zhangyuewww 1 anno fa
parent
commit
4457e09630

+ 4 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/TranSettlementReport.java

@@ -235,6 +235,10 @@ public class TranSettlementReport extends BaseModel<TranSettlementReport> {
      * 手动修改扣款标识(1是)
      */
     private String manualIdentification;
+    /**
+     * 手动清空税点标识(1是)
+     */
+    private String manualTax;
     /**
      * 银行卡号
      */

+ 44 - 35
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranProcessInfoServiceImpl.java

@@ -75,7 +75,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
     @Autowired
     private ICommonStaffService staffService;
     @Autowired
-    private ICommonRoleResourceService roleResourceService;
+    private IWarehouseInOutInfoService warehouseInOutInfoService;
     @Autowired
     private IStockSaleReceiptReportService stockSaleReceiptReportService;
     @Autowired
@@ -688,51 +688,60 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                     //自运的销售合同
                     ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                             .eq("contract_no", tranProcessInfo1.getContractNo())
+                            .eq("comp_id", tranTaskInfo.getCompId())
                             .eq("deliver_type", "1")
                             .eq("delete_flag", "0"));
                     if (contractManagementInfo != null) {
                             if ("汽运".equals(tranProcessInfo1.getTranType())) {
-                                StockSaleReceiptReport stockSaleReceiptReport = stockSaleReceiptReportService.selectOne(new EntityWrapper<StockSaleReceiptReport>()
-                                        .eq("process_id", tranProcessInfo1.getId())
-                                        .eq("tran_car_no", tranCarInfo.getTranCarNo()));
-                                if (stockSaleReceiptReport != null) {
-                                    //现货销售出库报表
-                                    stockSaleReceiptReport.setFeedbackPerson(commonStaff.getStaffName());
-                                    stockSaleReceiptReport.setFeedbackDate(new Date());
-                                    stockSaleReceiptReport.setFeedbackWeight(Double.valueOf(String.valueOf(tranCarInfo.getUnloadNetWeight())));
-                                    //按收货重量结算时
-                                    if("2".equals(contractManagementInfo.getSettlementWeightMethod())&&tranCarInfo.getUnloadNetWeight() > 0){
-                                        stockSaleReceiptReport.setSettlementWeight(Double.valueOf(String.valueOf(tranCarInfo.getUnloadNetWeight())));
-                                        //定价销售
-                                        if(contractManagementInfo.getUnitContractPrice()!=null) {
-                                            stockSaleReceiptReport.setSettlementPrice(contractManagementInfo.getUnitContractPrice());
-                                            stockSaleReceiptReport.setAmountIngReceivable(tranCarInfo.getUnloadNetWeight()*
-                                                    (contractManagementInfo.getUnitContractPrice()));
-                                            stockSaleReceiptReport.setAmountEdReceivable(0.00);
-                                            stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
+                                WarehouseInOutInfo warehouseInOutInfo = warehouseInOutInfoService.selectOne(new EntityWrapper<WarehouseInOutInfo>()
+                                        .eq("car_id", tranCarInfo.getId()));
+                                if (warehouseInOutInfo != null) {
+                                    StockSaleReceiptReport stockSaleReceiptReport = stockSaleReceiptReportService.selectOne(new EntityWrapper<StockSaleReceiptReport>()
+                                            .eq("warehouse_record_id", warehouseInOutInfo.getId()));
+                                    if (stockSaleReceiptReport != null) {
+                                        //现货销售出库报表
+                                        stockSaleReceiptReport.setFeedbackPerson(commonStaff.getStaffName());
+                                        stockSaleReceiptReport.setFeedbackDate(new Date());
+                                        stockSaleReceiptReport.setFeedbackWeight(Double.valueOf(String.valueOf(tranCarInfo.getUnloadNetWeight())));
+                                        //按收货重量结算时
+                                        if ("2".equals(contractManagementInfo.getSettlementWeightMethod()) && tranCarInfo.getUnloadNetWeight() > 0) {
+                                            //扣重不为空
+                                            if (tranCarInfo.getDeductionWeight() != null) {
+                                                stockSaleReceiptReport.setSettlementWeight(Double.valueOf(String.valueOf(tranCarInfo.getUnloadNetWeight() - tranCarInfo.getDeductionWeight())));
+                                            } else {
+                                                stockSaleReceiptReport.setSettlementWeight(Double.valueOf(String.valueOf(tranCarInfo.getUnloadNetWeight())));
+                                            }
+                                            //定价销售
+                                            if (contractManagementInfo.getUnitContractPrice() != null) {
+                                                stockSaleReceiptReport.setSettlementPrice(contractManagementInfo.getUnitContractPrice());
+                                                stockSaleReceiptReport.setAmountIngReceivable(stockSaleReceiptReport.getSettlementWeight() *
+                                                        (contractManagementInfo.getUnitContractPrice()));
+                                                stockSaleReceiptReport.setAmountEdReceivable(0.00);
+                                                stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
+                                            }
+                                            //随行就市
+                                            else {
+                                                if (tranCarInfo.getContractPrice() != null) {
+                                                    stockSaleReceiptReport.setSettlementPrice(tranCarInfo.getContractPrice());
+                                                    stockSaleReceiptReport.setAmountIngReceivable(Double.valueOf(String.valueOf(stockSaleReceiptReport.getSettlementWeight() * tranCarInfo.getContractPrice())));
+                                                    stockSaleReceiptReport.setAmountEdReceivable(0.00);
+                                                    stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
+                                                }
+                                            }
                                         }
-                                        //随行就市
-                                        else {
-                                            if (tranCarInfo.getContractPrice()!=null) {
+                                        //按出库重量结算时
+                                        else if ("1".equals(contractManagementInfo.getSettlementWeightMethod())) {
+                                            //随行就市
+                                            if (contractManagementInfo.getUnitContractPrice() == null && tranCarInfo.getContractPrice() != null) {
                                                 stockSaleReceiptReport.setSettlementPrice(tranCarInfo.getContractPrice());
-                                                stockSaleReceiptReport.setAmountIngReceivable(Double.valueOf(String.valueOf(tranCarInfo.getUnloadNetWeight() *tranCarInfo.getContractPrice())));
+                                                stockSaleReceiptReport.setAmountIngReceivable(stockSaleReceiptReport.getSettlementWeight() *
+                                                        (tranCarInfo.getContractPrice()));
                                                 stockSaleReceiptReport.setAmountEdReceivable(0.00);
                                                 stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
                                             }
                                         }
+                                        stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
                                     }
-                                    //按出库重量结算时
-                                    else if("1".equals(contractManagementInfo.getSettlementWeightMethod())){
-                                        //随行就市
-                                        if(contractManagementInfo.getUnitContractPrice()==null&&tranCarInfo.getContractPrice()!=null) {
-                                            stockSaleReceiptReport.setSettlementPrice(tranCarInfo.getContractPrice());
-                                            stockSaleReceiptReport.setAmountIngReceivable(stockSaleReceiptReport.getSettlementWeight()*
-                                                    (tranCarInfo.getContractPrice()));
-                                            stockSaleReceiptReport.setAmountEdReceivable(0.00);
-                                            stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
-                                        }
-                                    }
-                                    stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
                                 }
                             }
                             else if ("火运".equals(tranProcessInfo1.getTranType())) {

+ 41 - 35
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java

@@ -1022,6 +1022,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //他运的销售合同
                         ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("deliver_type", "2")
                                 .eq("contract_type", "1")
                                 .eq("delete_flag", "0"));
@@ -1046,7 +1047,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             stockSaleReceiptReport.setReturnFlag("1");
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -1057,6 +1057,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //自运的销售合同
                         ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("contract_type", "1")
                                 .eq("deliver_type", "1")
                                 .eq("delete_flag", "0"));
@@ -1082,7 +1083,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             stockSaleReceiptReport.setReturnFlag("1");
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -1557,6 +1557,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //他运的销售合同
                         ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("deliver_type", "2")
                                 .eq("contract_type", "1")
                                 .eq("delete_flag", "0"));
@@ -1661,7 +1662,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             }
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -1672,6 +1672,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //自运的销售合同
                         ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("deliver_type", "1")
                                 .eq("contract_type", "1")
                                 .eq("delete_flag", "0"));
@@ -1860,7 +1861,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             stockSaleReceiptReport.setTare(Double.valueOf(String.valueOf(warehouseInOutInfo.getTare())));
                             stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
                             stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
-                            stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
                             //按出库重量结算时
                             if ("1".equals(contractManagementInfo1.getSettlementWeightMethod())) {
                                 stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
@@ -1875,7 +1875,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             }
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -2299,16 +2298,24 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         stockSaleReceiptReport.setGrossWeight(Double.valueOf(String.valueOf(warehouseInOutInfo.getGrossWeight())));
                         stockSaleReceiptReport.setTare(Double.valueOf(String.valueOf(warehouseInOutInfo.getTare())));
                         stockSaleReceiptReport.setNetWeight(Double.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                        stockSaleReceiptReport.setSettlementWeight(Double.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                        if (warehouseInOutInfo.getCost() != null) {
-                            stockSaleReceiptReport.setSettlementPrice(Double.valueOf(String.valueOf(warehouseInOutInfo.getCost())));
-                        } else {
-                            stockSaleReceiptReport.setSettlementPrice(0d);
+                        //查销售合同
+                        ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                                .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
+                                .eq("delete_flag", "0"));
+                        //按出库重量结算时
+                        if ("1".equals(contractManagementInfo1.getSettlementWeightMethod())) {
+                            stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
+                            //定价销售
+                            if (contractManagementInfo1.getUnitContractPrice() != null) {
+                                stockSaleReceiptReport.setSettlementPrice(contractManagementInfo1.getUnitContractPrice());
+                                stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getNetWeight() *
+                                        (contractManagementInfo1.getUnitContractPrice()));
+                                stockSaleReceiptReport.setAmountEdReceivable(0.00);
+                                stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
+                            }
                         }
-                        stockSaleReceiptReport.setAmountEdReceivable(0.0d);
                         stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
-                        stockSaleReceiptReport.setAmountIngReceivable(stockSaleReceiptReport.getSettlementPrice() * warehouseInOutInfo.getNetWeight());
-                        stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
                         stockSaleReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
                         stockSaleReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
                         stockSaleReceiptReportService.insert(stockSaleReceiptReport);
@@ -2334,11 +2341,11 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
 //                            stockSaleReceiptReportService.updateById(stockSaleReceiptReport);
 //                            workflowService.activateInstance(stockSaleReceiptReport.getWorkflowId(), stockSaleReceiptReport.getId());
 //                        }
-                        ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                                .eq("contract_no", warehouseBaseInfo.getWarehouseName()).eq("delete_flag", "0"));
-                        if (contractManagementInfo1 == null) {
-                            throw new YException(YExceptionEnum.CONTRACT_NO_NOT_EXSITS_ERROR);
-                        }
+//                        ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+//                                .eq("contract_no", warehouseBaseInfo.getWarehouseName()).eq("delete_flag", "0"));
+//                        if (contractManagementInfo1 == null) {
+//                            throw new YException(YExceptionEnum.CONTRACT_NO_NOT_EXSITS_ERROR);
+//                        }
                         Wrapper wrapper = new EntityWrapper<TranCarInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
                                 .eq("car_no", warehouseInOutInfo.getCarNo())
@@ -4215,6 +4222,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //他运的销售合同
                         ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("deliver_type", "2")
                                 .eq("contract_type", "1")
                                 .eq("delete_flag", "0"));
@@ -4239,7 +4247,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             stockSaleReceiptReport.setReturnFlag("1");
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -4250,6 +4257,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //自运的销售合同
                         ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("contract_type", "1")
                                 .eq("deliver_type", "1")
                                 .eq("delete_flag", "0"));
