diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index b651f7b..cc2cfdd 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -155,8 +155,21 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); Device device = null; String device_code = null; - - + String old_device_code = null; + + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + device = deviceAppService.findDeviceByCode(device_code); + } // AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; @@ -243,8 +256,10 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); String is_enter = standardAutodoorDeviceDriver.getExtraValue().get("is_enter").toString(); - if (StrUtil.isNotBlank(is_enter) && !"true".equals(is_enter)) { + if (StrUtil.isNotBlank(is_enter) && "false".equals(is_enter)) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); + } else { + log.info("区域已锁定,请释放后在进入"); } } } else { @@ -260,8 +275,10 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); String is_enter = standardAutodoorDeviceDriver.getExtraValue().get("is_enter").toString(); - if (StrUtil.isNotBlank(is_enter) && !"true".equals(is_enter)) { + if (StrUtil.isNotBlank(is_enter) && "false".equals(is_enter)) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); + } else { + log.info("区域已锁定,请释放后在进入"); } } } else { diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 2308f58..f2c7ed9 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -685,6 +685,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { .set("0".equals(param.getString("status")),DeviceExtra::getExtra_value, "false") .set("1".equals(param.getString("status")),DeviceExtra::getExtra_value, "true") ); + Device deviceByCode = deviceAppService.findDeviceByCode(point); + deviceByCode.getExtraValue().put("is_enter", "1".equals(param.getString("status"))?"true":"false"); }); } else { deviceExtraService.update(Wrappers.lambdaUpdate(DeviceExtra.class) @@ -694,6 +696,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { .set("0".equals(param.getString("status")),DeviceExtra::getExtra_value, "false") .set("1".equals(param.getString("status")),DeviceExtra::getExtra_value, "true") ); + Device deviceByCode = deviceAppService.findDeviceByCode(pointCode); + deviceByCode.getExtraValue().put("is_enter", "1".equals(param.getString("status"))?"true":"false"); } return null; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java index e141147..7301379 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java @@ -39,7 +39,7 @@ public class ConnectorToWmsController { @Log("推送物料信息") @ApiOperation("推送物料信息") @SaIgnore - @PostMapping("/createMaterial") + @PostMapping("/addMaterial") public ResponseEntity createMaterial(@RequestBody JSONArray jsonArray){ return new ResponseEntity(connectorService.createMaterial(jsonArray), HttpStatus.OK); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java index 4244663..053ea89 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java @@ -10,7 +10,9 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.extern.slf4j.Slf4j; +import net.dreamlu.mica.core.exception.ServiceException; import nl.basjes.shaded.org.springframework.util.Assert; +import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.database.material.service.dao.MdBaseMaterial; import org.nl.wms.ext.acs.service.WmsToAcsService; @@ -130,6 +132,14 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService { Assert.noNullElements(jsonArray, "请求参数为空!"); List connectorDtos = BeanUtil.copyToList(jsonArray, ConnectorDto.class); for (ConnectorDto connectorDto : connectorDtos) { + SchBaseVehiclematerialgroup one = iSchBaseVehiclematerialgroupService.getOne(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) + .eq(SchBaseVehiclematerialgroup::getJob_name, connectorDto.getJobname()) + .eq(SchBaseVehiclematerialgroup::getMaterial_id, connectorDto.getProductID()) + .eq(SchBaseVehiclematerialgroup::getOrder_code, connectorDto.getProductionOrder())); + if (ObjectUtil.isNotNull(one)) { + throw new BadRequestException("jobName:" + connectorDto.getJobname() + "orderCode:" + + connectorDto.getProductionOrder() + "ProductID:" + connectorDto.getProductID() + "该物料信息已存在!"); + } SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code()); schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname()); 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 3846d60..b405b35 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 @@ -208,11 +208,28 @@ public class HandheldServiceImpl implements HandheldService { case "3": goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); break; + case "4": + connectorBlanking(schBasePoint, param, region_code, device_code, vehicle_code, connectorTask); + break; default: break; } } + /** + * connector下料入库 + * + * @param schBasePoint + * @param param + * @param region_code + * @param device_code + * @param vehicle_code + * @param connectorTask + */ + private void connectorBlanking(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { + + } + /** * 物料下料去货架 * @@ -506,10 +523,10 @@ public class HandheldServiceImpl implements HandheldService { SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); Param isInvokeConnector = sysParamService.findByCode(GeneralDefinition.HANDHELD_LOGIN_TIME); int loginTime = 3; - if(ObjectUtil.isNotEmpty(isInvokeConnector)){ + if (ObjectUtil.isNotEmpty(isInvokeConnector)) { loginTime = Integer.parseInt(isInvokeConnector.getValue()); } - redisUtils.set("mobile:" + json.getString("device_code"), json.getString("device_code"),loginTime, TimeUnit.HOURS); + redisUtils.set("mobile:" + json.getString("device_code"), json.getString("device_code"), loginTime, TimeUnit.HOURS); } } SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code")); @@ -536,13 +553,13 @@ public class HandheldServiceImpl implements HandheldService { @Override public void updateRoute(JSONObject json) { Assert.noNullElements(new String[]{json.getString("type"), json.getString("status")}, "参数不能为空!"); - switch(json.getString("type")){ + switch (json.getString("type")) { case "1": JSONObject jsonObject = new JSONObject(); SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); Param isConnectConnector = sysParamService.findByCode(GeneralDefinition.ADD_ROUTE_DOOR_1); - jsonObject.put("pointCode",isConnectConnector.getValue()); - jsonObject.put("status",json.getString("status")); + jsonObject.put("pointCode", isConnectConnector.getValue()); + jsonObject.put("status", json.getString("status")); wmsToAcsService.notifyAcs1(jsonObject); break; default: diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/sorting/service/impl/SortingServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/sorting/service/impl/SortingServiceImpl.java index e45b5e5..f237afa 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/sorting/service/impl/SortingServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/sorting/service/impl/SortingServiceImpl.java @@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.gson.Gson; import lombok.extern.slf4j.Slf4j; import org.nl.common.enums.region.RegionEnum; +import org.nl.common.exception.BadRequestException; import org.nl.config.IdUtil; import org.nl.config.MapOf; import org.nl.wms.ext.connector.service.dto.ConnectorDto; @@ -94,14 +95,23 @@ public class SortingServiceImpl implements SortingService { connectorTask.apply(taskParam); //TODO:叫料 } else if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { + if (StrUtil.isEmpty(vehicle_code)) { + return MapOf.of("status", 400, "msg", "载具号未传递!"); + } taskParam.put("config_code", "SortingCMTTask"); connectorTask.apply(taskParam); //TODO:将空托盘放到线边库 } else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) { + if (StrUtil.isEmpty(vehicle_code)) { + return MapOf.of("status", 400, "msg", "载具号未传递!"); + } taskParam.put("config_code", "SortingSNTTask"); connectorTask.apply(taskParam); //TODO:将满料放到线边库 } else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { + if (StrUtil.isEmpty(vehicle_code)) { + return MapOf.of("status", 400, "msg", "载具号未传递!"); + } taskParam.put("config_code", "SortingSMTTask"); connectorTask.apply(taskParam); } @@ -109,12 +119,12 @@ public class SortingServiceImpl implements SortingService { //TODO:呼叫两个空笼框 if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) { taskParam.put("device_code", pointCode + "_01"); - taskParam.put("task_seq","1"); + taskParam.put("task_seq", "1"); taskParam.put("config_code", "SortingTwoCNTTask"); taskParam.put("task_code", task_code + "A"); connectorTask.apply(taskParam); taskParam.put("device_code", pointCode + "_02"); - taskParam.put("task_seq","2"); + taskParam.put("task_seq", "2"); taskParam.put("task_code", task_code + "B"); connectorTask.apply(taskParam); //TODO:将两个笼框放到线边库 @@ -123,13 +133,13 @@ public class SortingServiceImpl implements SortingService { return MapOf.of("status", 400, "msg", "第二个笼框载具号未传递!"); } taskParam.put("config_code", "SortingSMTTask"); - taskParam.put("task_seq","1"); + taskParam.put("task_seq", "1"); taskParam.put("vehicle_code", jsonObject.getString("vehicle_code2")); taskParam.put("device_code", pointCode + "_02"); taskParam.put("task_code", task_code + "B"); connectorTask.apply(taskParam); taskParam.put("vehicle_code", vehicle_code); - taskParam.put("task_seq","2"); + taskParam.put("task_seq", "2"); taskParam.put("device_code", pointCode + "_01"); taskParam.put("task_code", task_code + "A"); connectorTask.apply(taskParam); 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 5ebf383..9dfb233 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 @@ -1,5 +1,6 @@ package org.nl.wms.sch.task_manage.task.tasks.sorting; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -70,9 +71,13 @@ public class SortingSMTTask extends AbstractTask { String requestParam = task.getRequest_param(); JSONObject jsonObject = JSONObject.parseObject(requestParam); JSONArray pallet_detail = jsonObject.getJSONArray("pallet_detail"); - JSONObject jsonObject1 = JSONObject.parseObject(StrUtil.toString(pallet_detail.get(0))); - String regionCode = StrUtil.isEmpty(jsonObject1.getString("NextOperation")) ? - RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code() : jsonObject1.getString("NextOperation"); + String NextOperation = null; + if (CollUtil.isNotEmpty(pallet_detail) && pallet_detail.size() > 0) { + JSONObject jsonObject1 = JSONObject.parseObject(StrUtil.toString(pallet_detail.get(0))); + NextOperation = ObjectUtil.isNotEmpty(jsonObject1) && StrUtil.isNotEmpty(jsonObject1.getString("NextOperation")) ? jsonObject1.getString("NextOperation") : null; + } + String regionCode = StrUtil.isEmpty(NextOperation) ? + RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code() : NextOperation; // 根据对接位查找对应的载具类型 SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(regionCode, task.getVehicle_code(), "1"); if (ObjectUtil.isEmpty(schBasePoint)) { diff --git a/lms/nladmin-ui/src/views/wms/sch/task/index.vue b/lms/nladmin-ui/src/views/wms/sch/task/index.vue index 0149e4d..6ff3f15 100644 --- a/lms/nladmin-ui/src/views/wms/sch/task/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/task/index.vue @@ -167,11 +167,11 @@ {{ scope.row.vehicle_code ? scope.row.vehicle_code : '-' }} - +