更新
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
package org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine;
|
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.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -176,8 +178,15 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
case 2:
|
case 2:
|
||||||
break;
|
break;
|
||||||
case 4:
|
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;
|
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() {
|
public boolean exe_business() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1067,8 +1067,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
|||||||
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
||||||
this.writing(this.mode);
|
this.writing(this.mode);
|
||||||
}
|
}
|
||||||
|
this.setRequireSucess(true);
|
||||||
}
|
}
|
||||||
this.setRequireSucess(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1086,8 +1086,12 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("device_code",this.device_code);
|
this.instruction_require_time = date;
|
||||||
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<String> 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("vehicle_code",barcode);
|
||||||
json.put("is_full","0");
|
json.put("is_full","0");
|
||||||
json.put("product_code",product_code);
|
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")) {
|
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
||||||
this.writing(this.mode);
|
this.writing(this.mode);
|
||||||
}
|
}
|
||||||
|
this.setRequireSucess(true);
|
||||||
}
|
}
|
||||||
this.setRequireSucess(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ import org.openscada.opc.lib.da.Server;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 荣力嘉耐-包装码拆垛机械手
|
* 荣力嘉耐-包装码拆垛机械手
|
||||||
@@ -706,6 +703,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
|||||||
if (!requireSucess) {
|
if (!requireSucess) {
|
||||||
applyEmpty();
|
applyEmpty();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
//工单完成
|
//工单完成
|
||||||
if (!requireSucess && !order_No.equals("0")) {
|
if (!requireSucess && !order_No.equals("0")) {
|
||||||
@@ -837,18 +835,18 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
|||||||
if (ObjectUtil.isNotEmpty(result)) {
|
if (ObjectUtil.isNotEmpty(result)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||||
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
||||||
this.writing(this.mode);
|
|
||||||
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
||||||
if (this.mode == 4) {
|
if (this.mode == 4) {
|
||||||
dto.setOrder_status("0");
|
dto.setOrder_status("1");
|
||||||
} else if (this.mode == 9){
|
} else if (this.mode == 9){
|
||||||
dto.setOrder_status("2");
|
dto.setOrder_status("2");
|
||||||
}
|
}
|
||||||
produceshiftorderService.update(dto);
|
produceshiftorderService.update(dto);
|
||||||
|
this.writing(this.mode);
|
||||||
|
this.setRequireSucess(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setRequireSucess(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1015,8 +1013,12 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("device_code",this.device_code);
|
this.instruction_require_time = date;
|
||||||
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<String> 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("vehicle_code",barcode);
|
||||||
json.put("is_full","1");
|
json.put("is_full","1");
|
||||||
json.put("product_code",product_code);
|
json.put("product_code",product_code);
|
||||||
@@ -1103,8 +1105,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("device_code",this.device_code);
|
String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code");
|
||||||
json.put("qty",qty);
|
String demosub = linkobj.substring(1,linkobj.length()-1);
|
||||||
|
String demoArray[] = demosub.split(",");
|
||||||
|
List<String> 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("vehicle_code",barcode);
|
||||||
json.put("is_full","0");
|
json.put("is_full","0");
|
||||||
json.put("product_code",product_code);
|
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")) {
|
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
||||||
this.writing(this.mode);
|
this.writing(this.mode);
|
||||||
}
|
}
|
||||||
|
this.setRequireSucess(true);
|
||||||
}
|
}
|
||||||
this.setRequireSucess(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1191,18 +1196,20 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe
|
|||||||
} else {
|
} else {
|
||||||
this.instruction_require_time = date;
|
this.instruction_require_time = date;
|
||||||
JSONObject json = new JSONObject();
|
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<String> demoList = Arrays.asList(demoArray);
|
||||||
|
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
|
||||||
json.put("type","4");
|
json.put("type","4");
|
||||||
json.put("qty",qty);
|
|
||||||
json.put("vehicle_code",barcode);
|
|
||||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||||
if (ObjectUtil.isNotEmpty(result)) {
|
if (ObjectUtil.isNotEmpty(result)) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||||
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
||||||
this.writing(this.mode);
|
this.writing(this.mode);
|
||||||
|
this.setRequireSucess(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setRequireSucess(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
|
|
||||||
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
|
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
|
||||||
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
|
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
|
||||||
|
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
|
||||||
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
|
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
|
||||||
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
|
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
|
||||||
if (StrUtil.isEmpty(qty)) {
|
if (StrUtil.isEmpty(qty)) {
|
||||||
@@ -312,8 +313,21 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code", material_code);
|
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code", material_code);
|
||||||
is_flag = true;
|
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();
|
ProduceshiftorderDto dto = new ProduceshiftorderDto();
|
||||||
dto.setOrder_code(producetask_code);
|
dto.setOrder_code(producetask_code);
|
||||||
dto.setProduct_code(product_code);
|
dto.setProduct_code(product_code);
|
||||||
@@ -328,7 +342,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
dto.setWeight(weight);
|
dto.setWeight(weight);
|
||||||
dto.setQty(qty);
|
dto.setQty(qty);
|
||||||
produceshiftorderService.create(dto);
|
produceshiftorderService.create(dto);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject resultJson = new JSONObject();
|
JSONObject resultJson = new JSONObject();
|
||||||
|
|||||||
Reference in New Issue
Block a user