zhangyuewww 3 years ago
parent
commit
dfbcde1dd9

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

@@ -361,6 +361,11 @@ public class WeighingManagement extends BaseModel<WeighingManagement> {
      */
     @TableField(exist = false)
     private ContractManagementInfo contractManagement;
+    /**
+     * 派车编号
+     */
+    @TableField(exist = false)
+    private String tranCarNo;
     /**
      *仓库对象
      */

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/exception/YExceptionEnum.java

@@ -39,6 +39,7 @@ public enum YExceptionEnum {
 	TRANTASK_NOT_CREATED_ERROR("ERROR-002", "内勤尚未创建运输任务!"),
 	PAYMENT_NOT_DELETED_ERROR("ERROR", "请先删除对应的付款信息!"),
 	WEIGHT_NOT_DELETED_ERROR("ERROR", "请先删除对应的检斤信息!"),
+	QUALITY_NO_ERROR("ERROR", "业务编号已存在,不可重复!"),
 	;
 	@Getter
 	private String value;

+ 9 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/QualityInspectionManagementServiceImpl.java

@@ -9,6 +9,7 @@ import com.winsea.svc.base.base.service.ICommonCompanyService;
 import com.winsea.svc.base.base.service.ICommonStaffService;
 import com.winsea.svc.base.security.util.AuthSecurityUtils;
 import com.yh.saas.common.support.util.IdGenerator;
+import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.*;
 import com.yh.saas.plugin.yiliangyiyun.exception.YException;
@@ -263,6 +264,14 @@ public class QualityInspectionManagementServiceImpl extends ServiceImpl<QualityI
     public String addQualityInspection(QualityInspectionManagement qualityInspectionManagement) {
         String relationId=IdGenerator.generateUUID();
         qualityInspectionManagement.setId(IdGenerator.generateUUID());
+        //判断质检编号是否唯一
+        List<QualityInspectionManagement> qualityInspectionManagements =
+                this.selectList(new EntityWrapper<QualityInspectionManagement>()
+                        .eq("comp_id",qualityInspectionManagement.getCompId())
+                        .eq("quality_no", qualityInspectionManagement.getQualityNo()));
+        if (qualityInspectionManagements.size() > 0) {
+            throw new YException(YExceptionEnum.QUALITY_NO_ERROR);
+        }
         if(qualityInspectionManagement.getCompId() == null || qualityInspectionManagement.getCompId().isEmpty()){
             qualityInspectionManagement.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
         }

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

@@ -238,6 +238,22 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                     warehouseInOutDetailService.updateById(warehouseInOutDetail);
                 }
             }
+            //入库
+            if("2".equals(warehouseInOutInfo.getInOutFlag())) {
+                Wrapper wrapper = new EntityWrapper<TranCarInfo>()
+                        .eq("contract_no", warehouseInOutInfo.getContractNo())
+                        .eq("car_no", warehouseInOutInfo.getCarNo())
+                        .eq(TranCarInfo.QueryFiles.DELETE_FLAG, NumberConstant.CONSTANT0)
+                        .eq("tran_car_no", warehouseInOutInfo.getTranCarNo());
+                TranCarInfo tranCarInfo = tranCarInfoService.selectOne(wrapper);
+                if (tranCarInfo != null) {
+                    //将车改成已被选
+                    tranCarInfo.setSubmit("2");
+                    tranCarInfo.setStatusFlag(StatusEnum.DELIVERED.getFlag());
+                    tranCarInfo.setStatus(StatusEnum.DELIVERED.getName());
+                    tranCarInfoService.updateById(tranCarInfo);
+                }
+            }
 
         } else {
             //插入记录
@@ -940,13 +956,13 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             tranCarInfo.setUnloadPoundImg(warehouseInOutInfo.getAddressUrl());
                         }
                         tranCarInfo.setUnloadingDate(warehouseInOutInfo.getInOutDate());
-                        if ("2".equals(tranCarInfo.getSubmit())) {
-                            throw new YException(YExceptionEnum.CARNO_SUBMITTED_ERROR);
-                        } else {
+//                        if ("2".equals(tranCarInfo.getSubmit())) {
+//                            throw new YException(YExceptionEnum.CARNO_SUBMITTED_ERROR);
+//                        } else {
                             tranCarInfo.setSubmit("2");
                             tranCarInfo.setStatusFlag(StatusEnum.DELIVERED.getFlag());
                             tranCarInfo.setStatus(StatusEnum.DELIVERED.getName());
-                        }
+//                        }
                         tranCarInfoService.updateById(tranCarInfo);
                     }
                     //更新库存量
