Browse Source

更新

master
张江玮 2 years ago
parent
commit
ca952de9ea
  1. 8
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java
  2. 2
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java
  3. 33
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  4. 52
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AbstractAcsTask.java
  5. 9
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java
  6. 16
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/YZCallEmptyTask.java
  7. 11
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/FJCallMaterialTask.java
  8. 9
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java
  9. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/wql/CALL_MATERIAL_TASK.wql
  10. 10
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/FJSendEmptyTask.java
  11. 1
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/wql/SEND_EMPTY_TASK.wql
  12. 10
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/SZSendMaterialTask.java
  13. 9
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/YZSendMaterialTask.java
  14. 13
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java

8
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java

@ -142,4 +142,12 @@ public class AcsToWmsController {
public ResponseEntity<Object> getVehicleInfo(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> getVehicleInfo(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.getVehicleInfo(whereJson), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.getVehicleInfo(whereJson), HttpStatus.OK);
} }
@PostMapping("/updateFoldPoint")
@Log("更新叠盘位点位状态")
@ApiOperation("更新叠盘位点位状态")
@SaIgnore
public ResponseEntity<Object> updateFoldPoint(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.updateFoldPoint(whereJson), HttpStatus.OK);
}
} }

2
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java

@ -106,4 +106,6 @@ public interface AcsToWmsService {
JSONObject feedbackVehicleType(JSONObject param); JSONObject feedbackVehicleType(JSONObject param);
JSONObject getVehicleInfo(JSONObject whereJson); JSONObject getVehicleInfo(JSONObject whereJson);
JSONObject updateFoldPoint(JSONObject param);
} }

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

