feat: 新增需求手持部分v1
This commit is contained in:
@@ -30,9 +30,9 @@ public class SecurityUtils {
|
|||||||
return json.toBean(CurrentUser.class);
|
return json.toBean(CurrentUser.class);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new CurrentUser();
|
return CurrentUser.buildDefaultUser();
|
||||||
}
|
}
|
||||||
return null;
|
return CurrentUser.buildDefaultUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,4 +28,12 @@ public class CurrentUser implements Serializable {
|
|||||||
private UserDto user;
|
private UserDto user;
|
||||||
|
|
||||||
private List<String> permissions = new ArrayList<>();
|
private List<String> permissions = new ArrayList<>();
|
||||||
|
|
||||||
|
public static CurrentUser buildDefaultUser() {
|
||||||
|
CurrentUser currentUser = new CurrentUser();
|
||||||
|
currentUser.setId(99L);
|
||||||
|
currentUser.setUsername("default");
|
||||||
|
currentUser.setNickName("默认用户");
|
||||||
|
return currentUser;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package org.nl.wms.ext.erp.rest;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description: Erp请求Wms
|
||||||
|
* @Date: 2024/5/13
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "erp请求wms")
|
||||||
|
@RequestMapping("/api/erp/task")
|
||||||
|
@Slf4j
|
||||||
|
public class ErpToWmsController {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.nl.wms.ext.erp.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description:
|
||||||
|
* @Date: 2024/5/13
|
||||||
|
*/
|
||||||
|
public interface ErpToWmsService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.nl.wms.ext.erp.service.impl;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.wms.ext.erp.service.ErpToWmsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description:
|
||||||
|
* @Date: 2024/5/13
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ErpToWmsServiceImpl implements ErpToWmsService {
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.wms.pda.rest;
|
package org.nl.wms.pda.rest;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import cn.hutool.core.util.StrUtil;
|
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;
|
||||||
@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Api(tags = "辽宁晟华手持")
|
@Api(tags = "辽宁晟华手持")
|
||||||
@RequestMapping("/api/pda")
|
@RequestMapping("/api/pda")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@SaIgnore
|
||||||
public class PdaController {
|
public class PdaController {
|
||||||
|
|
||||||
private final PdaService pdaService;
|
private final PdaService pdaService;
|
||||||
@@ -267,4 +269,160 @@ public class PdaController {
|
|||||||
pdaService.callDefective(device_code, param.toJSONString());
|
pdaService.callDefective(device_code, param.toJSONString());
|
||||||
return PdaUtils.buildSuccessResultJSON(null);
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual/ExceptionHandlingTask/show")
|
||||||
|
@Log("人工异常处理-任务显示")
|
||||||
|
@ApiOperation("人工异常处理-任务显示")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject manualExceptionHandlingTaskShow() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.manualExceptionHandlingTaskShow());
|
||||||
|
}
|
||||||
|
@PostMapping("/manual/ExceptionHandlingTask/list")
|
||||||
|
@Log("人工异常处理-点位下拉框")
|
||||||
|
@ApiOperation("人工异常处理-点位下拉框")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject manualExceptionHandlingTaskList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.manualExceptionHandlingTaskList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual/ExceptionHandlingTask")
|
||||||
|
@Log("人工异常处理")
|
||||||
|
@ApiOperation("人工异常处理")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject manualExceptionHandlingTask(@RequestBody JSONObject param) {
|
||||||
|
pdaService.manualExceptionHandlingTask(param);
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
@PostMapping("/manual/mixingMoveTask")
|
||||||
|
@Log("人工混碾搬运")
|
||||||
|
@ApiOperation("人工混碾搬运")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject manualMixingMoveTask(@RequestBody JSONObject param) {
|
||||||
|
pdaService.manualMixingMoveTask(param);
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual/getMixingPointList")
|
||||||
|
@Log("获取混碾下拉框")
|
||||||
|
@ApiOperation("获取混碾下拉框")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject getMixingPoint() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.getMixingPointList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual/getMixingTaskList")
|
||||||
|
@Log("获取混碾人工任务")
|
||||||
|
@ApiOperation("获取混碾人工任务")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject getMixingTaskList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.getMixingTaskList());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
@PostMapping("/manual/transfer/positionList")
|
||||||
|
@Log("料盅转移位置列表")
|
||||||
|
@ApiOperation("料盅转移位置列表")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject getPositionList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.getPositionList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual/transfer/createTask")
|
||||||
|
@Log("料盅转移任务")
|
||||||
|
@ApiOperation("料盅转移任务")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject transferCreateTask(@RequestBody JSONObject param) {
|
||||||
|
pdaService.transferCreateTask(param);
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
@PostMapping("/manual/transfer/taskShow")
|
||||||
|
@Log("料盅转移任务显示")
|
||||||
|
@ApiOperation("料盅转移任务显示")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject transferTaskShow() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.transferTaskShow());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
// 终点见 /manual/transfer/positionList
|
||||||
|
@PostMapping("/manual/suppress/startPointList")
|
||||||
|
@Log("压制叫料起点列表")
|
||||||
|
@ApiOperation("压制叫料起点列表")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject suppressStartPointList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.suppressStartPointList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual/suppress/createTask")
|
||||||
|
@Log("压制送料任务")
|
||||||
|
@ApiOperation("压制送料任务")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject suppressCreateTask(@RequestBody JSONObject param) {
|
||||||
|
pdaService.suppressCreateTask(param);
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual/suppress/taskShow")
|
||||||
|
@Log("压制送料任务显示")
|
||||||
|
@ApiOperation("压制送料任务显示")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject suppressTaskShow() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.suppressTaskShow());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
|
||||||
|
@PostMapping("/manual/suppress/down/pointList")
|
||||||
|
@Log("压制送料起点列表")
|
||||||
|
@ApiOperation("压制送料起点列表")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject suppressDownPointList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.suppressDownPointList());
|
||||||
|
}
|
||||||
|
@PostMapping("/manual/suppress/down/createTask")
|
||||||
|
@Log("压制送料任务")
|
||||||
|
@ApiOperation("压制送料任务")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject suppressDownCreateTask(@RequestBody JSONObject param) {
|
||||||
|
pdaService.suppressDownCreateTask(param);
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
@PostMapping("/manual/suppress/down/show")
|
||||||
|
@Log("压制送料任务显示")
|
||||||
|
@ApiOperation("压制送料任务显示")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject suppressDownShow() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.suppressDownShow());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
@PostMapping("/manual/kiln/out/createTask")
|
||||||
|
@Log("出窑任务请求")
|
||||||
|
@ApiOperation("出窑任务请求")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject kilnOutCreateTask(@RequestBody JSONObject param) {
|
||||||
|
pdaService.kilnOutCreateTask(param);
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
@PostMapping("/manual/kiln/move/createTask")
|
||||||
|
@Log("窑后移库任务请求")
|
||||||
|
@ApiOperation("窑后移库任务请求")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject kilnMoveCreateTask(@RequestBody JSONObject param) {
|
||||||
|
pdaService.kilnMoveCreateTask(param);
|
||||||
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
}
|
||||||
|
@PostMapping("/manual/kiln/move/pointList")
|
||||||
|
@Log("窑后移库点位下拉数据")
|
||||||
|
@ApiOperation("窑后移库点位下拉数据")
|
||||||
|
@PdaAnnotation
|
||||||
|
public JSONObject kilnMovePointList() {
|
||||||
|
return PdaUtils.buildSuccessResultJSON(pdaService.kilnMovePointList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.nl.wms.pda.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 辽宁晟华手持服务层接口
|
* 辽宁晟华手持服务层接口
|
||||||
@@ -123,4 +124,112 @@ public interface PdaService {
|
|||||||
* @param device_code 设备编码
|
* @param device_code 设备编码
|
||||||
*/
|
*/
|
||||||
void callDefective(String device_code, String request_param);
|
void callDefective(String device_code, String request_param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人工处理异常任务
|
||||||
|
* @param param /
|
||||||
|
*/
|
||||||
|
void manualExceptionHandlingTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人工异常处理-任务查看
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray manualExceptionHandlingTaskShow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人工混碾搬运
|
||||||
|
* @param param /
|
||||||
|
*/
|
||||||
|
void manualMixingMoveTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取混碾下拉框
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray getMixingPointList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取混碾人工任务
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray getMixingTaskList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 料盅转移位置列表
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray getPositionList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 料盅转移任务
|
||||||
|
* @param param /
|
||||||
|
*/
|
||||||
|
void transferCreateTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务显示
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray transferTaskShow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压制叫料起点列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
JSONArray suppressStartPointList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建任务
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
void suppressCreateTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压制送料起点列表
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray suppressDownPointList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压制送料任务
|
||||||
|
* @param param /
|
||||||
|
*/
|
||||||
|
void suppressDownCreateTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务显示
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray suppressDownShow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出窑任务请求
|
||||||
|
* @param param /
|
||||||
|
*/
|
||||||
|
void kilnOutCreateTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 窑后移库任务请求
|
||||||
|
* @param param /
|
||||||
|
*/
|
||||||
|
void kilnMoveCreateTask(JSONObject param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 窑后移库点位下拉数据
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray kilnMovePointList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点位下拉框
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray manualExceptionHandlingTaskList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压制送料任务显示
|
||||||
|
* @return /
|
||||||
|
*/
|
||||||
|
JSONArray suppressTaskShow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,20 +10,23 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
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.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.nl.wms.basedata.eum.StandStatus;
|
||||||
import org.nl.wms.basedata.eum.TrueOrFalse;
|
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||||
import org.nl.wms.basedata.eum.VehicleType;
|
import org.nl.wms.basedata.eum.VehicleType;
|
||||||
|
import org.nl.wms.common.PickType;
|
||||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||||
import org.nl.wms.pda.service.PdaService;
|
import org.nl.wms.pda.service.PdaService;
|
||||||
import org.nl.wms.sch.manage.CreateMode;
|
import org.nl.wms.sch.manage.*;
|
||||||
import org.nl.wms.sch.manage.PointStatus;
|
|
||||||
import org.nl.wms.sch.manage.Region;
|
|
||||||
import org.nl.wms.sch.task.call.empty.FJCallEmptyTask;
|
import org.nl.wms.sch.task.call.empty.FJCallEmptyTask;
|
||||||
import org.nl.wms.sch.task.call.empty.HLCallEmptyTask;
|
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.empty.YZCallEmptyTask;
|
||||||
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
|
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
|
||||||
import org.nl.wms.sch.task.call.material.YZCallMaterialTask;
|
import org.nl.wms.sch.task.call.material.YZCallMaterialTask;
|
||||||
|
import org.nl.wms.sch.task.p2p.PDATask;
|
||||||
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
|
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
|
||||||
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask;
|
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask;
|
||||||
import org.nl.wms.sch.task.send.material.FJSendMaterialTask;
|
import org.nl.wms.sch.task.send.material.FJSendMaterialTask;
|
||||||
@@ -615,4 +618,493 @@ public class PdaServiceImpl implements PdaService {
|
|||||||
method_param.put("create_name", SecurityUtils.getCurrentNickName());
|
method_param.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
yzCallMaterialTask.createTask(method_param);
|
yzCallMaterialTask.createTask(method_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void manualExceptionHandlingTask(JSONObject param) {
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
String taskId = param.getString("task_id");
|
||||||
|
// param中包含两个信息:task_id, target_point(可为空)
|
||||||
|
JSONObject taskObject = taskTab.query("task_id = '" + taskId + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(taskObject)) {
|
||||||
|
throw new BadRequestException("任务「" + taskId + "」不存在!");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(param.getString("target_point"))) {
|
||||||
|
taskObject.put("point_code2", param.getString("target_point"));
|
||||||
|
}
|
||||||
|
taskObject.put("task_status", TaskStatus.FINISHED.value());
|
||||||
|
TaskUtils.addCurrentUpdateColum(taskObject);
|
||||||
|
taskTab.update(taskObject);
|
||||||
|
log.info("任务「{}」已经更新目的地「{}」并完成", taskId, param.getString("target_point"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray manualExceptionHandlingTaskShow() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "4")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void manualMixingMoveTask(JSONObject param) {
|
||||||
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
// param: point_code, vehicle_code, weight
|
||||||
|
String target_point = "KLXNK";
|
||||||
|
String pointCode = param.getString("point_code");
|
||||||
|
String vehicleCode = param.getString("vehicle_code");
|
||||||
|
String weight = param.getString("weight");
|
||||||
|
if (ObjectUtil.isEmpty(vehicleCode)) {
|
||||||
|
throw new BadRequestException("载具编码不能为空!");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(weight)) {
|
||||||
|
throw new BadRequestException("重量不能为空!");
|
||||||
|
}
|
||||||
|
// 检测同个点位是否存在任务
|
||||||
|
JSONObject tasking = taskTab.query("point_code1 = '" + pointCode + "' AND task_status < '7' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(tasking)) {
|
||||||
|
throw new BadRequestException("点位「" + pointCode + "」存在任务『" + tasking.getString("task_code") + "』");
|
||||||
|
}
|
||||||
|
// 组盘
|
||||||
|
// 相同组盘信息,先标记删除
|
||||||
|
JSONObject vd_update = new JSONObject();
|
||||||
|
vd_update.put("is_delete", "1");
|
||||||
|
vd_update.put("update_optid", ACSSystem.id);
|
||||||
|
vd_update.put("update_optname", ACSSystem.nick_name);
|
||||||
|
String now = DateUtil.now();
|
||||||
|
vd_update.put("update_time", now);
|
||||||
|
vd_table.update(vd_update, "vehicle_type = '1' AND vehicle_code = '" + vehicleCode + "' AND is_delete = '0'");
|
||||||
|
// 获取点位
|
||||||
|
JSONObject point = pointTab.query("point_code = '" + pointCode + "'").uniqueResult(0);
|
||||||
|
// 获取工单
|
||||||
|
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
||||||
|
// 创建任务,状态为完成
|
||||||
|
JSONObject vd = new JSONObject();
|
||||||
|
vd.put("vd_id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||||
|
vd.put("vehicle_type", VehicleType.CUP.value());
|
||||||
|
vd.put("vehicle_code", vehicleCode);
|
||||||
|
vd.put("material_id", workorder.getString("material_id"));
|
||||||
|
vd.put("weight", weight);
|
||||||
|
vd.put("workorder_id", workorder.getString("workorder_id"));
|
||||||
|
vd.put("point_code", pointCode);
|
||||||
|
vd.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
vd.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
|
vd.put("create_time", now);
|
||||||
|
vd.put("is_in_kiln", "0");
|
||||||
|
vd.put("stand_status", StandStatus.STANDING.value());
|
||||||
|
vd.put("mix_num", "0"); // todo
|
||||||
|
vd_table.insert(vd);
|
||||||
|
param.put("vd", vd);
|
||||||
|
// 创建任务
|
||||||
|
JSONObject task = new JSONObject();
|
||||||
|
task.put("task_id", IdUtil.getSnowflake().nextId());
|
||||||
|
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
task.put("task_name", "混料区人工送料");
|
||||||
|
task.put("task_type", TaskType.SEND_MATERIAL.value());
|
||||||
|
task.put("task_status", TaskStatus.FINISHED.value());
|
||||||
|
task.put("point_code1", pointCode);
|
||||||
|
task.put("point_code2", target_point);
|
||||||
|
task.put("group_id", vd.getString("vd_id"));
|
||||||
|
task.put("material_id", workorder.getString("material_id"));
|
||||||
|
task.put("vehicle_type", VehicleType.CUP.value());
|
||||||
|
task.put("vehicle_code", vehicleCode);
|
||||||
|
task.put("priority", "1");
|
||||||
|
task.put("is_auto_issue", "0");
|
||||||
|
task.put("handle_class", this.getClass().getName());
|
||||||
|
task.put("create_mode", CreateMode.SCCJ.value());
|
||||||
|
task.put("request_param", param);
|
||||||
|
task.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
task.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
|
task.put("create_time", DateUtil.now());
|
||||||
|
taskTab.insert(task);
|
||||||
|
// 混碾工单需要加上重量真实值
|
||||||
|
JSONObject workorder_update = new JSONObject();
|
||||||
|
workorder_update.put("real_qty", workorder.getIntValue("real_qty") + workorder.getIntValue("weight"));
|
||||||
|
TaskUtils.addACSUpdateColum(workorder_update);
|
||||||
|
WQLObject.getWQLObject("pdm_bd_workorder").update(workorder_update, "workorder_id = " + workorder.getString("workorder_id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getMixingPointList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "5")
|
||||||
|
.addParam("region_code", "HL")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getMixingTaskList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "6")
|
||||||
|
.addParam("handle_class", "org.nl.wms.pda.service.impl.PdaServiceImpl")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray getPositionList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "9")
|
||||||
|
.addParam("types", "('2','3')")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void transferCreateTask(JSONObject param) {
|
||||||
|
log.info("请求参数:{}", param);
|
||||||
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
// param: start_point, end_point, vehicle_code
|
||||||
|
String startPoint = param.getString("start_point");
|
||||||
|
String endPoint = param.getString("end_point");
|
||||||
|
String vehicleCode = param.getString("vehicle_code");
|
||||||
|
JSONObject point1 = pointTab.query("point_code = '" + startPoint + "'").uniqueResult(0);
|
||||||
|
JSONObject point2 = pointTab.query("point_code = '" + endPoint + "'").uniqueResult(0);
|
||||||
|
// 校验任务
|
||||||
|
JSONObject tasking = taskTab.query("(point_code1 = '" + startPoint + "' or point_code2 = '" + endPoint + "') " +
|
||||||
|
"AND task_status < '7' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(tasking)) {
|
||||||
|
throw new BadRequestException("已存在任务");
|
||||||
|
}
|
||||||
|
// 获取组盘
|
||||||
|
JSONObject groupInfo = vd_table.query("vehicle_type = '1' AND vehicle_code = '" + vehicleCode + "' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(groupInfo)) {
|
||||||
|
throw new BadRequestException("料盅「" + vehicleCode + "」的组盘信息不存在");
|
||||||
|
}
|
||||||
|
JSONObject taskParam = new JSONObject();
|
||||||
|
taskParam.put("point1", point1);
|
||||||
|
taskParam.put("point2", point2);
|
||||||
|
taskParam.put("vehicle_type", "1");
|
||||||
|
taskParam.put("vehicle_code", vehicleCode);
|
||||||
|
taskParam.put("create_mode", CreateMode.SCCJ.value());
|
||||||
|
taskParam.put("group_id", groupInfo.getString("vd_id"));
|
||||||
|
PDATask pdaTask = SpringContextHolder.getBean(PDATask.class);
|
||||||
|
pdaTask.createTask(taskParam);
|
||||||
|
log.info("手持任务创建成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray transferTaskShow() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "7")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray suppressStartPointList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "8")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void suppressCreateTask(JSONObject param) {
|
||||||
|
log.info("请求参数:{}", param);
|
||||||
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
// param: start_point, end_point, vehicle_code
|
||||||
|
String startPoint = param.getString("start_point");
|
||||||
|
String endPoint = param.getString("end_point");
|
||||||
|
String vehicleCode = param.getString("vehicle_code");
|
||||||
|
// 校验是否创建过任务
|
||||||
|
JSONObject tasking = taskTab.query("(point_code1 = '" + startPoint + "' or point_code2 = '" + endPoint + "') " +
|
||||||
|
"AND task_status < '7' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(tasking)) {
|
||||||
|
throw new BadRequestException("已存在任务");
|
||||||
|
}
|
||||||
|
// 创建人工搬运任务,任务状态是完成,点位上记录的数据需要变动
|
||||||
|
JSONObject point1 = pointTab.query("point_code = '" + startPoint + "'").uniqueResult(0);
|
||||||
|
JSONObject point2 = pointTab.query("point_code = '" + endPoint + "'").uniqueResult(0);
|
||||||
|
// 获取组盘信息
|
||||||
|
JSONObject vd = vd_table.query("vehicle_type = '1' AND vehicle_code = '" + vehicleCode + "' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(vd)) {
|
||||||
|
throw new BadRequestException("料盅「" + vehicleCode + "」的组盘信息不存在");
|
||||||
|
}
|
||||||
|
// 获取工单
|
||||||
|
JSONObject workorder = TaskUtils.hasWorkOrder(point2);
|
||||||
|
// 创建任务
|
||||||
|
JSONObject task = new JSONObject();
|
||||||
|
task.put("task_id", IdUtil.getSnowflake().nextId());
|
||||||
|
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
task.put("task_name", "人工布料机上料");
|
||||||
|
task.put("task_type", TaskType.SEND_MATERIAL.value());
|
||||||
|
task.put("task_status", TaskStatus.FINISHED.value());
|
||||||
|
task.put("point_code1", startPoint);
|
||||||
|
task.put("point_code2", endPoint);
|
||||||
|
task.put("group_id", vd.getString("vd_id"));
|
||||||
|
task.put("material_id", workorder.getString("material_id"));
|
||||||
|
task.put("vehicle_type", VehicleType.CUP.value());
|
||||||
|
task.put("vehicle_code", vehicleCode);
|
||||||
|
task.put("priority", "1");
|
||||||
|
task.put("is_auto_issue", "0");
|
||||||
|
task.put("handle_class", this.getClass().getName());
|
||||||
|
task.put("create_mode", CreateMode.SCCJ.value());
|
||||||
|
task.put("request_param", param);
|
||||||
|
task.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
task.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
|
task.put("create_time", DateUtil.now());
|
||||||
|
taskTab.insert(task);
|
||||||
|
// 点位数据更新
|
||||||
|
point1.put("task_code", "");
|
||||||
|
point1.put("vehicle_type", "");
|
||||||
|
point1.put("vehicle_code", "");
|
||||||
|
point1.put("point_status", PointStatus.EMPTY.value());
|
||||||
|
TaskUtils.addCurrentUpdateColum(point1);
|
||||||
|
pointTab.update(point1);
|
||||||
|
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());
|
||||||
|
TaskUtils.addCurrentUpdateColum(point2);
|
||||||
|
pointTab.update(point2);
|
||||||
|
log.info("布料机叫料手持任务创建成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray suppressDownPointList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "9")
|
||||||
|
.addParam("types", "('2','3')")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void suppressDownCreateTask(JSONObject param) {
|
||||||
|
log.info("请求参数:{}", param);
|
||||||
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
// param: start_point, vehicle_code, qty, is_full
|
||||||
|
String startPoint = param.getString("start_point");
|
||||||
|
String endPoint = "YQXNK";
|
||||||
|
String vehicleCode = param.getString("vehicle_code");
|
||||||
|
String qty = param.getString("qty");
|
||||||
|
String isFull = param.getString("is_full");
|
||||||
|
String weight = "0";
|
||||||
|
// 判断是否有任务
|
||||||
|
JSONObject tasking = taskTab.query("(point_code1 = '" + startPoint + "' or point_code2 = '" + endPoint + "') " +
|
||||||
|
"AND task_status < '7' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(tasking)) {
|
||||||
|
throw new BadRequestException("已存在任务");
|
||||||
|
}
|
||||||
|
// 组盘
|
||||||
|
// 相同组盘信息,先标记删除
|
||||||
|
JSONObject vd_update = new JSONObject();
|
||||||
|
vd_update.put("is_delete", "1");
|
||||||
|
vd_update.put("update_optid", ACSSystem.id);
|
||||||
|
vd_update.put("update_optname", ACSSystem.nick_name);
|
||||||
|
String now = DateUtil.now();
|
||||||
|
vd_update.put("update_time", now);
|
||||||
|
vd_table.update(vd_update, "vehicle_type = '2' AND vehicle_code = '" + vehicleCode + "' AND is_delete = '0'");
|
||||||
|
// 获取点位
|
||||||
|
JSONObject point1 = pointTab.query("point_code = '" + startPoint + "'").uniqueResult(0);
|
||||||
|
JSONObject point2 = pointTab.query("point_code = '" + endPoint + "'").uniqueResult(0);
|
||||||
|
// 获取工单
|
||||||
|
JSONObject workorder = TaskUtils.hasWorkOrder(point1);
|
||||||
|
JSONObject vd = new JSONObject();
|
||||||
|
vd.put("vd_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
vd.put("vehicle_type", "2");
|
||||||
|
vd.put("vehicle_code", vehicleCode);
|
||||||
|
vd.put("material_id", workorder.getString("material_id"));
|
||||||
|
vd.put("qty", qty);
|
||||||
|
vd.put("weight", weight);
|
||||||
|
vd.put("is_full", isFull);
|
||||||
|
vd.put("workorder_id", workorder.getString("workorder_id"));
|
||||||
|
vd.put("point_code", endPoint); // 这里换成虚拟库位置
|
||||||
|
vd.put("create_id", ACSSystem.id);
|
||||||
|
vd.put("create_name", ACSSystem.nick_name);
|
||||||
|
vd.put("create_time", DateUtil.now());
|
||||||
|
vd.put("is_delete", TrueOrFalse.FALSE.value());
|
||||||
|
vd_table.insert(vd);
|
||||||
|
JSONObject pn = TaskUtils.buildPN(PickType.YZ, vd.getLongValue("qty"), vd.getLongValue("workorder_id"));
|
||||||
|
WQLObject.getWQLObject("das_produce_number").insert(pn);
|
||||||
|
// 创建任务
|
||||||
|
JSONObject task = new JSONObject();
|
||||||
|
task.put("task_id", IdUtil.getSnowflake().nextId());
|
||||||
|
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
task.put("task_name", "人工压机下料");
|
||||||
|
task.put("task_type", TaskType.SEND_MATERIAL.value());
|
||||||
|
task.put("task_status", TaskStatus.FINISHED.value());
|
||||||
|
task.put("point_code1", startPoint);
|
||||||
|
task.put("point_code2", endPoint);
|
||||||
|
task.put("group_id", vd.getString("vd_id"));
|
||||||
|
task.put("material_id", workorder.getString("material_id"));
|
||||||
|
task.put("vehicle_type", VehicleType.STEEL_TRAY.value());
|
||||||
|
task.put("vehicle_code", vehicleCode);
|
||||||
|
task.put("priority", "1");
|
||||||
|
task.put("is_auto_issue", "0");
|
||||||
|
task.put("handle_class", this.getClass().getName());
|
||||||
|
task.put("create_mode", CreateMode.SCCJ.value());
|
||||||
|
task.put("request_param", param);
|
||||||
|
task.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
task.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
|
task.put("create_time", DateUtil.now());
|
||||||
|
taskTab.insert(task);
|
||||||
|
// 起点清空,终点赋值。
|
||||||
|
point1.put("task_code", "");
|
||||||
|
point1.put("vehicle_type", "");
|
||||||
|
point1.put("vehicle_code", "");
|
||||||
|
point1.put("point_status", PointStatus.EMPTY.value());
|
||||||
|
TaskUtils.addCurrentUpdateColum(point1);
|
||||||
|
pointTab.update(point1);
|
||||||
|
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());
|
||||||
|
TaskUtils.addCurrentUpdateColum(point2);
|
||||||
|
pointTab.update(point2);
|
||||||
|
log.info("压机下料手持任务创建成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray suppressDownShow() {
|
||||||
|
return this.getMixingTaskList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void kilnOutCreateTask(JSONObject param) {
|
||||||
|
log.info("请求参数:{}", param);
|
||||||
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
// JYHJ01DJ04
|
||||||
|
// param: vehicle_code
|
||||||
|
String startPoint = "JYHJ01DJ04";
|
||||||
|
String endPoint = "CYXNK";
|
||||||
|
String vehicleCode = param.getString("vehicle_code");
|
||||||
|
// 校验任务
|
||||||
|
JSONObject tasking = taskTab.query("(point_code1 = '" + startPoint + "' or point_code2 = '" + endPoint + "') " +
|
||||||
|
"AND task_status < '7' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(tasking)) {
|
||||||
|
throw new BadRequestException("已存在任务");
|
||||||
|
}
|
||||||
|
// 获取组盘 (此时是刚托盘)
|
||||||
|
JSONObject vd = vd_table.query("vehicle_type = '2' AND vehicle_code = '" + vehicleCode + "' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(vd)) {
|
||||||
|
throw new BadRequestException("钢托盘「" + vehicleCode + "」的组盘信息不存在");
|
||||||
|
}
|
||||||
|
vd.put("is_fire", "1");
|
||||||
|
vd.put("is_in_kiln", "0");
|
||||||
|
vd.put("point_code", endPoint);
|
||||||
|
vd_table.update(vd);
|
||||||
|
// 创建任务
|
||||||
|
JSONObject task = new JSONObject();
|
||||||
|
task.put("task_id", IdUtil.getSnowflake().nextId());
|
||||||
|
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
task.put("task_name", "人工出窑任务");
|
||||||
|
task.put("task_type", TaskType.SEND_MATERIAL.value());
|
||||||
|
task.put("task_status", TaskStatus.FINISHED.value());
|
||||||
|
task.put("point_code1", startPoint);
|
||||||
|
task.put("point_code2", endPoint);
|
||||||
|
task.put("group_id", vd.getString("vd_id"));
|
||||||
|
task.put("material_id", vd.getString("material_id"));
|
||||||
|
task.put("vehicle_type", VehicleType.STEEL_TRAY.value());
|
||||||
|
task.put("vehicle_code", vehicleCode);
|
||||||
|
task.put("priority", "1");
|
||||||
|
task.put("is_auto_issue", "0");
|
||||||
|
task.put("handle_class", this.getClass().getName());
|
||||||
|
task.put("create_mode", CreateMode.SCCJ.value());
|
||||||
|
task.put("request_param", param);
|
||||||
|
task.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
task.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
|
task.put("create_time", DateUtil.now());
|
||||||
|
taskTab.insert(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void kilnMoveCreateTask(JSONObject param) {
|
||||||
|
log.info("请求参数:{}", param);
|
||||||
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
// param: start_point, vehicle_code
|
||||||
|
String startPoint = param.getString("start_point");
|
||||||
|
String vehicleCode = param.getString("vehicle_code");
|
||||||
|
String endPoint = "CYXNK";
|
||||||
|
JSONObject point1 = pointTab.query("point_code = '" + startPoint + "'").uniqueResult(0);
|
||||||
|
// 判断是否有任务
|
||||||
|
JSONObject tasking = taskTab.query("(point_code1 = '" + startPoint + "' or point_code2 = '" + endPoint + "') " +
|
||||||
|
"AND task_status < '7' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(tasking)) {
|
||||||
|
throw new BadRequestException("已存在任务");
|
||||||
|
}
|
||||||
|
// 获取组盘 (此时是刚托盘)
|
||||||
|
JSONObject vd = vd_table.query("vehicle_type = '2' AND vehicle_code = '" + vehicleCode + "' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(vd)) {
|
||||||
|
throw new BadRequestException("钢托盘「" + vehicleCode + "」的组盘信息不存在");
|
||||||
|
}
|
||||||
|
vd.put("point_code", endPoint); // 更新到虚拟库
|
||||||
|
vd_table.update(vd);
|
||||||
|
// 生成完成的任务
|
||||||
|
JSONObject task = new JSONObject();
|
||||||
|
task.put("task_id", IdUtil.getSnowflake().nextId());
|
||||||
|
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||||
|
task.put("task_name", "人工移库任务");
|
||||||
|
task.put("task_type", TaskType.SEND_MATERIAL.value());
|
||||||
|
task.put("task_status", TaskStatus.FINISHED.value());
|
||||||
|
task.put("point_code1", startPoint);
|
||||||
|
task.put("point_code2", endPoint);
|
||||||
|
task.put("group_id", vd.getString("vd_id"));
|
||||||
|
task.put("material_id", vd.getString("material_id"));
|
||||||
|
task.put("vehicle_type", VehicleType.STEEL_TRAY.value());
|
||||||
|
task.put("vehicle_code", vehicleCode);
|
||||||
|
task.put("priority", "1");
|
||||||
|
task.put("is_auto_issue", "0");
|
||||||
|
task.put("handle_class", this.getClass().getName());
|
||||||
|
task.put("create_mode", CreateMode.SCCJ.value());
|
||||||
|
task.put("request_param", param);
|
||||||
|
task.put("create_id", SecurityUtils.getCurrentUserId());
|
||||||
|
task.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
|
task.put("create_time", DateUtil.now());
|
||||||
|
taskTab.insert(task);
|
||||||
|
// 起点清空
|
||||||
|
point1.put("task_code", "");
|
||||||
|
point1.put("vehicle_type", "");
|
||||||
|
point1.put("vehicle_code", "");
|
||||||
|
point1.put("point_status", PointStatus.EMPTY.value());
|
||||||
|
TaskUtils.addCurrentUpdateColum(point1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray kilnMovePointList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "5")
|
||||||
|
.addParam("region_code", "BCPHJ")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray manualExceptionHandlingTaskList() {
|
||||||
|
return WQL
|
||||||
|
.getWO("PDA")
|
||||||
|
.addParam("flag", "5")
|
||||||
|
.addParam("region_code", "XN")
|
||||||
|
.process()
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONArray suppressTaskShow() {
|
||||||
|
return this.getMixingTaskList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@
|
|||||||
输入.flag TYPEAS s_string
|
输入.flag TYPEAS s_string
|
||||||
输入.where TYPEAS f_string
|
输入.where TYPEAS f_string
|
||||||
输入.region_code TYPEAS s_string
|
输入.region_code TYPEAS s_string
|
||||||
|
输入.handle_class TYPEAS s_string
|
||||||
输入.point_type TYPEAS f_string
|
输入.point_type TYPEAS f_string
|
||||||
|
输入.types TYPEAS f_string
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
--这边列出来的临时表就会在运行期动态创建
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
@@ -94,3 +96,101 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
IF 输入.flag = "4"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
t.task_id,
|
||||||
|
t.task_code,
|
||||||
|
t.task_name,
|
||||||
|
t.task_status,
|
||||||
|
p.point_name AS start_point,
|
||||||
|
p1.point_name AS end_point,
|
||||||
|
t.vehicle_type,
|
||||||
|
t.vehicle_code
|
||||||
|
FROM
|
||||||
|
`sch_base_task` t
|
||||||
|
LEFT JOIN sch_base_point p ON p.point_code = t.point_code1
|
||||||
|
LEFT JOIN sch_base_point p1 ON p1.point_code = t.point_code2
|
||||||
|
WHERE t.task_status < '7' AND t.task_status > '3'
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "5"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
p.point_code,
|
||||||
|
p.point_name
|
||||||
|
FROM
|
||||||
|
`sch_base_point` p
|
||||||
|
WHERE p.region_code = 输入.region_code
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "6"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
t.task_id,
|
||||||
|
t.task_code,
|
||||||
|
t.task_name,
|
||||||
|
t.task_status,
|
||||||
|
p.point_name AS start_point,
|
||||||
|
p1.point_name AS end_point,
|
||||||
|
t.vehicle_type,
|
||||||
|
t.vehicle_code
|
||||||
|
FROM
|
||||||
|
`sch_base_task` t
|
||||||
|
LEFT JOIN sch_base_point p ON p.point_code = t.point_code1
|
||||||
|
LEFT JOIN sch_base_point p1 ON p1.point_code = t.point_code2
|
||||||
|
WHERE t.task_status = '7'
|
||||||
|
AND t.handle_class = 输入.handle_class
|
||||||
|
AND TIMESTAMPDIFF(HOUR, t.create_time, NOW()) < 1;
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "7"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
t.task_id,
|
||||||
|
t.task_code,
|
||||||
|
t.task_name,
|
||||||
|
t.task_status,
|
||||||
|
p.point_name AS start_point,
|
||||||
|
p1.point_name AS end_point,
|
||||||
|
t.vehicle_type,
|
||||||
|
t.vehicle_code
|
||||||
|
FROM
|
||||||
|
`sch_base_task` t
|
||||||
|
LEFT JOIN sch_base_point p ON p.point_code = t.point_code1
|
||||||
|
LEFT JOIN sch_base_point p1 ON p1.point_code = t.point_code2
|
||||||
|
WHERE t.task_status < '7'
|
||||||
|
AND t.task_type = '6'
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "8"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
p.point_code,
|
||||||
|
p.point_name
|
||||||
|
FROM
|
||||||
|
`sch_base_point` p
|
||||||
|
WHERE p.region_code IN ('XN', 'KLHJ') AND p.point_type = '1' AND p.is_used = '1' AND p.lock_type = '1'
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "9"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
p.point_code,
|
||||||
|
p.point_name
|
||||||
|
FROM
|
||||||
|
`sch_base_point` p
|
||||||
|
WHERE p.region_code = 'YZ' AND p.point_type IN 输入.types
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ public abstract class AbstractAcsTask {
|
|||||||
public List<AcsTaskDTO> addTask() {
|
public List<AcsTaskDTO> addTask() {
|
||||||
JSONArray tasks = WQLObject
|
JSONArray tasks = WQLObject
|
||||||
.getWQLObject("sch_base_task")
|
.getWQLObject("sch_base_task")
|
||||||
.query("is_delete = '0' AND task_status = " + TaskStatus.START_AND_END.value() + " AND handle_class = '" + this.getClass().getName() + "'")
|
.query("is_delete = '0' AND task_status = " + TaskStatus.START_AND_END.value() + " AND handle_class = '" + this.getClass().getName() +
|
||||||
|
"' AND is_auto_issue = '1'")
|
||||||
.getResultJSONArray(0);
|
.getResultJSONArray(0);
|
||||||
|
|
||||||
ArrayList<AcsTaskDTO> acs_tasks = new ArrayList<>();
|
ArrayList<AcsTaskDTO> acs_tasks = new ArrayList<>();
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ public enum TaskType {
|
|||||||
CALL_MATERIAL("叫料", "2"),
|
CALL_MATERIAL("叫料", "2"),
|
||||||
SEND_EMPTY("送空", "3"),
|
SEND_EMPTY("送空", "3"),
|
||||||
CALL_EMPTY("叫空", "4"),
|
CALL_EMPTY("叫空", "4"),
|
||||||
TO_PACKAGE("去包装", "5");
|
TO_PACKAGE("去包装", "5"),
|
||||||
|
PDA_TASK("PDA任务", "6");
|
||||||
|
|
||||||
private final String label;
|
private final String label;
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|||||||
@@ -0,0 +1,194 @@
|
|||||||
|
package org.nl.wms.sch.task.p2p;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wms.sch.manage.*;
|
||||||
|
import org.nl.wms.sch.task.util.TaskUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: lyd
|
||||||
|
* @Description: 手持点对点任务类
|
||||||
|
* @Date: 2024/5/14
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Component
|
||||||
|
public class PDATask 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
|
||||||
|
public String createTask(JSONObject form) {
|
||||||
|
JSONObject point1 = form.getJSONObject("point1");
|
||||||
|
JSONObject point2 = form.getJSONObject("point2");
|
||||||
|
|
||||||
|
JSONObject task = TaskUtils.buildTask(
|
||||||
|
"手持点对点任务",
|
||||||
|
TaskType.PDA_TASK.value(),
|
||||||
|
TaskStatus.START_AND_END.value(),
|
||||||
|
point1.getString("point_code"),
|
||||||
|
point2.getString("point_code"),
|
||||||
|
form.getLong("group_id"),
|
||||||
|
null,
|
||||||
|
form.getString("vehicle_type"),
|
||||||
|
form.getString("vehicle_code"),
|
||||||
|
8,
|
||||||
|
PDATask.class.getName(),
|
||||||
|
form.getString("create_mode"),
|
||||||
|
JSONObject.toJSONString(form),
|
||||||
|
String.valueOf(SecurityUtils.getCurrentUserId()),
|
||||||
|
SecurityUtils.getCurrentUsername()
|
||||||
|
);
|
||||||
|
|
||||||
|
point1.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
point1.put("task_code", task.getString("task_code"));
|
||||||
|
TaskUtils.addFormUpdateColum(point1, form);
|
||||||
|
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
pointTable.update(point1);
|
||||||
|
|
||||||
|
point2.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
point2.put("task_code", task.getString("task_code"));
|
||||||
|
TaskUtils.addFormUpdateColum(point2, form);
|
||||||
|
pointTable.update(point2);
|
||||||
|
|
||||||
|
WQLObject.getWQLObject("sch_base_task").insert(task);
|
||||||
|
|
||||||
|
return task.getString("task_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
String point_code1 = task.getString("point_code1");
|
||||||
|
if (StrUtil.isNotBlank(point_code1)) {
|
||||||
|
JSONObject point1 = point_table.query("point_code = '" + 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String point_code2 = task.getString("point_code2");
|
||||||
|
if (StrUtil.isNotBlank(point_code2)) {
|
||||||
|
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 = '" + point_code2 + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||||
|
int current_task_status = task.getIntValue("task_status");
|
||||||
|
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||||
|
if (operation_type == OperationType.MANUAL
|
||||||
|
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
|
||||||
|
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
String point_code1 = task.getString("point_code1");
|
||||||
|
if (StrUtil.isNotBlank(point_code1)) {
|
||||||
|
JSONObject point1 = point_table.query("point_code = '" + 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("vd_id", null);
|
||||||
|
point1.put("point_status", PointStatus.EMPTY.value());
|
||||||
|
if (operation_type == OperationType.AUTO) {
|
||||||
|
TaskUtils.addACSUpdateColum(point1);
|
||||||
|
} else if (operation_type == OperationType.MANUAL) {
|
||||||
|
TaskUtils.addCurrentUpdateColum(point1);
|
||||||
|
}
|
||||||
|
point_table.update(point1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String point_code2 = task.getString("point_code2");
|
||||||
|
if (StrUtil.isNotBlank(point_code2)) {
|
||||||
|
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("vd_id", task.getString("group_id"));
|
||||||
|
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 = '" + point_code2 + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user