Browse Source

更新

master
张江玮 2 years ago
parent
commit
3b54f3f201
  1. 2
      lms/nladmin-system/src/main/java/org/nl/modules/security/rest/MobileAuthorizationController.java
  2. 62
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  3. 100
      lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java
  4. 40
      lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java
  5. 196
      lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java
  6. 6
      lms/nladmin-system/src/main/java/org/nl/wms/pda/util/PdaUtils.java
  7. 45
      lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql
  8. 5
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java
  9. 18
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/FJCallMaterialTask.java
  10. 23
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/wql/CALL_MATERIAL_TASK.wql
  11. 6
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java
  12. 24
      lms/nladmin-system/src/test/java/org/nl/test/PointTest.java

2
lms/nladmin-system/src/main/java/org/nl/modules/security/rest/MobileAuthorizationController.java

@ -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);
}};

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

@ -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;

100
lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java

@ -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("/point")
@Log("查询点位")
@ApiOperation("查询点位")
@PdaAnnotation
public JSONObject point(@RequestBody JSONObject param) {
String func = param.getString("func");
if (StrUtil.isBlank(func)) {
throw new BadRequestException("未知功能!");
}
String region_code = param.getString("region_code");
if (StrUtil.isBlank(region_code)) {
throw new BadRequestException("区域不能为空!");
}
@PostMapping("/queryPoint")
@Log("查询对接位")
@ApiOperation("查询对接位")
return PdaUtils.buildSuccessResultJSON(pdaService.point(func, region_code));
}
@PostMapping("/device")
@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 device(@RequestBody JSONObject param) {
String func = param.getString("func");
if (StrUtil.isBlank(func)) {
throw new BadRequestException("未知功能!");
}
return PdaUtils.buildSuccessResultJSON(pdaService.queryPoint(type));
return PdaUtils.buildSuccessResultJSON(pdaService.device(func));
}
@PostMapping("/createTask")
@Log("创建任务")
@ApiOperation("创建任务")
@PostMapping("/report")
@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 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("不合格数量不能为空!");
}
String point_code = request_body.getString("point_code");
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);
}
}

40
lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java

@ -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);
/**
* 查询点位
* @param func 手持功能
* @param region_code 区域编码
* @return 点位编码 点位名称
*/
JSONArray point(String func, String region_code);
JSONArray queryRegion();
/**
* 查询设备
* @param func 手持功能
* @return 设备编码 设备名称
*/
JSONArray device(String func);
JSONArray queryPoint(String type);
/**
* 不合格品上报
* @param device_code 设备编码
* @param unqualified_qty 不合格数量
*/
void report(String device_code, String unqualified_qty);
void createTask(JSONObject request_param);
/**
* 送料
* @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);
}

196
lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java

@ -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()
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", "1")
.addParam("type", type)
.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("未知功能!");
}
}
/**
* 创建任务
*
* @param request_param 请求带的参数
*/
@Override
public void createTask(JSONObject request_param) {
String type = request_param.getString("type");
public JSONArray device(String func) {
return WQL
.getWO("PDA")
.addParam("flag", "3")
.process()
.getResultJSONArray(0);
}
@Transactional(rollbackFor = Exception.class)
@Override
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() + "] 不能发起送料任务!");
}
}
}

6
lms/nladmin-system/src/main/java/org/nl/wms/pda/util/PdaUtils.java

@ -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) {

45
lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql

@ -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
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

5
lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java

@ -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());

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

@ -7,6 +7,7 @@ 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;
@ -39,18 +40,19 @@ public class FJCallMaterialTask extends AbstractAcsTask {
@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"),
null,
workorder.getString("material_id"),
VehicleType.STEEL_TRAY.value(),
null,
"1",
SZCallMaterialTask.class.getName(),
TrueOrFalse.trueOrFalse(workorder.getString("is_urgent")) ? "99" : "1",
FJCallMaterialTask.class.getName(),
form.getString("create_mode"),
form.getString("request_param"),
form.getString("create_id"),
@ -70,7 +72,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
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 = '" + SZCallMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
.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");
@ -79,14 +81,13 @@ public class FJCallMaterialTask extends AbstractAcsTask {
JSONObject point = WQL
.getWO("CALL_MATERIAL_TASK")
.addParam("flag", "1")
.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("material_id", point.getString("material_id"));
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
task.put("remark", "");
task_table.update(task);
@ -184,6 +185,9 @@ public class FJCallMaterialTask extends AbstractAcsTask {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
point2.put("vehicle_type", task.getString("vehicle_type"));
point2.put("vehicle_code", task.getString("vehicle_code"));
point2.put("point_status", PointStatus.NOT_EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {

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

@ -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

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

@ -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);

24
lms/nladmin-system/src/test/java/org/nl/test/PointTest.java

@ -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));
}
}

Loading…
Cancel
Save