This commit is contained in:
2023-08-14 16:13:21 +08:00
25 changed files with 545 additions and 103 deletions

View File

@@ -72,6 +72,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
int angle = 0; //角度 int angle = 0; //角度
int electric_qty = 0; //电量 int electric_qty = 0; //电量
int status = 0; //三色灯状态 int status = 0; //三色灯状态
int last_status = 0; //三色灯状态
int error = 0; int error = 0;
int last_error = 0; int last_error = 0;
String error_message = ""; String error_message = "";
@@ -442,6 +443,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
dto.setError_code(String.valueOf(error_code)); dto.setError_code(String.valueOf(error_code));
dto.setError_info(error_message); dto.setError_info(error_message);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", this.getError_message());
acsToWmsService.sendDeviceStatus(param);
} }
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
last_error = error; last_error = error;
@@ -460,6 +467,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (phase == 0x74) { } else if (phase == 0x74) {
//三色灯状态 //三色灯状态
status = ikey; status = ikey;
if (status != last_status) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", status);
acsToWmsService.sendDeviceStatus(param);
}
last_status = status;
} }
if (!ObjectUtil.isEmpty(data)) { if (!ObjectUtil.isEmpty(data)) {
phase = 0; phase = 0;

View File

@@ -80,6 +80,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
int angle = 0; //角度 int angle = 0; //角度
int electric_qty = 0; //电量 int electric_qty = 0; //电量
int status = 0; //三色灯状态 int status = 0; //三色灯状态
int last_status = 0; //三色灯状态
String error_message = ""; String error_message = "";
String error_type = "agv_error_type"; String error_type = "agv_error_type";
private Instruction instruction; private Instruction instruction;
@@ -685,6 +686,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
dto.setError_code(String.valueOf(error_code)); dto.setError_code(String.valueOf(error_code));
dto.setError_info(error_message); dto.setError_info(error_message);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", this.getError_message());
acsToWmsService.sendDeviceStatus(param);
} }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
last_error = error; last_error = error;
@@ -703,6 +710,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (phase == 0x74) { } else if (phase == 0x74) {
//三色灯状态 //三色灯状态
status = ikey; status = ikey;
if (status != last_status) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", status);
acsToWmsService.sendDeviceStatus(param);
}
last_status = status;
} }
//进入区域phase值 //进入区域phase值
else if (phase == 0x50) { else if (phase == 0x50) {

View File

@@ -76,6 +76,7 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
String task_id = ""; String task_id = "";
Boolean iserror = false; Boolean iserror = false;
Boolean last_iserror = false;
Boolean hasGoods = false; Boolean hasGoods = false;
@Override @Override
@@ -115,4 +116,15 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
jo.put("hasGoods", this.getHasGoods()); jo.put("hasGoods", this.getHasGoods());
return jo; return jo;
} }
public void setIserror(Boolean iserror) {
this.iserror = iserror;
if (this.iserror != this.last_iserror && this.iserror && device_id.startsWith("RGV")) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_id);
param.put("error", alarm);
param.put("error_msg", ErrorUtil.getDictDetail("ssx_error_type", alarm));
acsToWmsService.sendDeviceStatus(param);
}
this.last_iserror = iserror;
}
} }

View File

@@ -177,6 +177,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task); logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
} }
if (mode != last_mode) { if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
if (mode == 2) { if (mode == 2) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号复位前requireSuccess" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "信号复位前requireSuccess" + requireSucess);
this.setRequireSucess(false); this.setRequireSucess(false);
@@ -208,8 +213,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
DeviceErrorLogDto dto = new DeviceErrorLogDto(); DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code); dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error)); dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error))); String errorInfo = ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
} }
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -228,6 +228,14 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = false; requireSucess = false;
requireEmptyInSuccess = false; requireEmptyInSuccess = false;
} }
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
@@ -258,8 +266,17 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
DeviceErrorLogDto dto = new DeviceErrorLogDto(); DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code); dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error)); dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error))); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
}
} }
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
@@ -280,19 +297,25 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
} }
if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) { try{
if (ObjectUtil.equal(this.getDevice().getExtraValue().get("noIdleRequest"), "true")) { if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) {
if (!requiresShipDeviceUpdate && move == 0) { if (ObjectUtil.equal(this.getDevice().getExtraValue().get("noIdleRequest"), "true")) {
this.shipDeviceUpdate(); if (!requiresShipDeviceUpdate && move == 0) {
} this.shipDeviceUpdate();
} else { }
if (mode == 2 && !requiresShipDeviceUpdate && move == 0) { } else {
this.shipDeviceUpdate(); if (mode == 2 && !requiresShipDeviceUpdate && move == 0) {
this.shipDeviceUpdate();
}
} }
} }
} catch (Exception e){
e.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "反馈LMS光电信号变化时出现异常:" + e.getMessage());
} }
if (mode == 0) { if (mode == 0) {
this.setIsonline(false); this.setIsonline(false);
message = "未联机"; message = "未联机";
@@ -577,6 +600,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
this.checkcontrol(itemMap); this.checkcontrol(itemMap);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
try{
this.checkcontrol(itemMap);
} catch (Exception e1){
e1.printStackTrace();
}
} }
} }