@ -231,6 +231,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
switch (region) { switch (region) {
case HL: case HL:
JSONObject workorder = TaskUtils.hasWorkOrder(point);
method_param.put("workorder", workorder);
task_code = hlSendMaterialTask.createTask(method_param); task_code = hlSendMaterialTask.createTask(method_param);
break; break;
case YZ: case YZ:
@ -259,6 +261,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
break; break;
case "2": case "2":
// 叫料 // 叫料
JSONObject workorder = TaskUtils.hasWorkOrder(point);
method_param.put("workorder", workorder);
switch (region) { switch (region) {
case FJ: case FJ:
task_code = fjCallMaterialTask.createTask(method_param); task_code = fjCallMaterialTask.createTask(method_param);
@ -279,6 +284,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
break; break;
case "4": case "4":
// 叫空 // 叫空
String device_code = point.getString("device_code");
JSONObject work_order = WQLObject
.getWQLObject("pdm_bd_workorder")
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
.uniqueResult(0);
method_param.put("workorder", work_order);
switch (region) { switch (region) {
case HL: case HL:
task_code = hlCallEmptyTask.createTask(method_param); task_code = hlCallEmptyTask.createTask(method_param);
@ -773,4 +785,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result.put("data", data); result.put("data", data);
return result; return result;
} }
@Override
public JSONObject updateFoldPoint(JSONObject param) {
String point_code = param.getString("device_code");
if (StrUtil.isBlank(point_code)) {
throw new BadRequestException("点位不能为空!");
}
String point_status = param.getString("point_status");
if (StrUtil.isBlank(point_status)) {
throw new BadRequestException("点位状态不能为空!");
}
JSONObject point_update = new JSONObject();
point_update.put("point_status", point_status);
WQLObject.getWQLObject("sch_base_point").update(point_update, "point_code = '" + point_code + "'");
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "更新点位状态成功!");
return result;
}
} }

52
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AbstractAcsTask.java

@ -7,9 +7,11 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.sch.AcsUtil; import org.nl.wms.sch.AcsUtil;
import org.nl.wms.sch.task.AcsTaskDTO; import org.nl.wms.sch.task.AcsTaskDTO;
import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -51,7 +53,7 @@ public abstract class AbstractAcsTask {
.query("is_delete = '0' AND task_status = " + TaskStatus.START_AND_END.value() + " AND handle_class = '" + this.getClass().getName() + "'") .query("is_delete = '0' AND task_status = " + TaskStatus.START_AND_END.value() + " AND handle_class = '" + this.getClass().getName() + "'")
.getResultJSONArray(0); .getResultJSONArray(0);
ArrayList<AcsTaskDTO> acsTasks = new ArrayList<>(); ArrayList<AcsTaskDTO> acs_tasks = new ArrayList<>();
for (Object o : tasks) { for (Object o : tasks) {
JSONObject task = (JSONObject) o; JSONObject task = (JSONObject) o;
@ -68,11 +70,13 @@ public abstract class AbstractAcsTask {
.remark(task.getString("remark")) .remark(task.getString("remark"))
.build(); .build();
acsTasks.add(acsTask); acs_tasks.add(acsTask);
} }
return acsTasks; return acs_tasks;
}; }
;
/** /**
* @param taskObj 代表一条任务对象 * @param taskObj 代表一条任务对象
@ -145,16 +149,32 @@ public abstract class AbstractAcsTask {
*/ */
public JSONObject immediateNotifyAcs(String taskId) { public JSONObject immediateNotifyAcs(String taskId) {
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task"); WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
JSONArray tasks = taskTable JSONObject task = taskTable
.query("task_id = " + taskId) .query("task_id = " + taskId)
.getResultJSONArray(0); .uniqueResult(0);
if (ObjectUtil.isNotEmpty(tasks)) { if (ObjectUtil.isNotEmpty(task)) {
String taskStatus = ((JSONObject) tasks.get(0)).getString("task_status"); String task_status = task.getString("task_status");
if (!StrUtil.equals(taskStatus, TaskStatus.START_AND_END.value())) { if (!StrUtil.equals(task_status, TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能下发已确认起点和终点的任务"); throw new BadRequestException("只能下发 [确认起点和终点] 的任务!");
} }
AcsTaskDTO acs_task = AcsTaskDTO
.builder()
.task_id(task.getString("task_id"))
.task_code(task.getString("task_code"))
.task_type(task.getString("acs_task_type"))
.start_device_code(task.getString("point_code1"))
.next_device_code(task.getString("point_code2"))
.vehicle_code(task.getString("vehicle_code"))
.vehicle_type(task.getString("vehicle_type"))
.priority(task.getString("priority"))
.remark(task.getString("remark"))
.build();
JSONArray tasks = new JSONArray() {{
add(acs_task);
}};
JSONObject result = AcsUtil.notifyAcs("api/wms/task", tasks); JSONObject result = AcsUtil.notifyAcs("api/wms/task", tasks);
String status = result.getString("status"); String status = result.getString("status");
@ -169,8 +189,8 @@ public abstract class AbstractAcsTask {
JSONObject taskObj = new JSONObject(); JSONObject taskObj = new JSONObject();
taskObj.put("task_id", ((JSONObject) item).getString("task_id")); taskObj.put("task_id", ((JSONObject) item).getString("task_id"));
taskObj.put("task_status", TaskStatus.ISSUE.value()); taskObj.put("task_status", TaskStatus.ISSUE.value());
taskObj.put("remark", "下发成功"); taskObj.put("remark", "下发成功");
taskObj.put("update_time", DateUtil.now()); TaskUtils.addCurrentUpdateColum(taskObj);
taskTable.update(taskObj); taskTable.update(taskObj);
}); });
} else {//下发失败 } else {//下发失败
@ -178,8 +198,8 @@ public abstract class AbstractAcsTask {
JSONObject taskObj = new JSONObject(); JSONObject taskObj = new JSONObject();
taskObj.put("task_id", ((JSONObject) item).getString("task_id")); taskObj.put("task_id", ((JSONObject) item).getString("task_id"));
// taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode()); // taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
taskObj.put("remark", "下发失败:" + message); taskObj.put("remark", "下发失败" + message);
taskObj.put("update_time", DateUtil.now()); TaskUtils.addCurrentUpdateColum(taskObj);
taskTable.update(taskObj); taskTable.update(taskObj);
}); });
} }
@ -188,8 +208,8 @@ public abstract class AbstractAcsTask {
//处理下发失败的任务 //处理下发失败的任务
for (int i = 0; i < errArr.size(); i++) { for (int i = 0; i < errArr.size(); i++) {
JSONObject taskObj = errArr.getJSONObject(i); JSONObject taskObj = errArr.getJSONObject(i);
taskObj.put("remark", "下发失败:"+taskObj.getString("message")); taskObj.put("remark", "下发失败:" + taskObj.getString("message"));
taskObj.put("update_time", DateUtil.now()); TaskUtils.addCurrentUpdateColum(taskObj);
taskTable.update(taskObj); taskTable.update(taskObj);
} }
} }