@@ -4275,7 +4283,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             stockSaleReceiptReport.setReturnFlag("1");
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -4836,6 +4843,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //他运的销售合同
                         ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("deliver_type", "2")
                                 .eq("contract_type", "1")
                                 .eq("delete_flag", "0"));
@@ -4941,7 +4949,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             }
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -4952,6 +4959,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //自运的销售合同
                         ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("deliver_type", "1")
                                 .eq("contract_type", "1")
                                 .eq("delete_flag", "0"));
@@ -5160,7 +5168,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             stockSaleReceiptReport.setTare(Double.valueOf(String.valueOf(warehouseInOutInfo.getTare())));
                             stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
                             stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
-                            stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
                             //按出库重量结算时
                             if ("1".equals(contractManagementInfo1.getSettlementWeightMethod())) {
                                 stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
@@ -5175,7 +5182,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             }
                             stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                             stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
-                            stockSaleReceiptReport.setSettlementWeight(stockSaleReceiptReport.getNetWeight());
                             CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
                             if (costManagementInfo != null) {
                                 stockSaleReceiptReport.setCost(costManagementInfo.getCost());
@@ -5633,13 +5639,12 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
 //                                workflowService.activateInstance(stockPurchaseReceiptReport.getWorkflowId(), stockPurchaseReceiptReport.getId());
 //                            }
                         }