View File

@@ -187,6 +187,12 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
requireEmptyOutSuccess = false; requireEmptyOutSuccess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记"); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
} }
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
@@ -216,8 +222,15 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceErrorLogDto dto = new DeviceErrorLogDto(); DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code); dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error)); dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error))); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
} }
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -170,6 +170,12 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
requireEmptyOutSuccess = false; requireEmptyOutSuccess = false;
logServer.deviceExecuteLog(this.device_code, "", "", "复位请求标记成功!"); logServer.deviceExecuteLog(this.device_code, "", "", "复位请求标记成功!");
} }
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
@@ -194,8 +200,15 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
DeviceErrorLogDto dto = new DeviceErrorLogDto(); DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code); dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error)); dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error))); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
} }
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog( logServer.deviceExecuteLog(

View File

@@ -161,6 +161,12 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
to_command = this.itemProtocol.getTo_command(); to_command = this.itemProtocol.getTo_command();
to_target = this.itemProtocol.getTo_target(); to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task(); to_task = this.itemProtocol.getTo_task();
if (last_mode != mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
}
if (to_command != last_to_command) { if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command); logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
} }
@@ -175,8 +181,15 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
DeviceErrorLogDto dto = new DeviceErrorLogDto(); DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code); dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error)); dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error))); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
} }
} }
} catch (Exception var17) { } catch (Exception var17) {

View File

@@ -230,6 +230,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
// logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat" + last_heartbeat + "->" + heartbeat); // logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat" + last_heartbeat + "->" + heartbeat);
// } // }
if (mode != last_mode) { if (mode != last_mode) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("mode", mode);
acsToWmsService.sendDeviceStatus(param);
inst_type = null; inst_type = null;
cache_inst = null; cache_inst = null;
if (mode == 2) { if (mode == 2) {
@@ -252,8 +257,15 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceErrorLogDto dto = new DeviceErrorLogDto(); DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code); dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error)); dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(error))); String errorInfo = ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(error));
dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
acsToWmsService.sendDeviceStatus(param);
} }
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -61,28 +61,60 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
int i = 0; int i = 0;
while(true) { while(true) {
//下发信号 //下发信号
control( itemValues); try{
Map<String, Object> read = new HashMap(); if(i == 0){
Map<Item, ItemState> itemStatus = group.read(true, (Item[])readitems.values().toArray(new Item[0])); control( itemValues);
Set<Item> items = itemStatus.keySet(); } else {
Iterator var15 = items.iterator(); controlByNewConn( itemValues);
while(var15.hasNext()) {
Item item = (Item)var15.next();
ItemState itemState = (ItemState)itemStatus.get(item);
Object value = OpcUtl.getValue(item, itemState);
read.put(item.getId(), value);
}
boolean check = true;
Iterator var24 = itemsString.iterator();
while(var24.hasNext()) {
String itemString = (String)var24.next();
if (!ObjectUtl.isEquals(itemValues.get(itemString), JsonUtl.parse(read.get(itemString)))) {
check = false;
} }
} catch (Exception e){
e.printStackTrace();
} }
Map<String, Object> read = new HashMap();
Map<Item, ItemState> itemStatus = null;
boolean check = true;
try{
if(i>0){
group = opcServerService.getServer(this.getOpcServer());
itemsString = new ArrayList<> (itemValues.keySet());
Iterator nis = itemsString.iterator();
while (nis.hasNext()) {
String string = (String) nis.next();
try {
readitems.put(string, group.addItem(string));
} catch (Exception e) {
e.printStackTrace();
}
}
itemStatus = group.read(true, (Item[])readitems.values().toArray(new Item[0]));
} else {
itemStatus = group.read(true, (Item[])readitems.values().toArray(new Item[0]));
}
Set<Item> items = itemStatus.keySet();
Iterator var15 = items.iterator();
while(var15.hasNext()) {
Item item = (Item)var15.next();
ItemState itemState = (ItemState)itemStatus.get(item);
Object value = OpcUtl.getValue(item, itemState);
read.put(item.getId(), value);
}
Iterator var24 = itemsString.iterator();
while(var24.hasNext()) {
String itemString = (String)var24.next();
if (!ObjectUtl.isEquals(itemValues.get(itemString), JsonUtl.parse(read.get(itemString)))) {
check = false;
}
}
} catch (Exception e){
e.printStackTrace();
check = false;
}
if (check) { if (check) {
return; return;
} }
@@ -92,6 +124,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
} }
if (i > 3) { if (i > 3) {
log.info("写入次数超过3次而失败");
throw new WDKException("写入次数超过3次而失败"); throw new WDKException("写入次数超过3次而失败");
} }
++i; ++i;
@@ -119,6 +152,24 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
return this.control(p2); return this.control(p2);
} }
public boolean controlByNewConn(Map<String, Object> itemValues) {
Iterator<Map.Entry<String, Object>> it = itemValues.entrySet().iterator();
ItemValue p2[];
p2 = new ItemValue[itemValues.size()];
int i=0;
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
System.out.println("即将写入值:"+entry.getKey() + ":" + entry.getValue());
p2[i] = new ItemValue();
p2[i].setItem_code(entry.getKey());
p2[i].setItem_value(entry.getValue());
i++;
}
return this.controlByNewConn(p2);
}
public boolean control(ItemValue[] itemValues) { public boolean control(ItemValue[] itemValues) {
@@ -129,23 +180,22 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
ItemValue[] var5 = itemValues; ItemValue[] var5 = itemValues;
int var6 = itemValues.length; int var6 = itemValues.length;
for (int var7 = 0; var7 < var6; ++var7) { // for (int var7 = 0; var7 < var6; ++var7) {
ItemValue itemValue = var5[var7]; // ItemValue itemValue = var5[var7];
String code = itemValue.getItem_code(); // String code = itemValue.getItem_code();
Object udw_value = this.getUdwValue(code); // Object udw_value = this.getUdwValue(code);
Object write_value = itemValue.getItem_value(); // Object write_value = itemValue.getItem_value();
sb.append(code); // sb.append(code);
sb.append(":"); // sb.append(":");
sb.append(JsonUtl.parseWithoutException(udw_value)); // sb.append(JsonUtl.parseWithoutException(udw_value));
sb.append(";"); // sb.append(";");
if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) { // if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
need_write = true; // need_write = true;
} else { // } else {
log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value ); // log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
} // }
} // }
//need_write = true; need_write = true;
if (need_write) { if (need_write) {
Date date = new Date(); Date date = new Date();
/*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) { /*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) {
@@ -162,6 +212,67 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
opcServerService.writeInteger(this.getOpcServer(), itemValues); opcServerService.writeInteger(this.getOpcServer(), itemValues);
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
ItemValue[] var17 = itemValues;
int var18 = itemValues.length;
for (int var19 = 0; var19 < var18; ++var19) {
ItemValue itemValue = var17[var19];
String code = itemValue.getItem_code();
Object value = itemValue.getItem_value();
opcValueAccessor.setValue(code, value);
}
}
return true;
} else {
throw new WDKException("下发 无内容");
}
}
public boolean controlByNewConn(ItemValue[] itemValues) {
if (itemValues != null && itemValues.length != 0) {
String this_items = JsonUtl.parseWithoutException(itemValues);
boolean need_write = false;
StringBuilder sb = new StringBuilder();
ItemValue[] var5 = itemValues;
int var6 = itemValues.length;
// for (int var7 = 0; var7 < var6; ++var7) {
// ItemValue itemValue = var5[var7];
// String code = itemValue.getItem_code();
// Object udw_value = this.getUdwValue(code);
// Object write_value = itemValue.getItem_value();
// sb.append(code);
// sb.append(":");
// sb.append(JsonUtl.parseWithoutException(udw_value));
// sb.append(";");
// if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
// need_write = true;
// } else {
// log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
// }
// }
need_write = true;
if (need_write) {
Date date = new Date();
/*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) {
log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check);
return false;
}*/
this.last_items = this_items;
this.sendTime = date;
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
opcServerService.writeIntegerByNewConn(this.getOpcServer(), itemValues);
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
ItemValue[] var17 = itemValues; ItemValue[] var17 = itemValues;
int var18 = itemValues.length; int var18 = itemValues.length;

View File

@@ -104,4 +104,6 @@ public interface AcsToWmsService {
// 输送线有货变成无货时向lms请求 // 输送线有货变成无货时向lms请求
HttpResponse shipDeviceUpdate(JSONObject param); HttpResponse shipDeviceUpdate(JSONObject param);
void sendDeviceStatus(JSONObject param);
} }

View File

@@ -538,4 +538,28 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
return null; return null;
} }
@Override
public void sendDeviceStatus(JSONObject param) {
try {
MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("sendDeviceStatus");
String methods_url = addressDto.getMethods_url();
String url = wmsUrl + methods_url;
// log.info("sendDeviceStatus - 请求参数 {}", param);
// HttpRequest
// .post(url)
// .body(param.toString())
// .execute();
// log.info("sendDeviceStatus - 返回参数 {}", response.body());
}
} catch (Throwable ignored) {
} finally {
MDC.remove(log_file_type);
}
}
} }

