嘉耐业务更新

This commit is contained in:
loujf
2022-09-27 09:35:23 +08:00
parent c8e3d6b5f4
commit 7dab1570a5
6 changed files with 49 additions and 17 deletions

View File

@@ -222,7 +222,7 @@ public interface DeviceService {
*
* @param device_id
*/
net.sf.json.JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code);
JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code);
/**
* DB测试读

View File

@@ -1143,15 +1143,15 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
@Override
public net.sf.json.JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
final net.sf.json.JSONObject extraObj = new net.sf.json.JSONObject();
DeviceDto dto = this.findById(device_id);
if (ObjectUtil.isNull(dto)) {
return new net.sf.json.JSONObject();
return new JSONObject();
}
log.info("判断设备是否配置过驱动!");
//处理设备扩展属性
net.sf.json.JSONObject result = new net.sf.json.JSONObject();
JSONObject result = new JSONObject();
//根据设备驱动定义获取OPC读写数据
DeviceDriverDefination deviceDriverDefination = deviceDriverDefinationAppService.getDeviceDriverDefination(driver_code);

View File

@@ -260,7 +260,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("type","5");
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
HttpResponse result = acsToWmsService.inKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -288,7 +288,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("type","5");
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -317,7 +317,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
json.put("task_code",inst.getTask_code());
HttpResponse result = acsToWmsService.applyIntoKiln(json);
@@ -349,7 +349,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
HttpResponse result = acsToWmsService.outKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -373,6 +373,10 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i
this.executing(1, instruction, "");
}
public String autoGenericCode(String vehicle_code) {
return String.format("%0" + 4 + "d", Integer.parseInt(vehicle_code));
}
public void executing(int command, Instruction instruction, String appendMessage) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;

View File

@@ -899,7 +899,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
String demoArray[] = demosub.split(",");
List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
HttpResponse result = acsToWmsService.queryCribbingInfo(json);
if (ObjectUtil.isNotEmpty(result)) {
@@ -1063,7 +1063,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
json.put("qty",two_qty);
}
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
json.put("is_full","1");
json.put("product_code",product_code);
json.put("AlongSide",AlongSide);
@@ -1162,7 +1162,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
} else if (put_station == 2) {
json.put("qty",two_qty);
}
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
json.put("is_full",type);
json.put("product_code",product_code);
json.put("AlongSide",AlongSide);
@@ -1303,6 +1303,10 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
}
public String autoGenericCode(String vehicle_code) {
return String.format("%0" + 4 + "d", Integer.parseInt(vehicle_code));
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()

View File

@@ -24,6 +24,7 @@ import org.nl.acs.opc.Device;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.exception.BadRequestException;
import org.nl.exception.WDKException;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.core.bean.WQLObject;
@@ -355,7 +356,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
json.put("device_code",this.device_code);
json.put("type","2");
json.put("pcsn",batch);
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
json.put("is_full","0");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
@@ -385,7 +386,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
json.put("task_code",inst.getTask_code());
HttpResponse result = acsToWmsService.applyIntoKiln(json);
@@ -527,7 +528,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("type","5");
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
HttpResponse result = acsToWmsService.inKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -584,7 +585,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
this.instruction_require_time = date;
JSONObject json = new JSONObject();
json.put("device_code",this.device_code);
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
HttpResponse result = acsToWmsService.outKiln(json);
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSONObject.parseObject(result.body());
@@ -616,7 +617,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
json.put("device_code",this.device_code);
json.put("type",type);
json.put("material",material);
json.put("vehicle_code",barcode);
json.put("vehicle_code",this.autoGenericCode(String.valueOf(barcode)));
json.put("is_full","1");
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
if (ObjectUtil.isNotEmpty(result)) {
@@ -644,6 +645,10 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
return true;
}
public String autoGenericCode(String vehicle_code) {
return String.format("%0" + 4 + "d", Integer.parseInt(vehicle_code));
}
protected void executing(Instruction instruction) {
this.executing(1, instruction, "");
}

View File

@@ -56,6 +56,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final DeviceAppService DeviceAppService;
private final RouteLineService RouteLineService;
private final ProduceshiftorderService produceshiftorderService;
private final DeviceAppService appService;
private String log_file_type = "log_file_type";
private String log_type = "WMS下发ACS";
@@ -266,7 +267,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONObject json = orders.getJSONObject(i);
String producetask_code = json.getString("producetask_code");
String device_code = json.getString("device_code");
String product_code = json.getString("product_code");
String material_code = json.getString("material_code");
String material_name = json.getString("material_name");
String vehicle_type = json.getString("vehicle_type");
@@ -276,6 +276,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String molten_pool = json.getString("molten_pool");
String weight = json.getString("weight");
String qty = json.getString("plan_qty");
String product_code = json.getString("product_code");
String AlongSide = json.getString("AlongSide");
String BshortSide = json.getString("BshortSide");
String Htrapezoidal = json.getString("Htrapezoidal");
String Wthickness = json.getString("Wthickness");
if (StrUtil.isEmpty(producetask_code)) {
throw new WDKException("工单号不能为空");
@@ -319,8 +324,22 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
lnshSplitManipulatorDeviceDriver.writing("to_order_No", producetask_code);
lnshSplitManipulatorDeviceDriver.writing("to_order_qty", qty);
lnshSplitManipulatorDeviceDriver.writing("to_material_code", material_code);
lnshSplitManipulatorDeviceDriver.writing("to_product_code", product_code);
lnshSplitManipulatorDeviceDriver.writing("to_AlongSide", AlongSide);
lnshSplitManipulatorDeviceDriver.writing("to_BshortSide", BshortSide);
lnshSplitManipulatorDeviceDriver.writing("to_Htrapezoidal", Htrapezoidal);
lnshSplitManipulatorDeviceDriver.writing("to_Wthickness", Wthickness);
lnshSplitManipulatorDeviceDriver.writing(3);
is_flag = true;
//此时也下发给码垛机械手一份垛型参数
List<LnshPackagePalletManipulatorDeviceDriver> deviceDriver = appService.findDeviceDriver(LnshPackagePalletManipulatorDeviceDriver.class);
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver1 = deviceDriver.get(0);
lnshPackagePalletManipulatorDeviceDriver1.writing("to_product_code", product_code);
lnshPackagePalletManipulatorDeviceDriver1.writing("to_AlongSide", AlongSide);
lnshPackagePalletManipulatorDeviceDriver1.writing("to_BshortSide", BshortSide);
lnshPackagePalletManipulatorDeviceDriver1.writing("to_Htrapezoidal", Htrapezoidal);
lnshPackagePalletManipulatorDeviceDriver1.writing("to_Wthickness", Wthickness);
}
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();