Browse Source

fix: 修复与sorting交互问题

master
yanps 2 months ago
parent
commit
d9b995ad94
  1. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  2. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/dto/ConnectorDto.java
  3. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java
  4. 23
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java
  5. 30
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java
  6. 88
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  7. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

1
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());

3
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;
/**
* 任务号
*/

9
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<ConnectorDto> 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());

23
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));
}
/**

30
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<SchBaseVehiclematerialgroupMapper, SchBaseVehiclematerialgroup> implements ISchBaseVehiclematerialgroupService {
@ -55,8 +55,9 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
@Autowired
private ISchBasePointService pointService;
@Override
public IPage<SchBaseVehiclematerialgroup> queryAll(SchBaseVehiclematerialgroupQuery whereJson, PageQuery page){
public IPage<SchBaseVehiclematerialgroup> queryAll(SchBaseVehiclematerialgroupQuery whereJson, PageQuery page) {
IPage<SchBaseVehiclematerialgroup> pages = new Page<>(page.getPage() + 1, page.getSize());
IPage<SchBaseVehiclematerialgroup> 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<SchBaseV
.eq(StrUtil.isNotBlank(whereJson.getGroup_bind_material_status()), SchBaseVehiclematerialgroup::getGroup_bind_material_status, whereJson.getGroup_bind_material_status())
.eq(StrUtil.isNotBlank(whereJson.getRegion_code()), SchBaseVehiclematerialgroup::getRegion_code, whereJson.getRegion_code()));
schBaseVehiclematerialgroupIPage.getRecords().forEach(item -> {
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<SchBaseV
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
if(StringUtils.isNotBlank(entity.getPoint_code()))
{
if (StringUtils.isNotBlank(entity.getPoint_code())) {
entity.setRegion_code(pointService.getById(entity.getPoint_code()).getRegion_code());
}
entity.setGroup_id(IdUtil.getSnowflake(1,1).nextIdStr());
entity.setGroup_id(StrUtil.isNotEmpty(entity.getGroup_id()) ? entity.getGroup_id() : IdUtil.getSnowflake(1, 1).nextIdStr());
entity.setCreate_id(currentUserId);
entity.setCreate_name(nickName);
entity.setCreate_time(now);
@ -158,9 +156,9 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
List<SchBaseVehiclematerialgroup> 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;

88
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<SchBasePointMapper, Sch
private final Object lock = new Object();
private final Object lock2 = new Object();
@Override
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) {
@ -249,42 +251,44 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override
@Transactional(rollbackFor = Exception.class)
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode, String piont_type) {
//查询载具的类型
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode);
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
//查询满足条件的站点
List<SchBasePoint> 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<SchBasePoint> 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<SchBasePoint> 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<SchBasePoint> 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<SchBasePointMapper, Sch
.eq(SchBasePoint::getIs_used, true)
.eq(SchBasePoint::getPoint_status, pointStatus)
.eq(SchBasePoint::getPoint_type, "1")
.eq(StrUtil.isNotBlank(vehicle_type),SchBasePoint::getCan_vehicle_type, vehicle_type)
.eq(StrUtil.isNotBlank(vehicle_type), SchBasePoint::getCan_vehicle_type, vehicle_type)
.isNull(seq == 2, SchBasePoint::getVehicles)
.isNull(seq == 1, SchBasePoint::getVehicle_code)
.eq(StrUtil.isNotBlank(region_code), SchBasePoint::getRegion_code, region_code)
@ -428,10 +432,10 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
List<String> 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<SchBasePointMapper, Sch
.set(SchBasePoint::getVehicles, null));
}
SchBasePoint schBasePoint1 = null;
if(vehicle_qty == 1){
if (vehicle_qty == 1) {
schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code());
}else{
} else {
schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code() + "_" + (vehicle_qty - 1));
}
if(ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("该货位不存在!");
if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("该货位不存在!");
schBasePoint1.setVehicle_code(s);
return schBasePoint1;
}
@ -523,7 +527,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
//查询满足条件的站点
List<SchBasePoint> 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));

9
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);
}

Loading…
Cancel
Save