代码更新
This commit is contained in:
@@ -403,7 +403,7 @@ public class HtSendEmpVehicleTask extends AbstractAcsTask {
|
|||||||
AcsTaskDto dto = AcsTaskDto.builder()
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
.task_id(json.getString("task_id"))
|
.task_id(json.getString("task_id"))
|
||||||
.task_code(json.getString("task_code"))
|
.task_code(json.getString("task_code"))
|
||||||
.task_type(json.getString("task_type"))
|
.task_type(json.getString("acs_task_type"))
|
||||||
.start_device_code(json.getString("point_code1"))
|
.start_device_code(json.getString("point_code1"))
|
||||||
.next_device_code(json.getString("point_code3"))
|
.next_device_code(json.getString("point_code3"))
|
||||||
.vehicle_code(json.getString("vehicle_code"))
|
.vehicle_code(json.getString("vehicle_code"))
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ package org.nl.wms.sch.tasks.sendMaterial;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
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.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
|
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.sch.SchTaskDto;
|
import org.nl.wms.sch.SchTaskDto;
|
||||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||||
@@ -15,7 +18,9 @@ import org.nl.wms.sch.manage.TaskStatusEnum;
|
|||||||
import org.nl.wms.sch.tasks.AcsTaskDto;
|
import org.nl.wms.sch.tasks.AcsTaskDto;
|
||||||
import org.nl.wms.util.IdUtil;
|
import org.nl.wms.util.IdUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@@ -30,18 +35,186 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
public void updateTaskStatus(JSONObject task, String status) {
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
|
String task_id = task.getString("task_id");
|
||||||
|
JSONObject taskObj = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
//任务取消
|
||||||
|
if (StrUtil.equals(status, "0")) {
|
||||||
|
// 取消删除任务
|
||||||
|
if (StrUtil.equals(taskObj.getString("task_status"), TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
throw new BadRequestException("已完成不能取消!");
|
||||||
|
}
|
||||||
|
String point_code2 = taskObj.getString("point_code2");
|
||||||
|
String point_code3 = taskObj.getString("point_code3");
|
||||||
|
//说明未二次申请过
|
||||||
|
if (ObjectUtil.isEmpty(point_code3)) {
|
||||||
|
JSONObject json = pointTab.query("point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||||
|
json.put("lock_type", "1");
|
||||||
|
pointTab.update(json);
|
||||||
|
}
|
||||||
|
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||||
|
taskObj.put("remark", "已取消");
|
||||||
|
taskTab.update(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||||
|
// 更新任务状态为执行中
|
||||||
|
taskObj.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||||
|
taskObj.put("update_time", DateUtil.now());
|
||||||
|
taskObj.put("car_no", taskObj.getString("car_no"));
|
||||||
|
taskTab.update(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||||
|
// 更改任务状态为完成
|
||||||
|
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||||
|
taskObj.put("update_time", DateUtil.now());
|
||||||
|
taskTab.update(taskObj);
|
||||||
|
|
||||||
|
String point_code3 = taskObj.getString("point_code3");
|
||||||
|
JSONObject point3Obj = pointTab.query("point_code = '" + point_code3 + "'").uniqueResult(0);
|
||||||
|
JSONObject requestObj = task.getJSONObject("request_param");
|
||||||
|
//工单标识
|
||||||
|
String workorder_id = requestObj.getString("material_info_id");
|
||||||
|
//生产工单表【PDM_BD_WorkOrder】
|
||||||
|
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||||
|
JSONObject workorderObj = workOrderTab.query("workorder_id", workorder_id).uniqueResult(0);
|
||||||
|
|
||||||
|
|
||||||
|
//区域出入表【st_ivt_regionIO】
|
||||||
|
WQLObject regionIoTab = WQLObject.getWQLObject("st_ivt_regionIO");
|
||||||
|
JSONObject regionIoObj = new JSONObject();
|
||||||
|
regionIoObj.put("stockrecord_id", IdUtil.getLongId());
|
||||||
|
regionIoObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||||
|
regionIoObj.put("buss_date", DateUtil.today());
|
||||||
|
regionIoObj.put("io_type", "1");
|
||||||
|
regionIoObj.put("material_id", taskObj.getString("material_id"));
|
||||||
|
regionIoObj.put("vehicle_code", taskObj.getString("vehicle_code"));
|
||||||
|
regionIoObj.put("qty", requestObj.getString("qty"));
|
||||||
|
regionIoObj.put("bill_status", "3");
|
||||||
|
regionIoObj.put("start_point_code", taskObj.getString("point_code1"));
|
||||||
|
regionIoObj.put("end_point_code", taskObj.getString("point_code3"));
|
||||||
|
regionIoObj.put("create_mode", "2");
|
||||||
|
regionIoObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd"));
|
||||||
|
regionIoTab.insert(regionIoObj);
|
||||||
|
|
||||||
|
|
||||||
|
//完成后入库
|
||||||
|
//仓位库存表【ST_IVT_StructIvt】
|
||||||
|
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||||
|
JSONObject ivtObj = new JSONObject();
|
||||||
|
ivtObj.put("stockrecord_id", IdUtil.getLongId());
|
||||||
|
ivtObj.put("point_id", point3Obj.getString("point_id"));
|
||||||
|
ivtObj.put("point_code", point3Obj.getString("point_code"));
|
||||||
|
ivtObj.put("point_name", point3Obj.getString("point_name"));
|
||||||
|
ivtObj.put("region_id", point3Obj.getString("region_id"));
|
||||||
|
ivtObj.put("region_code", point3Obj.getString("region_code"));
|
||||||
|
ivtObj.put("region_name", point3Obj.getString("region_name"));
|
||||||
|
ivtObj.put("instorage_time", DateUtil.now());
|
||||||
|
ivtObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd"));
|
||||||
|
ivtObj.put("ivt_qty", requestObj.getString("qty"));
|
||||||
|
ivtObj.put("standing_time", DateUtil.now());
|
||||||
|
ivtObj.put("material_id", workorderObj.getString("material_id"));
|
||||||
|
ivtTab.insert(ivtObj);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void findNextPoint() {
|
public void findNextPoint() {
|
||||||
|
/*
|
||||||
|
* 根据业务找对应的终点
|
||||||
|
*/
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
JSONArray taskArr = taskTab.query("handle_class = '" + THIS_CLASS + "'and is_delete = '0' and task_status = '2'").getResultJSONArray(0);
|
||||||
|
for (int i = 0; i < taskArr.size(); i++) {
|
||||||
|
JSONObject taskObj = taskArr.getJSONObject(i);
|
||||||
|
String material_id = taskObj.getString("material_id");
|
||||||
|
String vehicle_type = taskObj.getString("vehicle_type");
|
||||||
|
JSONObject param1 = new JSONObject();
|
||||||
|
param1.put("flag", "1");
|
||||||
|
param1.put("material_id", material_id);
|
||||||
|
param1.put("region_code", "YSQA01");
|
||||||
|
param1.put("vehicle_type", vehicle_type);
|
||||||
|
//1、查找库区类是否有响应的载具类型和对应的物料
|
||||||
|
JSONObject json1 = WQL.getWO("QSCH_gjxSendMaterial_01").addParamMap(param1).process().uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json1)) {
|
||||||
|
Integer block_num = json1.getInteger("block_num");
|
||||||
|
Integer row_num = json1.getInteger("row_num");
|
||||||
|
Integer col_num = json1.getInteger("col_num");
|
||||||
|
|
||||||
|
//拿到第一排
|
||||||
|
JSONObject firstRow = pointTab.query("block_num = '" + block_num + "' and col_num = '" + col_num + "' and row_num ='1'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(firstRow)) throw new BadRequestException("数据错误,请校验!");
|
||||||
|
taskObj.put("point_code2", firstRow.getString("point_code"));
|
||||||
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT);
|
||||||
|
taskObj.put("update_time", DateUtil.now());
|
||||||
|
//需要设置等待点
|
||||||
|
if (row_num > 2) {
|
||||||
|
//二楼终点追加任务
|
||||||
|
taskObj.put("acs_task_type", "4");
|
||||||
|
} else if (row_num == 2) {
|
||||||
|
//二楼普通任务
|
||||||
|
taskObj.put("acs_task_type", "2");
|
||||||
|
}
|
||||||
|
|
||||||
|
taskTab.update(taskObj);
|
||||||
|
} else {//找空位入
|
||||||
|
JSONObject param2 = new JSONObject();
|
||||||
|
param2.put("flag", "1");
|
||||||
|
param2.put("region_code", "YSQA01");
|
||||||
|
param2.put("vehicle_type", vehicle_type);
|
||||||
|
//1、查找整列为空的货位
|
||||||
|
JSONObject json2 = WQL.getWO("QSCH_gjxSendMaterial_01").addParamMap(param2).process().uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(json2)) {
|
||||||
|
taskObj.put("remark", "养生A区无可用货位");
|
||||||
|
taskObj.put("update_time", DateUtil.now());
|
||||||
|
taskTab.update(taskObj);
|
||||||
|
} else {
|
||||||
|
Integer block_num = json2.getInteger("block_num");
|
||||||
|
Integer col_num = json2.getInteger("col_num");
|
||||||
|
JSONObject firstRow = pointTab.query("block_num = '" + block_num + "' and col_num = '" + col_num + "' and row_num ='1'").uniqueResult(0);
|
||||||
|
taskObj.put("point_code2", firstRow.getString("point_code"));
|
||||||
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT);
|
||||||
|
//二楼终点追加任务
|
||||||
|
taskObj.put("acs_task_type", "4");
|
||||||
|
taskObj.put("update_time", DateUtil.now());
|
||||||
|
taskTab.update(taskObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AcsTaskDto> addTask() {
|
public List<AcsTaskDto> addTask() {
|
||||||
return null;
|
/*
|
||||||
|
* 下发给ACS时需要特殊处理
|
||||||
|
*/
|
||||||
|
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||||
|
|
||||||
|
ArrayList<AcsTaskDto> acsTaskArr = new ArrayList<>();
|
||||||
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
|
JSONObject json = arr.getJSONObject(i);
|
||||||
|
AcsTaskDto dto = AcsTaskDto.builder()
|
||||||
|
.task_id(json.getString("task_id"))
|
||||||
|
.task_code(json.getString("task_code"))
|
||||||
|
.task_type(json.getString("acs_task_type"))
|
||||||
|
.start_device_code(json.getString("point_code1"))
|
||||||
|
.next_device_code(json.getString("point_code3"))
|
||||||
|
.vehicle_code(json.getString("vehicle_code"))
|
||||||
|
.vehicle_type(json.getString("vehicle_type"))
|
||||||
|
.priority(json.getString("priority"))
|
||||||
|
.remark(json.getString("remark"))
|
||||||
|
.build();
|
||||||
|
acsTaskArr.add(dto);
|
||||||
|
}
|
||||||
|
return acsTaskArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,4 +266,34 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|||||||
public void cancel(String task_id) {
|
public void cancel(String task_id) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public String againApply(String task_id) {
|
||||||
|
/*
|
||||||
|
* 再次下发任务处理方法
|
||||||
|
* 涉及业务:入空载具、出空载具、入物料、出物料
|
||||||
|
*/
|
||||||
|
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
|
||||||
|
|
||||||
|
JSONObject taskObj = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
|
||||||
|
JSONObject jsonPoint2 = pointTab.query("point_code = '" + taskObj.getString("point_code2") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
// 根据 区域、块、列找到第一个有物料的货位
|
||||||
|
JSONObject jsonOnePoint = pointTab.query("region_id = '" + jsonPoint2.getString("region_id") +
|
||||||
|
"' and block_num = '" + jsonPoint2.getString("block_num") +
|
||||||
|
"' and col_num = '" + jsonPoint2.getString("col_num") +
|
||||||
|
"' and point_status = '1' order by row_num").uniqueResult(0);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(jsonOnePoint)) throw new BadRequestException("该列库存状态有误,请检查!");
|
||||||
|
|
||||||
|
taskObj.put("point_code3", jsonOnePoint.getString("point_code"));
|
||||||
|
taskObj.put("remark", "二次申请货位");
|
||||||
|
taskObj.put("update_time", DateUtil.now());
|
||||||
|
taskTab.update(taskObj);
|
||||||
|
|
||||||
|
return jsonOnePoint.getString("point_code");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 共挤线满料请求
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
输入.region_code TYPEAS s_string
|
||||||
|
输入.material_id TYPEAS s_string
|
||||||
|
输入.vehicle_type TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
p.point_id,
|
||||||
|
p.point_code,
|
||||||
|
p.point_name,
|
||||||
|
p.block_num,
|
||||||
|
p.row_num,
|
||||||
|
p.col_num
|
||||||
|
FROM
|
||||||
|
ST_IVT_StructIvt ivt
|
||||||
|
LEFT JOIN SCH_BASE_Point p on ivt.point_id = p.point_id
|
||||||
|
WHERE
|
||||||
|
p.is_used = '1'
|
||||||
|
AND is_delete = '0'
|
||||||
|
and lock_type='1'
|
||||||
|
and p.row_num>1
|
||||||
|
OPTION 输入.material_id <> ""
|
||||||
|
ivt.material_id = 输入.material_id
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.region_code <> ""
|
||||||
|
p.region_code = 输入.region_code
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.vehicle_type <> ""
|
||||||
|
p.can_vehicle_type = 输入.vehicle_type
|
||||||
|
ENDOPTION
|
||||||
|
ORDER BY block_num,row_num
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
block_num,
|
||||||
|
col_num,
|
||||||
|
COUNT(*) AS sum
|
||||||
|
FROM
|
||||||
|
SCH_BASE_Point p
|
||||||
|
WHERE
|
||||||
|
p.is_delete = '0'
|
||||||
|
AND is_used = '1'
|
||||||
|
AND region_code = 'YSQA01'
|
||||||
|
AND point_status = '1'
|
||||||
|
AND lock_type = '1'
|
||||||
|
AND ( row_num = 1 OR row_num )
|
||||||
|
OPTION 输入.vehicle_type <> ""
|
||||||
|
p.can_vehicle_type = 输入.vehicle_type
|
||||||
|
ENDOPTION
|
||||||
|
GROUP BY block_num,col_num
|
||||||
|
HAVING sum = 9
|
||||||
|
ORDER BY block_num,col_num
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user