Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhangzhiqiang
2023-02-05 19:26:05 +08:00
7 changed files with 692 additions and 664 deletions

View File

@@ -124,6 +124,9 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
if(StrUtil.equals(task.getTask_type(),"7") && StrUtil.equals(task.getStorage_task_type(),"4")){ if(StrUtil.equals(task.getTask_type(),"7") && StrUtil.equals(task.getStorage_task_type(),"4")){
inst.setInstruction_status("2"); inst.setInstruction_status("2");
instructionService.finish(inst.getInstruction_id()); instructionService.finish(inst.getInstruction_id());
} else {
inst.setRemark("立库已反馈完成,待输送上报任务号");
instructionService.update(inst);
} }
} else if(StrUtil.equals(status,"4")){ } else if(StrUtil.equals(status,"4")){

View File

@@ -5,27 +5,25 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.*; import org.nl.acs.agv.server.MagicAgvService;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.ext.wms.liKuData.*; import org.nl.acs.ext.wms.liKuData.*;
import org.nl.acs.ext.wms.service.AcsToLiKuService; import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
@@ -84,7 +82,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override @Override
public synchronized void reload() { public synchronized void reload() {
Class var1 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) { synchronized (TaskInstructionLock.class) {
this.instructions = this.queryAll("instruction_status <2 and is_delete =0"); this.instructions = this.queryAll("instruction_status <2 and is_delete =0");
} }
@@ -92,10 +89,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override @Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) { public Map<String, Object> queryAll(Map whereJson, Pageable page) {
/*WQLObject wo = WQLObject.getWQLObject("acs_instruction");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "instruction_status < 2 and is_delete =0 ", "update_time desc");
*/
// this.reload();
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("flag", "1"); map.put("flag", "1");
String code = (String) whereJson.get("code"); String code = (String) whereJson.get("code");
@@ -214,7 +207,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override @Override
public List queryAll(String whereJson) { public List queryAll(String whereJson) {
WQLObject wo = WQLObject.getWQLObject("acs_instruction"); WQLObject wo = WQLObject.getWQLObject("acs_instruction");
JSONArray arr = wo.query(whereJson).getResultJSONArray(0); JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0);
List<Instruction> list = arr.toJavaList(Instruction.class); List<Instruction> list = arr.toJavaList(Instruction.class);
return list; return list;
} }
@@ -262,7 +255,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
return null; return null;
} }
} }
@Override @Override
@@ -280,13 +272,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override @Override
public void create(Instruction dto) { public void create(Instruction dto) {
Class var2 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) {
dto = foramte(dto); dto = foramte(dto);
String task_code = dto.getTask_code(); String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code); TaskDto task = taskService.findByCodeFromCache(task_code);
WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now(); String now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) { if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
@@ -345,14 +334,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code()); Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code());
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
(HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code())); hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
} }
@@ -361,8 +348,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String next_device_code = dto.getNext_device_code(); String next_device_code = dto.getNext_device_code();
String route_plan_code = task.getRoute_plan_code(); String route_plan_code = task.getRoute_plan_code();
List<RouteLineDto> shortPathsList = List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines( routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
start_device_code, next_device_code, route_plan_code);
RouteLineDto route = null; RouteLineDto route = null;
for (int i = 0; i < shortPathsList.size(); i++) { for (int i = 0; i < shortPathsList.size(); i++) {
RouteLineDto routeLineDto = shortPathsList.get(i); RouteLineDto routeLineDto = shortPathsList.get(i);
@@ -405,12 +391,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
wo.insert(json); wo.insert(json);
instructions.add(dto); instructions.add(dto);
} }
}
@Override @Override
public void create2(Instruction dto) throws Exception { public void create2(Instruction dto) throws Exception {
Class var2 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) {
dto = foramte(dto); dto = foramte(dto);
String task_code = dto.getTask_code(); String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code); TaskDto task = taskService.findByCodeFromCache(task_code);
@@ -472,8 +455,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
(HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code())); hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
} }
@@ -482,8 +464,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String next_device_code = dto.getNext_device_code(); String next_device_code = dto.getNext_device_code();
String route_plan_code = task.getRoute_plan_code(); String route_plan_code = task.getRoute_plan_code();
List<RouteLineDto> shortPathsList = List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines( routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
start_device_code, next_device_code, route_plan_code);
RouteLineDto route = null; RouteLineDto route = null;
for (int i = 0; i < shortPathsList.size(); i++) { for (int i = 0; i < shortPathsList.size(); i++) {
RouteLineDto routeLineDto = shortPathsList.get(i); RouteLineDto routeLineDto = shortPathsList.get(i);
@@ -519,12 +500,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
wo.insert(json); wo.insert(json);
instructions.add(dto); instructions.add(dto);
} }
}
@Override @Override
public void createAgain(Instruction dto) throws Exception { public void createAgain(Instruction dto) throws Exception {
Class var2 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) {
String task_code = dto.getTask_code(); String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code); TaskDto task = taskService.findByCodeFromCache(task_code);
WQLObject instwo = WQLObject.getWQLObject("acs_instruction"); WQLObject instwo = WQLObject.getWQLObject("acs_instruction");
@@ -608,12 +586,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
// } // }
instructions.add(dto); instructions.add(dto);
} }
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(Instruction dto) { public void update(Instruction dto) {
synchronized (TaskInstructionLock.class) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now(); String now = DateUtil.now();
dto.setUpdate_time(now); dto.setUpdate_time(now);
@@ -625,7 +601,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
this.reload(); this.reload();
} }
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@@ -762,8 +737,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void finish(Instruction dto) { public void finish(Instruction dto) {
Class var2 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) {
String now = DateUtil.now(); String now = DateUtil.now();
dto.setInstruction_status("2"); dto.setInstruction_status("2");
WQLObject wo = WQLObject.getWQLObject("acs_instruction"); WQLObject wo = WQLObject.getWQLObject("acs_instruction");
@@ -817,7 +790,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
removeByCodeFromCache(dto.getInstruction_code()); removeByCodeFromCache(dto.getInstruction_code());
// this.reload(); // this.reload();
} }
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@@ -901,8 +873,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override @Override
public void cancel(String id) throws Exception { public void cancel(String id) throws Exception {
Class var2 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) {
// flag= true时取消指令 // flag= true时取消指令
boolean flag = false; boolean flag = false;
Instruction entity = this.findById(id); Instruction entity = this.findById(id);
@@ -930,8 +900,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3") } else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
&& !StrUtil.equals(entity.getSend_status(), "2")) { && !StrUtil.equals(entity.getSend_status(), "2")) {
XianGongAgvService xianGongAgvService = XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
SpringContextHolder.getBean(XianGongAgvService.class);
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code()); xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
flag = true; flag = true;
} else { } else {
@@ -1008,12 +977,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
this.reload(); this.reload();
} }
}
@Override @Override
public void forceCancel(String id) throws Exception { public void forceCancel(String id) throws Exception {
Class var2 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) {
// flag= true时取消指令 // flag= true时取消指令
boolean flag = false; boolean flag = false;
Instruction entity = this.findById(id); Instruction entity = this.findById(id);
@@ -1066,12 +1032,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
removeByCodeFromCache(entity.getInstruction_code()); removeByCodeFromCache(entity.getInstruction_code());
} }
}
@Override @Override
public void cancelNOSendAgv(String id) throws Exception { public void cancelNOSendAgv(String id) throws Exception {
Class var2 = TaskInstructionLock.class;
synchronized (TaskInstructionLock.class) {
// flag= true时取消指令 // flag= true时取消指令
Instruction entity = this.findById(id); Instruction entity = this.findById(id);
if (entity == null) { if (entity == null) {
@@ -1126,7 +1089,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
removeByCodeFromCache(entity.getInstruction_code()); removeByCodeFromCache(entity.getInstruction_code());
} }
}
@Override @Override
public Instruction findByLinkNumSend(String code) { public Instruction findByLinkNumSend(String code) {
@@ -1156,8 +1118,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
return list; return list;
} }
} }
@Override @Override
@@ -1173,7 +1133,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
return null; return null;
} }
} }
@Override @Override
@@ -1188,8 +1147,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
return null; return null;
} }
} }
@Override @Override
@@ -1355,7 +1312,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
return num; return num;
} }
} }
@Override @Override
@@ -1376,8 +1332,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
} }
return num; return num;
} }
} }
@Override @Override
@@ -1395,8 +1349,6 @@ synchronized (InstructionServiceImpl.class){
} }
} }
@Override @Override
public boolean createLkInst(String type, Instruction dto) { public boolean createLkInst(String type, Instruction dto) {
Class var3 = TaskInstructionLock.class; Class var3 = TaskInstructionLock.class;

View File

@@ -202,8 +202,10 @@ public class DeviceOpcProtocolRunable implements Runnable {
} }
} }
} catch (Exception var30) { } catch (Exception var30) {
if (group != null) { if (group != null) {
try { try {
group.getServer().dispose();
group.clear(); group.clear();
group.remove(); group.remove();
} catch (Exception var6) { } catch (Exception var6) {

View File

@@ -138,7 +138,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override @Override
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) { public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) {
synchronized (TaskServiceImpl.class){
this.reload(); this.reload();
@@ -151,6 +151,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String task_type = (String) whereJson.get("task_type"); String task_type = (String) whereJson.get("task_type");
List<TaskDto> taskList = new ArrayList(); List<TaskDto> taskList = new ArrayList();
synchronized (TaskServiceImpl.class){
Iterator<TaskDto> it = tasks.iterator(); Iterator<TaskDto> it = tasks.iterator();
while (it.hasNext()) { while (it.hasNext()) {
TaskDto task = it.next(); TaskDto task = it.next();
@@ -193,6 +194,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
DateUtil.parse(task2.getCreate_time()))) DateUtil.parse(task2.getCreate_time())))
.collect(Collectors.toList()); .collect(Collectors.toList());
}
Integer currentPageNumber = page.getPageNumber() + 1; Integer currentPageNumber = page.getPageNumber() + 1;
Integer pageMaxSize = page.getPageSize(); Integer pageMaxSize = page.getPageSize();
List<TaskDto> taskDtoList = List<TaskDto> taskDtoList =
@@ -204,7 +207,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
jo.put("content", taskDtoList); jo.put("content", taskDtoList);
jo.put("totalElements", taskList.size()); jo.put("totalElements", taskList.size());
return jo; return jo;
}
} }
@Override @Override
@@ -653,7 +656,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(TaskDto dto) { public void update(TaskDto dto) {
synchronized (TaskServiceImpl.class) {
TaskDto entity = this.findById(dto.getTask_id()); TaskDto entity = this.findById(dto.getTask_id());
if (entity == null) { if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!"); throw new BadRequestException("被删除或无权限,操作失败!");
@@ -669,6 +672,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
wo.update(json); wo.update(json);
synchronized (TaskServiceImpl.class) {
Iterator<TaskDto> iterator = tasks.iterator(); Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
TaskDto task = iterator.next(); TaskDto task = iterator.next();
@@ -679,6 +683,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) { if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
tasks.add(dto); tasks.add(dto);
} }
}
// 判断是否为WMS下发的任务如果是反馈任务状态给WMS // 判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
@@ -767,7 +772,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
} }
} }
} }
}
} }
@Override @Override
@@ -916,7 +921,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
JSONObject json = (JSONObject) JSONObject.toJSON(entity); JSONObject json = (JSONObject) JSONObject.toJSON(entity);
wo.update(json); wo.update(json);
try { synchronized (TaskServiceImpl.class){
Iterator<TaskDto> it = tasks.iterator(); Iterator<TaskDto> it = tasks.iterator();
// 清理缓存 // 清理缓存
while (it.hasNext()) { while (it.hasNext()) {
@@ -924,10 +929,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (taskDto.getTask_id().equals(id)) { if (taskDto.getTask_id().equals(id)) {
tasks.remove(taskDto); tasks.remove(taskDto);
} }
} }}
} catch (Exception e) {
e.printStackTrace();
}
// 判断是否为WMS下发的任务如果是反馈任务状态给WMS // 判断是否为WMS下发的任务如果是反馈任务状态给WMS
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
@@ -1089,7 +1092,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (acsTask == null) { if (acsTask == null) {
throw new BadRequestException("被删除或无权限,操作失败!"); throw new BadRequestException("被删除或无权限,操作失败!");
} }
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 "); InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 ");