View File

@@ -33,8 +33,6 @@ public class DeviceExecuteLogServiceImpl implements DeviceExecuteLogService {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
MDC.remove("device_code_log"); MDC.remove("device_code_log");
System.out.println("successNum:" + OpcUtl.successNum);
System.out.println("errNum:" + OpcUtl.errNum);
} }
} }

View File

@@ -15,7 +15,11 @@ public interface OpcServerService {
Group getServer(String var1); Group getServer(String var1);
Group getServerByNewConn(String var1);
void writeInteger(String var1, ItemValue... var2); void writeInteger(String var1, ItemValue... var2);
void writeIntegerByNewConn(String var1, ItemValue... var2);
void clearServer(String var1); void clearServer(String var1);
} }

View File

@@ -109,6 +109,11 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
throw new RuntimeException(code+"不存在"); throw new RuntimeException(code+"不存在");
} }
// if (server!=null){
// server.disconnect();
// server=null;
// }
if (server == null) { if (server == null) {
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); } server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); }
@@ -134,6 +139,45 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
} }
} }
public Group getServerByNewConn(String code) {
synchronized(this.buildLock(code)) {
Server server = (Server)this.servers.get(code);
if (server!=null){
this.clearServer(code);
}
OpcServerManageDto dto = (OpcServerManageDto)this.opcServerManageDtos.get(code);
if (dto == null) {
throw new RuntimeException(code+"不存在");
}
// if (server == null) {
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain()));
// }
String groupName = code;
Group group = null;
try {
group = server.addGroup(groupName);
} catch (Exception var12) {
this.clearServer(code);
ThreadUtl.sleep(2000L);
log.warn("获取opc出错重新获取", code, var12);
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain()));
try {
group = server.addGroup(groupName);
} catch (Exception var11) {
throw new RuntimeException(var12);
}
}
this.servers.put(code, server);
this.groups.put(code, group);
return group;
}
}
public void clearServer(String code) { public void clearServer(String code) {
synchronized(this.buildLock(code)) { synchronized(this.buildLock(code)) {
try { try {
@@ -154,7 +198,19 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
} catch (Exception var4) { } catch (Exception var4) {
this.clearServer(code); this.clearServer(code);
log.info("写入出错opc server {} 重新加载", code, var4); log.info("写入出错opc server {} 重新加载", code, var4);
ThreadUtl.sleep(5000L); ThreadUtl.sleep(1000L);
throw var4;
}
}
public void writeIntegerByNewConn(String code, ItemValue... values) {
try {
Group group = this.getServerByNewConn(code);
OpcUtl.writeValue(group, values);
} catch (Exception var4) {
this.clearServer(code);
log.info("写入出错opc server {} 重新加载", code, var4);
ThreadUtl.sleep(1000L);
throw var4; throw var4;
} }
} }

View File

@@ -20,8 +20,6 @@ import java.util.concurrent.Executors;
public class OpcUtl { public class OpcUtl {
private static int timeout = 1*60*1000; private static int timeout = 1*60*1000;
private static String key = "rpc.socketTimeout"; private static String key = "rpc.socketTimeout";
public static int successNum=0;
public static int errNum=0;
static { static {
checkTimeout(); checkTimeout();
@@ -37,18 +35,7 @@ public class OpcUtl {
public static void writeValue(Group group, WriteRequest... requests) throws WDKException { public static void writeValue(Group group, WriteRequest... requests) throws WDKException {
try { try {
Map<Item, Integer> e=null; Map<Item, Integer> e=group.write(requests);
try{
e=group.write(requests);
group.write(requests);
}catch (Exception e1){
try{
e= group.write(requests);
}catch (Exception e2){
e= group.write(requests);
}
}
boolean is_success = true; boolean is_success = true;
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
Iterator arg4 = e.keySet().iterator(); Iterator arg4 = e.keySet().iterator();
@@ -69,16 +56,12 @@ public class OpcUtl {
} }
if (!is_success) { if (!is_success) {
// throw new BusinessException(message.toString());
System.out.println("下发信号失败:"+message.toString());
System.out.println("下发信号失败原因:"+message.toString());
log.info("下发信号失败:"+message.toString()); log.info("下发信号失败:"+message.toString());
throw new WDKException(message.toString()); throw new WDKException(message.toString());
} }
} catch (JIException arg7) { } catch (JIException arg7) {
log.info("下发信号失败:"+arg7.getMessage()); log.info("下发信号失败Exception"+arg7.getMessage());
System.out.println("下发信号失败原因:"+arg7.getMessage()); throw new WDKException("下发信号失败Exception:"+arg7);
throw new WDKException(arg7);
} }
} }
@@ -221,16 +204,10 @@ public class OpcUtl {
server = new Server(getConnection(host, clsid, user, password, domain), server = new Server(getConnection(host, clsid, user, password, domain),
Executors.newSingleThreadScheduledExecutor()); Executors.newSingleThreadScheduledExecutor());
server.connect(); server.connect();
successNum++;
return server; return server;
} catch (Exception e) { } catch (Exception e) {
errNum++;
// e.printStackTrace();
System.out.println("server error:"+e.getMessage()); System.out.println("server error:"+e.getMessage());
throw new WDKException(e.getMessage()); throw new WDKException(e.getMessage());
}finally{
System.out.println("successNum:"+successNum);
System.out.println("errNum:"+errNum);
} }
} }

View File

@@ -2,7 +2,7 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: prod active: dev
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:

View File

@@ -147,6 +147,11 @@
<el-switch v-model="form.special_flag" /> <el-switch v-model="form.special_flag" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="反馈设备状态" label-width="150px">
<el-switch v-model="form.sendDeviceStatus" />
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
@@ -320,7 +325,8 @@ export default {
is_release: true, is_release: true,
link_device_code: [], link_device_code: [],
ship_device_update: true, ship_device_update: true,
special_flag: true special_flag: true,
sendDeviceStatus: true
}, },
rules: {} rules: {}
} }

