Explorar el Código

零号变更2

qianxb hace 1 año
padre
commit
e24fe46911

+ 4 - 2
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ChangeTokenFormMapper.xml

@@ -78,11 +78,13 @@
     <select id="getAllForm" resultType="org.springblade.meter.entity.ContractInventoryForm">
         select cif.id,cif.current_price,
                IFNULL((select sum(build_picture_total) from s_inventory_form_meter ifm
-                where ifm.contract_id = #{contractId} and ifm.is_deleted = 0 and ifm.contract_form_id = cif.id),0) as build_change_total
+                where ifm.contract_id = #{contractId} and ifm.is_deleted = 0 and ifm.contract_form_id = cif.id),0) as build_change_total,
+               IFNULL((select sum(change_build_picture_total) from s_inventory_form_meter ifm
+                       where ifm.contract_id = #{contractId} and ifm.is_deleted = 0 and ifm.contract_form_id = cif.id),0) as changeTotal
         from s_contract_inventory_form cif
         where id in
         (select contract_form_id from s_inventory_form_meter
-                where contract_id = #{contractId} group by contract_form_id)
+                where contract_id = #{contractId} and is_deleted = 0 group by contract_form_id)
     </select>
     <select id="getZeroChange" resultType="org.springblade.meter.vo.ZeroChangeVO">
         select id,form_number,form_name,current_price,contract_total,contract_money,

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

@@ -98,8 +98,7 @@ public class ChangeTokenFormServiceImpl extends BaseServiceImpl<ChangeTokenFormM
         }
         //每次生成零号变更时,把清单变更后数量,修改为当前划分数量
         for (ContractInventoryForm form : list) {
-            form.setChangeTotal(form.getBuildChangeTotal());
-            form.setChangeMoney(form.getCurrentPrice().multiply(form.getChangeTotal()));
+            form.setChangeMoney(form.getCurrentPrice().multiply(form.getChangeTotal()).setScale(2,RoundingMode.HALF_UP));
         }
         //修改清单表的划分数量
         contractInventoryFormService.updateBatchById(list);