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 send_letteringMess(@Validated @RequestBody Map whereJson) throws IOException { + produceshiftorderService.send_letteringMess(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("下发贴标信息") + @ApiOperation("下发贴标信息") + @PostMapping(value = "/send_labelingMess") + public ResponseEntity send_labelingMess(@Validated @RequestBody Map whereJson) { + produceshiftorderService.send_labelingMess(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("清料") @ApiOperation("清料") @PostMapping(value = "/clear") @@ -195,6 +212,14 @@ public class ProduceshiftorderController { return new ResponseEntity<>(produceshiftorderService.selectTemplateList(),HttpStatus.OK); } + @Log("查询套冒颜色") + @ApiOperation("查询套冒颜色") + @GetMapping("/selectColortypeList") + public ResponseEntity selectColortypeList() { + return new ResponseEntity<>(produceshiftorderService.selectColortypeList(),HttpStatus.OK); + } + + @Log("上传Excel模板") @ApiOperation("上传Excel模板") @PostMapping({"/pictures"}) diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java b/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java index 9cc7657..915081f 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java @@ -148,6 +148,11 @@ public interface ProduceshiftorderService { */ void stop(); + //下发刻字信息 + void send_letteringMess(Map where) throws IOException; + + //下发贴标信息 + void send_labelingMess(Map where); /** @@ -228,9 +233,13 @@ public interface ProduceshiftorderService { */ JSONArray selectTemplateList(); + JSONArray selectColortypeList(); + + + /** * 打印 * @param whereJson */ - void print(JSONObject whereJson); + Boolean print(JSONObject whereJson); } diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderDto.java b/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderDto.java index 7d2eeb7..75883f9 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderDto.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderDto.java @@ -97,5 +97,10 @@ public class ProduceshiftorderDto implements Serializable { private String temper; + /** + * 顶升数 + */ + private String jackup_num; + } diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java b/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java index fbdf0df..82135aa 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/dto/ProduceshiftorderdetailDto.java @@ -12,15 +12,6 @@ import java.io.Serializable; @Data public class ProduceshiftorderdetailDto implements Serializable { - /** 工单明细标识 */ - private String order_detail_id; - - /** 工单明细编码 */ - private String order_detail_code; - - /** 工单明细类型 */ - private String order_detail_type; - /** 优先级 */ private String priority; @@ -36,43 +27,21 @@ public class ProduceshiftorderdetailDto implements Serializable { /** 工单数量 */ private String order_qty; - /** 工单明细数量 */ - private String order_detail_qty; - /** 捆扎包数 */ private String strap_pack_number; /** 当前捆扎包数 */ private String present_strap_pack_number; - /** 当前捆扎数 */ - private String present_strap_number; - /** 每捆数量 */ private String strap_number; /** 捆扎尾料数量 */ private String strap_tailint_number; - /** 图标前刻字信息 */ + /** 刻字信息 */ private String lettering_message; - /** 刻字图标类型 */ - private String lettering_icon; - - /** 图标后刻字信息 */ - private String lettering_message2; - - - /** 当前刻字数量 */ - private String present_lettering_number; - - - - /** 贴标模板 */ - private String labeling_template; - - /** 贴标信息 */ private String labeling_message; @@ -115,39 +84,20 @@ public class ProduceshiftorderdetailDto implements Serializable { /** 外径 */ private String outer_diameter; - /** 壁厚 */ - private String wall_thickness; - /** 物料长度 */ private String length; /** 工单明细状态 */ - //00-就绪、01-分拣中 - //02-下发工单明细暂停 03-工单明细暂停 - //04-下发强制完成 05-强制完成 - //06-自动完成 private String order_detail_status; /** 上料数量 */ private String feeding_qty; - /** 当前上料数量 */ - private String present_feeding_number; - - /** 上料合格数量 */ - private String feeding_qualified_number; - /** 上料开始时间 */ private String feeding_start_time; /** 上料完成时间 */ - private String feeding_finish_time; - - /** 上料完成 */ - private String feeding_finished; - - /** 刻字合格数量 */ - private String qualified_lettering_number; + private String feeding_end_time; /** 刻字开始时间 */ private String lettering_start_time; @@ -155,33 +105,15 @@ public class ProduceshiftorderdetailDto implements Serializable { /** 刻字完成时间 */ private String lettering_finish_time; - /** 刻字完成 */ - private String lettering_finished; - - /** 当前套冒数量 */ - private String present_sleeveing_number; - /** 套冒合格数量 */ private String qualified_sleeveing_number; - /** 套冒完成 */ - private String sleeveing_finished; - /** 套冒开始时间 */ private String sleeveing_start_time; /** 套冒完成时间 */ private String sleeveing_finish_time; - /** 捆扎开始时间 */ - private String strap_start_time; - - /** 捆扎完成时间 */ - private String strap_finish_time; - - /** 捆扎完成 */ - private String strap_finished; - /** 裹膜数量 */ private String wraping_number; @@ -197,26 +129,29 @@ public class ProduceshiftorderdetailDto implements Serializable { /** 裹膜完成时间 */ private String wraping_finish_time; - /** 裹膜完成 */ - private String wraping_finished; - /** 贴标开始时间 */ private String labeling_start_time; /** 贴标完成时间 */ private String labeling_finish_time; - /** 贴标完成 */ - private String labeling_finished; - /** 开始时间 */ private String start_time; /** 结束时间 */ private String end_time; - /** 模板id */ - private String template_id; + /** 工单明细标识 */ + private String order_detail_id; + + /** 工单明细编码 */ + private String order_detail_code; + + /** 工单明细类型 */ + private String order_detail_type; + + /** 壁厚 */ + private String wall_thickness; /** 执行标准 */ private String standard; @@ -232,4 +167,71 @@ public class ProduceshiftorderdetailDto implements Serializable { /** 米克重 */ private String mg_weight; + + /** 工单明细数量 */ + private String order_detail_qty; + + /** 图标类型 */ + private String lettering_icon; + + /** 图标后刻字信息 */ + private String lettering_message2; + + /** 当前上料数量 */ + private String present_feeding_number; + + /** 上料合格数量 */ + private String feeding_qualified_number; + + /** 当前刻字数量 */ + private String present_lettering_number; + + /** 刻字合格数量 */ + private String qualified_lettering_number; + + /** 当前套冒数量 */ + private String present_sleeveing_number; + + /** 捆扎合格包数 */ + private String qualified_strap_pack_number; + + /** 当前捆扎数量 */ + private String present_strap_number; + + /** 捆扎开始时间 */ + private String strap_start_time; + + /** 捆扎完成时间 */ + private String strap_finish_time; + + /** 贴标模板 */ + private String labeling_template; + + /** 贴标合格数量 */ + private String qualified_labeling_number; + + /** 上料完成 */ + private String feeding_finished; + + /** 刻字完成 */ + private String lettering_finished; + + /** 套冒完成 */ + private String sleeveing_finished; + + /** 裹膜完成 */ + private String wraping_finished; + + /** 捆扎完成 */ + private String strap_finished; + + /** 贴标完成 */ + private String labeling_finished; + + /** 模板id */ + private String template_id; + + /** 颜色 */ + private String color_type; + } diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java index 6be5fa4..de626da 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java @@ -15,6 +15,7 @@ import com.spire.xls.Workbook; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver; +import org.nl.acs.device_driver.hailiang.hailiang_labeling.HaiLiangLabelingDeviceDriver; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.order.service.ProduceshiftorderService; import org.nl.acs.order.service.ProduceshiftorderdetailService; @@ -226,12 +227,20 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if (ObjectUtil.isEmpty(tableData)){ throw new BadRequestException("客户信息不可为空!"); } + String jackup_num = ""; + if(Double.valueOf(outer_diameter) < 34.93){ + jackup_num = "5"; + } else { + jackup_num = "2"; + } + String order_code = CodeUtil.getNewCode("ORDER_NO"); String order_id = IdUtil.simpleUUID(); orderDto.setMaterial_code(material_code); orderDto.setMaterial_name(material_name); orderDto.setMaterial_spec(material_spec); orderDto.setMaterial_uuid(material_id); + orderDto.setJackup_num(jackup_num); orderDto.setLength(length); orderDto.setOuter_diameter(outer_diameter); orderDto.setWall_thickness(wall_thickness); @@ -532,7 +541,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if(haiLiangFeedingTrunkDeviceDriver.getPause() == 1 ){ throw new BadRequestException("设备已处于暂停状态,无法下发暂停!"); } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","1"); + haiLiangFeedingTrunkDeviceDriver.writing("to_pause","1"); } } @@ -548,7 +557,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if(haiLiangFeedingTrunkDeviceDriver.getPause() == 0 ){ throw new BadRequestException("设备已处于恢复状态,无法下发恢复!"); } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0"); + haiLiangFeedingTrunkDeviceDriver.writing("to_pause","0"); } } @@ -562,13 +571,76 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){ throw new BadRequestException("设备未联机,无法下发恢复!"); } - if(haiLiangFeedingTrunkDeviceDriver.getPause() == 0 ){ - throw new BadRequestException("设备已处于恢复状态,无法下发恢复!"); - } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0"); + + haiLiangFeedingTrunkDeviceDriver.writing("to_pause","1"); } } + //下发刻字信息 + @Override + public void send_letteringMess(Map where) throws IOException { + String order_code = where.get("parent_order_code").toString(); + String deatail_code = where.get("order_code").toString(); + ProduceshiftorderdetailDto dto = produceshiftorderdetailService.findOrderDetailFromCache(order_code,deatail_code); + if(ObjectUtil.isEmpty(dto)){ + throw new BadRequestException("未找到对应工单明细!"); + + } + produceshiftorderdetailService.sendLetteringMess(dto); + + } + + //下发贴标信息 + @Override + public void send_labelingMess(Map where) { + String order_code = where.get("parent_order_code").toString(); + String deatail_code = where.get("order_code").toString(); + ProduceshiftorderDto dto = findOrderByOrderCodeFromCache(order_code); + ProduceshiftorderdetailDto detaildto = produceshiftorderdetailService.findOrderDetailFromCache(order_code,deatail_code); + if(ObjectUtil.isEmpty(detaildto)){ + throw new BadRequestException("未找到对应工单明细!"); + + } + // 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"; + + HaiLiangLabelingDeviceDriver haiLiangLabelingDeviceDriver; + int one_qty = 0; + int labeling_index = 0; + + List deviceAll = deviceAppService.findDeviceDriver(HaiLiangLabelingDeviceDriver.class); + if (deviceAll.get(0) instanceof HaiLiangLabelingDeviceDriver) { + haiLiangLabelingDeviceDriver = (HaiLiangLabelingDeviceDriver) deviceAll.get(0); + one_qty = haiLiangLabelingDeviceDriver.getOne_qty(); + labeling_index = haiLiangLabelingDeviceDriver.getLabeling_index(); + } + + 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","50"); + jo.put("page_height","40"); + print(jo); + } + @Override public void clear() { HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver; @@ -581,7 +653,10 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if(haiLiangFeedingTrunkDeviceDriver.getClear() == 1 ){ throw new BadRequestException("设备已处于清料状态,无法下发清料!"); } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_clear","1"); + if(haiLiangFeedingTrunkDeviceDriver.getOrder_feeding_finish() == 0 ){ + throw new BadRequestException("设备未上料完成,无法下发清料!"); + } + haiLiangFeedingTrunkDeviceDriver.writing("to_clear","1"); } } @@ -597,27 +672,32 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if(haiLiangFeedingTrunkDeviceDriver.getPause() != 0 ){ throw new BadRequestException("设备已处于暂停状态,无法下发暂停!"); } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0"); + haiLiangFeedingTrunkDeviceDriver.writing("to_pause","0"); } } + //强制完成 @Override public void order_force_complete(Map whereJson) { + String order = whereJson.get("order_code").toString(); + ProduceshiftorderDto orderdto = findOrderByOrderCodeFromCache(order); + if(ObjectUtil.isEmpty(orderdto)){ + throw new BadRequestException("未找到对应工单!"); + } + orderdto.setOrder_status("06"); HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver; List deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class); if (deviceAll.get(0) instanceof HaiLiangFeedingTrunkDeviceDriver) { haiLiangFeedingTrunkDeviceDriver = (HaiLiangFeedingTrunkDeviceDriver) deviceAll.get(0); - if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){ - throw new BadRequestException("设备未联机,无法下发暂停!"); - } - if(haiLiangFeedingTrunkDeviceDriver.getOrder() == 0 ){ - throw new BadRequestException("设备已处于恢复状态,无法下发恢复!"); - } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0"); +// if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){ +// throw new BadRequestException("设备未联机,无法下发暂停!"); +// } + haiLiangFeedingTrunkDeviceDriver.writing("to_order_complete","1"); } + update(orderdto); } - + //工单明细暂停 @Override public void detail_pause(Map whereJson) { String is_flag = MapUtil.getStr(whereJson, "is_flag"); @@ -649,25 +729,27 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if(haiLiangFeedingTrunkDeviceDriver.getPause() == 1 ){ throw new BadRequestException("设备已处于暂停状态,无法下发!"); } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0"); + haiLiangFeedingTrunkDeviceDriver.writing("to_pause","0"); } } @Override public void detail_force_complete(Map whereJson) { + String order = whereJson.get("parent_order_code").toString(); + String detail = whereJson.get("order_code").toString(); + ProduceshiftorderdetailDto detaildto = produceshiftorderdetailService.findOrderDetailFromCache(order,detail); + if(ObjectUtil.isEmpty(detaildto)){ + throw new BadRequestException("未找到对应工单明细!"); + } + detaildto.setOrder_detail_status("04"); HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver; List deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class); if (deviceAll.get(0) instanceof HaiLiangFeedingTrunkDeviceDriver) { haiLiangFeedingTrunkDeviceDriver = (HaiLiangFeedingTrunkDeviceDriver) deviceAll.get(0); - if(haiLiangFeedingTrunkDeviceDriver.getMode() !=2){ - throw new BadRequestException("设备联机,无法下发暂停!"); - } - if(haiLiangFeedingTrunkDeviceDriver.getPause() == 0 ){ - throw new BadRequestException("设备已处于恢复状态,无法下发恢复!"); - } - haiLiangFeedingTrunkDeviceDriver.writing("item_to_pause","0"); + haiLiangFeedingTrunkDeviceDriver.writing("to_order_detail_complete","1"); } + produceshiftorderdetailService.update(detaildto); } @@ -868,14 +950,31 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A JSONObject json = new JSONObject(); json.put("template_id", obj.getString("template_id")); json.put("template_code", obj.getString("template_code")); - json.put("template_name", obj.getString("template_name")); + json.put("template_name", obj.getString("template_name")); + result.add(json); + } + return result; + } + + + @Override + public JSONArray selectColortypeList() { + //贴标模板表【acs_labeling_template】 + JSONArray arr = WQLObject.getWQLObject("sys_dict_detail").query("is_delete= '0' AND is_used= '1' and name='color_type'","dict_sort asc").getResultJSONArray(0); + JSONArray result = new JSONArray(); + for (int i = 0; i < arr.size(); i++) { + JSONObject obj = arr.getJSONObject(i); + JSONObject json = new JSONObject(); + json.put("id", obj.getString("id")); + json.put("label", obj.getString("label")); + json.put("value", obj.getString("value")); result.add(json); } return result; } @Override - public void print(JSONObject whereJson) { + public Boolean print(JSONObject whereJson) { String order_id = whereJson.getString("order_id"); String template_id = whereJson.getString("template_id"); @@ -929,7 +1028,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A printerJob.print(); } catch (PrinterException e) { e.printStackTrace(); + return false; } + return true; } } \ No newline at end of file diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java index 6cebace..77dab8c 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderdetailServiceImpl.java @@ -176,7 +176,7 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta map.put("上料数量", produceshiftorderdetail.getFeeding_qty()); map.put("上料合格数量", produceshiftorderdetail.getFeeding_qualified_number()); map.put("上料开始时间", produceshiftorderdetail.getFeeding_start_time()); - map.put("上料完成时间", produceshiftorderdetail.getFeeding_finish_time()); + map.put("上料完成时间", produceshiftorderdetail.getFeeding_end_time()); map.put("刻字合格数量", produceshiftorderdetail.getQualified_lettering_number()); map.put("刻字开始时间", produceshiftorderdetail.getLettering_start_time()); map.put("刻字完成时间", produceshiftorderdetail.getLettering_finish_time()); @@ -206,7 +206,7 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta } public synchronized void reload() { - this.detail = this.queryAllOrderDteail(" (order_detail_status != '05' and order_detail_status != '06' and order_detail_status != '07') and is_deleted =0"); + this.detail = this.queryAllOrderDteail(" (order_detail_status != '05' and order_detail_status != '06' and order_detail_status != '07') and is_deleted =0 order by order_detail_code"); } @Override @@ -249,10 +249,17 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta String msg1 = dto.getLettering_message(); String msg2 = dto.getLettering_message2(); String icon = dto.getLettering_icon(); - message = msg1 + msg2; + if(StrUtil.equals(icon,"1")){ + icon = "<"; + } else if (StrUtil.equals(icon,"2")) { + icon = ">"; + } else { + icon = ""; + } + message = msg1 + icon + msg2; //清缓存 try { - LetteringSocketConnectionAutoRun.write("BUFFERCLEAR" + "\r\n"); +// LetteringSocketConnectionAutoRun.write("BUFFERCLEAR" + "\r\n"); String yh = "\""; String strInst = "SETTEXT " + "S1" + " " + yh + message + yh + "\r\n"; //2个变量 LetteringSocketConnectionAutoRun.write(strInst + "\r\n"); diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/Test.java b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/Test.java index b7718ba..cc4d945 100644 --- a/nladmin-system/src/main/java/org/nl/acs/order/service/impl/Test.java +++ b/nladmin-system/src/main/java/org/nl/acs/order/service/impl/Test.java @@ -5,8 +5,7 @@ public class Test { public static void main(String[] args) { Process printProcess; - String printName ="HP LaserJet Pro MFP M225-M226 PCL 6"; - + String printName ="Zebra ZE500-4 RH (300 dpi)"; try { printProcess = Runtime @@ -14,7 +13,7 @@ public class Test { .exec(new String[] { "C:\\Users\\noblelift\\Desktop\\条码标签设计软件和打印程序\\BarcodePrint\\BarcodePrint.exe", "PrinterName=" + printName, - "LabelName=Label.ct", "Text5="+ "111","Text6="+"222","Text7="+"333","Text8="+"444"}); + "LabelName=Label1.ct", "Text1="+ "12211","Text2="+"23422","Text3="+"3533","Text4="+"6444"}); } catch (Exception e) { @@ -22,6 +21,7 @@ public class Test { } + //System.out.println(17%15); } diff --git a/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls b/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls index 04930ea..6f8f1ea 100644 Binary files a/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls and b/nladmin-system/src/main/java/org/nl/acs/order/service/wql/order.xls differ diff --git a/nladmin-system/src/main/java/org/nl/acs/stage/service/impl/StageActorServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/stage/service/impl/StageActorServiceImpl.java index 1731013..73be087 100644 --- a/nladmin-system/src/main/java/org/nl/acs/stage/service/impl/StageActorServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/acs/stage/service/impl/StageActorServiceImpl.java @@ -940,18 +940,25 @@ public class StageActorServiceImpl implements StageActorService { haiLiangFeedingTrunkDeviceDriver = (HaiLiangFeedingTrunkDeviceDriver) device.getDeviceDriver(); if (haiLiangFeedingTrunkDeviceDriver.getMode() == 0) { mode = "未联机"; + jo.put("isOnline", false); } else if (haiLiangFeedingTrunkDeviceDriver.getMode() == 1) { mode = "单机"; + jo.put("isOnline", false); } else if (haiLiangFeedingTrunkDeviceDriver.getMode() == 2) { mode = "联机"; + jo.put("isOnline", true); } else if (haiLiangFeedingTrunkDeviceDriver.getMode() == 3) { mode = "工作中"; + jo.put("isOnline", true); } else if (haiLiangFeedingTrunkDeviceDriver.getMode() == 4) { mode = "申请工单"; + jo.put("isOnline", true); } else if (haiLiangFeedingTrunkDeviceDriver.getMode() == 5) { mode = "申请工单明细号"; + jo.put("isOnline", true); } else if (haiLiangFeedingTrunkDeviceDriver.getMode() == 6) { mode = "急停"; + jo.put("isOnline", true); } obj.put("device_name", haiLiangFeedingTrunkDeviceDriver.getDevice().getDevice_name()); jo.put("mode", mode); @@ -969,7 +976,7 @@ public class StageActorServiceImpl implements StageActorService { jo.put("detail_strapping_qty", haiLiangFeedingTrunkDeviceDriver.getDetail_strapping_qty()); jo.put("detail_strapping_oneqty", haiLiangFeedingTrunkDeviceDriver.getDetail_strapping_oneqty()); jo.put("detail_coating_qty", haiLiangFeedingTrunkDeviceDriver.getDetail_coating_qty()); - jo.put("labeling_order", haiLiangFeedingTrunkDeviceDriver.getLabeling_order()); + jo.put("labeling_order_detail", haiLiangFeedingTrunkDeviceDriver.getLabeling_order_detail()); jo.put("detail_labeling_qualified_qty", haiLiangFeedingTrunkDeviceDriver.getDetail_labeling_qualified_qty()); jo.put("detail_labeling_qty", haiLiangFeedingTrunkDeviceDriver.getDetail_labeling_qty()); jo.put("ready", haiLiangFeedingTrunkDeviceDriver.getReady()); @@ -992,16 +999,22 @@ public class StageActorServiceImpl implements StageActorService { haiLiangFeedingDeviceDriver = (HaiLiangFeedingDeviceDriver) device.getDeviceDriver(); if (haiLiangFeedingDeviceDriver.getMode() == 0) { mode = "未联机"; + jo.put("isOnline", false); } else if (haiLiangFeedingDeviceDriver.getMode() == 1) { mode = "单机"; + jo.put("isOnline", false); } else if (haiLiangFeedingDeviceDriver.getMode() == 2) { mode = "联机"; + jo.put("isOnline", true); } else if (haiLiangFeedingDeviceDriver.getMode() == 3) { mode = "工作中"; + jo.put("isOnline", true); } else if (haiLiangFeedingDeviceDriver.getMode() == 4) { mode = "上料完成"; + jo.put("isOnline", true); } else if (haiLiangFeedingDeviceDriver.getMode() == 5) { mode = "强制上料完成"; + jo.put("isOnline", true); } if (haiLiangFeedingDeviceDriver.getMove() == 0) { move = "无货"; @@ -1024,16 +1037,22 @@ public class StageActorServiceImpl implements StageActorService { haiLiangLetteringDeviceDriver = (HaiLiangLetteringDeviceDriver) device.getDeviceDriver(); if (haiLiangLetteringDeviceDriver.getMode() == 0) { mode = "未联机"; + jo.put("isOnline", false); } else if (haiLiangLetteringDeviceDriver.getMode() == 1) { mode = "单机"; + jo.put("isOnline", false); } else if (haiLiangLetteringDeviceDriver.getMode() == 2) { mode = "联机"; + jo.put("isOnline", true); } else if (haiLiangLetteringDeviceDriver.getMode() == 3) { mode = "工作中"; + jo.put("isOnline", true); } else if (haiLiangLetteringDeviceDriver.getMode() == 4) { mode = "刻字完成"; + jo.put("isOnline", true); } else if (haiLiangLetteringDeviceDriver.getMode() == 5) { mode = "强制刻字完成"; + jo.put("isOnline", true); } if (haiLiangLetteringDeviceDriver.getMove() == 0) { move = "无货"; @@ -1054,16 +1073,22 @@ public class StageActorServiceImpl implements StageActorService { haiLiangRiskingDeviceDriver = (HaiLiangRiskingDeviceDriver) device.getDeviceDriver(); if (haiLiangRiskingDeviceDriver.getMode() == 0) { mode = "未联机"; + jo.put("isOnline", false); } else if (haiLiangRiskingDeviceDriver.getMode() == 1) { mode = "单机"; + jo.put("isOnline", false); } else if (haiLiangRiskingDeviceDriver.getMode() == 2) { mode = "联机"; + jo.put("isOnline", true); } else if (haiLiangRiskingDeviceDriver.getMode() == 3) { mode = "工作中"; + jo.put("isOnline", true); } else if (haiLiangRiskingDeviceDriver.getMode() == 4) { mode = "套冒完成"; + jo.put("isOnline", true); } else if (haiLiangRiskingDeviceDriver.getMode() == 5) { mode = "强制套冒完成"; + jo.put("isOnline", true); } if (haiLiangRiskingDeviceDriver.getMove() == 0) { move = "无货"; @@ -1169,7 +1194,6 @@ public class StageActorServiceImpl implements StageActorService { jo.put("order", haiLiangLabelingDeviceDriver.getOrder()); jo.put("order_detail", haiLiangLabelingDeviceDriver.getOrder_detail()); jo.put("detail_qty", haiLiangLabelingDeviceDriver.getDetail_qty()); - jo.put("detail_qualified_qty", haiLiangLabelingDeviceDriver.getDetail_qualified_qty()); } obj.put("data", jo); } diff --git a/nladmin-system/src/main/java/org/nl/start/auto/run/LetteringSocketConnectionAutoRun.java b/nladmin-system/src/main/java/org/nl/start/auto/run/LetteringSocketConnectionAutoRun.java index 2ad8649..ea0c5c0 100644 --- a/nladmin-system/src/main/java/org/nl/start/auto/run/LetteringSocketConnectionAutoRun.java +++ b/nladmin-system/src/main/java/org/nl/start/auto/run/LetteringSocketConnectionAutoRun.java @@ -2,6 +2,7 @@ package org.nl.start.auto.run; import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; +import net.sf.json.JSONObject; import org.nl.acs.config.AcsConfig; import org.nl.acs.config.server.AcsConfigService; import org.nl.acs.config.server.impl.AcsConfigServiceImpl; @@ -76,7 +77,8 @@ public class LetteringSocketConnectionAutoRun extends AbstractAutoRunnable { // if (StrUtil.equals(bs.toString(), "MSG 3")) { // // } - if (StrUtil.equals(bs.toString(), "OK")) { +// if (StrUtil.equals(bs.toString(), "OK")) { + if(bs.toString().contains("OK")){ HaiLiangFeedingTrunkDeviceDriver haiLiangFeedingTrunkDeviceDriver; List deviceAll = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class); if (deviceAll.get(0) instanceof HaiLiangFeedingTrunkDeviceDriver) { @@ -148,6 +150,10 @@ public class LetteringSocketConnectionAutoRun extends AbstractAutoRunnable { public static void main(String[] args) throws UnsupportedEncodingException { - byte[] bytes = "你".getBytes("utf-8"); + JSONObject jo = new JSONObject(); + jo.put("x",10.0); + jo.put("y",3.0); + jo.put("angle",0); + System.out.println(bytesToHexString(stringToByte(jo.toString()))); } } diff --git a/nladmin-system/src/main/resources/config/application-dev.yml b/nladmin-system/src/main/resources/config/application-dev.yml index ad6a5e3..b3b5105 100644 --- a/nladmin-system/src/main/resources/config/application-dev.yml +++ b/nladmin-system/src/main/resources/config/application-dev.yml @@ -8,12 +8,12 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_zgbz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - #url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_zgbz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + #url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_zgbz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.1.90}:${DB_PORT:3306}/${DB_NAME:hl_zgbz_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true username: ${DB_USER:root} #password: ${DB_PWD:P@ssw0rd} - password: ${DB_PWD:Root.123456} - #password: ${DB_PWD:123456} + #password: ${DB_PWD:Root.123456} + password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 # 最小连接数 diff --git a/qd/src/api/acs/order/order.js b/qd/src/api/acs/order/order.js index 67bf528..a672ec9 100644 --- a/qd/src/api/acs/order/order.js +++ b/qd/src/api/acs/order/order.js @@ -83,6 +83,21 @@ export function order_pause(data) { }) } +export function send_letteringMess(data) { + return request({ + url: 'api/produceshiftorder/send_letteringMess', + method: 'post', + data + }) +} + +export function send_labelingMess(data) { + return request({ + url: 'api/produceshiftorder/send_labelingMess', + method: 'post', + data + }) +} export function order_force_complete(data) { return request({ url: 'api/produceshiftorder/order_force_complete', @@ -114,6 +129,13 @@ export function selectTemplateList() { }) } +export function selectColortypeList() { + return request({ + url: 'api/produceshiftorder/selectColortypeList', + method: 'get' + }) +} + export function reload() { return request({ url: 'api/produceshiftorder/reload', @@ -122,4 +144,4 @@ export function reload() { } export default { add, edit, del, importExcel, getDtl, send, device_pause, device_restore, clear, stop, order_pause, order_force_complete, detail_pause, detail_force_complete, - selectTemplateList, reload } + selectTemplateList, selectColortypeList, reload, send_letteringMess, send_labelingMess } diff --git a/qd/src/views/acs/order/AddDialog.vue b/qd/src/views/acs/order/AddDialog.vue index b0673ca..403e7ad 100644 --- a/qd/src/views/acs/order/AddDialog.vue +++ b/qd/src/views/acs/order/AddDialog.vue @@ -94,16 +94,16 @@ :header-cell-style="{background:'#f5f7fa',color:'#606266'}" > - -