@@ -1362,7 +1378,9 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                 //出库时打入成本
                                 CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
                                         .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
-                                tranCarInfo.setCost(costManagementInfo.getCost());
+                                if(costManagementInfo != null) {
+                                    tranCarInfo.setCost(costManagementInfo.getCost());
+                                }
                                 tranCarInfo.setCompId(warehouseBaseInfo.getCompId());
                                 tranCarInfo.setTranType("1");
                                 tranCarInfo.setCarNo(warehouseInOutInfo.getCarNo());
@@ -1399,7 +1417,9 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         //移库出库时打入成本
                         CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
                                 .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
-                        tranCarInfo.setCost(costManagementInfo.getCost());
+                            if(costManagementInfo != null) {
+                                tranCarInfo.setCost(costManagementInfo.getCost());
+                            }
                         }
                         tranCarInfo.setLoadingDate(warehouseInOutInfo.getInOutDate());
                         tranCarInfo.setContractNo(warehouseInOutInfo.getContractNo());
@@ -1664,10 +1684,17 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             }
                             tranCarInfo.setLoadingDate(warehouseInOutInfo.getInOutDate());
                             tranCarInfo.setContractNo(warehouseInOutInfo.getContractNo());
-                            //出库时打入成本
-                            CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
-                                    .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
-                            tranCarInfo.setCost(costManagementInfo.getCost());
+                            if(contractManagementInfo!=null){
+                                tranCarInfo.setCost(contractManagementInfo.getUnitContractPrice());
+                            }
+                            else {
+                                //出库时打入成本
+                                CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
+                                        .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
+                                if (costManagementInfo != null) {
+                                    tranCarInfo.setCost(costManagementInfo.getCost());
+                                }
+                            }
                             tranCarInfo.setStatus(StatusEnum.LOADED.getName());
                             tranCarInfo.setStatusFlag(StatusEnum.LOADED.getFlag());
                             if ("1".equals(tranCarInfo.getSubmit())) {
@@ -1706,10 +1733,19 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             tranCarInfo.setCompId(warehouseBaseInfo.getCompId());
                             tranCarInfo.setTranType("1");
                             tranCarInfo.setSubmit("1");
-                            //出库时打入成本
-                            CostManagementInfo costManagementInfo = costManagementInfoService.selectOne(new EntityWrapper<CostManagementInfo>().eq("warehouse_id", warehouseInOutInfo.getBaseId())
-                                    .eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
-                            tranCarInfo.setCost(costManagementInfo.getCost());
+                            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_key", warehouseInOutInfo.getGoodsNameKey()));
+                                if (costManagementInfo != null) {
+                                    tranCarInfo.setCost(costManagementInfo.getCost());
+                                }
+                            }
                             tranCarInfo.setLoadNetWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
                             tranCarInfo.setLoadingDate(new Date());
                             tranCarInfo.setCarNo(warehouseInOutInfo.getCarNo());

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

@@ -48,7 +48,7 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
     @Autowired
     private IWarehouseBaseInfoService warehouseBaseInfoService;
     @Autowired
-    private IPurchasePriceService purchasePriceService;
+    private IWarehouseInOutInfoService warehouseInOutInfoService;
     @Autowired
     private IContractManagementInfoService contractManagementInfoService;
     @Autowired
@@ -105,6 +105,10 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                         .eq("comp_id", weighingManagement1.getCompId()));
                 if (qualityInspectionManagement != null) {
                     weighingManagement1.setQualityInspectionManagement(qualityInspectionManagement);
+                    WarehouseInOutInfo warehouseInOutInfo=warehouseInOutInfoService.selectById(qualityInspectionManagement.getWarehouseInOutId());
+                    if (warehouseInOutInfo!=null){
+                        weighingManagement1.setTranCarNo(warehouseInOutInfo.getTranCarNo());
+                    }
                 }
                 WarehouseBaseInfo warehouseBaseInfo = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
                         .eq("comp_id", weighingManagement1.getCompId())