修改任务列表

This commit is contained in:
2023-03-27 18:41:56 +08:00
parent 015ed75171
commit a74a4d5d3a
5 changed files with 208 additions and 111 deletions

View File

@@ -124,10 +124,10 @@ public class CacheLineHandController{
}
@PostMapping("/cacheLineOutBoxExceptionQuery")
@Log("缓存线出箱异常-查询")
@ApiOperation("缓存线出箱异常-查询")
@Log("缓存线出箱异常-查询")
@ApiOperation("缓存线出箱异常-查询")
public CommonResult<JSONArray> cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param);
log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
@@ -136,12 +136,12 @@ public class CacheLineHandController{
}
@PostMapping("/cacheLineOutBoxExceptionConfirm")
@Log("缓存线出箱异常-确认")
@ApiOperation("缓存线出箱异常-确认")
@Log("缓存线出箱异常-确认")
@ApiOperation("缓存线出箱异常-确认")
public CommonResult<Void> cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-确认] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
if( StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineOutBoxExceptionConfirm(param));
@@ -240,6 +240,10 @@ public class CacheLineHandController{
@ApiOperation("缓存线异常处理")
public CommonResult<Void> cacheLineExcepOpt(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线异常处理] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("opt_type"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineExcepOpt(param));
}

View File

