Ver Fonte

合同工程清单修改增加调差校验

qianxb há 7 meses atrás
pai
commit
fb7afa80d7

+ 10 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractInventoryFormServiceImpl.java

@@ -60,6 +60,7 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
 
         private final IInventoryFormMaterialService formMaterialService;
 
+
     /**
      * 导入excel
      * @param file
@@ -454,6 +455,15 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
         if (isChange){
             throw new ServiceException("当前节点已经被分解或者变更,不允许修改");
         }
+        //校验是否允许调差是否被修改,如果从是修改为否,则校验是否已经关联了
+        if (nodeInfo.getIsAdjust() == 1 && form.getIsAdjust() == 0){
+            int count = Math.toIntExact(formMaterialService.count(new LambdaQueryWrapper<InventoryFormMaterial>()
+                    .eq(InventoryFormMaterial::getContractFormId, form.getId())));
+            if (count > 0){
+                throw new ServiceException("当前清单已经关联材料,请取消关联后再修改不允许调差");
+            }
+
+        }
         //如果当前节点类型和修改后的节点类型相同,则不校验
         if (nodeInfo.getIsFormNode().equals(form.getIsFormNode())) {
             //相同则先判断修改后节点类型是否为清单类型