更新
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package org.nl.wms.common;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangjiangwei
|
||||||
|
* @date 2023/04/25 15:29
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum PickType {
|
||||||
|
|
||||||
|
YL("原料", "1"),
|
||||||
|
YZ("压制", "2"),
|
||||||
|
GZ("干燥", "3"),
|
||||||
|
CP("成品", "4");
|
||||||
|
|
||||||
|
private final String label;
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
public String label() {
|
||||||
|
return this.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String value() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,14 +4,19 @@ package org.nl.wms.ext.acs.rest;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
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.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||||
|
|
||||||
|
import org.redisson.api.RLock;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -20,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ludj
|
* @author ludj
|
||||||
@@ -55,7 +61,30 @@ public class AcsToWmsController {
|
|||||||
@ApiOperation("申请任务")
|
@ApiOperation("申请任务")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity<Object> apply(@RequestBody JSONObject whereJson) {
|
public ResponseEntity<Object> apply(@RequestBody JSONObject whereJson) {
|
||||||
return new ResponseEntity<>(acsToWmsService.apply(whereJson), HttpStatus.OK);
|
String point_code = whereJson.getString("device_code");
|
||||||
|
if (StrUtil.isBlank(point_code)) {
|
||||||
|
throw new BadRequestException("点位不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
RLock lock = SpringContextHolder.getBean(RedissonClient.class).getFairLock(point_code);
|
||||||
|
boolean try_lock = false;
|
||||||
|
try {
|
||||||
|
try_lock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||||
|
if (try_lock) {
|
||||||
|
return new ResponseEntity<>(acsToWmsService.apply(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new BadRequestException(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (try_lock) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("message", "申请任务失败!");
|
||||||
|
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
return new ResponseEntity<>(result, HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/manipulatorApply")
|
@PostMapping("/manipulatorApply")
|
||||||
@@ -63,7 +92,30 @@ public class AcsToWmsController {
|
|||||||
@ApiOperation("ACS机械手给WMS发送任务")
|
@ApiOperation("ACS机械手给WMS发送任务")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity<Object> manipulatorApply(@RequestBody JSONObject whereJson) {
|
public ResponseEntity<Object> manipulatorApply(@RequestBody JSONObject whereJson) {
|
||||||
return new ResponseEntity<>(acsToWmsService.manipulatorApply(whereJson), HttpStatus.OK);
|
String point_code = whereJson.getString("device_code");
|
||||||
|
if (StrUtil.isBlank(point_code)) {
|
||||||
|
throw new BadRequestException("点位不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
RLock lock = SpringContextHolder.getBean(RedissonClient.class).getFairLock(point_code);
|
||||||
|
boolean try_lock = false;
|
||||||
|
try {
|
||||||
|
try_lock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||||
|
if (try_lock) {
|
||||||
|
return new ResponseEntity<>(acsToWmsService.manipulatorApply(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new BadRequestException(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (try_lock) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("message", "申请任务失败!");
|
||||||
|
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
return new ResponseEntity<>(result, HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/reverseGroup")
|
@PostMapping("/reverseGroup")
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||||
|
|
||||||
private final RedissonClient redissonClient;
|
|
||||||
|
|
||||||
private final HLCallEmptyTask hlCallEmptyTask;
|
private final HLCallEmptyTask hlCallEmptyTask;
|
||||||
|
|
||||||
private final HLSendMaterialTask hlSendMaterialTask;
|
private final HLSendMaterialTask hlSendMaterialTask;
|
||||||
@@ -187,155 +185,142 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public JSONObject apply(JSONObject param) {
|
public JSONObject apply(JSONObject param) {
|
||||||
String point_code = param.getString("device_code");
|
String point_code = param.getString("device_code");
|
||||||
if (StrUtil.isBlank(point_code)) {
|
|
||||||
throw new BadRequestException("点位不能为空!");
|
|
||||||
}
|
|
||||||
String type = param.getString("type");
|
String type = param.getString("type");
|
||||||
if (StrUtil.isBlank(type)) {
|
if (StrUtil.isBlank(type)) {
|
||||||
throw new BadRequestException("任务类型不能为空!");
|
throw new BadRequestException("任务类型不能为空!");
|
||||||
}
|
}
|
||||||
RLock lock = redissonClient.getFairLock("acs_to_wms:" + point_code);
|
String task_code;
|
||||||
boolean try_lock = false;
|
JSONObject point = param.getJSONObject("point");
|
||||||
String task_code = null;
|
if (ObjectUtil.isEmpty(point)) {
|
||||||
try {
|
point = WQLObject
|
||||||
try_lock = lock.tryLock(5, TimeUnit.SECONDS);
|
.getWQLObject("sch_base_point")
|
||||||
if (try_lock) {
|
.query("is_used = '1' AND point_code = '" + point_code + "'")
|
||||||
JSONObject point = param.getJSONObject("point");
|
.uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(point)) {
|
if (ObjectUtil.isEmpty(point)) {
|
||||||
point = WQLObject
|
throw new BadRequestException("[" + point_code + "] 已删除或未启用!");
|
||||||
.getWQLObject("sch_base_point")
|
|
||||||
.query("is_used = '1' AND point_code = '" + point_code + "'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(point)) {
|
|
||||||
throw new BadRequestException("[" + point_code + "] 已删除或未启用!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TaskUtils.isLocked(point);
|
|
||||||
|
|
||||||
Region region = Region.get(point.getString("region_code"));
|
|
||||||
|
|
||||||
JSONObject method_param = new JSONObject();
|
|
||||||
method_param.put("point", point);
|
|
||||||
method_param.put("create_mode", CreateMode.ACSSQ.value());
|
|
||||||
String request_param = param.getString("request_param");
|
|
||||||
if (StrUtil.isBlank(request_param)) {
|
|
||||||
request_param = param.toJSONString();
|
|
||||||
}
|
|
||||||
method_param.put("request_param", request_param);
|
|
||||||
method_param.put("create_id", ACSSystem.id);
|
|
||||||
method_param.put("create_name", ACSSystem.nick_name);
|
|
||||||
switch (type) {
|
|
||||||
case "1":
|
|
||||||
// 送料
|
|
||||||
String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
|
|
||||||
if ("0000".equals(vehicle_code)) {
|
|
||||||
throw new BadRequestException("载具编码不能为空!");
|
|
||||||
}
|
|
||||||
method_param.put("vehicle_code", vehicle_code);
|
|
||||||
|
|
||||||
switch (region) {
|
|
||||||
case HL:
|
|
||||||
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
|
||||||
method_param.put("workorder", workorder);
|
|
||||||
task_code = hlSendMaterialTask.createTask(method_param);
|
|
||||||
break;
|
|
||||||
case YZ:
|
|
||||||
method_param.put("workorder", param.getJSONObject("workorder"));
|
|
||||||
method_param.put("vd", param.getJSONObject("vd"));
|
|
||||||
JSONObject device = WQLObject
|
|
||||||
.getWQLObject("pdm_bi_device")
|
|
||||||
.query("device_code = '" + point.getString("device_code") + "'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
method_param.put("device", device);
|
|
||||||
task_code = 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);
|
|
||||||
|
|
||||||
task_code = szSendMaterialTask.createTask(method_param);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new BadRequestException("[" + region.label() + "] 不能发起送料任务!");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "2":
|
|
||||||
// 叫料
|
|
||||||
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
|
||||||
method_param.put("workorder", workorder);
|
|
||||||
|
|
||||||
switch (region) {
|
|
||||||
case FJ:
|
|
||||||
task_code = fjCallMaterialTask.createTask(method_param);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new BadRequestException("[" + region.label() + "] 不能发起叫料任务!");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "3":
|
|
||||||
// 送空
|
|
||||||
switch (region) {
|
|
||||||
case FJ:
|
|
||||||
task_code = fjSendEmptyTask.createTask(method_param);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new BadRequestException("[" + region.label() + "] 不能发起送空任务!");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "4":
|
|
||||||
// 叫空
|
|
||||||
switch (region) {
|
|
||||||
case HL:
|
|
||||||
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);
|
|
||||||
task_code = hlCallEmptyTask.createTask(method_param);
|
|
||||||
break;
|
|
||||||
case YZ:
|
|
||||||
device_code = point.getString("device_code");
|
|
||||||
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);
|
|
||||||
JSONObject device = WQLObject
|
|
||||||
.getWQLObject("pdm_bi_device")
|
|
||||||
.query("device_code = '" + device_code + "'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
method_param.put("device", device);
|
|
||||||
task_code = yzCallEmptyTask.createTask(method_param);
|
|
||||||
break;
|
|
||||||
case GTK:
|
|
||||||
task_code = gtkCallEmptyTask.createTask(method_param);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new BadRequestException("未知任务类型!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
log.error("lock fail!", e);
|
|
||||||
} finally {
|
|
||||||
if (try_lock) {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TaskUtils.isLocked(point);
|
||||||
|
|
||||||
|
Region region = Region.get(point.getString("region_code"));
|
||||||
|
|
||||||
|
JSONObject method_param = new JSONObject();
|
||||||
|
method_param.put("point", point);
|
||||||
|
method_param.put("create_mode", CreateMode.ACSSQ.value());
|
||||||
|
String request_param = param.getString("request_param");
|
||||||
|
if (StrUtil.isBlank(request_param)) {
|
||||||
|
request_param = param.toJSONString();
|
||||||
|
}
|
||||||
|
method_param.put("request_param", request_param);
|
||||||
|
method_param.put("create_id", ACSSystem.id);
|
||||||
|
method_param.put("create_name", ACSSystem.nick_name);
|
||||||
|
switch (type) {
|
||||||
|
case "1":
|
||||||
|
// 送料
|
||||||
|
String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
|
||||||
|
if ("0000".equals(vehicle_code)) {
|
||||||
|
throw new BadRequestException("载具编码不能为空!");
|
||||||
|
}
|
||||||
|
method_param.put("vehicle_code", vehicle_code);
|
||||||
|
|
||||||
|
switch (region) {
|
||||||
|
case HL:
|
||||||
|
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
||||||
|
method_param.put("workorder", workorder);
|
||||||
|
task_code = hlSendMaterialTask.createTask(method_param);
|
||||||
|
break;
|
||||||
|
case YZ:
|
||||||
|
method_param.put("workorder", param.getJSONObject("workorder"));
|
||||||
|
method_param.put("vd", param.getJSONObject("vd"));
|
||||||
|
task_code = 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);
|
||||||
|
|
||||||
|
task_code = szSendMaterialTask.createTask(method_param);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new BadRequestException("[" + region.label() + "] 不能发起送料任务!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
// 叫料
|
||||||
|
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
||||||
|
method_param.put("workorder", workorder);
|
||||||
|
|
||||||
|
switch (region) {
|
||||||
|
case FJ:
|
||||||
|
task_code = fjCallMaterialTask.createTask(method_param);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new BadRequestException("[" + region.label() + "] 不能发起叫料任务!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
// 送空
|
||||||
|
vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
|
||||||
|
if ("0000".equals(vehicle_code)) {
|
||||||
|
vehicle_code = point.getString("vehicle_code");
|
||||||
|
if (StrUtil.isBlank(vehicle_code) || "0000".equals(vehicle_code)) {
|
||||||
|
throw new BadRequestException("未知载具编码!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
method_param.put("vehicle_code", vehicle_code);
|
||||||
|
|
||||||
|
switch (region) {
|
||||||
|
case FJ:
|
||||||
|
JSONObject vd_update = new JSONObject();
|
||||||
|
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
|
||||||
|
WQLObject
|
||||||
|
.getWQLObject("st_ivt_vehicle_detail")
|
||||||
|
.update(vd_update, "vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'");
|
||||||
|
task_code = fjSendEmptyTask.createTask(method_param);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new BadRequestException("[" + region.label() + "] 不能发起送空任务!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
// 叫空
|
||||||
|
switch (region) {
|
||||||
|
case HL:
|
||||||
|
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);
|
||||||
|
task_code = hlCallEmptyTask.createTask(method_param);
|
||||||
|
break;
|
||||||
|
case YZ:
|
||||||
|
device_code = point.getString("device_code");
|
||||||
|
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);
|
||||||
|
task_code = yzCallEmptyTask.createTask(method_param);
|
||||||
|
break;
|
||||||
|
case GTK:
|
||||||
|
task_code = gtkCallEmptyTask.createTask(method_param);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new BadRequestException("未知任务类型!");
|
||||||
|
}
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("message", "申请任务成功,任务编码 [" + task_code + "]");
|
result.put("message", "申请任务成功,任务编码 [" + task_code + "]");
|
||||||
result.put("status", HttpStatus.OK.value());
|
result.put("status", HttpStatus.OK.value());
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component("autoCreateTask")
|
||||||
public class AutoCreateTask {
|
public class AutoCreateTask {
|
||||||
// 下发acs的任务集合
|
// 下发acs的任务集合
|
||||||
private List<AcsTaskDTO> taskList = null;
|
private List<AcsTaskDTO> taskList = null;
|
||||||
|
|||||||
@@ -45,17 +45,17 @@ public class TaskController {
|
|||||||
public ResponseEntity<Object> getTaskStatus() {
|
public ResponseEntity<Object> getTaskStatus() {
|
||||||
TaskStatus[] values = TaskStatus.values();
|
TaskStatus[] values = TaskStatus.values();
|
||||||
JSONArray arr = new JSONArray();
|
JSONArray arr = new JSONArray();
|
||||||
|
//增加未完成状态
|
||||||
|
JSONObject unFinish = new JSONObject();
|
||||||
|
unFinish.put("code", "-1");
|
||||||
|
unFinish.put("name", "未完成");
|
||||||
|
arr.add(unFinish);
|
||||||
for (TaskStatus value : values) {
|
for (TaskStatus value : values) {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("code", value.value());
|
json.put("code", value.value());
|
||||||
json.put("name", value.label());
|
json.put("name", value.label());
|
||||||
arr.add(json);
|
arr.add(json);
|
||||||
}
|
}
|
||||||
//增加未完成状态
|
|
||||||
JSONObject unFinish = new JSONObject();
|
|
||||||
unFinish.put("code", "-1");
|
|
||||||
unFinish.put("name", "未完成");
|
|
||||||
arr.add(unFinish);
|
|
||||||
return new ResponseEntity<>(arr, HttpStatus.OK);
|
return new ResponseEntity<>(arr, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ public class TaskServiceImpl implements TaskService {
|
|||||||
param.put("remark", json.getString("message"));
|
param.put("remark", json.getString("message"));
|
||||||
wo.update(param);
|
wo.update(param);
|
||||||
}
|
}
|
||||||
throw new BadRequestException("任务操作失败!");
|
|
||||||
} else {
|
} else {
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("task_id", task_id);
|
param.put("task_id", task_id);
|
||||||
@@ -134,7 +133,7 @@ public class TaskServiceImpl implements TaskService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new BadRequestException("任务操作失败!");
|
throw new BadRequestException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,6 @@ public class YZCallEmptyTask extends AbstractAcsTask {
|
|||||||
if (ObjectUtil.isNotEmpty(work_order)) {
|
if (ObjectUtil.isNotEmpty(work_order)) {
|
||||||
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
|
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
|
||||||
}
|
}
|
||||||
JSONObject device = form.getJSONObject("device");
|
|
||||||
if (ObjectUtil.isNotEmpty(device) && "4".equals(device.getString("device_model"))) {
|
|
||||||
++priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject task = TaskUtils.buildTask(
|
JSONObject task = TaskUtils.buildTask(
|
||||||
"压制区叫空",
|
"压制区叫空",
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
IF 输入.flag = "3"
|
IF 输入.flag = "3"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
*
|
point.*
|
||||||
FROM
|
FROM
|
||||||
sch_base_point point
|
sch_base_point point
|
||||||
LEFT JOIN sch_base_task task ON point.point_code = task.point_code1
|
LEFT JOIN sch_base_task task ON point.point_code = task.point_code1
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ public class FJCallMaterialTask extends AbstractAcsTask {
|
|||||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
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("group_id", point.getString("vd_id"));
|
|
||||||
task.put("remark", "");
|
task.put("remark", "");
|
||||||
TaskUtils.addAutoUpdateColum(task);
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
task_table.update(task);
|
task_table.update(task);
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ public class SZCallMaterialTask extends AbstractAcsTask {
|
|||||||
task.put("point_code1", point.getString("point_code"));
|
task.put("point_code1", point.getString("point_code"));
|
||||||
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("group_id", point.getString("vd_id"));
|
|
||||||
task.put("remark", "");
|
task.put("remark", "");
|
||||||
TaskUtils.addAutoUpdateColum(task);
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
task_table.update(task);
|
task_table.update(task);
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ 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 = point.getString("vehicle_code");
|
|
||||||
|
|
||||||
JSONObject task = TaskUtils.buildTask(
|
JSONObject task = TaskUtils.buildTask(
|
||||||
"分拣区送空",
|
"分拣区送空",
|
||||||
@@ -49,7 +48,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
VehicleType.STEEL_TRAY.value(),
|
VehicleType.STEEL_TRAY.value(),
|
||||||
vehicle_code,
|
form.getString("vehicle_code"),
|
||||||
1,
|
1,
|
||||||
FJSendEmptyTask.class.getName(),
|
FJSendEmptyTask.class.getName(),
|
||||||
form.getString("create_mode"),
|
form.getString("create_mode"),
|
||||||
|
|||||||
@@ -40,15 +40,18 @@
|
|||||||
IF 输入.flag = "1"
|
IF 输入.flag = "1"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
*
|
point.*
|
||||||
FROM
|
FROM
|
||||||
sch_base_point
|
sch_base_point point
|
||||||
|
LEFT JOIN sch_base_task task ON point.point_code = task.point_code2
|
||||||
|
AND task.task_status <> '7'
|
||||||
|
AND task_status <> '8'
|
||||||
WHERE
|
WHERE
|
||||||
is_used = '1'
|
point.is_used = '1'
|
||||||
AND lock_type = '1'
|
AND point.lock_type = '1'
|
||||||
AND region_code = 'GTK'
|
AND point.region_code = 'GTK'
|
||||||
AND point_type = '1'
|
AND point.point_type = '1'
|
||||||
AND point_status = '0'
|
AND task.task_id IS NULL
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
|
|||||||
TaskStatus.SURE_START.value(),
|
TaskStatus.SURE_START.value(),
|
||||||
point.getString("point_code"),
|
point.getString("point_code"),
|
||||||
null,
|
null,
|
||||||
vd.getString("vd_id"),
|
null,
|
||||||
vd.getString("material_id"),
|
vd.getString("material_id"),
|
||||||
vd.getString("vehicle_type"),
|
vd.getString("vehicle_type"),
|
||||||
vd.getString("vehicle_code"),
|
vd.getString("vehicle_code"),
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.nl.wms.sch.task.send.material;
|
package org.nl.wms.sch.task.send.material;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
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;
|
||||||
@@ -8,6 +10,7 @@ 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.common.PickType;
|
||||||
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;
|
||||||
@@ -40,19 +43,18 @@ public class YZSendMaterialTask extends AbstractAcsTask {
|
|||||||
JSONObject point = form.getJSONObject("point");
|
JSONObject point = form.getJSONObject("point");
|
||||||
JSONObject work_order = form.getJSONObject("workorder");
|
JSONObject work_order = form.getJSONObject("workorder");
|
||||||
int priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
|
int priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
|
||||||
JSONObject device = form.getJSONObject("device");
|
|
||||||
if (ObjectUtil.isNotEmpty(device) && "4".equals(device.getString("device_model"))) {
|
|
||||||
++priority;
|
|
||||||
}
|
|
||||||
JSONObject vd = form.getJSONObject("vd");
|
JSONObject vd = form.getJSONObject("vd");
|
||||||
|
|
||||||
|
JSONObject pn = TaskUtils.buildPN(PickType.YZ, vd.getLongValue("qty"), vd.getLongValue("workorder_id"));
|
||||||
|
WQLObject.getWQLObject("das_produce_number").insert(pn);
|
||||||
|
|
||||||
JSONObject task = TaskUtils.buildTask(
|
JSONObject task = TaskUtils.buildTask(
|
||||||
"压制区送料",
|
"压制区送料",
|
||||||
TaskType.SEND_MATERIAL.value(),
|
TaskType.SEND_MATERIAL.value(),
|
||||||
TaskStatus.SURE_START.value(),
|
TaskStatus.SURE_START.value(),
|
||||||
point.getString("point_code"),
|
point.getString("point_code"),
|
||||||
null,
|
null,
|
||||||
vd.getString("vd_id"),
|
pn.getLongValue("data_id"),
|
||||||
vd.getString("material_id"),
|
vd.getString("material_id"),
|
||||||
vd.getString("vehicle_type"),
|
vd.getString("vehicle_type"),
|
||||||
vd.getString("vehicle_code"),
|
vd.getString("vehicle_code"),
|
||||||
@@ -163,6 +165,8 @@ public class YZSendMaterialTask extends AbstractAcsTask {
|
|||||||
TaskUtils.addCurrentUpdateColum(point2);
|
TaskUtils.addCurrentUpdateColum(point2);
|
||||||
}
|
}
|
||||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||||
|
|
||||||
|
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("group_id"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.nl.modules.common.utils.SecurityUtils;
|
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.common.PickType;
|
||||||
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.AutoCreate;
|
||||||
import org.nl.wms.sch.manage.LockType;
|
import org.nl.wms.sch.manage.LockType;
|
||||||
@@ -53,7 +54,7 @@ public class TaskUtils {
|
|||||||
String task_status,
|
String task_status,
|
||||||
String point_code1,
|
String point_code1,
|
||||||
String point_code2,
|
String point_code2,
|
||||||
String group_id,
|
Long group_id,
|
||||||
String material_id,
|
String material_id,
|
||||||
String vehicle_type,
|
String vehicle_type,
|
||||||
String vehicle_code,
|
String vehicle_code,
|
||||||
@@ -72,6 +73,7 @@ public class TaskUtils {
|
|||||||
task.put("task_status", task_status);
|
task.put("task_status", task_status);
|
||||||
task.put("point_code1", point_code1);
|
task.put("point_code1", point_code1);
|
||||||
task.put("point_code2", point_code2);
|
task.put("point_code2", point_code2);
|
||||||
|
task.put("group_id", group_id);
|
||||||
task.put("material_id", material_id);
|
task.put("material_id", material_id);
|
||||||
task.put("vehicle_type", vehicle_type);
|
task.put("vehicle_type", vehicle_type);
|
||||||
task.put("vehicle_code", vehicle_code);
|
task.put("vehicle_code", vehicle_code);
|
||||||
@@ -125,4 +127,14 @@ public class TaskUtils {
|
|||||||
row.put("update_optname", form.getString("create_name"));
|
row.put("update_optname", form.getString("create_name"));
|
||||||
row.put("update_time", DateUtil.now());
|
row.put("update_time", DateUtil.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JSONObject buildPN(PickType pickType, long real_qty, long workorder_id) {
|
||||||
|
JSONObject pn = new JSONObject();
|
||||||
|
pn.put("data_id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||||
|
pn.put("pick_type", pickType.value());
|
||||||
|
pn.put("real_qty", real_qty);
|
||||||
|
pn.put("workorder_id", workorder_id);
|
||||||
|
pn.put("create_time", DateUtil.now());
|
||||||
|
return pn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user