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. 30
      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. 3
      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) {
case "1":
// 送料
String vehicle_code = param.getString("vehicle_code");
if (StrUtil.isBlank(vehicle_code) || "0".equals(vehicle_code)) {
throw new BadRequestException("载具不能为空!");
String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
if ("0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
method_param.put("vehicle_code", TaskUtils.formatVehicleCode(vehicle_code));
method_param.put("vehicle_code", vehicle_code);
switch (region) {
case HL:
@ -240,6 +240,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
yzSendMaterialTask.createTask(method_param);
break;
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);
break;
default:
@ -409,12 +421,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
vd.put("create_name", ACSSystem.nick_name);
vd.put("create_time", DateUtil.now());
vd.put("is_delete", 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_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());
}
@ -430,8 +444,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
param.put("point", point);
param.put("workorder", work_order);
param.put("vd", vd);
param.put("vehicle_code", vehicle_code);
param.put("type", "1");
param.put("request_param", jsonObject);
param.put("request_param", jsonObject.toJSONString());
this.apply(param);
}
@ -691,7 +706,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "反馈成功");
result.put("message", "反馈成功");
return result;
}
@ -703,6 +718,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
String vehicle_code = whereJson.getString("vehicle_code");
vehicle_code = TaskUtils.formatVehicleCode(vehicle_code);
if ("0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
JSONObject point = WQLObject
.getWQLObject("sch_base_point")
.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);
String pointStatus = dto.getPoint_status();
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals("1")) { // 空位
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals("0")) { // 空位
dto.setVehicle_type("");
dto.setVehicle_code("");
// PointUpdateUtil.clearPoint(dto.getPoint_code());
} else if (pointStatus.equals("2")) { // 空载具
} else if (pointStatus.equals("3")) { // 有料
}
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
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、业务主过程 #
##########################################
IF flag = "1"
IF 输入.flag = "1"
QUERY
SELECT
point.*,
@ -78,7 +78,7 @@
ENDQUERY
ENDIF
IF flag = "3"
IF 输入.flag = "3"
QUERY
SELECT
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 com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
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.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.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* @author zhangjiangwei
* @date 2023/04/14 21:29
*/
@RequiredArgsConstructor
@Component
public class FJSendEmptyTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
@ -34,32 +35,23 @@ public class FJSendEmptyTask extends AbstractAcsTask {
}
}
@Transactional(rollbackFor = Exception.class)
@Override
@Transactional
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
TaskUtils.isLocked(point);
JSONObject work_order = TaskUtils.hasWorkOrder(point);
String vehicle_code = form.getString("vehicle_code");
if ("0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
// todo 组盘
JSONObject task = TaskUtils.buildTask(
"混料机送料入库",
TaskType.SEND_MATERIAL.value(),
"分拣区送空",
TaskType.SEND_EMPTY.value(),
TaskStatus.SURE_START.value(),
point.getString("point_code"),
null,
work_order.getString("material_id"),
VehicleType.CUP.value(),
null,
VehicleType.STEEL_TRAY.value(),
vehicle_code,
TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? "99" : "1",
HLSendMaterialTask.class.getName(),
"1",
FJSendEmptyTask.class.getName(),
form.getString("create_mode"),
form.getString("request_param"),
form.getString("create_id"),
@ -67,6 +59,10 @@ public class FJSendEmptyTask extends AbstractAcsTask {
);
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");
}
@ -75,7 +71,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
public void findNextPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
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);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
@ -83,7 +79,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
JSONObject task = tasks.getJSONObject(i);
JSONObject point = WQL
.getWO("SEND_MATERIAL_TASK")
.getWO("SEND_EMPTY_TASK")
.addParam("flag", "1")
.process()
.uniqueResult(0);
@ -186,8 +182,6 @@ public class FJSendEmptyTask extends AbstractAcsTask {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
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());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);

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

@ -37,33 +37,7 @@
# 3、业务主过程 #
##########################################
IF flag = "1"
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"
IF 输入.flag = "1"
QUERY
SELECT
*
@ -72,7 +46,7 @@
WHERE
is_used = '1'
AND lock_type = '1'
AND region_code = 'SZ'
AND region_code = 'GTK'
AND point_type = '1'
ENDSELECT
ENDQUERY

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
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
String vehicle_code = form.getString("vehicle_code");
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 vd = form.getJSONObject("vd");
JSONObject task = TaskUtils.buildTask(
"烧制区送料",
@ -59,7 +49,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
null,
vd.getString("material_id"),
VehicleType.STEEL_TRAY.value(),
vehicle_code,
vd.getString("vehicle_code"),
"1",
SZSendMaterialTask.class.getName(),
form.getString("create_mode"),

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

@ -75,6 +75,8 @@ public class YZSendMaterialTask extends AbstractAcsTask {
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")
.getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(tasks)) {
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
for (int i = 0; i < tasks.size(); i++) {
@ -98,6 +100,7 @@ public class YZSendMaterialTask extends AbstractAcsTask {
}
}
}
}
@Transactional(rollbackFor = Exception.class)
@Override

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)) {
vehicle_code = "0000";
} else {
if (vehicle_code.length() > 4 || vehicle_code.matches("^\\d+$")) {
if (vehicle_code.length() > 4 || !vehicle_code.matches("^\\d+$")) {
throw new BadRequestException("载具编码错误!");
}
}

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

Binary file not shown.
Loading…
Cancel
Save