psh 11 months ago
parent
commit
35edc07e4f
  1. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  2. 23
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java
  3. 20
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java
  4. 101
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java

2
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -76,6 +76,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
int move = 0;
int task = 0;
int action = 0;
int last_action=0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
@ -242,6 +243,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
last_task = task;
last_material_type = material_type;
last_barcode=barcode;
last_action=action;
}

23
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/BPSLTask.java

@ -170,18 +170,19 @@ public class BPSLTask extends AbstractTask {
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode)
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,
GroupBindMaterialStatusEnum.BOUND.getValue()));
if (ObjectUtil.isEmpty(one)) {
throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
if (ObjectUtil.isNotEmpty(one)) {
// throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
// }
one.setTask_code(taskObj.getTask_code());
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
one.setPoint_name(endPointObj.getPoint_name());
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code());
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
one.setUpdate_id(GeneralDefinition.ACS_ID);
one.setUpdate_name(GeneralDefinition.ACS_NAME);
one.setUpdate_time(DateUtil.now());
vehiclematerialgroupService.updateById(one);
}
one.setTask_code(taskObj.getTask_code());
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
one.setPoint_name(endPointObj.getPoint_name());
one.setMove_way(one.getMove_way()==null?"":(one.getMove_way() + " -> ") + endPointObj.getPoint_code());
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
one.setUpdate_id(GeneralDefinition.ACS_ID);
one.setUpdate_name(GeneralDefinition.ACS_NAME);
one.setUpdate_time(DateUtil.now());
vehiclematerialgroupService.updateById(one);
// 起点清空
if (vehicleCodeList.size()==1) {
startPointObj.setVehicle_code("");

20
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java

@ -149,7 +149,7 @@ public class MJXLTask extends AbstractTask {
}
for (SchBasePoint schBasePoint2 : schBasePointList) {
if(list.contains(schBasePoint2.getPoint_code())) {
if (schBasePoint2.getVehicle_type() != null && !materialType.equals(schBasePoint2.getVehicle_type())) {
if (ObjectUtil.isNotEmpty(schBasePoint2.getVehicle_type()) && !materialType.equals(schBasePoint2.getVehicle_type())) {
flag = false;
}
}
@ -183,10 +183,13 @@ public class MJXLTask extends AbstractTask {
String vehicle_code = ObjectUtil.isNotEmpty(taskObj.getVehicle_code())
? taskObj.getVehicle_code()
: IdUtil.getSnowflake(1, 1).nextIdStr();
PdmBdWorkorder workorderCode = ObjectUtil.isNotEmpty(extGroupData.getString("workorder_code"))
? workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>()
.eq(PdmBdWorkorder::getWorkorder_code, extGroupData.getString("workorder_code")))
: null;
PdmBdWorkorder workorderCode = null;
if (extGroupData != null) {
workorderCode = ObjectUtil.isNotEmpty(extGroupData.getString("workorder_code"))
? workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>()
.eq(PdmBdWorkorder::getWorkorder_code, extGroupData.getString("workorder_code")))
: null;
}
String startPoint = taskObj.getPoint_code1(); // 获取起点
String endPoint = ObjectUtil.isNotEmpty(taskObj.getPoint_code2())?taskObj.getPoint_code2().substring(0,taskObj.getPoint_code2().length()-2):"0"; // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
@ -280,14 +283,13 @@ public class MJXLTask extends AbstractTask {
@Override
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
//重新计算固化室放货点位
try {
JSONObject extGroupData = JSONObject.parseObject(schBaseTask.getExt_group_data());
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()));
SchBasePoint point = findNextPoint(startPoint, extGroupData);
schBaseTask.setPoint_code2(point.getPoint_code()+"0"+(point.getVehicle_qty()+1));
} catch (Exception e) {
log.error("error:{}", e, e.getMessage());
}
if(point.getIng_task_code()!=null){
throw new BadRequestException("当前固化室点位有任务,暂不反馈!");
}
}
}

101
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSFMTask.java

