Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhangzhiqiang
2023-03-01 10:57:56 +08:00
38 changed files with 1595 additions and 557 deletions

View File

@@ -8,6 +8,7 @@ import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
@@ -132,6 +133,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
String device_code = null;
String old_device_code = null;
String emptyNum = null;
//自动门
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, "-")) {
@@ -187,6 +190,34 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.cancelNOSendAgv(inst.getInstruction_id());
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (phase == 0x50) {
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
standardAutodoorDeviceDriver.writing("to_open","1");
standardAutodoorDeviceDriver.writing("to_close","0");
if(standardAutodoorDeviceDriver.getOpen() == 1){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
} else if (phase == 0x51) {
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
standardAutodoorDeviceDriver.writing("to_close","1");
standardAutodoorDeviceDriver.writing(
"to_open","0");
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
//上报异常信息
//不需要WCS反馈

View File

@@ -47,7 +47,9 @@ public enum DriverTypeEnum {
SIEMENS_ONEFLOOR_AGV_CONVEYOR(17, "siemens_onefloor_agv_conveyor", "西门子-1LAGV-输送机驱动", "conveyor"),
PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor");
PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor"),
STANDARD_AUTODOOR(20, "standard_autodoor", "标准版-自动门", "autodoor");
//驱动索引

View File

@@ -12,6 +12,8 @@ import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
@@ -114,6 +116,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
StandardStorageDeviceDriver standardStorageDeviceDriver;
//普通-光电检测
PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
//标准-光电检测
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
//自动门
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
if (phase == 0x02) {
if (ObjectUtil.isEmpty(inst)) {
@@ -184,6 +190,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver();
if(photoelectricInspectionSiteDeviceDriver.getMove() == 1)
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","1");
if(standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -240,6 +252,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","0");
if(standardInspectSiteDeviceDriver.getMove() == 0 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -419,6 +437,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver();
if(photoelectricInspectionSiteDeviceDriver.getMove() == 0)
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","1");
if(standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() ==1 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -474,6 +498,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","0");
if(standardInspectSiteDeviceDriver.getMove() == 1 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -481,9 +511,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//到达放货点
//Itype=1、3,需要WCS反馈
else if (phase == 0x10) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
return;
@@ -601,22 +628,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} //进入区域phase值
else if (phase == 0x50) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
//离开区域phase值
else if (phase == 0x51) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
//上报异常信息
//不需要WCS反馈

View File

@@ -16,6 +16,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -87,7 +88,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private int instruction_require_time_out;
private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识
boolean requireSucess = false;
@@ -531,33 +532,40 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!";
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "无货,无法下发指令!";
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) nextdevice.getDeviceDriver();
if (photoelectricInspectionSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!";
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "有货,无法下发指令!";
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
@@ -584,7 +592,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing("to_target", next_addr);
this.writing("to_task", instruction.getInstruction_code());
this.writing("to_command", "1");
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door","1");
}
this.setNow_steps_type(2);
this.setRequireSucess(true);
return true;
@@ -603,6 +614,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
@@ -610,6 +622,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return false;
}
}
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "光电无货,无法生成指令!";
return false;
}
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) {
@@ -632,6 +651,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "光电有货,无法生成指令!";
return false;
}
}
String taskid = task.getTask_id();
String taskcode = task.getTask_code();
String vehiclecode = task.getVehicle_code();

View File

@@ -102,7 +102,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
private Date require_empty_in_time = new Date();
private Date require_empty_out_time = new Date();
private int instruction_require_time_out;
private int instruction_require_time_out =3000;
// 行架机械手申请任务成功标识
boolean requireSucess = false;
boolean requireApplyLabelingSuccess = false;
@@ -214,24 +214,12 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
var17.printStackTrace();
inst_message = var17.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
// return;
}
// if (!this.itemProtocol.getIsonline()) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "信号量同步异常";
// //未联机
// } else
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
// 有报警
// } else if (error != 0) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "有报警";
// //无报警
} else {
this.setIsonline(true);
this.setIserror(false);

View File

@@ -225,19 +225,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
inst1.setInstruction_status("1");
inst1.setExecute_device_code(this.getDevice_code());
instructionService.update(inst1);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
// if (!ObjectUtil.isEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray();
// JSONObject map = new JSONObject();
// map.put("task_id", taskDto.getExt_task_id());
// map.put("task_status", "1");
// array.add(map);
// acsToWmsService.feedbackTaskStatusToWms(array);
// }
// }
;
//this.setNow_steps_type1(1);
}
}
}
@@ -1213,8 +1200,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));

View File