-                        //他运销售合同
+                        //查询销售合同
                         ContractManagementInfo contractManagementInfoSale = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                                 .eq("contract_no", warehouseInOutInfo.getContractNo())
-                                .eq("deliver_type", "2")
+                                .eq("comp_id", warehouseBaseInfo.getCompId())
                                 .eq("contract_type", "1")
                                 .eq("delete_flag", "0"));
-
                         //现货销售出库报表
                         StockSaleReceiptReport stockSaleReceiptReport = new StockSaleReceiptReport();
                         stockSaleReceiptReport.setId(IdGenerator.generateUUID());
@@ -5651,17 +5656,18 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         stockSaleReceiptReport.setGrossWeight(Double.valueOf(String.valueOf(warehouseInOutInfo.getGrossWeight())));
                         stockSaleReceiptReport.setTare(Double.valueOf(String.valueOf(warehouseInOutInfo.getTare())));
                         stockSaleReceiptReport.setNetWeight(Double.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                        stockSaleReceiptReport.setSettlementWeight(Double.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                        if (contractManagementInfoSale!=null) {
-                            stockSaleReceiptReport.setSettlementPrice(Double.valueOf(String.valueOf(warehouseInOutInfo.getCost() == null ? (contractManagementInfoSale.getUnitContractPrice() == null ? 0 : contractManagementInfoSale.getUnitContractPrice()) : warehouseInOutInfo.getCost())));
-                        }
-                        else {
-                            stockSaleReceiptReport.setSettlementPrice(Double.valueOf(String.valueOf(warehouseInOutInfo.getCost() == null ? (contractManagementInfo.getUnitContractPrice() == null ? 0 : contractManagementInfo.getUnitContractPrice()) : warehouseInOutInfo.getCost())));
+                        //按出库重量结算时
+                        if ("1".equals(contractManagementInfoSale.getSettlementWeightMethod())) {
+                            stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
+                            //定价销售
+                            if (contractManagementInfoSale.getUnitContractPrice() != null) {
+                                stockSaleReceiptReport.setSettlementPrice(contractManagementInfoSale.getUnitContractPrice());
+                                stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getNetWeight() * contractManagementInfoSale.getUnitContractPrice());
+                                stockSaleReceiptReport.setAmountEdReceivable(0.00);
+                                stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
+                            }
                         }
-                        stockSaleReceiptReport.setAmountEdReceivable(0.0d);
                         stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
-                        stockSaleReceiptReport.setAmountIngReceivable(stockSaleReceiptReport.getSettlementPrice() * warehouseInOutInfo.getNetWeight());
-                        stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
                         stockSaleReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
                         stockSaleReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
                         stockSaleReceiptReportService.insert(stockSaleReceiptReport);

+ 22 - 15
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WeighingManagementServiceImpl.java

@@ -1557,6 +1557,7 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                 //他运的销售合同
                 ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                         .eq("contract_no", warehouseInOutInfo.getContractNo())
+                        .eq("comp_id", warehouseBaseInfo.getCompId())
                         .eq("deliver_type", "2")
                         .eq("contract_type", "1")
                         .eq("delete_flag", "0"));
@@ -1611,11 +1612,11 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                     //按出库重量结算时
                     if ("1".equals(contractManagementInfo.getSettlementWeightMethod())) {
                         stockSaleReceiptReport.setSettlementWeight(weighingManagement1.getSettleWeight());
+                        stockSaleReceiptReport.setSettlementPrice(weighingManagement1.getSettlePrice());
+                        stockSaleReceiptReport.setAmountIngReceivable(weighingManagement1.getSettleMoney());
+                        stockSaleReceiptReport.setAmountEdReceivable(0.00);
+                        stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
                     }
-                    stockSaleReceiptReport.setSettlementPrice(weighingManagement1.getSettlePrice());
-                    stockSaleReceiptReport.setAmountIngReceivable(weighingManagement1.getSettleMoney());
-                    stockSaleReceiptReport.setAmountEdReceivable(0.00);
-                    stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
                     stockSaleReceiptReport.setStatusFlag(StatusEnum.TO_BE_RECEIVED.getFlag());
                     stockSaleReceiptReport.setStatus(StatusEnum.TO_BE_RECEIVED.getName());
                     CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId()));