View File

@@ -21,9 +21,12 @@ import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.st.inbill.service.OutChargeService; import org.nl.wms.st.inbill.service.OutChargeService;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author Liuxy * @author Liuxy
@@ -73,10 +76,12 @@ public class OutChargeServiceImpl implements OutChargeService {
} }
@Override @Override
@Transactional
public void charge(Map whereJson) { public void charge(Map whereJson) {
WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl"); WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
WQLObject mst_wql = WQLObject.getWQLObject("ST_IVT_IOStorInv"); WQLObject mst_wql = WQLObject.getWQLObject("ST_IVT_IOStorInv");
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
WQLObject ivtTab = WQLObject.getWQLObject("st_ivt_structivt");
String currentUserId = SecurityUtils.getCurrentUserId(); String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName(); String nickName = SecurityUtils.getCurrentNickName();
@@ -128,10 +133,19 @@ public class OutChargeServiceImpl implements OutChargeService {
whereJson.put("upload_sap", ""); whereJson.put("upload_sap", "");
mst_wql.insert(whereJson); mst_wql.insert(whereJson);
ArrayList<String> ivtList = new ArrayList<>(); // 存在库存的集合
for (int i = 0; i < dis_rows.size(); i++) { for (int i = 0; i < dis_rows.size(); i++) {
//插入明细表 //插入明细表
String iostorinvdtl_id = IdUtil.getSnowflake(1, 1).nextId() + ""; String iostorinvdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject dis_row = dis_rows.getJSONObject(i); JSONObject dis_row = dis_rows.getJSONObject(i);
// 校验是否存在库存
JSONObject jsonIvt = ivtTab.query("pcsn = '" + dis_row.getString("pcsn") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonIvt)) {
ivtList.add(jsonIvt.getString("pcsn"));
}
//查询对应的出库单明细 //查询对应的出库单明细
JSONObject dtl_row = dtl_wql.query("iostorinvdtl_id = '" + dis_row.getString("iostorinvdtl_id") + "'").uniqueResult(0); JSONObject dtl_row = dtl_wql.query("iostorinvdtl_id = '" + dis_row.getString("iostorinvdtl_id") + "'").uniqueResult(0);
dis_row.put("iostorinvdtl_id", iostorinvdtl_id); dis_row.put("iostorinvdtl_id", iostorinvdtl_id);
@@ -174,6 +188,13 @@ public class OutChargeServiceImpl implements OutChargeService {
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "'"); WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "'");
} }
} }
// 判断是否存在库存
if (ivtList.size() > 0) {
String msg = String.join(",", ivtList);
throw new BadRequestException("此子卷已存在库存:"+msg);
}
} }
} }

