Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -50,7 +50,7 @@ public class LokiLogAspect {
|
|||||||
// 获取描述信息
|
// 获取描述信息
|
||||||
LokiLogType logType = lokiLog.type();
|
LokiLogType logType = lokiLog.type();
|
||||||
|
|
||||||
MDC.put("log_file_type", logType.name());
|
MDC.put("log_file_type", logType.getDesc());
|
||||||
log.info("输入参数:" + JSONObject.toJSONString(pjp.getArgs()));
|
log.info("输入参数:" + JSONObject.toJSONString(pjp.getArgs()));
|
||||||
|
|
||||||
Object proceed = pjp.proceed();
|
Object proceed = pjp.proceed();
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ public enum LokiLogType {
|
|||||||
private String desc;
|
private String desc;
|
||||||
|
|
||||||
LokiLogType(String desc) {
|
LokiLogType(String desc) {
|
||||||
|
this.desc=desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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.InHotTask;
|
import org.nl.wms.sch.tasks.InHotTask;
|
||||||
|
import org.nl.wms.sch.tasks.OutHotTask;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||||
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
|
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
|
||||||
WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表
|
WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表
|
||||||
|
WQLObject hosReMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烤箱区点位库存表
|
||||||
|
|
||||||
if (StrUtil.equals(option, "1")) {
|
if (StrUtil.equals(option, "1")) {
|
||||||
// 入箱
|
// 入箱
|
||||||
@@ -153,7 +155,78 @@ public class BakingServiceImpl implements BakingService {
|
|||||||
}
|
}
|
||||||
} else if (StrUtil.equals(option, "2")) {
|
} else if (StrUtil.equals(option, "2")) {
|
||||||
// 出箱
|
// 出箱
|
||||||
|
String point_code1 = whereJson.getString("point_code");
|
||||||
|
if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("出箱点位不能为空");
|
||||||
|
JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
// 1.查询暂存位有没有空位
|
||||||
|
String product_area = jsonHotIvt.getString("product_area");
|
||||||
|
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", jsonHotIvt.getString("point_location"));
|
||||||
|
|
||||||
|
JSONArray 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3.创建任务
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("point_code1", point_code1);
|
||||||
|
param.put("point_code2", point_code2);
|
||||||
|
OutHotTask outHotTask = new OutHotTask();
|
||||||
|
String task_id = outHotTask.createTask(param);
|
||||||
|
|
||||||
|
// 4.插入烘箱区出入明细表
|
||||||
|
JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + jsonHotIvt.getString("container_name") + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在");
|
||||||
|
|
||||||
|
// 创建明细
|
||||||
|
JSONObject hotParam = new JSONObject();
|
||||||
|
hotParam.put("task_id",task_id);
|
||||||
|
hotParam.put("iostorinv_id",jsonHotReMst.getString("iostorinv_id"));
|
||||||
|
hotParam.put("start_point_code",point_code1);
|
||||||
|
hotParam.put("next_point_code",point_code2);
|
||||||
|
this.createHotDtl(hotParam);
|
||||||
|
|
||||||
|
// 5.下发任务
|
||||||
|
JSONObject jsonObject = outHotTask.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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
WHERE
|
WHERE
|
||||||
is_delete = '0'
|
is_delete = '0'
|
||||||
AND is_used = '1'
|
AND is_used = '1'
|
||||||
|
AND point_status = '00'
|
||||||
|
|
||||||
OPTION 输入.reging_id <> ""
|
OPTION 输入.reging_id <> ""
|
||||||
region_id = 输入.reging_id
|
region_id = 输入.reging_id
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
package org.nl.wms.sch.tasks;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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.wms.sch.manage.AbstractAcsTask;
|
||||||
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class OutHotTask extends AbstractAcsTask {
|
||||||
|
private final String THIS_CLASS = OutHotTask.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 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 jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||||
|
jsonPoint2.put("point_status", "02");
|
||||||
|
pointTab.update(jsonPoint2);
|
||||||
|
|
||||||
|
// 更新烘箱区库存状态
|
||||||
|
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||||
|
jsonHotIvt.put("point_status", "01");
|
||||||
|
jsonHotIvt.put("container_name","" );
|
||||||
|
jsonHotIvt.put("workorder_id","" );
|
||||||
|
jsonHotIvt.put("ivt_qty",0 );
|
||||||
|
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", "010202");
|
||||||
|
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);
|
||||||
|
|
||||||
|
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