ccjgmwz %!s(int64=3) %!d(string=hai) anos
pai
achega
ce74809e04

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

@@ -42,6 +42,9 @@ public enum YExceptionEnum {
 	QUALITY_NO_ERROR("ERROR", "业务编号已存在,不可重复!"),
 	TARE_NULL("ERROR", "皮重不能为空!"),
 	GROSSWEIGHT_NULL("ERROR", "毛重不能为空!"),
+	IN_WEIGHT_STATUS_ERROR("ERROR", "入库检斤《已称皮重》状态不允许删除,请先退回!"),
+	OUT_WEIGHT_STATUS_ERROR("ERROR", "出库检斤《已称毛重》状态不允许删除,请先退回!"),
+	IN_OUT_STATUS_ERROR("ERROR", "出入库记录状态异常"),
 	;
 	@Getter
 	private String value;

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

@@ -315,14 +315,29 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
      * @return
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void deleteWeightcheck(String id) {
         //查询检斤管理信息
         WeighingManagement weighingManagement = this.selectById(id);
         if(weighingManagement != null){
+            WarehouseInOutInfo warehouseInOutInfo = warehouseInOutInfoService.selectById(weighingManagement.getWarehouseInOutId());
+            if(warehouseInOutInfo != null && warehouseInOutInfo.getInOutFlag()!=null){
+                if(warehouseInOutInfo.getInOutFlag().equals("1")){
+                    if (weighingManagement.getStatusFlag().equals("3")){
+                        throw new YException(YExceptionEnum.OUT_WEIGHT_STATUS_ERROR);
+                    }
+                }
+                else{
+                    if (weighingManagement.getStatusFlag().equals("5")){
+                        throw new YException(YExceptionEnum.IN_WEIGHT_STATUS_ERROR);
+                    }
+                }
+            }
             //无关联的付款信息时可删除
             PaymentManagement paymentManagement = paymentManagementService.selectOne(new EntityWrapper<PaymentManagement>()
                     .eq("relation_id", weighingManagement.getRelationId())
-                    .eq("comp_id", weighingManagement.getCompId()));
+                    .eq("comp_id", weighingManagement.getCompId())
+                    .eq("delete_flag","0"));
             if (paymentManagement==null){
                 //删除关联的质检信息
                 QualityInspectionManagement qualityInspectionManagement = qualityInspectionManagementService.selectOne(new EntityWrapper<QualityInspectionManagement>()
@@ -331,6 +346,12 @@ public class WeighingManagementServiceImpl extends ServiceImpl<WeighingManagemen
                 //删除检斤管理信息,质检管理信息
                 this.deleteById(weighingManagement.getId());
                 qualityInspectionManagementService.deleteById(qualityInspectionManagement.getId());
+                if(warehouseInOutInfo != null){
+                    if (warehouseInOutInfo.getStatusFlag().equals("3")){
+                        throw new YException(YExceptionEnum.IN_OUT_STATUS_ERROR);
+                    }
+                    warehouseInOutInfoService.deleteById(weighingManagement.getWarehouseInOutId());
+                }
             }
             else{
                 throw new YException(YExceptionEnum.PAYMENT_NOT_DELETED_ERROR);