psh 1 year ago
parent
commit
d4fdd90834
  1. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  2. 42
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/POINTTask.java
  3. 49
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/YCLRKTask.java

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java

@ -131,12 +131,15 @@ public abstract class AbstractTask {
* @param task
* @param apply_point_code
*/
protected void setTaskPoint(SchBaseTaskconfig taskConfig, SchBaseTask task, String apply_point_code) {
protected void setTaskPoint(SchBaseTaskconfig taskConfig, SchBaseTask task, String apply_point_code,JSONObject param) {
String taskDirection = taskConfig.getTask_direction();
if (TaskDirectionEnum.SEND.getValue().equals(taskDirection)) {
task.setPoint_code1(apply_point_code);
} else {
} else if(TaskDirectionEnum.CALL.getValue().equals(taskDirection)) {
task.setPoint_code2(apply_point_code);
} else {
task.setPoint_code1(param.getString("start_point"));
task.setPoint_code2(param.getString("next_point"));
}
}
@ -217,7 +220,7 @@ public abstract class AbstractTask {
task.setTask_status(TaskStatus.APPLY.getCode());
task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码
// 设置起/终点
this.setTaskPoint(taskConfig, task, apply_point_code);
this.setTaskPoint(taskConfig, task, apply_point_code,param);
task.setExt_group_data(JSONObject.toJSONString(param));
taskService.create(task);

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

@ -72,27 +72,13 @@ public class POINTTask extends AbstractTask {
for (SchBaseTask task : tasks) {
String extGroupData = task.getExt_group_data();
JSONObject jsonObject = JSONObject.parseObject(extGroupData);
String materialType = jsonObject.getString("material_type");
SchBasePoint point = findNextPoint(jsonObject,task);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.update(task);
// 消息通知
log.info("包片上料未找到当前符合条件的点位materialType:{},",materialType);
continue;
}
// 设置起点并修改创建成功状态
// 取料先去等待点
task.setTask_type("3");
task.setPoint_code1(point.getNext_wait_point());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.update(task);
//发起任务时先把点位占用,防止发起重复任务
// point.setIng_task_code(task.getTask_code());
// point.setVehicle_qty(point.getVehicle_qty() - 1);
// point.setVehicle_type(materialType);
// pointService.update(point);
//下发
@ -101,36 +87,12 @@ public class POINTTask extends AbstractTask {
}
/**
* 判断目标点位
* 从10-1查找可以物料一致且有货的点位
* 点对点任务暂定不需要等待点
*
* @param extGroupData
* @return
*/
private SchBasePoint findNextPoint(JSONObject extGroupData,SchBaseTask task) {
String regionCode = "";
String materialType = extGroupData.getString("material_type");
if("1".equals(materialType)){
regionCode="ZJBDJW";
}else if("2".equals(materialType)){
regionCode="HCQ2";
}else if ("3".equals(materialType)){
regionCode="HCQ3";
}
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"1");
for(int i=schBasePointList.size()-1;i>=0;i--){
SchBasePoint schBasePoint=schBasePointList.get(i);
//已锁定直接返回
if(task.getTask_code().equals(schBasePoint.getIng_task_code())){
return schBasePoint;
}
if (!"2".equals(schBasePoint.getPoint_type())&&schBasePoint.getVehicle_qty()!=0
&&ObjectUtil.isEmpty(schBasePoint.getIng_task_code())
&&(ObjectUtil.isEmpty(schBasePoint.getVehicle_type())||materialType.equals(schBasePoint.getVehicle_type()))){
log.info("包片上料任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code());
return schBasePoint;
}
}
return null;
}

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

@ -120,44 +120,12 @@ public class YCLRKTask extends AbstractTask {
*/
private SchBasePoint findNextPoint(SchBasePoint startPoint, JSONObject extGroupData) {
String regionCode = null;
String materialType = extGroupData.getString("material_type");
if ("TBX1".equals(startPoint.getRegion_code())) {
//TBX1找A区
regionCode = "GHS1";
} else if ("TBX2".equals(startPoint.getRegion_code())) {
//TBX2找B区
regionCode = "GHS2";
}
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "2");
for (SchBasePoint schBasePoint : schBasePointList) {
if (!schBasePoint.getPoint_code().endsWith("01") &&
!schBasePoint.getPoint_code().endsWith("06")) {
continue;
}
if ((ObjectUtil.isEmpty(schBasePoint.getVehicle_type()) ||
materialType.equals(schBasePoint.getVehicle_type()))
&& "2".equals(schBasePoint.getPoint_status())
&& schBasePoint.getVehicle_qty() < 3) {
//新增逻辑,同一列只能放相同物料
boolean flag=true;
List<String> list=new ArrayList<>();
for(int i=1;i<=4;i++){
int end=Integer.parseInt(schBasePoint.getPoint_code().substring(schBasePoint.getPoint_code().length()-1))+i;
String pointCode=schBasePoint.getPoint_code().substring(0,schBasePoint.getPoint_code().length()-1);
list.add(pointCode+end);
}
for (SchBasePoint schBasePoint2 : schBasePointList) {
if(list.contains(schBasePoint2.getPoint_code())) {
if (ObjectUtil.isNotEmpty(schBasePoint2.getVehicle_type()) && !materialType.equals(schBasePoint2.getVehicle_type())) {
flag = false;
}
}
}
if(!flag){
continue;
}
log.info("满架下料找到当前符合条件的点位{}", schBasePoint.getPoint_code());
if ("2".equals(schBasePoint.getPoint_status())
&& schBasePoint.getVehicle_qty() ==0) {
log.info("原材料入库找到当前符合条件的点位{}", schBasePoint.getPoint_code());
return schBasePoint;
}
}
@ -207,7 +175,7 @@ public class YCLRKTask extends AbstractTask {
// 终点解锁
endPointObj.setIng_task_code("");
endPointObj.setVehicle_code(ObjectUtil.isEmpty(endPointObj.getVehicle_code()) ? vehicle_code + "," : endPointObj.getVehicle_code() + vehicle_code + ",");
endPointObj.setVehicle_qty(endPointObj.getVehicle_qty() + 1);
endPointObj.setVehicle_qty(1);
pointService.update(endPointObj);
// 要把数据存到组盘表 -> 改造公共方法,返回id
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup();
@ -243,15 +211,10 @@ public class YCLRKTask extends AbstractTask {
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setGroup_id(groupEntity.getGroup_id());
taskObj.setRemark("任务完成");
JSONObject param=new JSONObject();
String device_code=startPoint.substring(0,startPoint.length()-1)+"2";
param.put("device_code",device_code);
param.put("request_medthod_code","TBXBKJTask");
param.put("request_medthod_name","涂板线补空架");
try {
acsToWmsService.acsApply(param);
//todo 入库成功后上报mes
}catch (Exception e){
log.error("涂板线下料任务自动创建涂板线补空架任务失败{}",e.getMessage());
log.error("原材料入库上报MES失败{}",e.getMessage(),e);
}
}
if (status.equals(TaskStatus.CANCELED)) { // 取消

Loading…
Cancel
Save