This commit is contained in:
2022-10-13 14:45:14 +08:00
34 changed files with 986 additions and 206 deletions

View File

@@ -36,8 +36,4 @@ public interface LogRepository extends JpaRepository<Log,Long>, JpaSpecification
@Modifying
@Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true)
void deleteByLogType(String logType);
@Modifying
@Query(value = "delete from sys_log where log_type = ?1 and DATEDIFF(NOW(),create_time) >= 15", nativeQuery = true)
void delAfterDay(String logType);
}

View File

@@ -79,14 +79,4 @@ public interface LogService {
* 删除所有INFO日志
*/
void delAllByInfo();
/**
* 删除15天之前的错误日志
*/
void delAfterDay15ByError();
/**
* 删除15天之前的INFO日志
*/
void delAfterDay15ByInfo();
}

View File

@@ -155,16 +155,4 @@ public class LogServiceImpl implements LogService {
public void delAllByInfo() {
logRepository.deleteByLogType("INFO");
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delAfterDay15ByError() {
logRepository.delAfterDay("ERROR");
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delAfterDay15ByInfo() {
logRepository.delAfterDay("INFO");
}
}

View File

@@ -2,7 +2,8 @@ package org.nl.wms.autotask;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.service.LogService;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.stereotype.Component;
/**
@@ -12,14 +13,14 @@ import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class CleanLog {
private final LogService logService;
private final ParamService paramService;
public void run(){
// 删除所有异常日志
logService.delAfterDay15ByError();
// 删除所有操作日志
logService.delAfterDay15ByInfo();
log.info("删除所有异常/操作日志 执行成功");
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
WQLObject logTab = WQLObject.getWQLObject("sys_log");
int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
log.info("自动清理日志执行成功...!");
}
}

View File

@@ -121,4 +121,12 @@ public class ClassstandardController {
return new ResponseEntity<>(ClassstandardService.getType(type_id,level), HttpStatus.OK);
}
@GetMapping("/getClassName")
@Log("获取分类名称下拉框")
@ApiOperation("获取分类名称下拉框")
public ResponseEntity<Object> getClassName() {
return new ResponseEntity<>(ClassstandardService.getClassName(), HttpStatus.OK);
}
}

View File

@@ -124,4 +124,9 @@ public interface ClassstandardService {
*/
String getAllChildIdStr(String class_idStr);
/**
* 获取分类名称下拉框
* @return
*/
JSONArray getClassName();
}

View File

@@ -19,8 +19,6 @@ public class ClassstandardDto implements Serializable {
@JsonSerialize(using= ToStringSerializer.class)
private Long class_id;
private String base_data_type;
private String path_code;
private String class_code;

View File

@@ -44,10 +44,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
String base_data_type = (String) whereJson.get("base_data_type");
String class_code = (String) whereJson.get("class_code");
String where = "";
if (!StrUtil.isEmpty(base_data_type)) {
where = "AND base_data_type = '" + base_data_type + "'";
if (!StrUtil.isEmpty(class_code)) {
where = "AND class_code = '" + class_code + "'";
}
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'" + where + "", "update_time desc");
final JSONObject json = rb.pageResult();
@@ -100,7 +100,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
public void create(ClassstandardDto dto) {
String class_code = dto.getClass_code();
ClassstandardDto classstandardDto = this.findByCode(class_code);
if (classstandardDto != null && classstandardDto.getIs_delete().equals("0") && dto.getBase_data_type().equals(classstandardDto.getBase_data_type())) {
if (classstandardDto != null && classstandardDto.getIs_delete().equals("0") ) {
throw new BadRequestException("存在相同的基础类别编号");
}
Long currentUserId = SecurityUtils.getCurrentUserId();
@@ -120,10 +120,6 @@ public class ClassstandardServiceImpl implements ClassstandardService {
dto.setPath_code(dto.getClass_code());
dto.setLong_class_code(dto.getClass_code());
if (StrUtil.equals(dto.getBase_data_type(), "03")) {
dto.setIs_modify("0");
}
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
@@ -144,7 +140,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
String class_code = dto.getClass_code();
ClassstandardDto classstandardDto = this.findByCode(class_code);
if (classstandardDto != null && !dto.getClass_id().equals(classstandardDto.getClass_id()) && classstandardDto.getIs_delete().equals("0") && dto.getBase_data_type().equals(classstandardDto.getBase_data_type())) {
if (classstandardDto != null && !dto.getClass_id().equals(classstandardDto.getClass_id()) && classstandardDto.getIs_delete().equals("0") ) {
throw new BadRequestException("存在相同的供应商编号");
}
@@ -240,15 +236,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
@Override
public JSONArray getSuperior(JSONObject jo, JSONArray ja) {
String base_data_type=jo.getString("base_data_type");
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
if (StrUtil.isEmpty(jo.getString("parent_class_id")) || jo.getString("parent_class_id").equals("0")) {
JSONArray null_pids = new JSONArray();
if (jo.getString("base_data_type").equals(base_data_type)) {
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0' and base_data_type = '"+base_data_type+"'").getResultJSONArray(0);
} else {
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
}
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
for (int m = 0; m < null_pids.size(); m++) {
JSONObject null_pid = null_pids.getJSONObject(m);
@@ -536,6 +527,21 @@ public class ClassstandardServiceImpl implements ClassstandardService {
return str;
}
@Override
public JSONArray getClassName() {
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
// 获取的是父节点
JSONArray result = wo.query("(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'").getResultJSONArray(0);
JSONArray res = new JSONArray();
for (int i=0; i<result.size(); i++) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("label", result.getJSONObject(i).get("class_name"));
jsonObject.put("value", result.getJSONObject(i).get("class_code"));
res.add(jsonObject);
}
return res;
}
public void updateSubCnt(Long Id) {
if (Id != null && Id != 0) {

View File

@@ -28,6 +28,7 @@ public class BakingController {
@Log("烘箱出入")
@ApiOperation("烘箱出入")
public ResponseEntity<Object> queryRawFoil(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(bakingService.ovenInAndOut(whereJson), HttpStatus.OK);
bakingService.ovenInAndOut(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -9,6 +9,6 @@ public interface BakingService {
* @param whereJson /
* @return JSONObject
*/
JSONObject ovenInAndOut(JSONObject whereJson);
void ovenInAndOut(JSONObject whereJson);
}

View File

@@ -1,27 +1,210 @@
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 com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
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.RawFoilService;
import org.nl.wms.sch.manage.RegionTypeEnum;
import org.nl.wms.sch.tasks.InHotTask;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@RequiredArgsConstructor
@Slf4j
public class BakingServiceImpl implements BakingService {
/*
* 业务流程:
* 入烤箱:
* 1.首先需要找到无任务的暂存位 并创建两条任务
* 2。下发冷却区 --> 烘烤区的任务 等待反馈完成
* 3.插入烤箱区出入主表和明细表
* 出烤箱:
* 1.烤箱时间到后 查找无任务的暂存位 并创建2条任务
* 2.1下发烤箱区 --> 暂存位 的任务
* 2.2插入烤箱区出入明细表
* 3.查找对应冷却区空位
* 4.在下发暂存位 --> 冷却区的任务
* 问题:
* 1.第二条任务出现异常后 如何再次触发
*/
@Override
public JSONObject ovenInAndOut(JSONObject whereJson) {
JSONObject result = new JSONObject();
result.put("code", "1");
result.put("desc", "查询成功");
return result;
@Transactional
public void ovenInAndOut(JSONObject whereJson) {
String option = whereJson.getString("option"); // 1-入箱 2-出箱
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);
}

View File

@@ -144,13 +144,13 @@ public class RawFoilServiceImpl implements RawFoilService {
param.put("end_pint_code", end_pint_code);
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")) {
// 成功返回 更新任务状态
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");
taskTab.update(jsonTask);
}
@@ -204,7 +204,7 @@ public class RawFoilServiceImpl implements RawFoilService {
param.put("end_pint_code",end_point_code);
BookTwoConfirmTask bookTwoConfirmTask = new BookTwoConfirmTask();
String taskdtl_id = bookTwoConfirmTask.createTask(param);
String task_id = bookTwoConfirmTask.createTask(param);
// 5.插入入库单
Long currentUserId = SecurityUtils.getCurrentUserId();
@@ -226,17 +226,17 @@ public class RawFoilServiceImpl implements RawFoilService {
jsonRegion.put("end_point_code",end_point_code);
jsonRegion.put("cust_id","");
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_name",currentUsername);
jsonRegion.put("create_time",DateUtil.now());
regionTab.insert(jsonRegion);
// 6.下发任务
JSONObject jsonObject = bookTwoConfirmTask.renotifyAcs(taskdtl_id);
JSONObject jsonObject = bookTwoConfirmTask.renotifyAcs(task_id);
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");
taskTab.update(jsonTask);
// 更新出入表状态

View File

@@ -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

View File

@@ -26,6 +26,15 @@ public class DeliveryPointIvtDto implements Serializable {
/** 生产区域 */
private String product_area;
/** 点位状态 **/
private String point_status;
/** 载具码 **/
private String vehicle_code;
/** 气涨轴 **/
private String qzzno;
/** 位置 */
private String point_location;

View File

@@ -12,7 +12,7 @@ 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.wql.core.bean.ResultBean;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.pdm.ivt.service.DeliveryPointIvtService;
@@ -36,9 +36,14 @@ public class DeliveryPointIvtServiceImpl implements DeliveryPointIvtService {
@Override
public Map<String,Object> queryAll(Map whereJson, Pageable page){
WQLObject wo = WQLObject.getWQLObject("st_ivt_deliverypointivt");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "update_time desc");
final JSONObject json = rb.pageResult();
JSONObject map = new JSONObject();
map.put("flag", "1");
if (!ObjectUtil.isNull(whereJson.get("point_code")))
map.put("point_code", "%" + whereJson.get("point_code") + "%");
map.put("product_area", whereJson.get("product_area"));
map.put("point_status", whereJson.get("point_status"));
map.put("is_used", whereJson.get("is_used"));
JSONObject json = WQL.getWO("ST_IVT_DELIVERYPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
return json;
}

View File

@@ -0,0 +1,66 @@
[交易说明]
交易名: 分切输送线点位库存
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.point_code TYPEAS s_string
输入.point_status TYPEAS s_string
输入.product_area TYPEAS s_string
输入.is_used TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
deliver.*
FROM
st_ivt_deliverypointivt deliver
WHERE
1=1
OPTION 输入.point_code <> ""
point_code LIKE 输入.point_code
ENDOPTION
OPTION 输入.point_status <> ""
point_status = 输入.point_status
ENDOPTION
OPTION 输入.product_area <> ""
product_area = 输入.product_area
ENDOPTION
OPTION 输入.is_used <> ""
is_used = 输入.is_used
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,49 @@
package org.nl.wms.sch;
/**
* 任务状态枚举
*/
public enum TaskTypeEnum {
//生箔任务
SB_QKFM("sb_qkfm", "生箔取空放满","生箔取空放满"),
SB_QK("sb_qk", "生箔取空","生箔取空"),
SB_FM("sb_qk", "生箔放满","生箔放满"),
//分切上料任务
FQ_SL_QMFK("fq_sl_qmfk", "分切取满放空","分切放满"),
FQ_SL_FM("fq_sl_fm", "分切放满","分切初始化"),
FQ_SL_QK("fq_sl_qk", "分切取满放空","分切放满"),
//分切下料任务
FQ_XL_CZ("FQ_XL_QK", "子卷出站","子卷出站4个点"),
//烘箱
//入烘箱:3个点
//输送任务。
HX_R_QMFMFM("hx_r_qmfmfm", "入烘箱","入烘箱3个点"),
HX_C_SS("hx_c_ss", "出烘箱输送线","出烘箱输送线"),
HX_C_AGV("hx_c_agv", "出烘箱AGV","出烘箱AGV");
private String code;
private String name;
private String description;
public String getCode() {
return code;
}
public String getName() {
return name;
}
TaskTypeEnum(String code, String name,String description) {
this.code = code;
this.name = name;
this.description = description;
}
}

View File

@@ -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;
}
}

View File

@@ -1,33 +0,0 @@
package org.nl.wms.sch.manage;
/**
* 任务状态枚举
*/
public enum TaskTypeEnum {
IN_TASK(1, "01", "入库"),
Out_TASK(2, "02", "出库"),
IN_EMPTY_VEHICLE_TASK(3, "03", "入空载具"),
OUT_EMPTY_VEHICLE_TASK(4, "04", "出空载具"),
DUMPINV_TASK(5, "05", "转储"),
QUALITY_TASK(6, "06", "质检"),
MATERIAL_BACK_TASK(7, "07", "余料回库");
private int index;
private String code;
private String name;
public String getCode() {
return code;
}
public String getName() {
return name;
}
TaskTypeEnum(int index, String code, String name) {
this.index = index;
this.code = code;
this.name = name;
}
}

View File

@@ -13,7 +13,7 @@ import org.nl.wms.sch.manage.FinishTypeEnum;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.TaskService;
import org.nl.wms.sch.service.dto.TaskDto;
import org.nl.wms.sch.manage.TaskTypeEnum;
import org.nl.wms.sch.TaskTypeEnum;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@@ -67,20 +67,20 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
String next_point_code = jsonTask.getString("next_point_code");
String start_point_code = jsonTask.getString("start_point_code");
String point_code1 = jsonTask.getString("point_code1");
String point_code2 = jsonTask.getString("point_code2");
PointService point = SpringContextHolder.getBean(PointService.class);
// 校验起点是否存在
PointDto startDto = point.findByCode(start_point_code);
if (ObjectUtil.isEmpty(startDto)) throw new BadRequestException("起点未找到可用点位:" + start_point_code);
PointDto startDto = point.findByCode(point_code1);
if (ObjectUtil.isEmpty(startDto)) throw new BadRequestException("起点未找到可用点位:" + point_code1);
// 校验终点是否存在
JSONObject jsonIvt = ivtTab.query("point_code ='" + next_point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("终点未找到可用点位:" + next_point_code);
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
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("instorage_time", DateUtil.now());
@@ -117,13 +117,13 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject json = new JSONObject();
json.put("taskdtl_id", IdUtil.getSnowflake(1,1).nextId());
json.put("task_id",json.getString("taskdtl_id"));
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
json.put("task_type", "05");
json.put("task_status", "01");
json.put("start_point_code", form.getString("start_pint_code"));
json.put("next_point_code", form.getString("end_pint_code"));
json.put("point_code1", form.getString("start_pint_code"));
json.put("point_code2", form.getString("end_pint_code"));
json.put("sort_seq", "1");
json.put("handle_class", THIS_CLASS);
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);
@@ -132,7 +132,7 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
json.put("acs_task_type","1" );
tab.insert(json);
return json.getString("taskdtl_id");
return json.getString("task_id");
}
@Override

View File

@@ -65,15 +65,15 @@ public class CallEmpReelTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
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);
// 校验起点是否存在
JSONObject jsonIvt = ivtTab.query("point_code ='" + start_point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("未找到可用点位:" + start_point_code);
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("未找到可用点位:" + point_code1);
// 校验终点是否存在
PointDto nextDto = point.findByCode(jsonTask.getString("next_point_code"));
if (ObjectUtil.isEmpty(nextDto)) throw new BadRequestException("未找到可用点位:" + jsonTask.getString("next_point_code"));
PointDto nextDto = point.findByCode(jsonTask.getString("point_code2"));
if (ObjectUtil.isEmpty(nextDto)) throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2"));
// 更新冷却库存状态
jsonIvt.put("empty_point_status", "01");
@@ -99,14 +99,14 @@ public class CallEmpReelTask extends AbstractAcsTask {
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject json = new JSONObject();
json.put("taskdtl_id", IdUtil.getSnowflake(1,1).nextId());
json.put("task_id",json.getString("taskdtl_id"));
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
json.put("task_type", "05");
json.put("task_status", "01");
json.put("start_point_code", form.getString("start_pint_code"));
json.put("next_point_code", form.getString("end_pint_code"));
json.put("point_code1", form.getString("start_pint_code"));
json.put("point_code2", form.getString("end_pint_code"));
json.put("handle_class", THIS_CLASS);
json.put("sort_seq", "1");
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());
@@ -114,7 +114,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
json.put("acs_task_type","1" );
tab.insert(json);
return json.getString("taskdtl_id");
return json.getString("task_id");
}
@Override

View 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) {
}
}

View File

@@ -66,7 +66,7 @@ https://juejin.cn/post/6844903775631572999
</http>
<format>
<label>
<pattern>system=${SYSTEM_NAME},level=%level,logType=%X{log_file_type:-logType},device=%X{device_code_log:-device}</pattern>
<pattern>system=${SYSTEM_NAME},level=%level,logType=%X{log_file_type:-logType}</pattern>
</label>
<message>
<pattern>${log.pattern}</pattern>