@@ -1628,6 +1629,7 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                 //自运的销售合同
                 ContractManagementInfo contractManagementInfo2 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                         .eq("contract_no", warehouseInOutInfo.getContractNo())
+                        .eq("comp_id", warehouseBaseInfo.getCompId())
                         .eq("deliver_type", "1")
                         .eq("contract_type", "1")
                         .eq("delete_flag", "0"));
@@ -1684,7 +1686,6 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                     stockSaleReceiptReport.setTare(Double.valueOf(String.valueOf(warehouseInOutInfo.getTare()!=null?warehouseInOutInfo.getTare():0f)));
                     stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
                     stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
-                    stockSaleReceiptReport.setSettlementWeight(weighingManagement1.getSettleWeight());
                     //按出库重量结算时
                     if ("1".equals(contractManagementInfo2.getSettlementWeightMethod())) {
                         stockSaleReceiptReport.setSettlementWeight(weighingManagement1.getSettleWeight());
@@ -1757,11 +1758,11 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
 //                            workflowService.activateInstance(stockPurchaseReceiptReport.getWorkflowId(), stockPurchaseReceiptReport.getId());
 //                        }
                     }
-//                    ContractManagementInfo contractManagementInfoSale = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-//                            .eq("contract_no", warehouseInOutInfo.getContractNo())
-//                            .eq("deliver_type", "2")
-//                            .eq("contract_type", "1")
-//                            .eq("delete_flag", "0"));
+                    //查销售合同
+                    ContractManagementInfo contractManagementInfoSale = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                            .eq("contract_no", warehouseInOutInfo.getContractNo())
+                            .eq("comp_id", warehouseBaseInfo.getCompId())
+                            .eq("delete_flag", "0"));
                     //现货销售出库报表
                     StockSaleReceiptReport stockSaleReceiptReport = new StockSaleReceiptReport();
                     stockSaleReceiptReport.setId(IdGenerator.generateUUID());
