Pārlūkot izejas kodu

计量-合同计量单元,显示所有子节点表单

qianxb 2 mēneši atpakaļ
vecāks
revīzija
d1bd33b139

+ 3 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/MeterTreeController.java

@@ -727,6 +727,9 @@ public class MeterTreeController extends BladeController {
             vo.setLinkNodeList(wbsTreeVOS);
         } else {
             meterTreeContractService.getAllChildNodeMoney(vo);
+            //设置清单
+            List<ContractFromVO> contrFormAllByContrId = contractInventoryFormService.getChildNodeResolveForm(vo.getContractId(), vo.getId());
+            vo.setDecompositionList(contrFormAllByContrId);
         }
         return R.data(vo);
     }

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

@@ -71,4 +71,6 @@ public interface ContractInventoryFormMapper extends BaseMapper<ContractInventor
     List<FormNodeSortVO> getAllForm(@Param("contractId") Long contractId);
 
     List<FormTreeVO2> getAllForm2(@Param("contractId") Long contractId,@Param("materialId") Long materialId);
+
+    List<ContractFromVO> getChildNodeResolveForm(@Param("contractId") Long contractId,@Param("meterId") Long meterId);
 }

+ 20 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractInventoryFormMapper.xml

@@ -180,5 +180,25 @@
         from s_contract_inventory_form scif where contract_id = #{contractId} and is_deleted = 0
         order by -sort desc,create_time
     </select>
+    <select id="getChildNodeResolveForm" resultType="org.springblade.meter.vo.ContractFromVO">
+        select ifm.id, ifm.contract_form_id ,cif.form_number,cif.form_name,cif.current_price,cif.contract_total,cif.change_total,cif.is_supplement,ifm.up_pay_ratio as upPayRatio,
+               ifm.build_picture_total,ifm.change_build_picture_total,ifm.build_picture_money,ifm.change_build_picture_money,
+
+               if(ifm.build_picture_total=ifm.change_build_picture_total,if((select count(1) from s_inventory_form_apply
+                                                                             where contract_id = #{contractId} and is_deleted = 0 and contract_form_id = ifm.contract_form_id and contract_meter_id = ifm.contract_meter_id)=0,
+                                                                            if((select count(1) from s_change_token_inventory
+                                                                                where contract_id = #{contractId} and is_deleted = 0 and contract_form_id = ifm.contract_form_id and contract_meter_id = ifm.contract_meter_id)=0,0,1)
+                   ,1),1) as citeStatus,
+
+               IFNULL((SELECT SUM(change_build_picture_total) from s_inventory_form_meter WHERE contract_id = #{contractId} and contract_form_id = cif.id
+                                                                                            and is_deleted = 0 and contract_meter_id and contract_meter_id != #{meterId}),0)  as otherPoseNum,
+               IFNULL((SELECT SUM(change_build_picture_total) from s_inventory_form_meter
+                       WHERE contract_id = #{contractId} and is_deleted = 0 and contract_form_id = cif.id),0)  as poseNum
+        from s_inventory_form_meter ifm left join s_contract_inventory_form cif on ifm.contract_form_id = cif.id
+        WHERE ifm.contract_id = #{contractId} and ifm.is_deleted = 0
+          and ifm.contract_meter_id in (
+              select id from s_meter_tree_contract where contract_id = #{contractId} and is_deleted = 0 and FIND_IN_SET(#{meterId},ancestor) > 0
+            )
+    </select>
 
 </mapper>

+ 3 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractInventoryFormService.java

@@ -65,4 +65,7 @@ public interface IContractInventoryFormService extends BaseService<ContractInven
 
     //材料调差-获取允许调差清单树,并且回显已经选择的
     GetAdjustFormTreeVO getAdjustFormTree(Long contractId, Long materialId);
+
+    //获取节点下分解的清单
+    List<ContractFromVO> getChildNodeResolveForm(Long contractId, Long id);
 }

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

@@ -724,6 +724,15 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
         return vo;
     }
 
+    @Override
+    public List<ContractFromVO> getChildNodeResolveForm(Long contractId, Long id) {
+        List<ContractFromVO> vos = baseMapper.getChildNodeResolveForm(contractId, id);
+        for (ContractFromVO vo : vos) {
+            vo.setResidueNum(vo.getChangeTotal().subtract(vo.getPoseNum()));
+        }
+        return vos;
+    }
+
     /**
      * 判断当前清单是否已经分解或变更过,变更过返回true
      */