Sfoglia il codice sorgente

删除材料同步删除系数,批量修改调差系数

qianxb 7 mesi fa
parent
commit
f96bbfd028

+ 3 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/GetLinkAllFormVO.java

@@ -28,4 +28,7 @@ public class GetLinkAllFormVO {
 
     @ApiModelProperty(value = "调差系数")
     private BigDecimal adjustFactor;
+
+    @ApiModelProperty(value = "是否被引用0否1是,被引用后不允许取消")
+    private Integer isQuote;
 }

+ 11 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMaterialController.java

@@ -27,6 +27,8 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.meter.dto.MaterialLinkFormDTO;
 import org.springblade.meter.dto.MaterialListDTO;
+import org.springblade.meter.entity.InventoryFormMaterial;
+import org.springblade.meter.service.IInventoryFormMaterialService;
 import org.springblade.meter.vo.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -51,6 +53,8 @@ public class ContractMaterialController extends BladeController {
 
 	private final IContractMaterialService contractMaterialService;
 
+	private final IInventoryFormMaterialService formMaterialService;
+
 
 	/**
 	 * 新增或修改 合同材料表
@@ -174,5 +178,12 @@ public class ContractMaterialController extends BladeController {
 		contractMaterialService.removeLinkForm(id);
 		return R.success("解除成功");
 	}
+	@PostMapping("/submit-link-form")
+	@ApiOperationSupport(order = 13)
+	@ApiOperation(value = "调差系数-提交编辑", notes = "传入编辑列表数据,只传入id和调差系数")
+	public R submitLinkForm(@RequestBody List<InventoryFormMaterial> list) {
+		formMaterialService.updateBatchById(list);
+		return R.success("修改成功");
+	}
 	
 }

+ 1 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractInventoryFormMapper.java

@@ -70,5 +70,5 @@ public interface ContractInventoryFormMapper extends BaseMapper<ContractInventor
 
     List<FormNodeSortVO> getAllForm(@Param("contractId") Long contractId);
 
-    List<FormTreeVO2> getAllForm2(@Param("contractId") Long contractId);
+    List<FormTreeVO2> getAllForm2(@Param("contractId") Long contractId,@Param("materialId") Long materialId);
 }

+ 3 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractInventoryFormMapper.xml

@@ -174,7 +174,9 @@
         order by -sort desc,create_time
     </select>
     <select id="getAllForm2" resultType="org.springblade.meter.vo.FormTreeVO2">
-        select id ,parent_id,form_name,is_form_node,is_adjust,0 as isSelect,0 as isQuote
+        select id ,parent_id,form_name,is_form_node,is_adjust,0 as isSelect,
+               if((select count(1) from s_contract_material_adjust_detail mad where mad.contract_form_id = scif.id
+                                and mad.contract_material_id = #{materialId}) > 0,1,0) as isQuote
         from s_contract_inventory_form scif where contract_id = #{contractId} and is_deleted = 0
         order by -sort desc,create_time
     </select>

+ 3 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.xml

@@ -58,7 +58,9 @@
         select id,adjust_factor,
                (select form_number from s_contract_inventory_form cif where cif.id = ifm.contract_form_id) as formNumber,
                (select form_name from s_contract_inventory_form cif where cif.id = ifm.contract_form_id) as formName,
-               (select material_name from s_contract_material scm where scm.id = ifm.contract_material_id) as materialName
+               (select material_name from s_contract_material scm where scm.id = ifm.contract_material_id) as materialName,
+               if((select count(1) from s_contract_material_adjust_detail mad where mad.contract_form_id = ifm.contract_form_id
+                                    and mad.contract_material_id = #{materialId}) > 0,1,0) as isQuote
         from s_inventory_form_material ifm
         where  is_deleted = 0 and contract_id = #{contractId} and contract_material_id = #{materialId}
     </select>

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

@@ -660,7 +660,7 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
                 .eq(InventoryFormMaterial::getContractMaterialId, materialId));
         Map<Long, BigDecimal> map = formMaterials.stream().collect(Collectors.toMap(l -> l.getContractFormId(), l -> l.getAdjustFactor()));
         //获取所有清单节点
-        List<FormTreeVO2> vo2s = baseMapper.getAllForm2(contractId);
+        List<FormTreeVO2> vo2s = baseMapper.getAllForm2(contractId,materialId);
         List<FormTreeVO2> list = new ArrayList<>();
         List<Long> ids = new ArrayList<>();
         //循环清单节点,把最底层节点不允许调差的删除,并且标识已关联的节点

+ 2 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMaterialServiceImpl.java

@@ -182,7 +182,8 @@ public class ContractMaterialServiceImpl extends BaseServiceImpl<ContractMateria
         priceService.remove(new LambdaQueryWrapper<ContractMaterialPrice>()
                 .in(ContractMaterialPrice::getContractMaterialId,list));
         //删除调差系数
-
+        formMaterialService.remove(new LambdaQueryWrapper<InventoryFormMaterial>()
+                .in(InventoryFormMaterial::getContractMaterialId,list));
         //删除材料信息
         this.removeBatchByIds(list);
     }