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 1451ad8..57919cf 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 @@ -492,6 +492,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); } else { + if(connector_and_sorting == 1){ + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } log.info("指令号:{},phase:{},acs反馈wms失败:{}", inst.getInstruction_code(), phase, httpResponse); } } else { diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 8fcd0de..4b50aa6 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -335,7 +335,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("点位不存在!device_code:" + device_code); SchBasePoint schBasePoint1 = pointService.selectByNextWaitPoint(device_code, schBaseTask.getVehicle_code()); if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("未查询到可用点位!等待点位:" + device_code); - return schBasePoint; + return schBasePoint1; } return null; } @@ -489,6 +489,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { schBaseVehiclematerialgroup.setExtend(connectorDto.toString()); schBaseVehiclematerialgroup.setOrder_code(connectorDto.getProductionOrder()); iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); + taskService.update(Wrappers.lambdaUpdate(SchBaseTask.class).eq(SchBaseTask::getTask_code, schBaseTask.getTask_code()) + .set(SchBaseTask::getJob_name, connectorDto.getJobname())); } } } 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 1fee937..fd17b0a 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 @@ -42,7 +42,8 @@ public class SortingServiceImpl implements SortingService { @Override public Map createAgvTask(JSONObject jsonObject) { try { - Assert.noNullElements(new Object[]{jsonObject,jsonObject.getString("pointCode"),jsonObject.getString("vehicle_code")},"请求参数不能为空"); + Assert.noNullElements(new Object[]{jsonObject,jsonObject.getString("pointCode"),jsonObject.getString("vehicle_code") + ,jsonObject.getString("task_type"),jsonObject.getString("is_empty")},"请求参数不能为空"); //任务号 String task_code = jsonObject.getString("task_code"); String pointCode = jsonObject.getString("pointCode"); @@ -58,21 +59,22 @@ public class SortingServiceImpl implements SortingService { //托盘上的堆垛信息 JSONArray jsonArray = JSONUtil.parseArray(jsonObject.get("pallet_detail")); // TODO:呼叫空托 - JSONObject taskParam = new JSONObject(MapOf.of("task_code",task_code,"job_name",jobname,"device_code",pointCode,"requestNo", "sorting_"+IdUtil.getStringId(),"ext_data",jsonObject)); + JSONObject taskParam = new JSONObject(MapOf.of("task_code",task_code,"job_name",jobname,"device_code",pointCode,"requestNo" + , "sorting_"+IdUtil.getStringId(),"ext_data",jsonObject,"vehicle_code",vehicle_code,"ext_data",jsonObject)); if(SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)){ - taskParam.put("config_code","sortingCNTTask"); + taskParam.put("config_code","SortingCNTTask"); sortingCNTTask.apply(taskParam); //TODO:叫料 }else if(SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)){ - taskParam.put("config_code","sortingCMTTask"); + taskParam.put("config_code","SortingCMTTask"); sortingCMTTask.apply(taskParam); //TODO:将空托盘放到线边库 }else if(SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)){ - taskParam.put("config_code","sortingSNTTask"); + taskParam.put("config_code","SortingSNTTask"); sortingSNTTask.apply(taskParam); //TODO:将满料放到线边库 }else if(SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)){ - taskParam.put("config_code","sortingCMTTask"); + taskParam.put("config_code","SortingSMTTask"); sortingSMTTask.apply(taskParam); } return MapOf.of("status", 200,"msg", "sucess"); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java index aecc6a5..3c411b4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/dao/SchBasePoint.java @@ -73,6 +73,9 @@ public class SchBasePoint implements Serializable { @ApiModelProperty(value = "层") private Integer layer_num; + @ApiModelProperty(value = "工序顺序") + private Integer region_seq; + @ApiModelProperty(value = "入库顺序") private Integer in_order_seq; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java index 28373c2..904e251 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java @@ -35,10 +35,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -232,41 +229,44 @@ public class SchBasePointServiceImpl extends ServiceImpl schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). - isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) - .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true)); + List schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) + .eq(SchBasePoint::getIs_lock, false) + .isNull(SchBasePoint::getVehicle_code) + .eq(SchBasePoint::getRegion_code, region_code) + .eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) + .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) + .eq(SchBasePoint::getIs_used, true)); if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){ SchBasePoint schBasePoint = schBasePoints.get(0); schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setIs_lock(true); - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - schBasePoint.setUpdate_id(currentUserId); - schBasePoint.setUpdate_name(nickName); - schBasePoint.setUpdate_time(now); + schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); + PointUtils.setUpdateByAcs(schBasePoint); updateById(schBasePoint); return schBasePoint; } + SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0); + if(ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("不存在该区域!"); //分配载具类型相同的站点 - List schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). - isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) - .eq(SchBasePoint::getIs_used, true).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())); + List schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) + .eq(SchBasePoint::getIs_lock, false) + .isNull(SchBasePoint::getVehicle_code) + .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) + .eq(SchBasePoint::getIs_used, true) + .eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())); + schBasePoints1.stream().sorted(Comparator.comparingInt(schBasePoint -> Math.abs(schBasePoint1.getRegion_seq() - schBasePoint.getRegion_seq()))); if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){ - SchBasePoint schBasePoint = schBasePoints.get(0); + SchBasePoint schBasePoint = schBasePoints1.get(0); schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setIs_lock(true); - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - schBasePoint.setUpdate_id(currentUserId); - schBasePoint.setUpdate_name(nickName); - schBasePoint.setUpdate_time(now); + schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); + PointUtils.setUpdateByAcs(schBasePoint); updateById(schBasePoint); return schBasePoint; } @@ -285,40 +285,39 @@ public class SchBasePointServiceImpl extends ServiceImpl schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). - isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) - .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true)); + List schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) + .eq(SchBasePoint::getIs_lock, false) + .isNull(SchBasePoint::getVehicle_code) + .eq(SchBasePoint::getRegion_code, region_code) + .eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) + .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) + .eq(SchBasePoint::getIs_used, true)); if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){ SchBasePoint schBasePoint1 = schBasePoints.get(0); SchBasePoint schBasePoint = pointMapper.selectById(schBasePoint1.getNext_wait_point()); if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!"); schBasePoint1.setVehicle_code(vehicleCode); schBasePoint1.setIs_lock(true); - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - schBasePoint1.setUpdate_id(currentUserId); - schBasePoint1.setUpdate_name(nickName); - schBasePoint1.setUpdate_time(now); + schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); + PointUtils.setUpdateByAcs(schBasePoint); updateById(schBasePoint1); return schBasePoint; } //分配载具类型相同的站点 - List schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). - isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) - .eq(SchBasePoint::getIs_used, true).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())); + List schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) + .eq(SchBasePoint::getIs_lock, false) + .isNull(SchBasePoint::getVehicle_code) + .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()) + .eq(SchBasePoint::getIs_used, true) + .eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())); if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){ - SchBasePoint schBasePoint1 = schBasePoints.get(0); + SchBasePoint schBasePoint1 = schBasePoints1.get(0); SchBasePoint schBasePoint = pointMapper.selectById(schBasePoint1.getNext_wait_point()); if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!"); schBasePoint1.setVehicle_code(vehicleCode); schBasePoint1.setIs_lock(true); - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - schBasePoint1.setUpdate_id(currentUserId); - schBasePoint1.setUpdate_name(nickName); - schBasePoint1.setUpdate_time(now); + schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); + PointUtils.setUpdateByAcs(schBasePoint); updateById(schBasePoint1); return schBasePoint; } @@ -334,12 +333,8 @@ public class SchBasePointServiceImpl extends ServiceImpl tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); @@ -78,7 +81,7 @@ public class SortingSNTTask extends AbstractTask { } //删除组盘信息 schBaseVehiclematerialgroupService.remove(new QueryWrapper() - .eq("vehiicle_code",schBasePoint.getVehicle_code())); + .eq("vehicle_code",schBasePoint.getVehicle_code())); taskService.update(new UpdateWrapper() .set("task_status",TaskStatus.CREATED.getCode()) .set("point_code2",schBasePoint.getPoint_code()) @@ -126,13 +129,15 @@ public class SortingSNTTask extends AbstractTask { // 起点清空 if (ObjectUtil.isNotEmpty(schBasePoint)) { PointUtils.updateByIngTaskCode(schBasePoint); - pointService.updateById(schBasePoint); + pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) + .set(SchBasePoint::getIs_lock, false)); } String point_code2 = taskObj.getPoint_code2(); SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); if (ObjectUtil.isNotEmpty(schBasePoint2)) { PointUtils.updateByIngTaskCode(schBasePoint2); - pointService.updateById(schBasePoint2); + pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) + .set(SchBasePoint::getIs_lock, false)); } // 任务完成 taskObj.setTask_status(TaskStatus.FINISHED.getCode());