代码更新
This commit is contained in:
@@ -28,6 +28,7 @@ public class BakingController {
|
|||||||
@Log("烘箱出入")
|
@Log("烘箱出入")
|
||||||
@ApiOperation("烘箱出入")
|
@ApiOperation("烘箱出入")
|
||||||
public ResponseEntity<Object> queryRawFoil(@RequestBody JSONObject whereJson) {
|
public ResponseEntity<Object> queryRawFoil(@RequestBody JSONObject whereJson) {
|
||||||
return new ResponseEntity<>(bakingService.ovenInAndOut(whereJson), HttpStatus.OK);
|
bakingService.ovenInAndOut(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ public interface BakingService {
|
|||||||
* @param whereJson /
|
* @param whereJson /
|
||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
JSONObject ovenInAndOut(JSONObject whereJson);
|
void ovenInAndOut(JSONObject whereJson);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,210 @@
|
|||||||
package org.nl.wms.pda.mps.service.impl;
|
package org.nl.wms.pda.mps.service.impl;
|
||||||
|
|
||||||
|
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 cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
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.WQL;
|
||||||
|
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.pda.mps.service.RawFoilService;
|
import org.nl.wms.sch.manage.RegionTypeEnum;
|
||||||
|
import org.nl.wms.sch.tasks.InHotTask;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BakingServiceImpl implements BakingService {
|
public class BakingServiceImpl implements BakingService {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 业务流程:
|
||||||
|
* 入烤箱:
|
||||||
|
* 1.首先需要找到无任务的暂存位 并创建两条任务
|
||||||
|
* 2。下发冷却区 --> 烘烤区的任务 等待反馈完成
|
||||||
|
* 3.插入烤箱区出入主表和明细表
|
||||||
|
* 出烤箱:
|
||||||
|
* 1.烤箱时间到后 查找无任务的暂存位 并创建2条任务
|
||||||
|
* 2.1下发烤箱区 --> 暂存位 的任务
|
||||||
|
* 2.2插入烤箱区出入明细表
|
||||||
|
* 3.查找对应冷却区空位
|
||||||
|
* 4.在下发暂存位 --> 冷却区的任务
|
||||||
|
* 问题:
|
||||||
|
* 1.第二条任务出现异常后 如何再次触发
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public JSONObject ovenInAndOut(JSONObject whereJson) {
|
@Transactional
|
||||||
JSONObject result = new JSONObject();
|
public void ovenInAndOut(JSONObject whereJson) {
|
||||||
result.put("code", "1");
|
|
||||||
result.put("desc", "查询成功");
|
String option = whereJson.getString("option"); // 1-入箱 2-出箱
|
||||||
return result;
|
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||||
|
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
|
||||||
|
WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表
|
||||||
|
|
||||||
|
if (StrUtil.equals(option, "1")) {
|
||||||
|
// 入箱
|
||||||
|
String container_name = whereJson.getString("container_name"); // 母卷号
|
||||||
|
String temperature = whereJson.getString("temperature"); // 温度
|
||||||
|
String hours = whereJson.getString("hours"); // 时间
|
||||||
|
String point_code1 = whereJson.getString("point_code"); // 点位
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空");
|
||||||
|
if (ObjectUtil.isEmpty(temperature)) throw new BadRequestException("温度不能为空");
|
||||||
|
if (ObjectUtil.isEmpty(hours)) throw new BadRequestException("时间不能为空");
|
||||||
|
if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空");
|
||||||
|
|
||||||
|
// 1.根据冷却区此母卷的点位找到对应的暂存区、找到空位
|
||||||
|
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("母卷不存在");
|
||||||
|
|
||||||
|
String product_area = jsonCoolIvt.getString("product_area"); // 生产区域
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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("point_code1",point_code1);
|
||||||
|
param.put("point_code2",point_code2);
|
||||||
|
param.put("point_code3",jsonHotIvt.getString("point_code"));
|
||||||
|
|
||||||
|
// 创建冷却区 --> 暂存位的任务
|
||||||
|
InHotTask inHotTask = new InHotTask();
|
||||||
|
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")) {
|
||||||
|
// 出箱
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public String createHotIoMst(JSONObject param) {
|
||||||
|
/*
|
||||||
|
* 创建烘箱区出入主表
|
||||||
|
*/
|
||||||
|
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表
|
||||||
|
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
|
||||||
|
|
||||||
|
JSONObject jsonCoolIvt = coolTab.query("container_name = '" + param.getString("container_name") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
JSONObject jsonHotMst = new JSONObject();
|
||||||
|
jsonHotMst.put("iostorinv_id", IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
jsonHotMst.put("bill_code", CodeUtil.getNewCode("HOT_BILL_CODE"));
|
||||||
|
jsonHotMst.put("container_name", param.getString("container_name"));
|
||||||
|
jsonHotMst.put("workorder_id", jsonCoolIvt.getString("workorder_id"));
|
||||||
|
jsonHotMst.put("qty", jsonCoolIvt.getString("ivt_qty"));
|
||||||
|
jsonHotMst.put("bill_status", "10");
|
||||||
|
jsonHotMst.put("create_mode", "03");
|
||||||
|
jsonHotMst.put("task_id", param.getString("task_id"));
|
||||||
|
jsonHotMst.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
jsonHotMst.put("create_name", SecurityUtils.getCurrentUsername());
|
||||||
|
jsonHotMst.put("create_time", DateUtil.now());
|
||||||
|
hotMstTab.insert(jsonHotMst);
|
||||||
|
|
||||||
|
return jsonHotMst.getString("iostorinv_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void createHotDtl(JSONObject param) {
|
||||||
|
/*
|
||||||
|
* 创建烘箱区出入明细表
|
||||||
|
*/
|
||||||
|
WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表
|
||||||
|
|
||||||
|
JSONObject jsonHotDtl = new JSONObject();
|
||||||
|
jsonHotDtl.put("iostorinvdtl_id",IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
jsonHotDtl.put("iostorinv_id", param.getString("iostorinv_id"));
|
||||||
|
jsonHotDtl.put("start_point_code", param.getString("start_point_code"));
|
||||||
|
jsonHotDtl.put("next_point_code", param.getString("next_point_code"));
|
||||||
|
jsonHotDtl.put("temperature", param.getString("temperature"));
|
||||||
|
jsonHotDtl.put("oven_time", param.getString("oven_time"));
|
||||||
|
jsonHotDtl.put("task_type", "1");
|
||||||
|
jsonHotDtl.put("task_id", param.getString("task_id"));
|
||||||
|
jsonHotDtl.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
jsonHotDtl.put("create_name", SecurityUtils.getCurrentUsername());
|
||||||
|
jsonHotDtl.put("create_time", DateUtil.now());
|
||||||
|
jsonHotDtl.put("dtl_status", "10");
|
||||||
|
hotDtlTab.insert(jsonHotDtl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -144,13 +144,13 @@ public class RawFoilServiceImpl implements RawFoilService {
|
|||||||
param.put("end_pint_code", end_pint_code);
|
param.put("end_pint_code", end_pint_code);
|
||||||
|
|
||||||
CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
|
CallEmpReelTask callEmpReelTask = new CallEmpReelTask();
|
||||||
String taskdtl_id = callEmpReelTask.createTask(param);
|
String task_id = callEmpReelTask.createTask(param);
|
||||||
|
|
||||||
// 下发任务
|
// 下发任务
|
||||||
JSONObject jsonObject = callEmpReelTask.renotifyAcs(taskdtl_id);
|
JSONObject jsonObject = callEmpReelTask.renotifyAcs(task_id);
|
||||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||||
// 成功返回 更新任务状态
|
// 成功返回 更新任务状态
|
||||||
JSONObject jsonTask = taskTab.query("taskdtl_id ='" + taskdtl_id + "'").uniqueResult(0);
|
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||||
jsonTask.put("task_status", "05");
|
jsonTask.put("task_status", "05");
|
||||||
taskTab.update(jsonTask);
|
taskTab.update(jsonTask);
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ public class RawFoilServiceImpl implements RawFoilService {
|
|||||||
param.put("end_pint_code",end_point_code);
|
param.put("end_pint_code",end_point_code);
|
||||||
|
|
||||||
BookTwoConfirmTask bookTwoConfirmTask = new BookTwoConfirmTask();
|
BookTwoConfirmTask bookTwoConfirmTask = new BookTwoConfirmTask();
|
||||||
String taskdtl_id = bookTwoConfirmTask.createTask(param);
|
String task_id = bookTwoConfirmTask.createTask(param);
|
||||||
|
|
||||||
// 5.插入入库单
|
// 5.插入入库单
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
@@ -226,17 +226,17 @@ public class RawFoilServiceImpl implements RawFoilService {
|
|||||||
jsonRegion.put("end_point_code",end_point_code);
|
jsonRegion.put("end_point_code",end_point_code);
|
||||||
jsonRegion.put("cust_id","");
|
jsonRegion.put("cust_id","");
|
||||||
jsonRegion.put("create_mode","03");
|
jsonRegion.put("create_mode","03");
|
||||||
jsonRegion.put("task_id",taskdtl_id);
|
jsonRegion.put("task_id",task_id);
|
||||||
jsonRegion.put("create_id",currentUserId);
|
jsonRegion.put("create_id",currentUserId);
|
||||||
jsonRegion.put("create_name",currentUsername);
|
jsonRegion.put("create_name",currentUsername);
|
||||||
jsonRegion.put("create_time",DateUtil.now());
|
jsonRegion.put("create_time",DateUtil.now());
|
||||||
regionTab.insert(jsonRegion);
|
regionTab.insert(jsonRegion);
|
||||||
|
|
||||||
// 6.下发任务
|
// 6.下发任务
|
||||||
JSONObject jsonObject = bookTwoConfirmTask.renotifyAcs(taskdtl_id);
|
JSONObject jsonObject = bookTwoConfirmTask.renotifyAcs(task_id);
|
||||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||||
// 成功返回 更新任务状态
|
// 成功返回 更新任务状态
|
||||||
JSONObject jsonTask = taskTab.query("taskdtl_id ='" + taskdtl_id + "'").uniqueResult(0);
|
JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||||
jsonTask.put("task_status", "05");
|
jsonTask.put("task_status", "05");
|
||||||
taskTab.update(jsonTask);
|
taskTab.update(jsonTask);
|
||||||
// 更新出入表状态
|
// 更新出入表状态
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 手持接口
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
输入.reging_id TYPEAS s_string
|
||||||
|
输入.point_location TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
SCH_BASE_Point
|
||||||
|
WHERE
|
||||||
|
is_delete = '0'
|
||||||
|
AND is_used = '1'
|
||||||
|
|
||||||
|
OPTION 输入.reging_id <> ""
|
||||||
|
region_id = 输入.reging_id
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.point_location <> ""
|
||||||
|
point_location = 输入.point_location
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package org.nl.wms.sch.manage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成方式:00自动,01:手动
|
||||||
|
*/
|
||||||
|
public enum RegionTypeEnum {
|
||||||
|
A_SB("01","A生箔区","1578627451293143040"),
|
||||||
|
B_SB("02","B生箔区",""),
|
||||||
|
C_SB("03","C生箔区",""),
|
||||||
|
D_SB("04","D生箔区",""),
|
||||||
|
A_FQ("05","A分切区","1578628922277498880"),
|
||||||
|
B_FQ("06","B分切区",""),
|
||||||
|
C_FQ("07","C分切区",""),
|
||||||
|
D_FQ("08","D分切区",""),
|
||||||
|
A_HKZC("09","A烘烤暂存区","1578657813205487616"),
|
||||||
|
B_HKZC("10","B烘烤暂存区",""),
|
||||||
|
C_HKZC("11","C烘烤暂存区",""),
|
||||||
|
D_HKZC("12","D烘烤暂存区","");
|
||||||
|
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private RegionTypeEnum(String code, String name, String id) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -67,20 +67,20 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
|
|||||||
jsonTask.put("update_time", DateUtil.now());
|
jsonTask.put("update_time", DateUtil.now());
|
||||||
taskTab.update(jsonTask);
|
taskTab.update(jsonTask);
|
||||||
|
|
||||||
String next_point_code = jsonTask.getString("next_point_code");
|
String point_code1 = jsonTask.getString("point_code1");
|
||||||
String start_point_code = jsonTask.getString("start_point_code");
|
String point_code2 = jsonTask.getString("point_code2");
|
||||||
|
|
||||||
PointService point = SpringContextHolder.getBean(PointService.class);
|
PointService point = SpringContextHolder.getBean(PointService.class);
|
||||||
// 校验起点是否存在
|
// 校验起点是否存在
|
||||||
PointDto startDto = point.findByCode(start_point_code);
|
PointDto startDto = point.findByCode(point_code1);
|
||||||
if (ObjectUtil.isEmpty(startDto)) throw new BadRequestException("起点未找到可用点位:" + start_point_code);
|
if (ObjectUtil.isEmpty(startDto)) throw new BadRequestException("起点未找到可用点位:" + point_code1);
|
||||||
|
|
||||||
// 校验终点是否存在
|
// 校验终点是否存在
|
||||||
JSONObject jsonIvt = ivtTab.query("point_code ='" + next_point_code + "'").uniqueResult(0);
|
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("终点未找到可用点位:" + next_point_code);
|
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("终点未找到可用点位:" + point_code2);
|
||||||
|
|
||||||
// 更新冷却库存状态
|
// 更新冷却库存状态
|
||||||
JSONObject jsonRaw = rawTab.query("resource_name ='" + start_point_code + "'").uniqueResult(0);
|
JSONObject jsonRaw = rawTab.query("resource_name ='" + point_code1 + "'").uniqueResult(0);
|
||||||
|
|
||||||
jsonIvt.put("full_point_status", "02");
|
jsonIvt.put("full_point_status", "02");
|
||||||
jsonIvt.put("instorage_time", DateUtil.now());
|
jsonIvt.put("instorage_time", DateUtil.now());
|
||||||
@@ -117,13 +117,13 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
|
|||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("taskdtl_id", IdUtil.getSnowflake(1,1).nextId());
|
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||||
json.put("task_id",json.getString("taskdtl_id"));
|
|
||||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
json.put("task_type", "05");
|
json.put("task_type", "05");
|
||||||
json.put("task_status", "01");
|
json.put("task_status", "01");
|
||||||
json.put("start_point_code", form.getString("start_pint_code"));
|
json.put("point_code1", form.getString("start_pint_code"));
|
||||||
json.put("next_point_code", form.getString("end_pint_code"));
|
json.put("point_code2", form.getString("end_pint_code"));
|
||||||
|
json.put("sort_seq", "1");
|
||||||
json.put("handle_class", THIS_CLASS);
|
json.put("handle_class", THIS_CLASS);
|
||||||
json.put("create_id", currentUserId);
|
json.put("create_id", currentUserId);
|
||||||
json.put("create_name", currentUsername);
|
json.put("create_name", currentUsername);
|
||||||
@@ -132,7 +132,7 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
|
|||||||
json.put("acs_task_type","1" );
|
json.put("acs_task_type","1" );
|
||||||
tab.insert(json);
|
tab.insert(json);
|
||||||
|
|
||||||
return json.getString("taskdtl_id");
|
return json.getString("task_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -65,15 +65,15 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
|||||||
jsonTask.put("update_time", DateUtil.now());
|
jsonTask.put("update_time", DateUtil.now());
|
||||||
taskTab.update(jsonTask);
|
taskTab.update(jsonTask);
|
||||||
|
|
||||||
String start_point_code = jsonTask.getString("start_point_code");
|
String point_code1 = jsonTask.getString("point_code1");
|
||||||
|
|
||||||
PointService point = SpringContextHolder.getBean(PointService.class);
|
PointService point = SpringContextHolder.getBean(PointService.class);
|
||||||
// 校验起点是否存在
|
// 校验起点是否存在
|
||||||
JSONObject jsonIvt = ivtTab.query("point_code ='" + start_point_code + "'").uniqueResult(0);
|
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("未找到可用点位:" + start_point_code);
|
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("未找到可用点位:" + point_code1);
|
||||||
// 校验终点是否存在
|
// 校验终点是否存在
|
||||||
PointDto nextDto = point.findByCode(jsonTask.getString("next_point_code"));
|
PointDto nextDto = point.findByCode(jsonTask.getString("point_code2"));
|
||||||
if (ObjectUtil.isEmpty(nextDto)) throw new BadRequestException("未找到可用点位:" + jsonTask.getString("next_point_code"));
|
if (ObjectUtil.isEmpty(nextDto)) throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2"));
|
||||||
|
|
||||||
// 更新冷却库存状态
|
// 更新冷却库存状态
|
||||||
jsonIvt.put("empty_point_status", "01");
|
jsonIvt.put("empty_point_status", "01");
|
||||||
@@ -99,14 +99,14 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
|||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("taskdtl_id", IdUtil.getSnowflake(1,1).nextId());
|
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||||
json.put("task_id",json.getString("taskdtl_id"));
|
|
||||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
json.put("task_type", "05");
|
json.put("task_type", "05");
|
||||||
json.put("task_status", "01");
|
json.put("task_status", "01");
|
||||||
json.put("start_point_code", form.getString("start_pint_code"));
|
json.put("point_code1", form.getString("start_pint_code"));
|
||||||
json.put("next_point_code", form.getString("end_pint_code"));
|
json.put("point_code2", form.getString("end_pint_code"));
|
||||||
json.put("handle_class", THIS_CLASS);
|
json.put("handle_class", THIS_CLASS);
|
||||||
|
json.put("sort_seq", "1");
|
||||||
json.put("create_id", currentUserId);
|
json.put("create_id", currentUserId);
|
||||||
json.put("create_name", currentUsername);
|
json.put("create_name", currentUsername);
|
||||||
json.put("create_time", DateUtil.now());
|
json.put("create_time", DateUtil.now());
|
||||||
@@ -114,7 +114,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
|||||||
json.put("acs_task_type","1" );
|
json.put("acs_task_type","1" );
|
||||||
tab.insert(json);
|
tab.insert(json);
|
||||||
|
|
||||||
return json.getString("taskdtl_id");
|
return json.getString("task_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
169
nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java
Normal file
169
nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
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 InHotTask extends AbstractAcsTask {
|
||||||
|
private final String THIS_CLASS = InHotTask.class.getName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
|
||||||
|
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表
|
||||||
|
WQLObject hotIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烘箱区库存表
|
||||||
|
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表
|
||||||
|
WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// 更新明细表状态
|
||||||
|
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
jsonHotDtl.put("dtl_status", "40");
|
||||||
|
hotDtlTab.update(jsonHotDtl);
|
||||||
|
|
||||||
|
// 更新主表状态
|
||||||
|
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||||
|
jsonHotMst.put("bill_status", "40");
|
||||||
|
hotMstTab.update(jsonHotMst);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
|
// 更改任务状态为完成
|
||||||
|
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||||
|
jsonTask.put("update_optid", currentUserId);
|
||||||
|
jsonTask.put("update_optname", currentUsername);
|
||||||
|
jsonTask.put("update_time", DateUtil.now());
|
||||||
|
taskTab.update(jsonTask);
|
||||||
|
|
||||||
|
// 更新明细表
|
||||||
|
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
jsonHotDtl.put("dtl_status", "50");
|
||||||
|
jsonHotDtl.put("confirm_optid", currentUserId);
|
||||||
|
jsonHotDtl.put("confirm_optname", currentUsername);
|
||||||
|
jsonHotDtl.put("confirm_time", DateUtil.now());
|
||||||
|
hotDtlTab.update(jsonHotDtl);
|
||||||
|
|
||||||
|
// 更新主表: 什么时候更新主表
|
||||||
|
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);
|
||||||
|
String container_name = jsonCoolIvt.getString("container_name"); // 母卷号
|
||||||
|
String workorder_id = jsonCoolIvt.getString("workorder_id"); // 母卷工单标识
|
||||||
|
String ivt_qty = jsonCoolIvt.getString("ivt_qty"); // 库存
|
||||||
|
|
||||||
|
jsonCoolIvt.put("full_point_status", "01");
|
||||||
|
jsonCoolIvt.put("container_name", "");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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();
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user