|
|
@ -1065,134 +1065,178 @@ public class CwsettlementServiceImpl extends ServiceImpl<CwsettlementMapper, Cws
|
|
|
|
settlementRelationPurchaseEntityQueryWrapper.lambda().eq(SettlementRelationPurchaseEntity::getPurchaseSettlementCode, entity.getCode());
|
|
|
|
settlementRelationPurchaseEntityQueryWrapper.lambda().eq(SettlementRelationPurchaseEntity::getPurchaseSettlementCode, entity.getCode());
|
|
|
|
settlementRelationPurchaseService.remove(settlementRelationPurchaseEntityQueryWrapper);
|
|
|
|
settlementRelationPurchaseService.remove(settlementRelationPurchaseEntityQueryWrapper);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SettlementRelationPurchaseEntity settlementRelationPurchaseEntity = new SettlementRelationPurchaseEntity();
|
|
|
|
SettlementRelationPurchaseEntity settlementRelationPurchaseEntity = new SettlementRelationPurchaseEntity();
|
|
|
|
for (CwsettlementaccountModel model : cwsettlementForm.getCwsettlementaccountList()) {
|
|
|
|
settlementRelationPurchaseEntity.setId(RandomUtil.uuId());
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPurchaseSettlementCode(entity.getCode()); //采购结算单
|
|
|
|
//采购结算
|
|
|
|
QueryWrapper<WarehousingStorageEntity> warehousingStorageQueryWrapper = new QueryWrapper<>();
|
|
|
|
QueryWrapper<CwaccountstorageEntity> cwaccountstorageQueryWrapper = new QueryWrapper<>();
|
|
|
|
warehousingStorageQueryWrapper.lambda().eq(WarehousingStorageEntity::getDocumentNo, tableField207.get(i).getDocmentNo());
|
|
|
|
cwaccountstorageQueryWrapper.lambda().eq(CwaccountstorageEntity::getAccountId, model.getAccountId());
|
|
|
|
warehousingStorageQueryWrapper.lambda().isNull(WarehousingStorageEntity::getDeleteMark);
|
|
|
|
cwaccountstorageQueryWrapper.lambda().isNull(CwaccountstorageEntity::getDeleteMark);
|
|
|
|
WarehousingStorageEntity warehousingStorageEntity = warehousingStorageService.getOne(warehousingStorageQueryWrapper);
|
|
|
|
List<CwaccountstorageEntity> cwaccountstorageEntityList = cwaccountstorageService.list(cwaccountstorageQueryWrapper);
|
|
|
|
if (ObjectUtil.isNotEmpty(warehousingStorageEntity)) {
|
|
|
|
for (CwaccountstorageEntity cwaccountstorage : cwaccountstorageEntityList) {
|
|
|
|
ReceiptOrderEntity receiptOrderEntity = receiptOrderService.getInfo(warehousingStorageEntity.getWarehousingId());
|
|
|
|
//入库单的采购订单
|
|
|
|
if (ObjectUtil.isNotEmpty(receiptOrderEntity)) {
|
|
|
|
QueryWrapper<WarehousingStorageEntity> warehousingStorageQueryWrapper = new QueryWrapper<>();
|
|
|
|
settlementRelationPurchaseEntity.setReceiptCode(receiptOrderEntity.getReceiptCode()); //收货单
|
|
|
|
warehousingStorageQueryWrapper.lambda().eq(WarehousingStorageEntity::getDocumentNo, cwaccountstorage.getDocumentNo());
|
|
|
|
|
|
|
|
warehousingStorageQueryWrapper.lambda().isNull(WarehousingStorageEntity::getDeleteMark);
|
|
|
|
|
|
|
|
List<WarehousingStorageEntity> warehousingStorageEntityList = warehousingStorageService.list(warehousingStorageQueryWrapper);
|
|
|
|
|
|
|
|
if (warehousingStorageEntityList != null && warehousingStorageEntityList.size() > 0) {
|
|
|
|
|
|
|
|
//收货单
|
|
|
|
|
|
|
|
QueryWrapper<ReceiptOrderEntity> receiptOrderEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
receiptOrderEntityQueryWrapper.lambda().eq(ReceiptOrderEntity::getId, warehousingStorageEntityList.get(0).getWarehousingId());
|
|
|
|
|
|
|
|
receiptOrderEntityQueryWrapper.lambda().isNull(ReceiptOrderEntity::getDeleteMark);
|
|
|
|
|
|
|
|
List<ReceiptOrderEntity> receiptOrderEntities = receiptOrderService.list(receiptOrderEntityQueryWrapper);
|
|
|
|
|
|
|
|
if (receiptOrderEntities != null && receiptOrderEntities.size() > 0) {
|
|
|
|
|
|
|
|
//采购订单
|
|
|
|
|
|
|
|
BusinessOrderEntity businessOrderEntity = businessOrderService.getInfo(receiptOrderEntities.get(0).getBusinessId());
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessOrderEntity)) {
|
|
|
|
|
|
|
|
//采购订单子表
|
|
|
|
|
|
|
|
QueryWrapper<BusinessOrderProductRelationalEntity> businessOrderSonQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
businessOrderSonQueryWrapper.lambda().eq(BusinessOrderProductRelationalEntity::getBusinessOrderId, businessOrderEntity.getId());
|
|
|
|
|
|
|
|
businessOrderSonQueryWrapper.lambda().isNull(BusinessOrderProductRelationalEntity::getDeleteMark);
|
|
|
|
|
|
|
|
List<BusinessOrderProductRelationalEntity> businessOrderProductRelationalEntityList = businessOrderProductRelationalService.list(businessOrderSonQueryWrapper);
|
|
|
|
|
|
|
|
for (BusinessOrderProductRelationalEntity businessSon : businessOrderProductRelationalEntityList) {
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPurchaseSettlementCode(entity.getCode()); //采购结算单
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setReceiptCode(receiptOrderEntities.get(0).getReceiptCode()); //收货单
|
|
|
|
|
|
|
|
//采购合同编号
|
|
|
|
|
|
|
|
ContractLEntity contractLEntity = contractLService.getInfo(businessOrderEntity.getContractId());
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(contractLEntity)) {
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setContract(contractLEntity.getContractNumber());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPurchaseCode(businessOrderEntity.getCode());
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setOrdLn(businessSon.getOrdLn()); //订单行
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSettlementSum(tableField207.get(i).getSettlementSum()); //结算量
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSettlementPrice(tableField207.get(i).getSettlementPrice()); //单价量
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSettlementCount(tableField207.get(i).getSettlementSubtotal()); //单价量
|
|
|
|
|
|
|
|
SubjectbasicEntity subjectbasicEntity = subjectbasicService.getInfo(businessOrderEntity.getFirstSubjectBasicId());
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(subjectbasicEntity)) {
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSupplier(subjectbasicEntity.getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BusinessLineEntity businessLineEntity = businessLineService.getInfo(businessOrderEntity.getBusinessLineId());
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessLineEntity)) {
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPurchaseBusinessLine(businessLineEntity.getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPaymentAmount(cwsettlementForm.getPaymentAmount()); //已付款金额
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setPurchaseBusinessLine(cwsettlementForm.getBusinessLine());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settlementRelationPurchaseService.saveOrUpdate(settlementRelationPurchaseEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else if(entity.getType().equals("2") && entity.getBusinessLine().equals("550709408384942213")){
|
|
|
|
QueryWrapper<BusinessOrderEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper.lambda().eq(BusinessOrderEntity::getCode,tableField207.get(i).getBusinessCode());
|
|
|
|
if(!isSave){
|
|
|
|
queryWrapper.lambda().isNull(BusinessOrderEntity::getDeleteMark);
|
|
|
|
QueryWrapper<SettlementRelationSaleEntity> settlementRelationPurchaseEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
BusinessOrderEntity businessOrderEntity = businessOrderService.getOne(queryWrapper);
|
|
|
|
settlementRelationPurchaseEntityQueryWrapper.lambda().eq(SettlementRelationSaleEntity::getSettlementCode, entity.getCode());
|
|
|
|
if (ObjectUtil.isNotEmpty(businessOrderEntity)) {
|
|
|
|
settlementRelationSaleService.remove(settlementRelationPurchaseEntityQueryWrapper);
|
|
|
|
//采购合同编号
|
|
|
|
|
|
|
|
ContractLEntity contractLEntity = contractLService.getInfo(businessOrderEntity.getContractId());
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(contractLEntity)) {
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setContract(contractLEntity.getContractNumber()); //合同号
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPurchaseCode(businessOrderEntity.getCode()); //采购单号
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setOrdLn(tableField207.get(i).getOrdLn()); //订单行
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSettlementSum(tableField207.get(i).getSettlementSum()); //结算量
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSettlementPrice(tableField207.get(i).getSettlementPrice()); //单价量
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSettlementCount(tableField207.get(i).getSettlementSubtotal()); //单价量
|
|
|
|
|
|
|
|
SubjectbasicEntity subjectbasicEntity = subjectbasicService.getInfo(businessOrderEntity.getFirstSubjectBasicId());
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(subjectbasicEntity)) {
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setSupplier(subjectbasicEntity.getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BusinessLineEntity businessLineEntity = businessLineService.getInfo(businessOrderEntity.getBusinessLineId());
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessLineEntity)) {
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPurchaseBusinessLine(businessLineEntity.getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntity.setPaymentAmount(cwsettlementForm.getPaymentAmount()); //已付款金额
|
|
|
|
|
|
|
|
settlementRelationPurchaseService.saveOrUpdate(settlementRelationPurchaseEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SettlementRelationSaleEntity settlementRelationSaleEntity=new SettlementRelationSaleEntity();
|
|
|
|
// for (CwsettlementaccountModel model : cwsettlementForm.getCwsettlementaccountList()) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// //采购结算
|
|
|
|
|
|
|
|
// QueryWrapper<CwaccountstorageEntity> cwaccountstorageQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
// cwaccountstorageQueryWrapper.lambda().eq(CwaccountstorageEntity::getAccountId, model.getAccountId());
|
|
|
|
|
|
|
|
// cwaccountstorageQueryWrapper.lambda().isNull(CwaccountstorageEntity::getDeleteMark);
|
|
|
|
|
|
|
|
// List<CwaccountstorageEntity> cwaccountstorageEntityList = cwaccountstorageService.list(cwaccountstorageQueryWrapper);
|
|
|
|
|
|
|
|
// for (CwaccountstorageEntity cwaccountstorage : cwaccountstorageEntityList) {
|
|
|
|
|
|
|
|
// //入库单的采购订单
|
|
|
|
|
|
|
|
// QueryWrapper<WarehousingStorageEntity> warehousingStorageQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
// warehousingStorageQueryWrapper.lambda().eq(WarehousingStorageEntity::getDocumentNo, cwaccountstorage.getDocumentNo());
|
|
|
|
|
|
|
|
// warehousingStorageQueryWrapper.lambda().isNull(WarehousingStorageEntity::getDeleteMark);
|
|
|
|
|
|
|
|
// List<WarehousingStorageEntity> warehousingStorageEntityList = warehousingStorageService.list(warehousingStorageQueryWrapper);
|
|
|
|
|
|
|
|
// if (warehousingStorageEntityList != null && warehousingStorageEntityList.size() > 0) {
|
|
|
|
|
|
|
|
// //收货单
|
|
|
|
|
|
|
|
// QueryWrapper<ReceiptOrderEntity> receiptOrderEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
// receiptOrderEntityQueryWrapper.lambda().eq(ReceiptOrderEntity::getId, warehousingStorageEntityList.get(0).getWarehousingId());
|
|
|
|
|
|
|
|
// receiptOrderEntityQueryWrapper.lambda().isNull(ReceiptOrderEntity::getDeleteMark);
|
|
|
|
|
|
|
|
// List<ReceiptOrderEntity> receiptOrderEntities = receiptOrderService.list(receiptOrderEntityQueryWrapper);
|
|
|
|
|
|
|
|
// if (receiptOrderEntities != null && receiptOrderEntities.size() > 0) {
|
|
|
|
|
|
|
|
// //采购订单
|
|
|
|
|
|
|
|
// BusinessOrderEntity businessOrderEntity = businessOrderService.getInfo(receiptOrderEntities.get(0).getBusinessId());
|
|
|
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(businessOrderEntity)) {
|
|
|
|
|
|
|
|
// //采购订单子表
|
|
|
|
|
|
|
|
// QueryWrapper<BusinessOrderProductRelationalEntity> businessOrderSonQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
// businessOrderSonQueryWrapper.lambda().eq(BusinessOrderProductRelationalEntity::getBusinessOrderId, businessOrderEntity.getId());
|
|
|
|
|
|
|
|
// businessOrderSonQueryWrapper.lambda().isNull(BusinessOrderProductRelationalEntity::getDeleteMark);
|
|
|
|
|
|
|
|
// List<BusinessOrderProductRelationalEntity> businessOrderProductRelationalEntityList = businessOrderProductRelationalService.list(businessOrderSonQueryWrapper);
|
|
|
|
|
|
|
|
// for (BusinessOrderProductRelationalEntity businessSon : businessOrderProductRelationalEntityList) {
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setId(RandomUtil.uuId());
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setPurchaseSettlementCode(entity.getCode()); //采购结算单
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setReceiptCode(receiptOrderEntities.get(0).getReceiptCode()); //收货单
|
|
|
|
|
|
|
|
// //采购合同编号
|
|
|
|
|
|
|
|
// ContractLEntity contractLEntity = contractLService.getInfo(businessOrderEntity.getContractId());
|
|
|
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(contractLEntity)) {
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setContract(contractLEntity.getContractNumber());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setPurchaseCode(businessOrderEntity.getCode());
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setOrdLn(businessSon.getOrdLn()); //订单行
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setSettlementSum(tableField207.get(i).getSettlementSum()); //结算量
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setSettlementPrice(tableField207.get(i).getSettlementPrice()); //单价量
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setSettlementCount(tableField207.get(i).getSettlementSubtotal()); //单价量
|
|
|
|
|
|
|
|
// SubjectbasicEntity subjectbasicEntity = subjectbasicService.getInfo(businessOrderEntity.getFirstSubjectBasicId());
|
|
|
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(subjectbasicEntity)) {
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setSupplier(subjectbasicEntity.getName());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// BusinessLineEntity businessLineEntity = businessLineService.getInfo(businessOrderEntity.getBusinessLineId());
|
|
|
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(businessLineEntity)) {
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setPurchaseBusinessLine(businessLineEntity.getName());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// settlementRelationPurchaseEntity.setPaymentAmount(cwsettlementForm.getPaymentAmount()); //已付款金额
|
|
|
|
|
|
|
|
// settlementRelationPurchaseService.saveOrUpdate(settlementRelationPurchaseEntity);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// throw new NullPointerException();
|
|
|
|
|
|
|
|
if(entity.getType().equals("2") && entity.getBusinessLine().equals("550709408384942213")){
|
|
|
|
|
|
|
|
|
|
|
|
for (CwsettlementaccountModel model : cwsettlementForm.getCwsettlementaccountList()) {
|
|
|
|
if(!isSave){
|
|
|
|
|
|
|
|
QueryWrapper<SettlementRelationSaleEntity> settlementRelationPurchaseEntityQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
settlementRelationPurchaseEntityQueryWrapper.lambda().eq(SettlementRelationSaleEntity::getSettlementCode, entity.getCode());
|
|
|
|
|
|
|
|
settlementRelationSaleService.remove(settlementRelationPurchaseEntityQueryWrapper);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (CwsettlementaccountModel model : cwsettlementForm.getCwsettlementaccountList()) {
|
|
|
|
|
|
|
|
//销售结算
|
|
|
|
|
|
|
|
QueryWrapper<CwaccountstorageEntity> cwaccountstorageQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
cwaccountstorageQueryWrapper.lambda().eq(CwaccountstorageEntity::getAccountId, model.getAccountId());
|
|
|
|
|
|
|
|
List<CwaccountstorageEntity> cwaccountstorageEntityList = cwaccountstorageService.list(cwaccountstorageQueryWrapper);
|
|
|
|
|
|
|
|
for (CwaccountstorageEntity cwaccountstorageEntity : cwaccountstorageEntityList) {
|
|
|
|
//销售结算
|
|
|
|
//销售结算
|
|
|
|
QueryWrapper<CwaccountstorageEntity> cwaccountstorageQueryWrapper = new QueryWrapper<>();
|
|
|
|
QueryWrapper<WarehousingOutboundEntity> warehousingOutboundQueryWrapper = new QueryWrapper<>();
|
|
|
|
cwaccountstorageQueryWrapper.lambda().eq(CwaccountstorageEntity::getAccountId, model.getAccountId());
|
|
|
|
warehousingOutboundQueryWrapper.lambda().eq(WarehousingOutboundEntity::getDocumentNo, cwaccountstorageEntity.getDocumentNo());
|
|
|
|
List<CwaccountstorageEntity> cwaccountstorageEntityList = cwaccountstorageService.list(cwaccountstorageQueryWrapper);
|
|
|
|
List<WarehousingOutboundEntity> warehousingOutboundEntityList = warehousingOutboundService.list(warehousingOutboundQueryWrapper);
|
|
|
|
for (CwaccountstorageEntity cwaccountstorageEntity : cwaccountstorageEntityList) {
|
|
|
|
if (warehousingOutboundEntityList != null && warehousingOutboundEntityList.size() > 0) {
|
|
|
|
//销售结算
|
|
|
|
//发货单
|
|
|
|
QueryWrapper<WarehousingOutboundEntity> warehousingOutboundQueryWrapper = new QueryWrapper<>();
|
|
|
|
DeliveryOrderEntity deliveryOrderEntity = deliveryOrderService.getInfo(warehousingOutboundEntityList.get(0).getWarehousingId());
|
|
|
|
warehousingOutboundQueryWrapper.lambda().eq(WarehousingOutboundEntity::getDocumentNo, cwaccountstorageEntity.getDocumentNo());
|
|
|
|
if (ObjectUtil.isNotEmpty(deliveryOrderEntity)) {
|
|
|
|
List<WarehousingOutboundEntity> warehousingOutboundEntityList = warehousingOutboundService.list(warehousingOutboundQueryWrapper);
|
|
|
|
BusinessOrderEntity businessOrderEntity = businessOrderService.getInfo(deliveryOrderEntity.getBusinessId());
|
|
|
|
if (warehousingOutboundEntityList != null && warehousingOutboundEntityList.size() > 0) {
|
|
|
|
List<WarehousingOutboundProductEntity> warehousingOutboundProductList = warehousingOutboundProductService.queryOutboundProductPurchase(warehousingOutboundEntityList.get(0).getId());
|
|
|
|
//发货单
|
|
|
|
for (WarehousingOutboundProductEntity warehousingOutboundProductEntity : warehousingOutboundProductList) {
|
|
|
|
DeliveryOrderEntity deliveryOrderEntity = deliveryOrderService.getInfo(warehousingOutboundEntityList.get(0).getWarehousingId());
|
|
|
|
SettlementRelationSaleEntity settlementRelationSaleEntity=new SettlementRelationSaleEntity();
|
|
|
|
if (ObjectUtil.isNotEmpty(deliveryOrderEntity)) {
|
|
|
|
settlementRelationSaleEntity.setId(RandomUtil.uuId());
|
|
|
|
BusinessOrderEntity businessOrderEntity = businessOrderService.getInfo(deliveryOrderEntity.getBusinessId());
|
|
|
|
settlementRelationSaleEntity.setPurchaseCode(warehousingOutboundProductEntity.getCode()); //采购订单
|
|
|
|
List<WarehousingOutboundProductEntity> warehousingOutboundProductList = warehousingOutboundProductService.queryOutboundProductPurchase(model.getAccountId());
|
|
|
|
settlementRelationSaleEntity.setContract(warehousingOutboundProductEntity.getContractName()); //采购合同编号
|
|
|
|
for (WarehousingOutboundProductEntity warehousingOutboundProductEntity : warehousingOutboundProductList) {
|
|
|
|
settlementRelationSaleEntity.setSupplier(warehousingOutboundProductEntity.getName()); //供应商
|
|
|
|
settlementRelationSaleEntity.setPurchaseCode(warehousingOutboundProductEntity.getCode()); //采购订单
|
|
|
|
settlementRelationSaleEntity.setOrdLn(warehousingOutboundProductEntity.getOrdLnPurchase()); //供应商
|
|
|
|
settlementRelationSaleEntity.setContract(warehousingOutboundProductEntity.getContractName()); //采购合同编号
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSupplier(warehousingOutboundProductEntity.getName()); //供应商
|
|
|
|
settlementRelationSaleEntity.setSettlementCode(entity.getCode()); //销售结算单
|
|
|
|
settlementRelationSaleEntity.setOrdLn(warehousingOutboundProductEntity.getOrdLn()); //供应商
|
|
|
|
settlementRelationSaleEntity.setDeliveryCode(deliveryOrderEntity.getDeliveryCode()); //发货单
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessOrderEntity)){
|
|
|
|
settlementRelationSaleEntity.setSettlementCode(entity.getCode()); //销售结算单
|
|
|
|
settlementRelationSaleEntity.setSaleCode(businessOrderEntity.getCode());
|
|
|
|
settlementRelationSaleEntity.setDeliveryCode(deliveryOrderEntity.getDeliveryCode()); //发货单
|
|
|
|
ContractLEntity contractLEntity = contractLService.getInfo(businessOrderEntity.getContractId());
|
|
|
|
if (ObjectUtil.isNotEmpty(businessOrderEntity)){
|
|
|
|
SubjectbasicEntity subjectbasicEntity = subjectbasicService.getInfo(businessOrderEntity.getFirstSubjectBasicId());
|
|
|
|
settlementRelationSaleEntity.setSaleCode(businessOrderEntity.getCode());
|
|
|
|
BusinessLineEntity businessLineEntity = businessLineService.getInfo(businessOrderEntity.getBusinessLineId());
|
|
|
|
ContractLEntity contractLEntity = contractLService.getInfo(businessOrderEntity.getContractId());
|
|
|
|
if (ObjectUtil.isNotEmpty(contractLEntity)){
|
|
|
|
SubjectbasicEntity subjectbasicEntity = subjectbasicService.getInfo(businessOrderEntity.getFirstSubjectBasicId());
|
|
|
|
settlementRelationSaleEntity.setSaleContract(contractLEntity.getContractNumber());//合同号
|
|
|
|
BusinessLineEntity businessLineEntity = businessLineService.getInfo(businessOrderEntity.getBusinessLineId());
|
|
|
|
}
|
|
|
|
if (ObjectUtil.isNotEmpty(contractLEntity)){
|
|
|
|
if(ObjectUtil.isNotEmpty(subjectbasicEntity)) {
|
|
|
|
settlementRelationSaleEntity.setSaleContract(contractLEntity.getContractNumber());//合同号
|
|
|
|
settlementRelationSaleEntity.setCustomer(subjectbasicEntity.getName());//客户
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(ObjectUtil.isNotEmpty(subjectbasicEntity)) {
|
|
|
|
if (ObjectUtil.isNotEmpty(businessLineEntity)){
|
|
|
|
settlementRelationSaleEntity.setCustomer(subjectbasicEntity.getName());//客户
|
|
|
|
settlementRelationSaleEntity.setPurchaseBusinessLine(businessLineEntity.getName());//业务线
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(businessLineEntity)){
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setPurchaseBusinessLine(businessLineEntity.getName());//业务线
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSaleOrdLn(tableField207.get(i).getOrdLn()); //订单行
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSaleSettlementSum(tableField207.get(i).getSettlementSum()); //结算量
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSettlementPrice(tableField207.get(i).getSettlementPrice()); //单价量
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSettlementCount(tableField207.get(i).getSettlementSubtotal()); //单价量
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setPaymentAmount(cwsettlementForm.getPaymentAmount()); //已收款金额
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSaleOrdLn(warehousingOutboundProductEntity.getOrdLn()); //销售订单行
|
|
|
|
|
|
|
|
QueryWrapper<CwsettlementsummaryEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
queryWrapper.lambda().eq(CwsettlementsummaryEntity::getSettlementId,entity.getId());
|
|
|
|
|
|
|
|
queryWrapper.lambda().eq(CwsettlementsummaryEntity::getBusinessCode,businessOrderEntity.getCode());
|
|
|
|
|
|
|
|
queryWrapper.lambda().eq(CwsettlementsummaryEntity::getOrdLn,warehousingOutboundProductEntity.getOrdLn());
|
|
|
|
|
|
|
|
CwsettlementsummaryEntity cwsettlementsummaryEntity = cwsettlementsummaryService.getOne(queryWrapper);
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(cwsettlementsummaryEntity)) {
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSaleSettlementSum(cwsettlementsummaryEntity.getSettlementSum());
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSettlementSum(cwsettlementsummaryEntity.getSettlementSum()); //结算量
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSettlementPrice(cwsettlementsummaryEntity.getSettlementPrice()); //单价量
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setSettlementCount(cwsettlementsummaryEntity.getSettlementSubtotal()); //结算金额
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
settlementRelationSaleEntity.setPaymentAmount(cwsettlementForm.getPaymentAmount()); //已收款金额
|
|
|
|
settlementRelationSaleService.saveOrUpdate(settlementRelationSaleEntity);
|
|
|
|
settlementRelationSaleService.saveOrUpdate(settlementRelationSaleEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|