9
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCreateTask.java

@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.sch.AcsUtil; import org.nl.wms.sch.AcsUtil;
@ -84,6 +85,8 @@ public class AutoCreateTask {
taskObj.put("task_id", item.getTask_id()); taskObj.put("task_id", item.getTask_id());
taskObj.put("task_status", TaskStatus.ISSUE.value()); taskObj.put("task_status", TaskStatus.ISSUE.value());
taskObj.put("remark", "下发成功"); taskObj.put("remark", "下发成功");
taskObj.put("update_optid", AutoCreate.id);
taskObj.put("update_optname", AutoCreate.nick_name);
taskObj.put("update_time", DateUtil.now()); taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj); taskTab.update(taskObj);
}); });
@ -92,7 +95,9 @@ public class AutoCreateTask {
JSONObject taskObj = new JSONObject(); JSONObject taskObj = new JSONObject();
taskObj.put("task_id", item.getTask_id()); taskObj.put("task_id", item.getTask_id());
// taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode()); // taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
taskObj.put("remark", "下发失败:" + message); taskObj.put("remark", "下发失败:" + message);
taskObj.put("update_optid", AutoCreate.id);
taskObj.put("update_optname", AutoCreate.nick_name);
taskObj.put("update_time", DateUtil.now()); taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj); taskTab.update(taskObj);
}); });
@ -103,6 +108,8 @@ public class AutoCreateTask {
for (int i = 0; i < errArr.size(); i++) { for (int i = 0; i < errArr.size(); i++) {
JSONObject taskObj = errArr.getJSONObject(i); JSONObject taskObj = errArr.getJSONObject(i);
taskObj.put("remark", "下发失败:" + taskObj.getString("message")); taskObj.put("remark", "下发失败:" + taskObj.getString("message"));
taskObj.put("update_optid", AutoCreate.id);
taskObj.put("update_optname", AutoCreate.nick_name);
taskObj.put("update_time", DateUtil.now()); taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj); taskTab.update(taskObj);
} }

16
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/YZCallEmptyTask.java

@ -12,7 +12,6 @@ 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.util.TaskUtils; import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 辽宁晟华压制 叫空 任务类 * 辽宁晟华压制 叫空 任务类
@ -24,7 +23,6 @@ import org.springframework.transaction.annotation.Transactional;
@Component @Component
public class YZCallEmptyTask extends AbstractAcsTask { public class YZCallEmptyTask extends AbstractAcsTask {
@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)) {
@ -38,7 +36,6 @@ public class YZCallEmptyTask extends AbstractAcsTask {
} }
} }
@Override @Override
public String createTask(JSONObject form) { public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point"); JSONObject point = form.getJSONObject("point");
@ -68,12 +65,12 @@ public class YZCallEmptyTask extends AbstractAcsTask {
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point); WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code"); return task.getString("task_code");
} }
@Override @Override
public void findStartPoint() { public void findStartPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task"); WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
@ -103,16 +100,17 @@ public class YZCallEmptyTask extends AbstractAcsTask {
task.put("point_code1", point.getString("point_code")); task.put("point_code1", point.getString("point_code"));
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code"))); task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
task.put("remark", ""); task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task); task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point);
point_table.update(point); point_table.update(point);
} }
} }
} }
@Override @Override
public void forceFinish(String task_id) { public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0); JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@ -132,7 +130,6 @@ public class YZCallEmptyTask extends AbstractAcsTask {
this.cancelTask(task, OperationType.MANUAL); this.cancelTask(task, OperationType.MANUAL);
} }
public void cancelTask(JSONObject task, OperationType operation_type) { public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) { if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value()); task.put("task_status", TaskStatus.CANCELLED.value());
@ -170,7 +167,6 @@ public class YZCallEmptyTask extends AbstractAcsTask {
} }
} }
public void finishTask(JSONObject task, OperationType operation_type) { public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) { if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.FINISHED.value()); task.put("task_status", TaskStatus.FINISHED.value());
@ -190,13 +186,19 @@ public class YZCallEmptyTask extends AbstractAcsTask {
point1.put("vehicle_type", ""); point1.put("vehicle_type", "");
point1.put("vehicle_code", ""); point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value()); point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1); TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1); point_table.update(point1);
} }
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);

