rev:设置站点增加手动事务

This commit is contained in:
2024-04-12 15:39:47 +08:00
parent 6baf7c97ad
commit faf907c38c
4 changed files with 360 additions and 1028 deletions

View File

@@ -146,13 +146,6 @@ public interface CheckOutBillService {
*/
void setPoint(JSONObject whereJson);
/**
* 设置一个站点
*
* @param whereJson /
*/
void oneSetPoint(JSONObject whereJson);
/**
* 设置一个站点
*

View File

@@ -150,14 +150,6 @@ public class CheckOutBillController {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/oneSetPoint")
@Log("设置一个站点")
public ResponseEntity<Object> oneSetPoint(@RequestBody JSONObject whereJson) {
checkOutBillService.oneSetPoint(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/oneSetPoint2")
@Log("设置一个站点")

View File

@@ -2454,643 +2454,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void oneSetPoint(JSONObject whereJson) {
//出库分配表
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
//点位表
WQLObject wo_Point = WQLObject.getWQLObject("SCH_BASE_Point");
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
//出库主表
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
//仓位表
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr");
String struct_id = whereJson.getString("struct_id");
String point_code = whereJson.getString("point_code"); // 终点
String iostorinv_id = whereJson.getString("iostorinv_id");
//查询主表信息
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jo_mst)) {
throw new BadRequestException("未查到相关出库单");
}
JSONObject jsonPoint2 = wo_Point.query("lock_type='1' and (vehicle_code='' or vehicle_code IS NULL) and point_code='" + point_code + "'").uniqueResult(0);
//如果终点站点被锁定或者有载具号,则不允许设置点位
if (ObjectUtil.isEmpty(jsonPoint2)) {
throw new BadRequestException("该站点被锁定或者有载具号,不允许设置!");
}
// 查询未生成和生成未下发的分配记录
JSONObject dis = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParam("flag", "5")
.addParam("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"))
.addParam("struct_id", struct_id)
.addParam("iostorinv_id", iostorinv_id)
.addParam("bill_status", "01")
.addParam("is_issued", "0")
.process()
.uniqueResult(0);
if (ObjectUtil.isEmpty(dis)) {
throw new BadRequestException("分配明细不存在或已执行、完成、!");
}
String task_status = dis.getString("task_status");
String task_id = dis.getString("task_id");
if (StrUtil.isNotEmpty(task_status) && "05,06,07".contains(task_status)) {
throw new BadRequestException("该任务已执行,不可重新设置站点!");
}
if (ObjectUtil.isNotEmpty(task_id)) {
//若任务不为空,则为变更出库目的站点
JSONObject task = wo_Task.query("task_id='" + task_id + "'").uniqueResult(0);
//更新任务
task.put("point_code2", jsonPoint2.getString("point_code"));
wo_Task.update(task);
} else {
/*
* 生成任务:
* 1.判断此条分配明细的 ‘仓位’在此主表下的分配明细是否有相同的 ‘仓位’
* a.如果有:有则合并只生成一条任务
* b.没有:则正常生成
* 2.判断此货位是否被挡住
* a.挡住:判断哪边的货位比较少 生成移库单
* b.没挡住:正常生成
*/
JSONObject jsonPoint1 = wo_Point.query("source_id = '" + dis.getString("struct_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint1)) {
throw new BadRequestException("起点点位不存在");
}
// 创建任务
JSONObject param = new JSONObject();
param.put("task_type", "010503");
param.put("vehicle_code", dis.getString("box_no"));
param.put("task_name", "task_name");
param.put("point_code1", jsonPoint1.getString("point_code"));
param.put("point_code2", jsonPoint2.getString("point_code"));
param.put("material_id", dis.getString("material_id"));
param.put("task_group_id", ""); // 任务组
param.put("sort_seq", ""); // 任务组顺序号
String create_task_id = outTask.createTask(param);
// 更新分配状态、任务标识、出库点位
JSONObject jsonTask = wo_Task.query("task_id = '" + create_task_id + "'").uniqueResult(0);
JSONObject jsonUpdateMap = new JSONObject();
jsonUpdateMap.put("work_status", "01");
jsonUpdateMap.put("task_id", jsonTask.getLong("task_id"));
jsonUpdateMap.put("point_id", jsonPoint2.getLong("point_id"));
wo_dis.update(jsonUpdateMap, "iostorinvdis_id = '" + dis.getString("iostorinvdis_id") + "'");
// 1.判断此条分配明细的 ‘仓位’在此主表下的分配明细是否有相同的 ‘仓位’
JSONArray disArr = wo_dis.query("struct_id = '" + dis.getString("struct_id") +
"' and iostorinv_id = '" + dis.getString("iostorinv_id") +
"' and iostorinvdis_id <> '" + dis.getString("iostorinvdis_id") +
"' and work_status = '00'").getResultJSONArray(0);
// 依次更新相同仓位的分配明细状态、任务标识、出库点位
for (int i = 0; i < disArr.size(); i++) {
JSONObject jsonObject = disArr.getJSONObject(i);
jsonObject.put("work_status", "01");
jsonObject.put("task_id", jsonTask.getLong("task_id"));
jsonObject.put("point_id", jsonPoint2.getLong("point_id"));
wo_dis.update(jsonObject);
}
// 2.判断此货位是否被挡住
JSONObject jsonAttr = attrTab.query("struct_id = '" + dis.getString("struct_id") + "'").uniqueResult(0);
// 判断此仓位是‘双通’还是’单通‘
if (StrUtil.equals(jsonAttr.getString("placement_type"), "01")) {
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("struct_code", jsonAttr.getString("struct_code"));
map.put("sect_id", jsonAttr.getString("sect_id"));
// 判断左边是否被挡住
JSONObject jsonIsBlockL = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().uniqueResult(0);
boolean left_verify = true;
if (ObjectUtil.isEmpty(jsonIsBlockL)) {
left_verify = false;
/* String out_order_seq = NumberUtil.add(jsonAttr.getString("out_order_seq"), "1").toString();
JSONObject json = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + jsonAttr.getString("block_num")
+ "' and row_num = '" + jsonAttr.getString("row_num") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
jsonAttr.put("placement_type","02");
}*/
jsonAttr.put("placement_type", "02");
} else {
// 调用验证方法进行校验
String out_order_seq = NumberUtil.add(jsonIsBlockL.getString("out_order_seq"), "1").toString();
JSONObject jsonParam = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + jsonIsBlockL.getString("block_num")
+ "' and row_num = '" + jsonIsBlockL.getString("row_num") + "'").uniqueResult(0);
jsonParam.put("iostorinv_id", dis.getString("iostorinv_id"));
jsonParam.put("option", "2");
left_verify = this.is_trueOrFalse(jsonParam);
if (!left_verify) {
jsonParam.put("option", "3");
boolean left_verify2 = this.is_trueOrFalse(jsonParam);
if (left_verify2) {
jsonAttr.put("placement_type", "02");
}
} else {
jsonParam.put("option", "4");
boolean left_verify2 = this.is_trueOrFalse(jsonParam);
if (left_verify2) {
jsonAttr.put("placement_type", "02");
}
}
}
// 判断右边是否被挡住
map.put("flag", "1");
JSONObject jsonIsBlockR = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().uniqueResult(0);
boolean right_verify = true;
if (ObjectUtil.isEmpty(jsonIsBlockR)) {
right_verify = false;
/* String out_order_seq = NumberUtil.sub(jsonAttr.getString("out_order_seq"), "1").toString();
JSONObject json = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + jsonAttr.getString("block_num")
+ "' and row_num = '" + jsonAttr.getString("row_num") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
jsonAttr.put("placement_type","03");
}*/
jsonAttr.put("placement_type", "03");
} else {
// 调用验证方法进行校验
String out_order_seq = NumberUtil.sub(jsonIsBlockR.getString("out_order_seq"), "1").toString();
JSONObject jsonParam = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + jsonIsBlockR.getString("block_num")
+ "' and row_num = '" + jsonIsBlockR.getString("row_num") + "'").uniqueResult(0);
jsonParam.put("iostorinv_id", dis.getString("iostorinv_id"));
jsonParam.put("option", "2");
right_verify = this.is_trueOrFalse(jsonParam);
if (!right_verify) {
jsonParam.put("option", "3");
boolean right_verify2 = this.is_trueOrFalse(jsonParam);
if (right_verify2) {
jsonAttr.put("placement_type", "03");
}
} else {
jsonParam.put("option", "4");
boolean right_verify2 = this.is_trueOrFalse(jsonParam);
if (right_verify2) {
jsonAttr.put("placement_type", "03");
}
}
}
if (left_verify && right_verify) {
// 都被挡住判断哪边被挡住的货位少
map.put("flag", "3");
map.put("out_order_seq", jsonAttr.getString("out_order_seq"));
JSONArray jsonIsBlockAll = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
int blockLeft = 0; // 左边个数
int blockRigth = 0; // 右边个数
for (int i = 0; i < jsonIsBlockAll.size(); i++) {
JSONObject json = jsonIsBlockAll.getJSONObject(i);
if (i == 0) {
blockRigth = json.getIntValue("num");
}
if (i == 1) {
blockRigth = json.getIntValue("num");
}
}
// 更新第一个任务 任务组、任务顺序号
jsonTask.put("task_group_id", IdUtil.getSnowflake(1, 1).nextId());
jsonTask.put("sort_seq", 1);
wo_Task.update(jsonTask);
JSONArray jsonAllBlockPoint = new JSONArray();
if (blockLeft > blockRigth) {
// 从右边生成移库单
map.put("flag", "4");
map.put("block_num", jsonAttr.getString("block_num"));
map.put("row_num", jsonAttr.getString("row_num"));
jsonAllBlockPoint = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
} else {
// 从左边生成移库单
map.put("flag", "5");
map.put("block_num", jsonAttr.getString("block_num"));
map.put("row_num", jsonAttr.getString("row_num"));
jsonAllBlockPoint = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
}
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "10");
mapParam.put("bill_type", "21");
mapParam.put("buss_type", "21");
mapParam.put("biz_date", DateUtil.today());
mapParam.put("stor_code", "CP01");
mapParam.put("stor_id", "1582991156504039424");
mapParam.put("stor_name", "成品仓库");
mapParam.put("is_task", "1");
// 查询移入货位
JSONObject moveParam = new JSONObject();
moveParam.put("box_no", json.getString("storagevehicle_code"));
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
// 查询移出货位的库存物料
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
.addParam("flag", "6")
.addParam("struct_id", json.getString("struct_id"))
.process().uniqueResult(0);
// 移库单明细
JSONObject jsonMoveDtl = new JSONObject();
jsonMoveDtl.put("is_task", "2");
jsonMoveDtl.put("turnout_sect_id", json.getLongValue("sect_id"));
jsonMoveDtl.put("turnout_sect_code", json.getString("sect_code"));
jsonMoveDtl.put("turnout_sect_name", json.getString("sect_name"));
jsonMoveDtl.put("turnout_struct_id", json.getLongValue("struct_id"));
jsonMoveDtl.put("turnout_struct_code", json.getString("struct_code"));
jsonMoveDtl.put("turnout_struct_name", json.getString("struct_name"));
jsonMoveDtl.put("material_id", jsonMoveIvt.getLongValue("material_id"));
jsonMoveDtl.put("pcsn", jsonMoveIvt.getString("pcsn"));
jsonMoveDtl.put("quality_scode", "01");
jsonMoveDtl.put("qty_unit_id", jsonMoveIvt.getLongValue("qty_unit_id"));
jsonMoveDtl.put("qty_unit_name", jsonMoveIvt.getString("unit_name"));
jsonMoveDtl.put("qty", jsonMoveIvt.getDoubleValue("canuse_qty"));
jsonMoveDtl.put("storagevehicle_code", json.getString("storagevehicle_code"));
jsonMoveDtl.put("turnin_sect_id", jsonMove.getLongValue("sect_id"));
jsonMoveDtl.put("turnin_sect_code", jsonMove.getString("sect_code"));
jsonMoveDtl.put("turnin_sect_name", jsonMove.getString("sect_name"));
jsonMoveDtl.put("turnin_struct_id", jsonMove.getLongValue("struct_id"));
jsonMoveDtl.put("turnin_struct_code", jsonMove.getString("struct_code"));
jsonMoveDtl.put("turnin_struct_name", jsonMove.getString("struct_name"));
jsonMoveDtl.put("source_billdtl_id", dis.getLongValue("iostorinvdis_id"));
// 生成任务
JSONObject param2 = new JSONObject();
param2.put("task_type", "010503");
param2.put("vehicle_code", json.getString("storagevehicle_code"));
param2.put("task_name", "task_name");
param2.put("point_code1", json.getString("point_code"));
param2.put("point_code2", jsonMove.getString("struct_code"));
param2.put("task_group_id", jsonTask.getLongValue("task_group_id")); // 任务组
param2.put("sort_seq", jsonTask.getIntValue("sort_seq") + i + 1); // 任务组顺序号
String move_task_id = outTask.createTask(param2);
// 回显移库明细任务id
jsonMoveDtl.put("task_id", move_task_id);
table.add(jsonMoveDtl);
// 更新任务处理类
JSONObject jsonTaskMove = wo_Task.query("task_id = '" + move_task_id + "'").uniqueResult(0);
jsonTaskMove.put("task_type", "010505");
jsonTaskMove.put("handle_class", HandMoveStorAcsTask.class.getName());
wo_Task.update(jsonTaskMove);
mapParam.put("tableData", table);
// 调用移库单新增方法
if (ObjectUtil.isNotEmpty(jsonAllBlockPoint)) {
handMoveStorService.insertDtl2(mapParam);
}
}
} else {
if (StrUtil.equals(jsonAttr.getString("placement_type"), "01")) {
throw new BadRequestException("任务生成失败,请重新选择");
}
map.put("struct_code", jsonAttr.getString("struct_code"));
map.put("sect_id", jsonAttr.getString("sect_id"));
map.put("out_order_seq", jsonAttr.getString("out_order_seq"));
map.put("block_num", jsonAttr.getString("block_num"));
map.put("row_num", jsonAttr.getString("row_num"));
JSONArray jsonAllBlockPoint = new JSONArray();
if (StrUtil.equals(jsonAttr.getString("placement_type"), "02")) {
// 02-左通
map.put("flag", "2");
// 判断左边是否被挡住
JSONObject jsonIsBlockL2 = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().uniqueResult(0);
// 如果被挡住则进行校验
boolean verify = true;
if (ObjectUtil.isEmpty(jsonIsBlockL2)) {
verify = false;
} else {
// 调用验证方法进行校验
String out_order_seq = NumberUtil.add(jsonIsBlockL2.getString("out_order_seq"), "1").toString();
JSONObject jsonParam = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + map.getString("block_num")
+ "' and row_num = '" + map.getString("row_num") + "'").uniqueResult(0);
jsonParam.put("iostorinv_id", dis.getString("iostorinv_id"));
jsonParam.put("option", "1");
verify = this.is_trueOrFalse(jsonParam);
}
if (verify) {
// 更新第一个任务 任务组、任务顺序号
jsonTask.put("task_group_id", IdUtil.getSnowflake(1, 1).nextId());
jsonTask.put("sort_seq", 1);
wo_Task.update(jsonTask);
// 从左边生成移库单
map.put("flag", "5");
jsonAllBlockPoint = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
}
}
if (StrUtil.equals(jsonAttr.getString("placement_type"), "03")) {
// 03-右通
map.put("flag", "1");
// 判断右边是否被挡住
JSONObject jsonIsBlockR2 = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().uniqueResult(0);
// 如果被挡住则进行校验
boolean verify = true;
if (ObjectUtil.isEmpty(jsonIsBlockR2)) {
verify = false;
} else {
// 调用验证方法进行校验
String out_order_seq = NumberUtil.sub(jsonIsBlockR2.getString("out_order_seq"), "1").toString();
JSONObject jsonParam = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + map.getString("block_num")
+ "' and row_num = '" + map.getString("row_num") + "'").uniqueResult(0);
jsonParam.put("iostorinv_id", dis.getString("iostorinv_id"));
jsonParam.put("option", "1");
verify = this.is_trueOrFalse(jsonParam);
}
if (verify) {
// 更新第一个任务 任务组、任务顺序号
jsonTask.put("task_group_id", IdUtil.getSnowflake(1, 1).nextId());
jsonTask.put("sort_seq", 1);
wo_Task.update(jsonTask);
// 从右边生成移库单
map.put("flag", "4");
jsonAllBlockPoint = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
}
}
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "10");
mapParam.put("bill_type", "21");
mapParam.put("buss_type", "21");
mapParam.put("biz_date", DateUtil.today());
mapParam.put("stor_code", "CP01");
mapParam.put("stor_id", "1582991156504039424");
mapParam.put("stor_name", "成品仓库");
mapParam.put("is_task", "1");
// 查询移入货位
JSONObject moveParam = new JSONObject();
moveParam.put("box_no", json.getString("storagevehicle_code"));
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
// 查询移出货位的库存物料
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
.addParam("flag", "6")
.addParam("struct_id", json.getString("struct_id"))
.process().uniqueResult(0);
// 移库单明细
JSONObject jsonMoveDtl = new JSONObject();
jsonMoveDtl.put("is_task", "2");
jsonMoveDtl.put("turnout_sect_id", json.getLongValue("sect_id"));
jsonMoveDtl.put("turnout_sect_code", json.getString("sect_code"));
jsonMoveDtl.put("turnout_sect_name", json.getString("sect_name"));
jsonMoveDtl.put("turnout_struct_id", json.getLongValue("struct_id"));
jsonMoveDtl.put("turnout_struct_code", json.getString("struct_code"));
jsonMoveDtl.put("turnout_struct_name", json.getString("struct_name"));
jsonMoveDtl.put("material_id", jsonMoveIvt.getLongValue("material_id"));
jsonMoveDtl.put("pcsn", jsonMoveIvt.getString("pcsn"));
jsonMoveDtl.put("quality_scode", "01");
jsonMoveDtl.put("qty_unit_id", jsonMoveIvt.getLongValue("qty_unit_id"));
jsonMoveDtl.put("qty_unit_name", jsonMoveIvt.getString("unit_name"));
jsonMoveDtl.put("qty", jsonMoveIvt.getDoubleValue("canuse_qty"));
jsonMoveDtl.put("storagevehicle_code", json.getString("storagevehicle_code"));
jsonMoveDtl.put("turnin_sect_id", jsonMove.getLongValue("sect_id"));
jsonMoveDtl.put("turnin_sect_code", jsonMove.getString("sect_code"));
jsonMoveDtl.put("turnin_sect_name", jsonMove.getString("sect_name"));
jsonMoveDtl.put("turnin_struct_id", jsonMove.getLongValue("struct_id"));
jsonMoveDtl.put("turnin_struct_code", jsonMove.getString("struct_code"));
jsonMoveDtl.put("turnin_struct_name", jsonMove.getString("struct_name"));
jsonMoveDtl.put("source_billdtl_id", dis.getLongValue("iostorinvdis_id"));
// 生成任务
JSONObject param2 = new JSONObject();
param2.put("task_type", "010503");
param2.put("vehicle_code", json.getString("storagevehicle_code"));
param2.put("task_name", "task_name");
param2.put("point_code1", json.getString("point_code"));
param2.put("point_code2", jsonMove.getString("struct_code"));
param2.put("task_group_id", jsonTask.getLongValue("task_group_id")); // 任务组
param2.put("sort_seq", jsonTask.getIntValue("sort_seq") + i + 1); // 任务组顺序号
String move_task_id = outTask.createTask(param2);
// 回显移库明细任务id
jsonMoveDtl.put("task_id", move_task_id);
table.add(jsonMoveDtl);
// 更新任务处理类
JSONObject jsonTaskMove = wo_Task.query("task_id = '" + move_task_id + "'").uniqueResult(0);
jsonTaskMove.put("task_type", "010505");
jsonTaskMove.put("handle_class", HandMoveStorAcsTask.class.getName());
wo_Task.update(jsonTaskMove);
mapParam.put("tableData", table);
// 调用移库单新增方法
if (ObjectUtil.isNotEmpty(jsonAllBlockPoint)) {
handMoveStorService.insertDtl2(mapParam);
}
}
}
} else {
JSONObject map = new JSONObject();
map.put("struct_code", jsonAttr.getString("struct_code"));
map.put("sect_id", jsonAttr.getString("sect_id"));
map.put("out_order_seq", jsonAttr.getString("out_order_seq"));
map.put("block_num", jsonAttr.getString("block_num"));
map.put("row_num", jsonAttr.getString("row_num"));
JSONArray jsonAllBlockPoint = new JSONArray();
if (StrUtil.equals(jsonAttr.getString("placement_type"), "02")) {
// 02-左通
map.put("flag", "2");
// 判断左边是否被挡住
JSONObject jsonIsBlockL = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().uniqueResult(0);
// 如果被挡住则进行校验
boolean verify = true;
if (ObjectUtil.isEmpty(jsonIsBlockL)) {
verify = false;
} else {
// 调用验证方法进行校验
String out_order_seq = NumberUtil.add(jsonIsBlockL.getString("out_order_seq"), "1").toString();
JSONObject jsonParam = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + map.getString("block_num")
+ "' and row_num = '" + map.getString("row_num") + "'").uniqueResult(0);
jsonParam.put("iostorinv_id", dis.getString("iostorinv_id"));
jsonParam.put("option", "1");
verify = this.is_trueOrFalse(jsonParam);
}
if (verify) {
// 更新第一个任务 任务组、任务顺序号
jsonTask.put("task_group_id", IdUtil.getSnowflake(1, 1).nextId());
jsonTask.put("sort_seq", 1);
wo_Task.update(jsonTask);
// 从左边生成移库单
map.put("flag", "5");
jsonAllBlockPoint = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
}
}
if (StrUtil.equals(jsonAttr.getString("placement_type"), "03")) {
// 03-右通
map.put("flag", "1");
// 判断左边是否被挡住
JSONObject jsonIsBlockR = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().uniqueResult(0);
// 如果被挡住则进行校验
boolean verify = true;
if (ObjectUtil.isEmpty(jsonIsBlockR)) {
verify = false;
} else {
// 调用验证方法进行校验
String out_order_seq = NumberUtil.sub(jsonIsBlockR.getString("out_order_seq"), "1").toString();
JSONObject jsonParam = attrTab.query("sect_id = '" + map.getString("sect_id")
+ "' and out_order_seq = '" + out_order_seq
+ "' and block_num = '" + map.getString("block_num")
+ "' and row_num = '" + map.getString("row_num") + "'").uniqueResult(0);
jsonParam.put("iostorinv_id", dis.getString("iostorinv_id"));
jsonParam.put("option", "1");
verify = this.is_trueOrFalse(jsonParam);
}
if (verify) {
// 更新第一个任务 任务组、任务顺序号
jsonTask.put("task_group_id", IdUtil.getSnowflake(1, 1).nextId());
jsonTask.put("sort_seq", 1);
wo_Task.update(jsonTask);
// 从右边生成移库单
map.put("flag", "4");
jsonAllBlockPoint = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().getResultJSONArray(0);
}
}
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "10");
mapParam.put("bill_type", "21");
mapParam.put("buss_type", "21");
mapParam.put("biz_date", DateUtil.today());
mapParam.put("stor_code", "CP01");
mapParam.put("stor_id", "1582991156504039424");
mapParam.put("stor_name", "成品仓库");
mapParam.put("is_task", "1");
// 查询移入货位
JSONObject moveParam = new JSONObject();
moveParam.put("box_no", json.getString("storagevehicle_code"));
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
// 查询移出货位的库存物料
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
.addParam("flag", "6")
.addParam("struct_id", json.getString("struct_id"))
.process().uniqueResult(0);
// 移库单明细
JSONObject jsonMoveDtl = new JSONObject();
jsonMoveDtl.put("is_task", "2");
jsonMoveDtl.put("turnout_sect_id", json.getLongValue("sect_id"));
jsonMoveDtl.put("turnout_sect_code", json.getString("sect_code"));
jsonMoveDtl.put("turnout_sect_name", json.getString("sect_name"));
jsonMoveDtl.put("turnout_struct_id", json.getLongValue("struct_id"));
jsonMoveDtl.put("turnout_struct_code", json.getString("struct_code"));
jsonMoveDtl.put("turnout_struct_name", json.getString("struct_name"));
jsonMoveDtl.put("material_id", jsonMoveIvt.getLongValue("material_id"));
jsonMoveDtl.put("pcsn", jsonMoveIvt.getString("pcsn"));
jsonMoveDtl.put("quality_scode", "01");
jsonMoveDtl.put("qty_unit_id", jsonMoveIvt.getLongValue("qty_unit_id"));
jsonMoveDtl.put("qty_unit_name", jsonMoveIvt.getString("unit_name"));
jsonMoveDtl.put("qty", jsonMoveIvt.getDoubleValue("canuse_qty"));
jsonMoveDtl.put("storagevehicle_code", json.getString("storagevehicle_code"));
jsonMoveDtl.put("turnin_sect_id", jsonMove.getLongValue("sect_id"));
jsonMoveDtl.put("turnin_sect_code", jsonMove.getString("sect_code"));
jsonMoveDtl.put("turnin_sect_name", jsonMove.getString("sect_name"));
jsonMoveDtl.put("turnin_struct_id", jsonMove.getLongValue("struct_id"));
jsonMoveDtl.put("turnin_struct_code", jsonMove.getString("struct_code"));
jsonMoveDtl.put("turnin_struct_name", jsonMove.getString("struct_name"));
jsonMoveDtl.put("source_billdtl_id", dis.getLongValue("iostorinvdis_id"));
// 生成任务
JSONObject param2 = new JSONObject();
param2.put("task_type", "010503");
param2.put("vehicle_code", json.getString("storagevehicle_code"));
param2.put("task_name", "task_name");
param2.put("point_code1", json.getString("point_code"));
param2.put("point_code2", jsonMove.getString("struct_code"));
param2.put("task_group_id", jsonTask.getLongValue("task_group_id")); // 任务组
param2.put("sort_seq", jsonTask.getIntValue("sort_seq") + i + 1); // 任务组顺序号
String move_task_id = outTask.createTask(param2);
// 回显移库明细任务id
jsonMoveDtl.put("task_id", move_task_id);
table.add(jsonMoveDtl);
// 更新任务处理类
JSONObject jsonTaskMove = wo_Task.query("task_id = '" + move_task_id + "'").uniqueResult(0);
jsonTaskMove.put("task_type", "010505");
jsonTaskMove.put("handle_class", HandMoveStorAcsTask.class.getName());
wo_Task.update(jsonTaskMove);
mapParam.put("tableData", table);
// 调用移库单新增方法
if (ObjectUtil.isNotEmpty(jsonAllBlockPoint)) {
handMoveStorService.insertDtl2(mapParam);
}
}
}
// 下发
outTask.immediateNotifyAcs(null);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void allSetPoint(JSONObject whereJson) {
@@ -3668,6 +3031,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
@Override
@Transactional(rollbackFor = Exception.class)
public void oneSetPoint2(JSONObject whereJson) {
TranUtil.openTransaction((req, allTransactionConsumer) -> {
allTransactionConsumer.accept("begin");
//出库分配表
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
//点位表
@@ -3944,7 +3309,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
moveParam.put("jsonAllBlockPoint", moveArr);
moveParam.put("iostorinvdis_id", jsonObject.getString("iostorinvdis_id"));
moveParam.put("task_group_id", task_group_id);
this.createMove(moveParam, null);
this.createMove(moveParam, allTransactionConsumer);
}
// 判断是否是异常出库口
@@ -3971,7 +3336,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
point_id = wo_Point.query("point_code = '" + point_code + "'").uniqueResult(0).getString("point_id");
}
allTransactionConsumer.accept(jsonObject.getString("struct_code"));
// 创建任务
JSONObject param = new JSONObject();
param.put("task_type", "010503");
@@ -4041,6 +3406,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
// 查询此任务组最后一个生成的任务
JSONObject jsonTaskLast = wo_Task.query("task_group_id = '" + task_group_id + "' order by sort_seq DESC").uniqueResult(0);
// 创建任务并添加到任务组
allTransactionConsumer.accept(jsonNext.getString("struct_code"));
JSONObject param2 = new JSONObject();
param2.put("task_type", "010503");
param2.put("vehicle_code", jsonNext.getString("box_no"));
@@ -4053,6 +3419,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
String create_task_id2 = outTask.createTask(param2);
outTask.immediateNotifyAcs(null);
// 更新分配状态、任务标识、出库点位
JSONObject jsonTask2 = wo_Task.query("task_id = '" + create_task_id2 + "'").uniqueResult(0);
JSONObject jsonUpdateMap2 = new JSONObject();
@@ -4093,6 +3461,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
task_group_id = IdUtil.getSnowflake(1, 1).nextId();
} else {
}
return null;
}, new JSONArray());
}
@Transactional(rollbackFor = Exception.class)

View File

@@ -601,29 +601,6 @@ export default {
})
}
},
oneSetPoint() {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.point_code) {
this.crud.notify('站点已设置!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.work_status !== '00') {
this.crud.notify('任务已生成!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentDis.iostorinvdis_id !== null) {
this.currentDis.point_code = this.form2.point_code
checkoutbill.oneSetPoint(this.currentDis).then(res => {
this.queryTableDdis(this.currentDis.iostorinvdtl_id)
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
}).catch(() => {
this.currentDis.point_code = ''
})
}
},
oneSetPoint2() {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)