|
@@ -613,6 +613,35 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
MiddleMeterApplyVO vo = baseMapper.getById(id);
|
|
|
//获取计量清单列表
|
|
|
List<MeterInventoryVO> formList = baseMapper.getForm(id,vo.getContractId(),vo.getContractUnitId());
|
|
|
+ //获取合同计量单元信息
|
|
|
+ MeterTreeContract treeContract = meterTreeContractService.getById(vo.getContractUnitId());
|
|
|
+ //判断是否为自动计量节点
|
|
|
+ if (treeContract.getIsAutoMeter() == 1) {
|
|
|
+ //自动新增并且为混凝土节点,则查询实际支付比例
|
|
|
+ if (vo.getIsAutoBuild() == 1 && treeContract.getIsConcreteNode() == 1) {
|
|
|
+ //获取计量单元关联的WBS节点信息
|
|
|
+ //获取每个节点的附件
|
|
|
+ Integer max = baseMapper.getMeterWbsFileMaxType(treeContract.getContractId(),treeContract.getId());
|
|
|
+ //判断附件中是否存在7天28天附件,如果不存在则提示:关联WBS节点中的附近已被删除,请重新上传
|
|
|
+ if (max == null || (max != 11 || max != 12)){
|
|
|
+ throw new ServiceException("关联WBS节点中的附件已被删除,请重新上传附件");
|
|
|
+ }else {
|
|
|
+ if (max == 11) {
|
|
|
+ formList.stream().forEach(l -> l.setUpPayRatio(treeContract.getSevenRatio()));
|
|
|
+ }else {
|
|
|
+ formList.stream().forEach(l -> l.setUpPayRatio(treeContract.getTwentyEightRatio()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //手动新增和不是混泥土节点,则直接使用后管。
|
|
|
+ MeterContractInfo one = meterContractInfoService.getOne(new LambdaQueryWrapper<MeterContractInfo>()
|
|
|
+ .eq(MeterContractInfo::getContractId, vo.getContractId()));
|
|
|
+ if (one == null || one.getMiddlePayRatio() == null){
|
|
|
+ throw new ServiceException("合同段支付比例被删除,必须先设置支付比例");
|
|
|
+ }
|
|
|
+ formList.stream().forEach(l->l.setUpPayRatio(one.getMiddlePayRatio()));
|
|
|
+ }
|
|
|
+ }
|
|
|
//计算分解数量是否超过合同数量
|
|
|
for (MeterInventoryVO form : formList) {
|
|
|
//设置施工图数量是否大于合同数量
|
|
@@ -1257,6 +1286,8 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
inventoryFormApply.setCurrentMeterTotal(maxMeterTotal.subtract(vo.getAllMeterTotal()));
|
|
|
inventoryFormApply.setCurrentMeterMoney(inventoryFormApply.getCurrentMeterTotal().multiply(inventoryFormApply.getCurrentPrice()));
|
|
|
inventoryFormApply.setBusinessDate(period.getEndDate());
|
|
|
+ //设置当前比例 = 当前计量数量 / 施工图变更后数量
|
|
|
+ inventoryFormApply.setPayRatio(inventoryFormApply.getCurrentMeterTotal().divide(inventoryFormApply.getChangeBuildPictureTotal(),4, RoundingMode.DOWN).multiply(new BigDecimal(100)).setScale(2));
|
|
|
total = total.add(inventoryFormApply.getCurrentMeterMoney());
|
|
|
//加入计量单与清单中间表集合
|
|
|
inventoryFormApplyAdd.add(inventoryFormApply);
|