11
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/FJCallMaterialTask.java

@ -12,7 +12,6 @@ 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.util.TaskUtils; import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author zhangjiangwei * @author zhangjiangwei
@ -40,7 +39,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
@Override @Override
public String createTask(JSONObject form) { public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point"); JSONObject point = form.getJSONObject("point");
JSONObject workorder = TaskUtils.hasWorkOrder(point); JSONObject workorder = form.getJSONObject("workorder");
JSONObject task = TaskUtils.buildTask( JSONObject task = TaskUtils.buildTask(
"分拣区叫料", "分拣区叫料",
@ -62,6 +61,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point); WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code"); return task.getString("task_code");
@ -82,6 +82,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
JSONObject point = WQL JSONObject point = WQL
.getWO("CALL_MATERIAL_TASK") .getWO("CALL_MATERIAL_TASK")
.addParam("flag", "3") .addParam("flag", "3")
.addParam("material_id", task.getString("material_id"))
.process() .process()
.uniqueResult(0); .uniqueResult(0);
@ -90,11 +91,13 @@ public class FJCallMaterialTask extends AbstractAcsTask {
task.put("point_code1", point.getString("point_code")); task.put("point_code1", point.getString("point_code"));
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code"))); task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
task.put("remark", ""); task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task); task_table.update(task);
JSONObject point_update = new JSONObject(); JSONObject point_update = new JSONObject();
point_update.put("lock_type", LockType.TASK_LOCKED.value()); point_update.put("lock_type", LockType.TASK_LOCKED.value());
point_update.put("task_code", task.getString("task_code")); point_update.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point_update);
point_table.update(point_update, "point_id = " + point.getLongValue("point_id")); point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
} }
} }
@ -178,7 +181,11 @@ public class FJCallMaterialTask extends AbstractAcsTask {
point1.put("vehicle_type", ""); point1.put("vehicle_type", "");
point1.put("vehicle_code", ""); point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value()); point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1); TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1); point_table.update(point1);
} }

9
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java

@ -1,5 +1,6 @@
package org.nl.wms.sch.task.call.material; package org.nl.wms.sch.task.call.material;
import cn.hutool.core.date.DateUtil;
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;
@ -11,7 +12,6 @@ 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.util.TaskUtils; import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author zhangjiangwei * @author zhangjiangwei
@ -78,6 +78,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point); WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code"); return task.getString("task_code");
@ -107,11 +108,13 @@ public class SZCallMaterialTask extends AbstractAcsTask {
task.put("material_id", point.getString("material_id")); task.put("material_id", point.getString("material_id"));
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code"))); task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
task.put("remark", ""); task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task); task_table.update(task);
JSONObject point_update = new JSONObject(); JSONObject point_update = new JSONObject();
point_update.put("lock_type", LockType.TASK_LOCKED.value()); point_update.put("lock_type", LockType.TASK_LOCKED.value());
point_update.put("task_code", task.getString("task_code")); point_update.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point_update);
point_table.update(point_update, "point_id = " + point.getLongValue("point_id")); point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
} }
} }
@ -195,7 +198,11 @@ public class SZCallMaterialTask extends AbstractAcsTask {
point1.put("vehicle_type", ""); point1.put("vehicle_type", "");
point1.put("vehicle_code", ""); point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value()); point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1); TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1); point_table.update(point1);
} }

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

@ -14,6 +14,7 @@
## 表字段对应输入参数 ## 表字段对应输入参数
################################################# #################################################
输入.flag TYPEAS s_string 输入.flag TYPEAS s_string
输入.material_id TYPEAS f_string
[临时表] [临时表]
--这边列出来的临时表就会在运行期动态创建 --这边列出来的临时表就会在运行期动态创建
@ -95,6 +96,7 @@
AND point.point_status = '1' AND point.point_status = '1'
AND point.vehicle_type = '2' AND point.vehicle_type = '2'
AND vd.is_fire = '1' AND vd.is_fire = '1'
AND vd.material_id = 输入.material_id
ORDER BY ORDER BY
workorder.is_urgent DESC, vd.create_time ASC workorder.is_urgent DESC, vd.create_time ASC
ENDSELECT ENDSELECT

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