@@ -0,0 +1,82 @@
package org.nl.acs.device_driver.basedriver.standard_autodoor;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_open = "open";
public static String item_close = "close";
public static String item_to_open = "to_open";
public static String item_to_close = "to_close";
private StandardAutodoorDeviceDriver driver;
public ItemProtocol(StandardAutodoorDeviceDriver driver) {
this.driver = driver;
}
public int getOpen() {
return this.getOpcIntegerValue(item_open);
}
public int getClose() {
return this.getOpcIntegerValue(item_close);
}
public int getToOpen() {
return this.getOpcIntegerValue(item_to_open);
}
public int getToClose() {
return this.getOpcIntegerValue(item_to_close);
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
} else {
return value;
}
return 0;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
} else {
return value;
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_open, "开到位", "10001"));
list.add(new ItemDto(item_close, "关到位", "10002"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_open, "下发开门", "00001" ));
list.add(new ItemDto(item_to_close, "下发关门", "00002"));
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -0,0 +1,63 @@
package org.nl.acs.device_driver.basedriver.standard_autodoor;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* 自动门驱动定义
*/
@Service
public class StandardAutodoorDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "standard_autodoor";
}
@Override
public String getDriverName() {
return "标准版-自动门";
}
@Override
public String getDriverDescription() {
return "标准版-自动门";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardAutodoorDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return StandardAutodoorDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,69 @@
package org.nl.acs.device_driver.basedriver.standard_autodoor;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import java.util.HashMap;
import java.util.Map;
/**
* 自动门驱动
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
int open = 0;
int close = 0;
int last_open = 0;
int last_close = 0;
String device_code = null;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
String message = null;
device_code = this.getDevice().getDevice_code();
open = this.itemProtocol.getOpen();
close = this.itemProtocol.getClose();
if (open != last_open) {
}
if (close != last_close) {
}
last_open = open;
last_close = close;
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
}

View File

@@ -507,22 +507,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符";
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务"
+"当前载具号"+container_code+"查找对应指令起点与当前设备不符");
// this.setIserror(true);
// List list = new ArrayList();
// Map map = new HashMap();
// map.put("code","to_target");
// map.put("value","1011");
// list.add(map);
// Map map2 = new HashMap();
// map2.put("code","to_command");
// map2.put("value","1");
// Map map3 = new HashMap();
// map3.put("code","to_task");
// map3.put("value","0");
// list.add(map3);
// this.writing(list);
// this.setRequireSucess(true);
// this.setApplySucess(true);
return false;
}
this.setIserror(false);
@@ -555,16 +539,22 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
message = "下发电气任务号成功";
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code
+"已存在对应任务,下发电气信号");
// if(task != Integer.parseInt(instdto.getInstruction_code()) ){
// this.writing(list);
// logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发电气信号");
// }
requireSucess = true;
applySucess = true;
} else {
message = "任务号:" + taskdto.getTask_code() + "未找到指令";
}
return true;
} else {
//需要判断指令中的指令 再次请求不能生成
if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"))) {
{
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code
+ "已存在对应任务");
requireSucess = true;
applySucess = true;
}
}
}
String taskid = taskdto.getTask_id();
@@ -722,6 +712,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
map3.put("value","0");
list.add(map3);
this.writing(list);
requireSucess = true;
applySucess = true;
message = "申请任务失败接口不通下发退回";
} else {
if (jo.getInteger("status") == 200) {

View File

@@ -14,13 +14,12 @@ public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_ioaction = "ioaction";
public static String item_action = "action";
public static String item_error = "error";
public static String item_task = "task";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_weight = "weight";
private StandardInspectSiteDeviceDriver driver;
@@ -40,8 +39,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_move);
}
public int getIoaction() {
return this.getOpcIntegerValue(item_ioaction);
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
@@ -87,16 +86,17 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_task, "任务", "DB600.D8"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2"));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_action, "动作信号", "DB600.B4"));
list.add(new ItemDto(item_error, "报警信", "DB600.B5"));
list.add(new ItemDto(item_task, "任务号", "DB600.D6"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2"));
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
return list;

View File

@@ -50,19 +50,10 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D8"));
return list;
return ItemProtocol.getReadableItemDtos();
}
@Override
@@ -70,4 +61,5 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -15,6 +15,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
@@ -43,14 +44,10 @@ import java.util.Map;
@RequiredArgsConstructor
public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
String container;
String container_type_desc;
String last_container_type_desc;
@@ -64,6 +61,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
int error = 0;
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;
@@ -117,7 +116,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
String devicecode;
String device_code = null;
@Override
public Device getDevice() {
@@ -129,91 +128,41 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void execute() {
String message = null;
try {
String device_code = this.getDeviceCode();
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
if (mode != last_mode) {
this.setRequireSucess(false);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
}
if (move != last_move) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (error != last_error) {
}
if (this.getApply_handling()) {
String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device link_device = appService.findDeviceByCode(link_device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
// if(standardInspectSiteDevicedriver.getMode() != 2){
// log.debug("设备未待机");
// return;
// }
// if(standardInspectSiteDevicedriver.getMove() != 0){
// log.debug("设备不满足放货条件");
// return;
// }
//如果目标设备申请叫料 则允许生成任务
if (standardInspectSiteDevicedriver.getApply_material()) {
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
dto.setNext_point_code(standardInspectSiteDevicedriver.getDevicecode());
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
standardInspectSiteDevicedriver.setApply_material(false);
}
}
this.setApply_handling(false);
if (action != last_action) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
} catch (Exception var17) {
return;
}
if (!this.itemProtocol.getIsonline()) {
if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "信号量同步异常";
//未联机
} else if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "未联机";
//有报警
} else if (error != 0) {
this.setIsonline(false);
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
message = "";
Instruction instruction = null;
List toInstructions;
@@ -222,76 +171,14 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
log.debug("设备运转模式:等待工作");
return;
case 2:
//申请任务
// if (this.getApply_handling()) {
// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
// Device link_device = appService.findDeviceByCode(link_device_code);
// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
// if(link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
// if(standardInspectSiteDevicedriver.getMode() != 2){
// log.debug("设备未待机");
// return;
// }
// if(standardInspectSiteDevicedriver.getMove() != 0){
// log.debug("设备不满足放货条件");
// return;
// }
//
// //如果目标设备申请叫料 则允许生成任务
// if(standardInspectSiteDevicedriver.getApply_material()){
// TaskDto dto = new TaskDto();
// String now = DateUtil.now();
// dto.setTask_id(IdUtil.simpleUUID());
// dto.setCreate_by(this.getDevice().getDevice_code());
// dto.setUpdate_by(this.getDevice().getDevice_code());
// dto.setStart_point_code(this.getDevice().getDevice_code());
//
// String taskcode = CodeGenerateUtil.getNewCode("TASK_NO");
// dto.setTask_code("-"+taskcode);
// dto.setTask_status("0");
// dto.setPriority("101");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
// dto.setNext_point_code(next_device_codecode);
// dto.setUpdate_time(now);
// dto.setCreate_time(now);
//
// WQLObject wo = WQLObject.getWQLObject("acs_task");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
// wo.insert(json);
// standardInspectSiteDevicedriver.setApply_material(false);
// }
// }
// this.setApply_handling(false);
// }
if (material.length() > 0 && qty.length() > 0 && !requireSucess) {
this.instruction_require(container);
}
}
switch (flag) {
//取货完成
case 1:
writing(2);
return;
//放货完成
case 2:
writing(3);
return;
break;
}
}
last_mode = mode;
last_error = error;
last_move = move;
last_action = action;
last_task = task;
}
@@ -306,137 +193,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
protected void thingToNothing() {
log.debug("从有货到无货 清理数据");
this.set_last_container(container, container_type_desc);
}
public void set_last_container(String barcode, String type_desc) {
this.set_last_container(barcode);
this.set_last_container_type_desc(type_desc);
}
public void set_last_container(String barcode) {
}
public void set_last_container_type_desc(String type) {
}
public boolean exe_business() {
return true;
}
protected void executing(Instruction instruction) {
this.executing(1, instruction, "");
}
public void executing(int command, Instruction instruction, String appendMessage) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
if (appendMessage == null) {
appendMessage = "";
}
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
this.control(itemMap);
}
public void writing(int type, int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
} else if (type == 2) {
itemMap.put(to_target, command);
} else if (type == 3) {
itemMap.put(to_task, command);
}
this.control(itemMap);
}
public boolean instruction_require(String container_code) {
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
}
/**
* 请求指令
*
* @param container_code
* @param container_type
*/
public synchronized boolean instruction_require(String container_code, String container_type) {
Date date = new Date();
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return false;
} else {
this.instruction_require_time = date;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
dto.setVehicle_code(container_code);
dto.setVehicle_type(container_type);
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
requireSucess = false;
return true;
}
}
@Override
public JSONObject getDeviceStatusName() {
@@ -479,4 +236,14 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void setDeviceStatus(JSONObject data) {
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@@ -527,6 +528,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
continue;
}
if(StrUtil.equals(task_type,"8")){
next_device_code = request.getPut_device_code();
put_device_code = request.getNext_device_code();
}
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) {
@@ -654,8 +659,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
JSONObject jo = new JSONObject();
jo.put("task_id", IdUtil.simpleUUID());
jo.put("task_code", task_code);
jo.put("task_id", ext_task_id);
jo.put("start_point_code", start_point_code);
jo.put("next_point_code", next_point_code);
jo.put("start_point_code2", start_point_code2);
@@ -688,7 +693,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
//创建临时指令 不创建、不生成
//等立库反馈成功才能创建任务和指令
Instruction inst = taskService.createTemporaryInst(task_dto);
Instruction inst = null;
try {
inst = taskService.createTemporaryInst(task_dto);
} catch (Exception e){
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", e.getMessage());
errArr.add(json);
continue;
}
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst);
if(StrUtil.equals(resp.result,"true")){
@@ -798,10 +813,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
JSONObject resultJson = new JSONObject();
if (ObjectUtil.isEmpty(errArr)) {
resultJson.put("status", HttpStatus.OK);
} else {
resultJson.put("status", HttpStatus.BAD_REQUEST);
resultJson.put("status", HttpStatus.OK.value());
resultJson.put("message", "操作成功");
} else {
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "操作失败");
if(ObjectUtil.isNotEmpty(errArr)){
resultJson.put("errArr",errArr);
}

View File

@@ -88,6 +88,8 @@ public interface InstructionService {
Instruction findByTaskcodeAndStatus(String code);
Instruction findByTaskcodeAndStatus(String code,String status);
/**
* 根据任务id查询
*
@@ -158,6 +160,13 @@ public interface InstructionService {
void finishAndCreateNextInst(Instruction dto) throws Exception;
/**
* 完成并创建指令
*
* @param
*/
void finishAndCreateHXInst(Instruction dto) throws Exception;
/**
* 取消指令
*
@@ -261,14 +270,6 @@ public interface InstructionService {
*/
Integer querySameOriginInst(String code);
/**
* 查询相同起点、终点指令的数量
*
* @param code
* @return
*/
//Integer querySameOriginInst(String code);
boolean removeByCodeFromCache(String code);

View File

@@ -261,6 +261,21 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
return null;
}
@Override
public Instruction findByTaskcodeAndStatus(String code,String status) {
Iterator var3 = instructions.iterator();
while (var3.hasNext()) {
Instruction instruction = (Instruction) var3.next();
if (StrUtil.equals(instruction.getTask_code(), code)
&& StrUtil.equals(instruction.getInstruction_status(), status)) {
return instruction;
}
}
return null;
}
@Override
public Instruction findByTaskid(String id, String wherecaluse) {
if (!StrUtil.isEmpty(wherecaluse)) {
@@ -728,11 +743,30 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
TaskDto obj = taskjson.toJavaObject(TaskDto.class);
// =0 则不用再次请求
if (StrUtil.equals(obj.getRequest_again(), "0")) {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
if(StrUtil.equals(obj.getTask_type(),"8")){
//中转为空
if(StrUtil.isEmpty(obj.getPut_device_code())){
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(entity);
}
} else {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(entity);
} else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
}
}
} else {
finishAndCreateNextInst(entity);
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(entity);
}
}
}
removeByCodeFromCache(entity.getInstruction_code());
@@ -755,11 +789,30 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
TaskDto obj = taskjson.toJavaObject(TaskDto.class);
// =0 则不用再次请求
if (StrUtil.equals(obj.getRequest_again(), "0")) {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
if(StrUtil.equals(obj.getTask_type(),"8")){
//中转为空
if(StrUtil.isEmpty(obj.getPut_device_code())){
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(dto);
}
} else {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(dto);
} else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
}
}
} else {
finishAndCreateNextInst(dto);
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(dto);
}
}
}
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@@ -876,6 +929,71 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void finishAndCreateHXInst(Instruction dto) {
dto = foramte(dto);
String device_code = dto.getNext_device_code();
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
String next_device_code = acsTask.getPut_device_code();
String start_device_code = dto.getNext_device_code();
String start_point_code = null;
String next_point_code = null;
String start_device =
deviceAppService
.findDeviceByCode(start_device_code)
.getDeviceDriverDefination()
.getFitDeviceTypes()
.get(0)
.name();
String next_device =
deviceAppService
.findDeviceByCode(next_device_code)
.getDeviceDriverDefination()
.getFitDeviceTypes()
.get(0)
.name();
if (StrUtil.equals("storage", start_device)) {
start_point_code = start_device_code + "-" + acsTask.getFrom_y() + "-" + acsTask.getFrom_z();
} else {
start_point_code = start_device_code;
}
if (StrUtil.equals("storage", next_device)) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(acsTask.getRoute_plan_code());
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
instdto.setQuantity(acsTask.getQuantity());
instdto.setTask_id(acsTask.getTask_id());
instdto.setTask_code(acsTask.getTask_code());
instdto.setVehicle_code(acsTask.getVehicle_code());
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setPriority(acsTask.getPriority());
instdto.setInstruction_status("0");
instdto.setExecute_device_code(dto.getNext_device_code());
try {
this.create(instdto);
} catch (Exception e) {
e.printStackTrace();
log.error("完成并创建下一条指令", e.getMessage());
}
}
@Override
public void cancel(String id) throws Exception {
// flag= true时取消指令

View File

@@ -367,6 +367,23 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (ObjectUtil.isNotEmpty(instruction)) {
list.add(task);
}
} else {
if(StrUtil.equals(task.getTask_type(),"8") && StrUtil.isNotEmpty(task.getPut_device_code()))
{
// if(task.getNext_device_code().equals(device_code)
// && StrUtil.equals(task.getTask_status(), "1")){
// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
// if (ObjectUtil.isNotEmpty(instruction)) {
// list.add(task);
// }
// }
Instruction instruction = instructionService.findByDeviceCodeFromCache(device_code);
if (ObjectUtil.isNotEmpty(instruction)) {
if(StrUtil.equals(instruction.getStart_device_code(),device_code)){
list.add(task);
}
}
}
}
}
return list;
@@ -777,7 +794,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
System.out.println(feefbackdto == null);
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getTask_id());
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray();
@@ -909,7 +926,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getTask_id());
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray();
@@ -939,11 +956,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
// InstructionDto inst = instructionservice.findByTaskid(acsTask, "instruction_status < 2
// ");
// if (inst != null) {
// throw new BadRequestException("有指令未完成!");
// }
String taskid = acsTask.getTask_id();
String taskcode = acsTask.getTask_code();
@@ -975,6 +987,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(
start_device_code, acsTask.getNext_device_code(), route_plan_code);
if(ObjectUtil.isEmpty(shortPathsList)){
throw new BadRequestException(start_device_code + "->" + acsTask.getNext_device_code() + "路由不通!");
}
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();

