rev:修改acs更新缓存线实时任务id,改为更新编码及相关牵涉代码;
rev:修改扫码异常查询逻辑,扫码异常确认功能增加对接位和准备位选择再下发acs; rev:修改指令查询中所有指令改为,增加显示字段及筛选条件。 rev:修改任务下发逻辑。
This commit is contained in:
@@ -49,12 +49,12 @@ public class AcsToWmsController {
|
||||
}
|
||||
|
||||
@PostMapping("/receiveTaskIdToCacheLine")
|
||||
@Log("ACS给WMS发送缓存线的实时任务ID")
|
||||
@ApiOperation("ACS给WMS发送缓存线的实时任务ID")
|
||||
@Log("acs给wms发送缓存线的实时任务编号")
|
||||
@ApiOperation("acs给wms发送缓存线的实时任务编号")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> receiveTaskIdToCacheLine(@RequestBody JSONObject whereJson) {
|
||||
//参数校验
|
||||
if(StringUtils.isEmpty(whereJson.getString("task_id")) || StringUtils.isEmpty(whereJson.getString("position_code"))) {
|
||||
if(StringUtils.isEmpty(whereJson.getString("task_code")) || StringUtils.isEmpty(whereJson.getString("position_code"))) {
|
||||
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
|
||||
}
|
||||
return new ResponseEntity<>(acsToWmsService.receiveTaskIdToCacheLine(whereJson), HttpStatus.OK);
|
||||
|
||||
@@ -18,9 +18,9 @@ public interface AcsToWmsService {
|
||||
|
||||
/**
|
||||
*
|
||||
* ACS客户端--->WMS服务端
|
||||
* ACS给WMS发送缓存线的实时任务ID
|
||||
* @param jsonObject 条件:1.缓存线点位编码:position_code,2.任务id:task_id
|
||||
* acs客户端--->wms服务端
|
||||
* acs给wms发送缓存线的实时任务编号
|
||||
* @param jsonObject 条件:1.缓存线点位编码:position_code,2.任务编号:task_code
|
||||
* @return JSONObject
|
||||
* @author gbx
|
||||
* @date 2023/3/25
|
||||
|
||||
@@ -88,20 +88,20 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
|
||||
/**
|
||||
* 更新缓存线的点位实时任务信息
|
||||
* ACS给WMS发送缓存线的实时任务ID
|
||||
* @param jsonObject position_code:缓存线点位编码 task_id:任务id
|
||||
* ACS给WMS发送缓存线的实时任务编号
|
||||
* @param jsonObject position_code:缓存线点位编码 task_code:任务编号
|
||||
*/
|
||||
@Override
|
||||
public JSONObject receiveTaskIdToCacheLine(JSONObject jsonObject) {
|
||||
JSONObject result = new JSONObject();
|
||||
HashMap<String,String> json = new HashMap<>(2);
|
||||
try {
|
||||
String taskId = jsonObject.getString("position_code");
|
||||
String positionCode = jsonObject.getString("task_id");
|
||||
String task_code = jsonObject.getString("task_code");
|
||||
String positionCode = jsonObject.getString("position_code");
|
||||
//缓存线位置表
|
||||
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
|
||||
json.put("position_code", positionCode);
|
||||
json.put("task_id", taskId);
|
||||
json.put("task_code", task_code);
|
||||
//更新缓存线的点位实时任务信息
|
||||
positionTab.update(json);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -198,6 +199,10 @@ public class CacheLineHandController{
|
||||
@ApiOperation("缓存线出入箱异常指令查询")
|
||||
public ResponseEntity<JSONArray> inOutExceptionInstQuery(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被·请求, 请求参数-{}", param);
|
||||
//参数校验
|
||||
if(StringUtils.isEmpty(param.getString("wcsdevice_code"))) {
|
||||
throw new BizCoreException("请选择缓存线编号!");
|
||||
}
|
||||
return new ResponseEntity<>(cacheLineHandService.inOutExceptionInstQuery(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -207,8 +212,8 @@ public class CacheLineHandController{
|
||||
public ResponseEntity<Object> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令确认] 接口被请求, 请求参数-{}", param);
|
||||
//参数校验
|
||||
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
|
||||
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
|
||||
if(StringUtils.isEmpty(param.getString("type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
|
||||
throw new BizCoreException("请确认缓存线,位置,料箱码是否都已选择或填入!");
|
||||
}
|
||||
return new ResponseEntity<>(cacheLineHandService.inOutExceptionInstConfirm(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ public interface CacheLineHandService{
|
||||
*/
|
||||
JSONArray dropdownListQuery(String param, String type);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 物料查询
|
||||
*
|
||||
@@ -151,7 +154,7 @@ public interface CacheLineHandService{
|
||||
* @author gbx
|
||||
* @date 2023/3/23
|
||||
*/
|
||||
CommonResult<String> instOperation(JSONObject param);
|
||||
CommonResult<Map<String, Object>> instOperation(JSONObject param);
|
||||
|
||||
/**
|
||||
* 缓存线出箱异常-确认
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.pda.dto.MaterialDto;
|
||||
import org.nl.wms.pda.service.CacheLineHandService;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -31,6 +32,7 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -51,6 +53,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
private final RedisUtils redisUtils;
|
||||
@Autowired
|
||||
private LocalCache cache;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
public JSONArray dropdownListQuery(String param, String type) {
|
||||
@@ -150,6 +154,18 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
JSONObject whereJson = JSONObject.parseObject(JSON.toJSONString(param));
|
||||
//任务状态
|
||||
String task_status = whereJson.getString("status");
|
||||
//任务名称
|
||||
if(StrUtil.isNotEmpty(whereJson.getString("task_name"))) {
|
||||
map.put("task_name", "%" + whereJson.getString("task_name") + "%");
|
||||
}
|
||||
//生产区域
|
||||
if(StrUtil.isNotEmpty(whereJson.getString("product_area"))) {
|
||||
map.put("product_area", whereJson.getString("product_area"));
|
||||
}
|
||||
//任务类型
|
||||
if(StrUtil.isNotEmpty(whereJson.getString("task_type"))) {
|
||||
map.put("task_type", whereJson.getString("task_type"));
|
||||
}
|
||||
if(StrUtil.isNotEmpty(task_status)) {
|
||||
task_status = task_status.replace("[\"", "").replace("\"]", "").replace("\"", "");
|
||||
}
|
||||
@@ -206,10 +222,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> instOperation(JSONObject param) {
|
||||
public CommonResult<Map<String,Object>> instOperation(JSONObject param) {
|
||||
String optType = param.getString("opt_type");
|
||||
String instruct_uuid = param.getString("instruct_uuid");
|
||||
SpeMachineryTask SpeMachineryTask = new SpeMachineryTask();
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject taskObject = taskTab.query("task_id =" + instruct_uuid).uniqueResult(0);
|
||||
if(null == taskObject) {
|
||||
@@ -224,17 +239,19 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
}
|
||||
//任务下发
|
||||
else if(StatusEnum.TASK_PUBLISH.getCode().equals(optType)) {
|
||||
return RestBusinessTemplate.execute(() -> SpeMachineryTask.createTask(taskObject));
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
jsonArray.add(taskObject);
|
||||
return RestBusinessTemplate.execute(() -> wmsToAcsService.issueTaskToAcs(jsonArray));
|
||||
}
|
||||
else{
|
||||
return RestBusinessTemplate.execute(() -> "1");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务取消和完成操作,更新任务状态
|
||||
*/
|
||||
public String updateTaskStatus(JSONObject taskObj, String status) {
|
||||
public JSONObject updateTaskStatus(JSONObject taskObj, String status) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
HashMap<String,String> map = new HashMap<>(4);
|
||||
@@ -243,7 +260,11 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", DateUtil.now());
|
||||
int result = (WQLObject.getWQLObject("sch_base_task").update(map, "task_id = '" + taskObj.getString("task_id") + "'").getSucess());
|
||||
return String.valueOf(result);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", result);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -508,52 +529,16 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
}
|
||||
|
||||
/**
|
||||
* 出入类型 inOut_type 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
|
||||
* 缓存线编码 wcsdevice_code
|
||||
* 缓存线位置编码 position_code
|
||||
* 料箱码 vehicle_code
|
||||
*/
|
||||
@Override
|
||||
public JSONArray inOutExceptionInstQuery(JSONObject param) {
|
||||
//料箱号
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
//缓存线编号
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
//出入箱类型
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
//返回结果
|
||||
JSONArray result = new JSONArray();
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("flag", "10");
|
||||
params.put("vehicle_code1", vehicle_code);
|
||||
params.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
// 入箱扫码异常
|
||||
if(StatusEnum.IN_VEHICLE.getCode().equals(inOut_type)) {
|
||||
params.put("point_code2", wcsdevice_code);
|
||||
}
|
||||
// 出箱扫码异常
|
||||
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
|
||||
params.put("point_code1", wcsdevice_code);
|
||||
}
|
||||
JSONArray array = WQL.getWO("PDA_QUERY").addParamMap(params).process().getResultJSONArray(0);
|
||||
for(int i = 0; i < array.size(); i++) {
|
||||
JSONObject row = array.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("instruct_uuid", row.getString("instruct_uuid"));
|
||||
json.put("instructorder_no", row.getString("instructoperate_num"));
|
||||
json.put("wcsdevice_code", row.getString("startpoint_code"));
|
||||
json.put("vehicle_code", row.getString("vehicle_code"));
|
||||
json.put("startpoint_code", row.getString("startpoint_code"));
|
||||
json.put("nextpoint_code", row.getString("nextpoint_code"));
|
||||
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
return WQL.getWO("PDA_QUERY").addParamMap(MapOf.of("cacheline_code", param.getString("wcsdevice_code"), "flag", "12")).process().getResultJSONArray(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码异常确认
|
||||
* 出入类型 inOut_type 1 入箱扫码扫码异常-空箱在对接位上,对接位对应的类型位1, 2 出箱扫码异常-满箱在准备位上,需要传类型为2
|
||||
* type:人工选择,1:对接位; 2:准备位
|
||||
* 缓存线编码 wcsdevice_code
|
||||
* 缓存线位置编码 position_code
|
||||
* 料箱码 vehicle_code
|
||||
@@ -562,25 +547,26 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
*/
|
||||
@Override
|
||||
public CommonResult<JSONObject> inOutExceptionInstConfirm(JSONObject param) {
|
||||
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
// 料箱在对接位还是准备位
|
||||
String type = param.getString("type");
|
||||
// 缓存线编码
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
String device_code = param.getString("wcsdevice_code");
|
||||
//载具编码
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
//缓存线位置编码
|
||||
String position_code = param.getString("position_code");
|
||||
// 封装给acs的数据
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// 1 扫码异常-入箱扫码 2 出箱扫码
|
||||
jsonObject.put("type", inOut_type);
|
||||
//缓存线编号
|
||||
jsonObject.put("wcsdevice_code", wcsdevice_code);
|
||||
//料箱码
|
||||
jsonObject.put("type", type);
|
||||
jsonObject.put("position_code", position_code);
|
||||
jsonObject.put("device_code", device_code);
|
||||
jsonObject.put("vehicle_code", vehicle_code);
|
||||
jsonArray.add(jsonObject);
|
||||
try {
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
// return AcsUtil.notifyAcs("/api/cacheLineHand", jsonArray);
|
||||
//return AcsUtil.notifyAcs("/api/cacheLineHand", jsonArray);
|
||||
return RestBusinessTemplate.execute(() -> new JSONObject());
|
||||
}
|
||||
catch(NullPointerException e) {
|
||||
@@ -622,15 +608,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
*/
|
||||
@Override
|
||||
public JSONArray cacheLineOutBoxExceptionQuery(JSONObject param) {
|
||||
// JSONArray arr = WQLObject.getWQLObject("sch_cacheline_position").query("cacheLine_code like '%" + wcsdevice_code + "%'").getResultJSONArray(0);
|
||||
// StringBuilder sd = new StringBuilder();
|
||||
// for(int i = 0; i < arr.size(); i++) {
|
||||
// JSONObject row = arr.getJSONObject(i);.
|
||||
// sd.append(row.getString("task_id")).append(",");
|
||||
// }
|
||||
// String taskIdList = sd.toString();
|
||||
// taskIdList = taskIdList.substring(0, taskIdList.length() - 1);
|
||||
// return WQLObject.getWQLObject("sch_base_task").query("task_id in ('" + taskIdList + "')").getResultJSONArray(0);
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
String position_code = param.getString("position_code");
|
||||
//根据缓存线编码和缓存线点位查找任务ID
|
||||
@@ -640,10 +617,10 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
throw new BadRequestException("未找到该缓存线的点位信息!");
|
||||
}
|
||||
//查不到任务信息
|
||||
if(StringUtils.isEmpty(posiObj.getString("task_id"))) {
|
||||
if(StringUtils.isEmpty(posiObj.getString("task_code"))) {
|
||||
throw new BadRequestException("未找到该缓存线的点位的任务信息!");
|
||||
}
|
||||
JSONArray jsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_id", posiObj.getString("task_id")).process().getResultJSONArray(0);
|
||||
JSONArray jsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_code", posiObj.getString("task_code")).process().getResultJSONArray(0);
|
||||
//缓存线编码
|
||||
for(int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject row = jsonArray.getJSONObject(i);
|
||||
@@ -693,7 +670,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
throw new BadRequestException("未找到该缓存线的点位信息!");
|
||||
}
|
||||
//获取当前任务信息
|
||||
JSONObject instructObj = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + positionInfo.getString("task_id") + "'").uniqueResult(0);
|
||||
JSONObject instructObj = WQLObject.getWQLObject("sch_base_task").query("task_code = '" + positionInfo.getString("task_code") + "'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == instructObj) {
|
||||
throw new BadRequestException("未找到该任务信息!");
|
||||
|
||||
@@ -28,8 +28,14 @@
|
||||
输入.task_id TYPEAS s_string
|
||||
输入.point_code1 TYPEAS s_string
|
||||
输入.point_code2 TYPEAS s_string
|
||||
输入.point_code3 TYPEAS s_string
|
||||
输入.task_status TYPEAS s_string
|
||||
输入.task_name TYPEAS s_string
|
||||
输入.product_area TYPEAS s_string
|
||||
输入.task_type TYPEAS s_string
|
||||
输入.task_code TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -234,21 +240,22 @@
|
||||
SELECT
|
||||
task.task_id as instruct_uuid,
|
||||
task.task_code as instructoperate_num,
|
||||
task.task_name as mes_no,
|
||||
task.task_name,
|
||||
task.product_area,
|
||||
class.class_name task_type,
|
||||
task.vehicle_code,
|
||||
task.vehicle_code2 as outvehicle_code,
|
||||
task.create_time,
|
||||
dict.label as status_name,
|
||||
mater.material_code as processmaterial_code,
|
||||
point1.point_name as startpoint_code,
|
||||
point2.point_name as nextpoint_code,
|
||||
point3.point_name as nextpoint_code2
|
||||
point2.point_name as nextpoint_code
|
||||
FROM
|
||||
sch_base_task task
|
||||
left join sch_base_point point1 on task.point_code1 = point1.point_code
|
||||
left join sch_base_point point2 on task.point_code2 = point2.point_code
|
||||
left join sch_base_point point3 on task.point_code3 = point3.point_code
|
||||
left join md_me_materialbase mater on task.material_id = mater.material_id
|
||||
left join md_pb_classstandard class on task.task_type = class.class_id
|
||||
left join sys_dict dict on dict.`value` = task.task_status
|
||||
and dict.`code` = 'task_status'
|
||||
WHERE task.is_delete = '0'
|
||||
@@ -261,6 +268,15 @@
|
||||
OPTION 输入.inst_num <> ""
|
||||
(task.task_code like CONCAT ('%', 输入.inst_num, '%'))
|
||||
ENDOPTION
|
||||
OPTION 输入.task_name <> ""
|
||||
(task.task_name like CONCAT ('%', 输入.task_name, '%'))
|
||||
ENDOPTION
|
||||
OPTION 输入.product_area <> ""
|
||||
(task.product_area = 输入.product_area)
|
||||
ENDOPTION
|
||||
OPTION 输入.task_type <> ""
|
||||
(task.task_type = 输入.task_type)
|
||||
ENDOPTION
|
||||
OPTION 输入.vehicle_code <> ""
|
||||
(task.vehicle_code like CONCAT ('%', 输入.vehicle_code, '%'))
|
||||
ENDOPTION
|
||||
@@ -276,12 +292,12 @@
|
||||
OPTION 输入.point_code2 <> ""
|
||||
(task.point_code2 = 输入.point_code2)
|
||||
ENDOPTION
|
||||
OPTION 输入.point_code3 <> ""
|
||||
(task.point_code3 = 输入.point_code3)
|
||||
ENDOPTION
|
||||
OPTION 输入.task_id <> ""
|
||||
(task.task_id = 输入.task_id)
|
||||
ENDOPTION
|
||||
OPTION 输入.task_code <> ""
|
||||
(task.task_code = 输入.task_code)
|
||||
ENDOPTION
|
||||
OPTION 输入.start_date <> ""
|
||||
task.create_time >= 输入.start_date
|
||||
ENDOPTION
|
||||
@@ -304,6 +320,29 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "12"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
v.vehicle_code,
|
||||
p.position_code,
|
||||
p.cacheLine_code
|
||||
FROM
|
||||
sch_cacheline_vehilematerial v
|
||||
LEFT JOIN sch_cacheline_position p ON v.vehicle_code = p.vehicle_code
|
||||
WHERE
|
||||
v.err_type = 2
|
||||
AND v.is_delete = 0
|
||||
) a
|
||||
WHERE
|
||||
a.cacheLine_code = 输入.cacheline_code
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user