Browse Source

fix: 修复测试中存在的问题

master
yanps 2 months ago
parent
commit
67af42d57e
  1. 94
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  2. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java
  3. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java
  4. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java
  5. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java
  6. 271
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java
  7. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java
  8. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java
  9. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

94
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -180,7 +180,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver();
Map<String, Object> extraValue = plcToAgvDeviceDriver.getExtraValue(); Map<String, Object> extraValue = plcToAgvDeviceDriver.getExtraValue();
if (plcToAgvDeviceDriver.getAGVEnable() != 0) { if (plcToAgvDeviceDriver.getAGVEnable() != 0) {
if (device_code.contains("_01")) { /*if (device_code.contains("_01")) {
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) { if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} }
@ -193,7 +193,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
data = feedBackStatus(data, index, 1, inst, task, 2, false); data = feedBackStatus(data, index, 1, inst, task, 2, false);
} }
} }
} else if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) { } else */
if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) {
Object plc_to_agv = extraValue.get("upper_lower_levels"); Object plc_to_agv = extraValue.get("upper_lower_levels");
if ("1".equals(plc_to_agv)) { if ("1".equals(plc_to_agv)) {
plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1"); plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1");
@ -256,7 +257,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (device.getDeviceDriver() instanceof PlcToAgvDeviceDriver) { if (device.getDeviceDriver() instanceof PlcToAgvDeviceDriver) {
PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver();
if (device_code.contains("_01")) { /*if (device_code.contains("_01")) {
try { try {
List list = new ArrayList<>(); List list = new ArrayList<>();
Map map = new HashMap(); Map map = new HashMap();
@ -278,27 +279,27 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
data = feedBackStatus(data, index, 2, inst, task, 2, false); data = feedBackStatus(data, index, 2, inst, task, 2, false);
} else if (device_code.contains("_02")) { } else if (device_code.contains("_02")) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} else { } else {*/
try { try {
List list = new ArrayList<>(); List list = new ArrayList<>();
Map map = new HashMap(); Map map = new HashMap();
map.put("code", "AGVInOP"); map.put("code", "AGVInOP");
map.put("value", "0"); map.put("value", "0");
Map map1 = new HashMap(); Map map1 = new HashMap();
map1.put("code", "AGVSetOutReqUpper"); map1.put("code", "AGVSetOutReqUpper");
map1.put("value", "0"); map1.put("value", "0");
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code", "AGVSetOutReqLower"); map2.put("code", "AGVSetOutReqLower");
map2.put("value", "0"); map2.put("value", "0");
list.add(map); list.add(map);
list.add(map1); list.add(map1);
list.add(map2); list.add(map2);
plcToAgvDeviceDriver.writing(list); plcToAgvDeviceDriver.writing(list);
} catch (Exception e) { } catch (Exception e) {
log.info("下发AGVInOP信号:{}失败", "0"); log.info("下发AGVInOP信号:{}失败", "0");
}
data = feedBackStatus(data, index, 2, inst, task, 2, false);
} }
data = feedBackStatus(data, index, 2, inst, task, 2, false);
/*}*/
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try { try {
data = feedBackStatus(data, index, 2, inst, task, 1, false); data = feedBackStatus(data, index, 2, inst, task, 1, false);
@ -340,7 +341,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver();
if (plcToAgvDeviceDriver.getAGVEnable() != 0) { if (plcToAgvDeviceDriver.getAGVEnable() != 0) {
Map<String, Object> extraValue = plcToAgvDeviceDriver.getExtraValue(); Map<String, Object> extraValue = plcToAgvDeviceDriver.getExtraValue();
if (device_code.contains("_01")) { /*if (device_code.contains("_01")) {
Object plc_to_agv = extraValue.get("upper_lower_levels"); Object plc_to_agv = extraValue.get("upper_lower_levels");
if (ObjectUtil.isNotNull(plc_to_agv) && "1".equals(plc_to_agv)) { if (ObjectUtil.isNotNull(plc_to_agv) && "1".equals(plc_to_agv)) {
plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1"); plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1");
@ -353,7 +354,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) { if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} }
} else if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) { } else */
if (ObjectUtil.isNotEmpty(extraValue.get("upper_lower_levels"))) {
Object plc_to_agv = extraValue.get("upper_lower_levels"); Object plc_to_agv = extraValue.get("upper_lower_levels");
if ("1".equals(plc_to_agv)) { if ("1".equals(plc_to_agv)) {
plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1"); plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1");
@ -422,7 +424,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
transportOrder = ""; transportOrder = "";
if (device.getDeviceDriver() instanceof PlcToAgvDeviceDriver) { if (device.getDeviceDriver() instanceof PlcToAgvDeviceDriver) {
PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver(); PlcToAgvDeviceDriver plcToAgvDeviceDriver = (PlcToAgvDeviceDriver) device.getDeviceDriver();
if (device_code.contains("_01")) { /*if (device_code.contains("_01")) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} else if (device_code.contains("_02")) { } else if (device_code.contains("_02")) {
try { try {
@ -444,27 +446,27 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("下发AGVInOP信号:{}失败", "0"); log.info("下发AGVInOP信号:{}失败", "0");
} }
data = feedBackStatus(data, index, 4, inst, task, 2, false); data = feedBackStatus(data, index, 4, inst, task, 2, false);
} else { } else {*/
try { try {
List list = new ArrayList<>(); List list = new ArrayList<>();
Map map = new HashMap(); Map map = new HashMap();
map.put("code", "AGVInOP"); map.put("code", "AGVInOP");
map.put("value", "0"); map.put("value", "0");
Map map1 = new HashMap(); Map map1 = new HashMap();
map1.put("code", "AGVSetInReqUpper"); map1.put("code", "AGVSetInReqUpper");
map1.put("value", "0"); map1.put("value", "0");
Map map2 = new HashMap(); Map map2 = new HashMap();
map2.put("code", "AGVSetInReqLower"); map2.put("code", "AGVSetInReqLower");
map2.put("value", "0"); map2.put("value", "0");
list.add(map); list.add(map);
list.add(map1); list.add(map1);
list.add(map2); list.add(map2);
plcToAgvDeviceDriver.writing(list); plcToAgvDeviceDriver.writing(list);
} catch (Exception e) { } catch (Exception e) {
log.info("下发AGVInOP信号:{}失败", "0"); log.info("下发AGVInOP信号:{}失败", "0");
}
data = feedBackStatus(data, index, 4, inst, task, 2, false);
} }
data = feedBackStatus(data, index, 4, inst, task, 2, false);
/* }*/
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try { try {
StandardOrdinarySiteDeviceDriver standar = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); StandardOrdinarySiteDeviceDriver standar = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/region/RegionEnum.java

@ -13,6 +13,7 @@ public enum RegionEnum {
DDLK("堆叠笼框工序","111-20"), DDLK("堆叠笼框工序","111-20"),
NBJG("内部加工区","111-10"), NBJG("内部加工区","111-10"),
WXJG("外协加工区","111-12"), WXJG("外协加工区","111-12"),
ZDZWQ("自动折弯区","ZDZWQ"),
; ;
private final String region_name; private final String region_name;
private final String region_code; private final String region_code;

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java

@ -53,6 +53,7 @@ public class FabController {
private WmsToConnectorService wmsToConnectorService; private WmsToConnectorService wmsToConnectorService;
/** /**
* 设备工序列表 * 设备工序列表
* *

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java

@ -137,4 +137,13 @@ public class HandheldController {
return new ResponseEntity<>(list,HttpStatus.OK); return new ResponseEntity<>(list,HttpStatus.OK);
} }
@PostMapping("/getPointVehicle")
@Log("获取点位的载具号")
@ApiOperation("获取点位的载具号")
@SaIgnore
public ResponseEntity<Object> getVehicleByPoint(@RequestBody JSONObject json) {
String vehicleCode = handheldService.selectVehicleByPoint(json);
return new ResponseEntity<>(vehicleCode,HttpStatus.OK);
}
} }

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java

@ -87,4 +87,11 @@ public interface HandheldService {
* @return * @return
*/ */
JSONObject deviceInLogin(JSONObject json); JSONObject deviceInLogin(JSONObject json);
/**
* 获取点位的载具号
* @param json
* @return
*/
String selectVehicleByPoint(JSONObject json);
} }

271
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java

@ -68,12 +68,93 @@ public class HandheldServiceImpl implements HandheldService {
}, "参数不能为空!"); }, "参数不能为空!");
String vehicle = param.getString("vehicle_list"); String vehicle = param.getString("vehicle_list");
String device_code = param.getString("device_code"); String device_code = param.getString("device_code");
String type = param.getString("type");
switch (type) {
case "1":
artificialBending(vehicle, device_code, param);
break;
case "2":
semiAutomaticBending(vehicle, device_code, param);
break;
case "3":
break;
default:
break;
}
}
/**
* 空料架送回
*
* @param vehicle
* @param device_code
* @param param
*/
private void semiAutomaticBending(String vehicle, String device_code, JSONObject param) {
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle);
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!");
if (!mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S04.getVehicleCode())
&& !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())) {
throw new BadRequestException("不是料架,生成搬运任务失败!");
}
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
AbstractTask connectorTask = taskFactory.getTask("RACKTask");
// 准备参数:设备编码
JSONObject jo = new JSONObject();
jo.put("device_code", device_code);
jo.put("config_code", "RACKTask");
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
jo.put("vehicle_code", vehicle);
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type());
jo.put("ext_data", param);
connectorTask.apply(jo);
}
/**
* 空料框送回
*
* @param vehicle
* @param device_code
* @param param
*/
private void artificialBending(String vehicle, String device_code, JSONObject param) {
String[] vehicle_list = null; String[] vehicle_list = null;
if (vehicle.contains(",")) { if (vehicle.contains(",")) {
vehicle_list = vehicle.split(","); vehicle_list = vehicle.split(",");
} }
if (vehicle_list.length != 2 && vehicle_list.length != 4) { if(CollUtil.isEmpty(Arrays.asList(vehicle_list))){
throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!"); MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle);
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!");
if (!mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S04.getVehicleCode())
&& !mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.RACKS_S06.getVehicleCode())){
throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!");
}
}else {
String[] finalVehicle_list = vehicle_list;
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle_list[0]);
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具不存在!");
if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode())) {
if (finalVehicle_list.length != 2) {
throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!");
}
}
if (mdBaseVehicle.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
if (finalVehicle_list.length != 4) {
throw new BadRequestException("笼框数量不匹配,请确认笼框数量后重新扫码!");
}
}
Arrays.stream(vehicle_list).forEach(vehicleCode -> {
String vehicleCode1 = vehicleCode;
MdBaseVehicle mdBaseVehicle1 = iMdBaseVehicleService.selectByVehicleCode(vehicleCode1);
if (ObjectUtil.isEmpty(mdBaseVehicle1)) throw new BadRequestException("载具不存在!");
if (!mdBaseVehicle1.getVehicle_type().equals(VehicleTypeEnum.FRAME_R01.getVehicleCode())
&& !mdBaseVehicle1.getVehicle_type().equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
throw new BadRequestException("托盘类型不匹配,,生成搬运任务失败!");
}
});
} }
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
@ -102,28 +183,39 @@ public class HandheldServiceImpl implements HandheldService {
String region_code = param.getString("region_code"); String region_code = param.getString("region_code");
String device_code = param.getString("device_code"); String device_code = param.getString("device_code");
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = param.getString("vehicle_code");
String type = param.getString("type");
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask"); AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask");
if (StrUtil.isNotEmpty(region_code) && (RegionEnum.NBJG.getRegion_code().equals(region_code) switch (type) {
|| RegionEnum.WXJG.getRegion_code().equals(region_code))) { case "1":
JSONObject jo = new JSONObject(); goShelves(param, region_code, device_code, vehicle_code, connectorTask);
jo.put("device_code", device_code); break;
jo.put("config_code", "ProcessingSMTTask"); case "2":
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask);
jo.put("vehicle_code", vehicle_code); break;
jo.put("region_code", region_code); case "3":
param.put("target_region_code", region_code); goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask);
jo.put("ext_data", param); break;
connectorTask.apply(jo); default:
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) break;
.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"); * @param param
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); * @param region_code
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!"); * @param device_code
* @param vehicle_code
* @param connectorTask
*/
private void goShelves(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) {
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!");
JSONArray materials = param.getJSONArray("material");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
JSONObject jo = new JSONObject();
if (StrUtil.isBlank(region_code)) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
@ -159,57 +251,98 @@ public class HandheldServiceImpl implements HandheldService {
} else if (ObjectUtil.isNotEmpty(json1)) { } else if (ObjectUtil.isNotEmpty(json1)) {
throw new BadRequestException(json1.getString("msg")); 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("region_code", region_code);
jo.put("ext_data", param); } else {
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) jo.put("region_code", region_code);
.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("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));
String finalRegion_code = region_code;
materials.stream().forEach(material -> {
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
replace = replace.replaceAll("material_code:,", "");
// 使用 Hutool 的 JSONUtil 解析 JSON 字符串
cn.hutool.json.JSONObject jsonObject1 = JSONUtil.parseObj(replace);
// 判断 material_code 是否为空
if (replace.contains("OR")) {
Object materialCode = jsonObject1.get("order_code");
jsonObject1.put("order_code", materialCode.toString());
replace = jsonObject1.toString();
}
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(StrUtil.isBlank(finalRegion_code) ? jsonObject.getString("region_code") : finalRegion_code);
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
});
} }
/**
* 物料下料去外协或内部加工区
*
* @param param
* @param region_code
* @param device_code
* @param vehicle_code
* @param connectorTask
*/
private void goWxOrNx(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));
}
@Override @Override
public String pointLock(JSONObject param) { public String pointLock(JSONObject param) {
Assert.noNullElements(new Object[]{param.getString("region_code"), param.getString("status")}, "参数不能为空!"); Assert.noNullElements(new Object[]{param.getString("region_code"), param.getString("status")}, "参数不能为空!");
String region_code = param.getString("region_code"); JSONArray region_code = param.getJSONArray("region_code");
String status = param.getString("status"); String status = param.getString("status");
SchBaseRegion schBaseRegion = iSchBaseRegionService.getOne(Wrappers.lambdaQuery(SchBaseRegion.class) region_code.stream().forEach(region -> {
.eq(SchBaseRegion::getRegion_code, region_code)); String s = StrUtil.toString(region);
if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!"); SchBaseRegion schBaseRegion = iSchBaseRegionService.getOne(Wrappers.lambdaQuery(SchBaseRegion.class)
List<String> pointCodes = iSchBasePointService.getByRegionCode(region_code); .eq(SchBaseRegion::getRegion_code, s));
if (StrUtil.equals(status, "0")) { if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!");
iSchBasePointService.releasePoint(region_code); List<String> pointCodes = iSchBasePointService.getByRegionCode(s);
iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes); if (StrUtil.equals(status, "0")) {
} else if (StrUtil.equals(status, "1")) { iSchBasePointService.releasePoint(s);
boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes); iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes);
if (is_executing) { } else if (StrUtil.equals(status, "1")) {
throw new BadRequestException("该区域有任务正在执行,请等待任务执行完成再锁定!"); boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes);
if (is_executing) {
throw new BadRequestException("该区域有任务正在执行,请等待任务执行完成再锁定!");
}
iSchBaseTaskService.selectByPointCodeAndTaskStatus(pointCodes);
iSchBasePointService.lockPoint(s);
} }
iSchBaseTaskService.selectByPointCodeAndTaskStatus(pointCodes); });
iSchBasePointService.lockPoint(region_code);
}
return "操作成功"; return "操作成功";
} }
@ -377,5 +510,13 @@ public class HandheldServiceImpl implements HandheldService {
return null; return null;
} }
@Override
public String selectVehicleByPoint(JSONObject json) {
Assert.notNull(json.getString("device_code"), "参数不能为空!");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code"));
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
return schBasePoint.getVehicle_code();
}
} }

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java

