结算单添加业务线,库存和销售出库绑定合同

jg-waiwang-pro
XI_TENG\xixi_ 3 months ago
parent 3976a2c0cf
commit 5c802b673d

@ -878,6 +878,16 @@ public class CwsettlementServiceImpl extends ServiceImpl<CwsettlementMapper, Cws
generaterSwapUtil.swapDatetime(CwsettlementConstant.getFormData(),cwsettlementForm),CwsettlementForm.class);
CwsettlementEntity entity = JsonUtil.getJsonToBean(cwsettlementForm, CwsettlementEntity.class);
if (cwsettlementForm.getCwsettlementcontractList()!=null){
QueryWrapper<ContractLEntity> contractLEntityQueryWrapper =new QueryWrapper<>();
contractLEntityQueryWrapper.lambda().eq(ContractLEntity::getId,cwsettlementForm.getCwsettlementcontractList().get(0).getContractId());
List<ContractLEntity> contractLEntityList=contractLService.list(contractLEntityQueryWrapper);
if (contractLEntityList!=null && contractLEntityList.size()>0){
entity.setBusinessLine(contractLEntityList.get(0).getBusinessId());
}
}
if(isSave){
String mainId = id ;
entity.setCode(generaterSwapUtil.getBillNumber("JSD", false));

@ -81,6 +81,8 @@ public class WarehousingOutboundServiceImpl extends ServiceImpl<WarehousingOutbo
private VoucherMapper voucherMapper;
@Resource
private WarehousingNotificationMapper warehousingNotificationMapper;
@Resource
private ContractRelationService contractRelationService;
@Override
public List<WarehousingOutboundEntity> getList(WarehousingOutboundPagination warehousingOutboundPagination){
return getTypeList(warehousingOutboundPagination,warehousingOutboundPagination.getDataType());
@ -685,6 +687,8 @@ public class WarehousingOutboundServiceImpl extends ServiceImpl<WarehousingOutbo
DeliveryOrderEntity deliveryOrder = deliveryOrderService.getInfo(deliveryOrderForm.getId());
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
String contractSale=null;
// warehousingOutboundForm = JsonUtil.getJsonToBean(
// generaterSwapUtil.swapDatetime(WarehousingOutboundConstant.getFormData(),warehousingOutboundForm),WarehousingOutboundForm.class);
// WarehousingOutboundEntity entity = JsonUtil.getJsonToBean(warehousingOutboundForm, WarehousingOutboundEntity.class);
@ -698,6 +702,7 @@ public class WarehousingOutboundServiceImpl extends ServiceImpl<WarehousingOutbo
BusinessOrderEntity businessOrderEntity = businessOrderService.getInfo(deliveryOrderForm.getBusinessId());
if (ObjectUtil.isNotEmpty(businessOrderEntity)){
entity.setBusinessOrderNo(businessOrderEntity.getCode()); //添加销售订单编号
contractSale=businessOrderEntity.getContractId();
}
}
entity.setWarehousingOutboundStatus("3");//已出库
@ -759,7 +764,7 @@ public class WarehousingOutboundServiceImpl extends ServiceImpl<WarehousingOutbo
if(inventoryList != null && inventoryList.size() > 0){
inventoryEntity = inventoryList.get(0);
inventoryEntity.setInventoryNumber(inventoryEntity.getInventoryNumber().subtract((entitys.getDeliveryNum())));//库存数量
inventoryEntity.setContractSaleId(contractSale);
if (deliveryType.equals("1")) {
inventoryEntity.setPurchasePrice(entitys.getReturnUnit());//平均采购单价
}else if (deliveryType.equals("2")){
@ -783,6 +788,8 @@ public class WarehousingOutboundServiceImpl extends ServiceImpl<WarehousingOutbo
inventoryEntity.setOrganizeJsonId(deliveryOrder.getOrganizeJsonId());
inventoryEntity.setCompanyId(deliveryOrder.getCompanyId());
inventoryEntity.setDepartmentId(deliveryOrder.getDepartmentId());
inventoryEntity.setContractSaleId(contractSale);
if (deliveryType.equals("1")) {
inventoryEntity.setPurchasePrice(entitys.getReturnUnit());//平均采购单价
}else if (deliveryType.equals("2")){
@ -792,6 +799,19 @@ public class WarehousingOutboundServiceImpl extends ServiceImpl<WarehousingOutbo
}
inventoryService.saveOrUpdate(inventoryEntity);
QueryWrapper<ContractRelationEntity> contractRelationQueryWrapper = new QueryWrapper<>();
contractRelationQueryWrapper.lambda().eq(ContractRelationEntity::getBusinessId, contractSale); //销售合同ud
contractRelationQueryWrapper.lambda().eq(ContractRelationEntity::getBusinessIds, inventoryEntity.getContractPurchaseId()); //采购合同id
List<ContractRelationEntity> contractRelationEntityList = contractRelationService.list(contractRelationQueryWrapper);
if(contractRelationEntityList != null && contractRelationEntityList.size() > 0){
//查询到则不做处理
}else {
ContractRelationEntity contractRelationEntity = new ContractRelationEntity();
contractRelationEntity.setBusinessId(contractSale);//合同主表id
contractRelationEntity.setBusinessIds(inventoryEntity.getContractPurchaseId()); //合同对应id
contractRelationService.saveOrUpdate(contractRelationEntity);
}
//更新库存流水
InventoryLogEntity inventoryLogEntity = new InventoryLogEntity();
inventoryLogEntity.setProductId(entitys.getProductId());

@ -749,11 +749,13 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
// WarehousingStorageEntity entity = JsonUtil.getJsonToBean(receiptOrderForm, WarehousingStorageEntity.class);
WarehousingStorageEntity entity = new WarehousingStorageEntity();
entity.setDocumentNo(generaterSwapUtil.getBillNumber("rukudanbianhao", false));
String contractPurchase=null;
if (receiptType.equals("1")) {
entity.setWarehousingStorageType("15");//采购收货单入库
BusinessOrderEntity businessOrderEntity = businessOrderService.getInfo(receiptOrderForm.getBusinessId());
if (ObjectUtil.isNotEmpty(businessOrderEntity)){
entity.setBusinessOrderNo(businessOrderEntity.getCode()); //添加采购订单编号
contractPurchase=businessOrderEntity.getContractId();
}
}else if (receiptType.equals("2")){
entity.setWarehousingStorageType("16");//销售收货单入库
@ -816,6 +818,8 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
inventoryEntity = inventoryList.get(0);
inventoryEntity.setInventoryNumber(inventoryEntity.getInventoryNumber().add((entitys.getDeliveryNum())));//库存数量
inventoryEntity.setSpec(entitys.getSpec());
inventoryEntity.setContractPurchaseId(contractPurchase);
}else{
inventoryEntity.setProductId(entitys.getProductId());
inventoryEntity.setCode(productWarehouseEntity.getCode());
@ -833,7 +837,7 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
inventoryEntity.setOrganizeJsonId(receiptOrder.getOrganizeJsonId());
inventoryEntity.setCompanyId(receiptOrder.getCompanyId());
inventoryEntity.setDepartmentId(receiptOrder.getDepartmentId());
inventoryEntity.setContractPurchaseId(contractPurchase);
if (receiptType.equals("1")) {
inventoryEntity.setPurchasePrice(entitys.getReturnUnit());//平均采购单价
}else if (receiptType.equals("2")){

@ -18,6 +18,8 @@ public class ContractRelationEntity {
private String id;
@TableField(value = "BUSINESS_ID" , updateStrategy = FieldStrategy.IGNORED)
private String businessId;
@TableField(value = "BUSINESS_IDS" , updateStrategy = FieldStrategy.IGNORED)
private String businessIds;
@TableField("PURCHASE_CONTRACT_CODE")
private String purchaseContractCode;
@TableField("PURCHASE_CONTRACT_NAME")

@ -176,4 +176,6 @@ public class CwsettlementEntity {
private String applyState;
@TableField(exist = false)
private String contractName;
@TableField(value = "BUSINESS_LINE" , updateStrategy = FieldStrategy.IGNORED)
private String businessLine;
}

@ -41,6 +41,10 @@ public class InventoryEntity {
private String storageAreaId;
@TableField(value = "BATCH_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String batchNumber;
@TableField(value = "CONTRACT_PURCHASE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String contractPurchaseId;
@TableField(value = "CONTRACT_SALE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String contractSaleId;
@TableField(value = "INVENTORY_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal inventoryNumber;
@TableField(value = "PURCHASE_PRICE" , updateStrategy = FieldStrategy.IGNORED)

@ -17,6 +17,10 @@ public class ContractRelationModel {
@JSONField(name = "businessId")
private Object businessId;
/** 主表id **/
@JSONField(name = "businessIds")
private Object businessIds;
/** 合同编码 **/
@JSONField(name = "purchaseContractCode")
private Object purchaseContractCode;

@ -170,4 +170,7 @@ public class CwsettlementForm {
private BigDecimal settlementSum;
@JsonProperty("applyState")
private String applyState;
@JsonProperty("businessLine")
private String businessLine;
}

@ -178,6 +178,18 @@
</template>
</el-table-column>
<!-- <el-table-column label="1" prop="buinessIds">
<template slot="header" v-if="false">
<span class="required-sign">*</span>1
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.buinessIds"
@change="changeData('voucherproduct-remark',scope.$index)" placeholder="请输入"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column> -->
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@ -406,6 +418,8 @@ export default {
purchaseContractCode: e.contractNumber,
purchaseContractName: e.contractName,
purchaseContractNo: e.contractNo,
buinessIds: e.id,
}
this.dataForm.contractRelationList.push(item)
}

Loading…
Cancel
Save