1.修改缓存线初入箱异常查询,确认处理接口。

2.增加ACSTOWMS发送任务编号,更新任务实时信息到缓存线点位表。
3.物料数据量大,模糊查询接口比较慢,在物料,新增,修改,删除,同步时异步更新redis,保证物料信息实时性。
This commit is contained in:
2023-03-25 18:00:28 +08:00
parent a267bc14ea
commit ae1e6076b2
7 changed files with 329 additions and 306 deletions

View File

@@ -6,8 +6,11 @@ import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.anno.Log;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.api.ResultCode;
import org.nl.modules.common.exception.BizCoreException;
import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -37,6 +40,17 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.apply(whereJson), HttpStatus.OK);
}
@PostMapping("/receiveTaskIdToCacheLine")
@Log("ACS给WMS发送缓存线的实时任务ID")
@ApiOperation("ACS给WMS发送缓存线的实时任务ID")
public ResponseEntity<Object> receiveTaskIdToCacheLine(@RequestBody JSONObject whereJson) {
//参数校验
if(StringUtils.isEmpty(whereJson.getString("task_id")) || StringUtils.isEmpty(whereJson.getString("position_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return new ResponseEntity<>(acsToWmsService.receiveTaskIdToCacheLine(whereJson), HttpStatus.OK);
}
@PostMapping("/status")
@Log("ACS给WMS反馈任务状态")
@ApiOperation("ACS给WMS反馈任务状态")
@@ -58,10 +72,15 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.feedDeviceStatusType(string), HttpStatus.OK);
}
@PostMapping("/feedOrderRealQty")
@Log("向wms反订单实施数量")
@ApiOperation("向wms反订单实施数量")
public ResponseEntity<Object> feedOrderRealQty(@RequestBody String string) {
return new ResponseEntity<>(acsToWmsService.feedOrderRealQty(string), HttpStatus.OK);
}
}

View File