View File

@@ -65,7 +65,6 @@ public class AutoCreateInst {
String next_point_code2 = acsTask.getNext_point_code2();
String next_device_code2 = acsTask.getNext_device_code2();
String route_plan_code = acsTask.getRoute_plan_code();
String vehicleType = acsTask.getVehicle_type();
String agv_system_type = acsTask.getAgv_system_type();
@@ -158,6 +157,8 @@ public class AutoCreateInst {
instdto.setAgv_inst_type("2");
} else if (StrUtil.equals(task_type, "2")) {
instdto.setAgv_inst_type("3");
} else if (StrUtil.equals(task_type, "8")) {
instdto.setAgv_inst_type("2");
}
} else {
instdto.setAgv_inst_type("4");

View File

@@ -97,6 +97,7 @@ import siemens_conveyor_labeling from '@/views/acs/device/driver/siemens_conveyo
import siemens_conveyor_ckk from '@/views/acs/device/driver/siemens_conveyor_ckk'
import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor'
import photoelectric_inspection_site from '@/views/acs/device/driver/photoelectric_inspection_site'
import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
export default {
name: 'DeviceConfig',
@@ -124,7 +125,8 @@ export default {
siemens_conveyor_labeling,
siemens_conveyor_ckk,
siemens_onefloor_agv_conveyor,
photoelectric_inspection_site
photoelectric_inspection_site,
standard_autodoor
},
dicts: ['device_type'],
mixins: [crud],

View File

@@ -0,0 +1,352 @@
<template>
<!--自动门-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">输送系统</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-switch v-model="form.OPCServer" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data1"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data1[scope.$index].db"
size="mini"
class="edit-input"
@input="finishReadEdit(data1[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbr_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC写入字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data2"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data2[scope.$index].db"
size="mini"
class="edit-input"
@input="finishWriteEdit(data2[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbw_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig,
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
export default {
name: 'StandardAutodoor',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
opc_id: '',
opc_code: '',
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
manual_create_task: true,
is_pickup: true,
is_release: true
},
rules: {}
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
// 给表单赋值,并且属性不能为空
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
// 不为空
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
this.data1 = data.rs
this.data2 = data.ws
this.sliceItem()
})
selectPlcList().then(data => {
this.dataOpcPlcs = data
this.plc_id = this.$props.parentForm.opc_plc_id
})
selectOpcList().then(data => {
this.dataOpcservers = data
this.opc_id = this.$props.parentForm.opc_server_id
})
})
},
methods: {
changeOpc(val) {
this.dataOpcservers.forEach(item => {
if (item.opc_id === val) {
this.opc_code = item.opc_code
}
})
selectListByOpcID(val).then(data => {
this.dataOpcPlcs = data
this.plc_id = ''
this.plc_code = ''
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
this.plc_id = this.dataOpcPlcs[0].plc_id
this.plc_code = this.dataOpcPlcs[0].plc_code
}
this.sliceItem()
})
},
finishReadEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('mode') !== -1) {
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('action') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
}
}
},
changePlc(val) {
this.dataOpcPlcs.forEach(item => {
if (item.plc_id === val) {
this.plc_code = item.plc_code
this.sliceItem()
return
}
})
},
test_read1() {
testRead(this.data1, this.opc_id).then(data => {
this.data1 = data
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
test_write1() {
testwrite(this.data2, this.opc_id).then(data => {
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
parentForm.is_route = true
parentForm.plc_id = this.plc_id
parentForm.opc_id = this.opc_id
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sliceItem() { // 拼接DB的Item值
this.data1.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
this.data2.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -147,27 +147,18 @@
<el-table-column prop="next_point_code" label="放货点1" />
<el-table-column prop="start_point_code2" label="取货点2" />
<el-table-column prop="next_point_code2" label="放货点2" />
<el-table-column prop="put_point_code" label="倒料" />
<el-table-column prop="put_point_code" label="中转" />
<el-table-column prop="execute_device_code" label="当前执行设备" />
<el-table-column prop="carno" label="车号" />
<el-table-column prop="weight" label="重量" />
<el-table-column prop="agv_jobno" label="AGV任务号" />
<el-table-column prop="agv_inst_type" label="AGV任务类型" />
<el-table-column prop="agv_system_type" label="AGV系统类型" />
<!-- <el-table-column prop="compound_inst" label="复合指令">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.compound_inst==='0' ">否</span>-->
<!-- <span v-if="scope.row.compound_inst==='1' ">是</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="compound_inst_data" width="200" label="复合路线" />-->
<!-- <el-table-column prop="matarial" label="物料" />-->
<!-- <el-table-column prop="quantity" label="数量" />-->
<el-table-column prop="agv_system_type" label="AGV系统类型" >
</el-table-column>
<el-table-column prop="remark" label="描述" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<!-- <el-table-column prop="update_by" label="修改者" />-->
<!-- <el-table-column prop="update_time" label="修改时间" width="135" />-->
<el-table-column
v-permission="['admin','instruction:edit','instruction:del']"
fixed="left"

View File

@@ -334,10 +334,8 @@
<!-- <el-table-column prop="link_num" label="关联编号" />-->
<el-table-column prop="vehicle_code" label="载具号" width="100" />
<el-table-column prop="task_status" label="任务状态" width="60">
<template slot-scope="scope" width="60">
<span v-if="scope.row.task_status==='0' ">就绪</span>
<span v-if="scope.row.task_status==='1' ">执行中</span>
<span v-if="scope.row.task_status==='2' ">完成</span>
<template slot-scope="scope">
{{ dict.label.task_status[scope.row.task_status] }}
</template>
</el-table-column>
<el-table-column prop="priority" label="优先级" width="100" />
@@ -345,20 +343,18 @@
<el-table-column prop="next_point_code" label="放货点1" width="120px" />
<el-table-column prop="start_point_code2" label="取货点2" width="120px" />
<el-table-column prop="next_point_code2" label="放货点2" width="120px" />
<el-table-column prop="put_point_code" label="倒料点" width="100px" />
<el-table-column prop="agv_task_type" label="AGV任务类型" width="120px" />
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px" />
<el-table-column prop="storage_task_type" label="立库任务类型" width="120px" />
<!-- <el-table-column prop="compound_task" label="复合任务">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.compound_task==='0' "></span>-->
<!-- <span v-if="scope.row.compound_task==='1' "></span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="compound_task_data" width="200" label="复合路线" />-->
<!-- <el-table-column prop="matarial" label="物料" />-->
<!-- <el-table-column prop="quantity" label="数量" />-->
<el-table-column prop="put_point_code" label="中转点" width="100px" />
<!-- <el-table-column prop="agv_task_type" label="AGV任务类型" width="120px" />-->
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px">
<template slot-scope="scope">
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
</template>
</el-table-column>
<el-table-column prop="storage_task_type" label="立库任务类型" width="120px" >
<template slot-scope="scope">
{{ dict.label.storage_task_type[scope.row.storage_task_type] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
@@ -478,6 +474,7 @@ export default {
vehicle_type: null,
task_type: '1',
storage_task_type: '',
agv_task_type: '',
task_status: null,
priority: 1,
start_point_code: null,

View File

@@ -603,8 +603,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
data.put("box_width", box_width);
data.put("box_high", box_high);
String bundle_times_num = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("bundle_times_num").getValue();
Double box_length_value = Double.valueOf(box_length);
if (box_length_value >= 772) {
Double box_bundle_times_num = Double.valueOf(bundle_times_num);
if (box_length_value >= box_bundle_times_num) {
data.put("bundle_times", 3);
} else {
data.put("bundle_times", 2);

View File

@@ -468,26 +468,25 @@ public class MesToLmsServiceImpl implements MesToLmsService {
try {
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
String container_name = param.getString("ContainerName");
if (StrUtil.isEmpty(container_name)) {
throw new BadRequestException("子卷号不能为空!");
}
JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到该子卷号对应的分切计划!");
}
String Attribute1 = param.getString("Attribute1");
String Attribute2 = param.getString("Attribute2");
if (StrUtil.equals("1", Attribute2)) {
//更新该子卷号对应的分切计划为已呼叫
plan_jo.put("is_call", "1");
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(plan_jo);
}
if (StrUtil.equals(is_mesTolms, "1")) {
String container_name = param.getString("ContainerName");
if (StrUtil.isEmpty(container_name)) {
throw new BadRequestException("子卷号不能为空!");
}
JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到该子卷号对应的分切计划!");
}
String Attribute1 = param.getString("Attribute1");
String Attribute2 = param.getString("Attribute2");
if (StrUtil.equals("1", Attribute2)) {
//更新该子卷号对应的分切计划为已呼叫
plan_jo.put("is_call", "1");
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(plan_jo);
}
if (Attribute1.equals("0")) {
result.put("RTYPE", "S");
result.put("RTMSG", "操作成功!");
@@ -743,6 +742,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
JSONArray up_rows = new JSONArray();
JSONArray down_rows = new JSONArray();
String up_qzz = "";
String down_qzz = "";
for (int i = 0; i < param.size(); i++) {
JSONObject row = param.getJSONObject(i);
//查询对应的分切计划
@@ -750,6 +751,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
if (ObjectUtil.isEmpty(plan_jo)) {
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
}
String qzzno = plan_jo.getString("qzzno");
String need_down = row.getString("Attribute1");
if (StrUtil.isEmpty(need_down)) {
throw new BadRequestException("子卷:" + row.getString("ContainerGroup") + "对应的是否需要下轴字段不能为空!");
@@ -759,10 +761,38 @@ public class MesToLmsServiceImpl implements MesToLmsService {
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
} else {
if (row.getString("ContainerPosition").equals("1")) {
up_rows.add(plan_jo);
if (StrUtil.isEmpty(up_qzz)) {
up_qzz = qzzno;
up_rows.add(plan_jo);
} else {
if (!StrUtil.equals(qzzno, up_qzz)) {
down_qzz = qzzno;
down_rows.add(plan_jo);
} else {
up_rows.add(plan_jo);
}
}
}
if (row.getString("ContainerPosition").equals("2")) {
down_rows.add(plan_jo);
if (StrUtil.isEmpty(down_qzz)) {
if (StrUtil.isEmpty(up_qzz)) {
down_qzz = qzzno;
down_rows.add(plan_jo);
} else {
if (StrUtil.equals(up_qzz, qzzno)) {
up_rows.add(plan_jo);
} else {
down_qzz = qzzno;
down_rows.add(plan_jo);
}
}
} else {
if (StrUtil.equals(down_qzz, qzzno)) {
down_rows.add(plan_jo);
} else {
up_rows.add(plan_jo);
}
}
}
}
}

View File

@@ -41,4 +41,18 @@ public class FeedingController {
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(feedingService.confirm(whereJson), HttpStatus.OK);
}
@PostMapping("/queryPoint")
@Log("扫码起点获取母卷")
@ApiOperation("扫码起点获取母卷")
public ResponseEntity<Object> queryPoint(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(feedingService.queryPoint(whereJson), HttpStatus.OK);
}
@PostMapping("/handleConfirm")
@Log("人工呼叫母卷确认")
@ApiOperation("人工呼叫母卷确认")
public ResponseEntity<Object> handleConfirm(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(feedingService.handleConfirm(whereJson), HttpStatus.OK);
}
}

View File

@@ -21,4 +21,20 @@ public interface FeedingService {
*/
JSONObject confirm(JSONObject whereJson);
/**
* 套轴确认
*
* @param whereJson /
* @return JSONObject
*/
JSONObject queryPoint(JSONObject whereJson);
/**
* 套轴确认
*
* @param whereJson /
* @return JSONObject
*/
JSONObject handleConfirm(JSONObject whereJson);
}

View File

@@ -174,8 +174,8 @@ public class BakingServiceImpl implements BakingService {
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "1");
jsonMap.put("product_area", product_area);
jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose));
jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose));
jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose)+"");
jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose)+"");
jsonMap.put("point_location", map.getString("point_location"));
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有合适温度的空位!");

View File

@@ -211,9 +211,126 @@ public class FeedingServiceImpl implements FeedingService {
}
JSONObject jo = new JSONObject();
jo.put("message", "查询成功!");
jo.put("message", "操作成功!");
return jo;
}
@Override
public JSONObject queryPoint(JSONObject form) {
String point_code = form.getString("point_code");
if (StrUtil.isEmpty(point_code)) {
throw new BadRequestException("输入的点位不能为空!");
}
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cool_jo)) {
throw new BadRequestException("请输入或者扫描冷却区满轴位的点位!");
}
if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) {
throw new BadRequestException("该点位上不存在母卷!");
}
JSONObject result = new JSONObject();
result.put("content", cool_jo);
result.put("message", "查询成功!");
return result;
}
@Transactional(rollbackFor = Exception.class)
@Override
public JSONObject handleConfirm(JSONObject form) {
String point_code = form.getString("point_code");
String next_point_code = form.getString("next_point_code");
if (StrUtil.isEmpty(point_code)) {
throw new BadRequestException("输入的起点不能为空!");
}
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cool_jo)) {
throw new BadRequestException("请输入或者扫描冷却区满轴位的点位做为起点!");
}
if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) {
throw new BadRequestException("该点位上不存在母卷!");
}
//查询该分切机对应的点位
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(cut_jo)) {
throw new BadRequestException("请扫描或者输入分切区域的满轴点位做为终点!");
}
if (StrUtil.isNotEmpty(cut_jo.getString("container_name")) || cut_jo.getString("full_point_status").equals("02")) {
throw new BadRequestException("该分切机对应的上料位存在母卷,不能下发搬运任务!");
}
JSONObject jo = new JSONObject();
if (StrUtil.equals("01", cut_jo.getString("empty_point_code"))) {
jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010302");
} else {
jo.put("point_code1", point_code);
jo.put("point_code2", next_point_code);
jo.put("point_code3", cut_jo.getString("empty_point_code"));
jo.put("point_code4", cool_jo.getString("empty_point_code"));
jo.put("vehicle_code", cool_jo.getString("container_name"));
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
jo.put("product_area", cut_jo.getString("product_area"));
jo.put("task_type", "010301");
}
//查询该母卷号对应的生箔信息
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + cool_jo.getString("container_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(raw_jo)) {
throw new BadRequestException("未查询到母卷:" + cool_jo.getString("container_name") + ",对应的生箔信息!");
}
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo)) {
throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + "基础信息!");
}
AbstractAcsTask task = new CoolCutTask();
String task_id = task.createTask(jo);
//生成半成品出库单据
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject jsonCool = new JSONObject();
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonCool.put("io_type", "1");
jsonCool.put("material_id", mater_jo.getString("material_id"));
jsonCool.put("pcsn", cool_jo.getString("container_name"));
jsonCool.put("bill_status", "50");
jsonCool.put("task_id", task_id);
jsonCool.put("qty_unit_id", "1");
jsonCool.put("start_point_code", cool_jo.getString("full_point_code"));
jsonCool.put("end_point_code", cut_jo.getString("full_point_code"));
jsonCool.put("create_mode", "03");
jsonCool.put("create_id", currentUserId);
jsonCool.put("create_name", currentUsername);
jsonCool.put("create_time", DateUtil.now());
jsonCool.put("update_optid", currentUserId);
jsonCool.put("update_optname", currentUsername);
jsonCool.put("update_time", DateUtil.now());
jsonCool.put("confirm_optid", currentUserId);
jsonCool.put("confirm_optname", currentUsername);
jsonCool.put("confirm_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_CoolRegionIO").insert(jsonCool);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
return jo;
}
}

