zhangyuewww 2 vuotta sitten
vanhempi
commit
dbb014b886

+ 74 - 60
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ContractManagementInfoServiceImpl.java

@@ -3005,67 +3005,81 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
                 contractManagementInfo.setInOutType("退库");
                 contractManagementInfo.setInOutType("退库");
             }
             }
             else {
             else {
-                InOutWarehouseTask inOutWarehouseTask = inOutWarehouseTaskService.selectOne(new EntityWrapper<InOutWarehouseTask>()
-                        .eq("comp_id", compId)
-                        .eq("delete_flag", "0")
-                        .eq("task_type_key", "3")
-                        .eq("task_status_key", "5")
-                        .eq("in_out_flag", "1")
-                        .eq("move_task_no",contractNo));
-               if (inOutWarehouseTask!=null) {
-                    ContractManagementInfo contractManagementInfo1 = new ContractManagementInfo();
-                    BeanUtils.copyProperties(inOutWarehouseTask, contractManagementInfo1);
-                    //查移库任务编号下的车牌号,入库只能查到已出库的
-                    List<TranCarInfo> tranCarInfoList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
-                            .eq("contract_no", inOutWarehouseTask.getMoveTaskNo()).eq("fleet_flag", "0").eq("tran_type", "1").eq("submit", "1")
-                            .last("ORDER BY CONVERT ( car_no USING gbk ) ASC"));
-                    if (!org.springframework.util.CollectionUtils.isEmpty(tranCarInfoList)) {
-                        contractManagementInfo1.setTranCarInfoList(tranCarInfoList);
-                    }
-                    List<TranCarInfo> tranCarInfoList1 = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
-                            .eq("contract_no", inOutWarehouseTask.getMoveTaskNo()).eq("fleet_flag", "1").eq("tran_type", "1")
-                            .last("ORDER BY CONVERT ( fleet_name USING gbk ) ASC"));
-                    if (!org.springframework.util.CollectionUtils.isEmpty(tranCarInfoList1)) {
-                        contractManagementInfo1.setTranCarInfoList1(tranCarInfoList1);
-                    }
-                    //查船名
-                    Wrapper<TranCarInfo> shipListWrapper = new EntityWrapper<>();
-                    shipListWrapper.eq("contract_no", inOutWarehouseTask.getMoveTaskNo())
-                            .eq("delete_flag", "0");
-                    shipListWrapper.andNew().eq("tran_type", "3").or()
-                            .eq("three_tran_type", "散船");
-                    List<TranCarInfo> shipInfoList = tranCarInfoService.selectList(shipListWrapper);
-                    if (!org.springframework.util.CollectionUtils.isEmpty(shipInfoList)) {
-                        contractManagementInfo1.setShipInfoList(shipInfoList);
-                    }
-                    //查火运流向
-                    List<TranCarInfo> fireList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
-                            .eq("contract_no", inOutWarehouseTask.getMoveTaskNo())
-                            .eq("tran_type", "2")
-                            .eq("delete_flag", "0"));
-                    if (!org.springframework.util.CollectionUtils.isEmpty(fireList)) {
-                        contractManagementInfo1.setFireDirectionList(fireList);
-                    }
-                    contractManagementInfo1.setContractNo(inOutWarehouseTask.getMoveTaskNo());
-                    ContractManagementInfo contractManagementInfo2 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                            .eq("contract_no", inOutWarehouseTask.getWarehouseName())
-                            .eq("comp_id", inOutWarehouseTask.getCompId()));
-                    if (contractManagementInfo2 != null && contractManagementInfo2.getUnitContractPrice() != null) {
-                        contractManagementInfo1.setContractPrice(Float.valueOf(String.valueOf(contractManagementInfo2.getUnitContractPrice())));
-                    }
-                    //自运采购的移库
-                    ContractManagementInfo contractManagementInfo3 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                            .eq("comp_id", inOutWarehouseTask.getCompId())
-                            .eq("contract_no", inOutWarehouseTask.getSendWarehouse()));
-                    if (contractManagementInfo3 != null && contractManagementInfo3.getUnitContractPrice() != null) {
-                        contractManagementInfo1.setContractPrice(Float.valueOf(String.valueOf(contractManagementInfo3.getUnitContractPrice())));
+                contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                    .eq("comp_id", compId)
+                    .eq("contract_type", "3")
+                    .eq("status_flag", "1")
+                    .eq("delete_flag", "0")
+                    .orderBy("update_date", false));
+                if (contractManagementInfo!=null){
+                    ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>()
+                            .eq("contract_id", contractManagementInfo.getId()));
+                    contractManagementInfo.setGoodsName(contractGoodsInfo.getGoodsName());
+                    contractManagementInfo.setGoodsNameKey(contractGoodsInfo.getGoodsNameKey());
+                }
+                else {
+                    InOutWarehouseTask inOutWarehouseTask = inOutWarehouseTaskService.selectOne(new EntityWrapper<InOutWarehouseTask>()
+                            .eq("comp_id", compId)
+                            .eq("delete_flag", "0")
+                            .eq("task_type_key", "3")
+                            .eq("task_status_key", "5")
+                            .eq("in_out_flag", "1")
+                            .eq("move_task_no",contractNo));
+                    if (inOutWarehouseTask!=null) {
+                        ContractManagementInfo contractManagementInfo1 = new ContractManagementInfo();
+                        BeanUtils.copyProperties(inOutWarehouseTask, contractManagementInfo1);
+                        //查移库任务编号下的车牌号,入库只能查到已出库的
+                        List<TranCarInfo> tranCarInfoList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
+                                .eq("contract_no", inOutWarehouseTask.getMoveTaskNo()).eq("fleet_flag", "0").eq("tran_type", "1").eq("submit", "1")
+                                .last("ORDER BY CONVERT ( car_no USING gbk ) ASC"));
+                        if (!org.springframework.util.CollectionUtils.isEmpty(tranCarInfoList)) {
+                            contractManagementInfo1.setTranCarInfoList(tranCarInfoList);
+                        }
+                        List<TranCarInfo> tranCarInfoList1 = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
+                                .eq("contract_no", inOutWarehouseTask.getMoveTaskNo()).eq("fleet_flag", "1").eq("tran_type", "1")
+                                .last("ORDER BY CONVERT ( fleet_name USING gbk ) ASC"));
+                        if (!org.springframework.util.CollectionUtils.isEmpty(tranCarInfoList1)) {
+                            contractManagementInfo1.setTranCarInfoList1(tranCarInfoList1);
+                        }
+                        //查船名
+                        Wrapper<TranCarInfo> shipListWrapper = new EntityWrapper<>();
+                        shipListWrapper.eq("contract_no", inOutWarehouseTask.getMoveTaskNo())
+                                .eq("delete_flag", "0");
+                        shipListWrapper.andNew().eq("tran_type", "3").or()
+                                .eq("three_tran_type", "散船");
+                        List<TranCarInfo> shipInfoList = tranCarInfoService.selectList(shipListWrapper);
+                        if (!org.springframework.util.CollectionUtils.isEmpty(shipInfoList)) {
+                            contractManagementInfo1.setShipInfoList(shipInfoList);
+                        }
+                        //查火运流向
+                        List<TranCarInfo> fireList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
+                                .eq("contract_no", inOutWarehouseTask.getMoveTaskNo())
+                                .eq("tran_type", "2")
+                                .eq("delete_flag", "0"));
+                        if (!org.springframework.util.CollectionUtils.isEmpty(fireList)) {
+                            contractManagementInfo1.setFireDirectionList(fireList);
+                        }
+                        contractManagementInfo1.setContractNo(inOutWarehouseTask.getMoveTaskNo());
+                        ContractManagementInfo contractManagementInfo2 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                                .eq("contract_no", inOutWarehouseTask.getWarehouseName())
+                                .eq("comp_id", inOutWarehouseTask.getCompId()));
+                        if (contractManagementInfo2 != null && contractManagementInfo2.getUnitContractPrice() != null) {
+                            contractManagementInfo1.setContractPrice(Float.valueOf(String.valueOf(contractManagementInfo2.getUnitContractPrice())));
+                        }
+                        //自运采购的移库
+                        ContractManagementInfo contractManagementInfo3 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                                .eq("comp_id", inOutWarehouseTask.getCompId())
+                                .eq("contract_no", inOutWarehouseTask.getSendWarehouse()));
+                        if (contractManagementInfo3 != null && contractManagementInfo3.getUnitContractPrice() != null) {
+                            contractManagementInfo1.setContractPrice(Float.valueOf(String.valueOf(contractManagementInfo3.getUnitContractPrice())));
+                        }
+                        //移库看成自运
+                        contractManagementInfo1.setDeliverType("1");
+                        contractManagementInfo1.setSendWarehouse(inOutWarehouseTask.getSendWarehouse());
+                        contractManagementInfo1.setGrade(inOutWarehouseTask.getGrade());
+                        contractManagementInfo1.setInOutType("移库入库");
+                        return contractManagementInfo1;
                     }
                     }
-                    //移库看成自运
-                    contractManagementInfo1.setDeliverType("1");
-                    contractManagementInfo1.setSendWarehouse(inOutWarehouseTask.getSendWarehouse());
-                    contractManagementInfo1.setGrade(inOutWarehouseTask.getGrade());
-                    contractManagementInfo1.setInOutType("移库入库");
-                    return contractManagementInfo1;
                 }
                 }
             }
             }
         }
         }