View File

@@ -157,8 +157,8 @@
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column prop="compound_inst_data" width="200" label="复合路线" />--> <!-- <el-table-column prop="compound_inst_data" width="200" label="复合路线" />-->
<el-table-column prop="matarial" label="物料" /> <!-- <el-table-column prop="matarial" label="物料" />-->
<el-table-column prop="quantity" label="数量" /> <!-- <el-table-column prop="quantity" label="数量" />-->
<el-table-column prop="remark" label="描述" /> <el-table-column prop="remark" label="描述" />
<el-table-column prop="create_by" label="创建者" /> <el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" /> <el-table-column prop="create_time" label="创建时间" width="135" />

View File

@@ -353,8 +353,8 @@
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<!-- <el-table-column prop="compound_task_data" width="200" label="复合路线" />--> <!-- <el-table-column prop="compound_task_data" width="200" label="复合路线" />-->
<el-table-column prop="matarial" label="物料" /> <!-- <el-table-column prop="matarial" label="物料" />-->
<el-table-column prop="quantity" label="数量" /> <!-- <el-table-column prop="quantity" label="数量" />-->
<el-table-column prop="remark" label="备注" /> <el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" /> <el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" /> <el-table-column prop="create_time" label="创建时间" width="135" />

View File

@@ -849,20 +849,28 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
// 双通 // 双通
// 先倒序找到第一个木箱、判断上一个是否有货位 // 先倒序找到第一个木箱、判断上一个是否有货位
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0); JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
JSONObject jsonDescStruct = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonDescBox)) {
String out_order_seq = jsonDescBox.getString("out_order_seq"); String out_order_seq = jsonDescBox.getString("out_order_seq");
// 上一个货位顺序号 // 上一个货位顺序号
String out_order_seq_desc = String.valueOf(NumberUtil.add(out_order_seq, "1")); String out_order_seq_desc = String.valueOf(NumberUtil.add(out_order_seq, "1"));
JSONObject jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '" + out_order_seq_desc + "'").uniqueResult(0); jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '" + out_order_seq_desc + "'").uniqueResult(0);
}
if (ObjectUtil.isNotEmpty(jsonDescStruct)) { if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
struct_jo = jsonDescStruct; struct_jo = jsonDescStruct;
} else { } else {
// 没有就正序找到第一个物料、判断上一个是否有货位 // 没有就正序找到第一个物料、判断上一个是否有货位
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0); JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
JSONObject jsonAscStruct = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonAscBox)) {
String out_order_seq2 = jsonAscBox.getString("out_order_seq"); String out_order_seq2 = jsonAscBox.getString("out_order_seq");
// 上一个货位顺序号 // 上一个货位顺序号
String out_order_seq_asc = String.valueOf(NumberUtil.sub(out_order_seq2, "1")); String out_order_seq_asc = String.valueOf(NumberUtil.sub(out_order_seq2, "1"));
JSONObject jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '"+out_order_seq_asc+"'").uniqueResult(0); jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq = '"+out_order_seq_asc+"'").uniqueResult(0);
}
if (ObjectUtil.isNotEmpty(jsonAscStruct)) { if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
struct_jo = jsonAscStruct; struct_jo = jsonAscStruct;
@@ -980,6 +988,67 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
return struct_jo; return struct_jo;
} }
public JSONObject queryEmpStruct(JSONObject whereJson) {
JSONObject struct_jo = new JSONObject();
String sect_id = whereJson.getString("sect_id");
String placement_type = whereJson.getString("placement_type");
String material_code = whereJson.getString("material_code");
String sale_order_name = whereJson.getString("sale_order_name");
//根据分切计划查询该订单物料大概还有多少未入
JSONObject row_map = new JSONObject();
row_map.put("material_code", material_code);
row_map.put("sale_order_name", sale_order_name);
row_map.put("sect_id", sect_id);
row_map.put("flag", "12");
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(plan_rows)) {
plan_rows = new JSONArray();
}
//查询该销售订单及行号有多少个生成状态的箱子
row_map.put("flag", "27");
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(box_rows)) {
box_rows = new JSONArray();
}
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
//查询数量与订单物料箱子数量相近的一排
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(empty_row)) {
String block_num2 = empty_row.getString("block_num");
String row_num2 = empty_row.getString("row_num");
String placement_type2 = empty_row.getString("placement_type");
if (placement_type.equals("02")) {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
} else {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
}
} else {
//如果查询不到空的一排,则查询有空位双通的一排
JSONObject have_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(have_row)) {
String block_num3 = have_row.getString("block_num");
String row_num3 = have_row.getString("row_num");
//判断该排是左边为空,还是右边为空
JSONObject right_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq").uniqueResult(0);
JSONObject left_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' order by out_order_seq desc").uniqueResult(0);
if (StrUtil.isNotEmpty(right_str.getString("storagevehicle_code")) || !right_str.getString("lock_type").equals("1")) {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq").uniqueResult(0);
}
if (StrUtil.isNotEmpty(left_str.getString("storagevehicle_code")) || !left_str.getString("lock_type").equals("1")) {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq desc").uniqueResult(0);
}
}
}
return struct_jo;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateTask(Map whereJson) { public void updateTask(Map whereJson) {