diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/common/utils/api/RestBusinessTemplate.java b/mes/hd/nladmin-system/src/main/java/org/nl/common/utils/api/RestBusinessTemplate.java index 57de09bf..e2876129 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/common/utils/api/RestBusinessTemplate.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/common/utils/api/RestBusinessTemplate.java @@ -41,7 +41,7 @@ public class RestBusinessTemplate{ catch(Exception e) { log.error("execute error", e); result.setCode(ResultCode.FAILED.getCode()); - result.setDesc(ResultCode.FAILED.getDesc()); + result.setDesc(ResultCode.FAILED.getDesc()+",原因是:"+e.getMessage()); } return result; } 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 9bf5c6f3..604da891 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,6 +1,7 @@ package org.nl.wms.pda.rest; import cn.dev33.satoken.annotation.SaIgnore; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -12,6 +13,7 @@ import org.nl.common.utils.api.CommonResult; import org.nl.common.utils.api.RestBusinessTemplate; import org.nl.common.utils.api.ResultCode; import org.nl.modules.common.exception.BizCoreException; +import org.nl.wms.pda.dto.MaterialDto; import org.nl.wms.pda.service.CacheLineHandService; import org.springframework.data.domain.Pageable; import org.springframework.web.bind.annotation.PostMapping; @@ -19,6 +21,7 @@ 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; /** @@ -39,7 +42,7 @@ public class CacheLineHandController{ @PostMapping("/materialQuery") @Log("物料查询") @ApiOperation("物料查询") - public CommonResult materialQuery(@RequestBody JSONObject form) { + public CommonResult> materialQuery(@RequestBody JSONObject form) { log.info("海亮缓存线手持服务 [查询物料] 接口被请求, 请求参数-{}", form); return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(form.getString("search_bar"))); } @@ -47,7 +50,7 @@ public class CacheLineHandController{ @PostMapping("/semiMaterialSpecQuery") @Log("规格下拉框查询") @ApiOperation("规格下拉框查询") - public CommonResult semiMaterialSpecQuery(@RequestBody JSONObject form) { + public CommonResult semiMaterialSpecQuery(@RequestBody JSONObject form) { log.info("海亮缓存线手持服务 [规格下拉框查询] 接口被请求, 请求参数-{}", form); return RestBusinessTemplate.execute(() -> cacheLineHandService.semiMaterialSpecQuery(form.getString("form"))); } @@ -55,7 +58,7 @@ public class CacheLineHandController{ @PostMapping("/workProcedureQuery") @Log("工序下拉框查询") @ApiOperation("工序下拉框查询") - public CommonResult workProcedureQuery(@RequestBody JSONObject form) { + public CommonResult workProcedureQuery(@RequestBody JSONObject form) { log.info("海亮缓存线手持服务 [工序下拉框查询] 接口被请求, 请求参数-{}", form); return RestBusinessTemplate.execute(() -> cacheLineHandService.workProcedureQuery(form.getString("form"))); } @@ -63,7 +66,7 @@ public class CacheLineHandController{ @PostMapping("/deviceQuery") @Log("缓存线设备下拉框查询") @ApiOperation("缓存线设备下拉框查询") - public CommonResult deviceQuery(@RequestBody JSONObject form) { + public CommonResult deviceQuery(@RequestBody JSONObject form) { log.info("海亮缓存线手持服务 [缓存线设备下拉框查询] 接口被请求, 请求参数-{}", form); return RestBusinessTemplate.execute(() -> cacheLineHandService.deviceQuery(form.getString("form"))); } @@ -71,7 +74,7 @@ public class CacheLineHandController{ @PostMapping("/instStatusQuery") @Log("指令状态下拉框查询") @ApiOperation("指令状态下拉框查询") - public CommonResult instStatusQuery(@RequestBody JSONObject form) { + public CommonResult instStatusQuery(@RequestBody JSONObject form) { log.info("海亮缓存线手持服务 [指令状态下拉框查询] 接口被请求, 请求参数-{}", form); return RestBusinessTemplate.execute(() -> cacheLineHandService.instStatusQuery(form.getString("form"))); } @@ -92,7 +95,7 @@ public class CacheLineHandController{ @PostMapping("/cacheLineMaterCheck") @Log("缓存线物料盘点") @ApiOperation("缓存线物料盘点") - public CommonResult cacheLineMaterCheck(@RequestBody JSONObject param) { + public CommonResult cacheLineMaterCheck(@RequestBody JSONObject param) { log.info("海亮缓存线手持服务 [缓存线物料盘点] 接口被请求, 请求参数-{}", param); return RestBusinessTemplate.execute(cacheLineHandService::cacheLineMaterCheck); } @@ -110,4 +113,172 @@ public class CacheLineHandController{ cacheLineHandService.instOperation(param); }); } + + @PostMapping("/cacheLineMaterInfoQuery") + @Log("缓存线料箱条码查询料箱信息") + @ApiOperation("缓存线料箱条码查询料箱信息") + public CommonResult cacheLineMaterInfoQuery(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [缓存线料箱条码查询料箱信息] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(()-> cacheLineHandService.cacheLineMaterInfoQuery(param)); + } + + + + @PostMapping("/inOutEmptyBox") + @Log("空箱初始化--出入空箱") + @ApiOperation("空箱初始化--出入空箱") + public CommonResult inOutEmptyBox(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.inOutEmptyBox(param); + }); + } + + + @PostMapping("/inOutExceptionInstQuery") + @Log("缓存线出入箱异常指令查询") + @ApiOperation("缓存线出入箱异常指令查询") + public CommonResult inOutExceptionInstQuery(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(()-> cacheLineHandService.inOutExceptionInstQuery(param)); + } + + + + + + @PostMapping("/inOutExceptionInstConfirm") + @Log("缓存线出入箱异常指令确认") + @ApiOperation("缓存线出入箱异常指令确认") + public CommonResult inOutExceptionInstConfirm(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [缓存线出入箱异常指令确认] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.inOutExceptionInstConfirm(param); + }); + } + + @PostMapping("/setfullBox") + @Log("设置满框") + @ApiOperation("设置满框") + public CommonResult setfullBox(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [设置满框] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.setfullBox(param); + }); + } + + + + @PostMapping("/setEmptyBox") + @Log("设置空框") + @ApiOperation("设置空框") + public CommonResult setEmptyBox(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [设置空框] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.setEmptyBox(param); + }); + } + + + + + @PostMapping("/agvInBoxExceptionQuery") + @Log("AGV入箱异常-查询") + @ApiOperation("AGV入箱异常-查询") + public CommonResult agvInBoxExceptionQuery(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [AGV入箱异常-查询] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(()-> cacheLineHandService.agvInBoxExceptionQuery(param)); + } + + + + @PostMapping("/agvInBoxExceptionConfirm") + @Log("AGV入箱异常-确认") + @ApiOperation("AGV入箱异常-确认") + public CommonResult agvInBoxExceptionConfirm(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [AGV入箱异常-确认] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.agvInBoxExceptionConfirm(param); + }); + } + + + + + + + + @PostMapping("/agvOutBoxExceptionQuery") + @Log("AGV出箱异常-查询") + @ApiOperation("AGV出箱异常-查询") + public CommonResult agvOutBoxExceptionQuery(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [AGV出箱异常-查询] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(()-> cacheLineHandService.agvOutBoxExceptionQuery(param)); + } + + + @PostMapping("/agvOutBoxExceptionConfirm") + @Log("AGV出箱异常-确认") + @ApiOperation("AGV出箱异常-确认") + public CommonResult agvOutBoxExceptionConfirm(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [AGV出箱异常-确认] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.agvOutBoxExceptionConfirm(param); + }); + } + + @PostMapping("/cacheLineOutBoxExceptionConfirm") + @Log("缓存线出箱异常-确认") + @ApiOperation("缓存线出箱异常-确认") + public CommonResult cacheLineOutBoxExceptionConfirm(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [缓存线出箱异常-确认] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.cacheLineOutBoxExceptionConfirm(param); + }); + } + + + @PostMapping("/setBlankPos") + @Log("设置缓存线货位为空位置") + @ApiOperation("设置缓存线货位为空位置") + public CommonResult setBlankPos(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [设置缓存线货位为空位置] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.setBlankPos(param); + }); + } + + + @PostMapping("/cacheLineOutBoxExceptionQuery") + @Log("缓存线出箱异常-查询") + @ApiOperation("缓存线出箱异常-查询") + public CommonResult cacheLineOutBoxExceptionQuery(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [缓存线出箱异常-查询] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(()-> cacheLineHandService.cacheLineOutBoxExceptionQuery(param)); + } + + + @PostMapping("/cacheLineExcepOpt") + @Log("缓存线异常处理") + @ApiOperation("缓存线异常处理") + public CommonResult cacheLineExcepOpt(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [缓存线异常处理] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + cacheLineHandService.cacheLineExcepOpt(param); + }); + } + + + + @PostMapping("/pourMaterial") + @Log("倒料操作") + @ApiOperation("倒料操作") + public CommonResult pourMaterial(@RequestBody JSONObject param) { + log.info("海亮缓存线手持服务 [倒料操作] 接口被请求, 请求参数-{}", param); + return RestBusinessTemplate.execute(() -> { + 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 148be5c4..22e7e73c 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 @@ -101,174 +101,143 @@ public interface CacheLineHandService{ * @author gbx * @date 2023/3/24 */ - Object cacheLineMaterCheck(); + JSONArray cacheLineMaterCheck(); /** * 缓存线料箱条码查询料箱信息 * - * @param param - * @return + * @param param 请求参数 + * @return 返回结果 * @author gbx * @date 2023/3/24 */ - Object cachelineMaterInfoQuery(JSONObject param); + JSONArray cacheLineMaterInfoQuery(JSONObject param); /** * 空箱初始化--出入空箱 * * @param param 查询参数 inOut_type:1 入空箱 2 出空箱 vehicle_code:载具编码 - * @return * @author gbx * @date 2023/3/24 */ - Object inOutEmptyBox(JSONObject param); + void inOutEmptyBox(JSONObject param); /** * 缓存线出入箱异常指令查询 * * @param param 查询参数 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码 - * @return + * @return 返回结果集 * @author gbx * @date 2023/3/24 */ - Object inOutExceptionInstQuery(JSONObject param); + JSONArray inOutExceptionInstQuery(JSONObject param); /** * 缓存线出入箱异常指令确认 * * @param param 查询参数 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码 - * @return * @author gbx * @date 2023/3/24 */ - Object inOutExceptionInstConfirm(JSONObject param); + void inOutExceptionInstConfirm(JSONObject param); /** - * 设置满匡 + * 设置满框 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object setfullBox(JSONObject param); + void setfullBox(JSONObject param); /** * 设置空框 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object setEmptyBox(JSONObject param); + void setEmptyBox(JSONObject param); /** * AGV入箱异常-查询 * - * @param param - * @return + * @param param 查询参数 + * @return 返回结果集 * @author gbx * @date 2023/3/24 */ - Object agvInBoxExceptionQuery(JSONObject param); + JSONArray agvInBoxExceptionQuery(JSONObject param); /** * AGV入箱异常-确认 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object agvInBoxExceptionConfirm(JSONObject param); + void agvInBoxExceptionConfirm(JSONObject param); /** * AGV出箱异常-查询 * - * @param param - * @return + * @param param 查询参数 + * @return 返回结果集 * @author gbx * @date 2023/3/24 */ - Object agvOutBoxExceptionQuery(JSONObject param); + JSONArray agvOutBoxExceptionQuery(JSONObject param); /** * AGV出箱异常-确认 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object agvOutBoxExceptionConfirm(JSONObject param); - - /** - * 缓存线出箱异常-查询 - * - * @param param - * @return - * @author gbx - * @date 2023/3/24 - */ - Object cacheLineOutBoxExceptionQuery(String account_uuid, JSONObject param); + void agvOutBoxExceptionConfirm(JSONObject param); /** * 缓存线出箱异常-确认 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object cacheLineOutBoxExceptionConfirm( - String account_uuid, JSONObject param); + void cacheLineOutBoxExceptionConfirm(JSONObject param); /** * 设置缓存线货位为空位置 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object setBlankPos(JSONObject param); + void setBlankPos(JSONObject param); /** - * @param param - * @return + * @param param 查询参数 + * @return 返回结果集 * @author gbx * @date 2023/3/24 */ - Object cacheLineOutBoxExceptionQuery( - JSONObject param); - - /** - * @param param - * @return - * @author gbx - * @date 2023/3/24 - */ - Object cacheLineOutBoxExceptionConfirm( - JSONObject param); + JSONArray cacheLineOutBoxExceptionQuery(JSONObject param); /** * 缓存线异常处理 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object cacheLineExcepOpt(JSONObject param); + void cacheLineExcepOpt(JSONObject param); /** * 倒料操作 * - * @param param - * @return + * @param param 查询参数 * @author gbx * @date 2023/3/24 */ - Object pourMaterial(JSONObject param); + void pourMaterial(JSONObject param); } 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 b7d9b8a6..931db26e 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 @@ -2,8 +2,11 @@ package org.nl.wms.pda.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; +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; @@ -11,9 +14,12 @@ import org.jetbrains.annotations.NotNull; 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; +import org.nl.modules.wql.exception.WDKException; import org.nl.wms.pda.dto.CachelineVehileMaterialDto; import org.nl.wms.pda.dto.MaterialDto; import org.nl.wms.pda.service.CacheLineHandService; @@ -66,35 +72,29 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ return getMaterialDto(materialList, param); } //2.查reids - materialList = redisUtils.get("materialList", MaterialDto.class); - if(null != materialList) { - //设置本地缓存 - cache.setLocalCache("materialList", materialList); - return getMaterialDto(materialList, param); - } + // materialList = redisUtils.get("materialList", MaterialDto.class); + // if(null != materialList) { + // //设置本地缓存 + // cache.setLocalCache("materialList", materialList); + // return getMaterialDto(materialList, param); + // } //3.查db JSONArray materialJsonArray = WQL.getWO("PDA_QUERY").addParam("flag", "5").process().getResultJSONArray(0); materialList = materialJsonArray.toJavaList(MaterialDto.class); //缓存到redis List finalMaterialList1 = materialList; - CompletableFuture f1 = CompletableFuture.runAsync(() -> { - try { - redisUtils.set("materialList", finalMaterialList1, 3600, TimeUnit.SECONDS); - } - catch(Exception e) { - log.error("物料信息缓存redis失败: {}", e.getMessage(), e); - } - }, pool); + CompletableFuture f1 = CompletableFuture.runAsync(() -> redisUtils.set("materialList", finalMaterialList1, 3600, TimeUnit.SECONDS), pool); //缓存到本地 List finalMaterialList = materialList; - CompletableFuture f2 = CompletableFuture.runAsync(() -> { - try { - cache.setLocalCache("materialList", finalMaterialList); - } - catch(Exception e) { - log.error("物料信息缓存本地失败: {}", e.getMessage(), e); - } - }, pool); + CompletableFuture f2 = CompletableFuture.runAsync(() -> cache.setLocalCache("materialList", finalMaterialList), pool); + f1.exceptionally((e) -> { + log.error("物料信息缓存redis失败: {}", e.getMessage(), e); + throw new BadRequestException("物料信息缓存redis失败"); + }); + f2.exceptionally((e) -> { + log.error("物料信息缓存本地失败: {}", e.getMessage(), e); + throw new BadRequestException("物料信息缓存本地失败"); + }); return materialList; } @@ -105,7 +105,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ private List getMaterialDto(List 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).collect(Collectors.toList()); + materialList = materialList.stream().filter(m -> (m.getMaterial_name().indexOf(param) > -1) || (m.getMaterial_code().indexOf(param)) > -1 || (m.getMaterial_spec().indexOf(param)) > -1 || (m.getClass_name().indexOf(param)) > -1).collect(Collectors.toList()); return materialList; } return materialList; @@ -167,7 +167,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ } @Override - public Object cacheLineMaterCheck() { + public JSONArray cacheLineMaterCheck() { WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position"); JSONArray positionArr = positionTab.query("is_delete = '0'").getResultJSONArray(0); // 缓存线位置表 @@ -193,164 +193,383 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ * 0空位 status = 1: 绿色空箱 || status = 2:黄色满箱 || status = 3:红色异常 || status = 4 :不显示 */ @Override - public Object cachelineMaterInfoQuery(JSONObject param) { - /* - * JSONArray arr = WQL.getWO("QWCS_CACHE_004").addParam("flag", "3") - * .addParam("extdevice_code", - * param.opt("wcsdevice_code")).process().getResultJSONArray(0); for (int i = 0; - * i < arr.size(); i++) { JSONObject json = arr.getJSONObject(i); // 默认非异常 - * json.put("is_err", "0"); // 去掉小数 json.put("weight", - * uMath.multiply(obj.getString("weight"), "1", 0)); json.put("status", - * obj.getString("status").substring(1, 2)); - * - * if (!"00".equals(obj.getString("err_type"))) { json.put("is_err", "1"); } } - */ - // for(int i = 0; i < arr.size(); i++) { - // JSONObject json = arr.getJSONObject(i); - // json.put("seat_order_num", json.opt("order_no")); - // // 0空位 status = 1: 绿色空箱 || status = 2:黄色满箱 || status = 3:红色异常 || status = 4 :不显示 - // json.put("weight", "0"); - // json.put("quantity", "0"); - // if("0".equals(obj.getString("is_show"))) { - // json.put("vehicle_status", "04"); - // } - // else{// 显示 - // if("1".equals(obj.getString("is_blank"))) { - // json.put("vehicle_status", "00"); - // } - // else{// 载具不为空 - // String vehicle_code = obj.getString("vehicle_code"); - // JSONObject ivtObj = ivtTab.query("vehicle_code = '" + vehicle_code + "' and extdevice_code like '%" + param.opt("wcsdevice_code") + "%'").uniqueResult(0); - // if(ivtObj == null) { - // // 异常 - // json.put("vehicle_status", "03"); - // } - // else{ - // json.put("vehicle_status", ivtObj.optString("vehicle_status")); - // json.put("weight", ivtObj.optString("weight")); - // json.put("quantity", ivtObj.optString("quantity")); - // json.putAll(ivtObj); - // } - // } - // } - // json.put("is_err", "0"); - // json.put("wcsdevice_code", obj.getString("extdevice_code")); - // // 去掉小数 - // json.put("weight", uMath.multiply(obj.getString("weight"), "1", 0)); - // json.put("status", obj.getString("vehicle_status").substring(1, 2)); - // if(!"00".equals(obj.getString("err_type"))) { - // json.put("is_err", "1"); - // } - // } - // srb.addJSONArray("result", arr); - // srb.setDesc("查询成功!"); - return null; + 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); + + + // 获取缓存线物料库存信息 + 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")); + + + //初始化料箱重量和数量 + json.put("weight", "0"); + json.put("quantity", "0"); + + //不展示 + 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 + { + // 载具不是空位 + 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); + + } + } + } + //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"))) { + json.put("is_err", "1"); + } + + + } + + + return arr; + + + + + } + /** + * 设置满箱物料 缓存线编码 wcsdevice_code 料箱码 vehicle_code 工序标识 workprocedure_uuid 物料标识 material_uuid + * 数量 quantity 重量 weight + */ + @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); + + } + + @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); + + } + + + + @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); + + } + + + + + + /** * 出入空箱,出入类型 inOut_type 1 入空箱 2 出空箱 缓存线编码 wcsdevice_code 料箱码 vehicle_code */ @Override - public Object inOutEmptyBox(JSONObject param) { - // - // String inOut_type = param.optString("inOut_type"); - // String extdevice_code = param.optString("wcsdevice_code"); - // String vehicle_code = param.optString("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("extdevice_code = '" + extdevice_code + "' and is_blank= '1'").uniqueResult(0); - // if(json == null) { - // throw new WDKException("无法找到缓存线【" + extdevice_code + "】的空位,无法入空箱!"); - // } - // // 入了空箱子 - // JSONObject afterIvt = new JSONObject(); - // afterIvt.put("vehmaterial_uuid", WDK.getUUID()); - // afterIvt.put("vehicle_uuid", vehicle_code); - // afterIvt.put("vehicle_code", vehicle_code); - // afterIvt.put("extdevice_code", extdevice_code); - // afterIvt.put("vehicle_status", "01"); - // afterIvt.put("update_time", WDK.getDateTime()); - // afterIvt.put("create_time", WDK.getDateTime()); - // vehMaterTab.insert(afterIvt); - // } - // // 出空箱 - // if("2".equals(inOut_type)) { - // // 缓存线载具物料表【IF_CacheLine_VehileMaterial】 - // JSONObject json = vehMaterTab.query("extdevice_code = '" + extdevice_code + "' and vehicle_status= '01' and vehicle_code = '" + vehicle_code + "'").uniqueResult(0); - // if(json == null) { - // throw new WDKException("无法找到缓存线【" + extdevice_code + "】的空箱【" + vehicle_code + "】,出空箱失败"); - // } - // // 删除掉出库的箱子 - // vehMaterTab.delete("extdevice_code = '" + extdevice_code + "' and vehicle_code = '" + vehicle_code + "'"); - // } - return null; + 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 + "'"); + } + } @Override - public Object inOutExceptionInstQuery(JSONObject param) { - // - // // 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码 - // // 出入类型 inOut_type - // // 缓存线编码 wcsdevice_code - // // 料箱码 vehicle_code - // // {"inOut_type":"1","wcsdevice_code":"HCX01","vehicle_code":"10001"} - // String vehicle_code = param.optString("vehicle_code"); - // String wcsdevice_code = param.optString("wcsdevice_code"); - // String inOut_type = param.optString("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(uString.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.optString("instruct_uuid")); - // json.put("instructorder_no", row.optString("instructorder_no")); - // json.put("wcsdevice_code", row.optString("nextwcsdevice_code")); - // json.put("vehicle_code", row.optString("invehicle_code")); - // json.put("startpoint_code", row.optString("startpoint_code")); - // json.put("nextpoint_code", row.optString("nextpoint_code")); - // json.put("nextpoint_code2", row.optString("nextpoint_code2")); - // result.add(json); - // } - // } - // // 出箱扫码异常 - // if("2".equals(inOut_type)) { - // String where = "startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'"; - // if(uString.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.optString("instruct_uuid")); - // json.put("instructorder_no", row.optString("instructorder_no")); - // json.put("vehicle_code", row.optString("outvehicle_code")); - // json.put("wcsdevice_code", row.optString("startwcsdevice_code")); - // json.put("startpoint_code", row.optString("startpoint_code")); - // json.put("nextpoint_code", row.optString("nextpoint_code")); - // json.put("nextpoint_code2", row.optString("nextpoint_code2")); - // result.add(json); - // } - // } - // srb.addJSONArray("result", result); - return null; + 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; + + } /** @@ -358,223 +577,63 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ * "vehicle_code": "10001", "instruct_uuid": "uuid_0101" } */ @Override - public Object inOutExceptionInstConfirm(JSONObject param) { - // - // WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - // // 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码 - // String inOut_type = param.optString("inOut_type"); - // // 缓存线编码 - // String wcsdevice_code = param.optString("wcsdevice_code"); - // // - // String vehicle_code = param.optString("vehicle_code"); - // // 指令标识 - // // String instruct_uuid = param.optString("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; - // uWcsSchedule.notifyWcs(99, 3001, data); - return null; + 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); + + + } - /** - * 设置满箱物料 缓存线编码 wcsdevice_code 料箱码 vehicle_code 工序标识 workprocedure_uuid 物料标识 - * material_uuid 数量 quantity 重量 weight - */ - @Override - public Object setfullBox(JSONObject param) { - // - // String semimanufactures_uuid = param.optString("material_uuid"); - // // 料箱码 - // String vehicle_code = param.optString("vehicle_code"); - // // 层数 - // String layer_num = param.optString("layer_num"); - // // 顺序号 - // String seat_order_num = param.optString("seat_order_num"); - // // 缓存线 - // String wcsdevice_code = param.optString("wcsdevice_code"); - // String weight = param.optString("weight"); - // String quantity = param.optString("quantity"); - // if(uString.isEmpty(quantity) || param.optInt("quantity") <= 0) { - // srb.setFailure(); - // srb.setDesc("数量必须大于0!"); - // return null; - // } - // String workprocedure_code = param.optString("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) { srb.setFailure(); - // * srb.setDesc("条码【" + 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 extdevice_code like '%" + wcsdevice_code + "%'").uniqueResult(0); - // if(vehiobj == null) { - // srb.setFailure(); - // srb.setDesc("位置不存在,设置有误!"); - // return null; - // } - // // 判断物料去的缓存线是否正确 - // // 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).optString("materialprocess_series"); - // AgvTwoInst inst = new AgvTwoInst(); - // String cachelineCode2 = inst.getCachelineCode(materialprocess_series, wpObj.optString("workprocedure_code")); - // 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).optString("sysdic_name"); - // srb.setFailure(); - // srb.setDesc("该缓存线【" + wcsdevice_code + "】不能存放【" + materialprocess_seriesname + "】物料,操作失败!"); - // return null; - // } - // 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("extdevice_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", WDK.getUUID()); - // json.put("vehicle_code", vehicle_code); - // json.put("vehicle_uuid", vehicle_code); - // json.put("extdevice_code", wcsdevice_code); - // json.put("material_uuid", materObj.optString("semimanufactures_uuid")); - // json.put("material_code", materObj.optString("semimanufactures_code")); - // json.put("material_spec", materObj.optString("semimanufactures_spec")); - // json.put("material_name", materObj.optString("semimanufactures_name")); - // json.put("weight", weight); - // json.put("quantity", quantity); - // json.put("workprocedure_uuid", wpObj.optString("workprocedure_uuid")); - // json.put("workprocedure_code", wpObj.optString("workprocedure_code")); - // json.put("workprocedure_name", wpObj.optString("workprocedure_name")); - // // 有箱有料 - // json.put("vehicle_status", "02"); - // json.put("create_time", WDK.getDateTime()); - // ivtTab.insert(json); - return null; - } - @Override - public Object setEmptyBox(JSONObject param) { - // - // // 层数 - // String layer_num = param.optString("layer_num"); - // // 顺序号 - // String seat_order_num = param.optString("seat_order_num"); - // // 载具条码 - // String vehicle_code = param.optString("vehicle_code"); - // // 缓存线编码 - // String wcsdevice_code = param.optString("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) { srb.setFailure(); - // * srb.setDesc("条码【" + 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 extdevice_code like '%" + wcsdevice_code + "%'").uniqueResult(0); - // if(vehiobj == null) { - // srb.setFailure(); - // srb.setDesc("位置不存在,设置有误!"); - // return null; - // } - // 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("extdevice_code = '" + wcsdevice_code + "' and vehicle_code = - // // '" + vehicle_code + "'"); - // ivtTab.delete("vehicle_code = '" + vehicle_code + "'"); - // JSONObject json = new JSONObject(); - // // 状态设置为空箱 - // json.put("vehmaterial_uuid", WDK.getUUID()); - // json.put("vehicle_code", vehicle_code); - // json.put("vehicle_uuid", vehicle_code); - // json.put("extdevice_code", wcsdevice_code); - // json.put("vehicle_status", "01"); - // json.put("vehicle_code", vehicle_code); - // // json.put("vehicle_uuid", vehiobj.optString("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", WDK.getDateTime()); - // ivtTab.insert(json); - return null; - } - @Override - public Object setBlankPos(JSONObject param) { - // - // // 层数 - // String layer_num = param.optString("layer_num"); - // // 顺序号 - // String seat_order_num = param.optString("seat_order_num"); - // // 缓存线编码 - // String wcsdevice_code = param.optString("wcsdevice_code"); - // // 缓存线位置表【IF_CacheLine_Position】 - // WQLObject ivtTab = WQLObject.getWQLObject("IF_CacheLine_Position"); - // JSONObject json = ivtTab.query("layer_num = " + layer_num + " and extdevice_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); - return null; - } /** * AGV入箱子异常,(怎么判断入箱子异常) 缓存线编码 wcsdevice_code 满箱码 vehicle_code */ @Override - public Object agvInBoxExceptionQuery(JSONObject param) { - // String vehicle_code = param.optString("vehicle_code"); - // String wcsdevice_code = param.optString("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(uString.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.optString("instruct_uuid")); - // json.put("instructorder_no", row.optString("instructorder_no")); - // json.put("wcsdevice_code", row.optString("nextwcsdevice_code")); - // json.put("startpoint_code", row.optString("startpoint_code")); - // json.put("nextpoint_code", row.optString("nextpoint_code")); - // json.put("nextpoint_code2", row.optString("nextpoint_code2")); - // result.add(json); - // } - // srb.addJSONArray("result", result); - return null; + 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); + } + + return result; } /** @@ -584,111 +643,112 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ * "empty_vehicle_code": "10002", "instruct_uuid": "uuid_0101" } */ @Override - public Object agvInBoxExceptionConfirm(JSONObject param) { - // - // WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - // String instruct_uuid = param.optString("instruct_uuid"); - // String extdevice_code = param.optString("wcsdevice_code"); - // String empty_vehicle_code = param.optString("empty_vehicle_code"); - // String full_vehicle_code = param.optString("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) { srb.setFailure(); srb.setDesc("条码【" + - // * 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) - // * { srb.setFailure(); srb.setDesc("条码【" + 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 extdevice_code = '" + extdevice_code - // * + "' and outvehicle_code = '" + empty_vehicle_code + "'").uniqueResult(0); if - // * (emptyBoxObj == null || - // * uString.isEmpty(emptyBoxObj.optString("vehicle_code"))) { srb.setFailure(); - // * srb.setDesc("缓存线内的空箱:" + empty_vehicle_code + "不存在,操作失败"); return null; } - // * - // * // 找到空位子入满箱 JSONObject fullBoxObj = - // * ivtTab.query("is_blank = '1' AND extdevice_code = '" + extdevice_code + "'") - // * .uniqueResult(0); if (fullBoxObj == null) { srb.setFailure(); - // * srb.setDesc("在缓存线:" + extdevice_code + "未找到可用的货位进行满箱入库!"); return null; } - // */ - // // 删除出的空箱 - // /* - // * ivtTab.delete(("vehicle_status = '01' AND extdevice_code = '" + - // * extdevice_code + "' and vehicle_code = '" + empty_vehicle_code + "'")); // - // * 更新入库物料信息 JSONObject afterIvt = new JSONObject(); - // * afterIvt.put("vehmaterial_uuid", WDK.getUUID()); afterIvt.put("vehicle_code", - // * full_vehicle_code); afterIvt.put("vehicle_uuid", full_vehicle_code); - // * afterIvt.put("vehicle_status", "02"); afterIvt.put("produceorder_uuid", - // * instObj.optString("produceorder_uuid")); afterIvt.put("produceorder_code", - // * instObj.optString("produceorder_code")); afterIvt.put("workprocedure_uuid", - // * instObj.optString("startworkprocedure_uuid")); - // * afterIvt.put("workprocedure_code", - // * instObj.optString("startworkprocedure_code")); - // * afterIvt.put("workprocedure_name", - // * instObj.optString("startworkprocedure_name")); afterIvt.put("material_uuid", - // * instObj.optString("processmaterial_uuid")); afterIvt.put("material_code", - // * instObj.optString("processmaterial_code")); afterIvt.put("material_name", - // * instObj.optString("processmaterial_name")); afterIvt.put("material_spec", - // * instObj.optString("processmaterial_spec")); - // * afterIvt.put("deviceprocess_series", - // * instObj.optString("deviceprocess_series")); afterIvt.put("quantity", - // * instObj.optString("quantity")); afterIvt.put("weight", - // * instObj.optString("weight")); afterIvt.put("update_time", WDK.getDateTime()); - // * afterIvt.put("create_time", WDK.getDateTime()); - // * - // * ivtTab.insert(afterIvt); - // */ - // AgvTwoInst inst = new AgvTwoInst(); - // instObj.put("inboxtxm", full_vehicle_code); - // instObj.put("outboxtxm", empty_vehicle_code); - // inst.updateInstStatus(instObj, "1"); - // inst.updateInstStatus(instObj, "2"); - return null; + 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"); + + + /* + * 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"); + } /** * AGV出空箱异常 */ @Override - public Object agvOutBoxExceptionQuery(JSONObject param) { - // String vehicle_code = param.optString("vehicle_code"); - // String wcsdevice_code = param.optString("wcsdevice_code"); - // JSONArray arr = new JSONArray(); - // WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - // if(uString.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.optString("instruct_uuid")); - // json.put("instructorder_no", row.optString("instructorder_no")); - // json.put("wcsdevice_code", row.optString("startwcsdevice_code")); - // json.put("vehicle_code", row.optString("outvehicle_code")); - // json.put("startpoint_code", row.optString("startpoint_code")); - // json.put("nextpoint_code", row.optString("nextpoint_code")); - // json.put("nextpoint_code2", row.optString("nextpoint_code2")); - // result.add(json); - // } - // srb.addJSONArray("result", result); - return null; + 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); + } + + return result; } /** @@ -696,48 +756,49 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ * "vehicle_code": "10001", "instruct_uuid": "222" } */ @Override - public Object agvOutBoxExceptionConfirm(JSONObject param) { - // - // WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - // String instruct_uuid = param.optString("instruct_uuid"); - // String vehicle_code = param.optString("vehicle_code"); - // String extdevice_code = param.optString("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 extdevice_code = '" + - // * extdevice_code + "'") .uniqueResult(0); - // * - // * if (positionObj == null) { - // * srb.setFailure(); srb.setDesc("缓存线无剩余位置,操作失败"); return null; - // * - // * } - // * - // * // 入的空箱子 JSONObject afterIvt = new JSONObject(); - // * afterIvt.put("vehmaterial_uuid", WDK.getUUID()); afterIvt.put("vehicle_uuid", - // * vehicle_code); afterIvt.put("vehicle_code", vehicle_code); - // * afterIvt.put("extdevice_code", extdevice_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", WDK.getDateTime()); ivtTab.insert(afterIvt); - // */ - // AgvTwoInst inst = new AgvTwoInst(); - // // 出箱的时候入箱码和出箱码相同 - // instObj.put("inboxtxm", vehicle_code); - // instObj.put("outboxtxm", vehicle_code); - // inst.updateInstStatus(instObj, "1"); - // inst.updateInstStatus(instObj, "2"); - return null; + 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); + + /* + * // 缓存线载具物料表【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"); + } /** @@ -759,97 +820,98 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ * 此时满箱说明已经没有了,管理人员必须立即处理,进行盘点检查缓存线物料和箱子信息,通过手持盘点操作保证缓存线满箱物料和mes系统物料一致,才能让缓存线设备继续进行出入操作。 */ @Override - public Object cacheLineOutBoxExceptionQuery( + public JSONArray cacheLineOutBoxExceptionQuery( JSONObject param) { - // - // String agv_no = param.optString("agv_no"); - // String wcsdevice_code = param.optString("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.optString("instruct_uuid")); - // json.put("instructorder_no", row.optString("instructorder_no")); - // json.put("wcsdevice_code", row.optString("startwcsdevice_code")); - // json.put("vehicle_code", "0"); - // json.put("startpoint_code", row.optString("startpoint_code")); - // json.put("nextpoint_code", row.optString("nextpoint_code")); - // json.put("nextpoint_code2", row.optString("nextpoint_code2")); - // result.add(json); - // } - // srb.addJSONArray("result", result); - return null; + + 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; + } /** * 缓存线出箱异常确认 */ @Override - public Object cacheLineOutBoxExceptionConfirm( + public void cacheLineOutBoxExceptionConfirm( JSONObject param) { - // - // WQLObject instructTab = WQLObject.getWQLObject("IF_WCS_InstructPoint"); - // String instruct_uuid = param.optString("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", WDK.getDateTime()); - // instObj.put("remark", "缓存线出箱异常确认完成!"); - // instructTab.update(instObj); - // // 把所以来该缓存线的AGV指令都完成掉 - // if(instObj.optString("nextwcsdevice_code").contains("HCX")) { - // HashMap map = new HashMap<>(); - // map.put("instruct_status", "06"); - // map.put("instructfinish_mode", "02"); - // map.put("update_time", WDK.getDateTime()); - // map.put("remark", "缓存线出箱异常确认完成!"); - // instructTab.update(map, "nextwcsdevice_code = '" + instObj.optString("nextwcsdevice_code") + "' and instruct_status <> '06'"); - // } - // // 把所以从该缓存线出AGV指令都完成掉 - // if(instObj.optString("startwcsdevice_code").contains("HCX")) { - // HashMap map = new HashMap<>(); - // map.put("instruct_status", "06"); - // map.put("instructfinish_mode", "02"); - // map.put("update_time", WDK.getDateTime()); - // map.put("remark", "缓存线出箱异常确认完成!"); - // instructTab.update(map, "startwcsdevice_code = '" + instObj.optString("startwcsdevice_code") + "' and instruct_status <> '06'"); - // } - // // 得到异常的载具号 - // String vehicle_codeStr = instObj.optString("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 + "'"); - // } - // } - return null; + + 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 Object cacheLineExcepOpt(JSONObject param) { - // // 缓存线编码 - // String wcsdevice_code = param.optString("wcsdevice_code"); - // // 01-暂停、02-启动 - // String opt_type = param.optString("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; - // // 下发给wcs - // uWcsSchedule.notifyWcs(99, 1000, objs); - return null; + 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); + } /** @@ -858,28 +920,23 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{ * ctx.setRows(pageable.getPageSize() + ""); return ctx; } */ @Override - public Object pourMaterial(JSONObject param) { - // // 指令标识 - // String instruct_uuid = param.optString("instruct_uuid"); - // // 指令点位表【IF_WCS_InstructPoint】 - // JSONObject instObj = WQLObject.getWQLObject("IF_WCS_InstructPoint").query("instruct_uuid = '" + instruct_uuid + "'").uniqueResult(0); - // int putquantity = instObj.optInt("quantity"); - // String producer = instObj.optString("nextwcsdevice_code"); - // Object[] objs = new Object[2]; - // objs[0] = producer; - // objs[1] = putquantity; - // // 下发给wcs - // uWcsSchedule.notifyWcs(99, 3002, objs); - return null; + 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); + } - @Override - public Object cacheLineOutBoxExceptionQuery(String account_uuid, JSONObject param) { - return null; - } - @Override - public Object cacheLineOutBoxExceptionConfirm(String account_uuid, JSONObject param) { - return null; - } }