View File

@@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* PC端出入库新增 * PC端出入库新增
@@ -64,7 +65,27 @@ public class CheckServiceImpl implements CheckService {
JSONObject jo = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "check_code desc"); JSONObject jo = WQL.getWO("QST_IVT_CHECK").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "check_code desc");
JSONArray content = jo.getJSONArray("content"); JSONArray content = jo.getJSONArray("content");
// 拼接主表id
String check_id = content.stream()
.map(row -> (JSONObject) row)
.map(row -> row.getString("check_id"))
.collect(Collectors.joining(","));
JSONArray resultJSONArray = WQL.getWO("QST_IVT_CHECK").addParam("flag", "13").addParam("check_id_in", "(" + check_id + ")").process().getResultJSONArray(0);
for (int i = 0; i < content.size(); i++) { for (int i = 0; i < content.size(); i++) {
JSONObject json = content.getJSONObject(i);
// 匹配相同check_id的数据条数
int pcsn_num = (int) resultJSONArray.stream()
.map(row -> (JSONObject) row)
.filter(row -> row.getString("check_id").equals(json.getString("check_id")))
.count();
json.put("pcsn_num",pcsn_num);
}
/* for (int i = 0; i < content.size(); i++) {
int pcsn_num = 0; int pcsn_num = 0;
JSONObject jsonObject = content.getJSONObject(i); JSONObject jsonObject = content.getJSONObject(i);
@@ -77,7 +98,7 @@ public class CheckServiceImpl implements CheckService {
pcsn_num += boxNum.size(); pcsn_num += boxNum.size();
} }
jsonObject.put("pcsn_num",pcsn_num); jsonObject.put("pcsn_num",pcsn_num);
} }*/
return jo; return jo;
} }