@ -82,6 +82,16 @@ public class EmptyCageTask extends AbstractTask {
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(), schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R02.getVehicleCode(), 2); GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R02.getVehicleCode(), 2);
break; break;
case "S04":
//RO2空料容
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S04.getVehicleCode(), 2);
break;
case "S06":
//RO2空料容
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.RACKS_S06.getVehicleCode(), 2);
break;
default: default:
break; break;
} }
@ -100,9 +110,12 @@ public class EmptyCageTask extends AbstractTask {
task.setTask_status(TaskStatus.CREATED.getCode()); task.setTask_status(TaskStatus.CREATED.getCode());
taskService.updateById(task); taskService.updateById(task);
if (vehicle_type.equals(VehicleTypeEnum.FRAME_R01.getVehicleCode()) || vehicle_type.equals(VehicleTypeEnum.FRAME_R02.getVehicleCode())) {
schBasePoint.setVehicles(task.getVehicle_code());
} else {
schBasePoint.setVehicle_code(task.getVehicle_code());
}
schBasePoint.setVehicle_qty(task.getVehicle_qty()); schBasePoint.setVehicle_qty(task.getVehicle_qty());
schBasePoint.setVehicles(task.getVehicle_code());
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue()); schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
schBasePoint.setIs_lock(true); schBasePoint.setIs_lock(true);
PointUtils.setUpdateByAcs(schBasePoint); PointUtils.setUpdateByAcs(schBasePoint);

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java

