冲突
This commit is contained in:
@@ -44,8 +44,17 @@ public class CacheLineHandController{
|
||||
@Log("物料查询")
|
||||
@ApiOperation("物料查询")
|
||||
public CommonResult<List<MaterialDto>> materialQuery(@RequestBody JSONObject form) {
|
||||
String params = form.getString("search_bar");
|
||||
//任务类型和任务ID校验,instruct_uuid为前端参数命名,本来应为task_id
|
||||
if(StringUtils.isNotEmpty(params)) {
|
||||
//限制查询参数过短,模糊力度大
|
||||
int length = params.length();
|
||||
if(length < 3) {
|
||||
throw new BizCoreException("您输入的条件匹配的范围太大,请重新输入稍长一点的内容。");
|
||||
}
|
||||
}
|
||||
log.info("海亮缓存线手持服务 [查询物料] 接口被请求, 请求参数-{}", form);
|
||||
return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(form.getString("search_bar")));
|
||||
return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(params));
|
||||
}
|
||||
|
||||
@PostMapping("/queryMaterial")
|
||||
@@ -112,14 +121,14 @@ public class CacheLineHandController{
|
||||
@PostMapping("/instOperation")
|
||||
@Log("任务操作")
|
||||
@ApiOperation("任务操作")
|
||||
public CommonResult<Void> instOperation(@RequestBody JSONObject param) {
|
||||
public CommonResult<String> instOperation(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [任务操作] 接口被请求, 请求参数-{}", param);
|
||||
return RestBusinessTemplate.execute(() -> {
|
||||
//任务类型和任务ID校验,instruct_uuid为前端参数命名,本来应为task_id
|
||||
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("opt_type"))) {
|
||||
throw new BizCoreException(ResultCode.MISS_PARAMETER);
|
||||
}
|
||||
cacheLineHandService.instOperation(param);
|
||||
return cacheLineHandService.instOperation(param);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -138,10 +147,10 @@ public class CacheLineHandController{
|
||||
@PostMapping("/cacheLineOutBoxExceptionConfirm")
|
||||
@Log("缓存线出入箱异常-确认")
|
||||
@ApiOperation("缓存线出入箱异常-确认")
|
||||
public CommonResult<Void> cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) {
|
||||
public CommonResult<String> cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线出箱异常-确认] 接口被请求, 请求参数-{}", param);
|
||||
//参数校验
|
||||
if( 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));
|
||||
@@ -158,8 +167,12 @@ public class CacheLineHandController{
|
||||
@PostMapping("/inOutEmptyBox")
|
||||
@Log("空箱初始化--出入空箱")
|
||||
@ApiOperation("空箱初始化--出入空箱")
|
||||
public CommonResult<Void> inOutEmptyBox(@RequestBody JSONObject param) {
|
||||
public CommonResult<String> inOutEmptyBox(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param);
|
||||
//参数校验
|
||||
if(StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
|
||||
throw new BizCoreException(ResultCode.MISS_PARAMETER);
|
||||
}
|
||||
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutEmptyBox(param));
|
||||
}
|
||||
|
||||
@@ -167,15 +180,19 @@ public class CacheLineHandController{
|
||||
@Log("缓存线出入箱异常指令查询")
|
||||
@ApiOperation("缓存线出入箱异常指令查询")
|
||||
public CommonResult<JSONArray> inOutExceptionInstQuery(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被请求, 请求参数-{}", param);
|
||||
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被·请求, 请求参数-{}", param);
|
||||
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstQuery(param));
|
||||
}
|
||||
|
||||
@PostMapping("/inOutExceptionInstConfirm")
|
||||
@Log("缓存线出入箱异常指令确认")
|
||||
@ApiOperation("缓存线出入箱异常指令确认")
|
||||
public CommonResult<Void> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
|
||||
public CommonResult<String> 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.MISS_PARAMETER);
|
||||
}
|
||||
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstConfirm(param));
|
||||
}
|
||||
|
||||
@@ -246,7 +263,7 @@ public class CacheLineHandController{
|
||||
@PostMapping("/cacheLineExcepOpt")
|
||||
@Log("缓存线异常处理")
|
||||
@ApiOperation("缓存线异常处理")
|
||||
public CommonResult<Void> cacheLineExcepOpt(@RequestBody JSONObject param) {
|
||||
public CommonResult<String> cacheLineExcepOpt(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线异常处理] 接口被请求, 请求参数-{}", param);
|
||||
//参数校验
|
||||
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("opt_type"))) {
|
||||
|
||||
@@ -86,16 +86,6 @@ public interface CacheLineHandService{
|
||||
*/
|
||||
JSONArray instStatusQuery(String param);
|
||||
|
||||
/**
|
||||
* 任务操作
|
||||
*
|
||||
* @Param: form 任务参数
|
||||
* @return: 操作结果
|
||||
* @author gbx
|
||||
* @date 2023/3/23
|
||||
*/
|
||||
void instOperation(JSONObject param);
|
||||
|
||||
/**
|
||||
* 任务分页查询
|
||||
*
|
||||
@@ -104,7 +94,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);
|
||||
|
||||
/**
|
||||
* 缓存线位置关系同步
|
||||
@@ -124,15 +114,6 @@ public interface CacheLineHandService{
|
||||
*/
|
||||
JSONArray cacheLineMaterInfoQuery(JSONObject param);
|
||||
|
||||
/**
|
||||
* 空箱初始化--出入空箱
|
||||
*
|
||||
* @param param 查询参数 inOut_type:1 入空箱 2 出空箱 vehicle_code:载具编码
|
||||
* @author gbx
|
||||
* @date 2023/3/24
|
||||
*/
|
||||
void inOutEmptyBox(JSONObject param);
|
||||
|
||||
/**
|
||||
* 缓存线出入箱异常指令查询
|
||||
*
|
||||
@@ -150,7 +131,36 @@ public interface CacheLineHandService{
|
||||
* @author gbx
|
||||
* @date 2023/3/24
|
||||
*/
|
||||
void inOutExceptionInstConfirm(JSONObject param);
|
||||
String inOutExceptionInstConfirm(JSONObject param);
|
||||
|
||||
/**
|
||||
* 任务操作
|
||||
*
|
||||
* @Param: form 任务参数
|
||||
* @return: 操作结果
|
||||
* @author gbx
|
||||
* @date 2023/3/23
|
||||
*/
|
||||
String instOperation(JSONObject param);
|
||||
|
||||
/**
|
||||
* 缓存线出箱异常-确认
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return String 处理结果
|
||||
* @author gbx
|
||||
* @date 2023/3/24
|
||||
*/
|
||||
String cacheLineOutBoxExceptionConfirm(JSONObject param);
|
||||
|
||||
/**
|
||||
* 空箱初始化--出入空箱
|
||||
*
|
||||
* @param param 查询参数 inOut_type:1 入空箱 2 出空箱 vehicle_code:载具编码
|
||||
* @author gbx
|
||||
* @date 2023/3/24
|
||||
*/
|
||||
String inOutEmptyBox(JSONObject param);
|
||||
|
||||
/**
|
||||
* 设置满框
|
||||
@@ -208,15 +218,6 @@ public interface CacheLineHandService{
|
||||
*/
|
||||
void agvOutBoxExceptionConfirm(JSONObject param);
|
||||
|
||||
/**
|
||||
* 缓存线出箱异常-确认
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @author gbx
|
||||
* @date 2023/3/24
|
||||
*/
|
||||
void cacheLineOutBoxExceptionConfirm(JSONObject param);
|
||||
|
||||
/**
|
||||
* 设置缓存线货位为空位置
|
||||
*
|
||||
@@ -240,10 +241,11 @@ public interface CacheLineHandService{
|
||||
* 缓存线异常处理
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return String 处理结果
|
||||
* @author gbx
|
||||
* @date 2023/3/24
|
||||
*/
|
||||
void cacheLineExcepOpt(JSONObject param);
|
||||
String cacheLineExcepOpt(JSONObject param);
|
||||
|
||||
/**
|
||||
* 倒料操作
|
||||
@@ -256,6 +258,7 @@ public interface CacheLineHandService{
|
||||
|
||||
/**
|
||||
* 缓存线下拉框
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@@ -263,6 +266,7 @@ public interface CacheLineHandService{
|
||||
|
||||
/**
|
||||
* 缓存线物料信息盘点
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@@ -270,12 +274,14 @@ public interface CacheLineHandService{
|
||||
|
||||
/**
|
||||
* 获取生产区域下拉框
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONArray getProductArea();
|
||||
|
||||
/**
|
||||
* 删除箱子
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
void deleteBox(JSONObject param);
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.*;
|
||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.exception.BizCoreException;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -30,6 +31,7 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -71,6 +73,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
// stopWatch.start();
|
||||
// stopWatch.stop();
|
||||
// System.out.println("缓存本地花费时间 totalTime = " + stopWatch.getTotalTimeMillis());
|
||||
if(StringUtils.isEmpty(param)) {
|
||||
return WQL.getWO("PDA_QUERY").addParam("flag", "6").addParam("condition", param).process().getResultJSONArray(0).toJavaList(MaterialDto.class);
|
||||
}
|
||||
List<MaterialDto> materialList;
|
||||
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
|
||||
//12W种物料信息,查本地缓存
|
||||
@@ -81,7 +86,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
//2.查reids
|
||||
materialList = redisUtils.get("materialList", MaterialDto.class);
|
||||
if(null != materialList) {
|
||||
//设置本地缓存
|
||||
// //设置本地缓存
|
||||
cache.setLocalCache("materialList", materialList);
|
||||
return getMaterialDto(materialList, param);
|
||||
}
|
||||
@@ -110,7 +115,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
private List<MaterialDto> getMaterialDto(List<MaterialDto> materialList, String param) {
|
||||
if(StringUtils.isNotEmpty(param)) {
|
||||
//按条件搜索
|
||||
materialList = materialList.stream().filter(m -> (m.getMaterial_name().contains(param)) || m.getMaterial_code().contains(param) || m.getMaterial_spec().contains(param) || m.getClass_name().contains(param)).collect(Collectors.toList());
|
||||
materialList = materialList.stream().filter(m -> (m.getMaterial_name().indexOf(param) > -1) || (m.getMaterial_code().indexOf(param)) > -1 || (m.getMaterial_spec().indexOf(param)) > -1).collect(Collectors.toList());
|
||||
return materialList;
|
||||
}
|
||||
return materialList;
|
||||
@@ -184,25 +189,28 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void instOperation(JSONObject param) {
|
||||
public String instOperation(JSONObject param) {
|
||||
String optType = param.getString("opt_type");
|
||||
SpeMachineryTask SpeMachineryTask = new SpeMachineryTask();
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject taskObject = taskTab.query("task_id =" + param.getString("instruct_uuid")).uniqueResult(0);
|
||||
//01-取消、02-完成、03-任务下发,根据操作类型执行相关操作
|
||||
if("01".equals(optType) || "02".equals(optType)) {
|
||||
updateTaskStatus(taskObject, optType);
|
||||
if("1".equals(optType) || "2".equals(optType)) {
|
||||
return updateTaskStatus(taskObject, optType);
|
||||
}
|
||||
//任务下发
|
||||
if("03".equals(optType)) {
|
||||
SpeMachineryTask.createTask(taskObject);
|
||||
else if("3".equals(optType)) {
|
||||
return SpeMachineryTask.createTask(taskObject);
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务取消和完成操作,更新任务状态
|
||||
*/
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
public String updateTaskStatus(JSONObject taskObj, String status) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
HashMap<String,String> map = new HashMap<>(4);
|
||||
@@ -210,12 +218,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
map.put("update_optid", currentUserId);
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("sch_base_task").update(map, "task_id = '" + taskObj.getString("task_id") + "'");
|
||||
int result = (WQLObject.getWQLObject("sch_base_task").update(map, "task_id = '" + taskObj.getString("task_id") + "'").getSucess());
|
||||
return Integer.toString(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void cacheLineMaterSync(String cachelineCode) {
|
||||
public void cacheLineMaterSync(
|
||||
String cachelineCode) {
|
||||
if(StringUtils.isEmpty(cachelineCode)) {
|
||||
return;
|
||||
}
|
||||
@@ -264,13 +274,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
json.put("quantity", "0");
|
||||
//不展示
|
||||
if("0".equals(json.getString("is_show"))) {
|
||||
json.put("vehicle_status", "04");
|
||||
json.put("vehicle_status", "4");
|
||||
}
|
||||
//展示
|
||||
else{
|
||||
//是否空位
|
||||
if("1".equals(json.getString("is_empty"))) {
|
||||
json.put("vehicle_status", "00");
|
||||
json.put("vehicle_status", "0");
|
||||
}
|
||||
else{
|
||||
// 载具不是空位
|
||||
@@ -279,7 +289,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
JSONObject ivtObj = ivtTab.query("vehicle_code = '" + vehicle_code + "' and cacheLine_code like '%" + param.getString("wcsdevice_code") + "%'").uniqueResult(0);
|
||||
if(ivtObj == null) {
|
||||
//标记为红色异常
|
||||
json.put("vehicle_status", "03");
|
||||
json.put("vehicle_status", "3");
|
||||
}
|
||||
else{
|
||||
json.put("vehicle_status", ivtObj.getString("vehicle_status"));
|
||||
@@ -331,9 +341,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
WQLObject meTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
// 查询工序信息
|
||||
JSONObject wpObj = wpTab.query("workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(wpObj)) throw new BadRequestException("工序查询错误,请检查工序");
|
||||
if(ObjectUtil.isEmpty(wpObj)) {
|
||||
throw new BadRequestException("工序查询错误,请检查工序");
|
||||
}
|
||||
JSONObject meObj = meTab.query("material_id = '" + semimanufactures_uuid + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(meObj)) throw new BadRequestException("物料查询错误,请检查物料");
|
||||
if(ObjectUtil.isEmpty(meObj)) {
|
||||
throw new BadRequestException("物料查询错误,请检查物料");
|
||||
}
|
||||
vehiobj.put("vehicle_code", vehicle_code);
|
||||
//2.缓存线位置通过扫码绑定料箱条码
|
||||
positionTab.update(vehiobj);
|
||||
@@ -363,7 +377,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void setEmptyBox(JSONObject param) {
|
||||
public void setEmptyBox(
|
||||
JSONObject param) {
|
||||
// 缓存线位置编码
|
||||
String position_code = param.getString("position_code");
|
||||
// 载具条码
|
||||
@@ -415,10 +430,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
* 出入空箱,出入类型 inOut_type 1 入空箱 2 出空箱 缓存线编码 wcsdevice_code 料箱码 vehicle_code
|
||||
*/
|
||||
@Override
|
||||
public void inOutEmptyBox(JSONObject param) {
|
||||
public String inOutEmptyBox(JSONObject param) {
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
String cacheLine_code = param.getString("wcsdevice_code");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
String position_code = param.getString("position_code");
|
||||
int result = 1;
|
||||
// 缓存线位置表
|
||||
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
|
||||
//缓存线载具物料表
|
||||
@@ -431,30 +448,32 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
throw new BadRequestException("箱子【" + vehicle_code + "】已在库内,无法入空箱!");
|
||||
}
|
||||
// 3.判断是否可以放入空箱子
|
||||
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "' and is_blank= '1'").uniqueResult(0);
|
||||
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "position_code = '" + position_code + "' and is_blank= '1'").uniqueResult(0);
|
||||
if(json == null) {
|
||||
throw new BadRequestException("无法找到缓存线【" + cacheLine_code + "】的空位,无法入空箱!");
|
||||
throw new BadRequestException("无法找到缓存线【" + position_code + "】的空位,无法入空箱!");
|
||||
}
|
||||
// 3.入空箱子
|
||||
JSONObject afterIvt = new JSONObject();
|
||||
afterIvt.put("vehmaterial_id", IdUtil.getStringId());
|
||||
afterIvt.put("vehicle_code", vehicle_code);
|
||||
afterIvt.put("cacheLine_code", cacheLine_code);
|
||||
afterIvt.put("vehicle_status", "01");
|
||||
afterIvt.put("position_code", position_code);
|
||||
afterIvt.put("vehicle_status", "1");
|
||||
afterIvt.put("update_time", DateUtil.now());
|
||||
afterIvt.put("create_time", DateUtil.now());
|
||||
vehMaterTab.insert(afterIvt);
|
||||
result = vehMaterTab.insert(afterIvt).getSucess();
|
||||
}
|
||||
// 出空箱
|
||||
if("2".equals(inOut_type)) {
|
||||
// 缓存线载具物料表
|
||||
JSONObject json = vehMaterTab.query("cacheLine_code = '" + cacheLine_code + "' and vehicle_status= '01' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
||||
JSONObject json = vehMaterTab.query("cacheLine_code = '" + position_code + "' and vehicle_status= '1' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
||||
if(json == null) {
|
||||
throw new BadRequestException("无法找到缓存线【" + cacheLine_code + "】的空箱【" + vehicle_code + "】,出空箱失败");
|
||||
}
|
||||
// 删除掉出库的箱子及关联物料
|
||||
vehMaterTab.delete("cacheLine_code = '" + cacheLine_code + "' and vehicle_code = '" + vehicle_code + "'");
|
||||
result = vehMaterTab.delete("cacheLine_code = '" + position_code + "' and vehicle_code = '" + vehicle_code + "'").getSucess();
|
||||
}
|
||||
return Integer.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -465,53 +484,52 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
*/
|
||||
@Override
|
||||
public JSONArray inOutExceptionInstQuery(JSONObject param) {
|
||||
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
|
||||
// 出入类型 inOut_type
|
||||
// 缓存线编码 wcsdevice_code
|
||||
// 料箱码 vehicle_code
|
||||
// {"inOut_type":"1","wcsdevice_code":"HCX01","vehicle_code":"10001"}
|
||||
//料箱号
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
//缓存线编号
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
//出入箱类型
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
//任务表信息
|
||||
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONArray result = new JSONArray();
|
||||
// 入箱扫码异常
|
||||
if("1".equals(inOut_type)) {
|
||||
String where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '06'";
|
||||
String where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
|
||||
if(StringUtils.isNotBlank(vehicle_code)) {
|
||||
where = "point_code2 = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
|
||||
where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
|
||||
}
|
||||
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
|
||||
for(int i = 0; i < arr.size(); i++) {
|
||||
JSONObject row = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("instruct_uuid", row.getString("task_id"));
|
||||
json.put("instructorder_no", row.getString("instructorder_no"));
|
||||
json.put("instructorder_no", row.getString("task_code"));
|
||||
json.put("wcsdevice_code", row.getString("point_code2"));
|
||||
json.put("vehicle_code", row.getString("invehicle_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"));
|
||||
json.put("vehicle_code", row.getString("vehicle_code"));
|
||||
json.put("startpoint_code", row.getString("point_code1"));
|
||||
json.put("nextpoint_code", row.getString("point_code2"));
|
||||
json.put("nextpoint_code2", row.getString("point_code3"));
|
||||
result.add(json);
|
||||
}
|
||||
}
|
||||
// 出箱扫码异常
|
||||
if("2".equals(inOut_type)) {
|
||||
String where = "startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'";
|
||||
String where = "point_code1 = '" + wcsdevice_code + "' and task_status <> '7'";
|
||||
if(StringUtils.isNotBlank(vehicle_code)) {
|
||||
where = "startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
|
||||
where = "point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
|
||||
}
|
||||
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
|
||||
for(int i = 0; i < arr.size(); i++) {
|
||||
JSONObject row = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("instruct_uuid", row.getString("task_id"));
|
||||
json.put("instructorder_no", row.getString("instructorder_no"));
|
||||
json.put("vehicle_code", row.getString("outvehicle_code"));
|
||||
json.put("wcsdevice_code", row.getString("startwcsdevice_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"));
|
||||
json.put("instructorder_no", row.getString("task_code"));
|
||||
json.put("vehicle_code", row.getString("vehicle_code"));
|
||||
json.put("wcsdevice_code", row.getString("point_code1"));
|
||||
json.put("startpoint_code", row.getString("point_code1"));
|
||||
json.put("nextpoint_code", row.getString("point_code2"));
|
||||
json.put("nextpoint_code2", row.getString("point_code3"));
|
||||
result.add(json);
|
||||
}
|
||||
}
|
||||
@@ -526,26 +544,56 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void inOutExceptionInstConfirm(JSONObject param) {
|
||||
public String inOutExceptionInstConfirm(JSONObject param) {
|
||||
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
// 缓存线编码
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
//
|
||||
//缓存线点位
|
||||
String position_code = param.getString("position_code");
|
||||
//载具编码
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
// 指令标识
|
||||
// String instruct_uuid = param.getString("instruct_uuid");
|
||||
// JSONObject instObj = instructTab.query("task_id = '" + instruct_uuid +
|
||||
// "'").uniqueResult(0);
|
||||
// 封装给wcs的数据
|
||||
// 封装给acs的数据
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("inOut_type", inOut_type);
|
||||
jsonObject.put("wcsdevice_code", wcsdevice_code);
|
||||
jsonObject.put("vehicle_code", vehicle_code);
|
||||
jsonObject.put("position_code", position_code);
|
||||
jsonArray.add(jsonObject);
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
AcsUtil.notifyAcs("api", jsonArray);
|
||||
try {
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String cacheLineExcepOpt(JSONObject param) {
|
||||
// 缓存线编码
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
// 1-暂停、2-启动
|
||||
String opt_type = param.getString("opt_type");
|
||||
// 类型:恢复是0,暂停是1
|
||||
String type = "1";
|
||||
if("2".equals(opt_type)) {
|
||||
type = "0";
|
||||
}
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type", type);
|
||||
jsonObject.put("wcsdevice_code", wcsdevice_code);
|
||||
jsonArray.add(jsonObject);
|
||||
try {
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
|
||||
}
|
||||
catch(Exception e) {
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -558,7 +606,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
// 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);
|
||||
// JSONObject row = arr.getJSONObject(i);.
|
||||
// sd.append(row.getString("task_id")).append(",");
|
||||
// }
|
||||
// String taskIdList = sd.toString();
|
||||
@@ -567,16 +615,16 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
String position_code = param.getString("position_code");
|
||||
//根据缓存线编码和缓存线点位查找任务ID
|
||||
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("position_code = " + position_code + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
|
||||
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("position_code like '%" + position_code + "%'" + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
|
||||
//查不到点位信息
|
||||
if(null == posiObj) {
|
||||
throw new BadRequestException("未找到该缓存线的点位信息!");
|
||||
}
|
||||
//查不到任务信息
|
||||
if(StringUtils.isNotEmpty(posiObj.getString("task_id"))) {
|
||||
if(StringUtils.isEmpty(posiObj.getString("task_id"))) {
|
||||
throw new BadRequestException("未找到该缓存线的点位的任务信息!");
|
||||
}
|
||||
return WQL.getWO("QSCH_TASK_01").addParam("flag", 10).addParam("task_id", posiObj.getString("task_id")).process().getResultJSONArray(0);
|
||||
return WQL.getWO("PDA_QUERY").addParam("flag", "10").addParam("task_id", posiObj.getString("task_id")).process().getResultJSONArray(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -587,7 +635,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
* 料箱码 vehicle_code
|
||||
*/
|
||||
@Override
|
||||
public void cacheLineOutBoxExceptionConfirm(JSONObject param) {
|
||||
public String cacheLineOutBoxExceptionConfirm(JSONObject param) {
|
||||
String inOut_type = param.getString("inOut_type");
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
String position_code = param.getString("position_code");
|
||||
@@ -637,12 +685,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
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");
|
||||
json.put("vehicle_status", "2");
|
||||
}
|
||||
// 出满箱扫码异常
|
||||
if("2".equals(inOut_type)) {
|
||||
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
|
||||
json.put("vehicle_status", "01");
|
||||
json.put("vehicle_status", "1");
|
||||
json.put("material_uuid", "");
|
||||
json.put("material_code", "");
|
||||
json.put("material_spec", "");
|
||||
@@ -653,7 +701,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
json.put("workprocedure_name", "");
|
||||
json.put("product_area", "");
|
||||
}
|
||||
ivtTab.insert(json);
|
||||
int result = ivtTab.insert(json).getSucess();
|
||||
return Integer.toString(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -666,7 +715,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
|
||||
String where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
|
||||
if(StringUtils.isEmpty(vehicle_code)) {
|
||||
where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '7'";
|
||||
where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
|
||||
}
|
||||
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
|
||||
JSONArray result = new JSONArray();
|
||||
@@ -674,11 +723,11 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
JSONObject row = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("instruct_uuid", row.getString("task_id"));
|
||||
json.put("instructorder_no", row.getString("instructorder_no"));
|
||||
json.put("instructorder_no", row.getString("task_code"));
|
||||
json.put("wcsdevice_code", row.getString("point_code2"));
|
||||
json.put("startpoint_code", row.getString("startpoint_code"));
|
||||
json.put("nextpoint_code", row.getString("nextpoint_code"));
|
||||
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
|
||||
json.put("point_code1", row.getString("point_code1"));
|
||||
json.put("nextpoint_code", row.getString("point_code2"));
|
||||
json.put("nextpoint_code2", row.getString("point_code3"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
@@ -720,22 +769,22 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
JSONArray arr;
|
||||
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
|
||||
if(StringUtils.isEmpty(vehicle_code)) {
|
||||
arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'").getResultJSONArray(0);
|
||||
arr = instructTab.query("point_code1 = '" + wcsdevice_code + "' and task_status <> '7'").getResultJSONArray(0);
|
||||
}
|
||||
else{
|
||||
arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'").getResultJSONArray(0);
|
||||
arr = instructTab.query("point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'").getResultJSONArray(0);
|
||||
}
|
||||
JSONArray result = new JSONArray();
|
||||
for(int i = 0; i < arr.size(); i++) {
|
||||
JSONObject row = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("instruct_uuid", row.getString("task_id"));
|
||||
json.put("instructorder_no", row.getString("instructorder_no"));
|
||||
json.put("wcsdevice_code", row.getString("startwcsdevice_code"));
|
||||
json.put("vehicle_code", row.getString("outvehicle_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"));
|
||||
json.put("instructorder_no", row.getString("task_code"));
|
||||
json.put("wcsdevice_code", row.getString("point_code1"));
|
||||
json.put("vehicle_code", row.getString("vehicle_code"));
|
||||
json.put("startpoint_code", row.getString("point_code1"));
|
||||
json.put("nextpoint_code", row.getString("point_code2"));
|
||||
json.put("nextpoint_code2", row.getString("point_code3"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
@@ -761,26 +810,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
// inst.updateInstStatus(instObj, "2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cacheLineExcepOpt(JSONObject param) {
|
||||
// 缓存线编码
|
||||
String wcsdevice_code = param.getString("wcsdevice_code");
|
||||
// 1-暂停、2-启动
|
||||
String opt_type = param.getString("opt_type");
|
||||
// 类型:恢复是0,暂停是1
|
||||
String type = "1";
|
||||
if("02".equals(opt_type)) {
|
||||
type = "0";
|
||||
}
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("type", type);
|
||||
jsonObject.put("wcsdevice_code", wcsdevice_code);
|
||||
jsonArray.add(jsonObject);
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
AcsUtil.notifyAcs("api", jsonArray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pourMaterial(JSONObject param) {
|
||||
// 指令标识
|
||||
@@ -802,10 +831,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
public JSONArray getCacheLine(JSONObject param) {
|
||||
// 生产区域
|
||||
String product_area = param.getString("product_area");
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -833,6 +859,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
|
||||
public void deleteBox(JSONObject param) {
|
||||
WQLObject cvTab = WQLObject.getWQLObject("SCH_CacheLine_VehileMaterial");
|
||||
String vehicleCode = param.getString("vehicle_code");
|
||||
if (ObjectUtil.isNotEmpty(vehicleCode)) cvTab.delete("vehicle_code = '" + vehicleCode + "'");
|
||||
if(ObjectUtil.isNotEmpty(vehicleCode)) {
|
||||
cvTab.delete("vehicle_code = '" + vehicleCode + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
输入.condition TYPEAS s_string
|
||||
输入.cacheLine_code TYPEAS s_string
|
||||
输入.product_area TYPEAS s_string
|
||||
输入.status TYPEAS s_string
|
||||
输入.inst_num TYPEAS s_string
|
||||
输入.start_point TYPEAS s_string
|
||||
输入.end_point TYPEAS s_string
|
||||
输入.start_date TYPEAS s_string
|
||||
输入.end_date TYPEAS s_string
|
||||
输入.task_id TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -140,6 +148,9 @@
|
||||
LEFT JOIN MD_PB_ClassStandard class ON class.class_id = mb.material_type_id
|
||||
WHERE
|
||||
mb.is_delete = '0'
|
||||
ORDER BY
|
||||
mb.material_id desc
|
||||
LIMIT 1000
|
||||
OPTION 输入.condition <> ""
|
||||
mb.material_name LIKE CONCAT ('%', 输入.condition, '%')
|
||||
OR mb.material_code LIKE CONCAT ('%', 输入.condition, '%')
|
||||
@@ -239,17 +250,20 @@
|
||||
OPTION 输入.status <> ""
|
||||
find_in_set(task.task_status,输入.status)
|
||||
ENDOPTION
|
||||
OPTION 输入.inst_num <>""
|
||||
(task.task_code like 输入.inst_num)
|
||||
OPTION 输入.inst_num <> ""
|
||||
(task.task_code like CONCAT ('%', 输入.inst_num, '%'))
|
||||
ENDOPTION
|
||||
OPTION 输入.vehicle_code <> ""
|
||||
(task.vehicle_code like 输入.vehicle_code)
|
||||
(task.vehicle_code like CONCAT ('%', 输入.vehicle_code, '%'))
|
||||
ENDOPTION
|
||||
OPTION 输入.start_point <> ""
|
||||
(task.point_code1 like 输入.start_point)
|
||||
(task.point_code1 like CONCAT ('%', 输入.start_point, '%'))
|
||||
ENDOPTION
|
||||
OPTION 输入.task_id <> ""
|
||||
(task.task_id = 输入.task_id )
|
||||
ENDOPTION
|
||||
OPTION 输入.end_point <> ""
|
||||
(task.point_code2 like 输入.end_point)
|
||||
(task.point_code2 like CONCAT ('%', 输入.end_point, '%'))
|
||||
ENDOPTION
|
||||
OPTION 输入.start_date <> ""
|
||||
task.create_time >= 输入.start_date
|
||||
|
||||
@@ -53,8 +53,8 @@ public class SpeMachineryTask extends AbstractAcsTask {
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
String next_point_code = form.getString("next_point_code");
|
||||
String start_point_code = form.getString("point_code1");
|
||||
String next_point_code = form.getString("point_code2");
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
String type = form.getString("type");
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
@@ -68,7 +68,6 @@ public class SpeMachineryTask extends AbstractAcsTask {
|
||||
}
|
||||
String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("taskdtl_id", taskdtl_id);
|
||||
task.put("task_id", taskdtl_id);
|
||||
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
task.put("task_type", type);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user