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. 18
      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:物料不存在 //TODO:物料不存在
} }
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
schBaseVehiclematerialgroup.setGroup_id(connectorDto.getID());
schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code()); schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code());
schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname()); schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname());
schBaseVehiclematerialgroup.setMaterial_id(connectorDto.getProductID()); 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 * 数据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, "请求参数为空!"); Assert.noNullElements(jsonArray, "请求参数为空!");
List<ConnectorDto> connectorDtos = BeanUtil.copyToList(jsonArray, ConnectorDto.class); List<ConnectorDto> connectorDtos = BeanUtil.copyToList(jsonArray, ConnectorDto.class);
for (ConnectorDto connectorDto : connectorDtos) { for (ConnectorDto connectorDto : connectorDtos) {
if(StrUtil.isEmpty(connectorDto.getID())) throw new BadRequestException("物料id为null!");
SchBaseVehiclematerialgroup one = iSchBaseVehiclematerialgroupService.getOne(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) SchBaseVehiclematerialgroup one = iSchBaseVehiclematerialgroupService.getOne(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getJob_name, connectorDto.getJobname()) .eq(SchBaseVehiclematerialgroup::getGroup_id, connectorDto.getID()));
.eq(SchBaseVehiclematerialgroup::getMaterial_id, connectorDto.getProductID())
.eq(SchBaseVehiclematerialgroup::getOrder_code, connectorDto.getProductionOrder()));
if (ObjectUtil.isNotNull(one)) { if (ObjectUtil.isNotNull(one)) {
throw new BadRequestException("jobName:" + connectorDto.getJobname() + "orderCode:" throw new BadRequestException("id:" + connectorDto.getID() + "," + "该物料信息已存在!");
+ connectorDto.getProductionOrder() + "ProductID:" + connectorDto.getProductID() + "该物料信息已存在!");
} }
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
schBaseVehiclematerialgroup.setGroup_id(connectorDto.getID());
schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code()); schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code());
schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname()); schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname());
schBaseVehiclematerialgroup.setMaterial_id(connectorDto.getProductID()); 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); goShelves(schBasePoint, param, region_code, device_code, vehicle_code, connectorTask);
break; break;
case "2": case "2":
goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); goWxOrNx(param, RegionEnum.NBJG.getRegion_code(), device_code, vehicle_code, connectorTask);
break; break;
case "3": case "3":
goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); goWxOrNx(param, RegionEnum.WXJG.getRegion_code(), device_code, vehicle_code, connectorTask);
break; break;
case "4": 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; break;
default: default:
break; break;
@ -226,8 +226,21 @@ public class HandheldServiceImpl implements HandheldService {
* @param vehicle_code * @param vehicle_code
* @param connectorTask * @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; import java.util.Set;
/** /**
* @description 服务实现 * @author lyd
* @author lyd * @description 服务实现
* @date 2023-05-16 * @date 2023-05-16
**/ **/
@Slf4j @Slf4j
@Service @Service
public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseVehiclematerialgroupMapper, SchBaseVehiclematerialgroup> implements ISchBaseVehiclematerialgroupService { public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseVehiclematerialgroupMapper, SchBaseVehiclematerialgroup> implements ISchBaseVehiclematerialgroupService {
@ -55,8 +55,9 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
@Autowired @Autowired
private ISchBasePointService pointService; private ISchBasePointService pointService;
@Override @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> pages = new Page<>(page.getPage() + 1, page.getSize());
IPage<SchBaseVehiclematerialgroup> schBaseVehiclematerialgroupIPage = vehiclematerialgroupMapper.selectPage(pages, Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) IPage<SchBaseVehiclematerialgroup> schBaseVehiclematerialgroupIPage = vehiclematerialgroupMapper.selectPage(pages, Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(StrUtil.isNotBlank(whereJson.getVehicle_code()), SchBaseVehiclematerialgroup::getVehicle_code, whereJson.getVehicle_code()) .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.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())); .eq(StrUtil.isNotBlank(whereJson.getRegion_code()), SchBaseVehiclematerialgroup::getRegion_code, whereJson.getRegion_code()));
schBaseVehiclematerialgroupIPage.getRecords().forEach(item -> { schBaseVehiclematerialgroupIPage.getRecords().forEach(item -> {
if(StrUtil.isNotBlank(item.getMaterial_id())) if (StrUtil.isNotBlank(item.getMaterial_id())) {
{
MdBaseMaterial mdBaseMaterial = iMdBaseMaterialService.getOne(Wrappers.lambdaQuery(MdBaseMaterial.class) MdBaseMaterial mdBaseMaterial = iMdBaseMaterialService.getOne(Wrappers.lambdaQuery(MdBaseMaterial.class)
.eq(MdBaseMaterial::getMaterial_code, item.getMaterial_id())); .eq(MdBaseMaterial::getMaterial_code, item.getMaterial_id()));
if(ObjectUtil.isNotEmpty(mdBaseMaterial)){ if (ObjectUtil.isNotEmpty(mdBaseMaterial)) {
item.setMaterial_name(mdBaseMaterial.getMaterial_name()); item.setMaterial_name(mdBaseMaterial.getMaterial_name());
item.setMaterial_spec(mdBaseMaterial.getMaterial_spec()); item.setMaterial_spec(mdBaseMaterial.getMaterial_spec());
item.setMaterial_code(mdBaseMaterial.getMaterial_code()); 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()); 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 currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName(); String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now(); 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.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_id(currentUserId);
entity.setCreate_name(nickName); entity.setCreate_name(nickName);
entity.setCreate_time(now); entity.setCreate_time(now);
@ -158,9 +156,9 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
List<SchBaseVehiclematerialgroup> order_code = vehiclematerialgroupMapper.selectList(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) List<SchBaseVehiclematerialgroup> order_code = vehiclematerialgroupMapper.selectList(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getOrder_code, orderList.get("order_code")) .eq(SchBaseVehiclematerialgroup::getOrder_code, orderList.get("order_code"))
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
if(CollUtil.isNotEmpty(order_code)){ if (CollUtil.isNotEmpty(order_code)) {
orderList.put("region_code",order_code.get(0).getRegion_code()); orderList.put("region_code", order_code.get(0).getRegion_code());
orderList.put("due_date",order_code.get(0).getDue_date()); orderList.put("due_date", order_code.get(0).getDue_date());
} }
}); });
return maps; return maps;

18
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 lock = new Object();
private final Object lock2 = new Object();
@Override @Override
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) { public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) {
@ -249,6 +251,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode, String piont_type) { public SchBasePoint selectByRegionCode(String region_code, String vehicleCode, String piont_type) {
synchronized (lock2) {
//查询载具的类型 //查询载具的类型
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode); MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode);
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
@ -286,6 +289,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
} }
return null; return null;
} }
}
@Override @Override
public SchBasePoint selectByPointCode(String start_device_code) { public SchBasePoint selectByPointCode(String start_device_code) {
@ -391,7 +395,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
.eq(SchBasePoint::getIs_used, true) .eq(SchBasePoint::getIs_used, true)
.eq(SchBasePoint::getPoint_status, pointStatus) .eq(SchBasePoint::getPoint_status, pointStatus)
.eq(SchBasePoint::getPoint_type, "1") .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 == 2, SchBasePoint::getVehicles)
.isNull(seq == 1, SchBasePoint::getVehicle_code) .isNull(seq == 1, SchBasePoint::getVehicle_code)
.eq(StrUtil.isNotBlank(region_code), SchBasePoint::getRegion_code, region_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<>(); List<String> msg = new ArrayList<>();
String vehicles = schBasePoint.getVehicles(); String vehicles = schBasePoint.getVehicles();
boolean contains = vehicles.contains(","); boolean contains = vehicles.contains(",");
if(contains){ if (contains) {
String[] split = vehicles.split(","); String[] split = vehicles.split(",");
msg = Arrays.asList(split); msg = Arrays.asList(split);
}else{ } else {
msg.add(vehicles); msg.add(vehicles);
} }
Integer vehicle_qty = schBasePoint.getVehicle_qty(); Integer vehicle_qty = schBasePoint.getVehicle_qty();
@ -448,12 +452,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
.set(SchBasePoint::getVehicles, null)); .set(SchBasePoint::getVehicles, null));
} }
SchBasePoint schBasePoint1 = null; SchBasePoint schBasePoint1 = null;
if(vehicle_qty == 1){ if (vehicle_qty == 1) {
schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code()); schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code());
}else{ } else {
schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code() + "_" + (vehicle_qty - 1)); 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); schBasePoint1.setVehicle_code(s);
return schBasePoint1; 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). List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
isNotNull(SchBasePoint::getVehicle_code) 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()) .eq(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
.in(SchBasePoint::getCan_vehicle_type, vehicleType) .in(SchBasePoint::getCan_vehicle_type, vehicleType)
.eq(SchBasePoint::getIs_used, true)); .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.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -96,15 +97,19 @@ public class SortingSMTTask extends AbstractTask {
String workorder = jO.getString("ProductionOrder"); String workorder = jO.getString("ProductionOrder");
String ProductID = jO.getString("ProductID"); String ProductID = jO.getString("ProductID");
Integer qty = jO.getInteger("Currentqty"); 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"); String region_code = jO.getString("NextOperation");
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code); schBaseVehiclematerialgroup.setVehicle_code(task.getVehicle_code());
schBaseVehiclematerialgroup.setPoint_code(schBasePoint.getPoint_code()); schBaseVehiclematerialgroup.setPoint_code(schBasePoint.getPoint_code());
schBaseVehiclematerialgroup.setMaterial_id(ProductID); schBaseVehiclematerialgroup.setMaterial_id(ProductID);
schBaseVehiclematerialgroup.setMaterial_qty(qty); schBaseVehiclematerialgroup.setMaterial_qty(qty);
schBaseVehiclematerialgroup.setRegion_code(region_code); schBaseVehiclematerialgroup.setRegion_code(region_code);
schBaseVehiclematerialgroup.setOrder_code(workorder); schBaseVehiclematerialgroup.setOrder_code(workorder);
schBaseVehiclematerialgroup.setJob_name(Jobname);
schBaseVehiclematerialgroup.setDue_date(dueDate);
schBaseVehiclematerialgroup.setExtend(JSON.toJSONString(jO));
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
} }

Loading…
Cancel
Save