diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index 71ca3ee..ccc84d2 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -180,7 +180,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); Map extraValue = plcToAgvDeviceDriver.getExtraValue(); if (plcToAgvDeviceDriver.getAGVEnable() != 0) { - if (device_code.contains("_01")) { + /*if (device_code.contains("_01")) { if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); } @@ -193,7 +193,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic data = feedBackStatus(data, index, 1, inst, task, 2, false); } } - } else if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) { + } else */ + if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) { Object plc_to_agv = extraValue.get("upper_lower_levels"); if ("1".equals(plc_to_agv)) { plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1"); @@ -256,7 +257,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (device.getDeviceDriver() instanceof PlcToAgvDeviceDriver) { PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); - if (device_code.contains("_01")) { + /*if (device_code.contains("_01")) { try { List list = new ArrayList<>(); Map map = new HashMap(); @@ -278,27 +279,27 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic data = feedBackStatus(data, index, 2, inst, task, 2, false); } else if (device_code.contains("_02")) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); - } else { - try { - List list = new ArrayList<>(); - Map map = new HashMap(); - map.put("code", "AGVInOP"); - map.put("value", "0"); - Map map1 = new HashMap(); - map1.put("code", "AGVSetOutReqUpper"); - map1.put("value", "0"); - Map map2 = new HashMap(); - map2.put("code", "AGVSetOutReqLower"); - map2.put("value", "0"); - list.add(map); - list.add(map1); - list.add(map2); - plcToAgvDeviceDriver.writing(list); - } catch (Exception e) { - log.info("下发AGVInOP信号:{}失败", "0"); - } - data = feedBackStatus(data, index, 2, inst, task, 2, false); + } else {*/ + try { + List list = new ArrayList<>(); + Map map = new HashMap(); + map.put("code", "AGVInOP"); + map.put("value", "0"); + Map map1 = new HashMap(); + map1.put("code", "AGVSetOutReqUpper"); + map1.put("value", "0"); + Map map2 = new HashMap(); + map2.put("code", "AGVSetOutReqLower"); + map2.put("value", "0"); + list.add(map); + list.add(map1); + list.add(map2); + plcToAgvDeviceDriver.writing(list); + } catch (Exception e) { + log.info("下发AGVInOP信号:{}失败", "0"); } + data = feedBackStatus(data, index, 2, inst, task, 2, false); + /*}*/ } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { try { data = feedBackStatus(data, index, 2, inst, task, 1, false); @@ -340,7 +341,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); if (plcToAgvDeviceDriver.getAGVEnable() != 0) { Map extraValue = plcToAgvDeviceDriver.getExtraValue(); - if (device_code.contains("_01")) { + /*if (device_code.contains("_01")) { Object plc_to_agv = extraValue.get("upper_lower_levels"); if (ObjectUtil.isNotNull(plc_to_agv) && "1".equals(plc_to_agv)) { plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1"); @@ -353,7 +354,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); } - } else if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) { + } else */ + if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) { Object plc_to_agv = extraValue.get("upper_lower_levels"); if ("1".equals(plc_to_agv)) { plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1"); @@ -422,7 +424,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic transportOrder = ""; if (device.getDeviceDriver() instanceof PlcToAgvDeviceDriver) { PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); - if (device_code.contains("_01")) { + /*if (device_code.contains("_01")) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); } else if (device_code.contains("_02")) { try { @@ -444,27 +446,27 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("下发AGVInOP信号:{}失败", "0"); } data = feedBackStatus(data, index, 4, inst, task, 2, false); - } else { - try { - List list = new ArrayList<>(); - Map map = new HashMap(); - map.put("code", "AGVInOP"); - map.put("value", "0"); - Map map1 = new HashMap(); - map1.put("code", "AGVSetInReqUpper"); - map1.put("value", "0"); - Map map2 = new HashMap(); - map2.put("code", "AGVSetInReqLower"); - map2.put("value", "0"); - list.add(map); - list.add(map1); - list.add(map2); - plcToAgvDeviceDriver.writing(list); - } catch (Exception e) { - log.info("下发AGVInOP信号:{}失败", "0"); - } - data = feedBackStatus(data, index, 4, inst, task, 2, false); + } else {*/ + try { + List list = new ArrayList<>(); + Map map = new HashMap(); + map.put("code", "AGVInOP"); + map.put("value", "0"); + Map map1 = new HashMap(); + map1.put("code", "AGVSetInReqUpper"); + map1.put("value", "0"); + Map map2 = new HashMap(); + map2.put("code", "AGVSetInReqLower"); + map2.put("value", "0"); + list.add(map); + list.add(map1); + list.add(map2); + plcToAgvDeviceDriver.writing(list); + } catch (Exception e) { + log.info("下发AGVInOP信号:{}失败", "0"); } + data = feedBackStatus(data, index, 4, inst, task, 2, false); + /* }*/ } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { try { StandardOrdinarySiteDeviceDriver standar = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java index 3b8cec1..06cc043 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java @@ -13,6 +13,7 @@ public enum RegionEnum { DDLK("堆叠笼框工序","111-20"), NBJG("内部加工区","111-10"), WXJG("外协加工区","111-12"), + ZDZWQ("自动折弯区","ZDZWQ"), ; private final String region_name; private final String region_code; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java index 0ee4ece..fa312b6 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java @@ -53,6 +53,7 @@ public class FabController { private WmsToConnectorService wmsToConnectorService; + /** * 设备工序列表 * diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java index 645df92..3bc23f6 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java @@ -137,4 +137,13 @@ public class HandheldController { return new ResponseEntity<>(list,HttpStatus.OK); } + @PostMapping("/getPointVehicle") + @Log("获取点位的载具号") + @ApiOperation("获取点位的载具号") + @SaIgnore + public ResponseEntity getVehicleByPoint(@RequestBody JSONObject json) { + String vehicleCode = handheldService.selectVehicleByPoint(json); + return new ResponseEntity<>(vehicleCode,HttpStatus.OK); + } + } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java index cc69ab2..4c18a4f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java @@ -87,4 +87,11 @@ public interface HandheldService { * @return */ JSONObject deviceInLogin(JSONObject json); + + /** + * 获取点位的载具号 + * @param json + * @return + */ + String selectVehicleByPoint(JSONObject json); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java index 035e77e..0084a48 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java @@ -68,12 +68,93 @@ public class HandheldServiceImpl implements HandheldService { }, "参数不能为空!"); String vehicle = param.getString("vehicle_list"); String device_code = param.getString("device_code"); + String type = param.getString("type"); + switch (type) { + case "1": + artificialBending(vehicle, device_code, param); + break; + case "2": + semiAutomaticBending(vehicle, device_code, param); + break; + case "3": + break; + default: + break; + } + + } + + /** + * 空料架送回 + * + * @param vehicle + * @param device_code + * @param param + */ + private void semiAutomaticBending(String vehicle, String device_code, JSONObject param) { + MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle); + if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!"); + if (!mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S04.getVehicleCode()) + && !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())) { + throw new BadRequestException("不是料架,生成搬运任务失败!"); + } + SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); + if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); + AbstractTask connectorTask = taskFactory.getTask("RACKTask"); + // 准备参数:设备编码 + JSONObject jo = new JSONObject(); + jo.put("device_code", device_code); + jo.put("config_code", "RACKTask"); + jo.put("create_mode", GeneralDefinition.AUTO_CREATION); + jo.put("vehicle_code", vehicle); + jo.put("vehicle_type", mdBaseVehicle.getVehicle_type()); + jo.put("ext_data", param); + connectorTask.apply(jo); + } + + /** + * 空料框送回 + * + * @param vehicle + * @param device_code + * @param param + */ + private void artificialBending(String vehicle, String device_code, JSONObject param) { String[] vehicle_list = null; if (vehicle.contains(",")) { vehicle_list = vehicle.split(","); } - if (vehicle_list.length != 2 && vehicle_list.length != 4) { - throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!"); + if(CollUtil.isEmpty(Arrays.asList(vehicle_list))){ + MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle); + if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!"); + if (!mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S04.getVehicleCode()) + && !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())){ + throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!"); + } + }else { + String[] finalVehicle_list = vehicle_list; + MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle_list[0]); + if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!"); + if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode())) { + if (finalVehicle_list.length != 2) { + throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!"); + } + } + if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) { + if (finalVehicle_list.length != 4) { + throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!"); + } + } + Arrays.stream(vehicle_list).forEach(vehicleCode -> { + String vehicleCode1 = vehicleCode; + MdBaseVehicle mdBaseVehicle1 = iMdBaseVehicleService.selectByVehicleCode(vehicleCode1); + if (ObjectUtil.isEmpty(mdBaseVehicle1)) throw new BadRequestException("载具不存在!"); + if (!mdBaseVehicle1.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode()) + && !mdBaseVehicle1.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) { + throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!"); + } + }); + } SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); @@ -102,28 +183,39 @@ public class HandheldServiceImpl implements HandheldService { String region_code = param.getString("region_code"); String device_code = param.getString("device_code"); String vehicle_code = param.getString("vehicle_code"); + String type = param.getString("type"); AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask"); - if (StrUtil.isNotEmpty(region_code) && (RegionEnum.NBJG.getRegion_code().equals(region_code) - || RegionEnum.WXJG.getRegion_code().equals(region_code))) { - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("config_code", "ProcessingSMTTask"); - jo.put("create_mode", GeneralDefinition.AUTO_CREATION); - jo.put("vehicle_code", vehicle_code); - jo.put("region_code", region_code); - param.put("target_region_code", region_code); - jo.put("ext_data", param); - connectorTask.apply(jo); - iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) - .eq(SchBasePoint::getPoint_code, device_code) - .set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) - .set(SchBasePoint::getIs_lock, true) - .set(SchBasePoint::getVehicle_code, null)); - } else { - Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!"); - JSONArray materials = param.getJSONArray("material"); - SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); - if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); + switch (type) { + case "1": + goShelves(param, region_code, device_code, vehicle_code, connectorTask); + break; + case "2": + goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); + break; + case "3": + goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); + break; + default: + break; + } + } + + /** + * 物料下料去货架 + * + * @param param + * @param region_code + * @param device_code + * @param vehicle_code + * @param connectorTask + */ + private void goShelves(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { + Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!"); + JSONArray materials = param.getJSONArray("material"); + SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); + if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); + JSONObject jo = new JSONObject(); + if (StrUtil.isBlank(region_code)) { JSONObject json = new JSONObject(); JSONArray jsonArray = new JSONArray(); HashMap map = new HashMap<>(); @@ -159,57 +251,98 @@ public class HandheldServiceImpl implements HandheldService { } else if (ObjectUtil.isNotEmpty(json1)) { throw new BadRequestException(json1.getString("msg")); } - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("config_code", "BLANKINGTask"); - jo.put("create_mode", GeneralDefinition.AUTO_CREATION); - jo.put("vehicle_code", vehicle_code); jo.put("region_code", region_code); - jo.put("ext_data", param); - iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) - .eq(SchBasePoint::getPoint_code, device_code) - .set(SchBasePoint::getIs_lock, true) - .set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) - .set(SchBasePoint::getVehicle_code, null)); - connectorTask.apply(jo); - iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) - .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); - materials.stream().forEach(material -> { - String replace = StrUtil.replace(StrUtil.toString(material), "=", ":"); - JSONObject jsonObject = JSONObject.parseObject(replace); - SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); - schBaseVehiclematerialgroup.setVehicle_code(vehicle_code); - schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInteger("material_qty")); - schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getString("material_code")); - schBaseVehiclematerialgroup.setOrder_code(jsonObject.getString("order_code")); - schBaseVehiclematerialgroup.setDue_date(jsonObject.getString("due_date")); - schBaseVehiclematerialgroup.setRegion_code(jsonObject.getString("region_code")); - iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); - }); - + } else { + jo.put("region_code", region_code); } + jo.put("device_code", device_code); + jo.put("config_code", "BLANKINGTask"); + jo.put("create_mode", GeneralDefinition.AUTO_CREATION); + jo.put("vehicle_code", vehicle_code); + jo.put("region_code", region_code); + jo.put("ext_data", param); + iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) + .eq(SchBasePoint::getPoint_code, device_code) + .set(SchBasePoint::getIs_lock, true) + .set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) + .set(SchBasePoint::getVehicle_code, null)); + connectorTask.apply(jo); + iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) + .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); + String finalRegion_code = region_code; + materials.stream().forEach(material -> { + String replace = StrUtil.replace(StrUtil.toString(material), "=", ":"); + replace = replace.replaceAll("material_code:,", ""); + // 使用 Hutool 的 JSONUtil 解析 JSON 字符串 + cn.hutool.json.JSONObject jsonObject1 = JSONUtil.parseObj(replace); + // 判断 material_code 是否为空 + if (replace.contains("OR")) { + Object materialCode = jsonObject1.get("order_code"); + jsonObject1.put("order_code", materialCode.toString()); + replace = jsonObject1.toString(); + } + JSONObject jsonObject = JSONObject.parseObject(replace); + SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); + schBaseVehiclematerialgroup.setVehicle_code(vehicle_code); + schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInteger("material_qty")); + schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getString("material_code")); + schBaseVehiclematerialgroup.setOrder_code(jsonObject.getString("order_code")); + schBaseVehiclematerialgroup.setDue_date(jsonObject.getString("due_date")); + schBaseVehiclematerialgroup.setRegion_code(StrUtil.isBlank(finalRegion_code) ? jsonObject.getString("region_code") : finalRegion_code); + iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); + }); } + /** + * 物料下料去外协或内部加工区 + * + * @param param + * @param region_code + * @param device_code + * @param vehicle_code + * @param connectorTask + */ + private void goWxOrNx(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { + JSONObject jo = new JSONObject(); + jo.put("device_code", device_code); + jo.put("config_code", "ProcessingSMTTask"); + jo.put("create_mode", GeneralDefinition.AUTO_CREATION); + jo.put("vehicle_code", vehicle_code); + jo.put("region_code", region_code); + param.put("target_region_code", region_code); + jo.put("ext_data", param); + connectorTask.apply(jo); + iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) + .eq(SchBasePoint::getPoint_code, device_code) + .set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) + .set(SchBasePoint::getIs_lock, true) + .set(SchBasePoint::getVehicle_code, null)); + } + + @Override public String pointLock(JSONObject param) { Assert.noNullElements(new Object[]{param.getString("region_code"), param.getString("status")}, "参数不能为空!"); - String region_code = param.getString("region_code"); + JSONArray region_code = param.getJSONArray("region_code"); String status = param.getString("status"); - SchBaseRegion schBaseRegion = iSchBaseRegionService.getOne(Wrappers.lambdaQuery(SchBaseRegion.class) - .eq(SchBaseRegion::getRegion_code, region_code)); - if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!"); - List pointCodes = iSchBasePointService.getByRegionCode(region_code); - if (StrUtil.equals(status, "0")) { - iSchBasePointService.releasePoint(region_code); - iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes); - } else if (StrUtil.equals(status, "1")) { - boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes); - if (is_executing) { - throw new BadRequestException("该区域有任务正在执行,请等待任务执行完成再锁定!"); + region_code.stream().forEach(region -> { + String s = StrUtil.toString(region); + SchBaseRegion schBaseRegion = iSchBaseRegionService.getOne(Wrappers.lambdaQuery(SchBaseRegion.class) + .eq(SchBaseRegion::getRegion_code, s)); + if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!"); + List pointCodes = iSchBasePointService.getByRegionCode(s); + if (StrUtil.equals(status, "0")) { + iSchBasePointService.releasePoint(s); + iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes); + } else if (StrUtil.equals(status, "1")) { + boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes); + if (is_executing) { + throw new BadRequestException("该区域有任务正在执行,请等待任务执行完成再锁定!"); + } + iSchBaseTaskService.selectByPointCodeAndTaskStatus(pointCodes); + iSchBasePointService.lockPoint(s); } - iSchBaseTaskService.selectByPointCodeAndTaskStatus(pointCodes); - iSchBasePointService.lockPoint(region_code); - } + }); return "操作成功"; } @@ -377,5 +510,13 @@ public class HandheldServiceImpl implements HandheldService { return null; } + @Override + public String selectVehicleByPoint(JSONObject json) { + Assert.notNull(json.getString("device_code"), "参数不能为空!"); + SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code")); + if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); + return schBasePoint.getVehicle_code(); + } + } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java index f074a54..271451b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java @@ -82,6 +82,16 @@ public class EmptyCageTask extends AbstractTask { schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R02.getVehicleCode(), 2); break; + case "S04": + //RO2空料容 + schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(), + GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S04.getVehicleCode(), 2); + break; + case "S06": + //RO2空料容 + schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(), + GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S06.getVehicleCode(), 2); + break; default: break; } @@ -100,9 +110,12 @@ public class EmptyCageTask extends AbstractTask { task.setTask_status(TaskStatus.CREATED.getCode()); taskService.updateById(task); - + if (vehicle_type.equals(VehicleTypeEnum.FRAME_R01.getVehicleCode()) || vehicle_type.equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) { + schBasePoint.setVehicles(task.getVehicle_code()); + } else { + schBasePoint.setVehicle_code(task.getVehicle_code()); + } schBasePoint.setVehicle_qty(task.getVehicle_qty()); - schBasePoint.setVehicles(task.getVehicle_code()); schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue()); schBasePoint.setIs_lock(true); PointUtils.setUpdateByAcs(schBasePoint); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java index 7200001..2639d85 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java @@ -63,7 +63,7 @@ public class RackTask extends AbstractTask { for (SchBaseTask task : tasks) { String vehicle_type = task.getVehicle_type(); - SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(null, + SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.ZDZWQ.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue(),vehicle_type, 1); if (ObjectUtil.isEmpty(schBasePoint)) { task.setRemark("未找到所需点位!"); @@ -83,7 +83,7 @@ public class RackTask extends AbstractTask { schBasePoint.setVehicles(task.getVehicle_code()); - schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); + schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue()); schBasePoint.setIs_lock(true); PointUtils.setUpdateByAcs(schBasePoint); pointService.updateById(schBasePoint); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java index e382e45..5db2ae4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java @@ -70,8 +70,6 @@ public class SortingSMTTask extends AbstractTask { JSONObject jsonObject = JSONObject.parseObject(requestParam); // 根据对接位查找对应的载具类型 SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.ZDFJ.getRegion_code(),task.getVehicle_code(),"1"); - if(ObjectUtil.isEmpty(schBasePoint)) continue; - jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type()); if (ObjectUtil.isEmpty(schBasePoint)) { task.setRemark("未找到所需点位!"); taskService.updateById(task); @@ -80,6 +78,7 @@ public class SortingSMTTask extends AbstractTask { NoticeTypeEnum.WARN.getCode()); continue; } + jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type()); schBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) .eq(SchBaseVehiclematerialgroup::getVehicle_code, task.getVehicle_code())); JSONArray pallet_detail = jsonObject.getJSONArray("pallet_detail");