代码更新
This commit is contained in:
@@ -15,6 +15,7 @@ import org.nl.modules.wql.WQL;
|
|||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.wms.pda.mps.service.BakingService;
|
import org.nl.wms.pda.mps.service.BakingService;
|
||||||
import org.nl.wms.sch.manage.RegionTypeEnum;
|
import org.nl.wms.sch.manage.RegionTypeEnum;
|
||||||
|
import org.nl.wms.sch.tasks.InCoolIvtTask;
|
||||||
import org.nl.wms.sch.tasks.InHotTask;
|
import org.nl.wms.sch.tasks.InHotTask;
|
||||||
import org.nl.wms.sch.tasks.OutHotTask;
|
import org.nl.wms.sch.tasks.OutHotTask;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -70,22 +71,22 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
*/
|
*/
|
||||||
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(jsonPointZc)) {
|
if (ObjectUtil.isNotEmpty(jsonPointZc)) {
|
||||||
// 暂存区入烘箱
|
/*
|
||||||
|
* 暂存区入烘箱
|
||||||
// 查询烘箱对应的空位
|
*/
|
||||||
|
// 1.查询烘箱对应的空位
|
||||||
JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + jsonPointZc.getString("product_area") + "' and temperature = '" + temperature + "' and point_location = '"+jsonPointZc.getString("point_location")+"' and is_used = '1' and point_status = '01' order by point_code ASC").uniqueResult(0);
|
JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + jsonPointZc.getString("product_area") + "' and temperature = '" + temperature + "' and point_location = '"+jsonPointZc.getString("point_location")+"' and is_used = '1' and point_status = '01' order by point_code ASC").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位");
|
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位");
|
||||||
// 创建暂存位 --> 烘烤区任务
|
// 2.创建暂存位 --> 烘烤区任务
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("type","2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱
|
param.put("type","2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱
|
||||||
param.put("point_code1",point_code1);
|
param.put("point_code1",point_code1);
|
||||||
param.put("point_code2",jsonHotIvt.getString("point_code"));
|
param.put("point_code2",jsonHotIvt.getString("point_code"));
|
||||||
|
|
||||||
// 创建冷却区 --> 暂存位的任务
|
|
||||||
InHotTask inHotTask = new InHotTask(null);
|
InHotTask inHotTask = new InHotTask(null);
|
||||||
String task_id = inHotTask.createTask(param);
|
String task_id = inHotTask.createTask(param);
|
||||||
|
|
||||||
// 插入明细明细
|
// 3.插入明细明细
|
||||||
JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + container_name + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0);
|
JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + container_name + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在");
|
if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在");
|
||||||
|
|
||||||
@@ -99,96 +100,108 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
hotParam.put("oven_time",hours);
|
hotParam.put("oven_time",hours);
|
||||||
this.createHotDtl(hotParam);
|
this.createHotDtl(hotParam);
|
||||||
|
|
||||||
}
|
// 4.下发任务
|
||||||
|
JSONObject jsonObject = inHotTask.renotifyAcs(task_id);
|
||||||
// 1.根据冷却区此母卷的点位找到对应的暂存区、找到空位
|
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||||
JSONObject jsonCoolIvt = coolIvtTab.query("container_name ='" + container_name + "' and is is_used = '1' and full_point_status = '02'").uniqueResult(0);
|
// 成功返回 更新任务状态
|
||||||
if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("母卷不存在");
|
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||||
|
jsonTask.put("task_status", "05");
|
||||||
String product_area = jsonCoolIvt.getString("product_area"); // 生产区域
|
taskTab.update(jsonTask);
|
||||||
String point_location = jsonCoolIvt.getString("point_location"); // 位置
|
|
||||||
String reging_id = "";
|
|
||||||
|
|
||||||
switch (product_area) {
|
|
||||||
case "A":
|
|
||||||
reging_id = RegionTypeEnum.A_HKZC.getId();
|
|
||||||
break;
|
|
||||||
case "B":
|
|
||||||
reging_id = RegionTypeEnum.B_HKZC.getId();
|
|
||||||
break;
|
|
||||||
case "C":
|
|
||||||
reging_id = RegionTypeEnum.C_HKZC.getId();
|
|
||||||
break;
|
|
||||||
case "D":
|
|
||||||
reging_id = RegionTypeEnum.D_HKZC.getId();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
JSONObject map = new JSONObject();
|
|
||||||
map.put("flag", "1");
|
|
||||||
map.put("reging_id", reging_id);
|
|
||||||
map.put("point_location", point_location);
|
|
||||||
|
|
||||||
JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
|
|
||||||
if (ObjectUtil.isEmpty(pointArr)) {
|
|
||||||
if (StrUtil.equals(point_location, "0")) map.put("point_location","1");
|
|
||||||
if (StrUtil.equals(point_location, "1")) map.put("point_location","0");
|
|
||||||
pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(pointArr)) throw new BadRequestException("没有空暂存位");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2.判断暂存位是否有任务:找到无任务的暂存位 、查询烘箱对应的空位
|
|
||||||
String point_code2 = "";
|
|
||||||
for (int i = 0; i < pointArr.size(); i++) {
|
|
||||||
JSONObject jsonPoint = pointArr.getJSONObject(i);
|
|
||||||
String point_code = jsonPoint.getString("point_code");
|
|
||||||
|
|
||||||
JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
|
||||||
JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
|
||||||
JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
|
||||||
JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) {
|
|
||||||
point_code2 = point_code;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
if (ObjectUtil.isEmpty(point_code2)) throw new BadRequestException("没有空暂存位");
|
/*
|
||||||
|
* 冷却区入烘箱
|
||||||
|
*/
|
||||||
|
// 1.根据冷却区此母卷的点位找到对应的暂存区、找到空位
|
||||||
|
JSONObject jsonCoolIvt = coolIvtTab.query("container_name ='" + container_name + "' and is is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("母卷不存在");
|
||||||
|
|
||||||
// 查询烘箱对应的空位
|
String product_area = jsonCoolIvt.getString("product_area"); // 生产区域
|
||||||
JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + product_area + "' and temperature = '" + temperature + "' and point_location = '"+map.getString("point_location")+"' and is_used = '1' and point_status = '01' order by point_code ASC").uniqueResult(0);
|
String point_location = jsonCoolIvt.getString("point_location"); // 位置
|
||||||
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位");
|
String reging_id = "";
|
||||||
|
|
||||||
// 3.创建冷却区 --> 烘烤区任务
|
switch (product_area) {
|
||||||
JSONObject param = new JSONObject();
|
case "A":
|
||||||
param.put("point_code1",point_code1);
|
reging_id = RegionTypeEnum.A_HKZC.getId();
|
||||||
param.put("point_code2",point_code2);
|
break;
|
||||||
param.put("point_code3",jsonHotIvt.getString("point_code"));
|
case "B":
|
||||||
|
reging_id = RegionTypeEnum.B_HKZC.getId();
|
||||||
|
break;
|
||||||
|
case "C":
|
||||||
|
reging_id = RegionTypeEnum.C_HKZC.getId();
|
||||||
|
break;
|
||||||
|
case "D":
|
||||||
|
reging_id = RegionTypeEnum.D_HKZC.getId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("flag", "1");
|
||||||
|
map.put("reging_id", reging_id);
|
||||||
|
map.put("point_location", point_location);
|
||||||
|
|
||||||
// 创建冷却区 --> 暂存位的任务
|
JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
|
||||||
InHotTask inHotTask = new InHotTask(null);
|
if (ObjectUtil.isEmpty(pointArr)) {
|
||||||
String task_id = inHotTask.createTask(param);
|
if (StrUtil.equals(point_location, "0")) map.put("point_location","1");
|
||||||
|
if (StrUtil.equals(point_location, "1")) map.put("point_location","0");
|
||||||
|
pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0);
|
||||||
|
|
||||||
// 4.插入烘箱区出入主表 和 明细表
|
if (ObjectUtil.isEmpty(pointArr)) throw new BadRequestException("没有空暂存位");
|
||||||
JSONObject hotParam = new JSONObject();
|
}
|
||||||
hotParam.put("container_name",container_name);
|
|
||||||
hotParam.put("task_id",task_id);
|
|
||||||
// 创建主表
|
|
||||||
String iostorinv_id = this.createHotIoMst(hotParam);
|
|
||||||
// 创建明细
|
|
||||||
hotParam.put("iostorinv_id",iostorinv_id);
|
|
||||||
hotParam.put("start_point_code",point_code2);
|
|
||||||
hotParam.put("next_point_code",jsonHotIvt.getString("point_code"));
|
|
||||||
hotParam.put("temperature",temperature);
|
|
||||||
hotParam.put("oven_time",hours);
|
|
||||||
this.createHotDtl(hotParam);
|
|
||||||
|
|
||||||
// 5.下发任务
|
// 2.判断暂存位是否有任务:找到无任务的暂存位 、查询烘箱对应的空位
|
||||||
JSONObject jsonObject = inHotTask.renotifyAcs(task_id);
|
String point_code2 = "";
|
||||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
for (int i = 0; i < pointArr.size(); i++) {
|
||||||
// 成功返回 更新任务状态
|
JSONObject jsonPoint = pointArr.getJSONObject(i);
|
||||||
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
|
String point_code = jsonPoint.getString("point_code");
|
||||||
jsonTask.put("task_status", "05");
|
|
||||||
taskTab.update(jsonTask);
|
JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
||||||
|
JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
||||||
|
JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
||||||
|
JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) {
|
||||||
|
point_code2 = point_code;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(point_code2)) throw new BadRequestException("没有空暂存位");
|
||||||
|
|
||||||
|
// 查询烘箱对应的空位
|
||||||
|
JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + product_area + "' and temperature = '" + temperature + "' and point_location = '"+map.getString("point_location")+"' and is_used = '1' and point_status = '01' order by point_code ASC").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位");
|
||||||
|
|
||||||
|
// 3.创建冷却区 --> 烘烤区任务
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("type","1"); // 1- 冷却区入烘箱 2- 暂存位入烘箱
|
||||||
|
param.put("point_code1",point_code1);
|
||||||
|
param.put("point_code2",point_code2);
|
||||||
|
param.put("point_code3",jsonHotIvt.getString("point_code"));
|
||||||
|
|
||||||
|
// 创建冷却区 --> 暂存位的任务
|
||||||
|
InHotTask inHotTask = new InHotTask(null);
|
||||||
|
String task_id = inHotTask.createTask(param);
|
||||||
|
|
||||||
|
// 4.插入烘箱区出入主表 和 明细表
|
||||||
|
JSONObject hotParam = new JSONObject();
|
||||||
|
hotParam.put("container_name",container_name);
|
||||||
|
hotParam.put("task_id",task_id);
|
||||||
|
// 创建主表
|
||||||
|
String iostorinv_id = this.createHotIoMst(hotParam);
|
||||||
|
// 创建明细
|
||||||
|
hotParam.put("iostorinv_id",iostorinv_id);
|
||||||
|
hotParam.put("start_point_code",point_code2);
|
||||||
|
hotParam.put("next_point_code",jsonHotIvt.getString("point_code"));
|
||||||
|
hotParam.put("temperature",temperature);
|
||||||
|
hotParam.put("oven_time",hours);
|
||||||
|
this.createHotDtl(hotParam);
|
||||||
|
|
||||||
|
// 5.下发任务
|
||||||
|
JSONObject jsonObject = inHotTask.renotifyAcs(task_id);
|
||||||
|
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||||
|
// 成功返回 更新任务状态
|
||||||
|
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||||
|
jsonTask.put("task_status", "05");
|
||||||
|
taskTab.update(jsonTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (StrUtil.equals(option, "2")) {
|
} else if (StrUtil.equals(option, "2")) {
|
||||||
// 出箱
|
// 出箱
|
||||||
@@ -272,6 +285,51 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public JSONObject inCoolIvt(JSONObject whereJson) {
|
public JSONObject inCoolIvt(JSONObject whereJson) {
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
|
|
||||||
|
String point_code1 = whereJson.getString("point_code"); // 暂存位:起点
|
||||||
|
String container_name = whereJson.getString("container_name"); // 母卷号
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空");
|
||||||
|
if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空");
|
||||||
|
|
||||||
|
// 1.获取此暂存位的生产区域和上下位置
|
||||||
|
JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
// 2.找冷却区空货位
|
||||||
|
JSONObject map = new JSONObject();
|
||||||
|
map.put("flag", "2");
|
||||||
|
map.put("product_area", jsonPoint.getString("product_area"));
|
||||||
|
map.put("point_location", jsonPoint.getString("point_location"));
|
||||||
|
|
||||||
|
JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
|
||||||
|
// 如果为空
|
||||||
|
if (ObjectUtil.isEmpty(jsonCooIvt)) {
|
||||||
|
if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) map.put("point_location","1");
|
||||||
|
if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) map.put("point_location","0");
|
||||||
|
jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0);
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(jsonCooIvt)) throw new BadRequestException("冷却区空位不足");
|
||||||
|
|
||||||
|
// 3.创建任务
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("point_code1", point_code1);
|
||||||
|
param.put("point_code2", jsonCooIvt.getString("point_code"));
|
||||||
|
param.put("container_name", container_name);
|
||||||
|
|
||||||
|
InCoolIvtTask inCoolIvtTask = new InCoolIvtTask(null);
|
||||||
|
String task_id = inCoolIvtTask.createTask(param);
|
||||||
|
|
||||||
|
// 4.下发任务
|
||||||
|
JSONObject jsonObject = inCoolIvtTask.renotifyAcs(task_id);
|
||||||
|
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||||
|
// 成功返回 更新任务状态
|
||||||
|
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||||
|
jsonTask.put("task_status", "05");
|
||||||
|
taskTab.update(jsonTask);
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("message","操作成功!");
|
result.put("message","操作成功!");
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
输入.flag TYPEAS s_string
|
输入.flag TYPEAS s_string
|
||||||
输入.reging_id TYPEAS s_string
|
输入.reging_id TYPEAS s_string
|
||||||
输入.point_location TYPEAS s_string
|
输入.point_location TYPEAS s_string
|
||||||
|
输入.product_area TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
@@ -60,6 +61,28 @@
|
|||||||
ENDOPTION
|
ENDOPTION
|
||||||
|
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
ST_IVT_CoolPointIvt
|
||||||
|
WHERE
|
||||||
|
is_used = '1'
|
||||||
|
AND full_point_status = '01'
|
||||||
|
|
||||||
|
OPTION 输入.product_area <> ""
|
||||||
|
product_area = 输入.product_area
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.point_location <> ""
|
||||||
|
point_location = 输入.point_location
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
@@ -145,7 +145,8 @@
|
|||||||
der.product_area AS product_area,
|
der.product_area AS product_area,
|
||||||
der.update_time AS update_time,
|
der.update_time AS update_time,
|
||||||
ivt.point_location,
|
ivt.point_location,
|
||||||
ivt.product_area
|
ivt.product_area,
|
||||||
|
der.workorder_id
|
||||||
FROM
|
FROM
|
||||||
PDM_BI_RawFoilWorkOrder der
|
PDM_BI_RawFoilWorkOrder der
|
||||||
LEFT JOIN st_ivt_sbpointivt ivt ON ivt.ext_code = der.resource_name
|
LEFT JOIN st_ivt_sbpointivt ivt ON ivt.ext_code = der.resource_name
|
||||||
|
|||||||
@@ -99,14 +99,14 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
|||||||
jsonIvt2.put("workorder_id", jsonRaw.getString("workorder_id"));
|
jsonIvt2.put("workorder_id", jsonRaw.getString("workorder_id"));
|
||||||
jsonIvt2.put("ivt_qty", jsonRaw.getString("productin_qty"));
|
jsonIvt2.put("ivt_qty", jsonRaw.getString("productin_qty"));
|
||||||
ivtTab.update(jsonIvt2);
|
ivtTab.update(jsonIvt2);
|
||||||
|
/*
|
||||||
// 更新冷却区出入表
|
// 更新冷却区出入表
|
||||||
JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
jsonCool.put("bill_status","50");
|
jsonCool.put("bill_status","50");
|
||||||
jsonCool.put("confirm_optid", SecurityUtils.getCurrentUserId());
|
jsonCool.put("confirm_optid", SecurityUtils.getCurrentUserId());
|
||||||
jsonCool.put("confirm_optname", SecurityUtils.getCurrentUsername());
|
jsonCool.put("confirm_optname", SecurityUtils.getCurrentUsername());
|
||||||
jsonCool.put("confirm_time", DateUtil.now());
|
jsonCool.put("confirm_time", DateUtil.now());
|
||||||
coolTab.update(jsonCool);
|
coolTab.update(jsonCool);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
package org.nl.wms.sch.tasks;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.nl.wms.sch.service.PointService;
|
||||||
|
import org.nl.wms.sch.service.dto.PointDto;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class InCoolIvtTask extends AbstractAcsTask {
|
||||||
|
private final String THIS_CLASS = InCoolIvtTask.class.getName();
|
||||||
|
private final CutConveyorTask conveyorTask;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
|
||||||
|
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表
|
||||||
|
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
|
||||||
|
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工序工单表
|
||||||
|
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱出入主表
|
||||||
|
|
||||||
|
String task_id = taskObj.getString("task_id");
|
||||||
|
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
if (StrUtil.equals(status,"0")) {
|
||||||
|
// 取消删除任务
|
||||||
|
taskTab.delete("task_id = '"+task_id+"'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
jsonTask.put("update_time", DateUtil.now());
|
||||||
|
taskTab.update(jsonTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
// 更改任务状态为完成
|
||||||
|
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||||
|
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||||
|
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||||
|
jsonTask.put("update_time", DateUtil.now());
|
||||||
|
taskTab.update(jsonTask);
|
||||||
|
|
||||||
|
String point_code1 = jsonTask.getString("point_code1");
|
||||||
|
String point_code2 = jsonTask.getString("point_code2");
|
||||||
|
|
||||||
|
PointService point = SpringContextHolder.getBean(PointService.class);
|
||||||
|
// 校验起点是否存在
|
||||||
|
PointDto startDto = point.findByCode(point_code1);
|
||||||
|
if (ObjectUtil.isEmpty(startDto)) throw new BadRequestException("起点未找到可用点位:" + point_code1);
|
||||||
|
|
||||||
|
// 校验终点是否存在
|
||||||
|
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("终点未找到可用点位:" + point_code2);
|
||||||
|
|
||||||
|
// 更新冷却库存状态
|
||||||
|
JSONObject jsonHotMst = hotMstTab.query("container_name = '" + jsonTask.getString("material_code") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
jsonIvt.put("full_point_status", "02");
|
||||||
|
jsonIvt.put("cool_ivt_status", "03");
|
||||||
|
jsonIvt.put("instorage_time", DateUtil.now());
|
||||||
|
jsonIvt.put("container_name", jsonHotMst.getString("container_name"));
|
||||||
|
jsonIvt.put("workorder_id", jsonHotMst.getString("workorder_id"));
|
||||||
|
jsonIvt.put("ivt_qty", jsonHotMst.getString("qty"));
|
||||||
|
ivtTab.update(jsonIvt);
|
||||||
|
|
||||||
|
// 更新烘烤出入主表为完成
|
||||||
|
jsonHotMst.put("bill_status", "50");
|
||||||
|
hotMstTab.update(jsonIvt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void findStartPoint() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void findNextPoint() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
|
String point_code1 = form.getString("point_code1");
|
||||||
|
String point_code2 = form.getString("point_code2");
|
||||||
|
if (conveyorTask.isSingleTask(point_code1)){
|
||||||
|
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!");
|
||||||
|
}
|
||||||
|
if (conveyorTask.isSingleTask(point_code2)){
|
||||||
|
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
json.put("task_type", "010204");
|
||||||
|
json.put("task_status", "01");
|
||||||
|
json.put("point_code1", point_code1);
|
||||||
|
json.put("point_code2", point_code2);
|
||||||
|
json.put("material_code", form.getString("container_name"));
|
||||||
|
json.put("sort_seq", "1");
|
||||||
|
json.put("handle_class", THIS_CLASS);
|
||||||
|
json.put("create_id", currentUserId);
|
||||||
|
json.put("create_name", currentUsername);
|
||||||
|
json.put("create_time", DateUtil.now());
|
||||||
|
json.put("priority","1" );
|
||||||
|
json.put("acs_task_type","4" );
|
||||||
|
tab.insert(json);
|
||||||
|
|
||||||
|
return json.getString("task_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void forceFinish(String task_id) {
|
||||||
|
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pullBack(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel(String task_id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -83,33 +83,56 @@ public class InHotTask extends AbstractAcsTask {
|
|||||||
// 更新主表: 什么时候更新主表
|
// 更新主表: 什么时候更新主表
|
||||||
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||||
|
|
||||||
// 更新冷却区库存状态
|
// 判断此任务是否有三个点位
|
||||||
JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
if (ObjectUtil.isEmpty(jsonTask.getString("point_code3"))) {
|
||||||
String container_name = jsonCoolIvt.getString("container_name"); // 母卷号
|
/*
|
||||||
String workorder_id = jsonCoolIvt.getString("workorder_id"); // 母卷工单标识
|
* 暂存区入烘箱任务
|
||||||
String ivt_qty = jsonCoolIvt.getString("ivt_qty"); // 库存
|
*/
|
||||||
|
// 更新烘箱区库存状态
|
||||||
|
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||||
|
jsonHotIvt.put("point_status", "02");
|
||||||
|
jsonHotIvt.put("container_name",jsonHotMst.getString("container_name"));
|
||||||
|
jsonHotIvt.put("workorder_id",jsonHotMst.getString("workorder_id") );
|
||||||
|
jsonHotIvt.put("ivt_qty",jsonHotMst.getString("qty") );
|
||||||
|
jsonHotIvt.put("instorage_time",DateUtil.now() );
|
||||||
|
jsonHotIvt.put("update_optid", currentUserId);
|
||||||
|
jsonHotIvt.put("update_optname", currentUsername);
|
||||||
|
jsonHotIvt.put("update_time", DateUtil.now());
|
||||||
|
hotIvtTab.update(jsonHotIvt);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* 冷却区入烘箱任务
|
||||||
|
*/
|
||||||
|
|
||||||
jsonCoolIvt.put("full_point_status", "01");
|
// 更新冷却区库存状态
|
||||||
jsonCoolIvt.put("container_name", "");
|
JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||||
jsonCoolIvt.put("workorder_id", "");
|
String container_name = jsonCoolIvt.getString("container_name"); // 母卷号
|
||||||
jsonCoolIvt.put("ivt_qty", "0");
|
String workorder_id = jsonCoolIvt.getString("workorder_id"); // 母卷工单标识
|
||||||
jsonCoolIvt.put("instorage_time", "");
|
String ivt_qty = jsonCoolIvt.getString("ivt_qty"); // 库存
|
||||||
jsonCoolIvt.put("update_optid", currentUserId);
|
|
||||||
jsonCoolIvt.put("update_optname", currentUsername);
|
jsonCoolIvt.put("full_point_status", "01");
|
||||||
jsonCoolIvt.put("update_time", DateUtil.now());
|
jsonCoolIvt.put("container_name", "");
|
||||||
coolIvtTab.update(jsonCoolIvt);
|
jsonCoolIvt.put("workorder_id", "");
|
||||||
|
jsonCoolIvt.put("ivt_qty", "0");
|
||||||
|
jsonCoolIvt.put("instorage_time", "");
|
||||||
|
jsonCoolIvt.put("update_optid", currentUserId);
|
||||||
|
jsonCoolIvt.put("update_optname", currentUsername);
|
||||||
|
jsonCoolIvt.put("update_time", DateUtil.now());
|
||||||
|
coolIvtTab.update(jsonCoolIvt);
|
||||||
|
|
||||||
|
// 更新烘箱区库存状态
|
||||||
|
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0);
|
||||||
|
jsonHotIvt.put("point_status", "02");
|
||||||
|
jsonHotIvt.put("container_name",container_name );
|
||||||
|
jsonHotIvt.put("workorder_id",workorder_id );
|
||||||
|
jsonHotIvt.put("ivt_qty",ivt_qty );
|
||||||
|
jsonHotIvt.put("instorage_time",DateUtil.now() );
|
||||||
|
jsonHotIvt.put("update_optid", currentUserId);
|
||||||
|
jsonHotIvt.put("update_optname", currentUsername);
|
||||||
|
jsonHotIvt.put("update_time", DateUtil.now());
|
||||||
|
hotIvtTab.update(jsonHotIvt);
|
||||||
|
}
|
||||||
|
|
||||||
// 更新烘箱区库存状态
|
|
||||||
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0);
|
|
||||||
jsonHotIvt.put("point_status", "02");
|
|
||||||
jsonHotIvt.put("container_name",container_name );
|
|
||||||
jsonHotIvt.put("workorder_id",workorder_id );
|
|
||||||
jsonHotIvt.put("ivt_qty",ivt_qty );
|
|
||||||
jsonHotIvt.put("instorage_time",DateUtil.now() );
|
|
||||||
jsonHotIvt.put("update_optid", currentUserId);
|
|
||||||
jsonHotIvt.put("update_optname", currentUsername);
|
|
||||||
jsonHotIvt.put("update_time", DateUtil.now());
|
|
||||||
hotIvtTab.update(jsonHotIvt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,36 +153,69 @@ public class InHotTask extends AbstractAcsTask {
|
|||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
String point_code1 = form.getString("point_code1");
|
String task_id = "";
|
||||||
String point_code2 = form.getString("point_code2");
|
|
||||||
String point_code3 = form.getString("point_code3");
|
|
||||||
if (conveyorTask.isSingleTask(point_code1)){
|
|
||||||
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!");
|
|
||||||
}
|
|
||||||
if (conveyorTask.isSingleTask(point_code2)){
|
|
||||||
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!");
|
|
||||||
}
|
|
||||||
if (conveyorTask.isSingleTask(point_code3)){
|
|
||||||
throw new BadRequestException("点位:"+point_code3+"存在未完成的任务!");
|
|
||||||
}
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
|
||||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
|
||||||
json.put("task_type", "010201");
|
|
||||||
json.put("task_status", "01");
|
|
||||||
json.put("point_code1", form.getString("point_code1"));
|
|
||||||
json.put("point_code2", form.getString("point_code2"));
|
|
||||||
json.put("point_code3", form.getString("point_code3"));
|
|
||||||
json.put("sort_seq", "1");
|
|
||||||
json.put("handle_class", THIS_CLASS);
|
|
||||||
json.put("create_id", currentUserId);
|
|
||||||
json.put("create_name", currentUsername);
|
|
||||||
json.put("create_time", DateUtil.now());
|
|
||||||
json.put("priority","1" );
|
|
||||||
json.put("acs_task_type","1" );
|
|
||||||
tab.insert(json);
|
|
||||||
|
|
||||||
return json.getString("task_id");
|
if (StrUtil.equals(form.getString("type"), "1")) {
|
||||||
|
String point_code1 = form.getString("point_code1");
|
||||||
|
String point_code2 = form.getString("point_code2");
|
||||||
|
String point_code3 = form.getString("point_code3");
|
||||||
|
if (conveyorTask.isSingleTask(point_code1)){
|
||||||
|
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!");
|
||||||
|
}
|
||||||
|
if (conveyorTask.isSingleTask(point_code2)){
|
||||||
|
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!");
|
||||||
|
}
|
||||||
|
if (conveyorTask.isSingleTask(point_code3)){
|
||||||
|
throw new BadRequestException("点位:"+point_code3+"存在未完成的任务!");
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
json.put("task_type", "010201");
|
||||||
|
json.put("task_status", "01");
|
||||||
|
json.put("point_code1", form.getString("point_code1"));
|
||||||
|
json.put("point_code2", form.getString("point_code2"));
|
||||||
|
json.put("point_code3", form.getString("point_code3"));
|
||||||
|
json.put("sort_seq", "1");
|
||||||
|
json.put("handle_class", THIS_CLASS);
|
||||||
|
json.put("create_id", currentUserId);
|
||||||
|
json.put("create_name", currentUsername);
|
||||||
|
json.put("create_time", DateUtil.now());
|
||||||
|
json.put("priority","1" );
|
||||||
|
json.put("acs_task_type","1" );
|
||||||
|
tab.insert(json);
|
||||||
|
task_id = json.getString("task_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.equals(form.getString("type"), "2")) {
|
||||||
|
String point_code1 = form.getString("point_code1");
|
||||||
|
String point_code2 = form.getString("point_code2");
|
||||||
|
|
||||||
|
if (conveyorTask.isSingleTask(point_code1)){
|
||||||
|
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!");
|
||||||
|
}
|
||||||
|
if (conveyorTask.isSingleTask(point_code2)){
|
||||||
|
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
json.put("task_type", "010203");
|
||||||
|
json.put("task_status", "01");
|
||||||
|
json.put("point_code1", form.getString("point_code1"));
|
||||||
|
json.put("point_code2", form.getString("point_code2"));
|
||||||
|
json.put("sort_seq", "1");
|
||||||
|
json.put("handle_class", THIS_CLASS);
|
||||||
|
json.put("create_id", currentUserId);
|
||||||
|
json.put("create_name", currentUsername);
|
||||||
|
json.put("create_time", DateUtil.now());
|
||||||
|
json.put("priority","1" );
|
||||||
|
json.put("acs_task_type","1" );
|
||||||
|
tab.insert(json);
|
||||||
|
task_id = json.getString("task_id");
|
||||||
|
}
|
||||||
|
return task_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user