@ -81,62 +81,62 @@ public class GHSFMTask extends AbstractTask {
@Override
// @Transactional(rollbackFor = Exception.class)
protected void create() throws BadRequestException {
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion("GHS","2");
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion("GHS", "2");
for (SchBasePoint schBasePoint : schBasePointList) {
if (!schBasePoint.getPoint_code().endsWith("01") &&
!schBasePoint.getPoint_code().endsWith("06")) {
continue;
}
if (schBasePoint.getVehicle_qty()==3&&ObjectUtil.isEmpty(schBasePoint.getIng_task_code())) {
log.info("固化室对接位{}已经放满,开始进行后续判断",schBasePoint.getPoint_code());
String first=schBasePoint.getPoint_code().substring(0,schBasePoint.getPoint_code().length()-2);
String last=schBasePoint.getPoint_code().substring(schBasePoint.getPoint_code().length()-1);
String middle=schBasePoint.getPoint_code().substring(schBasePoint.getPoint_code().length()-4,schBasePoint.getPoint_code().length()-2);
boolean flag=false;
String pointCode=null;
if (schBasePoint.getVehicle_qty() == 3 && ObjectUtil.isEmpty(schBasePoint.getIng_task_code())) {
log.info("固化室对接位{}已经放满,开始进行后续判断", schBasePoint.getPoint_code());
String first = schBasePoint.getPoint_code().substring(0, schBasePoint.getPoint_code().length() - 2);
String last = schBasePoint.getPoint_code().substring(schBasePoint.getPoint_code().length() - 1);
String middle = schBasePoint.getPoint_code().substring(schBasePoint.getPoint_code().length() - 4, schBasePoint.getPoint_code().length() - 2);
boolean flag = false;
String pointCode = null;
//倒叙检查是否有符合要求的终点
for(int i=4;i>0;i--){
pointCode=first+ String.format("%02d",Integer.valueOf(last)+i);
for(SchBasePoint schBasePoint1 : schBasePointList){
for (int i = 4; i > 0; i--) {
pointCode = first + String.format("%02d", Integer.valueOf(last) + i);
for (SchBasePoint schBasePoint1 : schBasePointList) {
if (schBasePoint1.getPoint_code().equals(pointCode)
&&schBasePoint1.getVehicle_qty()==0&&ObjectUtil.isEmpty(schBasePoint1.getIng_task_code())){
log.info("找到当前列内部存在空位{}",pointCode);
flag=true;
&& schBasePoint1.getVehicle_qty() == 0 && ObjectUtil.isEmpty(schBasePoint1.getIng_task_code())) {
log.info("找到当前列内部存在空位{}", pointCode);
flag = true;
break;
}
}
if(flag){
if (flag) {
break;
}
}
if (flag){
if (flag) {
//生成任务并下发
this.createTask(schBasePoint,pointCode);
}else{
this.createTask(schBasePoint, pointCode);
} else {
//如果当列均已放满,检查隔壁列是否已全部放满
if("1".equals(last)){
last="6";
if ("1".equals(last)) {
last = "6";
}
for(int i=0;i<=4;i++){
pointCode=first+ String.format("%02d",Integer.valueOf(last)+i);
for(SchBasePoint schBasePoint1 : schBasePointList){
for (int i = 0; i <= 4; i++) {
pointCode = first + String.format("%02d", Integer.valueOf(last) + i);
for (SchBasePoint schBasePoint1 : schBasePointList) {
if (schBasePoint1.getPoint_code().equals(pointCode)
&&(schBasePoint1.getVehicle_qty()!=3||ObjectUtil.isNotEmpty(schBasePoint1.getIng_task_code()))){
log.info("检查当前固化室{}隔壁列,找到当前列内部存在空位{},不发送固化请求",schBasePoint.getPoint_code(),pointCode);
flag=true;
&& (schBasePoint1.getVehicle_qty() != 3 || ObjectUtil.isNotEmpty(schBasePoint1.getIng_task_code()))) {
log.info("检查当前固化室{}隔壁列,找到当前列内部存在空位{},不发送固化请求", schBasePoint.getPoint_code(), pointCode);
flag = true;
break;
}
}
}
}
if(!flag){
if (!flag) {
//通知acs已经放满,固化室可以进行固化
String device_code="ZDM"+middle;
log.info("当前固化室已经全部放满,通知固化室的自动门{}开始固化",device_code);
String device_code = "ZDM" + middle;
log.info("当前固化室已经全部放满,通知固化室的自动门{}开始固化", device_code);
JSONObject map = new JSONObject();
map.put("device_code",device_code);
map.put("type","1");
map.put("device_code", device_code);
map.put("type", "1");
wmsToAcsService.notifyAcs(map);
}
}
@ -150,10 +150,10 @@ public class GHSFMTask extends AbstractTask {
* @param endPoint
* @return
*/
private void createTask(SchBasePoint schBasePoint,String endPoint) {
private void createTask(SchBasePoint schBasePoint, String endPoint) {
// 申请任务
SchBaseTask task = new SchBaseTask(); // 任务实体
String apply_point_code =schBasePoint.getPoint_code(); // 请求点
String apply_point_code = schBasePoint.getPoint_code(); // 请求点
String config_code = "GHSFMTask";
// 1、校验数据
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
@ -163,7 +163,7 @@ public class GHSFMTask extends AbstractTask {
Integer tcmn = taskConfig.getTask_create_max_num();
// 获取执行中的任务
List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig(
taskConfig.getConfig_code(), apply_point_code+"01", taskConfig.getTask_direction());
taskConfig.getConfig_code(), apply_point_code + "01", taskConfig.getTask_direction());
Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn,
"该点位申请的任务未完成数已超过上限,无法申请任务");
@ -183,7 +183,7 @@ public class GHSFMTask extends AbstractTask {
task.setTask_status(TaskStatus.APPLY.getCode());
task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码
//acs固化室首位不存在01和06整体概念,需要补充01生成第一个点位的任务
task.setPoint_code1(apply_point_code+"01");
task.setPoint_code1(apply_point_code + "01");
task.setPoint_code2(endPoint);
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
@ -216,7 +216,7 @@ public class GHSFMTask extends AbstractTask {
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
throw new BadRequestException("该任务已取消!");
}
String startPoint = taskObj.getPoint_code1().substring(0,taskObj.getPoint_code1().length()-2); // 获取起点
String startPoint = taskObj.getPoint_code1().substring(0, taskObj.getPoint_code1().length() - 2); // 获取起点
String endPoint = taskObj.getPoint_code2(); // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
SchBasePoint endPointObj = pointService.getById(endPoint);
@ -226,7 +226,7 @@ public class GHSFMTask extends AbstractTask {
taskObj.setRemark("执行中");
}
if (status.equals(TaskStatus.FINISHED)) { // 完成
StringBuilder group_id= new StringBuilder();
StringBuilder group_id = new StringBuilder();
// 终点解锁
endPointObj.setIng_task_code("");
endPointObj.setVehicle_type(startPointObj.getVehicle_type());
@ -235,23 +235,24 @@ public class GHSFMTask extends AbstractTask {
endPointObj.setUpdate_time(DateUtil.now());
pointService.update(endPointObj);
List<String> vehicleCodeList = Arrays.stream(startPointObj.getVehicle_code().split(",")).collect(Collectors.toList());
for(String vehicleCode:vehicleCodeList) {
for (String vehicleCode : vehicleCodeList) {
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>()
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode)
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,
GroupBindMaterialStatusEnum.BOUND.getValue()));
if (ObjectUtil.isEmpty(one)) {
throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
if (ObjectUtil.isNotEmpty(one)) {
// throw new BadRequestException(vehicleCode + " => " + startPointObj.getVehicle_type() + "的组盘信息未找到");
// }
one.setTask_code(taskObj.getTask_code());
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
one.setPoint_name(endPointObj.getPoint_name());
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code());
one.setUpdate_id(GeneralDefinition.ACS_ID);
one.setUpdate_name(GeneralDefinition.ACS_NAME);
one.setUpdate_time(DateUtil.now());
vehiclematerialgroupService.updateById(one);
group_id.append(one.getGroup_id()).append(',');
}
one.setTask_code(taskObj.getTask_code());
one.setPoint_code(endPointObj.getPoint_code()); // 当前位置
one.setPoint_name(endPointObj.getPoint_name());
one.setMove_way(one.getMove_way()==null?"":(one.getMove_way() + " -> ") + endPointObj.getPoint_code());
one.setUpdate_id(GeneralDefinition.ACS_ID);
one.setUpdate_name(GeneralDefinition.ACS_NAME);
one.setUpdate_time(DateUtil.now());
vehiclematerialgroupService.updateById(one);
group_id.append(one.getGroup_id()).append(',');
}
// 起点清空
if (ObjectUtil.isNotEmpty(startPointObj)) {
@ -286,7 +287,7 @@ public class GHSFMTask extends AbstractTask {
@Override
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) {
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
//todo 重算最优点
}
}

Loading…
Cancel
Save