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 ff536b1..1b35bb1 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 @@ -507,6 +507,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { //TODO:物料不存在 } SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); + schBaseVehiclematerialgroup.setGroup_id(connectorDto.getID()); schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code()); schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname()); schBaseVehiclematerialgroup.setMaterial_id(connectorDto.getProductID()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/dto/ConnectorDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/dto/ConnectorDto.java index 47d6747..1890189 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/dto/ConnectorDto.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/dto/ConnectorDto.java @@ -15,7 +15,8 @@ public class ConnectorDto { /** * 数据ID */ - private String id; + @SerializedName("iD") + private String ID; /** * 任务号 */ 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 053ea89..f15fc03 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 @@ -132,15 +132,14 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService { Assert.noNullElements(jsonArray, "请求参数为空!"); List connectorDtos = BeanUtil.copyToList(jsonArray, ConnectorDto.class); for (ConnectorDto connectorDto : connectorDtos) { + if(StrUtil.isEmpty(connectorDto.getID())) throw new BadRequestException("物料id为null!"); 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())); + .eq(SchBaseVehiclematerialgroup::getGroup_id, connectorDto.getID())); if (ObjectUtil.isNotNull(one)) { - throw new BadRequestException("jobName:" + connectorDto.getJobname() + "orderCode:" - + connectorDto.getProductionOrder() + "ProductID:" + connectorDto.getProductID() + "该物料信息已存在!"); + throw new BadRequestException("id:" + connectorDto.getID() + "," + "该物料信息已存在!"); } SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); + schBaseVehiclematerialgroup.setGroup_id(connectorDto.getID()); schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code()); schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname()); schBaseVehiclematerialgroup.setMaterial_id(connectorDto.getProductID()); 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 b405b35..8482afb 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 @@ -203,13 +203,13 @@ public class HandheldServiceImpl implements HandheldService { goShelves(schBasePoint, param, region_code, device_code, vehicle_code, connectorTask); break; case "2": - goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); + goWxOrNx(param, RegionEnum.NBJG.getRegion_code(), device_code, vehicle_code, connectorTask); break; case "3": - goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); + goWxOrNx(param, RegionEnum.WXJG.getRegion_code(), device_code, vehicle_code, connectorTask); break; case "4": - connectorBlanking(schBasePoint, param, region_code, device_code, vehicle_code, connectorTask); + connectorBlanking(param, RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(), device_code, vehicle_code, connectorTask); break; default: break; @@ -226,8 +226,21 @@ public class HandheldServiceImpl implements HandheldService { * @param vehicle_code * @param connectorTask */ - private void connectorBlanking(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { - + private void connectorBlanking(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)); } /** diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java index e7b6678..44b1945 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java @@ -36,10 +36,10 @@ import java.util.Map; import java.util.Set; /** -* @description 服务实现 -* @author lyd -* @date 2023-05-16 -**/ + * @author lyd + * @description 服务实现 + * @date 2023-05-16 + **/ @Slf4j @Service public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl implements ISchBaseVehiclematerialgroupService { @@ -55,8 +55,9 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl queryAll(SchBaseVehiclematerialgroupQuery whereJson, PageQuery page){ + public IPage queryAll(SchBaseVehiclematerialgroupQuery whereJson, PageQuery page) { IPage pages = new Page<>(page.getPage() + 1, page.getSize()); IPage schBaseVehiclematerialgroupIPage = vehiclematerialgroupMapper.selectPage(pages, Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) .eq(StrUtil.isNotBlank(whereJson.getVehicle_code()), SchBaseVehiclematerialgroup::getVehicle_code, whereJson.getVehicle_code()) @@ -64,18 +65,16 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl { - if(StrUtil.isNotBlank(item.getMaterial_id())) - { + if (StrUtil.isNotBlank(item.getMaterial_id())) { MdBaseMaterial mdBaseMaterial = iMdBaseMaterialService.getOne(Wrappers.lambdaQuery(MdBaseMaterial.class) .eq(MdBaseMaterial::getMaterial_code, item.getMaterial_id())); - if(ObjectUtil.isNotEmpty(mdBaseMaterial)){ + if (ObjectUtil.isNotEmpty(mdBaseMaterial)) { item.setMaterial_name(mdBaseMaterial.getMaterial_name()); item.setMaterial_spec(mdBaseMaterial.getMaterial_spec()); item.setMaterial_code(mdBaseMaterial.getMaterial_code()); } } - if(StrUtil.isNotBlank(item.getRegion_code())) - { + if (StrUtil.isNotBlank(item.getRegion_code())) { item.setRegion_name(pointService.list(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, item.getRegion_code())).get(0).getRegion_name()); } }); @@ -88,11 +87,10 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl order_code = vehiclematerialgroupMapper.selectList(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) .eq(SchBaseVehiclematerialgroup::getOrder_code, orderList.get("order_code")) .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); - if(CollUtil.isNotEmpty(order_code)){ - orderList.put("region_code",order_code.get(0).getRegion_code()); - orderList.put("due_date",order_code.get(0).getDue_date()); + if (CollUtil.isNotEmpty(order_code)) { + orderList.put("region_code", order_code.get(0).getRegion_code()); + orderList.put("due_date", order_code.get(0).getDue_date()); } }); return maps; 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 62c6201..f3312e9 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 @@ -75,6 +75,8 @@ public class SchBasePointServiceImpl extends ServiceImpl queryAll(Map whereJson, PageQuery page) { @@ -249,42 +251,44 @@ public class SchBasePointServiceImpl extends ServiceImpl schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) - .eq(SchBasePoint::getIs_lock, false) - .isNull(SchBasePoint::getVehicle_code) - .eq(SchBasePoint::getPoint_type, piont_type) - .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); - 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::getPoint_type, piont_type) - .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 = schBasePoints1.get(0); - schBasePoint.setVehicle_code(vehicleCode); - schBasePoint.setIs_lock(true); - return schBasePoint; + synchronized (lock2) { + //查询载具的类型 + MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode); + if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); + //查询满足条件的站点 + List schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) + .eq(SchBasePoint::getIs_lock, false) + .isNull(SchBasePoint::getVehicle_code) + .eq(SchBasePoint::getPoint_type, piont_type) + .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); + 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::getPoint_type, piont_type) + .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 = schBasePoints1.get(0); + schBasePoint.setVehicle_code(vehicleCode); + schBasePoint.setIs_lock(true); + return schBasePoint; + } + return null; } - return null; } @Override @@ -391,7 +395,7 @@ public class SchBasePointServiceImpl extends ServiceImpl msg = new ArrayList<>(); String vehicles = schBasePoint.getVehicles(); boolean contains = vehicles.contains(","); - if(contains){ + if (contains) { String[] split = vehicles.split(","); msg = Arrays.asList(split); - }else{ + } else { msg.add(vehicles); } Integer vehicle_qty = schBasePoint.getVehicle_qty(); @@ -448,12 +452,12 @@ public class SchBasePointServiceImpl extends ServiceImpl schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). isNotNull(SchBasePoint::getVehicle_code) - .eq(StrUtil.isNotEmpty(region_code),SchBasePoint::getRegion_code, region_code) + .eq(StrUtil.isNotEmpty(region_code), SchBasePoint::getRegion_code, region_code) .eq(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue()) .in(SchBasePoint::getCan_vehicle_type, vehicleType) .eq(SchBasePoint::getIs_used, true)); 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 9dfb233..6641cb0 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 @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -96,15 +97,19 @@ public class SortingSMTTask extends AbstractTask { String workorder = jO.getString("ProductionOrder"); String ProductID = jO.getString("ProductID"); Integer qty = jO.getInteger("Currentqty"); - String vehicle_code = jO.getString("vehicle_code"); + String Jobname = jO.getString("Jobname"); + String dueDate = jO.getString("DueDate"); String region_code = jO.getString("NextOperation"); SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); - schBaseVehiclematerialgroup.setVehicle_code(vehicle_code); + schBaseVehiclematerialgroup.setVehicle_code(task.getVehicle_code()); schBaseVehiclematerialgroup.setPoint_code(schBasePoint.getPoint_code()); schBaseVehiclematerialgroup.setMaterial_id(ProductID); schBaseVehiclematerialgroup.setMaterial_qty(qty); schBaseVehiclematerialgroup.setRegion_code(region_code); schBaseVehiclematerialgroup.setOrder_code(workorder); + schBaseVehiclematerialgroup.setJob_name(Jobname); + schBaseVehiclematerialgroup.setDue_date(dueDate); + schBaseVehiclematerialgroup.setExtend(JSON.toJSONString(jO)); schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); }