fix: 修复手持测试过程中遇到的问题
This commit is contained in:
@@ -11,7 +11,7 @@ import lombok.Getter;
|
||||
@AllArgsConstructor
|
||||
public enum VehicleTypeEnum {
|
||||
|
||||
TRAY("T001","钢托盘"),
|
||||
TRAY("G01","钢托盘"),
|
||||
FRAME_R01("R01","料框 1230mm*840mm*990mm"),
|
||||
FRAME_R02("R02","料框 1230mm*840mm*450mm"),
|
||||
RACKS_S04("S04","料架 1230mm*840mm*1670mm"),
|
||||
|
||||
@@ -123,7 +123,7 @@ public class MobileAuthorizationController {
|
||||
@Log("PC登出")
|
||||
public ResponseEntity<Object> loginOut(@Validated @RequestBody AuthUserDto authUser) {
|
||||
// 密码解密 - 前端的加密规则: encrypt(根据实际更改)
|
||||
redisUtils.del("mobile:" + authUser.getDevice());
|
||||
redisUtils.del("mobile:" + authUser.getDevice_code());
|
||||
return new ResponseEntity(TableDataInfo.build(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,5 +36,5 @@ public class AuthUserDto {
|
||||
|
||||
private String uuid = "";
|
||||
|
||||
private String device ;
|
||||
private String device_code ;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext.connector.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -53,13 +54,16 @@ public class WmsToConnectorServiceImpl implements WmsToConnectorService {
|
||||
return jsonObject;
|
||||
} else if (ObjectUtil.isNotEmpty(isInvokeConnector) && GeneralDefinition.NO.equals(isInvokeConnector.getValue())) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
JSONArray objects = new JSONArray();
|
||||
jsonObject.put("status",200);
|
||||
jsonObject1.put("due_date","");
|
||||
jsonObject1.put("next_region_code","");
|
||||
jsonObject1.put("order_code","");
|
||||
objects.add(jsonObject1);
|
||||
JSONArray materials = json.getJSONArray("materials");
|
||||
materials.forEach(material -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(replace);
|
||||
jsonObject1.put("due_date"," ");
|
||||
jsonObject1.put("next_region_code","");
|
||||
objects.add(jsonObject1);
|
||||
});
|
||||
jsonObject.put("data",objects);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@@ -49,4 +49,6 @@ public class SendMaterVo {
|
||||
|
||||
public String due_date;
|
||||
|
||||
List<SendVehicleVo> mater;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ public class SendVehicleVo {
|
||||
* 订单号
|
||||
*/
|
||||
private String order_code;
|
||||
/**
|
||||
* 交期时间
|
||||
*/
|
||||
private String due_date;
|
||||
/**
|
||||
* 物料信息
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,6 @@ public class SendVehiclesVo {
|
||||
/**
|
||||
* 物料信息
|
||||
*/
|
||||
List<SendVehicleVo> sendVehicleVoList;
|
||||
List<SendVehicleVo> mater;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationSMTTask;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.pcoperation.PcOperationSNTTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -77,6 +78,7 @@ public class FabServiceImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createAgvTask(JSONObject form, String type) {
|
||||
JSONObject param = new JSONObject();
|
||||
switch (type) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import nl.basjes.shaded.org.springframework.util.Assert;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.VehicleTypeEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -31,6 +32,7 @@ import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -67,7 +69,7 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
String vehicle = param.getString("vehicle_list");
|
||||
String device_code = param.getString("device_code");
|
||||
String[] vehicle_list = null;
|
||||
if(vehicle.contains(",")){
|
||||
if (vehicle.contains(",")) {
|
||||
vehicle_list = vehicle.split(",");
|
||||
}
|
||||
if (vehicle_list.length != 2 && vehicle_list.length != 4) {
|
||||
@@ -93,83 +95,99 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cageBlankingTask(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")},
|
||||
"当前点位或目的地不能为空!");
|
||||
JSONArray materials = param.getJSONArray("material");
|
||||
String region_code = param.getString("region_code");
|
||||
String device_code = param.getString("device_code");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
/*String material_qty = param.getString("material_qty");
|
||||
String material_code = param.getString("material_code");*/
|
||||
String region_code = param.getString("region_code");
|
||||
/*String order_code = param.getString("order_code");*/
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
materials.stream().forEach(material2 -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material2), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
map.put("order_code", jsonObject.getString("order_code"));
|
||||
map.put("qty", jsonObject.getString("material_qty"));
|
||||
jsonArray.add(map);
|
||||
});
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("region_code", region_code);
|
||||
json.put("materials", jsonArray);
|
||||
JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json);
|
||||
if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == 200) {
|
||||
JSONArray date = json1.getJSONArray("data");
|
||||
date.stream().forEach(date1 -> {
|
||||
JSONObject json2 = JSONObject.parseObject(StrUtil.toString(date1));
|
||||
materials.stream().forEach(material -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
if (jsonObject.getString("order_code").equals(json2.getString("order_code"))) {
|
||||
jsonObject.put("due_date", json2.getString("due_date"));
|
||||
jsonObject.put("region_code", json2.getString("next_region_code"));
|
||||
}
|
||||
});
|
||||
});
|
||||
region_code = JSONObject.parseObject(StrUtil.toString(date.get(0))).getString("region_code");
|
||||
} else if (ObjectUtil.isNotEmpty(json1)) {
|
||||
throw new BadRequestException(json1.getString("msg"));
|
||||
}
|
||||
param.put("material", materials);
|
||||
if (!param.getString("region_code").equals(RegionEnum.NBJG.getRegion_code())) {
|
||||
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!");
|
||||
}
|
||||
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
if (RegionEnum.NBJG.getRegion_code().equals(region_code) || RegionEnum.WXJG.getRegion_code().equals(region_code)) {
|
||||
if (StrUtil.isNotEmpty(region_code) && (RegionEnum.NBJG.getRegion_code().equals(region_code)
|
||||
|| RegionEnum.WXJG.getRegion_code().equals(region_code))) {
|
||||
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));
|
||||
} else {
|
||||
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!");
|
||||
JSONArray materials = param.getJSONArray("material");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
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");
|
||||
}
|
||||
String replace = StrUtil.replace(StrUtil.toString(material2), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
map.put("order_code", jsonObject.getString("order_code"));
|
||||
map.put("qty", jsonObject.getString("material_qty"));
|
||||
jsonArray.add(map);
|
||||
});
|
||||
json.put("vehicle_code", vehicle_code);
|
||||
json.put("region_code", region_code);
|
||||
json.put("materials", jsonArray);
|
||||
JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json);
|
||||
if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == 200) {
|
||||
JSONArray date = json1.getJSONArray("data");
|
||||
date.stream().forEach(date1 -> {
|
||||
JSONObject json2 = JSONObject.parseObject(StrUtil.toString(date1));
|
||||
materials.stream().forEach(material -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
if (jsonObject.getString("order_code").equals(json2.getString("order_code"))) {
|
||||
jsonObject.put("due_date", json2.getString("due_date"));
|
||||
jsonObject.put("region_code", json2.getString("next_region_code"));
|
||||
}
|
||||
});
|
||||
});
|
||||
region_code = JSONObject.parseObject(StrUtil.toString(date.get(0))).getString("region_code");
|
||||
} else if (ObjectUtil.isNotEmpty(json1)) {
|
||||
throw new BadRequestException(json1.getString("msg"));
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "BLANKINGTask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("region_code", region_code);
|
||||
jo.put("ext_data", param);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, device_code)
|
||||
.set(SchBasePoint::getIs_lock, true)
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.set(SchBasePoint::getVehicle_code, null));
|
||||
connectorTask.apply(jo);
|
||||
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
||||
materials.stream().forEach(material -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code);
|
||||
schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInteger("material_qty"));
|
||||
schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getString("material_code"));
|
||||
schBaseVehiclematerialgroup.setOrder_code(jsonObject.getString("order_code"));
|
||||
schBaseVehiclematerialgroup.setDue_date(jsonObject.getString("due_date"));
|
||||
schBaseVehiclematerialgroup.setRegion_code(jsonObject.getString("region_code"));
|
||||
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||
});
|
||||
|
||||
}
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("region_code", region_code);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
||||
materials.stream().forEach(material -> {
|
||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
||||
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code);
|
||||
schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInteger("material_qty"));
|
||||
schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getString("material_code"));
|
||||
schBaseVehiclematerialgroup.setOrder_code(jsonObject.getString("order_code"));
|
||||
schBaseVehiclematerialgroup.setDue_date(jsonObject.getString("due_date"));
|
||||
schBaseVehiclematerialgroup.setRegion_code(jsonObject.getString("region_code"));
|
||||
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||
});
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, device_code)
|
||||
.set(SchBasePoint::getIs_lock, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,20 +199,17 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
.eq(SchBaseRegion::getRegion_code, region_code));
|
||||
if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!");
|
||||
List<String> pointCodes = iSchBasePointService.getByRegionCode(region_code);
|
||||
boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes);
|
||||
if (is_executing) {
|
||||
return "当前区域有任务正在执行,请等待任务执行完在锁定!";
|
||||
}
|
||||
iSchBaseTaskService.selectByPointCodeAndTaskStatus(pointCodes);
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
iSchBasePointService.releasePoint(region_code);
|
||||
iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes);
|
||||
} else if (StrUtil.equals(status, "1")) {
|
||||
boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes);
|
||||
if (is_executing) {
|
||||
throw new BadRequestException("该区域有任务正在执行,请等待任务执行完成再锁定!");
|
||||
}
|
||||
iSchBaseTaskService.selectByPointCodeAndTaskStatus(pointCodes);
|
||||
iSchBasePointService.lockPoint(region_code);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(pointCodes) && pointCodes.size() > 0) {
|
||||
return "当前区域已存在的任务有" + pointCodes.size() + "个";
|
||||
}
|
||||
return "操作成功";
|
||||
}
|
||||
|
||||
@@ -215,9 +230,13 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "TOSTOREHOUSETask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_type);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, device_code)
|
||||
.set(SchBasePoint::getIs_lock, true)
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,7 +267,7 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
@Override
|
||||
public void materialTransfer(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")}, "参数不能为空!");
|
||||
// String vehicle_code = param.getString("vehicle_code");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
String device_code = param.getString("device_code");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
@@ -258,10 +277,14 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "MTTask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
/*jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type());*/
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, device_code)
|
||||
.set(SchBasePoint::getIs_lock, true)
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.set(SchBasePoint::getVehicle_code, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -333,7 +356,7 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
public JSONObject
|
||||
deviceInLogin(JSONObject json) {
|
||||
Assert.notNull(json.getString("device_code"), "登录参数不能为空");
|
||||
if(StrUtil.isNotEmpty(json.getString("device_code"))){
|
||||
if (StrUtil.isNotEmpty(json.getString("device_code"))) {
|
||||
Object regin_code = redisUtils.get("mobile:" + json.getString("device_code"));
|
||||
if (regin_code != null) {
|
||||
throw new BadRequestException("当前设备工序已经登陆,无法继续选择");
|
||||
|
||||
@@ -142,7 +142,7 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
* @param vehicle_type
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByVehicleQty(String config_code, String vehicle_type);
|
||||
SchBasePoint selectByVehicleQty(String vehicle_type);
|
||||
|
||||
/**
|
||||
* 根据载具类型查询点位
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</select>
|
||||
<select id="selectByRegionCode" resultType="java.lang.String">
|
||||
select
|
||||
sbp.vehicle_code
|
||||
sbp.point_code
|
||||
from
|
||||
sch_base_point sbp
|
||||
where
|
||||
|
||||
@@ -356,14 +356,21 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectByVehicleQty(String config_code, String vehicle_type) {
|
||||
Assert.noNullElements(new Object[]{config_code, vehicle_type}, "载具类型不能为空!");
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false)
|
||||
public SchBasePoint selectByVehicleQty(String vehicle_type) {
|
||||
Assert.noNullElements(new Object[]{vehicle_type}, "载具类型不能为空!");
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.isNotNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getRegion_code, config_code)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type));
|
||||
return null;
|
||||
if (CollectionUtils.isEmpty(schBasePoints)) {
|
||||
return null;
|
||||
}
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
this.update(new UpdateWrapper<SchBasePoint>()
|
||||
.set("is_lock", true)
|
||||
.eq("point_code", schBasePoint.getPoint_code()));
|
||||
return schBasePoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -383,7 +390,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, pointStatus)
|
||||
.eq(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)
|
||||
|
||||
@@ -267,10 +267,13 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
public boolean selectByPointCodeAndStatus(List<String> pointCodes) {
|
||||
for (String pointCode : pointCodes) {
|
||||
List<SchBaseTask> schBaseTasks = schBaseTaskMapper.selectList(Wrappers.lambdaQuery(SchBaseTask.class)
|
||||
.eq(SchBaseTask::getPoint_code1, pointCode)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code2, pointCode)
|
||||
.in(SchBaseTask::getTask_status, TaskStatus.EXECUTING.getCode()));
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.EXECUTING.getCode())
|
||||
.and(wrapper -> wrapper
|
||||
.eq(SchBaseTask::getPoint_code1, pointCode)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code2, pointCode))
|
||||
|
||||
);
|
||||
if (CollUtil.isNotEmpty(schBaseTasks) && schBaseTasks.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
@@ -283,10 +286,11 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
boolean flag = false;
|
||||
for (String pointCode : pointCodes) {
|
||||
List<SchBaseTask> schBaseTasks = schBaseTaskMapper.selectList(Wrappers.lambdaQuery(SchBaseTask.class)
|
||||
.eq(SchBaseTask::getPoint_code1, pointCode)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code2, pointCode)
|
||||
.le(SchBaseTask::getTask_status, TaskStatus.ISSUED.getCode()));
|
||||
.le(SchBaseTask::getTask_status, TaskStatus.ISSUED.getCode())
|
||||
.and(wrapper -> wrapper
|
||||
.eq(SchBaseTask::getPoint_code1, pointCode)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code2, pointCode)));
|
||||
if (CollUtil.isNotEmpty(schBaseTasks) && schBaseTasks.size() > 0) {
|
||||
schBaseTasks.forEach(task -> {
|
||||
update(Wrappers.lambdaUpdate(SchBaseTask.class)
|
||||
@@ -305,10 +309,11 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
public void updateTaskStatusByPointCode(List<String> pointCodes) {
|
||||
for (String pointCode : pointCodes) {
|
||||
List<SchBaseTask> schBaseTasks = schBaseTaskMapper.selectList(Wrappers.lambdaQuery(SchBaseTask.class)
|
||||
.eq(SchBaseTask::getPoint_code1, pointCode)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code2, pointCode)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.TIMEOUT.getCode()));
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.TIMEOUT.getCode())
|
||||
.and(wrapper -> wrapper
|
||||
.eq(SchBaseTask::getPoint_code1, pointCode)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code2, pointCode)));
|
||||
if (CollUtil.isNotEmpty(schBaseTasks) && schBaseTasks.size() > 0) {
|
||||
schBaseTasks.forEach(task -> {
|
||||
update(Wrappers.lambdaUpdate(SchBaseTask.class)
|
||||
|
||||
@@ -300,6 +300,7 @@ public abstract class AbstractTask {
|
||||
taskService.update(Wrappers.lambdaUpdate(SchBaseTask.class)
|
||||
.set(SchBaseTask::getRemark, "下发任务失败" + e.getMessage())
|
||||
.eq(SchBaseTask::getTask_code, task.getTask_code()));
|
||||
throw new BadRequestException("下发任务失败" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MtTask extends AbstractTask {
|
||||
for (SchBaseTask task : tasks) {
|
||||
String vehicle_type = task.getVehicle_type();
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.NBJG.getRegion_code(),
|
||||
GoodsEnum.OUT_OF_STOCK.getValue(),null, 1);
|
||||
GoodsEnum.OUT_OF_STOCK.getValue(),null, 2);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
|
||||
@@ -62,8 +62,7 @@ public class ToStoreHouseTask extends AbstractTask {
|
||||
schBasePoint = schBasePointService.selectByEmptyCage(RegionEnum.DDLK.getRegion_code(),
|
||||
task.getVehicle_type(),GoodsEnum.EMPTY_PALLETS.getValue(),true,task);
|
||||
} else {
|
||||
schBasePoint = schBasePointService.selectByGroundPoint(null, GoodsEnum.EMPTY_PALLETS.getValue()
|
||||
, task.getVehicle_type(), 1);
|
||||
schBasePoint = schBasePointService.selectByVehicleQty(task.getVehicle_type());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
@@ -129,14 +128,16 @@ public class ToStoreHouseTask extends AbstractTask {
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
.set(SchBasePoint::getIs_lock, false)
|
||||
.set(SchBasePoint::getVehicle_code,null));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
.set(SchBasePoint::getIs_lock, false)
|
||||
.set(SchBasePoint::getVehicle_code,taskObj.getVehicle_code()));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -66,8 +67,6 @@ public class PcOperationSMTTask extends AbstractTask {
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
|
||||
for (SchBaseTask task : tasks) {
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
|
||||
SendMaterVo sendMaterVo = JSONObject.parseObject(task.getRequest_param(), SendMaterVo.class);
|
||||
//判断是否指定到外协区
|
||||
String targetRegionCode = sendMaterVo.getTarget_region_code();
|
||||
@@ -87,10 +86,13 @@ public class PcOperationSMTTask extends AbstractTask {
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
List<SendMaterVo> sendMaterVos = null;
|
||||
List<SendMaterVo> sendMaterVos = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(sendMaterVo.getMaterial_info())) {
|
||||
sendMaterVo.getMaterial_info().stream().forEach(sendMater -> {
|
||||
SendMaterVo sendMaterVo1 = BeanUtil.copyProperties(sendMater, SendMaterVo.class);
|
||||
JSONObject jsonObject = JSONObject.parseObject(sendMater);
|
||||
SendMaterVo sendMaterVo1 = new SendMaterVo();
|
||||
sendMaterVo1.setMaterial_qty(jsonObject.getInteger("material_qty"));
|
||||
sendMaterVo1.setOrder_code(jsonObject.getString("order_code"));
|
||||
sendMaterVos.add(sendMaterVo1);
|
||||
});
|
||||
}
|
||||
@@ -116,6 +118,7 @@ public class PcOperationSMTTask extends AbstractTask {
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.updateById(task);
|
||||
|
||||
//更新点位
|
||||
|
||||
@@ -93,6 +93,7 @@ public class ProcessingSMTTask extends AbstractTask {
|
||||
|
||||
//更新点位
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
schBasePoint.setVehicle_code(task.getVehicle_code());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
|
||||
@@ -60,6 +60,7 @@ public class BmVehicleInfo implements Serializable {
|
||||
* 添加人
|
||||
*/
|
||||
private String create_name;
|
||||
private String create_id;
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -14,6 +15,7 @@ import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.sch.vehicle.service.IBmVehicleInfoService;
|
||||
import org.nl.wms.sch.vehicle.service.dao.BmVehicleInfo;
|
||||
import org.nl.wms.sch.vehicle.service.dao.mapper.BmVehicleInfoMapper;
|
||||
@@ -42,7 +44,7 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
|
||||
@Override
|
||||
public BmVehicleInfo vehileInfo(String vehicle_code) {
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code",vehicle_code));
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code", vehicle_code));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,22 +55,21 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
throw new BadRequestException("此载具已存在");
|
||||
}
|
||||
//转编码类型:
|
||||
Dict dict = dictService.getOne(new QueryWrapper<Dict>().eq("para1", map.getString("vehicle_type")));
|
||||
if (dict==null){
|
||||
throw new BadRequestException("此载具类型"+map.getString("vehicle_type")+"没有配置字典值");
|
||||
Dict dict = dictService.getOne(new QueryWrapper<Dict>().eq("value", map.getString("vehicle_type")));
|
||||
if (dict == null) {
|
||||
throw new BadRequestException("此载具类型" + map.getString("vehicle_type") + "没有配置字典值");
|
||||
}
|
||||
JSONArray resultCodeArr = new JSONArray();
|
||||
int num = MapUtil.getInt(map, "num");
|
||||
for (int i = 0; i < num; i++) {
|
||||
BmVehicleInfo entity = new BmVehicleInfo();
|
||||
entity.setVehicle_code(CodeUtil.getNewCode(map.getString("vehicle_type")));
|
||||
entity.setVehicle_name(entity.getVehicle_name());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setUpdate_name(DateUtil.now());
|
||||
entity.setVehicle_type(dict.getValue());
|
||||
this.save(entity);
|
||||
resultCodeArr.add(entity.getVehicle_code());
|
||||
}
|
||||
BmVehicleInfo entity = new BmVehicleInfo();
|
||||
entity.setVehicle_code(map.getString("vehicle_code"));
|
||||
entity.setVehicle_name(dict.getLabel());
|
||||
entity.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setCreate_time(DateUtil.now());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
entity.setVehicle_type(dict.getValue());
|
||||
this.save(entity);
|
||||
resultCodeArr.add(entity.getVehicle_code());
|
||||
return resultCodeArr;
|
||||
}
|
||||
|
||||
@@ -104,8 +105,6 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Page queryAll(VehicleQuery query, PageQuery page) {
|
||||
return this.page(page.build(), query.build());
|
||||
@@ -119,12 +118,12 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
|
||||
@Override
|
||||
public Object findById(Long storagevehicle_id) {
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("storagevehicle_id",storagevehicle_id));
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("storagevehicle_id", storagevehicle_id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BmVehicleInfo findByCode(String code) {
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code",code));
|
||||
return this.getOne(new QueryWrapper<BmVehicleInfo>().eq("vehicle_code", code));
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +135,11 @@ public class BmVehicleInfoServiceImpl extends ServiceImpl<BmVehicleInfoMapper, B
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
if (ids.length>0){
|
||||
this.removeByIds(Arrays.asList(ids));
|
||||
if (ids.length > 0) {
|
||||
Arrays.stream(ids).forEach(id -> {
|
||||
this.remove(Wrappers.lambdaQuery(BmVehicleInfo.class)
|
||||
.eq(BmVehicleInfo::getVehicle_code,String.valueOf(id)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user