@ -39,7 +39,7 @@ public class FJSendEmptyTask 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"); String vehicle_code = point.getString("vehicle_code");
JSONObject task = TaskUtils.buildTask( JSONObject task = TaskUtils.buildTask(
"分拣区送空", "分拣区送空",
@ -61,6 +61,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point); WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code"); return task.getString("task_code");
@ -88,10 +89,12 @@ public class FJSendEmptyTask extends AbstractAcsTask {
task.put("task_status", TaskStatus.START_AND_END.value()); task.put("task_status", TaskStatus.START_AND_END.value());
task.put("point_code2", point.getString("point_code")); task.put("point_code2", point.getString("point_code"));
task.put("remark", ""); task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task); task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point);
point_table.update(point); point_table.update(point);
} }
} }
@ -175,14 +178,17 @@ public class FJSendEmptyTask extends AbstractAcsTask {
point1.put("vehicle_type", ""); point1.put("vehicle_type", "");
point1.put("vehicle_code", ""); point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value()); point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1); TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1); point_table.update(point1);
} }
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("point_status", PointStatus.NOT_EMPTY.value());
if (operation_type == OperationType.AUTO) { if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2); TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) { } else if (operation_type == OperationType.MANUAL) {

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

@ -48,6 +48,7 @@
AND lock_type = '1' AND lock_type = '1'
AND region_code = 'GTK' AND region_code = 'GTK'
AND point_type = '1' AND point_type = '1'
AND point_status = '0'
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY
ENDIF ENDIF

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

@ -59,6 +59,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point); WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code"); return task.getString("task_code");
@ -86,10 +87,12 @@ public class SZSendMaterialTask extends AbstractAcsTask {
task.put("task_status", TaskStatus.START_AND_END.value()); task.put("task_status", TaskStatus.START_AND_END.value());
task.put("point_code2", point.getString("point_code")); task.put("point_code2", point.getString("point_code"));
task.put("remark", ""); task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task); task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point);
point_table.update(point); point_table.update(point);
} }
} }
@ -170,7 +173,14 @@ public class SZSendMaterialTask extends AbstractAcsTask {
&& task.getString("task_code").equals(point1.getString("task_code"))) { && task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value()); point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", ""); point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1); TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1); point_table.update(point1);
} }

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

@ -8,11 +8,9 @@ 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.TrueOrFalse;
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.util.TaskUtils; import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author zhangjiangwei * @author zhangjiangwei
@ -63,6 +61,7 @@ public class YZSendMaterialTask extends AbstractAcsTask {
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point); WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code"); return task.getString("task_code");
@ -92,10 +91,12 @@ public class YZSendMaterialTask extends AbstractAcsTask {
task.put("task_status", TaskStatus.START_AND_END.value()); task.put("task_status", TaskStatus.START_AND_END.value());
task.put("point_code2", point.getString("point_code")); task.put("point_code2", point.getString("point_code"));
task.put("remark", ""); task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task); task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value()); point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code")); point.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point);
point_table.update(point); point_table.update(point);
} }
} }
@ -180,7 +181,11 @@ public class YZSendMaterialTask extends AbstractAcsTask {
point1.put("vehicle_type", ""); point1.put("vehicle_type", "");
point1.put("vehicle_code", ""); point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value()); point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1); TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1); point_table.update(point1);
} }

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

@ -10,6 +10,7 @@ import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.sch.manage.ACSSystem; import org.nl.wms.sch.manage.ACSSystem;
import org.nl.wms.sch.manage.AutoCreate;
import org.nl.wms.sch.manage.LockType; import org.nl.wms.sch.manage.LockType;
import org.nl.wms.sch.manage.PointStatus; import org.nl.wms.sch.manage.PointStatus;
@ -111,4 +112,16 @@ public class TaskUtils {
row.put("update_optname", SecurityUtils.getCurrentNickName()); row.put("update_optname", SecurityUtils.getCurrentNickName());
row.put("update_time", DateUtil.now()); row.put("update_time", DateUtil.now());
} }
public static void addAutoUpdateColum(JSONObject row) {
row.put("update_optid", AutoCreate.id);
row.put("update_optname", AutoCreate.nick_name);
row.put("update_time", DateUtil.now());
}
public static void addFormUpdateColum(JSONObject row, JSONObject form) {
row.put("update_optid", form.getString("create_id"));
row.put("update_optname", form.getString("create_name"));
row.put("update_time", DateUtil.now());
}
} }

Loading…
Cancel
Save