fix:优化需求单下推逻辑,允许局部成功

This commit is contained in:
zhangzq
2026-08-01 13:59:21 +08:00
parent 5c367ca7f9
commit dc2780efd5
4 changed files with 24 additions and 15 deletions

View File

@@ -82,7 +82,6 @@ public class PmDemandController {
@PostMapping("/push")
@Log("需求单下发")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Object> push(@RequestBody List<PmDemandDto> pmDemandDtos) {
pmDemandService.pushDemand(pmDemandDtos);
return ResponseData.build();

View File

@@ -260,11 +260,9 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
.map(PmDemandDto::getId).collect(Collectors.toList())));
}
if (!CollectionUtils.isEmpty(zdDemands)) {
wmsToZDWmdService.syncDemandOrder(zdDemands);
//直接增加对应库存并做库存记录
List<AddInvParam> addInvParams = new ArrayList<>();
List<InFinishParam> inFinishParams = new ArrayList<>();
for (PmDemandDto zdDemand : zdDemands) {
List<AddInvParam> addInvParams = new ArrayList<>();
List<InFinishParam> inFinishParams = new ArrayList<>();
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
.eq(Structattr::getSect_code, zdDemand.getTargetHouseCode())
.isNotNull(Structattr::getStoragevehicle_code)
@@ -284,13 +282,24 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
BeanUtils.copyProperties(addInvParam,inFinishParam);
inFinishParam.setRemark("中鼎需求单变动");
inFinishParams.add(inFinishParam);
List<PmDemandDto> zd = new ArrayList<>();
zd.add(zdDemand);
wmsToZDWmdService.syncDemandOrder(zd);
try {
iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
iStInventoryService.changeInventory(InventoryChangeType.IN_FINISH, inFinishParams);
this.update(new LambdaUpdateWrapper<PmDemand>()
.set(PmDemand::getStatus,DemandStatus.FINISH.getValue())
.in(PmDemand::getId,zdDemands.stream()
.map(PmDemandDto::getId).collect(Collectors.toList())));
}catch (Exception ex){
log.error("回传中鼎成功,WMS库存变动失败"+ex.getMessage());
this.update(new LambdaUpdateWrapper<PmDemand>()
.set(PmDemand::getStatus,DemandStatus.CANCEL.getValue())
.in(PmDemand::getId,zdDemands.stream()
.map(PmDemandDto::getId).collect(Collectors.toList())));
}
}
iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
iStInventoryService.changeInventory(InventoryChangeType.IN_FINISH, inFinishParams);
this.update(new LambdaUpdateWrapper<PmDemand>()
.set(PmDemand::getStatus,DemandStatus.FINISH.getValue())
.in(PmDemand::getId,zdDemands.stream()
.map(PmDemandDto::getId).collect(Collectors.toList())));
}
}

View File

@@ -261,6 +261,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
}
}
@Override
@Transactional
public String saveBill(JSONObject map) {
//明细
JSONArray array = map.getJSONArray("tableData");