更新
This commit is contained in:
@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -276,16 +277,19 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
||||
if (this.mode == 4) {
|
||||
dto.setOrder_status("2");
|
||||
} else if (this.mode == 3){
|
||||
dto.setOrder_status("0");
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
||||
if (this.mode == 3) {
|
||||
dto.setOrder_status("1");
|
||||
} else if (this.mode == 4) {
|
||||
dto.setOrder_status("2");
|
||||
}
|
||||
produceshiftorderService.update(dto);
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
produceshiftorderService.update(dto);
|
||||
requireSucess = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,10 +31,7 @@ import org.nl.wql.core.bean.WQLObject;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 晟华码垛机械手
|
||||
@@ -599,12 +596,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
@@ -882,9 +874,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
this.writing("to_one_qty",one_qty);
|
||||
this.writing("to_two_qty",two_qty);
|
||||
this.writing("to_tool_coordinate",tool_coordinate);
|
||||
|
||||
}
|
||||
requireSucess = true;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -902,7 +894,11 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
} 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<String> demoList = Arrays.asList(demoArray);
|
||||
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
|
||||
json.put("qty",encoder_qty);
|
||||
json.put("vehicle_code",barcode);
|
||||
json.put("is_full","1");
|
||||
@@ -968,8 +964,8 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1053,8 +1049,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
|
||||
}
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1072,16 +1069,20 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
} 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<String> demoList = Arrays.asList(demoArray);
|
||||
json.put("device_code",demoList.get(put_station-1).replace("\"",""));
|
||||
json.put("type","4");
|
||||
json.put("qty",encoder_qty);
|
||||
json.put("vehicle_code",barcode);
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.lnsh.lnsh_press;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -197,12 +198,8 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "未联机";
|
||||
@@ -303,17 +300,20 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
||||
if (this.mode == 4) {
|
||||
dto.setOrder_status("2");
|
||||
} else if (this.mode == 3){
|
||||
dto.setOrder_status("0");
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) {
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
||||
if (this.mode == 3) {
|
||||
dto.setOrder_status("1");
|
||||
} else if (this.mode == 4) {
|
||||
dto.setOrder_status("2");
|
||||
}
|
||||
produceshiftorderService.update(dto);
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
produceshiftorderService.update(dto);
|
||||
}
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,11 +181,6 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
//急停
|
||||
if (this.isStop()) {
|
||||
|
||||
//未在线无心跳
|
||||
} else if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
@@ -227,6 +222,12 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
putStorage();
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
//申请出窑分配
|
||||
if (!requireSucess && this.move != 0) {
|
||||
applyOuttoKiln();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
@@ -294,13 +295,12 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
json.put("type","2");
|
||||
json.put("weight",weight);
|
||||
json.put("vehicle_code",barcode);
|
||||
json.put("is_full","0");
|
||||
json.put("is_full","1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
|
||||
requireSucess = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -334,6 +334,34 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请出窑去包装
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyOuttoKiln() {
|
||||
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.applyOuttoKiln(json);
|
||||
if (result.getStatus() == 200) {
|
||||
JSONObject jo = JSONObject.parseObject(result.body());
|
||||
String is_package = jo.getString("is_package");
|
||||
this.writing(2,Integer.parseInt(is_package));
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
return true;
|
||||
|
||||
@@ -25,6 +25,13 @@ public interface AcsToWmsService {
|
||||
*/
|
||||
HttpResponse applyIntoKiln(JSONObject json);
|
||||
|
||||
/**
|
||||
* 申请出窑去包装
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
HttpResponse applyOuttoKiln(JSONObject json);
|
||||
|
||||
/**
|
||||
* ACS向WMS申请机械手任务
|
||||
*/
|
||||
|
||||
@@ -142,7 +142,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse applyOuttoKiln(JSONObject json) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL);
|
||||
AddressDto addressDto = addressService.findByCode("ispackage");
|
||||
String url = wmsurl + addressDto.getMethods_url();
|
||||
|
||||
String device_code = json.getString("device_code");
|
||||
|
||||
String parent_device_code = "";
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0);
|
||||
if (!device_json.isEmpty()) {
|
||||
parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell");
|
||||
}
|
||||
jo.put("device_code", parent_device_code);
|
||||
jo.putAll(json);
|
||||
|
||||
log.info("applyOuttoKiln-----请求参数{}", jo.toString());
|
||||
HttpResponse result2 = null;
|
||||
try {
|
||||
//{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"}
|
||||
result2 = HttpRequest.post(url)
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(jo))
|
||||
.execute();
|
||||
System.out.println(result2);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
}
|
||||
log.info("applyOuttoKiln-----输出参数{}", result2.body());
|
||||
return result2;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse applyIntoKiln(JSONObject json) {
|
||||
@@ -185,6 +224,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResponse lnshApplyTaskToWms(JSONObject json) {
|
||||
try {
|
||||
|
||||
@@ -12,9 +12,11 @@ import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_kiln_lane.LnshKilnLaneDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_labeling_machine.LnshLabelingMachineDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator.LnshPackagePalletManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator.LnshPalletizingManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_press.LnshPressDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_rgv.LnshRGVDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.LnshSplitManipulatorDeviceDriver;
|
||||
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
|
||||
@@ -254,109 +256,104 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> createOrder(String param) throws Exception {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
JSONArray orders = JSONArray.parseArray(param);
|
||||
log.info("createOrder--------------:输入参数:" + orders.toString());
|
||||
JSONArray orders = JSONArray.parseArray(param);
|
||||
log.info("createOrder--------------:输入参数:" + orders.toString());
|
||||
|
||||
for (int i = 0; i < orders.size(); i++) {
|
||||
Boolean is_flag = false;
|
||||
for (int i = 0; i < orders.size(); i++) {
|
||||
Boolean is_flag = false;
|
||||
|
||||
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 cust_code = json.getString("cust_code");
|
||||
String cust_name = json.getString("cust_name");
|
||||
String model = json.getString("model");
|
||||
String molten_pool = json.getString("molten_pool");
|
||||
String weight = json.getString("weight");
|
||||
String qty = json.getString("plan_qty");
|
||||
JSONObject json = orders.getJSONObject(i);
|
||||
String producetask_code = json.getString("producetask_code");
|
||||
String device_code = json.getString("device_code");
|
||||
String material_code = json.getString("material_code");
|
||||
String material_name = json.getString("material_name");
|
||||
String cust_code = json.getString("cust_code");
|
||||
String cust_name = json.getString("cust_name");
|
||||
String model = json.getString("model");
|
||||
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");
|
||||
|
||||
if (StrUtil.isEmpty(producetask_code)) {
|
||||
throw new WDKException("工单号不能为空");
|
||||
}
|
||||
|
||||
Device device = DeviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
|
||||
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
|
||||
LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver;
|
||||
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
|
||||
lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
|
||||
if (StrUtil.isEmpty(qty)) {
|
||||
throw new WDKException("数量不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
throw new WDKException("物料编号不能为空!");
|
||||
}
|
||||
lnshPalletizingManipulatorDeviceDriver.writing("to_order_No", producetask_code);
|
||||
lnshPalletizingManipulatorDeviceDriver.writing("to_material_qty", qty);
|
||||
lnshPalletizingManipulatorDeviceDriver.writing("to_material_code", material_code);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
|
||||
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
|
||||
if (StrUtil.isEmpty(qty)) {
|
||||
throw new WDKException("数量不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
throw new WDKException("物料编号不能为空!");
|
||||
}
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_order_No", producetask_code);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_qty", qty);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code", material_code);
|
||||
is_flag = true;
|
||||
}
|
||||
|
||||
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);
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setOrder_status("1");
|
||||
dto.setMaterial_code(material_code);
|
||||
dto.setMaterial_name(material_name);
|
||||
dto.setCust_code(cust_code);
|
||||
dto.setCust_name(cust_name);
|
||||
dto.setModel(model);
|
||||
dto.setMolten_pool(molten_pool);
|
||||
dto.setWeight(weight);
|
||||
dto.setQty(qty);
|
||||
produceshiftorderService.create(dto);
|
||||
if (StrUtil.isEmpty(producetask_code)) {
|
||||
throw new WDKException("工单号不能为空");
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("createOrder--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
Device device = DeviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new Exception("未找到对应设备:" + device_code);
|
||||
}
|
||||
|
||||
LnshMixingMillDeviceDriver lnshMixingMillDeviceDriver;
|
||||
LnshPressDeviceDriver lnshPressDeviceDriver;
|
||||
LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver) {
|
||||
lnshMixingMillDeviceDriver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
|
||||
if (StrUtil.isEmpty(qty)) {
|
||||
throw new WDKException("重量不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
throw new WDKException("物料编号不能为空!");
|
||||
}
|
||||
lnshMixingMillDeviceDriver.writing("to_order_No",producetask_code);
|
||||
lnshMixingMillDeviceDriver.writing("to_weight",qty);
|
||||
lnshMixingMillDeviceDriver.writing("to_material_code",material_code);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
|
||||
lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver();
|
||||
if (StrUtil.isEmpty(qty)) {
|
||||
throw new WDKException("数量不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
throw new WDKException("物料编号不能为空!");
|
||||
}
|
||||
lnshPressDeviceDriver.writing("to_order_No",producetask_code);
|
||||
lnshPressDeviceDriver.writing("to_qty",qty);
|
||||
lnshPressDeviceDriver.writing("to_material_code",material_code);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
|
||||
lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
|
||||
if (StrUtil.isEmpty(qty)) {
|
||||
throw new WDKException("数量不能为空");
|
||||
}
|
||||
if (StrUtil.isEmpty(material_code)) {
|
||||
throw new WDKException("物料编号不能为空!");
|
||||
}
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_order_No",producetask_code);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_qty",qty);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code",material_code);
|
||||
is_flag = true;
|
||||
}
|
||||
//下发成功后,写入工单信息表记录
|
||||
|
||||
ProduceshiftorderDto dto = new ProduceshiftorderDto();
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setOrder_code(producetask_code);
|
||||
dto.setOrder_status("1");
|
||||
dto.setMaterial_code(material_code);
|
||||
dto.setMaterial_name(material_name);
|
||||
dto.setCust_code(cust_code);
|
||||
dto.setCust_name(cust_name);
|
||||
dto.setModel(model);
|
||||
dto.setMolten_pool(molten_pool);
|
||||
dto.setWeight(weight);
|
||||
dto.setQty(qty);
|
||||
dto.setProduct_code(product_code);
|
||||
produceshiftorderService.create(dto);
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", HttpStatus.OK);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("createOrder--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> updateDeviceGoodsFromWms(String param) {
|
||||
try {
|
||||
|
||||
@@ -178,7 +178,7 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
||||
|
||||
}
|
||||
//设置值
|
||||
// accessor_value.setValue(item.getId(), value);
|
||||
accessor_value.setValue(item.getId(), value);
|
||||
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
|
||||
redisUtils.set(item.getId(), value);
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
Map<String, OpcServerManageDto> servers = this.opcServerManageService.queryAllServerMap();
|
||||
Map<String, List<List<OpcItemDto>>> pros;
|
||||
do{
|
||||
Thread.sleep(1000L);
|
||||
pros = this.deviceAppService.findAllFormatProtocolFromDriver();
|
||||
}while (ObjectUtil.isEmpty(pros));
|
||||
do{
|
||||
Thread.sleep(1000L);
|
||||
pros = this.deviceAppService.findAllFormatProtocolFromDriver();
|
||||
}while (ObjectUtil.isEmpty(pros));
|
||||
Set<String> keys = pros.keySet();
|
||||
Iterator var4 = keys.iterator();
|
||||
System.out.println("test:" + var4.hasNext());
|
||||
|
||||
@@ -335,105 +335,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
dto.setMaterial(startdevice.getMaterial_type());
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
if (StrUtil.equals(createTaskCheck, "1")) {
|
||||
//判断起点为输送设备
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
||||
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) {
|
||||
throw new Exception("任务起点需满足待机有货!");
|
||||
}
|
||||
if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) {
|
||||
dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial());
|
||||
}
|
||||
}
|
||||
if (startdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
if (startdevice.getHas_goods() == 0) {
|
||||
throw new Exception("任务起点需满足有货!");
|
||||
}
|
||||
if (!StrUtil.isEmpty(standardOrdinarySiteDeviceDriver.getMaterial())) {
|
||||
dto.setMaterial(standardOrdinarySiteDeviceDriver.getMaterial());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||
if (nextdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
if (nextdevice.getHas_goods() != 0) {
|
||||
throw new Exception("任务终点需满足无货!");
|
||||
}
|
||||
}
|
||||
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) {
|
||||
throw new Exception("任务终点需满足待机无货!");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//判断起点为输送设备
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
||||
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) {
|
||||
throw new Exception("任务起点需满足待机有货!");
|
||||
}
|
||||
if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) {
|
||||
dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||
// if (nextdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
// if (nextdevice.getHas_goods() != 0) {
|
||||
// throw new Exception("任务终点需满足无货!");
|
||||
// }
|
||||
// }
|
||||
|
||||
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
|
||||
if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) {
|
||||
throw new Exception("任务终点需满足待机无货!");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject jo2 = new JSONObject();
|
||||
if (!StrUtil.isEmpty(dto.getMaterial())) {
|
||||
if (!StrUtil.equals(dto.getMaterial(), "1")) {
|
||||
jo.put("hasGoodStatus", "2");
|
||||
jo.put("material_type", dto.getMaterial());
|
||||
} else {
|
||||
jo.put("hasGoodStatus", "1");
|
||||
jo.put("material_type", "1");
|
||||
}
|
||||
|
||||
} else {
|
||||
jo.put("hasGoodStatus", "1");
|
||||
jo.put("material_type", "1");
|
||||
}
|
||||
jo.put("device_code", dto.getStart_device_code());
|
||||
jo.put("quantity", dto.getQuantity());
|
||||
jo.put("remark", dto.getRemark());
|
||||
jo.put("batch", startdevice.getBatch());
|
||||
jo.put("islock", "true");
|
||||
deviceService.changeDeviceStatus(jo);
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code());
|
||||
jo2.put("device_code", dto.getNext_device_code());
|
||||
jo2.put("hasGoodStatus", deviceByCode.getHas_goods());
|
||||
jo2.put("quantity", deviceByCode.getQuantity());
|
||||
jo2.put("remark", deviceByCode.getRemark());
|
||||
jo2.put("material_type", deviceByCode.getMaterial_type());
|
||||
jo2.put("batch", deviceByCode.getBatch());
|
||||
jo2.put("islock", "true");
|
||||
deviceService.changeDeviceStatus(jo2);
|
||||
}
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--开发环境:打印控制台-->
|
||||
<springProfile name="dev">
|
||||
<root level="error">
|
||||
<root level="info">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="lokiAppender" />
|
||||
</root>
|
||||
|
||||
Reference in New Issue
Block a user