diff --git a/acs/produceshiftorderdetail.js b/acs/produceshiftorderdetail.js
new file mode 100644
index 0000000..3c60214
--- /dev/null
+++ b/acs/produceshiftorderdetail.js
@@ -0,0 +1,27 @@
+import request from '@/utils/request'
+
+export function add(data) {
+ return request({
+ url: 'api/produceshiftorderdetail',
+ method: 'post',
+ data
+ })
+}
+
+export function del(ids) {
+ return request({
+ url: 'api/produceshiftorderdetail/',
+ method: 'delete',
+ data: ids
+ })
+}
+
+export function edit(data) {
+ return request({
+ url: 'api/produceshiftorderdetail',
+ method: 'put',
+ data
+ })
+}
+
+export default { add, edit, del }
diff --git a/nladmin-system/pom.xml b/nladmin-system/pom.xml
index 5aba8f1..ff6d79b 100644
--- a/nladmin-system/pom.xml
+++ b/nladmin-system/pom.xml
@@ -19,6 +19,12 @@
7.6.1
+
+
+ e-iceblue
+ spire.xls
+ 3.11.2
+
net.logstash.logback
@@ -26,30 +32,25 @@
6.6
-
-
- e-iceblue
- spire.xls
- 3.11.2
-
+
org.mongodb
mongo-java-driver
3.4.2
-
+
@@ -70,14 +71,6 @@
spring-boot-starter-data-mongodb
-
-
- net.dreamlu
- mica-ip2region
- 2.5.6
-
-
-
org.openscada.utgard
org.openscada.opc.lib
@@ -270,6 +263,7 @@
exec-maven-plugin
1.6.0
+
@@ -310,25 +304,26 @@
-->
-
-
-
+
+
+
+ mvnrepository
+ mvnrepository
+ http://www.mvnrepository.com/
+ default
+
+ true
+
+
+ false
+
+
+
+
+ com.e-iceblue
+ http://repo.e-iceblue.cn/repository/maven-public/
+
+
diff --git a/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
index a05e764..617fa61 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java
@@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.config.server.AcsConfigService;
+import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.*;
import org.nl.acs.device.service.dto.*;
@@ -1170,14 +1171,14 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
//根据设备驱动定义获取OPC读写数据
DeviceDriverDefination deviceDriverDefination = deviceDriverDefinationAppService.getDeviceDriverDefination(driver_code);
+ OpcDeviceDriverDefination opcDeviceDriverDefination = null;
if (deviceDriverDefination instanceof OpcDeviceDriverDefination) {
- OpcDeviceDriverDefination opcDeviceDriverDefination = (OpcDeviceDriverDefination) deviceDriverDefination;
+ opcDeviceDriverDefination = (OpcDeviceDriverDefination) deviceDriverDefination;
//处理DB读和写属性
result.put("rs", opcDeviceDriverDefination.getReadableItemDtos());
result.put("ws", opcDeviceDriverDefination.getWriteableItemDtos());
}
-
JSONArray arr = WQLObject.getWQLObject("acs_device_extra").query("filed_type ='01' and device_id = '" + device_id + "'").getResultJSONArray(0);
for (int i = 0; i < arr.size(); i++) {
@@ -1194,7 +1195,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
result.put("form", extraObj);
- JSONObject json = (JSONObject) JSONObject.toJSON(dto);
+ JSONObject json = (JSONObject) JSONObject.toJSON(dto);
String opc_id = dto.getOpc_server_id();
@@ -1224,35 +1225,111 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
//设备扩展表【acs_device_extra】
JSONArray rs = WQLObject.getWQLObject("acs_device_extra").query("filed_type='02' and device_id = '" + device_id + "'", "order_seq").getResultJSONArray(0);
JSONArray r_arry = new JSONArray();
- for (int i = 0; i < rs.size(); i++) {
- JSONObject robj = new JSONObject();
- robj.put("code", rs.getJSONObject(i).getString("extra_code"));
- robj.put("name", rs.getJSONObject(i).getString("remark"));
- robj.put("db", rs.getJSONObject(i).getString("extra_name"));
- r_arry.add(robj);
- }
-
- JSONArray ws = WQLObject.getWQLObject("acs_device_extra").query("filed_type='03' and device_id = '" + device_id + "'", "order_seq").getResultJSONArray(0);
- JSONArray w_arry = new JSONArray();
- for (int i = 0; i < ws.size(); i++) {
- JSONObject robj = new JSONObject();
- robj.put("code", ws.getJSONObject(i).getString("extra_code"));
- robj.put("name", ws.getJSONObject(i).getString("remark"));
- robj.put("db", ws.getJSONObject(i).getString("extra_name"));
- w_arry.add(robj);
+ //先获取模板
+ if(ObjectUtil.isNotEmpty(opcDeviceDriverDefination)){
+ List readableItemDtos = opcDeviceDriverDefination.getReadableItemDtos();
+ List readableItemJsons = new ArrayList<>();
+ for (int i = 0; i < readableItemDtos.size(); i++) {
+ ItemDto itemDto = readableItemDtos.get(i);
+ JSONObject readableItemJson = new JSONObject();
+ readableItemJson.put("code",itemDto.getCode());
+ readableItemJson.put("name",itemDto.getName());
+ // readableItemJson.put("db",itemDto.getDb());
+ readableItemJsons.add(readableItemJson);
+ }
+ for (int i = 0; i < rs.size(); i++) {
+ JSONObject robj = new JSONObject();
+ String extra_code = rs.getJSONObject(i).getString("extra_code");
+ final String[] split = extra_code.split("\\.");
+ String code = split[split.length - 1];
+ robj.put("code", code);
+ robj.put("name", rs.getJSONObject(i).getString("remark"));
+ if (readableItemJsons.contains(robj)){
+ robj.put("code", rs.getJSONObject(i).getString("extra_code"));
+ robj.put("db", rs.getJSONObject(i).getString("extra_name"));
+ r_arry.add(robj);
+ }
+ }
+ List rarry = new ArrayList<>();
+ for (int i = 0; i < r_arry.size(); i++) {
+ JSONObject rJson = r_arry.getJSONObject(i);
+ String code = rJson.getString("code");
+ String[] split = code.split("\\.");
+ code = split[split.length - 1];
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("code", code);
+ jsonObject.put("name",rJson.getString("name"));
+ rarry.add(jsonObject);
+ }
+ for (int i = 0; i < readableItemDtos.size(); i++) {
+ ItemDto itemDto = readableItemDtos.get(i);
+ JSONObject readableItemJson = new JSONObject();
+ readableItemJson.put("code",itemDto.getCode());
+ readableItemJson.put("name",itemDto.getName());
+ if (!rarry.contains(readableItemJson)){
+ readableItemJson.put("db",itemDto.getDb());
+ r_arry.add(readableItemJson);
+ }
+ }
+ JSONArray ws = WQLObject.getWQLObject("acs_device_extra").query("filed_type='03' and device_id = '" + device_id + "'", "order_seq").getResultJSONArray(0);
+ JSONArray w_arry = new JSONArray();
+ List writeableItemDtos = opcDeviceDriverDefination.getWriteableItemDtos();
+ List writeableItemJsons = new ArrayList<>();
+ for (int i = 0; i < writeableItemDtos.size(); i++) {
+ ItemDto itemDto = writeableItemDtos.get(i);
+ JSONObject writeableItemJson = new JSONObject();
+ writeableItemJson.put("code",itemDto.getCode());
+ writeableItemJson.put("name",itemDto.getName());
+ //writeableItemJson.put("db",itemDto.getDb());
+ writeableItemJsons.add(writeableItemJson);
+ }
+ for (int i = 0; i < ws.size(); i++) {
+ String extra_code = ws.getJSONObject(i).getString("extra_code");
+ final String[] split = extra_code.split("\\.");
+ String code = split[split.length - 1];
+ JSONObject robj = new JSONObject();
+ robj.put("code", code);
+ robj.put("name", ws.getJSONObject(i).getString("remark"));
+ if (writeableItemJsons.contains(robj)){
+ robj.put("code", ws.getJSONObject(i).getString("extra_code"));
+ robj.put("db", ws.getJSONObject(i).getString("extra_name"));
+ w_arry.add(robj);
+ }
+ }
+ List warry = new ArrayList<>();
+ for (int i = 0; i < w_arry.size(); i++) {
+ JSONObject wJson = w_arry.getJSONObject(i);
+ String code = wJson.getString("code");
+ String[] split = code.split("\\.");
+ code = split[split.length - 1];
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("code",code);
+ jsonObject.put("name",wJson.getString("name"));
+ warry.add(jsonObject);
+ }
+ for (int i = 0; i < writeableItemDtos.size(); i++) {
+ ItemDto itemDto = writeableItemDtos.get(i);
+ JSONObject writeableItemJson = new JSONObject();
+ writeableItemJson.put("code",itemDto.getCode());
+ writeableItemJson.put("name",itemDto.getName());
+ if (!warry.contains(writeableItemJson)){
+ writeableItemJson.put("db",itemDto.getDb());
+ w_arry.add(writeableItemJson);
+ }
+ }
+ if (!r_arry.isEmpty()) {
+ result.put("rs", r_arry);
+ }
+ if (!w_arry.isEmpty()) {
+ result.put("ws", w_arry);
+ }
}
- if (!r_arry.isEmpty()) {
- result.put("rs", r_arry);
- }
- if (!w_arry.isEmpty()) {
- result.put("ws", w_arry);
- }
} else {
//处理DB读和写属性
- /* result.put("rs", ReadUtil.getReadableItemDtos());
- result.put("ws", ReadUtil.getWriteableItemDtos());*/
+// result.put("rs", ReadUtil.getReadableItemDtos());
+// result.put("ws", ReadUtil.getWriteableItemDtos());
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java
index dc638c6..6d66e89 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding/HaiLiangFeedingDeviceDriver.java
@@ -205,7 +205,7 @@ public class HaiLiangFeedingDeviceDriver extends AbstractOpcDeviceDriver impleme
// }
dto.setFeeding_finished(status);
String now = DateUtil.now();
- dto.setFeeding_finish_time(now);
+ dto.setFeeding_end_time(now);
produceshiftorderdetailService.update(dto);
writing(itemProtocol.item_to_command,String.valueOf(mode));
requireSucess = true;
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDefination.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDefination.java
index 92a93a7..7bdb281 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDefination.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDefination.java
@@ -64,7 +64,6 @@ public class HaiLiangFeedingTrunkDefination implements OpcDeviceDriverDefination
list.add(new ItemDto(ItemProtocol.item_last_order_detail, "上次完成工单明细号", "DB600.D14"));
list.add(new ItemDto(ItemProtocol.item_order_feeding_qty, "当前工单上料数量", "DB600.D18"));
list.add(new ItemDto(ItemProtocol.item_detail_feeding_qty, "当前工单明细号上料数量", "DB600.D22"));
- list.add(new ItemDto(ItemProtocol.item_detail_feeding_qualified_qty, "当前工单明细号上料合格数量", "DB600.D122"));
list.add(new ItemDto(ItemProtocol.item_detail_lettering_qty, "当前工单明细号刻字数量", "DB600.D26"));
list.add(new ItemDto(ItemProtocol.item_detail_lettering_qualified_qty, "当前工单明细号刻字合格数量", "DB600.D30"));
list.add(new ItemDto(ItemProtocol.item_detail_risking_qualified_qty, "当前工单明细号套冒合格数", "DB600.D34"));
@@ -72,7 +71,7 @@ public class HaiLiangFeedingTrunkDefination implements OpcDeviceDriverDefination
list.add(new ItemDto(ItemProtocol.item_detail_strapping_qty, "当前工单明细号捆扎包数", "DB600.D42"));
list.add(new ItemDto(ItemProtocol.item_detail_strapping_oneqty, "当前工单明细号捆扎根数", "DB600.D46"));
list.add(new ItemDto(ItemProtocol.item_detail_coating_qty, "当前工单明细号裹膜数", "DB600.D50"));
- list.add(new ItemDto(ItemProtocol.item_labeling_order, "当前贴标工单明细号", "DB600.D54"));
+ list.add(new ItemDto(ItemProtocol.item_labeling_order_detail, "当前贴标工单明细号", "DB600.D54"));
list.add(new ItemDto(ItemProtocol.item_detail_labeling_qualified_qty, "当前工单明细号刻字数量", "DB600.D58"));
list.add(new ItemDto(ItemProtocol.item_detail_labeling_qty, "当前贴标工单明细号贴标数", "DB600.D62"));
list.add(new ItemDto(ItemProtocol.item_ready, "设备就绪", "DB600.D66"));
@@ -89,6 +88,10 @@ public class HaiLiangFeedingTrunkDefination implements OpcDeviceDriverDefination
list.add(new ItemDto(ItemProtocol.item_lettering_frequency, "刻字频率", "DB600.D110"));
list.add(new ItemDto(ItemProtocol.item_one_speed, "捆扎裹膜贴标段输送速度", "DB600.REAL114"));
list.add(new ItemDto(ItemProtocol.item_coating_frequency, "裹膜机频率", "DB600.D118"));
+ list.add(new ItemDto(ItemProtocol.item_detail_feeding_qualified_qty, "当前工单明细号上料合格数量", "DB600.D122"));
+ list.add(new ItemDto(ItemProtocol.item_detail_coating_qualified_qty, "当前工单明细号裹膜合格数量", "DB600.D126"));
+ list.add(new ItemDto(ItemProtocol.item_strapping_order_detail, "捆扎工单明细号", "DB600.D130"));
+ list.add(new ItemDto(ItemProtocol.item_order_feeding_finish, "工单上料完成", "DB600.D134"));
return list;
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java
index 588a818..54fea88 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/HaiLiangFeedingTrunkDeviceDriver.java
@@ -67,7 +67,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int detail_strapping_qty = 0;
int detail_strapping_oneqty = 0;
int detail_coating_qty = 0;
- int labeling_order = 0;
+ int labeling_order_detail = 0;
int detail_labeling_qualified_qty = 0;
int detail_labeling_qty = 0;
Float line_speed = 0.0f;
@@ -81,6 +81,8 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int lettering_frequency = 0;
Float one_speed = 0.0f;
int coating_frequency = 0;
+ int strapping_order_detail =0;
+ int order_feeding_finish = 0;
int last_mode = 0;
int last_error = 0;
@@ -101,7 +103,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int last_detail_strapping_qty = 0;
int last_detail_strapping_oneqty = 0;
int last_detail_coating_qty = 0;
- int last_labeling_order = 0;
+ int last_labeling_order_detail = 0;
int last_detail_labeling_qualified_qty = 0;
int last_detail_labeling_qty = 0;
Float last_line_speed = 0.0f;
@@ -115,6 +117,8 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
int last_lettering_frequency = 0;
Float last_one_speed = 0.0f;
int last_coating_frequency = 0;
+ int last_strapping_order_detail =0;
+ int last_order_feeding_finish =0;
Boolean send_letter_flag_back = false;
Boolean send_letter_flag = false;
@@ -156,7 +160,9 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
//当前工单明细号裹膜数
detail_coating_qty =this.itemProtocol.getDetail_coating_qty();
//当前贴标工单明细号
- labeling_order = this.itemProtocol.getLabeling_order();
+ labeling_order_detail = this.itemProtocol.getLabeling_order_detail();
+ //捆扎明细
+ strapping_order_detail = this.itemProtocol.getStrapping_order_detail();
//当前贴标工单明细号贴标合格数
detail_labeling_qualified_qty = this.itemProtocol.getDetail_strapping_qty();
//当前贴标工单明细号贴标数
@@ -172,6 +178,9 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
lettering_frequency = this.itemProtocol.getLettering_frequency();
one_speed = this.itemProtocol.getOne_speed();
coating_frequency = this.itemProtocol.getCoating_frequency();
+ strapping_order_detail = this.itemProtocol.getStrapping_order_detail();
+ order_feeding_finish = this.itemProtocol.getOrder_feeding_finish();
+
if (mode != last_mode) {
this.setRequireSucess(false);
@@ -281,10 +290,10 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
logServer.deviceLogToacs(this.device_code,"","","信号detail_coating_qty:" + last_detail_coating_qty + "->" + detail_coating_qty);
}
- if(labeling_order != last_labeling_order)
+ if(labeling_order_detail != last_labeling_order_detail)
{
- logServer.deviceLog(this.device_code,"labeling_order" ,String.valueOf(labeling_order));
- logServer.deviceLogToacs(this.device_code,"","","信号labeling_order:" + last_labeling_order + "->" + labeling_order);
+ logServer.deviceLog(this.device_code,"labeling_order" ,String.valueOf(labeling_order_detail));
+ logServer.deviceLogToacs(this.device_code,"","","信号labeling_order:" + last_labeling_order_detail + "->" + labeling_order_detail);
}
if(detail_labeling_qualified_qty != last_detail_labeling_qualified_qty)
@@ -358,11 +367,36 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
logServer.deviceLog(this.device_code,"coating_frequency" ,String.valueOf(coating_frequency));
logServer.deviceLogToacs(this.device_code,"","","信号coating_frequency:" + last_coating_frequency + "->" + coating_frequency);
}
+ if(strapping_order_detail != last_strapping_order_detail)
+ {
+ logServer.deviceLog(this.device_code,"strapping_order_detail" ,String.valueOf(strapping_order_detail));
+ logServer.deviceLogToacs(this.device_code,"","","信号strapping_order_detail:" + last_strapping_order_detail+ "->" + strapping_order_detail);
+ }
+ if(order_feeding_finish != last_order_feeding_finish)
+ {
+ logServer.deviceLog(this.device_code,"order_feeding_finish" ,String.valueOf(order_feeding_finish));
+ logServer.deviceLogToacs(this.device_code,"","","信号order_feeding_finish:" + last_order_feeding_finish+ "->" + order_feeding_finish);
+ }
try{
if(order >0 && order_detail>0){
update_detail(String.valueOf(order),String.valueOf(order_detail));
}
+
+ //上料明细更新
+ if(order >0 && order_detail>0){
+ update_detail(String.valueOf(order),String.valueOf(order_detail));
+ }
+
+ //贴标明细更新
+ if(order >0 && labeling_order_detail>0){
+ update_labeling_detail(String.valueOf(order),String.valueOf(labeling_order_detail));
+ }
+
+ //捆扎明细更新
+ if(order >0 && strapping_order_detail>0){
+ update_strapping_detail(String.valueOf(order),String.valueOf(strapping_order_detail));
+ }
}
catch (Exception e){
@@ -389,7 +423,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
break;
case 2:
break;
- case 3:
+ case 4:
//申请工单
if(!requireSucess) {
if( ready == 1 && order ==0 && order_detail ==0 ){
@@ -403,7 +437,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
}
break;
- case 4:
+ case 5:
//申请工单明细
if(!requireSucess) {
if( ready == 1 && order != 0 ) {
@@ -435,7 +469,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
last_detail_strapping_qty = detail_strapping_qty;
last_detail_strapping_oneqty = detail_strapping_oneqty;
last_detail_coating_qty = detail_coating_qty;
- last_labeling_order = labeling_order;
+ last_labeling_order_detail = labeling_order_detail;
last_detail_labeling_qualified_qty = detail_labeling_qualified_qty;
last_detail_labeling_qty = detail_labeling_qty;
last_line_speed = line_speed;
@@ -451,6 +485,45 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
last_coating_frequency = coating_frequency;
}
+
+ public synchronized boolean update_strapping_detail(String order, String order_detail) throws Exception {
+ Date date = new Date();
+ if (date.getTime() - this.detail_time_out < (long) this.detail_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.detail_time_out);
+ return false;
+ } else {
+ this.detail_time= date;
+
+ ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order),String.valueOf(order_detail));
+ if(ObjectUtil.isEmpty(dto)){
+ return false;
+ }
+ dto.setPresent_labeling_number(String.valueOf(detail_labeling_qty));
+ dto.setQualified_lettering_number(String.valueOf(detail_labeling_qualified_qty));
+ produceshiftorderdetailService.update(dto);
+ return true;
+ }
+ }
+
+ public synchronized boolean update_labeling_detail(String order, String order_detail) throws Exception {
+ Date date = new Date();
+ if (date.getTime() - this.detail_time_out < (long) this.detail_time_out) {
+ log.trace("触发时间因为小于{}毫秒,而被无视", this.detail_time_out);
+ return false;
+ } else {
+ this.detail_time= date;
+
+ ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order),String.valueOf(order_detail));
+ if(ObjectUtil.isEmpty(dto)){
+ return false;
+ }
+ dto.setPresent_labeling_number(String.valueOf(detail_labeling_qty));
+ dto.setQualified_lettering_number(String.valueOf(detail_labeling_qualified_qty));
+ produceshiftorderdetailService.update(dto);
+ return true;
+ }
+ }
+
public synchronized boolean update_detail(String order, String order_detail) throws Exception {
Date date = new Date();
if (date.getTime() - this.detail_time_out < (long) this.detail_time_out) {
@@ -458,6 +531,7 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
return false;
} else {
this.detail_time= date;
+
ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order),String.valueOf(order_detail));
if(ObjectUtil.isEmpty(dto)){
return false;
@@ -474,14 +548,14 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
dto.setPresent_sleeveing_number(String.valueOf(detail_risking_qty));
//当前工单明细号套冒合格数
dto.setQualified_sleeveing_number(String.valueOf(detail_risking_qualified_qty));
- //当前捆扎包数
- dto.setPresent_strap_pack_number(String.valueOf(detail_strapping_qty));
- //当前捆扎数
- dto.setPresent_strap_number(String.valueOf(detail_strapping_oneqty));
- //当前工单明细号裹膜数
- dto.setPresent_wraping_number(String.valueOf(detail_coating_qty));
-
produceshiftorderdetailService.update(dto);
+
+// //当前捆扎包数
+// dto.setPresent_strap_pack_number(String.valueOf(detail_strapping_qty));
+// //当前捆扎数
+// dto.setPresent_strap_number(String.valueOf(detail_strapping_oneqty));
+// //当前工单明细号裹膜数
+// dto.setPresent_wraping_number(String.valueOf(detail_coating_qty));
return true;
}
}
@@ -537,36 +611,23 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
throw new BadRequestException("未找到可下发工单!");
}
String order = dto.getOrder_code();
- //是否刻字
- String is_lettering = dto.getIs_lettering();
- //是否套冒
- String is_risking = dto.getIs_risking();
- //是否捆扎
- String is_strapping = dto.getIs_strapping();
- //是否裹膜
- String is_coating = dto.getIs_coating();
- //是否贴标
- String is_labeling = dto.getIs_labeling();
+
//选择上料口
String feeding_mouth = dto.getFeeding_mouth();
String outer_diameter = dto.getOuter_diameter();
String wall_thickness = dto.getWall_thickness();
String length = dto.getLength();
String qty = dto.getQty();
+ String jackup_num = dto.getJackup_num();
logServer.deviceLogToacs(this.device_code,"","","申请工单号成功,order:"+order);
writing(ItemProtocol.item_to_order,order);
writing(ItemProtocol.item_to_feeding_mouth,feeding_mouth);
writing(ItemProtocol.item_to_order_feeding_qty,qty);
writing(ItemProtocol.item_to_outer_diameter,outer_diameter);
writing(ItemProtocol.item_to_wall_thickness,wall_thickness);
+ writing(ItemProtocol.item_to_jackup_num,jackup_num);
writing(ItemProtocol.item_to_length,length);
- writing(ItemProtocol.item_to_is_labeling,is_labeling);
- writing(ItemProtocol.item_to_is_risking,is_risking);
- writing(ItemProtocol.item_to_is_strapping,is_strapping);
- writing(ItemProtocol.item_to_is_coating,is_coating);
- writing(ItemProtocol.item_to_is_lettering,is_lettering);
writing(ItemProtocol.item_to_command,String.valueOf(mode));
-
dto.setOrder_status("02");
produceshiftorderService.autoupdate(dto);
@@ -576,13 +637,14 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
public boolean apply_orderDetail(int order) throws Exception {
ProduceshiftorderdetailDto dto = produceshiftorderdetailService.apply_orderDetail(String.valueOf(order));
+ ProduceshiftorderDto orderdto = produceshiftorderService.findOrderByOrderCodeFromCache(String.valueOf(order));
if(ObjectUtil.isEmpty(dto)){
logServer.deviceLogToacs(this.device_code,"","","apply_orderDetail 未找到可下发工单明细!");
throw new BadRequestException("未找到可下发工单明细!");
}
String orderDetail = dto.getOrder_detail_code();
//上料数量
- String feeding_qty = dto.getFeeding_qty();
+ String feeding_qty = dto.getOrder_detail_qty();
//捆扎包数
String strap_pack_number = dto.getStrap_pack_number();
//每捆数量
@@ -593,6 +655,18 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
String str = dto.getLabeling_message();
//判断是否最后一个客户
boolean last_detail = produceshiftorderdetailService.isLastOrderDetail(String.valueOf(order));
+ //套冒颜色
+ String color = dto.getColor_type();
+ //是否刻字
+ String is_lettering = orderdto.getIs_lettering();
+ //是否套冒
+ String is_risking = orderdto.getIs_risking();
+ //是否捆扎
+ String is_strapping = orderdto.getIs_strapping();
+ //是否裹膜
+ String is_coating = orderdto.getIs_coating();
+ //是否贴标
+ String is_labeling = orderdto.getIs_labeling();
//下发激光刻字信息
//判断下发刻字成功
if(!send_letter_flag){
@@ -613,10 +687,15 @@ public class HaiLiangFeedingTrunkDeviceDriver extends AbstractOpcDeviceDriver im
writing(ItemProtocol.item_to_coating_qty,strap_pack_number);
writing(ItemProtocol.item_to_labeling_qty,strap_pack_number);
writing(ItemProtocol.item_to_lastone_strapping_qty,strap_tailint_number);
-
+ writing(ItemProtocol.item_to_is_labeling,is_labeling);
+ writing(ItemProtocol.item_to_is_risking,is_risking);
+ writing(ItemProtocol.item_to_is_strapping,is_strapping);
+ writing(ItemProtocol.item_to_is_coating,is_coating);
+ writing(ItemProtocol.item_to_is_lettering,is_lettering);
+ writing(ItemProtocol.item_to_color,color);
writing(ItemProtocol.item_to_command,String.valueOf(mode));
- dto.setOrder_detail_status("01");
+ dto.setOrder_detail_status("02");
produceshiftorderdetailService.update(dto);
send_letter_flag = false;
send_letter_flag_back = false;
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java
index 1a99ffd..1dbb4e7 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_feeding_trunk/ItemProtocol.java
@@ -36,7 +36,7 @@ public class ItemProtocol {
//当前工单明细号裹膜数
public static String item_detail_coating_qty = "detail_coating_qty";
//当前贴标工单明细号
- public static String item_labeling_order = "labeling_order";
+ public static String item_labeling_order_detail = "labeling_order_detail";
//当前贴标工单明细号贴标合格数
public static String item_detail_labeling_qualified_qty = "detail_labeling_qualified_qty";
//当前贴标工单明细号贴标数
@@ -56,6 +56,11 @@ public class ItemProtocol {
public static String item_lettering_frequency = "lettering_frequency";
public static String item_one_speed = "one_speed";
public static String item_coating_frequency = "coating_frequency";
+ public static String item_detail_coating_qualified_qty = "detail_coating_qualified_qty";
+ public static String item_strapping_order_detail = "strapping_order_detail";
+ public static String item_order_feeding_finish = "order_feeding_finish";
+
+
public static String item_to_heartbeat = "to_heartbeat";
@@ -89,6 +94,9 @@ public class ItemProtocol {
public static String item_to_lettering_frequency = "to_lettering_frequency";
public static String item_to_one_speed = "to_one_speed";
public static String item_to_coating_frequency = "to_coating_frequency";
+ public static String item_to_jackup_num = "to_jackup_num";
+ public static String item_to_color = "to_color";
+
private HaiLiangFeedingTrunkDeviceDriver driver;
@@ -161,8 +169,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_detail_coating_qty);
}
- public int getLabeling_order() {
- return this.getOpcIntegerValue(item_labeling_order);
+ public int getLabeling_order_detail() {
+ return this.getOpcIntegerValue(item_labeling_order_detail);
}
public int getDetail_labeling_qualified_qty() {
@@ -181,6 +189,13 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_clear);
}
+ public int getStrapping_order_detail() {
+ return this.getOpcIntegerValue(item_strapping_order_detail);
+ }
+
+ public int getOrder_feeding_finish() {
+ return this.getOpcIntegerValue(item_order_feeding_finish);
+ }
public Float getLine_speed() {
@@ -227,6 +242,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_coating_frequency);
}
+ public int getDetail_coating_qualified_qty() {
+ return this.getOpcIntegerValue(item_detail_coating_qualified_qty);
+ }
+
+
+
public int getPause() {
return this.getOpcIntegerValue(item_pause);
}
@@ -399,7 +420,6 @@ public class ItemProtocol {
list.add(new ItemDto(item_last_order_detail, "上次完成工单明细号", "DB600.D14"));
list.add(new ItemDto(item_order_feeding_qty, "当前工单上料数量", "DB600.D18"));
list.add(new ItemDto(item_detail_feeding_qty, "当前工单明细号上料数量", "DB600.D22"));
- list.add(new ItemDto(item_detail_feeding_qualified_qty, "当前工单明细号上料合格数量", "DB600.D122"));
list.add(new ItemDto(item_detail_lettering_qty, "当前工单明细号刻字数量", "DB600.D26"));
list.add(new ItemDto(item_detail_lettering_qualified_qty, "当前工单明细号刻字合格数量", "DB600.D30"));
list.add(new ItemDto(item_detail_risking_qualified_qty, "当前工单明细号套冒合格数", "DB600.D34"));
@@ -407,7 +427,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_detail_strapping_qty, "当前工单明细号捆扎包数", "DB600.D42"));
list.add(new ItemDto(item_detail_strapping_oneqty, "当前工单明细号捆扎根数", "DB600.D46"));
list.add(new ItemDto(item_detail_coating_qty, "当前工单明细号裹膜数", "DB600.D50"));
- list.add(new ItemDto(item_labeling_order, "当前贴标工单明细号", "DB600.D54"));
+ list.add(new ItemDto(item_labeling_order_detail, "当前贴标工单明细号", "DB600.D54"));
list.add(new ItemDto(item_detail_labeling_qualified_qty, "当前工单明细号刻字数量", "DB600.D58"));
list.add(new ItemDto(item_detail_labeling_qty, "当前贴标工单明细号贴标数", "DB600.D62"));
list.add(new ItemDto(item_ready, "设备就绪", "DB600.D66"));
@@ -424,6 +444,12 @@ public class ItemProtocol {
list.add(new ItemDto(item_lettering_frequency, "刻字频率", "DB600.D110"));
list.add(new ItemDto(item_one_speed, "捆扎裹膜贴标段输送速度", "DB600.REAL114"));
list.add(new ItemDto(item_coating_frequency, "裹膜机频率", "DB600.D118"));
+ list.add(new ItemDto(item_detail_feeding_qualified_qty, "当前工单明细号上料合格数量", "DB600.D122"));
+ list.add(new ItemDto(item_detail_coating_qualified_qty, "当前工单明细号裹膜合格数量", "DB600.D126"));
+ list.add(new ItemDto(item_strapping_order_detail, "捆扎工单明细号", "DB600.D130"));
+ list.add(new ItemDto(item_order_feeding_finish, "工单上料完成", "DB600.D134"));
+
+
return list;
}
@@ -461,6 +487,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_lettering_frequency, "刻字频率", "DB610.D110"));
list.add(new ItemDto(item_to_one_speed, "捆扎裹膜贴标段输送速度", "DB610.REAL114"));
list.add(new ItemDto(item_to_coating_frequency, "裹膜机频率", "DB610.D118"));
+ list.add(new ItemDto(item_to_jackup_num, "套冒合格后顶升数", "DB610.W122"));
+ list.add(new ItemDto(item_to_color, "套冒颜色", "DB610.W124"));
return list;
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDefination.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDefination.java
index b9ea3fa..29c9a9f 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDefination.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDefination.java
@@ -60,10 +60,12 @@ public class HaiLiangLabelingDefination implements OpcDeviceDriverDefination {
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB606.W2", Boolean.valueOf(true)));
list.add(new ItemDto(ItemProtocol.item_move, "光电信号", "DB606.W4"));
list.add(new ItemDto(ItemProtocol.item_error, "故障信号", "DB606.W6"));
- list.add(new ItemDto(ItemProtocol.item_order, "当前执行工单号", "DB606.D8"));
- list.add(new ItemDto(ItemProtocol.item_order_detail, "当前工单明细号", "DB606.D12"));
- list.add(new ItemDto(ItemProtocol.item_detail_qty, "当前工单实时上料数量", "DB606.D16"));
- list.add(new ItemDto(ItemProtocol.item_detail_qualified_qty, "当前工单明细号合格数量", "DB606.D20"));
+ list.add(new ItemDto(ItemProtocol.item_order, "工单号", "DB606.D8"));
+ list.add(new ItemDto(ItemProtocol.item_order_detail, "工单明细号", "DB606.D12"));
+ list.add(new ItemDto(ItemProtocol.item_detail_qty, "明细总捆数", "DB606.D16"));
+ list.add(new ItemDto(ItemProtocol.item_detail_qualified_qty, "合格捆数量", "DB606.D20"));
+ list.add(new ItemDto(ItemProtocol.item_one_qty, "当前捆根数", "DB606.D24"));
+
return list;
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java
index b414481..0fa0738 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/HaiLiangLabelingDeviceDriver.java
@@ -3,6 +3,7 @@ package org.nl.acs.device_driver.hailiang.hailiang_labeling;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -12,13 +13,13 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.log.service.LogServer;
import org.nl.acs.opc.Device;
-import org.nl.acs.order.service.LabelingTemplateService;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.ProduceshiftorderdetailService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.dto.ProduceshiftorderdetailDto;
import org.nl.exception.BadRequestException;
import org.nl.utils.SpringContextHolder;
+import org.nl.wql.WQL;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
@@ -49,8 +50,8 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
@Autowired
LogServer logServer = SpringContextHolder.getBean(LogServer.class);
- @Autowired
- LabelingTemplateService labelingTemplateService = SpringContextHolder.getBean(LabelingTemplateService.class);
+// @Autowired
+// LabelingTemplateService labelingTemplateService = SpringContextHolder.getBean(LabelingTemplateService.class);
String device_code;
int mode = 0;
@@ -65,8 +66,13 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
int last_order_detail = 0;
int detail_qty = 0;
int last_detail_qty = 0;
- int detail_qualified_qty = 0;
- int last_detail_qualified_qty = 0;
+ int detail_qualified_qty;
+ int last_detail_qualified_qty;
+ int labeling_index;
+ int last_labeling_index;
+ int one_qty = 0;
+ int last_one_qty = 0;
+
boolean requireSucess = false;
@@ -84,10 +90,10 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
error = this.itemProtocol.getError();
order = this.itemProtocol.getOrder();
order_detail = this.itemProtocol.getOrder_detail();
- //当前工单明细号上料数量
detail_qty = this.itemProtocol.getDetail_qty();
- //当前工单明细号上料合格数量
detail_qualified_qty = this.itemProtocol.getDetail_qualified_qty();
+ one_qty = this.itemProtocol.getOne_qty();
+
if (mode != last_mode) {
logServer.deviceLog(this.device_code,"mode" ,String.valueOf(mode));
logServer.deviceLogToacs(this.device_code,"","","信号mode:" + last_mode + "->" + mode);
@@ -116,8 +122,13 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
}
if (detail_qualified_qty != last_detail_qualified_qty) {
logServer.deviceLog(this.device_code,"detail_qualified_qty" ,String.valueOf(detail_qualified_qty));
- logServer.deviceLogToacs(this.device_code,"","","信号detail_qualified_qty:" + last_detail_qualified_qty + "->" + detail_qualified_qty);
+ logServer.deviceLogToacs(this.device_code,"","","detail_qualified_qty:" + last_detail_qualified_qty + "->" + detail_qualified_qty);
}
+ if (one_qty != last_one_qty) {
+ logServer.deviceLog(this.device_code,"finish_status" ,String.valueOf(one_qty));
+ logServer.deviceLogToacs(this.device_code,"","","信号one_qty:" + last_one_qty + "->" + one_qty);
+ }
+
} catch (Exception var17) {
return;
}
@@ -140,16 +151,17 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
break;
case 2:
break;
- case 3:
+ case 4:
//申请贴标
if(!requireSucess){
- if(order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){
+ if(order > 0 && order_detail > 0 && detail_qty>0 ){
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
- +order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty);
+ +order_detail+",detail_qty:"+detail_qty);
+ logServer.deviceLogToacs(this.device_code,"","","申请贴标");
apply_labeling_message(String.valueOf(order),String.valueOf(order_detail),String.valueOf(detail_qty));
} else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
- +order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty);
+ +order_detail+",detail_qty:"+detail_qty);
}
}
@@ -157,13 +169,13 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
case 5:
//贴标完成
if(!requireSucess){
- if(order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0){
+ if(order > 0 && order_detail > 0 && detail_qty>0 ){
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
- +order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty);
+ +order_detail+",detail_qty:"+detail_qty);
update_detail(String.valueOf(order),String.valueOf(order_detail),"01");
} else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请贴标完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
- +order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty);
+ +order_detail+",detail_qty:"+detail_qty);
}
}
@@ -171,13 +183,13 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
case 6:
//强制贴标完成
if(!requireSucess){
- if( order > 0 && order_detail > 0 && detail_qty>0 && detail_qualified_qty>0 ) {
+ if( order > 0 && order_detail > 0 && detail_qty>0) {
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请强制贴标完成,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
- +order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty);
+ +order_detail+",detail_qty:"+detail_qty);
update_detail(String.valueOf(order),String.valueOf(order_detail),"02");
} else {
logServer.deviceLogToacs(this.device_code,"","",device_code+":申请强制贴标完成失败,mode:"+mode+",requireSucess:" + requireSucess + ",order:" + order +",order_detail:"
- +order_detail+",detail_qty:"+detail_qty+",detail_qualified_qty:"+detail_qualified_qty);
+ +order_detail+",detail_qty:"+detail_qty);
}
}
@@ -217,7 +229,6 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
last_order = order;
last_order_detail = order_detail;
last_detail_qty = detail_qty;
- last_detail_qualified_qty = detail_qualified_qty;
}
@@ -236,6 +247,7 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
dto.setLabeling_finished(status);
String now = DateUtil.now();
dto.setLabeling_finish_time(now);
+ dto.setOrder_detail_status("08");
produceshiftorderdetailService.update(dto);
writing(itemProtocol.item_to_command,String.valueOf(mode));
requireSucess = true;
@@ -273,24 +285,50 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
log.trace("触发时间因为小于{}毫秒,而被无视", this.detail_time_out);
return false;
} else {
- if (date.getTime() - this.detail_time_out < (long) this.detail_time_out) {
- log.trace("触发时间因为小于{}毫秒,而被无视", this.detail_time_out);
- return false;
+ this.detail_time = date;
+ ProduceshiftorderDto dto = produceshiftorderService.findOrderByOrderCodeFromCache(String.valueOf(order));
+ ProduceshiftorderdetailDto detaildto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail));
+ if(ObjectUtil.isEmpty(dto)){
+ throw new BadRequestException("未找到可下发工单明细!");
+ }
+ Boolean flag = false;
+ // 2.根据明细template_id 找到对应的模板
+ JSONObject jsonStor = WQL.getWO("QPRODUCESHIFTORDER").addParam("flag", "3").addParam("storage_id", detaildto.getTemplate_id()).process().uniqueResult(0);
+
+ //labelingTemplateService.printMessage(dto,qty);
+ String path = jsonStor.getString("path");
+ String pathName = "E:\\work\\"+jsonStor.getString("name")+ jsonStor.getString("storage_id") + ".xlsx";
+
+
+ JSONObject jo = new JSONObject();
+ jo.put("order_id",dto.getOrder_id());
+ jo.put("template_id",detaildto.getTemplate_id());
+ jo.put("path",path);
+ jo.put("url",pathName);
+ jo.put("alloy",dto.getAlloy());
+ jo.put("temper",dto.getTemper());
+ jo.put("material_spec",dto.getMaterial_spec());
+ jo.put("number",String.valueOf(one_qty));
+ jo.put("outer_diameter",dto.getOuter_diameter());
+ jo.put("standard",detaildto.getStandard());
+ jo.put("batch",detaildto.getBatch());
+ jo.put("prod_date",detaildto.getProd_date());
+ jo.put("present_strap_pack_number",String.valueOf(labeling_index));
+ jo.put("inspector",detaildto.getInspector());
+ jo.put("mg_weight",detaildto.getMg_weight());
+ //打印纸张大小
+ jo.put("page_length","600");
+ jo.put("page_height","400");
+ logServer.deviceLogToacs(this.device_code,"","","申请贴标接口信息:"+jo.toString());
+
+ flag = produceshiftorderService.print(jo);
+ if(flag){
+ logServer.deviceLogToacs(this.device_code,"","","下发贴标信息成功");
+ writing(itemProtocol.item_to_command,String.valueOf(mode));
+ requireSucess = true;
+ return true;
} else {
- this.detail_time = date;
- ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(String.valueOf(order), String.valueOf(order_detail));
- if(ObjectUtil.isEmpty(dto)){
- throw new BadRequestException("未找到可下发工单明细!");
- }
- Boolean flag = labelingTemplateService.printMessage(dto,qty);
- if(flag){
- logServer.deviceLogToacs(this.device_code,"","","下发贴标信息成功");
- writing(itemProtocol.item_to_command,String.valueOf(mode));
- requireSucess = true;
- return true;
- } else {
- return false;
- }
+ return false;
}
}
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/ItemProtocol.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/ItemProtocol.java
index 5e11985..6f32c38 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/ItemProtocol.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_labeling/ItemProtocol.java
@@ -14,8 +14,11 @@ public class ItemProtocol {
public static String item_error = "error";
public static String item_order = "order";
public static String item_order_detail = "order_detail";
+ public static String item_labeling_index = "labeling_index";
+ public static String item_labeling_index_number = "labeling_index_number";
public static String item_detail_qty = "detail_qty";
public static String item_detail_qualified_qty = "detail_qualified_qty";
+ public static String item_one_qty = "one_qty";
public static String item_to_command = "to_command";
@@ -53,6 +56,14 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_detail_qualified_qty);
}
+ public int getLabeling_index() {
+ return this.getOpcIntegerValue(item_labeling_index);
+ }
+
+ public int getOne_qty() {
+ return this.getOpcIntegerValue(item_one_qty);
+ }
+
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
@@ -75,10 +86,11 @@ public class ItemProtocol {
list.add(new ItemDto(item_mode, "工作模式", "DB606.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电信号", "DB606.W4"));
list.add(new ItemDto(item_error, "故障信号", "DB606.W6"));
- list.add(new ItemDto(item_order, "当前执行工单号", "DB606.D8"));
- list.add(new ItemDto(item_order_detail, "当前工单明细号", "DB606.D12"));
- list.add(new ItemDto(item_detail_qty, "当前工单实时上料数量", "DB606.D16"));
- list.add(new ItemDto(item_detail_qualified_qty, "当前工单明细号合格数量", "DB606.D20"));
+ list.add(new ItemDto(ItemProtocol.item_order, "工单号", "DB606.D8"));
+ list.add(new ItemDto(ItemProtocol.item_order_detail, "工单明细号", "DB606.D12"));
+ list.add(new ItemDto(ItemProtocol.item_detail_qty, "实时捆数量", "DB606.D16"));
+ list.add(new ItemDto(ItemProtocol.item_detail_qualified_qty, "合格捆数量", "DB606.D20"));
+ list.add(new ItemDto(ItemProtocol.item_one_qty, "当前捆根数", "DB606.D24"));
return list;
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDefination.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDefination.java
index c44269c..1e5e74c 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDefination.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDefination.java
@@ -64,8 +64,8 @@ public class HaiLiangStrappingDefination implements OpcDeviceDriverDefination {
list.add(new ItemDto(ItemProtocol.item_order_detail, "当前工单明细号", "DB604.D12"));
list.add(new ItemDto(ItemProtocol.item_detail_qty, "当前工单实时上料数量", "DB604.D16"));
list.add(new ItemDto(ItemProtocol.item_detail_qualified_qty, "当前工单明细号合格数量", "DB604.D20"));
- list.add(new ItemDto(ItemProtocol.item_cache_qty, "当前缓存数量", "DB604.D24"));
- list.add(new ItemDto(ItemProtocol.item_qty, "当前捆扎数量", "DB604.D28"));
+ list.add(new ItemDto(ItemProtocol.item_qty, "当前捆扎数量", "DB604.D24"));
+ list.add(new ItemDto(ItemProtocol.item_status, "当前捆扎数量", "DB604.D28"));
return list;
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java
index 9639d7c..0d5509f 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/HaiLiangStrappingDeviceDriver.java
@@ -63,6 +63,10 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple
int last_cache_qty = 0;
int qty = 0;
int last_qty = 0;
+ int status = 0;
+ int last_status = 0;
+
+
boolean requireSucess = false;
@@ -83,7 +87,7 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple
detail_qty = this.itemProtocol.getDetail_qty();
//当前工单明细号上料合格数量
detail_qualified_qty = this.itemProtocol.getDetail_qualified_qty();
- cache_qty = this.itemProtocol.getCache_qty();
+ status = this.itemProtocol.getStatus();
qty = this.itemProtocol.getQty();
if (mode != last_mode) {
@@ -116,9 +120,9 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple
logServer.deviceLog(this.device_code,"detail_qualified_qty" ,String.valueOf(detail_qualified_qty));
logServer.deviceLogToacs(this.device_code,"","","信号detail_qualified_qty:" + last_detail_qualified_qty + "->" + detail_qualified_qty);
}
- if (cache_qty != last_cache_qty) {
- logServer.deviceLog(this.device_code,"cache_qty" ,String.valueOf(cache_qty));
- logServer.deviceLogToacs(this.device_code,"","","信号cache_qty:" + last_cache_qty + "->" + cache_qty);
+ if (status != last_status) {
+ logServer.deviceLog(this.device_code,"status" ,String.valueOf(cache_qty));
+ logServer.deviceLogToacs(this.device_code,"","","信号status:" + last_status + "->" + status);
}
if (qty != last_qty) {
logServer.deviceLog(this.device_code,"qty" ,String.valueOf(qty));
@@ -182,7 +186,7 @@ public class HaiLiangStrappingDeviceDriver extends AbstractOpcDeviceDriver imple
last_order_detail = order_detail;
last_detail_qty = detail_qty;
last_detail_qualified_qty = detail_qualified_qty;
- last_cache_qty = cache_qty;
+ last_status = status;
last_qty = qty;
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/ItemProtocol.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/ItemProtocol.java
index e10ba57..4c84865 100644
--- a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/ItemProtocol.java
+++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_strapping/ItemProtocol.java
@@ -16,7 +16,7 @@ public class ItemProtocol {
public static String item_order_detail = "order_detail";
public static String item_detail_qty = "detail_qty";
public static String item_detail_qualified_qty = "detail_qualified_qty";
- public static String item_cache_qty = "cache_qty";
+ public static String item_status = "status";
public static String item_qty = "qty";
public static String item_to_command = "to_command";
@@ -59,8 +59,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_detail_qualified_qty);
}
- public int getCache_qty() {
- return this.getOpcIntegerValue(item_cache_qty);
+ public int getStatus() {
+ return this.getOpcIntegerValue(item_status);
}
public int getQty() {
@@ -94,8 +94,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_order_detail, "当前工单明细号", "DB604.D12"));
list.add(new ItemDto(item_detail_qty, "当前工单实时上料数量", "DB604.D16"));
list.add(new ItemDto(item_detail_qualified_qty, "当前工单明细号合格数量", "DB604.D20"));
- list.add(new ItemDto(item_cache_qty, "当前缓存数量", "DB604.D24"));
- list.add(new ItemDto(item_qty, "当前捆扎数量", "DB604.D28"));
+ list.add(new ItemDto(item_qty, "当前捆扎数量", "DB604.D24"));
+ list.add(new ItemDto(item_status, "状态", "DB604.D28"));
return list;
}
diff --git a/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
index 71c9eeb..a18d94a 100644
--- a/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
+++ b/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
@@ -150,22 +150,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("remark", remark);
jo.put("params", params);
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
- // 如果是无光电的设备 指令完成变更起点、终点状态
- JSONObject startjo = new JSONObject();
- startjo.put("device_code", start_device_code);
- startjo.put("hasGoodStatus", "2");
- startjo.put("material_type", "");
- startjo.put("batch", "");
- startjo.put("islock", "false");
- DeviceService.changeDeviceStatus(startjo);
-
- JSONObject nextjo = new JSONObject();
- nextjo.put("device_code", next_device_code);
- nextjo.put("hasGoodStatus", "0");
- nextjo.put("material_type", "");
- nextjo.put("batch", "");
- nextjo.put("islock", "false");
- DeviceService.changeDeviceStatus(nextjo);
+
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
TaskService.create(task_dto);
diff --git a/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java b/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java
index 7b15465..06122be 100644
--- a/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java
+++ b/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java
@@ -132,6 +132,23 @@ public class ProduceshiftorderController {
return new ResponseEntity<>(HttpStatus.OK);
}
+ @Log("下发刻字信息")
+ @ApiOperation("下发刻字信息")
+ @PostMapping(value = "/send_letteringMess")
+ public ResponseEntity