rav:任务完成时释放货位以及库存
This commit is contained in:
@@ -639,6 +639,19 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
||||
throw new BadRequestException("有未生成状态的分配明细,不允许强制确认!");
|
||||
}
|
||||
|
||||
// 判断是否有未完成的任务
|
||||
String task_in = disDaoList.stream()
|
||||
.map(row -> row.getTask_id().toString())
|
||||
.distinct()
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
JSONArray taskArr = taskService.query("task_id IN ('" + task_in + "') AND task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "' AND is_delete = '0'")
|
||||
.getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(taskArr)) {
|
||||
throw new BadRequestException("有任务未完成,不允许强制确认!");
|
||||
}
|
||||
|
||||
// 需要更新的库存集合
|
||||
List<JSONObject> needUpdateIvtList = new ArrayList<>();
|
||||
|
||||
@@ -654,6 +667,11 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
||||
jsonIvt.put("material_id", disDao.getMaterial_id());
|
||||
jsonIvt.put("pcsn", disDao.getPcsn());
|
||||
jsonIvt.put("canuse_qty", disDao.getPlan_qty());
|
||||
|
||||
// 判断木箱是否是主存区的,如果是主存区的则不更新库存
|
||||
if (disDao.getSect_id().toString().equals(RegionTypeEnum.TWO_BZC01.getId())) {
|
||||
continue;
|
||||
}
|
||||
needUpdateIvtList.add(jsonIvt);
|
||||
|
||||
if (disDao.getTask_id() != null) {
|
||||
@@ -665,10 +683,13 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
||||
UpdateExceptional(disDaoList);
|
||||
|
||||
// 更新库存
|
||||
outBussManageService.upateIvt(needUpdateIvtList,mstDao,IOSEnum.IVT_CHANGE.code("减库存"));
|
||||
if (ObjectUtil.isNotEmpty(needUpdateIvtList)) {
|
||||
outBussManageService.upateIvt(needUpdateIvtList,mstDao,IOSEnum.IVT_CHANGE.code("减库存"));
|
||||
}
|
||||
|
||||
// 更新仓位
|
||||
// 更新仓位: 主存区仓位不更新
|
||||
List<String> paramLockList = disDaoList.stream()
|
||||
.filter(row -> !row.getSect_id().toString().equals(RegionTypeEnum.TWO_BZC01.getId()))
|
||||
.map(StIvtIostorinvdis::getStruct_code)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
@@ -681,7 +702,9 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
||||
jsonLockParam.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
jsonLockParam.put("operate", IOSEnum.IO_TYPE.code("出库"));
|
||||
|
||||
outBussManageService.lockStruct(paramLockList,jsonLockParam);
|
||||
if (ObjectUtil.isNotEmpty(paramLockList)) {
|
||||
outBussManageService.lockStruct(paramLockList,jsonLockParam);
|
||||
}
|
||||
|
||||
// 更新单据
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
@@ -829,6 +852,36 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
||||
throw new BadRequestException("未查询到对应的出库单据!");
|
||||
}
|
||||
|
||||
// 更新库存
|
||||
// 需要更新的仓位库存
|
||||
List<JSONObject> needUpdateIvtList = new ArrayList<>();
|
||||
for (int i = 0; i < disDaoList.size(); i++) {
|
||||
StIvtIostorinvdis dao = disDaoList.get(i);
|
||||
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("struct_id", dao.getStruct_id());
|
||||
jsonIvt.put("material_id", dao.getMaterial_id());
|
||||
jsonIvt.put("pcsn", dao.getPcsn());
|
||||
jsonIvt.put("canuse_qty", dao.getPlan_qty());
|
||||
|
||||
needUpdateIvtList.add(jsonIvt);
|
||||
}
|
||||
outBussManageService.upateIvt(needUpdateIvtList,mstDao,IOSEnum.IVT_CHANGE.code("减库存"));
|
||||
|
||||
// 更新仓位
|
||||
List<String> paramLockList = new ArrayList<>();
|
||||
|
||||
JSONObject jsonLockParam = new JSONObject();
|
||||
jsonLockParam.put("inv_type", "");
|
||||
jsonLockParam.put("inv_id", "");
|
||||
jsonLockParam.put("inv_code", "");
|
||||
jsonLockParam.put("storagevehicle_code", "");
|
||||
jsonLockParam.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
jsonLockParam.put("operate", IOSEnum.IO_TYPE.code("出库"));
|
||||
|
||||
paramLockList.add(disDao.getStruct_code());
|
||||
outBussManageService.lockStruct(paramLockList,jsonLockParam);
|
||||
|
||||
if (IOSEnum.OUT_TYPE.code("改切出库").equals(mstDao.getBill_type()) || IOSEnum.OUT_TYPE.code("返检出库").equals(mstDao.getBill_type())) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("need_delete", IOSEnum.IS_NOTANDYES.code("是"));
|
||||
|
||||
Reference in New Issue
Block a user