@@ -104,7 +104,7 @@ public interface CacheLineHandService{
* @author gbx
* @date 2023/3/23
*/
Map<String,Object> instPageQuery(Map<String,String> param, Pageable page);
Map<String,Object> instPageQuery(Map<String,String> param, Pageable page);
/**
* 缓存线位置关系同步
@@ -227,7 +227,7 @@ public interface CacheLineHandService{
void setBlankPos(JSONObject param);
/**
* 缓存线出箱异常-查询
* 缓存线出箱异常-查询
*
* @param param 查询参数
* @return 返回结果集

View File

@@ -2,6 +2,9 @@ package org.nl.wms.pda.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -16,9 +19,11 @@ import org.nl.modules.common.exception.BadRequestException;
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.basedata.master.service.ClassstandardService;
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
import org.nl.wms.pda.dto.MaterialDto;
import org.nl.wms.pda.service.CacheLineHandService;
import org.nl.wms.sch.service.impl.TaskServiceImpl;
import org.nl.wms.sch.tasks.SpeMachineryTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
@@ -44,9 +49,10 @@ import java.util.stream.Collectors;
@Slf4j
public class CacheLineHandServiceImpl implements CacheLineHandService{
private final RedisUtils redisUtils;
private final TaskServiceImpl taskServiceImp;
@Autowired
private LocalCache cache;
@Autowired
private ClassstandardService classstandardService;
@Override
public JSONArray dropdownListQuery(String param, String type) {
@@ -132,7 +138,49 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
@Override
public Map<String,Object> instPageQuery(Map<String,String> param, Pageable page) {
return taskServiceImp.queryAll(param, page);
HashMap<String,String> map = new HashMap<>();
map.put("flag", "10");
JSONObject whereJson = JSONObject.parseObject(JSON.toJSONString(param));
//任务状态
String task_status = whereJson.getString("status");
if(StrUtil.isNotEmpty(task_status)) {
task_status = task_status.replace("[\"", "").replace("\"]", "").replace("\"", "");
}
String moreTaskStatus = whereJson.getString("more_task_status");
if(ObjectUtil.isNotEmpty(moreTaskStatus)) {
task_status = moreTaskStatus;
}
map.put("status", task_status);
//处理状态为未完成
if(StrUtil.isNotEmpty(task_status) && task_status.contains("-1")) {
map.put("unFinish", "-1");
map.put("status", task_status.replace("-1", ""));
}
//任务编号
if(StrUtil.isNotEmpty(whereJson.getString("task_code"))) {
map.put("task_code", "%" + whereJson.getString("task_code") + "%");
}
//起点
if(StrUtil.isNotEmpty(whereJson.getString("start_point"))) {
map.put("start_point", "%" + whereJson.getString("start_point") + "%");
}
//终点
if(StrUtil.isNotEmpty(whereJson.getString("end_point"))) {
map.put("end_point", "%" + whereJson.getString("end_point") + "%");
}
//载具编码
if(StrUtil.isNotEmpty(whereJson.getString("vehicle_code"))) {
map.put("vehicle_code", "%" + whereJson.getString("vehicle_code") + "%");
}
//开始时间
if(StrUtil.isNotEmpty(whereJson.getString("start_date"))) {
map.put("start_date", whereJson.getString("start_date"));
}
//结束时间
if(StrUtil.isNotEmpty(whereJson.getString("end_date"))) {
map.put("end_date", whereJson.getString("end_date"));
}
return WQL.getWO("QSCH_TASK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "task.update_time desc");
}
@Override
@@ -168,35 +216,33 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
@Override
@Async
public void cacheLineMaterSync(String cachelineCode) {
if (StringUtils.isEmpty(cachelineCode)){
if(StringUtils.isEmpty(cachelineCode)) {
return;
}
RedissonUtils.lock(() -> {
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
JSONArray positionArr = positionTab.query("cacheline_code = '"+cachelineCode+"'").getResultJSONArray(0);
if (positionArr.size() == 0){
log.warn("CacheLineHandServiceImpl#cacheLineMaterSync");
return;
}
// 缓存线位置表
Set<String> cacheLineVehiles = positionArr.stream().map(a -> ((JSONObject) a).getString("vehicle_code")).collect(Collectors.toSet());
JSONArray ivtArr = ivtTab.query("cacheline_code = '"+cachelineCode+"'").getResultJSONArray(0);
Set<String> relationVehiles = ivtArr.stream().map(a -> ((JSONObject) a).getString("vehicle_code")).collect(Collectors.toSet());
Collection<String> cacheLineVehilesSub = CollectionUtils.subtract(cacheLineVehiles, relationVehiles);
Collection<String> relationVehilesSub = CollectionUtils.subtract(relationVehiles, cacheLineVehiles);
if (!CollectionUtils.isEmpty(relationVehilesSub)){
String sql = relationVehilesSub.stream().collect(Collectors.joining("','"));
ivtTab.delete("cacheline_code = '"+cachelineCode+"' and vehicle_code in ('"+sql+"')");
}
if (!CollectionUtils.isEmpty(cacheLineVehilesSub)){
for (String vehileCode : cacheLineVehilesSub) {
ivtTab.insert(MapOf.of("vehmaterial_id", IdUtil.getStringId(),"vehicle_code",vehileCode,"vehicle_status", StatusEnum.CACHE_VEL_ERR.getCode()
,"cacheline_code",cachelineCode,"err_type",StatusEnum.STATUS_TRUE.getCode()));
}
}
},cachelineCode,3);
RedissonUtils.lock(() -> {
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
JSONArray positionArr = positionTab.query("cacheline_code = '" + cachelineCode + "'").getResultJSONArray(0);
if(positionArr.size() == 0) {
log.warn("CacheLineHandServiceImpl#cacheLineMaterSync");
return;
}
// 缓存线位置表
Set<String> cacheLineVehiles = positionArr.stream().map(a -> ((JSONObject) a).getString("vehicle_code")).collect(Collectors.toSet());
JSONArray ivtArr = ivtTab.query("cacheline_code = '" + cachelineCode + "'").getResultJSONArray(0);
Set<String> relationVehiles = ivtArr.stream().map(a -> ((JSONObject) a).getString("vehicle_code")).collect(Collectors.toSet());
Collection<String> cacheLineVehilesSub = CollectionUtils.subtract(cacheLineVehiles, relationVehiles);
Collection<String> relationVehilesSub = CollectionUtils.subtract(relationVehiles, cacheLineVehiles);
if(!CollectionUtils.isEmpty(relationVehilesSub)) {
String sql = relationVehilesSub.stream().collect(Collectors.joining("','"));
ivtTab.delete("cacheline_code = '" + cachelineCode + "' and vehicle_code in ('" + sql + "')");
}
if(!CollectionUtils.isEmpty(cacheLineVehilesSub)) {
for(String vehileCode : cacheLineVehilesSub) {
ivtTab.insert(MapOf.of("vehmaterial_id", IdUtil.getStringId(), "vehicle_code", vehileCode, "vehicle_status", StatusEnum.CACHE_VEL_ERR.getCode(), "cacheline_code", cachelineCode, "err_type", StatusEnum.STATUS_TRUE.getCode()));
}
}
}, cachelineCode, 3);
}
/**
@@ -551,7 +597,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
if(StringUtils.isNotEmpty(posiObj.getString("task_id"))) {
throw new BadRequestException("未找到该缓存线的点位的任务信息!");
}
return WQLObject.getWQLObject("sch_base_task").query("task_id = '" + posiObj.getString("task_id") + "' ").getResultJSONArray(0);
return WQL.getWO("QSCH_TASK_01").addParam("flag", 10).addParam("task_id", posiObj.getString("task_id")).process().getResultJSONArray(0);
}
/**
@@ -571,57 +617,64 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
// 缓存线载具物料表
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
try {
//1.确定缓存线点位
JSONObject vehiobj = positionTab.query("position_code = " + position_code + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
//2.绑定新料箱条码(入满箱或者入空箱),设置缓存线点位不为空
vehiobj.put("vehicle_code", vehicle_code);
vehiobj.put("is_empty", "0");
positionTab.update(vehiobj);
//3.删除入料箱之前的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'");
//4.初始化料箱
HashMap<String,String> json = new HashMap<>();
json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", position_code);
json.put("vehmaterial_id", IdUtil.getStringId());
json.put("create_time", DateUtil.now());
// 入满箱扫码异常
if("1".equals(inOut_type)) {
//5.通过缓存线位置表当前执行任务id获取任务信息中的物料信息
JSONObject positionInfo = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
//获取当前任务信息
JSONObject instructObj = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + positionInfo.getString("task_id") + "'").uniqueResult(0);
//获取物料信息
JSONObject meObj = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + instructObj.get("material_id") + "'").uniqueResult(0);
//6.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息
json.put("material_uuid", meObj.getString("material_id"));
json.put("material_code", meObj.getString("material_code"));
json.put("material_spec", meObj.getString("material_spec"));
json.put("material_name", meObj.getString("material_name"));
json.put("quantity", instructObj.getString("material_qty"));
json.put("product_area", instructObj.getString("product_area"));
json.put("vehicle_status", "02");
//1.确定缓存线点位
JSONObject vehiobj = positionTab.query("position_code = " + position_code + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
//2.绑定新料箱条码(入满箱或者入空箱),设置缓存线点位不为空
vehiobj.put("vehicle_code", vehicle_code);
vehiobj.put("is_empty", "0");
positionTab.update(vehiobj);
//3.删除入料箱之前的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'");
//4.初始化料箱
HashMap<String,String> json = new HashMap<>();
json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", position_code);
json.put("vehmaterial_id", IdUtil.getStringId());
json.put("create_time", DateUtil.now());
// 入满箱扫码异常
if("1".equals(inOut_type)) {
//5.通过缓存线位置表当前执行任务id获取任务信息中的物料信息
JSONObject positionInfo = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
//查不到点位信息
if(null == positionInfo) {
throw new BadRequestException("未找到该缓存线的点位信息!");
}
// 出满箱扫码异常
if("2".equals(inOut_type)) {
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
json.put("vehicle_status", "01");
json.put("material_uuid", "");
json.put("material_code", "");
json.put("material_spec", "");
json.put("material_name", "");
json.put("weight", "0");
json.put("quantity", "0");
json.put("workprocedure_code", "");
json.put("workprocedure_name", "");
json.put("product_area", "");
//获取当前任务信息
JSONObject instructObj = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + positionInfo.getString("task_id") + "'").uniqueResult(0);
//查不到点位信息
if(null == instructObj) {
throw new BadRequestException("未找到该任务信息!");
}
ivtTab.insert(json);
//获取物料信息
JSONObject meObj = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + instructObj.get("material_id") + "'").uniqueResult(0);
//查不到点位信息
if(null == meObj) {
throw new BadRequestException("未找到该物料信息!");
}
//6.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息
json.put("material_uuid", meObj.getString("material_id"));
json.put("material_code", meObj.getString("material_code"));
json.put("material_spec", meObj.getString("material_spec"));
json.put("material_name", meObj.getString("material_name"));
json.put("quantity", instructObj.getString("material_qty"));
json.put("product_area", instructObj.getString("product_area"));
json.put("vehicle_status", "02");
}
catch(Exception e) {
throw new BadRequestException(e.getMessage());
// 出满箱扫码异常
if("2".equals(inOut_type)) {
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
json.put("vehicle_status", "01");
json.put("material_uuid", "");
json.put("material_code", "");
json.put("material_spec", "");
json.put("material_name", "");
json.put("weight", "0");
json.put("quantity", "0");
json.put("workprocedure_code", "");
json.put("workprocedure_name", "");
json.put("product_area", "");
}
ivtTab.insert(json);
}
/**
@@ -733,7 +786,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
public void cacheLineExcepOpt(JSONObject param) {
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
// 01-暂停、02-启动
// 1-暂停、2-启动
String opt_type = param.getString("opt_type");
// 类型:恢复是0暂停是1
String type = "1";
@@ -771,10 +824,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// 生产区域
String product_area = param.getString("product_area");
String where = "region_code = 'A1_HCX'";
JSONArray resultJSONArray = WQL.getWO("PDA_QUERY")
.addParamMap(MapOf.of("flag", "7", "product_area", product_area))
.process()
.getResultJSONArray(0);
JSONArray resultJSONArray = WQL.getWO("PDA_QUERY").addParamMap(MapOf.of("flag", "7", "product_area", product_area)).process().getResultJSONArray(0);
return resultJSONArray;
}
@@ -784,19 +834,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String pointCode = param.getString("point_code");
// 生产区域
String productArea = param.getString("product_area");
JSONArray res = WQL.getWO("PDA_QUERY")
.addParamMap(MapOf.of("flag", "8", "product_area", productArea, "cacheLine_code", pointCode))
.process()
.getResultJSONArray(0);
JSONArray res = WQL.getWO("PDA_QUERY").addParamMap(MapOf.of("flag", "8", "product_area", productArea, "cacheLine_code", pointCode)).process().getResultJSONArray(0);
return res;
}
@Override
public JSONArray getProductArea() {
JSONArray res = WQL.getWO("PDA_QUERY")
.addParamMap(MapOf.of("flag", "9"))
.process()
.getResultJSONArray(0);
JSONArray res = WQL.getWO("PDA_QUERY").addParamMap(MapOf.of("flag", "9")).process().getResultJSONArray(0);
return res;
}
}

View File

@@ -61,7 +61,7 @@
IF 输入.flag = "2"
QUERY
SELECT
workprocedure_id value,
workprocedure_id `value`,
workprocedure_name text,
workprocedure_code
FROM
@@ -79,7 +79,7 @@
IF 输入.flag = "3"
QUERY
SELECT
dict_id value,
dict_id `value`,
label text
FROM
sys_dict
@@ -96,7 +96,7 @@
IF 输入.flag = "4"
QUERY
SELECT
device_code value,
device_code `value`,
device_name text
FROM
`pdm_bi_device`
@@ -113,16 +113,16 @@
IF 输入.flag = "5"
QUERY
SELECT
mb.material_id,
mb.material_code,
mb.material_spec,
mb.material_name,
class.class_name
MB.MATERIAL_ID,
MB.MATERIAL_CODE,
MB.MATERIAL_SPEC,
MB.MATERIAL_NAME,
CLASS.CLASS_NAME
FROM
md_me_materialbase mb
LEFT JOIN MD_PB_ClassStandard class ON class.class_id = mb.material_type_id
MD_ME_MATERIALBASE MB
LEFT JOIN MD_PB_CLASSSTANDARD CLASS ON CLASS.CLASS_ID = MB.MATERIAL_TYPE_ID
WHERE
mb.is_delete = '0'
MB.IS_DELETE = '0'
ENDSELECT
ENDQUERY
ENDIF
@@ -212,6 +212,55 @@
ENDQUERY
ENDIF
IF 输入.flag = "10"
PAGEQUERY
select
task.task_id instruct_uuid,
task.task_code instructoperate_num,
task.task_name mes_no,
task.vehicle_code invehicle_code,
task.vehicle_code2 outvehicle_code,
task.create_time,
dict.label status_name,
mater.material_code processmaterial_code,
point1.point_name startpoint_code,
point2.point_name nextpoint_code,
point3.point_name nextpoint_code2
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 sys_dict dict on dict.`value` = task.task_status
and dict.`code` = 'task_status'
where
task.is_delete = '0'
OPTION 输入.status <> ""
find_in_set( task.task_status, 输入.status)
ENDOPTION
OPTION 输入.inst_num <> ""
(task.task_code like 输入.inst_num)
ENDOPTION
OPTION 输入.vehicle_code <> ""
(task.vehicle_code like 输入.vehicle_code)
ENDOPTION
OPTION 输入.start_point <> ""
(task.point_code1 like 输入.start_point)
ENDOPTION
OPTION 输入.end_point <> ""
(task.point_code2 like 输入.end_point)
ENDOPTION
OPTION 输入.start_date <> ""
task.create_time >= 输入.start_date
ENDOPTION
OPTION 输入.end_date <> ""
task.create_time <= 输入.end_date
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -61,7 +61,7 @@
FROM
sch_base_task task
LEFT JOIN md_pb_classstandard md ON task.task_type = md.class_code
LEFT JOIN sys_dict_detail dict ON dict.`value` = task.task_status AND dict.`name` = 'task_status'
LEFT JOIN SYS_DICT DICT ON DICT.`VALUE` = TASK.TASK_STATUS AND DICT.`CODE` = 'TASK_STATUS'
LEFT JOIN SCH_BASE_Region reg1 ON reg1.region_code = (
SELECT p1.region_code FROM SCH_BASE_Point p1 WHERE p1.point_code = task.point_code1
)