opt: 取消NDC任务,手持下发任务优化

This commit is contained in:
yanps
2024-11-18 14:34:11 +08:00
parent 3937ed3a3b
commit d92ec484fa
7 changed files with 47 additions and 22 deletions

View File

@@ -60,9 +60,9 @@ public class WmsToConnectorServiceImpl implements WmsToConnectorService {
materials.forEach(material -> {
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
JSONObject jsonObject1 = JSONObject.parseObject(replace);
jsonObject1.put("due_date", "2000-10-01 00:00:00 ");
jsonObject1.put("due_date", "2000-10-01 00:00:00");
jsonObject1.put("next_region_code", "");
jsonObject1.put("priority", "5");
jsonObject1.put("priority", "");
objects.add(jsonObject1);
});
jsonObject.put("data", objects);

View File

@@ -108,6 +108,7 @@ public class HandheldServiceImpl implements HandheldService {
private void applyDeliveryRacks(String vehicle, String device_code, JSONObject param) {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
if (schBasePoint.getIs_lock()) throw new BadRequestException("当前点位存在任务!");
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle);
if (ObjectUtil.isEmpty(mdBaseVehicle))
throw new BadRequestException("载具不存在!");
@@ -127,7 +128,9 @@ public class HandheldServiceImpl implements HandheldService {
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type());
jo.put("ext_data", param);
connectorTask.apply(jo);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
.set(SchBasePoint::getIs_lock, true));
}
/**
@@ -285,7 +288,7 @@ public class HandheldServiceImpl implements HandheldService {
/**
* connector下料入库
*
* @param schBasePoint
* @param
* @param param
* @param region_code
* @param device_code
@@ -305,9 +308,7 @@ public class HandheldServiceImpl implements HandheldService {
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));
.set(SchBasePoint::getIs_lock, true));
}
/**
@@ -330,12 +331,12 @@ public class HandheldServiceImpl implements HandheldService {
if (StrUtil.isBlank(region_code)) {
JSONObject json = new JSONObject();
JSONArray jsonArray = new JSONArray();
HashMap<String, Object> map = new HashMap<>();
materials.stream().forEach(material2 -> {
boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code"));
if (material_code) {
((LinkedHashMap) material2).remove("material_code");
}
HashMap<String, Object> map = new HashMap<>();
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material2);
map.put("order_code", jsonObject.get("order_code"));
map.put("qty", jsonObject.get("material_qty"));
@@ -428,9 +429,7 @@ public class HandheldServiceImpl implements HandheldService {
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));
.set(SchBasePoint::getIs_lock, true));
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
materials.stream().forEach(material -> {

View File

@@ -78,7 +78,7 @@
ROW_NUMBER() OVER (PARTITION BY vg.vehicle_code ORDER BY vg.due_date) AS rn
FROM
sch_base_vehiclematerialgroup vg
where 1=1
where vg.is_delete = 0
<if test="query.vehicle_code != null">
AND vg.vehicle_code = #{query.vehicle_code}
</if>
@@ -97,6 +97,7 @@
<if test="query.material_id != null">
AND vg.material_id like CONCAT('%', #{query.material_id}, '%')
</if>
order by vg.region_code desc
)
SELECT *
FROM RankedVehicles

View File

@@ -77,7 +77,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
if (StrUtil.isNotBlank(item.getRegion_code())) {
item.setRegion_name(item.getRegion_code());
} else {
item.setRegion_name("未知");
item.setRegion_code("未知");
}
SchBasePoint one = pointService.getOne(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getVehicle_code, item.getVehicle_code()));
@@ -170,7 +170,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
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());
orderList.put("priority",order_code.get(0).getPriority());
orderList.put("priority", order_code.get(0).getPriority());
}
});
maps = maps.stream().sorted(Comparator.comparingLong(order -> {
@@ -193,6 +193,10 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
@Override
public Object createTask(JSONObject entity) {
Assert.noNullElements(new Object[]{entity.get("point_code2"), entity.get("vehicle_code")}, "载具号不能为空!");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(entity.getString("point_code2"));
if (ObjectUtil.isEmpty(schBasePoint) || schBasePoint.getIs_lock()) {
throw new BadRequestException("当前点位不存在或点位正在执行任务");
}
JSONObject param = new JSONObject();
param.put("device_code", entity.get("point_code2"));
param.put("config_code", "PcOperationCMTask");
@@ -201,7 +205,6 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
pcOperationCMTask.apply(param);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, entity.get("point_code2"))
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.set(SchBasePoint::getIs_lock, true));
this.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getVehicle_code, entity.get("vehicle_code"))

View File

@@ -293,7 +293,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override
public SchBasePoint selectByPointCode(String start_device_code) {
return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getPoint_code, start_device_code)
return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, start_device_code)
.eq(SchBasePoint::getIs_used, true));
}