zhangyuewww vor 1 Jahr
Ursprung
Commit
91aa8308d6

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

@@ -1040,80 +1040,107 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
         if (weighingManagement1 != null){
             weighingManagement1.setInOutTaskNo(weighingManagement.getInOutTaskNo());
             weighingManagement1.setContractNo(weighingManagement.getContractNo());
-            this.updateById(weighingManagement1);
-        }
-        //查询质检信息
-        QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
-                .eq("relation_id",weighingManagement1.getRelationId())
-                .eq("delete_flag","0"));
-        if (qualityInspectionManagement != null){
-            qualityInspectionManagement.setInOutTaskNo(weighingManagement.getInOutTaskNo());
-            qualityInspectionManagement.setContractNo(weighingManagement.getContractNo());
-            qualityInspectionManagementService.updateById(qualityInspectionManagement);
-        }
-        //查询出入库信息
-        WarehouseInOutInfo warehouseInOutInfo = warehouseInOutInfoService.selectOne(new EntityWrapper<WarehouseInOutInfo>()
-                .eq("id",weighingManagement1.getWarehouseInOutId())
-                .eq("delete_flag","0"));
-        if (warehouseInOutInfo != null){
-            warehouseInOutInfo.setInOutTaskNo(weighingManagement.getInOutTaskNo());
-            warehouseInOutInfo.setContractNo(weighingManagement.getContractNo());
-            if (warehouseInOutInfo.getCarId()!=null){
-                TranCarInfo tranCarInfo=tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
-                TranTaskInfo tranTaskInfo = tranTaskInfoService.selectOne(new EntityWrapper<TranTaskInfo>()
-                        .eq("comp_id", weighingManagement1.getCompId())
-                        .eq("contract_no", warehouseInOutInfo.getContractNo()));
-                if (tranTaskInfo != null) {
-                    TranProcessInfo tranProcessInfo = tranProcessInfoService.selectOne(new EntityWrapper<TranProcessInfo>()
-                            .eq("info_id", tranTaskInfo.getId()));
-                    tranCarInfo.setProcessId(tranProcessInfo.getId());
-                    tranCarInfo.setTranPrice(String.valueOf(tranProcessInfo.getTranPrice() != null ? tranProcessInfo.getTranPrice() : 0f));
-                    warehouseInOutInfo.setFreight(tranProcessInfo.getTranPrice());
-                    warehouseInOutInfo.setTaskNo(tranTaskInfo.getTaskNo());
-                    tranCarInfo.setInfoId(tranTaskInfo.getId());
-                    ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                            .eq("contract_no", warehouseInOutInfo.getContractNo()).eq("delete_flag", "0"));
-                    if (contractManagementInfo1 != null) {
-                        tranCarInfo.setCost(contractManagementInfo1.getUnitContractPrice());
-                    } else {
-                        //出库时打入成本
-                        CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
-                                .eq("goods_name", warehouseInOutInfo.getGoodsName()));
-                        if (costManagementInfo != null) {
-                            tranCarInfo.setCost(costManagementInfo.getCost());
+            InOutWarehouseTask inOutWarehouseTask=inOutWarehouseTaskService.selectOne(new EntityWrapper<InOutWarehouseTask>()
+                    .eq("in_out_task_no",weighingManagement.getInOutTaskNo())
+                    .eq("comp_id",weighingManagement1.getCompId()));
+            weighingManagement1.setGoodsNameKey(inOutWarehouseTask.getGoodsNameKey());
+            weighingManagement1.setGoodsName(inOutWarehouseTask.getGoodsName());
+            if(inOutWarehouseTask.getGoodsName()!= null && inOutWarehouseTask.getGoodsName().contains("潮粮")) {
+                weighingManagement1.setType("潮粮");
+            }
+            else{
+                weighingManagement1.setType("干粮");
+            }
+            //查询质检信息
+            QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
+                    .eq("relation_id",weighingManagement1.getRelationId())
+                    .eq("delete_flag","0"));
+            if (qualityInspectionManagement != null){
+                qualityInspectionManagement.setGoodsNameKey(inOutWarehouseTask.getGoodsNameKey());
+                qualityInspectionManagement.setGoodsName(inOutWarehouseTask.getGoodsName());
+                if(inOutWarehouseTask.getGoodsName()!= null && inOutWarehouseTask.getGoodsName().contains("潮粮")) {
+                    qualityInspectionManagement.setType("潮粮");
+                }
+                else{
+                    qualityInspectionManagement.setType("干粮");
+                }
+                qualityInspectionManagement.setInOutTaskNo(weighingManagement.getInOutTaskNo());
+                qualityInspectionManagement.setContractNo(weighingManagement.getContractNo());
+                qualityInspectionManagementService.updateById(qualityInspectionManagement);
+            }
+            //查询出入库信息
+            WarehouseInOutInfo warehouseInOutInfo = warehouseInOutInfoService.selectOne(new EntityWrapper<WarehouseInOutInfo>()
+                    .eq("id",weighingManagement1.getWarehouseInOutId())
+                    .eq("delete_flag","0"));
+            if (warehouseInOutInfo != null){
+                warehouseInOutInfo.setInOutTaskNo(weighingManagement.getInOutTaskNo());
+                warehouseInOutInfo.setContractNo(weighingManagement.getContractNo());
+                warehouseInOutInfo.setGoodsNameKey(inOutWarehouseTask.getGoodsNameKey());
+                warehouseInOutInfo.setGoodsName(inOutWarehouseTask.getGoodsName());
+                if(inOutWarehouseTask.getGoodsName()!= null && inOutWarehouseTask.getGoodsName().contains("潮粮")) {
+                    warehouseInOutInfo.setType("潮粮");
+                }
+                else{
+                    warehouseInOutInfo.setType("干粮");
+                }
+                if (warehouseInOutInfo.getCarId()!=null){
+                    TranCarInfo tranCarInfo=tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
+                    TranTaskInfo tranTaskInfo = tranTaskInfoService.selectOne(new EntityWrapper<TranTaskInfo>()
+                            .eq("comp_id", weighingManagement1.getCompId())
+                            .eq("contract_no", warehouseInOutInfo.getContractNo()));
+                    if (tranTaskInfo != null) {
+                        TranProcessInfo tranProcessInfo = tranProcessInfoService.selectOne(new EntityWrapper<TranProcessInfo>()
+                                .eq("info_id", tranTaskInfo.getId()));
+                        tranCarInfo.setProcessId(tranProcessInfo.getId());
+                        tranCarInfo.setTranPrice(String.valueOf(tranProcessInfo.getTranPrice() != null ? tranProcessInfo.getTranPrice() : 0f));
+                        warehouseInOutInfo.setFreight(tranProcessInfo.getTranPrice());
+                        warehouseInOutInfo.setTaskNo(tranTaskInfo.getTaskNo());
+                        tranCarInfo.setInfoId(tranTaskInfo.getId());
+                        ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                                .eq("contract_no", warehouseInOutInfo.getContractNo()).eq("delete_flag", "0"));
+                        if (contractManagementInfo1 != null) {
+                            tranCarInfo.setCost(contractManagementInfo1.getUnitContractPrice());
+                        } else {
+                            //出库时打入成本
+                            CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
+                                    .eq("goods_name", warehouseInOutInfo.getGoodsName()));
+                            if (costManagementInfo != null) {
+                                tranCarInfo.setCost(costManagementInfo.getCost());
+                            }
+                        }
+                        List<TranCarInfo> tranCarInfoList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
+                                .eq("info_id", tranTaskInfo.getId()));
+                        String tranCarNo = "";
+                        if ((tranCarInfoList.size() + 1) < 10) {
+                            tranCarNo = "C00" + (tranCarInfoList.size() + 1);
+                        } else if (tranCarInfoList.size() + 1 < 100) {
+                            tranCarNo = "C0" + (tranCarInfoList.size() + 1);
+                        } else {
+                            tranCarNo = "C" + (tranCarInfoList.size() + 1);
+                        }
+                        tranCarInfo.setTranCarNo(tranCarNo);
+                        tranCarInfo.setContractNo(warehouseInOutInfo.getContractNo());
+                        warehouseInOutInfo.setTranCarNo(tranCarNo);
+                        tranCarInfoService.updateById(tranCarInfo);
+                        TranSettlementReport tranSettlementReport=tranSettlementReportService.selectOne(new EntityWrapper<TranSettlementReport>()
+                                .eq("car_id", tranCarInfo.getId()));
+                        if (tranSettlementReport!=null){
+                            tranSettlementReport.setContractNo(weighingManagement.getContractNo());
+                            tranSettlementReport.setTranCarNo(tranCarNo);
+                            tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
+                            tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
+                            tranSettlementReportService.updateById(tranSettlementReport);
                         }
-                    }
-                    List<TranCarInfo> tranCarInfoList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
-                            .eq("info_id", tranTaskInfo.getId()));
-                    String tranCarNo = "";
-                    if ((tranCarInfoList.size() + 1) < 10) {
-                        tranCarNo = "C00" + (tranCarInfoList.size() + 1);
-                    } else if (tranCarInfoList.size() + 1 < 100) {
-                        tranCarNo = "C0" + (tranCarInfoList.size() + 1);
                     } else {
-                        tranCarNo = "C" + (tranCarInfoList.size() + 1);
-                    }
-                    tranCarInfo.setTranCarNo(tranCarNo);
-                    tranCarInfo.setContractNo(warehouseInOutInfo.getContractNo());
-                    warehouseInOutInfo.setTranCarNo(tranCarNo);
-                    tranCarInfoService.updateById(tranCarInfo);
-                    TranSettlementReport tranSettlementReport=tranSettlementReportService.selectOne(new EntityWrapper<TranSettlementReport>()
-                            .eq("car_id", tranCarInfo.getId()));
-                    if (tranSettlementReport!=null){
-                        tranSettlementReport.setContractNo(weighingManagement.getContractNo());
-                        tranSettlementReport.setTranCarNo(tranCarNo);
-                        tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
-                        tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
-                        tranSettlementReportService.updateById(tranSettlementReport);
+                        throw new YException(YExceptionEnum.TRANTASK_NOT_CREATED_ERROR);
                     }
-                } else {
-                    throw new YException(YExceptionEnum.TRANTASK_NOT_CREATED_ERROR);
                 }
+                warehouseInOutInfoService.updateById(warehouseInOutInfo);
             }
-            warehouseInOutInfoService.updateById(warehouseInOutInfo);
+            cacheComponent.delPrefixKey(Const.ADMIN_WEIGHINGINFO,weighingManagement1.getCompId());
+            cacheComponent.delPrefixKey(Const.ADMIN_WEIGHINGINFO_NUM,weighingManagement1.getCompId());
+            this.updateById(weighingManagement1);
         }
-        cacheComponent.delPrefixKey(Const.ADMIN_WEIGHINGINFO,weighingManagement1.getCompId());
-        cacheComponent.delPrefixKey(Const.ADMIN_WEIGHINGINFO_NUM,weighingManagement1.getCompId());
         return "ok";
     }