Merge branch 'master' of http://121.40.234.130:8899/root/liaoNingShengHua2
This commit is contained in:
@@ -78,7 +78,7 @@ public class MobileAuthorizationController {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("user", userDto);
|
||||
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
|
||||
put("token", "Bearer "+StpUtil.getTokenValue());
|
||||
put("token", "Bearer " + StpUtil.getTokenValue());
|
||||
put("user", jsonObject);
|
||||
}};
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
import org.nl.wms.sch.task.call.empty.HLCallEmptyTask;
|
||||
import org.nl.wms.sch.task.call.empty.YZCallEmptyTask;
|
||||
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
|
||||
import org.nl.wms.sch.task.call.material.SZCallMaterialTask;
|
||||
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
|
||||
import org.nl.wms.sch.task.send.material.HLSendMaterialTask;
|
||||
import org.nl.wms.sch.task.send.material.SZSendMaterialTask;
|
||||
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
|
||||
@@ -53,6 +55,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
private final SZSendMaterialTask szSendMaterialTask;
|
||||
|
||||
private final FJCallMaterialTask fjCallMaterialTask;
|
||||
|
||||
private final FJSendEmptyTask fjSendEmptyTask;
|
||||
|
||||
/**
|
||||
* task_id:任务标识
|
||||
* task_code:任务编码
|
||||
@@ -237,20 +243,28 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
szSendMaterialTask.createTask(method_param);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("[" + region.label() + "] 不存在送料任务!");
|
||||
throw new BadRequestException("[" + region.label() + "] 不能发起送料任务!");
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
// 叫料
|
||||
switch (region) {
|
||||
case FJ:
|
||||
fjCallMaterialTask.createTask(method_param);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("[" + region.label() + "] 不存在叫料任务!");
|
||||
throw new BadRequestException("[" + region.label() + "] 不能发起叫料任务!");
|
||||
}
|
||||
break;
|
||||
case "3":
|
||||
// 送空
|
||||
switch (region) {
|
||||
case FJ:
|
||||
fjSendEmptyTask.createTask(method_param);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("[" + region.label() + "] 不能发起送空任务!");
|
||||
}
|
||||
break;
|
||||
case "4":
|
||||
// 叫空
|
||||
@@ -264,7 +278,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
case GTK:
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("[" + region.label() + "] 不存在叫空任务!");
|
||||
throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -326,16 +340,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
TaskUtils.isLocked(point);
|
||||
|
||||
JSONObject work_order = TaskUtils.hasWorkOrder(point);
|
||||
|
||||
String vehicle_type = null;
|
||||
if (work_order.getString("device_code").startsWith("FJ")) {
|
||||
vehicle_type = work_order.getString("vehicle_type");
|
||||
} else if (work_order.getString("device_code").startsWith("YZ")) {
|
||||
vehicle_type = VehicleType.STEEL_TRAY.value();
|
||||
} else if (work_order.getString("device_code").startsWith("HL")) {
|
||||
vehicle_type = VehicleType.CUP.value();
|
||||
}
|
||||
|
||||
String device_code = work_order.getString("device_code");
|
||||
String vehicle_type = work_order.getString("vehicle_type");
|
||||
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
JSONObject vd_update = new JSONObject();
|
||||
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
|
||||
@@ -343,7 +349,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
JSONObject vd = new JSONObject();
|
||||
vd.put("vd_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
vd.put("vehicle_type", VehicleType.STEEL_TRAY.value());
|
||||
vd.put("vehicle_type", vehicle_type);
|
||||
vd.put("vehicle_code", vehicle_code);
|
||||
vd.put("material_id", work_order.getString("material_id"));
|
||||
vd.put("qty", qty);
|
||||
@@ -404,7 +410,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
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")) {
|
||||
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")) {
|
||||
vd.put("is_in_kiln", TrueOrFalse.FALSE.value());
|
||||
}
|
||||
|
||||
vd_table.insert(vd);
|
||||
|
||||
JSONObject vehicle_update = new JSONObject();
|
||||
@@ -659,21 +672,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
private JSONObject getProduceInfoByCode(String code) { // 查找工单
|
||||
//根据 设备点位去找生产任务信息
|
||||
//1 根据点位去找设备,去找对应的设备信息
|
||||
JSONObject pointObj = WQLObject.getWQLObject("sch_base_point").query("point_code ='" + code + "'").uniqueResult(0);
|
||||
String device_code = pointObj.getString("device_code");
|
||||
//2 根据设备去找对应的生产任务 1-未生产、2-已下发、3-生产中、4-暂停、5-完成
|
||||
JSONObject productTaskObj = WQLObject.getWQLObject("PDM_BD_WorkOrder")
|
||||
.query("device_code ='" + device_code + "' and order_status in ('3','2','4')", "workorder_procedure")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(productTaskObj)) {
|
||||
throw new BadRequestException("未找到点位为'" + code + "'的生产任务!");
|
||||
}
|
||||
return productTaskObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedbackVehicleType(JSONObject param) {
|
||||
String point_code = param.getString("device_code");
|
||||
@@ -704,9 +702,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
throw new BadRequestException("点位不能为空!");
|
||||
}
|
||||
String vehicle_code = whereJson.getString("vehicle_code");
|
||||
if (StrUtil.isBlank(vehicle_code) || "0".equals(vehicle_code)) {
|
||||
throw new BadRequestException("载具编码不能为空!");
|
||||
}
|
||||
vehicle_code = TaskUtils.formatVehicleCode(vehicle_code);
|
||||
JSONObject point = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("is_used = '1' AND point_code = '" + point_code + "'")
|
||||
@@ -734,7 +730,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(vehicle_type)) {
|
||||
throw new BadRequestException("未知载具类型! b ");
|
||||
throw new BadRequestException("未知载具类型!");
|
||||
}
|
||||
|
||||
JSONObject data = null;
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.pda.util.PdaUtils;
|
||||
import org.nl.wms.pda.anno.PdaAnnotation;
|
||||
import org.nl.wms.pda.service.PdaService;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -31,41 +32,98 @@ public class PdaController {
|
||||
|
||||
private final PdaService pdaService;
|
||||
|
||||
@PostMapping("/queryRegion")
|
||||
@PostMapping("/region")
|
||||
@Log("查询区域")
|
||||
@ApiOperation("查询区域")
|
||||
@PdaAnnotation
|
||||
public JSONObject queryRegion() {
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.queryRegion());
|
||||
public JSONObject region(@RequestBody JSONObject param) {
|
||||
String func = param.getString("func");
|
||||
if (StrUtil.isBlank(func)) {
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.region(func));
|
||||
}
|
||||
|
||||
@PostMapping("/queryPoint")
|
||||
@Log("查询对接位")
|
||||
@ApiOperation("查询对接位")
|
||||
@PostMapping("/point")
|
||||
@Log("查询点位")
|
||||
@ApiOperation("查询点位")
|
||||
@PdaAnnotation
|
||||
public JSONObject queryPoint(@RequestBody JSONObject request_body) {
|
||||
String type = request_body.getString("type");
|
||||
if (StrUtil.isBlank(type)) {
|
||||
throw new BadRequestException("未知界面!");
|
||||
public JSONObject point(@RequestBody JSONObject param) {
|
||||
String func = param.getString("func");
|
||||
if (StrUtil.isBlank(func)) {
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.queryPoint(type));
|
||||
String region_code = param.getString("region_code");
|
||||
if (StrUtil.isBlank(region_code)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.point(func, region_code));
|
||||
}
|
||||
|
||||
@PostMapping("/createTask")
|
||||
@Log("创建任务")
|
||||
@ApiOperation("创建任务")
|
||||
@PostMapping("/device")
|
||||
@Log("查询设备")
|
||||
@ApiOperation("查询设备")
|
||||
@PdaAnnotation
|
||||
public JSONObject createTask(@RequestBody JSONObject request_body) {
|
||||
String type = request_body.getString("type");
|
||||
if (StrUtil.isBlank(type)) {
|
||||
throw new BadRequestException("未知任务类型!");
|
||||
public JSONObject device(@RequestBody JSONObject param) {
|
||||
String func = param.getString("func");
|
||||
if (StrUtil.isBlank(func)) {
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
String point_code = request_body.getString("point_code");
|
||||
|
||||
return PdaUtils.buildSuccessResultJSON(pdaService.device(func));
|
||||
}
|
||||
|
||||
@PostMapping("/report")
|
||||
@Log("查询设备")
|
||||
@ApiOperation("查询设备")
|
||||
@PdaAnnotation
|
||||
public JSONObject report(@RequestBody JSONObject param) {
|
||||
String func = param.getString("func");
|
||||
if (StrUtil.isBlank(func)) {
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
String device_code = param.getString("device_code");
|
||||
if (StrUtil.isBlank(device_code)) {
|
||||
throw new BadRequestException("区域不能为空!");
|
||||
}
|
||||
String unqualified_qty = param.getString("unqualified_qty");
|
||||
if (StrUtil.isBlank(unqualified_qty)) {
|
||||
throw new BadRequestException("不合格数量不能为空!");
|
||||
}
|
||||
|
||||
pdaService.report(device_code, unqualified_qty);
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
|
||||
@PostMapping("/sendMaterial")
|
||||
@Log("送料")
|
||||
@ApiOperation("送料")
|
||||
@PdaAnnotation
|
||||
public JSONObject sendMaterial(@RequestBody JSONObject param) {
|
||||
String point_code = param.getString("point_code");
|
||||
if (StrUtil.isBlank(point_code)) {
|
||||
throw new BadRequestException("点位不能为空!");
|
||||
throw new BadRequestException("点位编码不能为空!");
|
||||
}
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
vehicle_code = TaskUtils.formatVehicleCode(vehicle_code);
|
||||
if ("0000".equals(vehicle_code)) {
|
||||
throw new BadRequestException("载具编码不能为空!");
|
||||
}
|
||||
String qty = param.getString("qty");
|
||||
if (StrUtil.isBlank(qty)) {
|
||||
throw new BadRequestException("数量不能为空!");
|
||||
}
|
||||
String weight = param.getString("weight");
|
||||
if (StrUtil.isBlank(weight)) {
|
||||
throw new BadRequestException("重量不能为空!");
|
||||
}
|
||||
String is_full = param.getString("is_full");
|
||||
if (StrUtil.isBlank(is_full)) {
|
||||
throw new BadRequestException("是否满拖不能为空!");
|
||||
}
|
||||
|
||||
pdaService.createTask(request_body);
|
||||
pdaService.sendMaterial(point_code, vehicle_code, qty, weight, is_full, param.toJSONString());
|
||||
return PdaUtils.buildSuccessResultJSON(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.nl.wms.pda.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 辽宁晟华手持服务层接口
|
||||
@@ -11,10 +11,42 @@ import com.alibaba.fastjson.JSONObject;
|
||||
*/
|
||||
public interface PdaService {
|
||||
|
||||
/**
|
||||
* 查询区域
|
||||
* @param func 手持功能
|
||||
* @return 区域编码 区域名称
|
||||
*/
|
||||
JSONArray region(String func);
|
||||
|
||||
JSONArray queryRegion();
|
||||
/**
|
||||
* 查询点位
|
||||
* @param func 手持功能
|
||||
* @param region_code 区域编码
|
||||
* @return 点位编码 点位名称
|
||||
*/
|
||||
JSONArray point(String func, String region_code);
|
||||
|
||||
JSONArray queryPoint(String type);
|
||||
/**
|
||||
* 查询设备
|
||||
* @param func 手持功能
|
||||
* @return 设备编码 设备名称
|
||||
*/
|
||||
JSONArray device(String func);
|
||||
|
||||
void createTask(JSONObject request_param);
|
||||
/**
|
||||
* 不合格品上报
|
||||
* @param device_code 设备编码
|
||||
* @param unqualified_qty 不合格数量
|
||||
*/
|
||||
void report(String device_code, String unqualified_qty);
|
||||
|
||||
/**
|
||||
* 送料
|
||||
* @param point_code 点位编码
|
||||
* @param vehicle_code 载具编码
|
||||
* @param qty 数量
|
||||
* @param weight 重量
|
||||
* @param is_full 是否满拖
|
||||
*/
|
||||
void sendMaterial(String point_code, String vehicle_code, String qty, String weight, String is_full, String request_param);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package org.nl.wms.pda.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -9,11 +12,16 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
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.pda.service.PdaService;
|
||||
import org.nl.wms.sch.manage.ACSSystem;
|
||||
import org.nl.wms.sch.manage.CreateMode;
|
||||
import org.nl.wms.sch.manage.Region;
|
||||
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.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author 张江玮
|
||||
@@ -26,63 +34,185 @@ public class PdaServiceImpl implements PdaService {
|
||||
|
||||
private final HLSendMaterialTask hlSendMaterialTask;
|
||||
|
||||
/**
|
||||
* 查询所有区域
|
||||
*
|
||||
* @return 所有区域信息
|
||||
*/
|
||||
private final YZSendMaterialTask yzSendMaterialTask;
|
||||
|
||||
@Override
|
||||
public JSONArray queryRegion() {
|
||||
return WQLObject
|
||||
.getWQLObject("sch_base_region")
|
||||
.query()
|
||||
.getResultJSONArray(0);
|
||||
public JSONArray region(String func) {
|
||||
switch (func) {
|
||||
case "send_material":
|
||||
// 送料
|
||||
case "call_material":
|
||||
// 送料
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "1")
|
||||
.addParam("where", "('HL', 'YZ', 'FJ')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
default:
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对接位
|
||||
*
|
||||
* @param type 手持界面 HLSL-混料送料
|
||||
* @return 对接位信息
|
||||
*/
|
||||
@Override
|
||||
public JSONArray queryPoint(String type) {
|
||||
public JSONArray point(String func, String region_code) {
|
||||
Region region = Region.get(region_code);
|
||||
if (ObjectUtil.isEmpty(region)) {
|
||||
throw new BadRequestException("未知区域!");
|
||||
}
|
||||
|
||||
switch (func) {
|
||||
case "send_material":
|
||||
// 送料
|
||||
switch (region) {
|
||||
case HL:
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", region_code)
|
||||
.addParam("point_type", "('1', '2')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
case YZ:
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", region_code)
|
||||
.addParam("point_type", "('1')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
case FJ:
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", region_code)
|
||||
.addParam("point_type", "('2')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
default:
|
||||
throw new BadRequestException(region.label() + "没有送料点位!");
|
||||
}
|
||||
case "call_material":
|
||||
// 叫料
|
||||
switch (region) {
|
||||
case YZ:
|
||||
JSONArray result = WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", region_code)
|
||||
.addParam("point_type", "('2')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
result.addAll(WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", Region.KLHJ.value())
|
||||
.addParam("point_type", "('2')")
|
||||
.process()
|
||||
.getResultJSONArray(0));
|
||||
return result;
|
||||
case FJ:
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "2")
|
||||
.addParam("region_code", region_code)
|
||||
.addParam("point_type", "('1')")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
default:
|
||||
throw new BadRequestException(region.label() + "没有叫料点位!");
|
||||
}
|
||||
default:
|
||||
throw new BadRequestException("未知功能!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray device(String func) {
|
||||
return WQL
|
||||
.getWO("PDA")
|
||||
.addParam("flag", "1")
|
||||
.addParam("type", type)
|
||||
.addParam("flag", "3")
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建任务
|
||||
*
|
||||
* @param request_param 请求带的参数
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void createTask(JSONObject request_param) {
|
||||
String type = request_param.getString("type");
|
||||
public void report(String device_code, String unqualified_qty) {
|
||||
WQLObject workorder_table = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||
JSONObject work_order = workorder_table
|
||||
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(work_order)) {
|
||||
throw new BadRequestException("设备 [" + device_code + "] 未开始生产!");
|
||||
}
|
||||
|
||||
int current_qty = work_order.getIntValue("unqualified_qty");
|
||||
work_order.put("unqualified_qty", current_qty + Integer.parseInt(unqualified_qty));
|
||||
workorder_table.update(work_order);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void sendMaterial(String point_code, String vehicle_code, String qty, String weight, String is_full, String request_param) {
|
||||
JSONObject point = WQLObject
|
||||
.getWQLObject("sch_base_point")
|
||||
.query("is_delete = '0' AND is_used = '1' AND point_code = '" + request_param.getString("point_code") + "'")
|
||||
.query("is_used = '1' AND point_code = '" + point_code + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位已删除或未启用!");
|
||||
throw new BadRequestException("[" + point_code + "] 已删除或未启用!");
|
||||
}
|
||||
TaskUtils.isLocked(point);
|
||||
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
||||
String vehicle_type = workorder.getString("vehicle_type");
|
||||
String device_code = workorder.getString("device_code");
|
||||
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||
JSONObject vd_update = new JSONObject();
|
||||
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
|
||||
vd_table.update(vd_update, "vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'");
|
||||
|
||||
// 组盘
|
||||
JSONObject vd = new JSONObject();
|
||||
vd.put("vd_id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||
vd.put("vehicle_type", vehicle_type);
|
||||
vd.put("vehicle_code", vehicle_code);
|
||||
vd.put("material_id", workorder.getString("material_id"));
|
||||
vd.put("qty", qty);
|
||||
vd.put("weight", weight);
|
||||
vd.put("is_full", is_full);
|
||||
vd.put("workorder_id", workorder.getString("workorder_id"));
|
||||
vd.put("point_code", point_code);
|
||||
vd.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
vd.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
vd.put("create_time", DateUtil.now());
|
||||
vd.put("is_delete", "0");
|
||||
if (device_code.startsWith("FJ")) {
|
||||
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")) {
|
||||
vd.put("is_in_kiln", TrueOrFalse.FALSE.value());
|
||||
}
|
||||
vd_table.insert(vd);
|
||||
|
||||
Region region = Region.get(point.getString("region_code"));
|
||||
JSONObject method_param = new JSONObject();
|
||||
method_param.put("point", point);
|
||||
method_param.put("workorder", workorder);
|
||||
method_param.put("vd", vd);
|
||||
method_param.put("create_mode", CreateMode.SCCJ.value());
|
||||
method_param.put("request_param", request_param);
|
||||
method_param.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
method_param.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
switch (type) {
|
||||
case "1":
|
||||
// 混料机送料
|
||||
method_param.put("point", point);
|
||||
method_param.put("vehicle_code", TaskUtils.formatVehicleCode(request_param.getString("vehicle_code")));
|
||||
switch (region) {
|
||||
case HL:
|
||||
hlSendMaterialTask.createTask(method_param);
|
||||
break;
|
||||
case "2":
|
||||
case YZ:
|
||||
yzSendMaterialTask.createTask(method_param);
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("[" + region.label() + "] 不能发起送料任务!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ public final class PdaUtils {
|
||||
* 服务层调用方法
|
||||
* 创建操作成功的 JSONObject 并携带需要返回的数据
|
||||
*
|
||||
* @param result 返回数据, 可为 NULL
|
||||
* @param result 返回数据,可为 NULL
|
||||
* @return 携带了返回数据的 JSONObject
|
||||
*/
|
||||
public static JSONObject buildSuccessResultJSON(JSON result) {
|
||||
JSONObject resultJSON = new JSONObject();
|
||||
resultJSON.put("code", "1");
|
||||
resultJSON.put("desc", "操作成功");
|
||||
resultJSON.put("desc", "操作成功!");
|
||||
resultJSON.put("result", result);
|
||||
return resultJSON;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public final class PdaUtils {
|
||||
* 服务层调用方法
|
||||
* 创建操作失败的 JSONObject
|
||||
*
|
||||
* @param desc 错误提示, 可为 NULL
|
||||
* @param desc 错误提示,可为 NULL
|
||||
* @return 自定义错误提示的 JSONObject
|
||||
*/
|
||||
public static JSONObject buildFailResultJSON(String desc) {
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.type TYPEAS s_string
|
||||
输入.where TYPEAS f_string
|
||||
输入.region_code TYPEAS s_string
|
||||
输入.point_type TYPEAS f_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -41,19 +43,44 @@
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
point_id,
|
||||
region_code,
|
||||
region_name
|
||||
FROM
|
||||
sch_base_region
|
||||
WHERE
|
||||
region_code IN 输入.where
|
||||
ORDER BY
|
||||
create_time ASC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
point_code,
|
||||
point_name
|
||||
FROM
|
||||
sch_base_point
|
||||
WHERE
|
||||
is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND lock_type = '1'
|
||||
OPTION 输入.type = "HL"
|
||||
region_code = 'HL'
|
||||
AND point_type IN ('1', '2')
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
is_used = '1'
|
||||
AND region_code = 输入.region_code
|
||||
AND point_type IN 输入.point_type
|
||||
ORDER BY
|
||||
point_code ASC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
device_code,
|
||||
device_name
|
||||
FROM
|
||||
pdm_bi_device
|
||||
ORDER BY
|
||||
device_code ASC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
if (!StrUtil.isEmpty(search)) {
|
||||
map.put("search", "%" + search + "%");
|
||||
}
|
||||
JSONObject json = WQL.getWO("PDM_BI_DEVICE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "device.device_model, device.device_code");
|
||||
JSONObject json = WQL.getWO("PDM_BI_DEVICE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "device.device_code");
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,14 +114,15 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
String device_code = dto.getDevice_code();
|
||||
String vehicle_type = dto.getVehicle_type();
|
||||
if (!device_code.startsWith("FJ")) {
|
||||
if (device_code.startsWith("YZJ")) {
|
||||
if (device_code.startsWith("YZ")) {
|
||||
vehicle_type = VehicleType.STEEL_TRAY.value();
|
||||
} else if (device_code.startsWith("HLJ")) {
|
||||
} else if (device_code.startsWith("HL")) {
|
||||
vehicle_type = VehicleType.CUP.value();
|
||||
}
|
||||
}
|
||||
work_order.put("vehicle_type", vehicle_type);
|
||||
work_order.put("device_id", dto.getDevice_id());
|
||||
work_order.put("device_code", dto.getDevice_code());
|
||||
work_order.put("order_status", WorkOrderEnum.ORDER_STATUS_UNPRODUCED.value());
|
||||
work_order.put("is_urgent", dto.getIs_urgent());
|
||||
work_order.put("is_pri", dto.getIs_pri());
|
||||
@@ -183,7 +184,7 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
String workorder_id = param.getString("workorder_id");
|
||||
JSONObject submit_obj = WQL
|
||||
.getWO("MPS_PRODUCEDURE001")
|
||||
.addParam("flag", "5")
|
||||
.addParam("flag", "6")
|
||||
.addParam("workorder_id", workorder_id)
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
@@ -193,7 +194,7 @@ public class WorkorderServiceImpl implements WorkordeService {
|
||||
|
||||
JSONObject workorder = WQLObject
|
||||
.getWQLObject("pdm_bd_workorder")
|
||||
.query("is_delete = '0' AND device_code = '" + submit_obj.getString("workorder_code") + "' AND order_status IN ('2', '3')")
|
||||
.query("is_delete = '0' AND device_id = '" + submit_obj.getString("device_id") + "' AND order_status IN ('2', '3')")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(workorder)) {
|
||||
throw new BadRequestException("该设备正在执行其它工单!");
|
||||
|
||||
@@ -161,8 +161,9 @@
|
||||
SELECT
|
||||
workorder.workorder_code,
|
||||
workorder.plan_qty,
|
||||
workorder.device_code,
|
||||
workorder.order_status,
|
||||
workorder.device_id,
|
||||
device.device_code,
|
||||
material.material_code,
|
||||
material.product_code,
|
||||
material.a,
|
||||
@@ -172,6 +173,7 @@
|
||||
FROM
|
||||
pdm_bd_workorder workorder
|
||||
LEFT JOIN md_me_materialbase material ON workorder.material_id = material.material_id
|
||||
LEFT JOIN pdm_bi_device device ON workorder.device_id = device.device_id
|
||||
WHERE
|
||||
workorder.is_delete = '0'
|
||||
AND workorder.workorder_id = 输入.workorder_id
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.nl.wms.sch.rest;
|
||||
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TaskServiceImpl implements TaskService {
|
||||
public void operation(Map<String, Object> map) {
|
||||
String task_id = MapUtil.getStr(map, "task_id");
|
||||
String method_name = MapUtil.getStr(map, "method_name");
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
JSONObject taskObj = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
if (taskObj.getString("task_status").equals(TaskStatus.FINISHED.value())) throw new BadRequestException("任务已完成!");
|
||||
// 任务处理类
|
||||
String processing_class = taskObj.getString("handle_class");
|
||||
|
||||
@@ -4,14 +4,12 @@ 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.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.LockType;
|
||||
import org.nl.wms.sch.manage.TaskStatus;
|
||||
import org.nl.wms.sch.manage.TaskType;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -27,8 +25,16 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
public class HLCallEmptyTask extends AbstractAcsTask {
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||
task.put("task_status", TaskStatus.EXECUTING.value());
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
} else if (TaskStatus.FINISHED.value().equals(status)) {
|
||||
this.finishTask(task, OperationType.AUTO);
|
||||
} else if (TaskStatus.CANCELLED.value().equals(status)) {
|
||||
this.cancelTask(task, OperationType.AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -96,13 +102,100 @@ public class HLCallEmptyTask extends AbstractAcsTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.finishTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.cancelTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.CANCELLED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(point1)
|
||||
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point1);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
}
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
JSONObject point2 = new JSONObject();
|
||||
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||
point2.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point2);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.FINISHED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
point1.put("vehicle_type", "");
|
||||
point1.put("vehicle_code", "");
|
||||
point1.put("point_status", PointStatus.EMPTY.value());
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
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);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
package org.nl.wms.sch.task.call.material;
|
||||
|
||||
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.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author zhangjiangwei
|
||||
* @date 2023/04/14 21:28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
public class FJCallMaterialTask extends AbstractAcsTask {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||
task.put("task_status", TaskStatus.EXECUTING.value());
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
} else if (TaskStatus.FINISHED.value().equals(status)) {
|
||||
this.finishTask(task, OperationType.AUTO);
|
||||
} else if (TaskStatus.CANCELLED.value().equals(status)) {
|
||||
this.cancelTask(task, OperationType.AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
JSONObject point = form.getJSONObject("point");
|
||||
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
||||
|
||||
JSONObject task = TaskUtils.buildTask(
|
||||
"分拣区叫料",
|
||||
TaskType.CALL_MATERIAL.value(),
|
||||
TaskStatus.SURE_END.value(),
|
||||
null,
|
||||
point.getString("point_code"),
|
||||
workorder.getString("material_id"),
|
||||
VehicleType.STEEL_TRAY.value(),
|
||||
null,
|
||||
TrueOrFalse.trueOrFalse(workorder.getString("is_urgent")) ? "99" : "1",
|
||||
FJCallMaterialTask.class.getName(),
|
||||
form.getString("create_mode"),
|
||||
form.getString("request_param"),
|
||||
form.getString("create_id"),
|
||||
form.getString("create_name")
|
||||
);
|
||||
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");
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray tasks = task_table
|
||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + FJCallMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||
.getResultJSONArray(0);
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
JSONObject task = tasks.getJSONObject(i);
|
||||
|
||||
JSONObject point = WQL
|
||||
.getWO("CALL_MATERIAL_TASK")
|
||||
.addParam("flag", "3")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(point)) {
|
||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||
task.put("point_code1", point.getString("point_code"));
|
||||
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
||||
task.put("remark", "");
|
||||
task_table.update(task);
|
||||
|
||||
JSONObject point_update = new JSONObject();
|
||||
point_update.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point_update.put("task_code", task.getString("task_code"));
|
||||
point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.finishTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.cancelTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.CANCELLED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(point1)
|
||||
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point1);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
}
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
JSONObject point2 = new JSONObject();
|
||||
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||
point2.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point2);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.FINISHED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
point1.put("vehicle_type", "");
|
||||
point1.put("vehicle_code", "");
|
||||
point1.put("point_status", PointStatus.EMPTY.value());
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
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);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void autoCreate() {
|
||||
JSONArray points = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "1").process().getResultJSONArray(0);
|
||||
JSONArray points = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "2").process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(points) && !points.isEmpty()) {
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("create_mode", CreateMode.ZDSC.value());
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
AND point.point_status = '1'
|
||||
AND point.vehicle_type = '2'
|
||||
AND vd.is_fire = '0'
|
||||
AND vd.if_in_kiln = '1'
|
||||
AND vd.is_in_kiln = '1'
|
||||
ORDER BY
|
||||
workorder.is_urgent DESC, vd.create_time ASC
|
||||
ENDSELECT
|
||||
@@ -77,3 +77,26 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
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 = '1'
|
||||
ORDER BY
|
||||
workorder.is_urgent DESC, vd.create_time ASC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
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 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.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author zhangjiangwei
|
||||
* @date 2023/04/14 21:29
|
||||
*/
|
||||
public class FJSendEmptyTask extends AbstractAcsTask {
|
||||
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||
task.put("task_status", TaskStatus.EXECUTING.value());
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
} else if (TaskStatus.FINISHED.value().equals(status)) {
|
||||
this.finishTask(task, OperationType.AUTO);
|
||||
} else if (TaskStatus.CANCELLED.value().equals(status)) {
|
||||
this.cancelTask(task, OperationType.AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
@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(),
|
||||
TaskStatus.SURE_START.value(),
|
||||
point.getString("point_code"),
|
||||
null,
|
||||
work_order.getString("material_id"),
|
||||
VehicleType.CUP.value(),
|
||||
vehicle_code,
|
||||
TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? "99" : "1",
|
||||
HLSendMaterialTask.class.getName(),
|
||||
form.getString("create_mode"),
|
||||
form.getString("request_param"),
|
||||
form.getString("create_id"),
|
||||
form.getString("create_name")
|
||||
);
|
||||
WQLObject.getWQLObject("sch_base_task").insert(task);
|
||||
|
||||
return task.getString("task_id");
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
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")
|
||||
.getResultJSONArray(0);
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
JSONObject task = tasks.getJSONObject(i);
|
||||
|
||||
JSONObject point = WQL
|
||||
.getWO("SEND_MATERIAL_TASK")
|
||||
.addParam("flag", "1")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(point)) {
|
||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||
task.put("point_code2", point.getString("point_code"));
|
||||
task.put("remark", "");
|
||||
task_table.update(task);
|
||||
|
||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point.put("task_code", task.getString("task_code"));
|
||||
point_table.update(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.finishTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.cancelTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.CANCELLED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point1);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
}
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
JSONObject point2 = new JSONObject();
|
||||
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||
point2.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point2);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.FINISHED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(point1)
|
||||
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
point1.put("vehicle_type", "");
|
||||
point1.put("vehicle_code", "");
|
||||
point1.put("point_status", PointStatus.EMPTY.value());
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
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);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
[交易说明]
|
||||
交易名: 叫空托盘
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 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"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_point
|
||||
WHERE
|
||||
is_used = '1'
|
||||
AND lock_type = '1'
|
||||
AND region_code = 'SZ'
|
||||
AND point_type = '1'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -1,14 +1,15 @@
|
||||
package org.nl.wms.sch.task.send.material;
|
||||
|
||||
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.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatus;
|
||||
import org.nl.wms.sch.manage.TaskType;
|
||||
import org.nl.wms.sch.manage.*;
|
||||
import org.nl.wms.sch.task.util.TaskUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -25,8 +26,16 @@ public class HLSendMaterialTask extends AbstractAcsTask {
|
||||
|
||||
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
|
||||
public void updateTaskStatus(JSONObject task, String status) {
|
||||
if (TaskStatus.EXECUTING.value().equals(status)) {
|
||||
task.put("task_status", TaskStatus.EXECUTING.value());
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
} else if (TaskStatus.FINISHED.value().equals(status)) {
|
||||
this.finishTask(task, OperationType.AUTO);
|
||||
} else if (TaskStatus.CANCELLED.value().equals(status)) {
|
||||
this.cancelTask(task, OperationType.AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,19 +74,131 @@ public class HLSendMaterialTask extends AbstractAcsTask {
|
||||
return task.getString("task_id");
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
@Transactional
|
||||
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")
|
||||
.getResultJSONArray(0);
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
for (int i = 0; i < tasks.size(); i++) {
|
||||
JSONObject task = tasks.getJSONObject(i);
|
||||
|
||||
JSONObject point = WQL
|
||||
.getWO("SEND_MATERIAL_TASK")
|
||||
.addParam("flag", "1")
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(point)) {
|
||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||
task.put("point_code2", point.getString("point_code"));
|
||||
task.put("remark", "");
|
||||
task_table.update(task);
|
||||
|
||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||
point.put("task_code", task.getString("task_code"));
|
||||
point_table.update(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.finishTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("未找到任务!");
|
||||
}
|
||||
this.cancelTask(task, OperationType.MANUAL);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.CANCELLED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point1);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
}
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
JSONObject point2 = new JSONObject();
|
||||
point2.put("lock_type", LockType.UNLOCKED.value());
|
||||
point2.put("task_code", "");
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(point2);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||
task.put("task_status", TaskStatus.FINISHED.value());
|
||||
if (operation_type == OperationType.AUTO) {
|
||||
TaskUtils.addACSUpdateColum(task);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(task);
|
||||
}
|
||||
WQLObject.getWQLObject("sch_base_task").update(task);
|
||||
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(point1)
|
||||
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
|
||||
&& task.getString("task_code").equals(point1.getString("task_code"))) {
|
||||
point1.put("lock_type", LockType.UNLOCKED.value());
|
||||
point1.put("task_code", "");
|
||||
point1.put("vehicle_type", "");
|
||||
point1.put("vehicle_code", "");
|
||||
point1.put("point_status", PointStatus.EMPTY.value());
|
||||
TaskUtils.addCurrentUpdateColum(point1);
|
||||
point_table.update(point1);
|
||||
}
|
||||
|
||||
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);
|
||||
} else if (operation_type == OperationType.MANUAL) {
|
||||
TaskUtils.addCurrentUpdateColum(point2);
|
||||
}
|
||||
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,11 @@ public class TaskUtils {
|
||||
|
||||
public static String formatVehicleCode(String vehicle_code) {
|
||||
if (StrUtil.isBlank(vehicle_code)) {
|
||||
return "0000";
|
||||
vehicle_code = "0000";
|
||||
} else {
|
||||
if (vehicle_code.length() > 4 || vehicle_code.matches("^\\d+$")) {
|
||||
throw new BadRequestException("载具编码错误!");
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder vehicle_code_builder = new StringBuilder(vehicle_code);
|
||||
|
||||
Binary file not shown.
@@ -2,9 +2,11 @@ package org.nl.test;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -19,23 +21,9 @@ public class PointTest {
|
||||
|
||||
@Test
|
||||
public void test01() {
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
JSONObject point = new JSONObject();
|
||||
String now = DateUtil.now();
|
||||
for (int i = 0; i < 52; i++) {
|
||||
point.put("point_id", IdUtil.getSnowflake().nextId());
|
||||
point.put("point_code", "CPHW" + String.format("%02d", i + 1));
|
||||
point.put("point_name", "成品货位" + (i + 1));
|
||||
point.put("region_id", 1643438902574452736L);
|
||||
point.put("region_code", "CPHJ");
|
||||
point.put("region_name", "成品货架");
|
||||
point.put("point_type", "1");
|
||||
point.put("device_code", null);
|
||||
point.put("create_id", 1L);
|
||||
point.put("create_name", "管理员");
|
||||
point.put("create_time", now);
|
||||
point_table.insert(point);
|
||||
}
|
||||
String pattern = "^\\d+$";
|
||||
System.out.println("ddd".matches(pattern));
|
||||
System.out.println("0010".matches(pattern));
|
||||
System.out.println("1232d".matches(pattern));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user