View File

@@ -42,6 +42,7 @@
输入.box_no TYPEAS s_string 输入.box_no TYPEAS s_string
输入.deptIds TYPEAS f_string 输入.deptIds TYPEAS f_string
输入.in_stor_id TYPEAS f_string 输入.in_stor_id TYPEAS f_string
输入.check_id_in TYPEAS f_string
[临时表] [临时表]
--这边列出来的临时表就会在运行期动态创建 --这边列出来的临时表就会在运行期动态创建
@@ -567,3 +568,22 @@
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY
ENDIF ENDIF
IF 输入.flag = "13"
QUERY
SELECT
sub.*,
dtl.check_id
FROM
pdm_bi_subpackagerelation sub
LEFT JOIN st_ivt_checkdtl dtl ON sub.package_box_sn = dtl.storagevehicle_code
WHERE
1 = 1
OPTION 输入.check_id_in <> ""
dtl.check_id in 输入.check_id_in
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -5014,7 +5014,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
order_no = jsonSub.getString("sale_order_name"); order_no = jsonSub.getString("sale_order_name");
// 规格: 厚度*幅宽 // 规格: 厚度*幅宽
String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width"); String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width_standard");
// 箱号 // 箱号
String box_no = json.getString("box_no"); String box_no = json.getString("box_no");
String sub_box_no = ""; String sub_box_no = "";
@@ -5073,7 +5073,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
order_no = jsonSub.getString("sale_order_name"); order_no = jsonSub.getString("sale_order_name");
// 规格: 厚度*幅宽 // 规格: 厚度*幅宽
String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width"); String material_spec = jsonSub.getString("thickness_request") + "*" + jsonSub.getString("width_standard");
// 箱号 // 箱号
String box_no = json.getString("box_no"); String box_no = json.getString("box_no");
String sub_box_no = ""; String sub_box_no = "";

View File

