Browse Source

fix 压制送料 烧制叫料

master
张江玮 2 years ago
parent
commit
43357070cc
  1. 34
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  2. 4
      lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/PointServiceImpl.java
  3. 4
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/wql/CALL_MATERIAL_TASK.wql
  4. 42
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/FJSendEmptyTask.java
  5. 36
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/wql/SEND_EMPTY_TASK.wql
  6. 14
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/SZSendMaterialTask.java
  7. 43
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/YZSendMaterialTask.java
  8. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java
  9. BIN
      lms/nladmin-system/src/main/java/org/nl/wms/wms.xls

34
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -224,11 +224,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
switch (type) { switch (type) {
case "1": case "1":
// 送料 // 送料
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
if (StrUtil.isBlank(vehicle_code) || "0".equals(vehicle_code)) { if ("0000".equals(vehicle_code)) {
throw new BadRequestException("载具不能为空!"); throw new BadRequestException("载具编码不能为空!");
} }
method_param.put("vehicle_code", TaskUtils.formatVehicleCode(vehicle_code)); method_param.put("vehicle_code", vehicle_code);
switch (region) { switch (region) {
case HL: case HL:
@ -240,6 +240,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
yzSendMaterialTask.createTask(method_param); yzSendMaterialTask.createTask(method_param);
break; break;
case SZ: case SZ:
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
JSONObject vd = vd_table
.query("is_delete = '0' AND vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(vd)) {
throw new BadRequestException("未找到 [" + vehicle_code + "] 的组盘信息!");
}
vd.put("is_fire", "1");
vd.put("is_in_kiln", "0");
vd_table.update(vd);
method_param.put("vd", vd);
szSendMaterialTask.createTask(method_param); szSendMaterialTask.createTask(method_param);
break; break;
default: default:
@ -409,12 +421,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
vd.put("create_name", ACSSystem.nick_name); vd.put("create_name", ACSSystem.nick_name);
vd.put("create_time", DateUtil.now()); vd.put("create_time", DateUtil.now());
vd.put("is_delete", TrueOrFalse.FALSE.value()); vd.put("is_delete", TrueOrFalse.FALSE.value());
vd.put("is_fire", TrueOrFalse.FALSE.value()); vd.put("is_fire", TrueOrFalse.FALSE.value());
if (device_code.startsWith("FJ")) { String region_code = point.getString("region_code");
if (Region.FJ.value().equals(region_code)) {
vd.put("is_fire", TrueOrFalse.TRUE.value()); vd.put("is_fire", TrueOrFalse.TRUE.value());
} }
vd.put("is_in_kiln", TrueOrFalse.trueOrFalse(is_full) ? TrueOrFalse.TRUE.value() : TrueOrFalse.FALSE.value()); vd.put("is_in_kiln", TrueOrFalse.trueOrFalse(is_full) ? TrueOrFalse.TRUE.value() : TrueOrFalse.FALSE.value());
if (device_code.startsWith("FJ")) { if (Region.FJ.value().equals(region_code)) {
vd.put("is_in_kiln", TrueOrFalse.FALSE.value()); vd.put("is_in_kiln", TrueOrFalse.FALSE.value());
} }
@ -430,8 +444,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
param.put("point", point); param.put("point", point);
param.put("workorder", work_order); param.put("workorder", work_order);
param.put("vd", vd); param.put("vd", vd);
param.put("vehicle_code", vehicle_code);
param.put("type", "1"); param.put("type", "1");
param.put("request_param", jsonObject); param.put("request_param", jsonObject.toJSONString());
this.apply(param); this.apply(param);
} }
@ -691,7 +706,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value()); result.put("status", HttpStatus.OK.value());
result.put("message", "反馈成功"); result.put("message", "反馈成功");
return result; return result;
} }
@ -703,6 +718,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
String vehicle_code = whereJson.getString("vehicle_code"); String vehicle_code = whereJson.getString("vehicle_code");
vehicle_code = TaskUtils.formatVehicleCode(vehicle_code); vehicle_code = TaskUtils.formatVehicleCode(vehicle_code);
if ("0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
JSONObject point = WQLObject JSONObject point = WQLObject
.getWQLObject("sch_base_point") .getWQLObject("sch_base_point")
.query("is_used = '1' AND point_code = '" + point_code + "'") .query("is_used = '1' AND point_code = '" + point_code + "'")

4
lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/PointServiceImpl.java

@ -153,12 +153,10 @@ public class PointServiceImpl implements PointService {
dto.setUpdate_optname(nickName); dto.setUpdate_optname(nickName);
String pointStatus = dto.getPoint_status(); String pointStatus = dto.getPoint_status();
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals("1")) { // 空位 if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals("0")) { // 空位
dto.setVehicle_type(""); dto.setVehicle_type("");
dto.setVehicle_code(""); dto.setVehicle_code("");
// PointUpdateUtil.clearPoint(dto.getPoint_code()); // PointUpdateUtil.clearPoint(dto.getPoint_code());
} else if (pointStatus.equals("2")) { // 空载具
} else if (pointStatus.equals("3")) { // 有料
} }
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
pointTab.update(json); pointTab.update(json);