@@ -16,6 +16,18 @@ public interface AcsToWmsService {
Map<String, Object> apply(JSONObject jsonObject);
/**
*
* ACS客户端--->WMS服务端
* ACS给WMS发送缓存线的实时任务ID
* @param jsonObject 条件1.缓存线点位编码:position_code,2.任务id:task_id
* @return JSONObject
* @author gbx
* @date 2023/3/25
*/
JSONObject receiveTaskIdToCacheLine(JSONObject jsonObject);
/**
* ACS客户端--->WMS服务端
* ACS向WMS反馈任务状态

View File

@@ -57,6 +57,34 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result;
}
/**
* 更新缓存线的点位实时任务信息
* ACS给WMS发送缓存线的实时任务ID
* @param jsonObject position_code缓存线点位编码 task_id任务id
*/
@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");
//缓存线位置表
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
json.put("position_code", positionCode);
json.put("task_id", taskId);
//更新缓存线的点位实时任务信息
positionTab.update(json);
}
catch(Exception e) {
result.put("status", 400);
result.put("message", e.getMessage());
}
result.put("status", HttpStatus.OK.value());
result.put("message", "设备状态反馈成功");
return result;
}
/**
* task_uuid任务标识
* task_code任务编码

View File

@@ -1,4 +1,5 @@
package org.nl.wms.pda.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -19,11 +20,13 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* 海亮缓存线手持服务
* 返回数据CommonResult,code,desc,result是因为原有对接文档给前端返回格式要求保留所以就包了一层。
*
* @author gbx
* @since 2023/3/22
@@ -45,6 +48,14 @@ public class CacheLineHandController{
return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(form.getString("search_bar")));
}
@PostMapping("/queryMaterial")
@Log("物料模糊查询")
@ApiOperation("物料模糊查询")
public CommonResult<JSONArray> queryMaterial(@RequestBody JSONObject form) {
log.info("海亮缓存线手持服务 [查询物料] 接口被请求, 请求参数-{}", form);
return RestBusinessTemplate.execute(() -> cacheLineHandService.queryMaterial(form.getString("search_bar")));
}
@PostMapping("/semiMaterialSpecQuery")
@Log("规格下拉框查询")
@ApiOperation("规格下拉框查询")
@@ -80,7 +91,7 @@ public class CacheLineHandController{
@PostMapping("/instPageQuery")
@Log("任务分页查询")
@ApiOperation("任务分页数据")
public CommonResult<Object> instPageQuery(@RequestBody Map param, Pageable page) {
public CommonResult<Object> instPageQuery(@RequestBody Map<String,String> param, Pageable page) {
log.info("海亮缓存线手持服务 [任务分页查询] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
if(null == param) {
@@ -112,6 +123,30 @@ public class CacheLineHandController{
});
}
@PostMapping("/cacheLineOutBoxExceptionQuery")
@Log("缓存线出箱异常-查询")
@ApiOperation("缓存线出箱异常-查询")
public CommonResult<JSONArray> cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("position_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineOutBoxExceptionQuery(param));
}
@PostMapping("/cacheLineOutBoxExceptionConfirm")
@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"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineOutBoxExceptionConfirm(param));
}
@PostMapping("/cacheLineMaterInfoQuery")
@Log("缓存线料箱条码查询料箱信息")
@ApiOperation("缓存线料箱条码查询料箱信息")
@@ -125,9 +160,7 @@ public class CacheLineHandController{
@ApiOperation("空箱初始化--出入空箱")
public CommonResult<Void> inOutEmptyBox(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.inOutEmptyBox(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutEmptyBox(param));
}
@PostMapping("/inOutExceptionInstQuery")
@@ -143,9 +176,7 @@ public class CacheLineHandController{
@ApiOperation("缓存线出入箱异常指令确认")
public CommonResult<Void> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令确认] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.inOutExceptionInstConfirm(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstConfirm(param));
}
@PostMapping("/setfullBox")
@@ -153,9 +184,7 @@ public class CacheLineHandController{
@ApiOperation("设置满框")
public CommonResult<Void> setfullBox(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [设置满框] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.setfullBox(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.setfullBox(param));
}
@PostMapping("/setEmptyBox")
@@ -163,9 +192,7 @@ public class CacheLineHandController{
@ApiOperation("设置空框")
public CommonResult<Void> setEmptyBox(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [设置空框] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.setEmptyBox(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.setEmptyBox(param));
}
@PostMapping("/agvInBoxExceptionQuery")
@@ -181,9 +208,7 @@ public class CacheLineHandController{
@ApiOperation("AGV入箱异常-确认")
public CommonResult<Void> agvInBoxExceptionConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [AGV入箱异常-确认] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.agvInBoxExceptionConfirm(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.agvInBoxExceptionConfirm(param));
}
@PostMapping("/agvOutBoxExceptionQuery")
@@ -199,19 +224,7 @@ public class CacheLineHandController{
@ApiOperation("AGV出箱异常-确认")
public CommonResult<Void> agvOutBoxExceptionConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [AGV出箱异常-确认] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.agvOutBoxExceptionConfirm(param);
});
}
@PostMapping("/cacheLineOutBoxExceptionConfirm")
@Log("缓存线出箱异常-确认")
@ApiOperation("缓存线出箱异常-确认")
public CommonResult<Void> cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-确认] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.cacheLineOutBoxExceptionConfirm(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.agvOutBoxExceptionConfirm(param));
}
@PostMapping("/setBlankPos")
@@ -219,17 +232,7 @@ public class CacheLineHandController{
@ApiOperation("设置缓存线货位为空位置")
public CommonResult<Void> setBlankPos(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [设置缓存线货位为空位置] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.setBlankPos(param);
});
}
@PostMapping("/cacheLineOutBoxExceptionQuery")
@Log("缓存线出箱异常-查询")
@ApiOperation("缓存线出箱异常-查询")
public CommonResult<JSONArray> cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineOutBoxExceptionQuery(param));
return RestBusinessTemplate.execute(() -> cacheLineHandService.setBlankPos(param));
}
@PostMapping("/cacheLineExcepOpt")
@@ -237,9 +240,7 @@ public class CacheLineHandController{
@ApiOperation("缓存线异常处理")
public CommonResult<Void> cacheLineExcepOpt(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线异常处理] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.cacheLineExcepOpt(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineExcepOpt(param));
}
@PostMapping("/pourMaterial")
@@ -247,8 +248,6 @@ public class CacheLineHandController{
@ApiOperation("倒料操作")
public CommonResult<Void> pourMaterial(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [倒料操作] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> {
cacheLineHandService.pourMaterial(param);
});
return RestBusinessTemplate.execute(() -> cacheLineHandService.pourMaterial(param));
}
}

View File

@@ -1,8 +1,10 @@
package org.nl.wms.pda.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.pda.dto.MaterialDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
@@ -16,8 +18,9 @@ public interface CacheLineHandService{
/**
* 下拉框列表查询
*
* @Param: form 查询条件
* @return: 下拉框列表
* @return 下拉框列表
* @Param form 查询条件
* @Param type 下拉框类型
* @author gbx
* @date 2023/3/22
*/
@@ -33,6 +36,16 @@ public interface CacheLineHandService{
*/
List<MaterialDto> materialQuery(String param);
/**
* 物料模糊查询
*
* @Param: param 查询条件
* @return: 物料列表
* @author gbx
* @date 2023/3/25
*/
JSONArray queryMaterial(String param);
/**
* 规格下拉框查询
*
@@ -86,8 +99,8 @@ public interface CacheLineHandService{
/**
* 任务分页查询
*
* @Param: form 任务参数
* @return: 分页列表
* @return 分页列表
* @Param form 任务参数
* @author gbx
* @date 2023/3/23
*/
@@ -214,6 +227,8 @@ public interface CacheLineHandService{
void setBlankPos(JSONObject param);
/**
* 缓存线出箱异常-查询
*
* @param param 查询参数
* @return 返回结果集
* @author gbx

View File

@@ -10,6 +10,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.nl.common.utils.AcsUtil;
import org.nl.common.utils.LocalCache;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.thread.ThreadPoolExecutorUtil;
@@ -30,7 +31,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -56,6 +56,11 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
return WQL.getWO("PDA_QUERY").addParam("flag", type).addParam("condition", param).process().getResultJSONArray(0);
}
@Override
public JSONArray queryMaterial(String param) {
return WQL.getWO("PDA_QUERY").addParam("flag", "6").addParam("condition", param).process().getResultJSONArray(0);
}
@Override
public List<MaterialDto> materialQuery(String param) {
// StopWatch stopWatch = new StopWatch();
@@ -101,7 +106,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().indexOf(param) > -1) || (m.getMaterial_code().indexOf(param)) > -1 || (m.getMaterial_spec().indexOf(param)) > -1 || (m.getClass_name().indexOf(param)) > -1).collect(Collectors.toList());
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());
return materialList;
}
return materialList;
@@ -154,7 +159,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
public void updateTaskStatus(JSONObject taskObj, String status) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
HashMap<String,String> map = new HashMap<String,String>(4);
HashMap<String,String> map = new HashMap<>(4);
map.put("task_status", status);
map.put("update_optid", currentUserId);
map.put("update_optname", nickName);
@@ -173,9 +178,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// 缓存线载具物料表
List<CachelineVehileMaterialDto> ivtList = ivtArr.toJavaList(CachelineVehileMaterialDto.class);
//取缓存线位置表多出来的物料
List<CachelineVehileMaterialDto> resultList = positionList.stream().filter(p -> !ivtList.stream().map(e -> e.getCacheLine_code() + "&" + e.getVehicle_code()).collect(Collectors.toList()).contains(p.getCacheLine_code() + "&" + p.getVehicle_code())).collect(Collectors.toList());
List<CachelineVehileMaterialDto> resultList = positionList.stream().filter(p -> !ivtList.stream().map(e -> e.getPosition_code() + "&" + e.getVehicle_code()).collect(Collectors.toList()).contains(p.getPosition_code() + "&" + p.getVehicle_code())).collect(Collectors.toList());
//取载具物料表多出来的物料
List<CachelineVehileMaterialDto> resultLists = ivtList.stream().filter(i -> !positionList.stream().map(e -> e.getCacheLine_code() + "&" + e.getVehicle_code()).collect(Collectors.toList()).contains(i.getCacheLine_code() + "&" + i.getVehicle_code())).collect(Collectors.toList());
List<CachelineVehileMaterialDto> resultLists = ivtList.stream().filter(i -> !positionList.stream().map(e -> e.getPosition_code() + "&" + e.getVehicle_code()).collect(Collectors.toList()).contains(i.getPosition_code() + "&" + i.getVehicle_code())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(resultList)) {
//TODO 缓存线位置表多出来的物料处理
}
@@ -186,7 +191,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
/**
* 0空位 status = 1 绿色空箱 || status = 2黄色满箱 || status = 3:红色异常 || status = 4 :不
* status = 0: 空位 status = 1 绿色空箱 || status = 2黄色满箱 || status = 3:红色异常 || status = 4 :不
*/
@Override
public JSONArray cacheLineMaterInfoQuery(JSONObject param) {
@@ -196,7 +201,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// 获取缓存线物料库存信息
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
for(int i = 0; i < arr.size(); i++) {
// 0 空位 status = 1 绿色空箱 || status = 2黄色满箱 || status = 3:红色异常 || status = 4 :不展示
JSONObject json = arr.getJSONObject(i);
//料箱展示顺序号
json.put("seat_order_num", json.getString("order_no"));
@@ -230,15 +234,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
}
}
//TOFIX 无此状态,这个状态对应什么意思? 是否为is_active 是否可用
json.put("is_err", "0");
json.put("cacheLine_code", json.getString("cacheLine_code"));
json.put("weight", NumberUtil.mul(json.getString("weight"), "1"));
json.put("status", json.getString("vehicle_status").substring(1, 2));
//异常类型
if(!"00".equals(json.getString("err_type"))) {
json.put("is_err", "1");
}
}
return arr;
}
@@ -285,16 +283,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONObject meObj = meTab.query("material_id = '" + semimanufactures_uuid + "'").uniqueResult(0);
//查找物料分类信息
String materialprocess_series = corrTab.query("class_id = '" + meObj.getString("material_type_id") + "'").uniqueResult(0).getString("class_name");
//伪代码
String cachelineCode2 = "";
//TOFIX 这个是调用什么? 通过物料分类信息和工序编码查询缓存线编码? 这里主要提示该缓存线位置不能存放非法物料
// AgvTwoInst inst = new AgvTwoInst();
// String cachelineCode2 = inst.getCachelineCode(materialprocess_series, wpObj.getString("workprocedure_code"));
//1.检查该缓存线位置是否存放非法物料
if(!wcsdevice_code.equals(cachelineCode2)) {
String materialprocess_seriesname = WQLObject.getWQLObject("PF_PB_SysDicInfo").query("sysdic_type = 'IF_WCS_DEVICESERIES' and sysdic_code = '" + materialprocess_series + "'").uniqueResult(0).getString("sysdic_name");
throw new BadRequestException("该缓存线【" + wcsdevice_code + "】不能存放【" + materialprocess_seriesname + "】物料,操作失败!");
}
//TOFIX
// AgvTwoInst inst = new AgvTwoInst();
// String cachelineCode2 = inst.getCachelineCode(materialprocess_series, wpObj.getString("workprocedure_code"));
// 1.检查该缓存线位置是否存放非法物料
// if(!wcsdevice_code.equals(cachelineCode2)) {
// String materialprocess_seriesname = WQLObject.getWQLObject("PF_PB_SysDicInfo").query("sysdic_type = 'IF_WCS_DEVICESERIES' and sysdic_code = '" + materialprocess_series + "'").uniqueResult(0).getString("sysdic_name");
// throw new BadRequestException("该缓存线【" + wcsdevice_code + "】不能存放【" + materialprocess_seriesname + "】物料,操作失败!");
// }
vehiobj.put("vehicle_code", vehicle_code);
//2.缓存线位置通过扫码绑定料箱条码
positionTab.update(vehiobj);
@@ -303,7 +299,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
//3.先删除料箱的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'");
// 物料信息
HashMap<String,String> json = new HashMap<String,String>();
HashMap<String,String> json = new HashMap<>();
json.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr());
json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", wcsdevice_code);
@@ -351,7 +347,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", wcsdevice_code);
json.put("vehicle_status", "01");
json.put("vehicle_code", vehicle_code);
json.put("material_uuid", "");
json.put("material_code", "");
json.put("material_spec", "");
@@ -429,36 +424,36 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
/**
* 1 扫码异常-入箱扫码 2 扫码异
* 出入类型 inOut_type
* 缓存线编码 wcsdevice_c
* 出入类型 inOut_type 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
* 缓存线编码 wcsdevice_code
* 缓存线位置编码 position_code
* 料箱码 vehicle_code
* {"inOut_type":"1","wcsdevice_code":"HCX01","vehicle_code":"10001"}
*/
@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");
//TOFIX sch_base_task 指令点位表 对应的sch_base_task?
//TOFIX 是通过料箱号关联载具物料表取得缓存线ID吗 但有两个料箱编码 vehicle_code和vehicle_code1,取vehicle_code吗 instruct_status <> '06'是执行中吗?
//TOFIX nextwcsdevice_code
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint");
JSONArray result = new JSONArray();
// 入箱扫码异常
if("1".equals(inOut_type)) {
String where = "nextwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'";
String where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '06'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "nextwcsdevice_code = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
where = "point_code2 = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
}
//任务里根据缓存线ID和料箱ID找关联该缓存线和料箱的那些任务
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("instruct_uuid"));
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("wcsdevice_code", row.getString("nextwcsdevice_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"));
@@ -468,17 +463,15 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
// 出箱扫码异常
if("2".equals(inOut_type)) {
//TOFIX nextwcsdevice_code
String where = "startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
}
//任务里根据缓存线ID和料箱ID找关联该缓存线和料箱的那些任务
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("instruct_uuid"));
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"));
@@ -492,12 +485,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
/**
* "inOut_type": "1",1 扫码异常-入箱扫码,2 扫码异常-出箱扫码 "wcsdevice_code": "HCX01",
* "vehicle_code": "10001", "instruct_uuid": "uuid_0101" }
* 出入类型 inOut_type 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
* 缓存线编码 wcsdevice_code
* 缓存线位置编码 position_code
* 料箱码 vehicle_code
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void inOutExceptionInstConfirm(JSONObject param) {
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
String inOut_type = param.getString("inOut_type");
// 缓存线编码
@@ -506,15 +501,118 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String vehicle_code = param.getString("vehicle_code");
// 指令标识
// String instruct_uuid = param.getString("instruct_uuid");
// JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid +
// JSONObject instObj = instructTab.query("task_id = '" + instruct_uuid +
// "'").uniqueResult(0);
// 封装给wcs的数据
Object[] data = new Object[3];
data[0] = inOut_type;
data[1] = wcsdevice_code;
data[2] = vehicle_code;
//TOFIX 补充入箱扫码,出箱扫码异常处理接口
//uWcsSchedule.notifyWcs(99, 3001, data);
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);
jsonArray.add(jsonObject);
//TOFIX 等确定api后换成下发的url
AcsUtil.notifyAcs("api", jsonArray);
}
/**
* 缓存线出箱异常-查询
* 缓存线编码 wcsdevice_code
* 缓存线位置编码 position_code
*/
@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
JSONObject posiObj = WQLObject.getWQLObject("sch_cacheline_position").query("position_code = " + position_code + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
//查不到点位信息
if(null == posiObj) {
throw new BadRequestException("未找到该缓存线的点位信息!");
}
//查不到任务信息
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);
}
/**
* 缓存线出箱异常确认
* 出入类型 inOut_type:1.入满箱异常,2.出满箱异常
* 缓存线位置编码 wcsdevice_code
* 缓存线点位编码 position_code
* 料箱码 vehicle_code
*/
@Override
public void cacheLineOutBoxExceptionConfirm(JSONObject param) {
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");
//缓存线位置表
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_uuid", IdUtil.getSnowflake(1, 1).nextIdStr());
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");
}
// 出满箱扫码异常
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);
}
catch(Exception e) {
throw new BadRequestException(e.getMessage());
}
}
/**
@@ -525,19 +623,18 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String vehicle_code = param.getString("vehicle_code");
String wcsdevice_code = param.getString("wcsdevice_code");
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
//TOFIX nextwcsdevice_code ?
String where = "nextwcsdevice_code = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
String where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
if(StringUtils.isEmpty(vehicle_code)) {
where = "nextwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'";
where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '7'";
}
JSONArray arr = instructTab.query(where).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("instruct_uuid"));
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("wcsdevice_code", row.getString("nextwcsdevice_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"));
@@ -555,7 +652,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
@Override
public void agvInBoxExceptionConfirm(JSONObject param) {
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
String instruct_uuid = param.getString("instruct_uuid");
String instruct_uuid = param.getString("task_id");
String cacheLine_code = param.getString("wcsdevice_code");
String empty_vehicle_code = param.getString("empty_vehicle_code");
String full_vehicle_code = param.getString("full_vehicle_code");
@@ -563,66 +660,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
// 缓存线载具物料表
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
/*
* JSONObject emptyObj = positionTab
* .query("is_active = '1' and is_delete = '0' and vehicle_code = '" +
* empty_vehicle_code + "'") .uniqueResult(0);
*
* // 判断箱子是否存在 if (emptyObj == null) { throw new BadRequestException("条码【" +
* empty_vehicle_code + "】不存在,操作失败"); return null; } JSONObject fullObj =
* positionTab .query("is_active = '1' and is_delete = '0' and vehicle_code = '"
* + full_vehicle_code + "'") .uniqueResult(0); // 判断箱子是否存在 if (fullObj == null)
* { throw new BadRequestException("条码【" + full_vehicle_code + "】不存在,操作失败");
* return null; }
*/
JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0);
// 出的空箱子
/*
* JSONObject emptyBoxObj =
* ivtTab.query("vehicle_status = '01' AND cacheLine_code = '" + cacheLine_code
* + "' and outvehicle_code = '" + empty_vehicle_code + "'").uniqueResult(0); if
* (emptyBoxObj == null ||
* StringUtils.isEmpty(emptyBoxObj.getString("vehicle_code"))) {
* throw new BadRequestException("缓存线内的空箱:" + empty_vehicle_code + "不存在,操作失败"); return null; }
*
* // 找到空位子入满箱 JSONObject fullBoxObj =
* ivtTab.query("is_blank = '1' AND cacheLine_code = '" + cacheLine_code + "'")
* .uniqueResult(0); if (fullBoxObj == null) {
* throw new BadRequestException("在缓存线:" + cacheLine_code + "未找到可用的货位进行满箱入库!"); return null; }
*/
// 删除出的空箱
/*
* ivtTab.delete(("vehicle_status = '01' AND cacheLine_code = '" +
* cacheLine_code + "' and vehicle_code = '" + empty_vehicle_code + "'")); //
* 更新入库物料信息 JSONObject afterIvt = new JSONObject();
* afterIvt.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); afterIvt.put("vehicle_code",
* afterIvt.put("vehicle_status", "02"); afterIvt.put("produceorder_uuid",
* instObj.getString("produceorder_uuid")); afterIvt.put("produceorder_code",
* instObj.getString("produceorder_code")); afterIvt.put("workprocedure_uuid",
* instObj.getString("startworkprocedure_uuid"));
* afterIvt.put("workprocedure_code",
* instObj.getString("startworkprocedure_code"));
* afterIvt.put("workprocedure_name",
* instObj.getString("startworkprocedure_name")); afterIvt.put("material_uuid",
* instObj.getString("processmaterial_uuid")); afterIvt.put("material_code",
* instObj.getString("processmaterial_code")); afterIvt.put("material_name",
* instObj.getString("processmaterial_name")); afterIvt.put("material_spec",
* instObj.getString("processmaterial_spec"));
* afterIvt.put("deviceprocess_series",
* instObj.getString("deviceprocess_series")); afterIvt.put("quantity",
* instObj.getString("quantity")); afterIvt.put("weight",
* instObj.getString("weight")); afterIvt.put("update_time", DateUtil.now());
* afterIvt.put("create_time", DateUtil.now());
*
* ivtTab.insert(afterIvt);
*/
//TOFIX 此逻辑疑问
// AgvTwoInst inst = new AgvTwoInst();
JSONObject instObj = instructTab.query("task_id = '" + instruct_uuid + "'").uniqueResult(0);
//TOFIX
//AgvTwoInst inst = new AgvTwoInst();
instObj.put("inboxtxm", full_vehicle_code);
instObj.put("outboxtxm", empty_vehicle_code);
// inst.updateInstStatus(instObj, "1");
// inst.updateInstStatus(instObj, "2");
// inst.updateInstStatus(instObj, "1");
// inst.updateInstStatus(instObj, "2");
}
/**
@@ -632,7 +676,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
public JSONArray agvOutBoxExceptionQuery(JSONObject param) {
String vehicle_code = param.getString("vehicle_code");
String wcsdevice_code = param.getString("wcsdevice_code");
JSONArray arr = new JSONArray();
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);
@@ -644,7 +688,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("instruct_uuid"));
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"));
@@ -665,132 +709,15 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
String instruct_uuid = param.getString("instruct_uuid");
String vehicle_code = param.getString("vehicle_code");
String cacheLine_code = param.getString("wcsdevice_code");
JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0);
/*
* // 缓存线载具物料表【sch_cacheline_vehilematerial】 WQLObject ivtTab =
* WQLObject.getWQLObject("sch_cacheline_vehilematerial"); //
* 缓存线位置表【sch_cacheline_position】 WQLObject positionTab =
* WQLObject.getWQLObject("sch_cacheline_position"); // 查看是否有空位入 JSONObject
* positionObj = positionTab.query("is_blank = '1' AND cacheLine_code = '" +
* cacheLine_code + "'") .uniqueResult(0);
*
* if (positionObj == null) {
* throw new BadRequestException("缓存线无剩余位置,操作失败"); return null;
*
* }
*
* // 入的空箱子 JSONObject afterIvt = new JSONObject();
* vehicle_code); afterIvt.put("vehicle_code", vehicle_code);
* afterIvt.put("cacheLine_code", cacheLine_code);
*
* afterIvt.put("vehicle_status", "01"); afterIvt.put("produceorder_uuid", "");
* afterIvt.put("produceorder_code", ""); afterIvt.put("workprocedure_uuid",
* ""); afterIvt.put("workprocedure_code", "");
* afterIvt.put("workprocedure_name", ""); afterIvt.put("material_uuid", "");
* afterIvt.put("material_code", ""); afterIvt.put("material_name", "");
* afterIvt.put("material_spec", ""); afterIvt.put("deviceprocess_series", "");
* afterIvt.put("quantity", "0"); afterIvt.put("weight", "0");
* afterIvt.put("update_time", DateUtil.now()); ivtTab.insert(afterIvt);
*/
//TOFIX 此逻辑疑问
JSONObject instObj = instructTab.query("task_id = '" + instruct_uuid + "'").uniqueResult(0);
//TOFIX
// AgvTwoInst inst = new AgvTwoInst();
// inst.updateInstStatus(instObj, "1");
// 出箱的时候入箱码和出箱码相同
//出箱的时候入箱码和出箱码相同
instObj.put("inboxtxm", vehicle_code);
instObj.put("outboxtxm", vehicle_code);
// inst.updateInstStatus(instObj, "1");
// inst.updateInstStatus(instObj, "2");
}
/**
* 缓存线出箱异常查询
* <p>
* {"wcsdevice_code":"HCX01","agv_no":"2"}
* <p>
* 入满箱查找空箱,出满箱查找满箱时,如果电气经过一圈后查找不到指定条码的箱子,则报警提示; 入满箱空箱找不到: 1、
* 人工先将满箱拿下放在缓存线边上,然后人工找个有条码的空箱拿到满箱的专机上; 2、
* 通过手持选择缓存线设备输入agv车号查询出agv正在执行的指令点击确认按钮mes完成该任务进行满箱物料条码和缓存线设备的绑定同时wcs和agv删除指令。
* <p>
* 3、 Mes系统需要将指令中下发的空箱条码全部设置为异常指令也标识为异常 4、
* 人工还需要将缓存线锁定的任务状态进行复位操作,不影响其他任务的进行;(只有先复位,才能进行盘点,两者冲突) 5、
* 此时空箱说明已经没有了,管理人员必须立即处理,进行盘点检查缓存线物料和箱子信息,通过手持盘点操作保证缓存线有空箱,才能让缓存线设备继续进行出入操作。
* 出满箱找不到满箱: 1、
* 通过手持选择缓存线设备输入agv车号查询出agv正在执行的指令点击确认按钮mes将指令标识为异常同时wcs和agv删除指令。 2、
* Mes系统需要将指令中下发的满箱条码全部设置为异常 3、
* 人工还需要将缓存线锁定的任务状态进行复位操作,不影响其他任务的进行;(只有先复位,才能进行盘点,两者冲突) 4、
* 此时满箱说明已经没有了管理人员必须立即处理进行盘点检查缓存线物料和箱子信息通过手持盘点操作保证缓存线满箱物料和mes系统物料一致才能让缓存线设备继续进行出入操作。
*/
@Override
public JSONArray cacheLineOutBoxExceptionQuery(
JSONObject param) {
String agv_no = param.getString("agv_no");
String wcsdevice_code = param.getString("wcsdevice_code");
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
JSONArray arr = instructTab.query("(startwcsdevice_code = '" + wcsdevice_code + "' or nextwcsdevice_code = '" + wcsdevice_code + "') and instruct_status <> '06' and agv_no like '%" + agv_no + "%'").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("instruct_uuid"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("wcsdevice_code", row.getString("startwcsdevice_code"));
json.put("vehicle_code", "0");
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;
}
/**
* 缓存线出箱异常确认
*/
@Override
public void cacheLineOutBoxExceptionConfirm(
JSONObject param) {
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
String instruct_uuid = param.getString("instruct_uuid");
JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0);
if(instObj != null) {
instObj.put("instruct_status", "06");
//TOFIX instructfinish_mode 是任务完成类型吗? finish_type
instObj.put("instructfinish_mode", "02");
instObj.put("update_time", DateUtil.now());
instObj.put("remark", "缓存线出箱异常确认完成!");
instructTab.update(instObj);
// 把所以来该缓存线的AGV指令都完成掉
if(instObj.getString("nextwcsdevice_code").contains("HCX")) {
HashMap<String,String> map = new HashMap<>();
map.put("instruct_status", "06");
map.put("instructfinish_mode", "02");
map.put("update_time", DateUtil.now());
map.put("remark", "缓存线出箱异常确认完成!");
instructTab.update(map, "nextwcsdevice_code = '" + instObj.getString("nextwcsdevice_code") + "' and instruct_status <> '06'");
}
// 把所以从该缓存线出AGV指令都完成掉
if(instObj.getString("startwcsdevice_code").contains("HCX")) {
HashMap<String,String> map = new HashMap<>();
map.put("instruct_status", "06");
map.put("instructfinish_mode", "02");
map.put("update_time", DateUtil.now());
map.put("remark", "缓存线出箱异常确认完成!");
instructTab.update(map, "startwcsdevice_code = '" + instObj.getString("startwcsdevice_code") + "' and instruct_status <> '06'");
}
// 得到异常的载具号
String vehicle_codeStr = instObj.getString("vehicle_code");
String[] arr = vehicle_codeStr.split(",");
// 缓存线载具物料表
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
for(String vehicle_code : arr) {
HashMap<String,String> map = new HashMap<>();
// 异常
map.put("vehicle_status", "03");
ivtTab.update(map, "vehicle_code = '" + vehicle_code + "'");
}
}
// inst.updateInstStatus(instObj, "1");
// inst.updateInstStatus(instObj, "2");
}
@Override
@@ -799,18 +726,18 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String wcsdevice_code = param.getString("wcsdevice_code");
// 01-暂停、02-启动
String opt_type = param.getString("opt_type");
System.out.println("操作类型:" + opt_type);
Object[] objs = new Object[2];
objs[0] = wcsdevice_code;
// 类型:恢复是0暂停是1
String type = "1";
if("02".equals(opt_type)) {
type = "0";
}
objs[1] = type;
//TOFIX 补充逻辑
// 下发给wcs
// uWcsSchedule.notifyWcs(99, 1000, objs);
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
@@ -818,15 +745,15 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// 指令标识
String instruct_uuid = param.getString("instruct_uuid");
// 指令点位表【sch_base_task】
JSONObject instObj = WQLObject.getWQLObject("sch_base_task").query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0);
//TOFIX quantity 是物料数量吗? material_qty
int putquantity = instObj.getInteger("quantity");
String producer = instObj.getString("nextwcsdevice_code");
Object[] objs = new Object[2];
objs[0] = producer;
objs[1] = putquantity;
//TOFIX 补充逻辑
// 下发给wcs
//uWcsSchedule.notifyWcs(99, 3002, objs);
JSONObject instObj = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + instruct_uuid + "'").uniqueResult(0);
int putquantity = instObj.getInteger("material_qty");
String producer = instObj.getString("point_code2");
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("producer", producer);
jsonObject.put("putquantity", putquantity);
jsonArray.add(jsonObject);
//TOFIX 等确定api后换成下发的url
AcsUtil.notifyAcs("api", jsonArray);
}
}

View File

@@ -125,6 +125,29 @@
ENDQUERY
ENDIF
IF 输入.flag = "6"
QUERY
SELECT
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
WHERE
mb.is_delete = '0'
OPTION 输入.condition <> ""
mb.material_name LIKE CONCAT ( '%', 输入.condition, '%' )
OR mb.material_code LIKE CONCAT ( '%', 输入.condition, '%' )
OR mb.material_spec LIKE CONCAT ( '%', 输入.condition, '%' )
OR class.class_name LIKE CONCAT ( '%', 输入.condition, '%' )
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF