diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/device.xls b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/device.xls index fdaae6e..9fded1e 100644 Binary files a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/device.xls and b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/device.xls differ diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java index fc916c1..30fb0a8 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java @@ -1,6 +1,8 @@ package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -176,8 +178,15 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i case 2: break; case 4: - if (!requireSucess) { - getVehicle_code(); + //申请入窑 + if(move ==1 && !requireSucess && StrUtil.isNotEmpty(this.barcode)){ + applyIn(); + } + break; + case 5: + //申请出窑 + if (!requireSucess && this.move != 0 && StrUtil.isNotEmpty(this.barcode)) { + outKiln(); } break; } @@ -212,6 +221,64 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i } } + /** + * 申请入窑 + * + * @param + */ + public synchronized boolean applyIn() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + JSONObject json = new JSONObject(); + json.put("device_code",this.device_code); + json.put("type","5"); + json.put("vehicle_code",barcode); + HttpResponse result = acsToWmsService.inKiln(json); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) { + this.writing(1); + this.setRequireSucess(true); + } + } + return true; + } + } + + /** + * 申请出窑 + * + * @param + */ + public synchronized boolean outKiln() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + JSONObject json = new JSONObject(); + json.put("device_code",this.device_code); + json.put("vehicle_code",barcode); + HttpResponse result = acsToWmsService.outKiln(json); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.get("status").toString(),"200")) { + String code = jsonObject.getString("code"); + this.writing(1); + this.writing(2,Integer.parseInt(code)); + this.setRequireSucess(true); + } + } + return true; + } + } + + public boolean exe_business() { return true; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java index 3f0fd48..ea15531 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java @@ -1067,8 +1067,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { this.writing(this.mode); } + this.setRequireSucess(true); } - this.setRequireSucess(true); return true; } } @@ -1086,8 +1086,12 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD } else { this.instruction_require_time = date; JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("qty",qty); + this.instruction_require_time = date; + String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); + String demosub = linkobj.substring(1,linkobj.length()-1); + String demoArray[] = demosub.split(","); + List demoList = Arrays.asList(demoArray); + json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("qty",qty); json.put("vehicle_code",barcode); json.put("is_full","0"); json.put("product_code",product_code); @@ -1155,8 +1159,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { this.writing(this.mode); } + this.setRequireSucess(true); } - this.setRequireSucess(true); return true; } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java index 75adc0a..c64fda9 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java @@ -27,10 +27,7 @@ import org.openscada.opc.lib.da.Server; import org.springframework.beans.factory.annotation.Autowired; import java.lang.reflect.Field; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 荣力嘉耐-包装码拆垛机械手 @@ -706,6 +703,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe if (!requireSucess) { applyEmpty(); } + break; case 9: //工单完成 if (!requireSucess && !order_No.equals("0")) { @@ -837,18 +835,18 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe if (ObjectUtil.isNotEmpty(result)) { JSONObject jsonObject = JSONObject.parseObject(result.body()); if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { - this.writing(this.mode); ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); if (this.mode == 4) { - dto.setOrder_status("0"); + dto.setOrder_status("1"); } else if (this.mode == 9){ dto.setOrder_status("2"); } produceshiftorderService.update(dto); + this.writing(this.mode); + this.setRequireSucess(true); } } - this.setRequireSucess(true); return true; } } @@ -1015,8 +1013,12 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe } else { this.instruction_require_time = date; JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("qty",qty); + this.instruction_require_time = date; + String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); + String demosub = linkobj.substring(1,linkobj.length()-1); + String demoArray[] = demosub.split(","); + List demoList = Arrays.asList(demoArray); + json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("qty",qty); json.put("vehicle_code",barcode); json.put("is_full","1"); json.put("product_code",product_code); @@ -1103,8 +1105,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe } else { this.instruction_require_time = date; JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); - json.put("qty",qty); + String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); + String demosub = linkobj.substring(1,linkobj.length()-1); + String demoArray[] = demosub.split(","); + List demoList = Arrays.asList(demoArray); + json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("qty",qty); json.put("vehicle_code",barcode); json.put("is_full","0"); json.put("product_code",product_code); @@ -1172,8 +1177,8 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { this.writing(this.mode); } + this.setRequireSucess(true); } - this.setRequireSucess(true); return true; } } @@ -1191,18 +1196,20 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe } else { this.instruction_require_time = date; JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); + String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); + String demosub = linkobj.substring(1,linkobj.length()-1); + String demoArray[] = demosub.split(","); + List demoList = Arrays.asList(demoArray); + json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("type","4"); - json.put("qty",qty); - json.put("vehicle_code",barcode); HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); if (ObjectUtil.isNotEmpty(result)) { JSONObject jsonObject = JSONObject.parseObject(result.body()); if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { this.writing(this.mode); + this.setRequireSucess(true); } } - this.setRequireSucess(true); return true; } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 6e0cd2e..c485b58 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -286,6 +286,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver; LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver; + RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver; if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) { lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver(); if (StrUtil.isEmpty(qty)) { @@ -312,8 +313,21 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code", material_code); is_flag = true; } - //下发成功后,写入工单信息表记录 - if (is_flag) { + + if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) { + rljnPackagePalletSplitManipulatorDeviceDriver = (RljnPackagePalletSplitManipulatorDeviceDriver) device.getDeviceDriver(); + if (StrUtil.isEmpty(qty)) { + throw new WDKException("数量不能为空"); + } + if (StrUtil.isEmpty(material_code)) { + throw new WDKException("物料编号不能为空!"); + } + rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_order_No", producetask_code); + rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_material_qty", qty); + rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_material_code", material_code); + is_flag = true; + } + //下发成功后,写入工单信息表记录 ProduceshiftorderDto dto = new ProduceshiftorderDto(); dto.setOrder_code(producetask_code); dto.setProduct_code(product_code); @@ -328,7 +342,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { dto.setWeight(weight); dto.setQty(qty); produceshiftorderService.create(dto); - } } JSONObject resultJson = new JSONObject();