Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
# Conflicts: # lms/nladmin-system/src/main/java/org/nl/modules/system/wql/sys.xls
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
FROM
|
||||
md_pb_storagevehicleinfo info
|
||||
LEFT JOIN md_pb_storagevehicleext ext ON info.storagevehicle_id = ext.storagevehicle_id
|
||||
LEFT JOIN sys_dict_detail d ON info.storagevehicle_type = d.value and d.name = 'storagevehicle_type'
|
||||
LEFT JOIN sys_dict d ON info.storagevehicle_type = d.value and d.code = 'storagevehicle_type'
|
||||
LEFT JOIN MD_ME_MaterialBase mdb ON ext.material_id = mdb.material_id
|
||||
LEFT JOIN MD_ME_ProducMaterialExt mdp ON mdb.material_id = mdp.material_id
|
||||
LEFT JOIN sch_base_point point ON info.storagevehicle_code = point.vehicle_code
|
||||
@@ -102,9 +102,9 @@
|
||||
dict.label,
|
||||
dict.value
|
||||
FROM
|
||||
sys_dict_detail dict
|
||||
sys_dict dict
|
||||
WHERE
|
||||
dict.name = 'storagevehicle_type'
|
||||
dict.code = 'storagevehicle_type'
|
||||
AND dict.value in (30,31,32,33)
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
point.point_name
|
||||
FROM
|
||||
md_pb_storagevehicleinfo s
|
||||
LEFT JOIN sys_dict_detail d ON s.storagevehicle_type = d.value and d.dict_id = '32'
|
||||
LEFT JOIN sys_dict d ON s.storagevehicle_type = d.value and d.code = 'storagevehicle_type'
|
||||
LEFT JOIN sch_base_point point ON point.vehicle_code = s.storagevehicle_code
|
||||
LEFT JOIN ST_IVT_StructIvt ivt ON point.source_id = ivt.struct_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN md_pb_storagevehiclepoint svp ON point.point_id = svp.point_id and svp.set_type <>'02'
|
||||
LEFT JOIN sys_dict_detail d ON svp.set_type = d.value and d.name = 'set_type'
|
||||
LEFT JOIN sys_dict d ON svp.set_type = d.value and d.code = 'set_type'
|
||||
WHERE
|
||||
point.is_delete = '0'
|
||||
AND point.is_used = '1'
|
||||
@@ -77,9 +77,9 @@
|
||||
dict.label,
|
||||
dict.value
|
||||
FROM
|
||||
sys_dict_detail dict
|
||||
sys_dict dict
|
||||
WHERE
|
||||
dict.name = 'storagevehicle_type'
|
||||
dict.code = 'storagevehicle_type'
|
||||
AND dict.value in (30,31,32,33)
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
@@ -91,9 +91,9 @@
|
||||
dict.label,
|
||||
dict.value
|
||||
FROM
|
||||
sys_dict_detail dict
|
||||
sys_dict dict
|
||||
WHERE
|
||||
dict.name = 'sch_area_type'
|
||||
dict.code = 'sch_area_type'
|
||||
AND dict.value in (25,26,32,28)
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
md_pb_storagevehicleinfo info
|
||||
LEFT JOIN md_pb_storagevehiclepoint svp ON info.storagevehicle_id = svp.storagevehicle_id and svp.set_type <>'01'
|
||||
LEFT JOIN sch_base_point point ON point.point_id = svp.point_id
|
||||
LEFT JOIN sys_dict_detail d ON info.storagevehicle_type = d.value and d.name = 'storagevehicle_type'
|
||||
LEFT JOIN sys_dict d ON info.storagevehicle_type = d.value and d.code = 'storagevehicle_type'
|
||||
WHERE
|
||||
info.is_delete = '0'
|
||||
AND info.is_used = '1'
|
||||
@@ -99,9 +99,9 @@
|
||||
dict.label,
|
||||
dict.value
|
||||
FROM
|
||||
sys_dict_detail dict
|
||||
sys_dict dict
|
||||
WHERE
|
||||
dict.name = 'storagevehicle_type'
|
||||
dict.code = 'storagevehicle_type'
|
||||
AND dict.value in (30,31,32,33)
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
|
||||
@@ -94,13 +94,13 @@
|
||||
LEFT JOIN md_me_stockmaterialext s ON m.material_id = s.material_id
|
||||
LEFT JOIN md_me_producmaterialext p ON m.material_id = p.material_id
|
||||
LEFT JOIN md_pb_classstandard b ON m.material_type_id = b.class_id
|
||||
LEFT JOIN sys_dict_detail d1 ON d1.value = p.product_mode and d1.name = 'product_mode'
|
||||
LEFT JOIN sys_dict_detail d2 ON d2.value = s.is_need_plan and d2.name = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict_detail d3 ON d3.value = s.is_report and d3.name = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict_detail d7 ON d7.value = p.is_report and d7.name = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict_detail d4 ON d4.value = p.is_auto_open and d4.name = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict_detail d5 ON d5.value = p.is_again_put and d5.name = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict_detail d6 ON d6.value = p.product_series and d6.name = 'product_series'
|
||||
LEFT JOIN sys_dict d1 ON d1.value = p.product_mode and d1.code = 'product_mode'
|
||||
LEFT JOIN sys_dict d2 ON d2.value = s.is_need_plan and d2.code = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict d3 ON d3.value = s.is_report and d3.code = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict d7 ON d7.value = p.is_report and d7.code = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict d4 ON d4.value = p.is_auto_open and d4.code = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict d5 ON d5.value = p.is_again_put and d5.code = 'IS_OR_NOT'
|
||||
LEFT JOIN sys_dict d6 ON d6.value = p.product_series and d6.code = 'product_series'
|
||||
LEFT JOIN md_pb_measureunit u ON u.measure_unit_id = m.base_unit_id
|
||||
WHERE
|
||||
m.is_delete = '0'
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
detail.label
|
||||
FROM
|
||||
st_ivt_bsrealstorattr stor
|
||||
LEFT JOIN sys_dict_detail detail ON detail.value = stor.stor_type_scode AND detail.dict_id = '30'
|
||||
LEFT JOIN sys_dict detail ON detail.value = stor.stor_type_scode AND detail.code = 'st_stor_type'
|
||||
WHERE
|
||||
stor.is_delete = '0'
|
||||
OPTION 输入.search <> ""
|
||||
|
||||
@@ -119,9 +119,9 @@
|
||||
label AS text,
|
||||
value
|
||||
FROM
|
||||
sys_dict_detail
|
||||
sys_dict
|
||||
WHERE
|
||||
name = 'product_area'
|
||||
code = 'product_area'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
|
||||
@@ -87,9 +87,9 @@
|
||||
label AS text,
|
||||
value
|
||||
FROM
|
||||
sys_dict_detail
|
||||
sys_dict
|
||||
WHERE
|
||||
dict_id = '115'
|
||||
code = 'sch_cool_ivt_status'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
@@ -100,9 +100,9 @@
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sys_dict_detail
|
||||
sys_dict
|
||||
WHERE
|
||||
name = 'task_priority'
|
||||
code = 'task_priority'
|
||||
AND
|
||||
label = 输入.task_type
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@
|
||||
value,
|
||||
label
|
||||
FROM
|
||||
sys_dict_detail
|
||||
sys_dict
|
||||
WHERE
|
||||
name = 'product_area'
|
||||
code = 'product_area'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
|
||||
@@ -149,9 +149,9 @@
|
||||
label AS text,
|
||||
value
|
||||
FROM
|
||||
sys_dict_detail
|
||||
sys_dict
|
||||
WHERE
|
||||
name = 'ST_INV_OUT_TYPE'
|
||||
code = 'ST_INV_OUT_TYPE'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
LEFT JOIN sys_dict_detail d3 ON point.lock_type = d3.value and d3.name='d_lock_type'
|
||||
LEFT JOIN sys_dict d3 ON point.lock_type = d3.value and d3.code='d_lock_type'
|
||||
WHERE
|
||||
point.is_delete = '0'
|
||||
OPTION 输入.region_id <> ""
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
FROM
|
||||
sch_base_task task
|
||||
LEFT JOIN md_pb_classstandard md ON task.task_type = md.class_code
|
||||
LEFT JOIN sys_dict_detail dict ON dict.`value` = task.task_status AND dict.`name` = 'task_status'
|
||||
LEFT JOIN sys_dict dict ON dict.`value` = task.task_status AND dict.`code` = 'task_status'
|
||||
WHERE
|
||||
task.is_delete = '0'
|
||||
OPTION 输入.task_type <> ""
|
||||
|
||||
@@ -116,6 +116,11 @@ public interface CheckOutBillService {
|
||||
* @param whereJson /
|
||||
*/
|
||||
void setPoint(JSONObject whereJson);
|
||||
/**
|
||||
* 设置一个站点
|
||||
* @param whereJson /
|
||||
*/
|
||||
void oneSetPoint(JSONObject whereJson);
|
||||
/**
|
||||
* 查询可分配库存
|
||||
* @param whereJson /
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
FROM
|
||||
st_ivt_iostorinvdisdtl disdtl
|
||||
LEFT JOIN md_pb_bucketrecord bucket ON bucket.bucketunique = disdtl.bucketunique
|
||||
LEFT JOIN sys_dict_detail detail ON detail.`value` = bucket.storagevehicle_type
|
||||
LEFT JOIN sys_dict detail ON detail.`value` = bucket.storagevehicle_type
|
||||
INNER JOIN sys_dict dict ON dict.dict_id = detail.dict_id
|
||||
AND dict.`name` LIKE 'MD_BUCKET_TYPE%'
|
||||
INNER JOIN md_me_materialbase mb ON mb.material_id = bucket.material_id
|
||||
@@ -374,9 +374,7 @@
|
||||
st_ivt_iostorinvdisdtl disdtl
|
||||
INNER JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = disdtl.iostorinv_id
|
||||
LEFT JOIN st_ivt_iostorinvdtl dtl ON dtl.iostorinvdtl_id = disdtl.iostorinvdtl_id
|
||||
LEFT JOIN sys_dict_detail detail ON detail.`value` = mst.bill_type
|
||||
LEFT JOIN sys_dict dict ON dict.dict_id = detail.dict_id
|
||||
AND dict.`name` LIKE 'ST_INV_TYPE%'
|
||||
LEFT JOIN sys_dict detail ON detail.`value` = mst.bill_type AND detail.code LIKE 'ST_INV_TYPE%'
|
||||
INNER JOIN md_me_materialbase mb ON mb.material_id = disdtl.material_id
|
||||
INNER JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
WHERE
|
||||
|
||||
@@ -112,33 +112,15 @@
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
max(detail.VALUE) AS CODE,
|
||||
max(detail.label) AS NAME
|
||||
max(value) AS CODE,
|
||||
max(label) AS NAME
|
||||
FROM
|
||||
sys_dict_detail detail
|
||||
LEFT JOIN sys_dict dict ON dict.dict_id = detail.dict_id
|
||||
sys_dict
|
||||
WHERE
|
||||
1 = 1
|
||||
AND dict. NAME LIKE '%INV_TYPE%'
|
||||
group by detail.VALUE
|
||||
AND CODE LIKE '%INV_TYPE%'
|
||||
|
||||
group by value
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
detail.VALUE,
|
||||
detail.label
|
||||
FROM
|
||||
sys_dict_detail detail
|
||||
inner JOIN sys_dict dict ON dict.dict_id = detail.dict_id and dict.dict_id='6'
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.ids <> ""
|
||||
detail.VALUE in (输入.ids)
|
||||
ENDOPTION
|
||||
order by detail.dict_sort
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
ENDIF
|
||||
@@ -124,6 +124,13 @@ public class CheckOutBillController {
|
||||
checkOutBillService.setPoint(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@PostMapping("/oneSetPoint")
|
||||
@Log("设置一个站点")
|
||||
@ApiOperation("设置检验站点")
|
||||
public ResponseEntity<Object> oneSetPoint(@RequestBody JSONObject whereJson) {
|
||||
checkOutBillService.oneSetPoint(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@GetMapping("/getOutBillTask")
|
||||
@Log("查询出库单分配任务")
|
||||
@ApiOperation("查询出库单分配任务")
|
||||
|
||||
@@ -87,6 +87,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
if (StrUtil.isNotEmpty(map.get("vbeln"))) {
|
||||
map.put("vbeln", "%" + map.get("vbeln") + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(map.get("width"))) {
|
||||
map.put("width", "%" + map.get("width") + "%");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(map.get("pcsn"))) {
|
||||
map.put("pcsn", "%" + map.get("pcsn") + "%");
|
||||
}
|
||||
@@ -464,6 +467,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
jsonDtl.put("unassign_qty", row.get("plan_qty"));
|
||||
jsonDtl.put("vbeln", row.getString("vbeln"));
|
||||
jsonDtl.put("posnr", row.getString("posnr"));
|
||||
jsonDtl.put("width", row.getString("width"));
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(jsonDtl);
|
||||
qty += jsonDtl.getDoubleValue("plan_qty");
|
||||
|
||||
@@ -1655,6 +1659,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
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);
|
||||
|
||||
@@ -1774,6 +1779,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
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);
|
||||
|
||||
@@ -1787,7 +1793,770 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
// 下发
|
||||
outTask.immediateNotifyAcs(null);
|
||||
}
|
||||
}
|
||||
|
||||
@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");
|
||||
// 库存表
|
||||
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("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");
|
||||
}
|
||||
} 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");
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean is_trueOrFalse(JSONObject json) {
|
||||
/*
|
||||
* 判断此货位在此出库单分配明细中是否存在:
|
||||
* 1.如果存在:
|
||||
* 1)判断此货位是否生成任务:生成:则没有任务组 = false,未生成:报错
|
||||
* 2.如果不存在:则判断此货位是否被锁住
|
||||
* 1)未锁住:生成移库单 = true
|
||||
* 2)锁住:判断是否生成任务,生成:则不用生成移库单 = false;未生成则报错
|
||||
*/
|
||||
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配明细表
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task"); // 任务表
|
||||
|
||||
if (ObjectUtil.isEmpty(json)) {
|
||||
// 如果为空说明未堵住
|
||||
return false;
|
||||
}
|
||||
|
||||
String struct_code = json.getString("struct_code");
|
||||
String iostorinv_id = json.getString("iostorinv_id");
|
||||
|
||||
if (ObjectUtil.isEmpty(struct_code)) throw new BadRequestException("校验仓位不能为空");
|
||||
|
||||
boolean param = false;
|
||||
|
||||
if (StrUtil.equals(json.getString("option"), "1")) {
|
||||
// 单通
|
||||
// 判断此货位在此出库单中是否存在
|
||||
JSONObject jsondis = disTab.query("iostorinv_id = '" + iostorinv_id + "' and struct_code = '" + struct_code + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsondis)) {
|
||||
// 存在:判断是否生成任务
|
||||
if (!StrUtil.equals(jsondis.getString("work_status"),"00")) {
|
||||
param = false;
|
||||
} else {
|
||||
throw new BadRequestException("此仓位不可生成任务,请按照顺序选择!");
|
||||
}
|
||||
} else {
|
||||
// 不存在: 判断此货位是否被锁住
|
||||
if (StrUtil.equals(json.getString("lock_type"), "1")) {
|
||||
// 未锁住:返回true
|
||||
param = true;
|
||||
} else {
|
||||
// 锁住:判断是否生成任务,生成:则不用生成移库单 = false;未生成则报错
|
||||
JSONObject jsonTask1 = taskTab.query("point_code1 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
JSONObject jsonTask2 = taskTab.query("point_code2 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonTask1) && ObjectUtil.isEmpty(jsonTask2)) {
|
||||
// 未生成任务
|
||||
throw new BadRequestException("挡住仓位"+struct_code+"已锁定但未生成任务,请按照顺序选择");
|
||||
} else {
|
||||
// 已生成
|
||||
param = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (StrUtil.equals(json.getString("option"), "2")){
|
||||
// 双通
|
||||
// 判断此货位在此出库单中是否存在
|
||||
JSONObject jsondis = disTab.query("iostorinv_id = '" + iostorinv_id + "' and struct_code = '" + struct_code + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsondis)) {
|
||||
param = false;
|
||||
} else {
|
||||
// 不存在: 判断此货位是否被锁住
|
||||
if (StrUtil.equals(json.getString("lock_type"), "1")) {
|
||||
// 未锁住:返回true
|
||||
param = true;
|
||||
} else {
|
||||
// 锁住:判断是否生成任务,生成:则不用生成移库单 = false;未生成则报错
|
||||
JSONObject jsonTask1 = taskTab.query("point_code1 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
JSONObject jsonTask2 = taskTab.query("point_code2 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonTask1) && ObjectUtil.isEmpty(jsonTask2)) {
|
||||
// 未生成任务
|
||||
param = true;
|
||||
} else {
|
||||
// 已生成
|
||||
param = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (StrUtil.equals(json.getString("option"), "3")) {
|
||||
// 判断此货位在此出库单中是否存在
|
||||
JSONObject jsondis = disTab.query("iostorinv_id = '" + iostorinv_id + "' and struct_code = '" + struct_code + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsondis)) {
|
||||
// 存在:判断是否生成任务
|
||||
if (!StrUtil.equals(jsondis.getString("work_status"),"00")) {
|
||||
param = true;
|
||||
} else {
|
||||
param = false;
|
||||
}
|
||||
} else {
|
||||
// 不存在: 判断此货位是否被锁住
|
||||
if (StrUtil.equals(json.getString("lock_type"), "1")) {
|
||||
// 未锁住:返回true
|
||||
param = false;
|
||||
} else {
|
||||
// 锁住:判断是否生成任务,生成:则不用生成移库单 = false;未生成则报错
|
||||
JSONObject jsonTask1 = taskTab.query("point_code1 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
JSONObject jsonTask2 = taskTab.query("point_code2 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonTask1) && ObjectUtil.isEmpty(jsonTask2)) {
|
||||
// 未生成任务
|
||||
param = false;
|
||||
} else {
|
||||
// 已生成
|
||||
param = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (StrUtil.equals(json.getString("option"), "4")) {
|
||||
if (StrUtil.equals(json.getString("lock_type"), "1")) {
|
||||
// 未锁住:返回true
|
||||
param = true;
|
||||
} else {
|
||||
// 锁住:判断是否生成任务,生成:则不用生成移库单 = false;未生成则报错
|
||||
JSONObject jsonTask1 = taskTab.query("point_code1 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
JSONObject jsonTask2 = taskTab.query("point_code2 = '" + struct_code + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonTask1) && ObjectUtil.isEmpty(jsonTask2)) {
|
||||
// 未生成任务
|
||||
param = true;
|
||||
} else {
|
||||
// 已生成
|
||||
param = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return param;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2966,6 +3735,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
json.put("num", dtlArr.size());
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONArray queryBox(JSONObject whereJson) {
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
输入.cust_code TYPEAS s_string
|
||||
输入.package_box_sn TYPEAS s_string
|
||||
输入.is_upload TYPEAS s_string
|
||||
输入.width TYPEAS s_string
|
||||
输入.in_stor_id TYPEAS f_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -121,6 +122,10 @@
|
||||
dtl.vbeln like 输入.vbeln
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.width <> ""
|
||||
dtl.width like 输入.width
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.bill_type <> ""
|
||||
ios.bill_type = 输入.bill_type
|
||||
ENDOPTION
|
||||
@@ -165,7 +170,7 @@
|
||||
LEFT JOIN ST_IVT_IOStorInv ios ON ios.iostorinv_id = iosdtl.iostorinv_id
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = iosdtl.pcsn
|
||||
WHERE
|
||||
sub.status = '2'
|
||||
1=1
|
||||
OPTION 输入.iostorinv_id <> ""
|
||||
iosdtl.iostorinv_id = 输入.iostorinv_id
|
||||
ENDOPTION
|
||||
@@ -393,7 +398,7 @@
|
||||
dis.work_status <= 输入.bill_status
|
||||
ENDOPTION
|
||||
|
||||
order by attr.row_num,attr.out_order_seq ASC
|
||||
order by attr.layer_num ASC,attr.row_num ASC,attr.col_num ASC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -695,21 +700,6 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "11"
|
||||
QUERY
|
||||
SELECT
|
||||
detail.value AS code,
|
||||
detail.label AS name
|
||||
FROM
|
||||
sys_dict_detail detail
|
||||
INNER JOIN sys_dict dict ON detail.dict_id = dict.dict_id
|
||||
WHERE
|
||||
dict.name = 'ST_INV_TYPE_IO'
|
||||
AND detail.name = 'IO_BUSS_TYPE'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "12"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
|
||||
@@ -84,7 +84,6 @@
|
||||
st_ivt_structattr sa3
|
||||
WHERE
|
||||
IFNULL( sa3.storagevehicle_code, '' ) <> ''
|
||||
AND sa3.lock_type = '1'
|
||||
) c
|
||||
WHERE
|
||||
c.block_num = a.block_num
|
||||
@@ -137,7 +136,6 @@
|
||||
st_ivt_structattr sa2
|
||||
WHERE
|
||||
IFNULL( sa2.storagevehicle_code, '' ) <> ''
|
||||
AND sa2.lock_type = '1'
|
||||
) b
|
||||
WHERE
|
||||
b.block_num = a.block_num
|
||||
@@ -169,8 +167,8 @@
|
||||
AND b.row_num = sa.row_num
|
||||
WHERE
|
||||
sa.out_order_seq < 输入.out_order_seq
|
||||
and sa.lock_type = '1'
|
||||
AND IFNULL( sa.storagevehicle_code, '' ) <> ''
|
||||
AND sa.lock_type = '1'
|
||||
|
||||
UNION
|
||||
|
||||
@@ -191,8 +189,8 @@
|
||||
AND b.row_num = sa.row_num
|
||||
WHERE
|
||||
sa.out_order_seq > 输入.out_order_seq
|
||||
and sa.lock_type = '1'
|
||||
AND IFNULL( sa.storagevehicle_code, '' ) <> ''
|
||||
AND sa.lock_type = '1'
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
|
||||
Reference in New Issue
Block a user