@@ -553,22 +553,24 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
// 调拨入库 // 调拨入库
if (StrUtil.equals(bill_type, "0004")) { if (StrUtil.equals(bill_type, "0004")) {
// 回传sap // 回传sap
JSONObject param = new JSONObject();
JSONArray paramSapMstArr = new JSONArray(); JSONArray paramSapMstArr = new JSONArray();
JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0); JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
JSONObject jsonDtl = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").uniqueResult(0); JSONObject jsonDtl = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").uniqueResult(0);
param.put("ZDBSQD",jsonDtl.getString("vbeln"));
param.put("LGORT2", jo_mst.getString("stor_code"));
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
param.put("LGORT1", jsonStorOut.getString("stor_code"));
for (int j = 0; j < disArr.size(); j++) { for (int j = 0; j < disArr.size(); j++) {
JSONObject jsonDis = disArr.getJSONObject(j); JSONObject jsonDis = disArr.getJSONObject(j);
JSONObject paramDis = new JSONObject(); JSONObject paramDis = new JSONObject();
paramDis.put("ZDBSQD", jsonDtl.getString("vbeln"));
paramDis.put("ZVBELN", jsonDtl.getString("source_bill_code")); paramDis.put("ZVBELN", jsonDtl.getString("source_bill_code"));
JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0); JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0);
paramDis.put("MATNR", jsonMater.getString("material_code")); paramDis.put("MATNR", jsonMater.getString("material_code"));
paramDis.put("LGORT2", jo_mst.getString("stor_code"));
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
paramDis.put("LGORT1", jsonStorOut.getString("stor_code"));
JSONObject jsonSub = subTab.query("container_name = '" + jsonDis.getString("pcsn") + "'").uniqueResult(0); JSONObject jsonSub = subTab.query("container_name = '" + jsonDis.getString("pcsn") + "'").uniqueResult(0);
paramDis.put("ZHL02", jsonSub.getString("width")); paramDis.put("ZHL02", jsonSub.getString("width"));
@@ -578,8 +580,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
paramDis.put("WERKS", "2460"); paramDis.put("WERKS", "2460");
paramSapMstArr.add(paramDis); paramSapMstArr.add(paramDis);
} }
JSONObject param = new JSONObject(); param.put("ITEM", paramSapMstArr);
param.put("HEAD", paramSapMstArr);
System.out.println(param.toString()); System.out.println(param.toString());
// 调用接口回传 // 调用接口回传
@@ -900,22 +901,24 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
// 调拨入库 // 调拨入库
if (StrUtil.equals(bill_type, "0004")) { if (StrUtil.equals(bill_type, "0004")) {
// 回传sap // 回传sap
JSONObject param = new JSONObject();
JSONArray paramSapMstArr = new JSONArray(); JSONArray paramSapMstArr = new JSONArray();
JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0); JSONArray disArr = wo_dis.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
JSONObject jsonDtl = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").uniqueResult(0); JSONObject jsonDtl = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").uniqueResult(0);
param.put("ZDBSQD",jsonDtl.getString("vbeln"));
param.put("LGORT2", jo_mst.getString("stor_code"));
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
param.put("LGORT1", jsonStorOut.getString("stor_code"));
for (int j = 0; j < disArr.size(); j++) { for (int j = 0; j < disArr.size(); j++) {
JSONObject jsonDis = disArr.getJSONObject(j); JSONObject jsonDis = disArr.getJSONObject(j);
JSONObject paramDis = new JSONObject(); JSONObject paramDis = new JSONObject();
paramDis.put("ZDBSQD", jsonDtl.getString("vbeln"));
paramDis.put("ZVBELN", jsonDtl.getString("source_bill_code")); paramDis.put("ZVBELN", jsonDtl.getString("source_bill_code"));
JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0); JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0);
paramDis.put("MATNR", jsonMater.getString("material_code")); paramDis.put("MATNR", jsonMater.getString("material_code"));
paramDis.put("LGORT2", jo_mst.getString("stor_code"));
JSONObject jsonStorOut = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '" + jo_mst.getString("out_stor_id") + "'").uniqueResult(0);
paramDis.put("LGORT1", jsonStorOut.getString("stor_code"));
JSONObject jsonSub = subTab.query("container_name = '" + jsonDis.getString("pcsn") + "'").uniqueResult(0); JSONObject jsonSub = subTab.query("container_name = '" + jsonDis.getString("pcsn") + "'").uniqueResult(0);
paramDis.put("ZHL02", jsonSub.getString("width")); paramDis.put("ZHL02", jsonSub.getString("width"));
@@ -925,8 +928,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
paramDis.put("WERKS", "2460"); paramDis.put("WERKS", "2460");
paramSapMstArr.add(paramDis); paramSapMstArr.add(paramDis);
} }
JSONObject param = new JSONObject(); param.put("ITEM", paramSapMstArr);
param.put("HEAD", paramSapMstArr);
System.out.println(param.toString()); System.out.println(param.toString());
// 调用接口回传 // 调用接口回传