View File

@@ -287,7 +287,7 @@ public class RawFoilServiceImpl implements RawFoilService {
JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '" + container_name + "' and task_status <> '07' AND is_delete = '0'").uniqueResult(0);
// 查询生箔点位库存表
JSONObject jsonSb = rawTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0);
JSONObject jsonSb = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位不存在");
//下发ACS执行取满放空的AGV动作

View File

@@ -46,10 +46,10 @@ public class CallEmpReelTask extends AbstractAcsTask {
String product_area = json.getString("product_area");
String agv_system_type = "";
if (product_area.equals("A1") || product_area.equals("A2")){
if (product_area.equals("A1") || product_area.equals("A2")) {
agv_system_type = "2";
}
if (product_area.equals("A3") || product_area.equals("A4")){
if (product_area.equals("A3") || product_area.equals("A4")) {
agv_system_type = "3";
}
AcsTaskDto dto = AcsTaskDto.builder()
@@ -87,7 +87,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
//更新车号和重量
String car_no = taskObj.getString("car_no");
if (StrUtil.isNotEmpty(car_no)){
if (StrUtil.isNotEmpty(car_no)) {
JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0);
jsonRaw.put("agvno", car_no);
rawTab.update(jsonRaw);
@@ -96,12 +96,12 @@ public class CallEmpReelTask extends AbstractAcsTask {
String weight = taskObj.getString("weight");
if (ObjectUtil.isNotEmpty(weight)) {
JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0);
jsonRaw.put("productin_qty", taskObj.getDoubleValue(weight));
jsonRaw.put("productin_qty", weight);
rawTab.update(jsonRaw);
}
if (StrUtil.equals(status, "0")) {
// 更新删除字段
jsonTask.put("is_delete","1");
jsonTask.put("is_delete", "1");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
@@ -145,7 +145,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
// 判断是两个点位的任务还是四个点位的任务
if (ObjectUtil.isEmpty(point_code3)) {
// 判断是取满 or 取空 :取满起点是生箔区域、取空起点是冷却区域
JSONObject jsonSbIvt = sbTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
JSONObject jsonSbIvt = sbTab.query("point_code = '" + point_code1.substring(0, point_code1.length() - 2) + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonSbIvt)) {
// 取满
JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
@@ -158,17 +158,17 @@ public class CallEmpReelTask extends AbstractAcsTask {
ivtTab.update(jsonCoolIvt);
//更新母卷工单状态
HashMap<String,String> map = new HashMap<>();
HashMap<String, String> map = new HashMap<>();
map.put("status", "09");
map.put("realend_time", DateUtil.now());
map.put("update_optid",currentUserId+"");
map.put("update_optname",currentUsername);
map.put("update_optid", currentUserId + "");
map.put("update_optname", currentUsername);
map.put("finish_type", "01");
map.put("update_time",DateUtil.now());
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map,"container_name = '"+jsonTask.getString("material_code")+"'");
map.put("update_time", DateUtil.now());
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'");
} else {
// 取空
JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
JSONObject jsonCoolIvt = ivtTab.query("empty_point_code = '" + point_code1 + "'").uniqueResult(0);
jsonCoolIvt.put("empty_point_status", "01");
jsonCoolIvt.put("empty_vehicle_code", "");
ivtTab.update(jsonCoolIvt);
@@ -179,9 +179,9 @@ public class CallEmpReelTask extends AbstractAcsTask {
JSONObject jsonIvt = ivtTab.query("empty_point_code ='" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("未找到可用点位:" + point_code1);
// 校验终点是否存在
JSONObject nextDto = sbTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
/*JSONObject nextDto = sbTab.query("point_code ='" + point_code2.substring(point_code2.length()-2) + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(nextDto))
throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2"));
throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2"));*/
// 更新冷却库存状态
jsonIvt.put("empty_point_status", "01");
@@ -194,14 +194,14 @@ public class CallEmpReelTask extends AbstractAcsTask {
// 更新工单状态为完成
//更新母卷工单状态
HashMap<String,String> map = new HashMap<>();
HashMap<String, String> map = new HashMap<>();
map.put("status", "09");
map.put("realend_time", DateUtil.now());
map.put("update_optid",currentUserId+"");
map.put("update_optname",currentUsername);
map.put("update_optid", currentUserId + "");
map.put("update_optname", currentUsername);
map.put("finish_type", "01");
map.put("update_time",DateUtil.now());
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map,"container_name = '"+jsonTask.getString("material_code")+"'");
map.put("update_time", DateUtil.now());
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'");
// 更新冷却库存状态
jsonIvt2.put("full_point_status", "02");
@@ -211,38 +211,36 @@ public class CallEmpReelTask extends AbstractAcsTask {
jsonIvt2.put("ivt_qty", jsonRaw.getString("productin_qty"));
ivtTab.update(jsonIvt2);
// 插入入库单
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在");
JSONObject jsonRegion = new JSONObject();
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonRegion.put("io_type", "0");
jsonRegion.put("material_id", jsonMater.getString("material_id"));
jsonRegion.put("pcsn", jsonRaw.getString("container_name"));
jsonRegion.put("vehicle_code", "");
jsonRegion.put("qty", jsonRaw.getString("productin_qty"));
jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id"));
jsonRegion.put("bill_status", "50");
jsonRegion.put("start_point_code", point_code2);
jsonRegion.put("end_point_code", point_code4);
jsonRegion.put("cust_id", "");
jsonRegion.put("create_mode", "03");
jsonRegion.put("task_id", task_id);
jsonRegion.put("create_id", currentUserId);
jsonRegion.put("create_name", currentUsername);
jsonRegion.put("create_time", DateUtil.now());
jsonRegion.put("update_optid", currentUserId);
jsonRegion.put("update_optname", currentUsername);
jsonRegion.put("update_time", DateUtil.now());
jsonRegion.put("confirm_optid", currentUserId);
jsonRegion.put("confirm_optname", currentUsername);
jsonRegion.put("confirm_time", DateUtil.now());
coolTab.insert(jsonRegion);
}
// 插入入库单
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在");
JSONObject jsonRegion = new JSONObject();
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonRegion.put("io_type", "0");
jsonRegion.put("material_id", jsonMater.getString("material_id"));
jsonRegion.put("pcsn", jsonRaw.getString("container_name"));
jsonRegion.put("vehicle_code", "");
jsonRegion.put("qty", jsonRaw.getString("productin_qty"));
jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id"));
jsonRegion.put("bill_status", "50");
jsonRegion.put("start_point_code", point_code2);
jsonRegion.put("end_point_code", point_code4);
jsonRegion.put("cust_id", "");
jsonRegion.put("create_mode", "03");
jsonRegion.put("task_id", task_id);
jsonRegion.put("create_id", currentUserId);
jsonRegion.put("create_name", currentUsername);
jsonRegion.put("create_time", DateUtil.now());
jsonRegion.put("update_optid", currentUserId);
jsonRegion.put("update_optname", currentUsername);
jsonRegion.put("update_time", DateUtil.now());
jsonRegion.put("confirm_optid", currentUserId);
jsonRegion.put("confirm_optname", currentUsername);
jsonRegion.put("confirm_time", DateUtil.now());
coolTab.insert(jsonRegion);
}
}
@@ -284,7 +282,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
JSONObject json = new JSONObject();
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("material_code", form.getString("material_code"));
json.put("point_code1", form.getString("point_code1"));
@@ -299,14 +297,16 @@ public class CallEmpReelTask extends AbstractAcsTask {
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());
//根据类型获取对应的任务优先级
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(priority_jo)){
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(priority_jo)) {
json.put("priority", "1");
}else {
} else {
json.put("priority", priority_jo.getString("value"));
}
if (form.getString("task_type").equals("010101")) {
json.put("acs_task_type", "1");
} else {
json.put("acs_task_type", "3");
}
tab.insert(json);

View File

@@ -104,18 +104,21 @@ public class CutConveyorTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
//调用MES接口通知MES运输中
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_delete ='0' AND status < '09'").getResultJSONArray(0);
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
JSONObject jo = new JSONObject();
jo.put("container_name", row.getString("container_name"));
jo.put("is_send", "1");
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'airSwellWithPaperTubeAssComplete'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) {
lmsToMesService.airSwellWithPaperTubeAssComplete(jo);
//只有输送入的时候才调用MES
if (jsonTask.getString("task_type").equals("010402")) {
//调用MES接口通知MES运输中
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_delete ='0' AND status < '09'").getResultJSONArray(0);
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
JSONObject jo = new JSONObject();
jo.put("container_name", row.getString("container_name"));
jo.put("is_send", "1");
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'airSwellWithPaperTubeAssComplete'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) {
lmsToMesService.airSwellWithPaperTubeAssComplete(jo);
}
}
}
}

View File

@@ -45,10 +45,10 @@ public class InHotTask extends AbstractAcsTask {
String product_area = json.getString("product_area");
String agv_system_type = "";
if (product_area.equals("A1") || product_area.equals("A2")){
if (product_area.equals("A1") || product_area.equals("A2")) {
agv_system_type = "2";
}
if (product_area.equals("A3") || product_area.equals("A4")){
if (product_area.equals("A3") || product_area.equals("A4")) {
agv_system_type = "3";
}
@@ -63,10 +63,10 @@ public class InHotTask extends AbstractAcsTask {
.priority(json.getString("priority"))
.remark(json.getString("remark"))
.build();
if (StrUtil.isNotEmpty(json.getString("point_code3"))){
if (StrUtil.isNotEmpty(json.getString("point_code3"))) {
dto.setNext_device_code(json.getString("point_code3"));
dto.setPut_device_code(json.getString("point_code2"));
}else {
} else {
dto.setNext_device_code(json.getString("point_code2"));
}
@@ -91,7 +91,7 @@ public class InHotTask extends AbstractAcsTask {
if (StrUtil.equals(status, "0")) {
// 更新删除字段
jsonTask.put("is_delete","1");
jsonTask.put("is_delete", "1");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
@@ -202,7 +202,7 @@ public class InHotTask extends AbstractAcsTask {
//判断该接口是否需要回传
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollBakeInBound'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")){
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) {
new LmsToMesServiceImpl().momRollBakeInBound(param);
}
}
@@ -244,7 +244,7 @@ public class InHotTask extends AbstractAcsTask {
}
JSONObject json = new JSONObject();
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_type", "010201");
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("point_code1", form.getString("point_code1"));
@@ -255,17 +255,21 @@ public class InHotTask extends AbstractAcsTask {
json.put("sort_seq", "1");
json.put("handle_class", THIS_CLASS);
json.put("create_id", currentUserId);
json.put("material_code",form.getString("material_code"));
json.put("material_code", form.getString("material_code"));
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());
//根据类型获取对应的任务优先级
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(priority_jo)){
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(priority_jo)) {
json.put("priority", "1");
}else {
} else {
json.put("priority", priority_jo.getString("value"));
}
json.put("acs_task_type", "8");
if (StrUtil.isNotEmpty(form.getString("point_code3"))) {
json.put("acs_task_type", "8");
} else {
json.put("acs_task_type", "6");
}
tab.insert(json);
task_id = json.getString("task_id");
@@ -292,7 +296,7 @@ public class InHotTask extends AbstractAcsTask {
JSONObject json = new JSONObject();
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_type", "010203");
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("point_code1", form.getString("point_code1"));
@@ -305,10 +309,10 @@ public class InHotTask extends AbstractAcsTask {
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());
//根据类型获取对应的任务优先级
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(priority_jo)){
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0);
if (ObjectUtil.isEmpty(priority_jo)) {
json.put("priority", "1");
}else {
} else {
json.put("priority", priority_jo.getString("value"));
}
json.put("acs_task_type", "8");

View File

@@ -58,4 +58,6 @@ public interface RawAssistIStorService {
JSONObject autoDis(JSONObject whereJson);
JSONObject autoDisMove(JSONObject whereJson);
}

View File

@@ -1093,6 +1093,300 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
return struct_jo;
}
@Override
public JSONObject autoDisMove(JSONObject whereJson) {
/*
* 分配逻辑:
* 1、先查找该木箱内属于什么物料、订单定位到具体的块、排查看是否存在空位
* a、存在的话优先放在这一块这一排中(遍历)
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
* 1存在空巷道
* 2不存在则找一个双通有空位置、数量相近的巷道
* */
JSONObject struct_jo = new JSONObject();
String box_no = whereJson.getString("box_no");
String sect_id = whereJson.getString("sect_id");
String col_num = whereJson.getString("layer_num"); // 转库时用
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
String material_code = sub_jo.getString("product_name");
String sale_order_name = sub_jo.getString("sale_order_name");
HashMap<String, String> row_map = new HashMap<>();
row_map.put("material_code", material_code);
row_map.put("sale_order_name", sale_order_name);
row_map.put("col_num", col_num);
row_map.put("sect_id", sect_id);
row_map.put("flag", "11");
//查询到当前可用的巷道
JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
for (int i = 0; i < rowArr.size(); i++) {
JSONObject row_jo = rowArr.getJSONObject(i);
String block_num = row_jo.getString("block_num");
String row_num = row_jo.getString("row_num");
String placement_type = row_jo.getString("placement_type");
// 判断此排是否有除:入库锁、移入锁以外的锁
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock)) {
if (placement_type.equals("02")) {
// 左通
struct_jo = 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);
break;
} else if (placement_type.equals("03")) {
// 右通
struct_jo = 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);
break;
} else {
// 双通
// 先倒序找到第一个木箱、判断上一个是否有货位
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");
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 + "' order by out_order_seq ASC").uniqueResult(0);
} else {
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') 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);
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
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 + "' order by out_order_seq ASC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
struct_jo = jsonDescStruct;
break;
} 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 jsonAscStruct = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonAscBox)) {
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
// 上一个货位顺序号
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_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
} else {
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') 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);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
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_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
struct_jo = jsonAscStruct;
break;
} else {
// 说明这排有任务在执行,新开一排
//根据分切计划查询该订单物料大概还有多少未入
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("col_num", col_num).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);
break;
} 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);
break;
}
} else {
//如果查询不到空的一排,则查询有空位双通的一排
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
for (int j = 0; j < haveArr.size(); j++) {
JSONObject have_row = haveArr.getJSONObject(j);
String block_num3 = have_row.getString("block_num");
String row_num3 = have_row.getString("row_num");
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock2)) {
// 先倒序找到第一个木箱、判断上一个是否有货位
JSONObject jsonDescBox2 = 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);
JSONObject jsonDescStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
String out_order_seq = jsonDescBox2.getString("out_order_seq");
jsonDescStruct2 = 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,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
} else {
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') 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);
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
jsonDescStruct2 = 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,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
struct_jo = jsonDescStruct2;
break;
} else {
// 没有就正序找到第一个物料、判断上一个是否有货位
JSONObject jsonAscBox2 = 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 ASC").uniqueResult(0);
JSONObject jsonAscStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
// 上一个货位顺序号
jsonAscStruct2 = 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,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
} else {
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') 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 ASC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
jsonAscStruct2 = 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,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
struct_jo = jsonAscStruct2;
break;
}
}
} else {
continue;
}
}
}
}
}
}
} else {
continue;
}
}
if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) {
//如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则
//根据分切计划查询该订单物料大概还有多少未入
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("col_num", col_num).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_num = empty_row.getString("block_num");
String row_num = empty_row.getString("row_num");
String placement_type = 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_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "' 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_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
}
} else {
//如果查询不到空的一排,则查询有空位双通的一排
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
for (int j = 0; j < haveArr.size(); j++) {
JSONObject have_row = haveArr.getJSONObject(j);
String block_num3 = have_row.getString("block_num");
String row_num3 = have_row.getString("row_num");
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock2)) {
// 先倒序找到第一个木箱、判断上一个是否有货位
JSONObject jsonDescBox2 = 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);
JSONObject jsonDescStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
String out_order_seq = jsonDescBox2.getString("out_order_seq");
jsonDescStruct2 = 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,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
} else {
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') 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);
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
jsonDescStruct2 = 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,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
struct_jo = jsonDescStruct2;
break;
} else {
// 没有就正序找到第一个物料、判断上一个是否有货位
JSONObject jsonAscBox2 = 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 ASC").uniqueResult(0);
JSONObject jsonAscStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
// 上一个货位顺序号
jsonAscStruct2 = 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,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
} else {
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') 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 ASC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
jsonAscStruct2 = 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,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
struct_jo = jsonAscStruct2;
break;
}
}
} else {
continue;
}
}
}
}
if (ObjectUtil.isEmpty(struct_jo)) {
throw new BadRequestException("未查询到可用的仓位!");
}
return struct_jo;
}
public JSONObject queryEmpStruct(JSONObject whereJson) {
JSONObject struct_jo = new JSONObject();
String sect_id = whereJson.getString("sect_id");

View File

@@ -22,6 +22,7 @@
输入.stor_id TYPEAS s_string
输入.sap_pcsn TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.col_num TYPEAS s_string
输入.bill_status TYPEAS s_string
输入.bill_type TYPEAS s_string
输入.box_no TYPEAS s_string
@@ -452,6 +453,9 @@
ENDOPTION
OPTION 输入.sale_order_name <> ""
sub.sale_order_name = 输入.sale_order_name
ENDOPTION
OPTION 输入.col_num <> ""
sa2.layer_num = 输入.col_num
ENDOPTION
GROUP BY
sa2.block_num,sa2.row_num,sa2.placement_type
@@ -498,6 +502,11 @@
sa.is_delete = '0'
AND is_used = '1'
AND sa.sect_id = 输入.sect_id
OPTION 输入.col_num <> ""
sa.layer_num = 输入.col_num
ENDOPTION
GROUP BY
sa.block_num,
sa.row_num,
@@ -553,6 +562,10 @@
AND is_used = '1'
AND placement_type = '01'
AND sa.sect_id = 输入.sect_id
OPTION 输入.col_num <> ""
sa.layer_num = 输入.col_num
ENDOPTION
GROUP BY
sa.block_num,
sa.row_num,

View File

@@ -3396,12 +3396,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
public void createMove(JSONObject whereJson) {
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
JSONArray jsonAllBlockPoint = whereJson.getJSONArray("jsonAllBlockPoint");
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
JSONObject jsonAttr = attrTab.query("struct_code = '" + json.getString("struct_code") + "'").uniqueResult(0);
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "10");
@@ -3417,7 +3420,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject moveParam = new JSONObject();
moveParam.put("box_no", json.getString("storagevehicle_code"));
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
moveParam.put("layer_num", jsonAttr.getString("layer_num"));
JSONObject jsonMove = rawAssistIStorService.autoDisMove(moveParam);
// 查询移出货位的库存物料
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
.addParam("flag", "6")

View File

@@ -257,6 +257,8 @@
AND attr.out_order_seq > 输入.out_order_seq
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
ORDER BY out_order_seq DESC
ENDSELECT
ENDQUERY
ENDIF
@@ -274,6 +276,8 @@
AND attr.out_order_seq < 输入.out_order_seq
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
ORDER BY out_order_seq
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -113,33 +113,6 @@
</el-row>
<el-row>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="气涨轴">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input
v-model="query.qzzno"
clearable
size="mini"
placeholder="气涨轴编号"
style="width: 250px"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
</el-col>
<el-form-item label="日期">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
</el-row>
<el-row>
<el-col :span="6">
@@ -196,11 +169,57 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="是否呼叫">
<el-select
v-model="query.is_call"
clearable
placeholder="是否呼叫"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.IS_OR_NOT"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="气涨轴">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input
v-model="query.qzzno"
clearable
size="mini"
placeholder="气涨轴编号"
style="width: 250px"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="日期">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<rrOperation/>
</el-col>
</el-row>
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
@@ -438,6 +457,8 @@
<el-table-column prop="is_parent_ok" label="母卷上料完成" width="100px" :formatter="formatParentName"/>
<el-table-column prop="is_child_tz_ok" label="子卷套轴完成" width="100px" :formatter="formatChildName"/>
<el-table-column prop="is_child_ps_ok" label="子卷配送完成" width="100px" :formatter="formatChildPsName"/>
<el-table-column prop="is_child_ps_ok" label="子卷配送完成" width="100px" :formatter="formatChildPsName"/>
<el-table-column prop="is_call" label="是否呼叫" width="100px" :formatter="formatChildCallName"/>
<el-table-column prop="qzzno" label="气涨轴编码" width="100px"/>
<el-table-column prop="start_time" label="开始时间" width="150px"/>
<el-table-column prop="end_time" label="结束时间" width="150px"/>
@@ -628,6 +649,9 @@ export default {
},
formatChildPsName(row) {
return this.dict.label.IS_OR_NOT[row.is_child_ps_ok]
},
formatChildCallName(row) {
return this.dict.label.IS_OR_NOT[row.is_call]
}
}
}