4
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/wql/CALL_MATERIAL_TASK.wql

@ -37,7 +37,7 @@
# 3、业务主过程 # # 3、业务主过程 #
########################################## ##########################################
IF flag = "1" IF 输入.flag = "1"
QUERY QUERY
SELECT SELECT
point.*, point.*,
@ -78,7 +78,7 @@
ENDQUERY ENDQUERY
ENDIF ENDIF
IF flag = "3" IF 输入.flag = "3"
QUERY QUERY
SELECT SELECT
point.* point.*

42
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/FJSendEmptyTask.java

@ -3,24 +3,25 @@ package org.nl.wms.sch.task.send.empty;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL; 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.basedata.eum.TrueOrFalse;
import org.nl.wms.basedata.eum.VehicleType; import org.nl.wms.basedata.eum.VehicleType;
import org.nl.wms.sch.manage.*; import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.task.send.material.HLSendMaterialTask;
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
import org.nl.wms.sch.task.util.TaskUtils; import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* @author zhangjiangwei * @author zhangjiangwei
* @date 2023/04/14 21:29 * @date 2023/04/14 21:29
*/ */
@RequiredArgsConstructor
@Component
public class FJSendEmptyTask extends AbstractAcsTask { public class FJSendEmptyTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void updateTaskStatus(JSONObject task, String status) { public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) { if (TaskStatus.EXECUTING.value().equals(status)) {
@ -34,32 +35,23 @@ public class FJSendEmptyTask extends AbstractAcsTask {
} }
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
@Transactional
public String createTask(JSONObject form) { public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point"); JSONObject point = form.getJSONObject("point");
TaskUtils.isLocked(point);
JSONObject work_order = TaskUtils.hasWorkOrder(point);
String vehicle_code = form.getString("vehicle_code"); String vehicle_code = form.getString("vehicle_code");
if ("0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
// todo 组盘
JSONObject task = TaskUtils.buildTask( JSONObject task = TaskUtils.buildTask(
"混料机送料入库", "分拣区送空",
TaskType.SEND_MATERIAL.value(), TaskType.SEND_EMPTY.value(),
TaskStatus.SURE_START.value(), TaskStatus.SURE_START.value(),
point.getString("point_code"), point.getString("point_code"),
null, null,
work_order.getString("material_id"), null,
VehicleType.CUP.value(), VehicleType.STEEL_TRAY.value(),
vehicle_code, vehicle_code,
TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? "99" : "1", "1",
HLSendMaterialTask.class.getName(), FJSendEmptyTask.class.getName(),
form.getString("create_mode"), form.getString("create_mode"),
form.getString("request_param"), form.getString("request_param"),
form.getString("create_id"), form.getString("create_id"),
@ -67,6 +59,10 @@ public class FJSendEmptyTask extends AbstractAcsTask {
); );
WQLObject.getWQLObject("sch_base_task").insert(task); WQLObject.getWQLObject("sch_base_task").insert(task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_id"); return task.getString("task_id");
} }
@ -75,7 +71,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
public void findNextPoint() { public void findNextPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task"); WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
JSONArray tasks = task_table JSONArray tasks = task_table
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + YZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC") .query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + FJSendEmptyTask.class.getName() + "'", "priority DESC, create_time ASC")
.getResultJSONArray(0); .getResultJSONArray(0);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point"); WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
@ -83,7 +79,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
JSONObject task = tasks.getJSONObject(i); JSONObject task = tasks.getJSONObject(i);
JSONObject point = WQL JSONObject point = WQL
.getWO("SEND_MATERIAL_TASK") .getWO("SEND_EMPTY_TASK")
.addParam("flag", "1") .addParam("flag", "1")
.process() .process()
.uniqueResult(0); .uniqueResult(0);
@ -186,8 +182,6 @@ public class FJSendEmptyTask extends AbstractAcsTask {
JSONObject point2 = new JSONObject(); JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value()); point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", ""); point2.put("task_code", "");
point2.put("vehicle_type", task.getString("vehicle_type"));
point2.put("vehicle_code", task.getString("vehicle_code"));
point2.put("point_status", PointStatus.NOT_EMPTY.value()); point2.put("point_status", PointStatus.NOT_EMPTY.value());
if (operation_type == OperationType.AUTO) { if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2); TaskUtils.addACSUpdateColum(point2);

36
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/wql/SEND_EMPTY_TASK.wql

@ -37,34 +37,8 @@
# 3、业务主过程 # # 3、业务主过程 #
########################################## ##########################################
IF flag = "1" IF 输入.flag = "1"
QUERY QUERY
SELECT
point.*,
vd.material_id,
workorder.is_urgent
FROM
sch_base_point point
JOIN st_ivt_vehicle_detail vd ON point.vehicle_type = vd.vehicle_type
AND point.vehicle_code = vd.vehicle_code
AND vd.is_delete = '0'
LEFT JOIN pdm_bd_workorder workorder ON vd.workorder_id = workorder.workorder_id
WHERE
point.is_used = '1'
AND point.lock_type = '1'
AND point.region_code = 'CPHJ'
AND point.point_status = '1'
AND point.vehicle_type = '2'
AND vd.is_fire = '0'
AND vd.is_in_kiln = '1'
ORDER BY
workorder.is_urgent DESC, vd.create_time ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT SELECT
* *
FROM FROM
@ -72,8 +46,8 @@
WHERE WHERE
is_used = '1' is_used = '1'
AND lock_type = '1' AND lock_type = '1'
AND region_code = 'SZ' AND region_code = 'GTK'
AND point_type = '1' AND point_type = '1'
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY
ENDIF ENDIF

14
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/SZSendMaterialTask.java

@ -39,17 +39,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
@Override @Override
public String createTask(JSONObject form) { public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point"); JSONObject point = form.getJSONObject("point");
String vehicle_code = form.getString("vehicle_code"); JSONObject vd = form.getJSONObject("vd");
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
JSONObject vd = vd_table
.query("is_delete = '0' AND vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(vd)) {
throw new BadRequestException("未找到 [" + vehicle_code + "] 的组盘信息!");
}
vd.put("is_fire", "1");
vd.put("is_in_kiln", "0");
vd_table.update(vd);
JSONObject task = TaskUtils.buildTask( JSONObject task = TaskUtils.buildTask(
"烧制区送料", "烧制区送料",
@ -59,7 +49,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
null, null,
vd.getString("material_id"), vd.getString("material_id"),
VehicleType.STEEL_TRAY.value(), VehicleType.STEEL_TRAY.value(),
vehicle_code, vd.getString("vehicle_code"),
"1", "1",
SZSendMaterialTask.class.getName(), SZSendMaterialTask.class.getName(),
form.getString("create_mode"), form.getString("create_mode"),

43
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/YZSendMaterialTask.java

@ -75,26 +75,29 @@ public class YZSendMaterialTask extends AbstractAcsTask {
JSONArray tasks = task_table JSONArray tasks = task_table
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + YZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC") .query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + YZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
.getResultJSONArray(0); .getResultJSONArray(0);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
if (ObjectUtil.isNotEmpty(tasks)) {
for (int i = 0; i < tasks.size(); i++) { WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject task = tasks.getJSONObject(i);
for (int i = 0; i < tasks.size(); i++) {
JSONObject point = WQL JSONObject task = tasks.getJSONObject(i);
.getWO("SEND_MATERIAL_TASK")
.addParam("flag", "1") JSONObject point = WQL
.process() .getWO("SEND_MATERIAL_TASK")
.uniqueResult(0); .addParam("flag", "1")
.process()
if (ObjectUtil.isNotEmpty(point)) { .uniqueResult(0);
task.put("task_status", TaskStatus.START_AND_END.value());
task.put("point_code2", point.getString("point_code")); if (ObjectUtil.isNotEmpty(point)) {
task.put("remark", ""); task.put("task_status", TaskStatus.START_AND_END.value());
task_table.update(task); task.put("point_code2", point.getString("point_code"));
task.put("remark", "");
point.put("lock_type", LockType.TASK_LOCKED.value()); task_table.update(task);
point.put("task_code", task.getString("task_code"));
point_table.update(point); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
point_table.update(point);
}
} }
} }
} }

2
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java

@ -87,7 +87,7 @@ public class TaskUtils {
if (StrUtil.isBlank(vehicle_code)) { if (StrUtil.isBlank(vehicle_code)) {
vehicle_code = "0000"; vehicle_code = "0000";
} else { } else {
if (vehicle_code.length() > 4 || vehicle_code.matches("^\\d+$")) { if (vehicle_code.length() > 4 || !vehicle_code.matches("^\\d+$")) {
throw new BadRequestException("载具编码错误!"); throw new BadRequestException("载具编码错误!");
} }
} }

BIN
lms/nladmin-system/src/main/java/org/nl/wms/wms.xls

Binary file not shown.
Loading…
Cancel
Save