@@ -1773,12 +1774,18 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                     stockSaleReceiptReport.setGrossWeight(Double.valueOf(String.valueOf(warehouseInOutInfo.getGrossWeight()!=null?warehouseInOutInfo.getGrossWeight():0f)));
                     stockSaleReceiptReport.setTare(Double.valueOf(String.valueOf(warehouseInOutInfo.getTare()!=null?warehouseInOutInfo.getTare():0f)));
                     stockSaleReceiptReport.setNetWeight(warehouseInOutInfo.getNetWeight());
-                    stockSaleReceiptReport.setSettlementWeight(weighingManagement1.getSettleWeight());
-                    stockSaleReceiptReport.setSettlementPrice(weighingManagement1.getSettlePrice());
-                    stockSaleReceiptReport.setAmountEdReceivable(0.0d);
+                    //按出库重量结算时
+                    if ("1".equals(contractManagementInfoSale.getSettlementWeightMethod())) {
+                        stockSaleReceiptReport.setSettlementWeight(warehouseInOutInfo.getNetWeight());
+                        //定价销售
+                        if (contractManagementInfoSale.getUnitContractPrice() != null) {
+                            stockSaleReceiptReport.setSettlementPrice(contractManagementInfoSale.getUnitContractPrice());
+                            stockSaleReceiptReport.setAmountIngReceivable(warehouseInOutInfo.getNetWeight() * contractManagementInfoSale.getUnitContractPrice());
+                            stockSaleReceiptReport.setAmountEdReceivable(0.00);
+                            stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
+                        }
+                    }
                     stockSaleReceiptReport.setDeliveryDate(warehouseInOutInfo.getInOutDate());
-                    stockSaleReceiptReport.setAmountIngReceivable(weighingManagement1.getSettleMoney());
-                    stockSaleReceiptReport.setAmountNotReceivable(stockSaleReceiptReport.getAmountIngReceivable());
                     stockSaleReceiptReport.setStatusFlag(StatusEnum.FORM_REVIEWED.getFlag());
                     stockSaleReceiptReport.setStatus(StatusEnum.FORM_REVIEWED.getName());
                     stockSaleReceiptReportService.insert(stockSaleReceiptReport);