View File

@@ -96,7 +96,23 @@
END AS confirm_time_class END AS confirm_time_class
FROM FROM
st_ivt_iostorinvdis dis (
SELECT
pcsn,
MAX(iostorinv_id) AS iostorinv_id,
MAX(sect_id) AS sect_id,
MAX(material_id) AS material_id,
MAX(box_no) AS box_no,
MAX(sect_name) AS sect_name,
MAX(struct_code) AS struct_code,
MAX(struct_name) AS struct_name,
MAX(qty_unit_name) AS qty_unit_name
FROM
st_ivt_iostorinvdis
WHERE
1 = 1
GROUP BY pcsn
) AS dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
@@ -194,7 +210,23 @@
END AS confirm_time_class END AS confirm_time_class
FROM FROM
st_ivt_iostorinvdis dis (
SELECT
pcsn,
MAX(iostorinv_id) AS iostorinv_id,
MAX(sect_id) AS sect_id,
MAX(material_id) AS material_id,
MAX(box_no) AS box_no,
MAX(sect_name) AS sect_name,
MAX(struct_code) AS struct_code,
MAX(struct_name) AS struct_name,
MAX(qty_unit_name) AS qty_unit_name
FROM
st_ivt_iostorinvdis
WHERE
1 = 1
GROUP BY pcsn
) AS dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
@@ -304,7 +336,23 @@
END AS confirm_time_class END AS confirm_time_class
FROM FROM
st_ivt_iostorinvdis dis (
SELECT
pcsn,
MAX(iostorinv_id) AS iostorinv_id,
MAX(sect_id) AS sect_id,
MAX(material_id) AS material_id,
MAX(box_no) AS box_no,
MAX(sect_name) AS sect_name,
MAX(struct_code) AS struct_code,
MAX(struct_name) AS struct_name,
MAX(qty_unit_name) AS qty_unit_name
FROM
st_ivt_iostorinvdis
WHERE
1 = 1
GROUP BY pcsn
) AS dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
@@ -404,7 +452,23 @@
END AS confirm_time_class END AS confirm_time_class
FROM FROM
st_ivt_iostorinvdis dis (
SELECT
pcsn,
MAX(iostorinv_id) AS iostorinv_id,
MAX(sect_id) AS sect_id,
MAX(material_id) AS material_id,
MAX(box_no) AS box_no,
MAX(sect_name) AS sect_name,
MAX(struct_code) AS struct_code,
MAX(struct_name) AS struct_name,
MAX(qty_unit_name) AS qty_unit_name
FROM
st_ivt_iostorinvdis
WHERE
1 = 1
GROUP BY pcsn
) AS dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id

View File

@@ -398,6 +398,7 @@
:min-width="flexWidth('product_description',crud.data,'产品描述')"/> :min-width="flexWidth('product_description',crud.data,'产品描述')"/>
<el-table-column sortable prop="sap_pcsn" label="sap批次" :min-width="flexWidth('sap_pcsn',crud.data,'SAP批次')"/> <el-table-column sortable prop="sap_pcsn" label="sap批次" :min-width="flexWidth('sap_pcsn',crud.data,'SAP批次')"/>
<el-table-column prop="width" label="产品规格(幅宽)" :min-width="flexWidth('width',crud.data,'产品规格(幅宽)')"/> <el-table-column prop="width" label="产品规格(幅宽)" :min-width="flexWidth('width',crud.data,'产品规格(幅宽)')"/>
<el-table-column prop="width_standard" label="客户要求幅宽" :min-width="flexWidth('width_standard',crud.data,'客户要求幅宽')"/>
<el-table-column prop="thickness" label="产品厚度" :min-width="flexWidth('thickness',crud.data,'产品厚度')"/> <el-table-column prop="thickness" label="产品厚度" :min-width="flexWidth('thickness',crud.data,'产品厚度')"/>
<el-table-column prop="mass_per_unit_area" label="单位面积质量" :formatter="crud.formatNum3" <el-table-column prop="mass_per_unit_area" label="单位面积质量" :formatter="crud.formatNum3"
:min-width="flexWidth('mass_per_unit_area',crud.data,'单位面积质量')"/> :min-width="flexWidth('mass_per_unit_area',crud.data,'单位面积质量')"/>