|
|
@ -374,48 +374,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void insertDtlByJson(JSONObject map) { |
|
|
|
//明细另一种写法
|
|
|
|
JSONArray rows = map.getJSONArray("tableData"); |
|
|
|
map.remove("tableData"); |
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + ""; |
|
|
|
String bill_code = CodeUtil.getNewCode("IO_CODE"); |
|
|
|
map.put("iostorinv_id", iostorinv_id); |
|
|
|
map.put("bill_code", bill_code); |
|
|
|
String bill_type = map.getString("bill_type"); |
|
|
|
map.put("buss_type", bill_type.substring(0, 4)); |
|
|
|
map.put("io_type", "1"); |
|
|
|
map.put("detail_count", rows.size() + ""); |
|
|
|
map.put("create_mode", "01"); |
|
|
|
map.put("input_optid", currentUserId + ""); |
|
|
|
map.put("input_optname", nickName); |
|
|
|
map.put("input_time", now); |
|
|
|
map.put("update_optid", currentUserId + ""); |
|
|
|
map.put("update_optname", nickName); |
|
|
|
map.put("update_time", now); |
|
|
|
map.put("is_delete", "0"); |
|
|
|
map.put("is_upload", "0"); |
|
|
|
Long deptId = SecurityUtils.getDeptId(); |
|
|
|
map.put("sysdeptid", deptId); |
|
|
|
map.put("syscompanyid", deptId); |
|
|
|
|
|
|
|
for (int i = 0; i < rows.size(); i++) { |
|
|
|
JSONObject row = rows.getJSONObject(i); |
|
|
|
row.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + ""); |
|
|
|
row.put("iostorinv_id", iostorinv_id); |
|
|
|
row.put("seq_no", (i + 1) + ""); |
|
|
|
row.put("assign_qty", "0"); |
|
|
|
row.put("unassign_qty", row.get("plan_qty")); |
|
|
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(row); |
|
|
|
} |
|
|
|
WQLObject.getWQLObject("ST_IVT_IOStorInv").insert(map); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public String insertDtl(JSONObject map) { |
|
|
@ -2526,13 +2484,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
|
from_end.put("lock_type", "1"); |
|
|
|
storPublicService.updateStructAndPoint2(from_end); |
|
|
|
} |
|
|
|
} else {//仓位载具扔有冻结数,需改任务类型为拣选出库
|
|
|
|
//任务号不为空
|
|
|
|
/* if (ObjectUtil.isNotEmpty(dis.getString("task_id"))) { |
|
|
|
//更新对应任务为拣选出库
|
|
|
|
map.put("taskdtl_type", "05"); |
|
|
|
wo_Task.update(map, "task_id='" + dis.getString("task_id") + "'"); |
|
|
|
}*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -2654,390 +2605,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else {//仓位载具扔有冻结数,需改任务类型为拣选出库
|
|
|
|
//任务号不为空
|
|
|
|
/* if (ObjectUtil.isNotEmpty(dis.getString("task_id"))) { |
|
|
|
//更新对应任务为拣选出库
|
|
|
|
map.put("taskdtl_type", "05"); |
|
|
|
wo_Task.update(map, "task_id='" + dis.getString("task_id") + "'"); |
|
|
|
}*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void setPoint(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"); |
|
|
|
// 库存表
|
|
|
|
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); |
|
|
|
|
|
|
|
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("iostorinvdis_id", whereJson.getString("iostorinvdis_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); |
|
|
|
|
|
|
|
// 判断右边是否被挡住
|
|
|
|
map.put("flag", "1"); |
|
|
|
JSONObject jsonIsBlockR = WQL.getWO("ST_OUTIVT03").addParamMap(map).process().uniqueResult(0); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonIsBlockL) && ObjectUtil.isNotEmpty(jsonIsBlockR)) { |
|
|
|
// 都被挡住判断哪边被挡住的货位少
|
|
|
|
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 { |
|
|
|
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); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonIsBlockL)) { |
|
|
|
// 更新第一个任务 任务组、任务顺序号
|
|
|
|
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); |
|
|
|
|
|
|
|
// 判断左边是否被挡住
|
|
|
|
if (ObjectUtil.isNotEmpty(jsonIsBlockR)) { |
|
|
|
// 更新第一个任务 任务组、任务顺序号
|
|
|
|
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) { |
|
|
@ -5775,59 +5347,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void cancleTaskfinish(JSONObject whereJson) { |
|
|
|
//出库明细表
|
|
|
|
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); |
|
|
|
//出库分配表
|
|
|
|
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); |
|
|
|
//任务表
|
|
|
|
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task"); |
|
|
|
//出库主表
|
|
|
|
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv"); |
|
|
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
|
|
|
|
String iostorinv_id = whereJson.getString("iostorinv_id"); |
|
|
|
String task_id = whereJson.getString("task_id"); |
|
|
|
|
|
|
|
// 更新任务状态
|
|
|
|
JSONObject jsonTask = wo_Task.query("task_id ='" + task_id + "'").uniqueResult(0); |
|
|
|
jsonTask.put("task_status", TaskStatusEnum.ISSUE.getCode()); |
|
|
|
jsonTask.put("update_optid", currentUserId); |
|
|
|
jsonTask.put("update_optname", nickName); |
|
|
|
jsonTask.put("update_time", now); |
|
|
|
wo_Task.update(jsonTask); |
|
|
|
|
|
|
|
//查询主表信息
|
|
|
|
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0); |
|
|
|
if (ObjectUtil.isEmpty(jo_mst)) { |
|
|
|
throw new BadRequestException("未查到相关出库单"); |
|
|
|
} |
|
|
|
|
|
|
|
if ("99".equals(jo_mst.getString("bill_status"))) { |
|
|
|
throw new BadRequestException("已完成单据不允许取消完成!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 查询此任务下的所有分配明细
|
|
|
|
JSONArray disArr = wo_dis.query("task_id ='" + task_id + "'").getResultJSONArray(0); |
|
|
|
|
|
|
|
for (int i = 0; i < disArr.size(); i++) { |
|
|
|
JSONObject jsonDis = disArr.getJSONObject(i); |
|
|
|
|
|
|
|
// 更新分配明细状态
|
|
|
|
jsonDis.put("work_status", "01"); |
|
|
|
wo_dis.update(jsonDis); |
|
|
|
|
|
|
|
// 更新明细状态
|
|
|
|
JSONObject jsonDtl = wo_dtl.query("iostorinvdtl_id = '" + jsonDis.getString("iostorinvdtl_id") + "'").uniqueResult(0); |
|
|
|
jsonDtl.put("bill_status", "40"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONArray getInvTypes() { |
|
|
|
//查询单据字段类型
|
|
|
@ -5838,107 +5357,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
|
return ja; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject getParamByCodeType(JSONObject form) { |
|
|
|
String bill_type = form.getString("bill_type"); |
|
|
|
if (StrUtil.isEmpty(bill_type)) { |
|
|
|
throw new BadRequestException("出库单类型不能为空!"); |
|
|
|
} |
|
|
|
Map whereJson = new HashMap<String, String>(); |
|
|
|
String io_flag = form.getString("io_flag"); |
|
|
|
whereJson.put("io_code", bill_type.substring(0, 4)); |
|
|
|
whereJson.put("io_flag", "01"); |
|
|
|
if (StrUtil.isNotEmpty(bill_type)) { |
|
|
|
whereJson.put("io_flag", io_flag); |
|
|
|
} |
|
|
|
JSONArray ja = null; |
|
|
|
JSONObject ret = new JSONObject(); |
|
|
|
if (ja.size() != 0) { |
|
|
|
for (int i = 0; i < ja.size(); i++) { |
|
|
|
JSONObject jo = ja.getJSONObject(i); |
|
|
|
if (bill_type.equals(jo.getString("code"))) { |
|
|
|
ret = jo; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new BadRequestException("出库类型系统参数查询失败!"); |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONArray schAreaType(JSONObject form) { |
|
|
|
String ids = form.getString("ids"); |
|
|
|
//查询单据字段类型
|
|
|
|
JSONArray ja = WQL.getWO("ST_PUB_QUERY_01") |
|
|
|
.addParam("flag", "5") |
|
|
|
.addParam("ids", ids) |
|
|
|
.process() |
|
|
|
.getResultJSONArray(0); |
|
|
|
return ja; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void backConfirm(JSONObject whereJson) { |
|
|
|
WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl"); |
|
|
|
WQLObject mst_wql = WQLObject.getWQLObject("ST_IVT_IOStorInv"); |
|
|
|
|
|
|
|
JSONObject mst_row = mst_wql.query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").uniqueResult(0); |
|
|
|
//校验主表状态为生成
|
|
|
|
String bill_status = mst_row.getString("bill_status"); |
|
|
|
if (!"10".equals(bill_status)) { |
|
|
|
throw new BadRequestException("主表状态必须为生成状态!"); |
|
|
|
} |
|
|
|
JSONArray dtl_rows = dtl_wql.query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").getResultJSONArray(0); |
|
|
|
|
|
|
|
//生成手工入库库单
|
|
|
|
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + ""; |
|
|
|
String bill_code = CodeUtil.getNewCode("IO_CODE"); |
|
|
|
|
|
|
|
for (int i = 0; i < dtl_rows.size(); i++) { |
|
|
|
JSONObject dtl_row = dtl_rows.getJSONObject(i); |
|
|
|
dtl_row.put("source_billdtl_id", dtl_row.getString("iostorinvdtl_id")); |
|
|
|
dtl_row.put("source_bill_type", mst_row.getString("bill_type")); |
|
|
|
dtl_row.put("source_bill_code", mst_row.getString("bill_code")); |
|
|
|
dtl_row.put("source_bill_table", "ST_IVT_IOStorInvDtl"); |
|
|
|
dtl_row.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId()); |
|
|
|
dtl_row.put("iostorinv_id", iostorinv_id); |
|
|
|
dtl_wql.insert(dtl_row); |
|
|
|
} |
|
|
|
|
|
|
|
mst_row.put("iostorinv_id", iostorinv_id); |
|
|
|
mst_row.put("bill_code", bill_code); |
|
|
|
mst_row.put("io_type", "0"); |
|
|
|
mst_row.put("bill_type", "000401"); |
|
|
|
mst_row.put("buss_type", ((String) mst_row.get("bill_type")).substring(0, 4)); |
|
|
|
mst_wql.insert(mst_row); |
|
|
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
String now = DateUtil.now(); |
|
|
|
JSONObject mst_row2 = mst_wql.query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").uniqueResult(0); |
|
|
|
|
|
|
|
mst_row2.put("bill_status", "99"); |
|
|
|
mst_row2.put("confirm_optid", currentUserId); |
|
|
|
mst_row2.put("confirm_optname", nickName); |
|
|
|
mst_row2.put("confirm_time", now); |
|
|
|
//更新主表状态为99
|
|
|
|
mst_wql.update(mst_row2); |
|
|
|
|
|
|
|
HashMap<String, String> map = new HashMap<>(); |
|
|
|
map.put("bill_status", "99"); |
|
|
|
dtl_wql.update(map, "iostorinv_id = '" + whereJson.get("iostorinv_id") + "'"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public JSONArray getType() { |
|
|
|
JSONArray jsonArr = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("flag", "11").process().getResultJSONArray(0); |
|
|
|
return jsonArr; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void moneySubmit(JSONObject whereJson) { |
|
|
@ -6303,31 +5721,4 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { |
|
|
|
} |
|
|
|
wo_mst.update(jo_mst); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断仓位上可用数是否为0,0返回true,非0返回false |
|
|
|
* |
|
|
|
* @param code 载具编码或者仓位编码 |
|
|
|
*/ |
|
|
|
boolean canuse_is_zero(String code) { |
|
|
|
//仓位库存表
|
|
|
|
WQLObject wo_StructIvt = WQLObject.getWQLObject("ST_IVT_StructIvt"); |
|
|
|
//仓位表
|
|
|
|
WQLObject wo_Struct = WQLObject.getWQLObject("ST_IVT_StructAttr"); |
|
|
|
if (StrUtil.isEmpty(code)) { |
|
|
|
throw new BadRequestException("仓位编码不能为空!"); |
|
|
|
} |
|
|
|
//查询仓位信息
|
|
|
|
JSONObject jo_mst = wo_Struct.query("struct_code = '" + code + "'").uniqueResult(0); |
|
|
|
if (jo_mst != null) { |
|
|
|
//查询可用数大于0的记录数
|
|
|
|
JSONArray ja = wo_StructIvt.query("canuse_qty>0 and struct_code = '" + code + "'").getResultJSONArray(0); |
|
|
|
if (ja.size() != 0) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new BadRequestException("查询不到相关仓位!"); |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|