From 1d0be8e2a30a9e9ea272d9bfc5f4ebd551262378 Mon Sep 17 00:00:00 2001 From: baoge <751575283@qq.com> Date: Fri, 24 Mar 2023 17:48:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E7=BA=BFpad=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/pda/rest/CacheLineHandController.java | 40 +- .../wms/pda/service/CacheLineHandService.java | 2 - .../impl/CacheLineHandServiceImpl.java | 1104 ++++++++--------- 3 files changed, 510 insertions(+), 636 deletions(-) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/rest/CacheLineHandController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/rest/CacheLineHandController.java index 604da891..5368c63d 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/rest/CacheLineHandController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/rest/CacheLineHandController.java @@ -1,5 +1,4 @@ package org.nl.wms.pda.rest; - import cn.dev33.satoken.annotation.SaIgnore; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -20,7 +19,6 @@ 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; @@ -119,11 +117,9 @@ public class CacheLineHandController{ @ApiOperation("缓存线料箱条码查询料箱信息") public CommonResult cacheLineMaterInfoQuery(@RequestBody JSONObject param) { log.info("海亮缓存线手持服务 [缓存线料箱条码查询料箱信息] 接口被请求, 请求参数-{}", param); - return RestBusinessTemplate.execute(()-> cacheLineHandService.cacheLineMaterInfoQuery(param)); + return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineMaterInfoQuery(param)); } - - @PostMapping("/inOutEmptyBox") @Log("空箱初始化--出入空箱") @ApiOperation("空箱初始化--出入空箱") @@ -134,19 +130,14 @@ public class CacheLineHandController{ }); } - @PostMapping("/inOutExceptionInstQuery") @Log("缓存线出入箱异常指令查询") @ApiOperation("缓存线出入箱异常指令查询") public CommonResult inOutExceptionInstQuery(@RequestBody JSONObject param) { log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被请求, 请求参数-{}", param); - return RestBusinessTemplate.execute(()-> cacheLineHandService.inOutExceptionInstQuery(param)); + return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstQuery(param)); } - - - - @PostMapping("/inOutExceptionInstConfirm") @Log("缓存线出入箱异常指令确认") @ApiOperation("缓存线出入箱异常指令确认") @@ -167,8 +158,6 @@ public class CacheLineHandController{ }); } - - @PostMapping("/setEmptyBox") @Log("设置空框") @ApiOperation("设置空框") @@ -179,19 +168,14 @@ public class CacheLineHandController{ }); } - - - @PostMapping("/agvInBoxExceptionQuery") @Log("AGV入箱异常-查询") @ApiOperation("AGV入箱异常-查询") public CommonResult agvInBoxExceptionQuery(@RequestBody JSONObject param) { log.info("海亮缓存线手持服务 [AGV入箱异常-查询] 接口被请求, 请求参数-{}", param); - return RestBusinessTemplate.execute(()-> cacheLineHandService.agvInBoxExceptionQuery(param)); + return RestBusinessTemplate.execute(() -> cacheLineHandService.agvInBoxExceptionQuery(param)); } - - @PostMapping("/agvInBoxExceptionConfirm") @Log("AGV入箱异常-确认") @ApiOperation("AGV入箱异常-确认") @@ -202,21 +186,14 @@ public class CacheLineHandController{ }); } - - - - - - @PostMapping("/agvOutBoxExceptionQuery") @Log("AGV出箱异常-查询") @ApiOperation("AGV出箱异常-查询") public CommonResult agvOutBoxExceptionQuery(@RequestBody JSONObject param) { log.info("海亮缓存线手持服务 [AGV出箱异常-查询] 接口被请求, 请求参数-{}", param); - return RestBusinessTemplate.execute(()-> cacheLineHandService.agvOutBoxExceptionQuery(param)); + return RestBusinessTemplate.execute(() -> cacheLineHandService.agvOutBoxExceptionQuery(param)); } - @PostMapping("/agvOutBoxExceptionConfirm") @Log("AGV出箱异常-确认") @ApiOperation("AGV出箱异常-确认") @@ -237,7 +214,6 @@ public class CacheLineHandController{ }); } - @PostMapping("/setBlankPos") @Log("设置缓存线货位为空位置") @ApiOperation("设置缓存线货位为空位置") @@ -248,16 +224,14 @@ public class CacheLineHandController{ }); } - @PostMapping("/cacheLineOutBoxExceptionQuery") @Log("缓存线出箱异常-查询") @ApiOperation("缓存线出箱异常-查询") public CommonResult cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) { log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param); - return RestBusinessTemplate.execute(()-> cacheLineHandService.cacheLineOutBoxExceptionQuery(param)); + return RestBusinessTemplate.execute(() -> cacheLineHandService.cacheLineOutBoxExceptionQuery(param)); } - @PostMapping("/cacheLineExcepOpt") @Log("缓存线异常处理") @ApiOperation("缓存线异常处理") @@ -268,8 +242,6 @@ public class CacheLineHandController{ }); } - - @PostMapping("/pourMaterial") @Log("倒料操作") @ApiOperation("倒料操作") @@ -279,6 +251,4 @@ public class CacheLineHandController{ cacheLineHandService.pourMaterial(param); }); } - - } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/CacheLineHandService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/CacheLineHandService.java index 22e7e73c..da9594d7 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/CacheLineHandService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/CacheLineHandService.java @@ -1,10 +1,8 @@ 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; diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java index 931db26e..2e0d1e54 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/CacheLineHandServiceImpl.java @@ -6,7 +6,6 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.NumberUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -15,7 +14,6 @@ import org.nl.common.utils.LocalCache; import org.nl.common.utils.SecurityUtils; 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; @@ -194,94 +192,57 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ */ @Override public JSONArray cacheLineMaterInfoQuery(JSONObject param) { - WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position"); - - //获取缓存线位置信息 - JSONArray arr = positionTab - .query("cacheLine_code like '%" + param.getString("cacheLine_code") + "%'", "layer_num desc,order_no") - .getResultJSONArray(0); - - + JSONArray arr = positionTab.query("cacheLine_code like '%" + param.getString("cacheLine_code") + "%'", "layer_num desc,order_no").getResultJSONArray(0); // 获取缓存线物料库存信息 WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial"); - - - - for (int i = 0; i < arr.size(); i++) - { - + 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")); - - //初始化料箱重量和数量 json.put("weight", "0"); json.put("quantity", "0"); - //不展示 - if ("0".equals(json.getString("is_show"))) - { + if("0".equals(json.getString("is_show"))) { json.put("vehicle_status", "04"); } //展示 - else - { - //是否空位 - if ("1".equals(json.getString("is_empty"))) - { - json.put("vehicle_status", "00"); + else{ + //是否空位 + if("1".equals(json.getString("is_empty"))) { + json.put("vehicle_status", "00"); + } + else{ + // 载具不是空位 + String vehicle_code = json.getString("vehicle_code"); + //从缓存线物料库存中 根据缓存线编码和载具编码获取绑定信息 + 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"); } - else - { - // 载具不是空位 - String vehicle_code = json.getString("vehicle_code"); - //从缓存线物料库存中 根据缓存线编码和载具编码获取绑定信息 - 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"); - } - else - { - json.put("vehicle_status", ivtObj.getString("vehicle_status")); - json.put("weight", ivtObj.getString("weight")); - json.put("quantity", ivtObj.getString("quantity")); - json.putAll(ivtObj); - - } + else{ + json.put("vehicle_status", ivtObj.getString("vehicle_status")); + json.put("weight", ivtObj.getString("weight")); + json.put("quantity", ivtObj.getString("quantity")); + json.putAll(ivtObj); } + } } //TOASK 无此状态,这个状态对应什么意思? 是否为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"))) { + //异常类型 + if(!"00".equals(json.getString("err_type"))) { json.put("is_err", "1"); } - - } - - return arr; - - - - - } /** @@ -290,286 +251,256 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ */ @Override public void setfullBox(JSONObject param) { - - String semimanufactures_uuid = param.getString("material_uuid"); - // 料箱码 - String vehicle_code = param.getString("vehicle_code"); - // 层数 - String layer_num = param.getString("layer_num"); - // 顺序号 - String seat_order_num = param.getString("seat_order_num"); - // 缓存线 - String wcsdevice_code = param.getString("wcsdevice_code"); - String weight = param.getString("weight"); - String quantity = param.getString("quantity"); - if(StringUtils.isEmpty(quantity) || param.getInteger("quantity") <= 0) { - - - throw new RuntimeException("数量必须大于0!"); - } - - String workprocedure_code = param.getString("workprocedure_uuid"); - // 判断载具编码是否存在 - // 缓存线载具条码表【IF_CacheLine_Vehicle】 - /* - * WQLObject wql=WQLObject.getWQLObject("IF_CacheLine_Vehicle"); JSONObject - * vehiobj = - * wql.query("is_delete='0' AND is_active='1' AND vehicle_code = '"+vehicle_code - * +"'").uniqueResult(0); if (vehiobj==null) { - * throw new RuntimeException("条码【" + vehicle_code + "】不存在或已被删除,操作失败!"); return null; } - */ - WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); - JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0); - if(vehiobj == null) { - - throw new RuntimeException("位置不存在,设置有误!"); - - } - // 判断物料去的缓存线是否正确 - // PDM_BI_WorkshopMaterialCorr - WQLObject corrTab = WQLObject.getWQLObject("PDM_BI_WorkshopMaterialCorr"); - WQLObject wpTab = WQLObject.getWQLObject("PDM_BI_WorkProcedure"); - // 设置工序信息 - JSONObject wpObj = wpTab.query("workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0); - // 物料系列 - String materialprocess_series = corrTab.query("semimanufactures_uuid = '" + semimanufactures_uuid + "'").uniqueResult(0).getString("materialprocess_series"); - - //TOASK 这个是调用什么? -// AgvTwoInst inst = new AgvTwoInst(); -// String cachelineCode2 = inst.getCachelineCode(materialprocess_series, wpObj.getString("workprocedure_code")); - - String cachelineCode2 = ""; - 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 RuntimeException("该缓存线【" + wcsdevice_code + "】不能存放【" + materialprocess_seriesname + "】物料,操作失败!"); - - } - vehiobj.put("vehicle_code", vehicle_code); - vehiobj.put("vehicle_uuid", vehicle_code); - positionTab.update(vehiobj); - WQLObject materTab = WQLObject.getWQLObject("PDM_BI_SemiMaterialCorr"); - // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); - // ivtTab.delete("cacheLine_code = '" + wcsdevice_code + "' and vehicle_code = - // '" + vehicle_code + "'"); - ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); - // 物料信息 - JSONObject materObj = materTab.query("semimanufactures_uuid = '" + semimanufactures_uuid + "'").uniqueResult(0); - HashMap json = new HashMap(); - json.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); - json.put("vehicle_code", vehicle_code); - json.put("vehicle_uuid", vehicle_code); - json.put("cacheLine_code", wcsdevice_code); - json.put("material_uuid", materObj.getString("semimanufactures_uuid")); - json.put("material_code", materObj.getString("semimanufactures_code")); - json.put("material_spec", materObj.getString("semimanufactures_spec")); - json.put("material_name", materObj.getString("semimanufactures_name")); - json.put("weight", weight); - json.put("quantity", quantity); - json.put("workprocedure_uuid", wpObj.getString("workprocedure_uuid")); - json.put("workprocedure_code", wpObj.getString("workprocedure_code")); - json.put("workprocedure_name", wpObj.getString("workprocedure_name")); - // 有箱有料 - json.put("vehicle_status", "02"); - json.put("create_time", DateUtil.now()); - ivtTab.insert(json); - + String semimanufactures_uuid = param.getString("material_uuid"); + // 料箱码 + String vehicle_code = param.getString("vehicle_code"); + // 层数 + String layer_num = param.getString("layer_num"); + // 顺序号 + String seat_order_num = param.getString("seat_order_num"); + // 缓存线 + String wcsdevice_code = param.getString("wcsdevice_code"); + String weight = param.getString("weight"); + String quantity = param.getString("quantity"); + if(StringUtils.isEmpty(quantity) || param.getInteger("quantity") <= 0) { + throw new RuntimeException("数量必须大于0!"); + } + String workprocedure_code = param.getString("workprocedure_uuid"); + // 判断载具编码是否存在 + // 缓存线载具条码表【IF_CacheLine_Vehicle】 + /* + * WQLObject wql=WQLObject.getWQLObject("IF_CacheLine_Vehicle"); JSONObject + * vehiobj = + * wql.query("is_delete='0' AND is_active='1' AND vehicle_code = '"+vehicle_code + * +"'").uniqueResult(0); if (vehiobj==null) { + * throw new RuntimeException("条码【" + vehicle_code + "】不存在或已被删除,操作失败!"); return null; } + */ + WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); + JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0); + if(vehiobj == null) { + throw new RuntimeException("位置不存在,设置有误!"); + } + // 判断物料去的缓存线是否正确 + // PDM_BI_WorkshopMaterialCorr + WQLObject corrTab = WQLObject.getWQLObject("PDM_BI_WorkshopMaterialCorr"); + WQLObject wpTab = WQLObject.getWQLObject("PDM_BI_WorkProcedure"); + // 设置工序信息 + JSONObject wpObj = wpTab.query("workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0); + // 物料系列 + String materialprocess_series = corrTab.query("semimanufactures_uuid = '" + semimanufactures_uuid + "'").uniqueResult(0).getString("materialprocess_series"); + //TOASK 这个是调用什么? + // AgvTwoInst inst = new AgvTwoInst(); + // String cachelineCode2 = inst.getCachelineCode(materialprocess_series, wpObj.getString("workprocedure_code")); + String cachelineCode2 = ""; + 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 RuntimeException("该缓存线【" + wcsdevice_code + "】不能存放【" + materialprocess_seriesname + "】物料,操作失败!"); + } + vehiobj.put("vehicle_code", vehicle_code); + vehiobj.put("vehicle_uuid", vehicle_code); + positionTab.update(vehiobj); + WQLObject materTab = WQLObject.getWQLObject("PDM_BI_SemiMaterialCorr"); + // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 + WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); + // ivtTab.delete("cacheLine_code = '" + wcsdevice_code + "' and vehicle_code = + // '" + vehicle_code + "'"); + ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); + // 物料信息 + JSONObject materObj = materTab.query("semimanufactures_uuid = '" + semimanufactures_uuid + "'").uniqueResult(0); + HashMap json = new HashMap(); + json.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); + json.put("vehicle_code", vehicle_code); + json.put("vehicle_uuid", vehicle_code); + json.put("cacheLine_code", wcsdevice_code); + json.put("material_uuid", materObj.getString("semimanufactures_uuid")); + json.put("material_code", materObj.getString("semimanufactures_code")); + json.put("material_spec", materObj.getString("semimanufactures_spec")); + json.put("material_name", materObj.getString("semimanufactures_name")); + json.put("weight", weight); + json.put("quantity", quantity); + json.put("workprocedure_uuid", wpObj.getString("workprocedure_uuid")); + json.put("workprocedure_code", wpObj.getString("workprocedure_code")); + json.put("workprocedure_name", wpObj.getString("workprocedure_name")); + // 有箱有料 + json.put("vehicle_status", "02"); + json.put("create_time", DateUtil.now()); + ivtTab.insert(json); } @Override public void setEmptyBox(JSONObject param) { - - // 层数 - String layer_num = param.getString("layer_num"); - // 顺序号 - String seat_order_num = param.getString("seat_order_num"); - // 载具条码 - String vehicle_code = param.getString("vehicle_code"); - // 缓存线编码 - String wcsdevice_code = param.getString("wcsdevice_code"); - // 判断载具编码是否存在 - // 缓存线载具条码表【IF_CacheLine_Vehicle】 - /* - * WQLObject wql=WQLObject.getWQLObject("IF_CacheLine_Vehicle"); JSONObject - * vehiobj = - * wql.query("is_delete='0' AND is_active='1' AND vehicle_code = '"+vehicle_code - * +"'").uniqueResult(0); if (vehiobj==null) { - * throw new RuntimeException("条码【" + vehicle_code + "】不存在或已被删除,操作失败!"); return null; } - */ - // 缓存线位置表【IF_CacheLine_Position】 - WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); - JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0); - if(vehiobj == null) { - - throw new RuntimeException("位置不存在,设置有误!"); - - } - vehiobj.put("vehicle_code", vehicle_code); - vehiobj.put("vehicle_uuid", vehicle_code); - positionTab.update(vehiobj); - // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); - // 先删除空箱子位置 - // ivtTab.delete("cacheLine_code = '" + wcsdevice_code + "' and vehicle_code = - // '" + vehicle_code + "'"); - ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); - JSONObject json = new JSONObject(); - // 状态设置为空箱 - json.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); - json.put("vehicle_code", vehicle_code); - json.put("vehicle_uuid", vehicle_code); - json.put("cacheLine_code", wcsdevice_code); - json.put("vehicle_status", "01"); - json.put("vehicle_code", vehicle_code); - // json.put("vehicle_uuid", vehiobj.getString("vehicle_uuid")); - 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_uuid", ""); - json.put("workprocedure_code", ""); - json.put("workprocedure_name", ""); - json.put("create_time", DateUtil.now()); - ivtTab.insert(json); - + // 层数 + String layer_num = param.getString("layer_num"); + // 顺序号 + String seat_order_num = param.getString("seat_order_num"); + // 载具条码 + String vehicle_code = param.getString("vehicle_code"); + // 缓存线编码 + String wcsdevice_code = param.getString("wcsdevice_code"); + // 判断载具编码是否存在 + // 缓存线载具条码表【IF_CacheLine_Vehicle】 + /* + * WQLObject wql=WQLObject.getWQLObject("IF_CacheLine_Vehicle"); JSONObject + * vehiobj = + * wql.query("is_delete='0' AND is_active='1' AND vehicle_code = '"+vehicle_code + * +"'").uniqueResult(0); if (vehiobj==null) { + * throw new RuntimeException("条码【" + vehicle_code + "】不存在或已被删除,操作失败!"); return null; } + */ + // 缓存线位置表【IF_CacheLine_Position】 + WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); + JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0); + if(vehiobj == null) { + throw new RuntimeException("位置不存在,设置有误!"); + } + vehiobj.put("vehicle_code", vehicle_code); + vehiobj.put("vehicle_uuid", vehicle_code); + positionTab.update(vehiobj); + // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 + WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); + // 先删除空箱子位置 + // ivtTab.delete("cacheLine_code = '" + wcsdevice_code + "' and vehicle_code = + // '" + vehicle_code + "'"); + ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); + JSONObject json = new JSONObject(); + // 状态设置为空箱 + json.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); + json.put("vehicle_code", vehicle_code); + json.put("vehicle_uuid", vehicle_code); + json.put("cacheLine_code", wcsdevice_code); + json.put("vehicle_status", "01"); + json.put("vehicle_code", vehicle_code); + // json.put("vehicle_uuid", vehiobj.getString("vehicle_uuid")); + 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_uuid", ""); + json.put("workprocedure_code", ""); + json.put("workprocedure_name", ""); + json.put("create_time", DateUtil.now()); + ivtTab.insert(json); } - - @Override public void setBlankPos(JSONObject param) { - - // 层数 - String layer_num = param.getString("layer_num"); - // 顺序号 - String seat_order_num = param.getString("seat_order_num"); - // 缓存线编码 - String wcsdevice_code = param.getString("wcsdevice_code"); - // 缓存线位置表【IF_CacheLine_Position】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_Position"); - JSONObject json = ivtTab.query("layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%' and order_no = " + seat_order_num + "").uniqueResult(0); - // 状态设置为空位 - json.put("is_blank", "1"); - json.put("vehicle_uuid", ""); - json.put("vehicle_code", ""); - ivtTab.update(json); - + // 层数 + String layer_num = param.getString("layer_num"); + // 顺序号 + String seat_order_num = param.getString("seat_order_num"); + // 缓存线编码 + String wcsdevice_code = param.getString("wcsdevice_code"); + // 缓存线位置表【IF_CacheLine_Position】 + WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_Position"); + JSONObject json = ivtTab.query("layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%' and order_no = " + seat_order_num + "").uniqueResult(0); + // 状态设置为空位 + json.put("is_blank", "1"); + json.put("vehicle_uuid", ""); + json.put("vehicle_code", ""); + ivtTab.update(json); } - - - - - /** * 出入空箱,出入类型 inOut_type 1 入空箱 2 出空箱 缓存线编码 wcsdevice_code 料箱码 vehicle_code */ @Override public void inOutEmptyBox(JSONObject param) { - - String inOut_type = param.getString("inOut_type"); - String cacheLine_code = param.getString("wcsdevice_code"); - String vehicle_code = param.getString("vehicle_code"); - // 缓存线位置表【IF_CacheLine_Position】 - WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); - WQLObject vehMaterTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); - // 入空箱 - if("1".equals(inOut_type)) { - // 判断是否可以放入空箱子 - JSONObject ivtObj = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0); - // 判断箱子是否在缓存线内 - if(ivtObj != null) { - throw new WDKException("箱子【" + vehicle_code + "】已在库内,无法入空箱!"); - } - // 判断是否可以放入空箱子 - JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "' and is_blank= '1'").uniqueResult(0); - if(json == null) { - throw new WDKException("无法找到缓存线【" + cacheLine_code + "】的空位,无法入空箱!"); - } - // 入了空箱子 - JSONObject afterIvt = new JSONObject(); - afterIvt.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); - afterIvt.put("vehicle_uuid", vehicle_code); - afterIvt.put("vehicle_code", vehicle_code); - afterIvt.put("cacheLine_code", cacheLine_code); - afterIvt.put("vehicle_status", "01"); - afterIvt.put("update_time", DateUtil.now()); - afterIvt.put("create_time", DateUtil.now()); - vehMaterTab.insert(afterIvt); - } - // 出空箱 - if("2".equals(inOut_type)) { - // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 - JSONObject json = vehMaterTab.query("cacheLine_code = '" + cacheLine_code + "' and vehicle_status= '01' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0); - if(json == null) { - throw new WDKException("无法找到缓存线【" + cacheLine_code + "】的空箱【" + vehicle_code + "】,出空箱失败"); - } - // 删除掉出库的箱子 - vehMaterTab.delete("cacheLine_code = '" + cacheLine_code + "' and vehicle_code = '" + vehicle_code + "'"); - } - + String inOut_type = param.getString("inOut_type"); + String cacheLine_code = param.getString("wcsdevice_code"); + String vehicle_code = param.getString("vehicle_code"); + // 缓存线位置表【IF_CacheLine_Position】 + WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); + WQLObject vehMaterTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); + // 入空箱 + if("1".equals(inOut_type)) { + // 判断是否可以放入空箱子 + JSONObject ivtObj = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0); + // 判断箱子是否在缓存线内 + if(ivtObj != null) { + throw new WDKException("箱子【" + vehicle_code + "】已在库内,无法入空箱!"); + } + // 判断是否可以放入空箱子 + JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "' and is_blank= '1'").uniqueResult(0); + if(json == null) { + throw new WDKException("无法找到缓存线【" + cacheLine_code + "】的空位,无法入空箱!"); + } + // 入了空箱子 + JSONObject afterIvt = new JSONObject(); + afterIvt.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); + afterIvt.put("vehicle_uuid", vehicle_code); + afterIvt.put("vehicle_code", vehicle_code); + afterIvt.put("cacheLine_code", cacheLine_code); + afterIvt.put("vehicle_status", "01"); + afterIvt.put("update_time", DateUtil.now()); + afterIvt.put("create_time", DateUtil.now()); + vehMaterTab.insert(afterIvt); + } + // 出空箱 + if("2".equals(inOut_type)) { + // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 + JSONObject json = vehMaterTab.query("cacheLine_code = '" + cacheLine_code + "' and vehicle_status= '01' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0); + if(json == null) { + throw new WDKException("无法找到缓存线【" + cacheLine_code + "】的空箱【" + vehicle_code + "】,出空箱失败"); + } + // 删除掉出库的箱子 + vehMaterTab.delete("cacheLine_code = '" + cacheLine_code + "' and vehicle_code = '" + vehicle_code + "'"); + } } @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("IF_WCS_InstructPoint"); - JSONArray result = new JSONArray(); - // 入箱扫码异常 - if("1".equals(inOut_type)) { - String where = "nextwcsdevice_code = '" + 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'"; - } - 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("instructorder_no", row.getString("instructorder_no")); - json.put("wcsdevice_code", row.getString("nextwcsdevice_code")); - 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")); - result.add(json); - } - } - // 出箱扫码异常 - if("2".equals(inOut_type)) { - 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'"; - } - 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("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")); - result.add(json); - } - } - - return result; - - + // 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("IF_WCS_InstructPoint"); + JSONArray result = new JSONArray(); + // 入箱扫码异常 + if("1".equals(inOut_type)) { + String where = "nextwcsdevice_code = '" + 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'"; + } + 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("instructorder_no", row.getString("instructorder_no")); + json.put("wcsdevice_code", row.getString("nextwcsdevice_code")); + 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")); + result.add(json); + } + } + // 出箱扫码异常 + if("2".equals(inOut_type)) { + 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'"; + } + 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("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")); + result.add(json); + } + } + return result; } /** @@ -578,61 +509,51 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ */ @Override public void inOutExceptionInstConfirm(JSONObject param) { - - WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - // 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码 - String inOut_type = param.getString("inOut_type"); - // 缓存线编码 - String wcsdevice_code = param.getString("wcsdevice_code"); - // - String vehicle_code = param.getString("vehicle_code"); - // 指令标识 - // String instruct_uuid = param.getString("instruct_uuid"); - // JSONObject instObj = instructTab.query("instruct_uuid = '" + 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); - - - + WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); + // 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码 + String inOut_type = param.getString("inOut_type"); + // 缓存线编码 + String wcsdevice_code = param.getString("wcsdevice_code"); + // + String vehicle_code = param.getString("vehicle_code"); + // 指令标识 + // String instruct_uuid = param.getString("instruct_uuid"); + // JSONObject instObj = instructTab.query("instruct_uuid = '" + 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); } - - - /** * AGV入箱子异常,(怎么判断入箱子异常) 缓存线编码 wcsdevice_code 满箱码 vehicle_code */ @Override public JSONArray agvInBoxExceptionQuery(JSONObject param) { - String vehicle_code = param.getString("vehicle_code"); - String wcsdevice_code = param.getString("wcsdevice_code"); - WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - String where = "nextwcsdevice_code = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'"; - if(StringUtils.isEmpty(vehicle_code)) { - where = "nextwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'"; - } - 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("instructorder_no", row.getString("instructorder_no")); - json.put("wcsdevice_code", row.getString("nextwcsdevice_code")); - json.put("startpoint_code", row.getString("startpoint_code")); - json.put("nextpoint_code", row.getString("nextpoint_code")); - json.put("nextpoint_code2", row.getString("nextpoint_code2")); - result.add(json); - } - + String vehicle_code = param.getString("vehicle_code"); + String wcsdevice_code = param.getString("wcsdevice_code"); + WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); + String where = "nextwcsdevice_code = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'"; + if(StringUtils.isEmpty(vehicle_code)) { + where = "nextwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'"; + } + 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("instructorder_no", row.getString("instructorder_no")); + json.put("wcsdevice_code", row.getString("nextwcsdevice_code")); + json.put("startpoint_code", row.getString("startpoint_code")); + json.put("nextpoint_code", row.getString("nextpoint_code")); + json.put("nextpoint_code2", row.getString("nextpoint_code2")); + result.add(json); + } return result; } @@ -644,79 +565,77 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ */ @Override public void agvInBoxExceptionConfirm(JSONObject param) { - - WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - String instruct_uuid = param.getString("instruct_uuid"); - 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"); - // 缓存线位置表【IF_CacheLine_Position】 - WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); + WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); + String instruct_uuid = param.getString("instruct_uuid"); + 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"); + // 缓存线位置表【IF_CacheLine_Position】 + WQLObject positionTab = WQLObject.getWQLObject("IF_CacheLine_Position"); - /* - * JSONObject emptyObj = positionTab - * .query("is_active = '1' and is_delete = '0' and vehicle_code = '" + - * empty_vehicle_code + "'") .uniqueResult(0); - * - * // 判断箱子是否存在 if (emptyObj == null) { throw new RuntimeException("条码【" + - * 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 RuntimeException("条码【" + full_vehicle_code + "】不存在,操作失败"); - * return null; } - */ - JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); - // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); - // 出的空箱子 - /* - * 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 RuntimeException("缓存线内的空箱:" + empty_vehicle_code + "不存在,操作失败"); return null; } - * - * // 找到空位子入满箱 JSONObject fullBoxObj = - * ivtTab.query("is_blank = '1' AND cacheLine_code = '" + cacheLine_code + "'") - * .uniqueResult(0); if (fullBoxObj == null) { - * throw new RuntimeException("在缓存线:" + 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", - * full_vehicle_code); afterIvt.put("vehicle_uuid", full_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); - */ + /* + * JSONObject emptyObj = positionTab + * .query("is_active = '1' and is_delete = '0' and vehicle_code = '" + + * empty_vehicle_code + "'") .uniqueResult(0); + * + * // 判断箱子是否存在 if (emptyObj == null) { throw new RuntimeException("条码【" + + * 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 RuntimeException("条码【" + full_vehicle_code + "】不存在,操作失败"); + * return null; } + */ + JSONObject instObj = instructTab.query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); + // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 + WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); + // 出的空箱子 + /* + * 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 RuntimeException("缓存线内的空箱:" + empty_vehicle_code + "不存在,操作失败"); return null; } + * + * // 找到空位子入满箱 JSONObject fullBoxObj = + * ivtTab.query("is_blank = '1' AND cacheLine_code = '" + cacheLine_code + "'") + * .uniqueResult(0); if (fullBoxObj == null) { + * throw new RuntimeException("在缓存线:" + 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", + * full_vehicle_code); afterIvt.put("vehicle_uuid", full_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); + */ //TOASK 此逻辑疑问 -// AgvTwoInst inst = new AgvTwoInst(); - instObj.put("inboxtxm", full_vehicle_code); - instObj.put("outboxtxm", empty_vehicle_code); -// inst.updateInstStatus(instObj, "1"); -// inst.updateInstStatus(instObj, "2"); - + // AgvTwoInst inst = new AgvTwoInst(); + instObj.put("inboxtxm", full_vehicle_code); + instObj.put("outboxtxm", empty_vehicle_code); + // inst.updateInstStatus(instObj, "1"); + // inst.updateInstStatus(instObj, "2"); } /** @@ -724,30 +643,29 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ */ @Override public JSONArray agvOutBoxExceptionQuery(JSONObject param) { - String vehicle_code = param.getString("vehicle_code"); - String wcsdevice_code = param.getString("wcsdevice_code"); - JSONArray arr = new JSONArray(); - WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - if(StringUtils.isEmpty(vehicle_code)) { - arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'").getResultJSONArray(0); - } - else{ - arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'").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", 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")); - result.add(json); - } - + String vehicle_code = param.getString("vehicle_code"); + String wcsdevice_code = param.getString("wcsdevice_code"); + JSONArray arr = new JSONArray(); + WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); + if(StringUtils.isEmpty(vehicle_code)) { + arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'").getResultJSONArray(0); + } + else{ + arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'").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", 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")); + result.add(json); + } return result; } @@ -757,48 +675,46 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ */ @Override public void agvOutBoxExceptionConfirm(JSONObject param) { + WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); + 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); - WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - 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); - - /* - * // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 WQLObject ivtTab = - * WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); // - * 缓存线位置表【IF_CacheLine_Position】 WQLObject positionTab = - * WQLObject.getWQLObject("IF_CacheLine_Position"); // 查看是否有空位入 JSONObject - * positionObj = positionTab.query("is_blank = '1' AND cacheLine_code = '" + - * cacheLine_code + "'") .uniqueResult(0); - * - * if (positionObj == null) { - * throw new RuntimeException("缓存线无剩余位置,操作失败"); return null; - * - * } - * - * // 入的空箱子 JSONObject afterIvt = new JSONObject(); - * afterIvt.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); afterIvt.put("vehicle_uuid", - * 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); - */ + /* + * // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 WQLObject ivtTab = + * WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); // + * 缓存线位置表【IF_CacheLine_Position】 WQLObject positionTab = + * WQLObject.getWQLObject("IF_CacheLine_Position"); // 查看是否有空位入 JSONObject + * positionObj = positionTab.query("is_blank = '1' AND cacheLine_code = '" + + * cacheLine_code + "'") .uniqueResult(0); + * + * if (positionObj == null) { + * throw new RuntimeException("缓存线无剩余位置,操作失败"); return null; + * + * } + * + * // 入的空箱子 JSONObject afterIvt = new JSONObject(); + * afterIvt.put("vehmaterial_uuid", IdUtil.getSnowflake(1, 1).nextIdStr()); afterIvt.put("vehicle_uuid", + * 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); + */ //TOASK 此逻辑疑问 -// AgvTwoInst inst = new AgvTwoInst(); - // 出箱的时候入箱码和出箱码相同 - instObj.put("inboxtxm", vehicle_code); - instObj.put("outboxtxm", vehicle_code); -// inst.updateInstStatus(instObj, "1"); -// inst.updateInstStatus(instObj, "2"); - + // AgvTwoInst inst = new AgvTwoInst(); + // 出箱的时候入箱码和出箱码相同 + instObj.put("inboxtxm", vehicle_code); + instObj.put("outboxtxm", vehicle_code); + // inst.updateInstStatus(instObj, "1"); + // inst.updateInstStatus(instObj, "2"); } /** @@ -822,26 +738,24 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ @Override public JSONArray cacheLineOutBoxExceptionQuery( JSONObject param) { - - String agv_no = param.getString("agv_no"); - String wcsdevice_code = param.getString("wcsdevice_code"); - WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - 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); - } + String agv_no = param.getString("agv_no"); + String wcsdevice_code = param.getString("wcsdevice_code"); + WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); + 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; - } /** @@ -850,68 +764,65 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ @Override public void cacheLineOutBoxExceptionConfirm( JSONObject param) { - - WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - 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"); - 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 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 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(","); - // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 - WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); - for(String vehicle_code : arr) { - HashMap map = new HashMap<>(); - // 异常 - map.put("vehicle_status", "03"); - ivtTab.update(map, "vehicle_code = '" + vehicle_code + "'"); - } - } - + WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); + 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"); + 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 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 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(","); + // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 + WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_VehileMaterial"); + for(String vehicle_code : arr) { + HashMap map = new HashMap<>(); + // 异常 + map.put("vehicle_status", "03"); + ivtTab.update(map, "vehicle_code = '" + vehicle_code + "'"); + } + } } @Override public void cacheLineExcepOpt(JSONObject param) { - // 缓存线编码 - 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); - + // 缓存线编码 + 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); } /** @@ -920,23 +831,18 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ * ctx.setRows(pageable.getPageSize() + ""); return ctx; } */ @Override - public void pourMaterial(JSONObject param) { - // 指令标识 - String instruct_uuid = param.getString("instruct_uuid"); - // 指令点位表【IF_WCS_InstructPoint】 - JSONObject instObj = WQLObject.getWQLObject("IF_WCS_InstructPoint").query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); - int putquantity = instObj.getInteger("quantity"); - String producer = instObj.getString("nextwcsdevice_code"); - Object[] objs = new Object[2]; - objs[0] = producer; - objs[1] = putquantity; - - + public void pourMaterial(JSONObject param) { + // 指令标识 + String instruct_uuid = param.getString("instruct_uuid"); + // 指令点位表【IF_WCS_InstructPoint】 + JSONObject instObj = WQLObject.getWQLObject("IF_WCS_InstructPoint").query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); + 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); - + //uWcsSchedule.notifyWcs(99, 3002, objs); } - - }