修改更新插入删除操作获取返回状态,避免获取不到异常信息。
This commit is contained in:
@@ -119,7 +119,7 @@ public class CacheLineHandController{
|
||||
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("opt_type"))) {
|
||||
throw new BizCoreException(ResultCode.MISS_PARAMETER);
|
||||
}
|
||||
return cacheLineHandService.instOperation(param);
|
||||
return cacheLineHandService.instOperation(param);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -138,10 +138,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,7 +158,7 @@ public class CacheLineHandController{
|
||||
@PostMapping("/inOutEmptyBox")
|
||||
@Log("空箱初始化--出入空箱")
|
||||
@ApiOperation("空箱初始化--出入空箱")
|
||||
public CommonResult<Void> inOutEmptyBox(@RequestBody JSONObject param) {
|
||||
public CommonResult<String> inOutEmptyBox(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param);
|
||||
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutEmptyBox(param));
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public class CacheLineHandController{
|
||||
@PostMapping("/inOutExceptionInstConfirm")
|
||||
@Log("缓存线出入箱异常指令确认")
|
||||
@ApiOperation("缓存线出入箱异常指令确认")
|
||||
public CommonResult<Void> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
|
||||
public CommonResult<String> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
|
||||
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令确认] 接口被请求, 请求参数-{}", param);
|
||||
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstConfirm(param));
|
||||
}
|
||||
@@ -246,7 +246,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
|
||||
*/
|
||||
String 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;
|
||||
@@ -337,9 +338,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);
|
||||
@@ -422,10 +427,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");
|
||||
//缓存线载具物料表
|
||||
@@ -438,30 +445,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("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= '1' 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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -533,26 +542,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的数据
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -594,7 +633,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");
|
||||
@@ -660,7 +699,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -768,26 +808,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("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);
|
||||
//TOFIX 等确定api后,换成下发的url
|
||||
AcsUtil.notifyAcs("api", jsonArray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pourMaterial(JSONObject param) {
|
||||
// 指令标识
|
||||
@@ -809,10 +829,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;
|
||||
}
|
||||
|
||||
@@ -837,6 +854,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 + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user