@ -63,7 +63,7 @@ public class RackTask extends AbstractTask {
for (SchBaseTask task : tasks) { for (SchBaseTask task : tasks) {
String vehicle_type = task.getVehicle_type(); String vehicle_type = task.getVehicle_type();
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(null, SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.ZDZWQ.getRegion_code(),
GoodsEnum.OUT_OF_STOCK.getValue(),vehicle_type, 1); GoodsEnum.OUT_OF_STOCK.getValue(),vehicle_type, 1);
if (ObjectUtil.isEmpty(schBasePoint)) { if (ObjectUtil.isEmpty(schBasePoint)) {
task.setRemark("未找到所需点位!"); task.setRemark("未找到所需点位!");
@ -83,7 +83,7 @@ public class RackTask extends AbstractTask {
schBasePoint.setVehicles(task.getVehicle_code()); schBasePoint.setVehicles(task.getVehicle_code());
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
schBasePoint.setIs_lock(true); schBasePoint.setIs_lock(true);
PointUtils.setUpdateByAcs(schBasePoint); PointUtils.setUpdateByAcs(schBasePoint);
pointService.updateById(schBasePoint); pointService.updateById(schBasePoint);

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

@ -70,8 +70,6 @@ public class SortingSMTTask extends AbstractTask {
JSONObject jsonObject = JSONObject.parseObject(requestParam); JSONObject jsonObject = JSONObject.parseObject(requestParam);
// 根据对接位查找对应的载具类型 // 根据对接位查找对应的载具类型
SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.ZDFJ.getRegion_code(),task.getVehicle_code(),"1"); SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.ZDFJ.getRegion_code(),task.getVehicle_code(),"1");
if(ObjectUtil.isEmpty(schBasePoint)) continue;
jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type());
if (ObjectUtil.isEmpty(schBasePoint)) { if (ObjectUtil.isEmpty(schBasePoint)) {
task.setRemark("未找到所需点位!"); task.setRemark("未找到所需点位!");
taskService.updateById(task); taskService.updateById(task);
@ -80,6 +78,7 @@ public class SortingSMTTask extends AbstractTask {
NoticeTypeEnum.WARN.getCode()); NoticeTypeEnum.WARN.getCode());
continue; continue;
} }
jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type());
schBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) schBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getVehicle_code, task.getVehicle_code())); .eq(SchBaseVehiclematerialgroup::getVehicle_code, task.getVehicle_code()));
JSONArray pallet_detail = jsonObject.getJSONArray("pallet_detail"); JSONArray pallet_detail = jsonObject.getJSONArray("pallet_detail");

Loading…
Cancel
Save