add 驱动
This commit is contained in:
@@ -23,4 +23,20 @@ public class AgvUtil {
|
||||
String nowAsISO = df.format(date);
|
||||
return nowAsISO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得之后num个天的时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getDate() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Date date = calendar.getTime();
|
||||
TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
df.setTimeZone(tz);
|
||||
String nowAsISO = df.format(date);
|
||||
return nowAsISO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,42 +43,45 @@ public enum DriverTypeEnum {
|
||||
|
||||
STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"),
|
||||
|
||||
LNSH_MIXING_MILL(37, "lnsh_mixing_mill", "晟华-混碾机", "station"),
|
||||
LNSH_MIXING_MILL(37, "lnsh_mixing_mill", "标准版-混碾机", "station"),
|
||||
|
||||
LNSH_PRESS(38, "lnsh_press", "晟华-压力机", "station"),
|
||||
LNSH_PRESS(38, "lnsh_press", "标准版-压力机", "station"),
|
||||
|
||||
LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "晟华-码垛机械手", "station"),
|
||||
LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "标准版-压制码垛机械手", "station"),
|
||||
|
||||
LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "晟华-进窑桁架", "station"),
|
||||
LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "标准版-进窑桁架", "station"),
|
||||
|
||||
LNSH_OUT_KILN_TRUSS(41, "lnsh_out_kiln_truss", "晟华-出窑桁架", "station"),
|
||||
LNSH_OUT_KILN_TRUSS(41, "lnsh_out_kiln_truss", "标准版-出窑桁架", "station"),
|
||||
|
||||
LNSH_KILN_LANE(42, "lnsh_kiln_lane", "晟华-窑车道", "station"),
|
||||
LNSH_KILN_LANE(42, "lnsh_kiln_lane", "标准版-窑车道", "station"),
|
||||
|
||||
LNSH_FOLD_DISC_SITE(43, "lnsh_fold_disc_site", "晟华-叠盘机", "station"),
|
||||
LNSH_FOLD_DISC_SITE(43, "lnsh_fold_disc_site", "标准版-叠盘机", "station"),
|
||||
|
||||
LNSH_PALLET_STORAGE(44, "lnsh_pallet_storage", "晟华-托盘存储线", "station"),
|
||||
LNSH_PALLET_STORAGE(44, "lnsh_pallet_storage", "标准版-托盘存储线", "station"),
|
||||
|
||||
LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "晟华-分拣机械手", "station"),
|
||||
LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "标准版-分拣机械手", "station"),
|
||||
|
||||
LNSH_LABELING_MACHINE(46, "lnsh_labeling_machine", "晟华-贴标机", "station"),
|
||||
LNSH_LABELING_MACHINE(46, "lnsh_labeling_machine", "标准版-贴标机", "station"),
|
||||
|
||||
LNSH_SPLIT_MANIPULATOR(47, "lnsh_split_manipulator", "晟华-拆垛机械手", "station"),
|
||||
LNSH_SPLIT_MANIPULATOR(47, "lnsh_split_manipulator", "标准版-拆垛机械手", "station"),
|
||||
|
||||
LNSH_RGV(48, "lnsh_rgv", "晟华-RGV", "rgv"),
|
||||
LNSH_RGV(48, "lnsh_rgv", "标准版-RGV", "rgv"),
|
||||
|
||||
LNSH_PACKAGE_LINE(49, "lnsh_package_line", "晟华-包装机", "station"),
|
||||
LNSH_PACKAGE_LINE(49, "lnsh_package_line", "标准版-包装机", "station"),
|
||||
|
||||
LNSH_STATION(50, "lnsh_station", "晟华-工位(交互模板)", "station"),
|
||||
LNSH_STATION(50, "lnsh_station", "标准版-工位(交互模板)", "station"),
|
||||
|
||||
LNSH_LAMINATING_MACHINE(51, "lnsh_Laminating_machine", "晟华-覆膜机", "station"),
|
||||
LNSH_LAMINATING_MACHINE(51, "lnsh_Laminating_machine", "标准版-覆膜机", "station"),
|
||||
|
||||
LNSH_PACKAGE_SITE(52, "lnsh_package_site", "晟华-包装线工位", "station"),
|
||||
LNSH_PACKAGE_SITE(52, "lnsh_package_site", "标准版-包装线工位", "station"),
|
||||
|
||||
LNSH_CRUSHER(53, "lnsh_crusher", "晟华-破碎机", "station"),
|
||||
LNSH_CRUSHER(53, "lnsh_crusher", "标准版-破碎机", "station"),
|
||||
|
||||
LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "晟华-机械手对接位", "station");
|
||||
LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "标准版-机械手对接位", "station"),
|
||||
|
||||
AGV_NDC_ONE(55, "agv_ndc_one", "NDC1楼AGV", "agv"),
|
||||
|
||||
AGV_NDC_TWO(56, "agv_ndc_two", "NDC2楼AGV", "agv");
|
||||
|
||||
//驱动索引
|
||||
private int index;
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.nl.acs.device.device_driver.standard_inspect.OpcPlcDto;
|
||||
import org.nl.acs.device.service.DeviceExtraService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceDto;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -247,6 +248,13 @@ public class DeviceController {
|
||||
return new ResponseEntity<>(DriverTypeEnum.getListByType(device.getDevice_type()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/selectRequestMethodList")
|
||||
@Log("下拉选设备请求方法")
|
||||
@ApiOperation("下拉选设备请求方法")
|
||||
public ResponseEntity<Object> selectRequestMethodList() {
|
||||
return new ResponseEntity<>(RequestMethodEnum.getList(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询")
|
||||
@GetMapping({"/{device_code}"})
|
||||
public ResponseEntity<Object> query(@PathVariable String device_code) {
|
||||
|
||||
@@ -197,6 +197,8 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device");
|
||||
WQLObject wo_extra = WQLObject.getWQLObject("acs_device_extra");
|
||||
|
||||
WQLObject storageTab = WQLObject.getWQLObject("acs_storage_cell");
|
||||
//路由路线表【acs_route_line】
|
||||
WQLObject routeLineTab = WQLObject.getWQLObject("acs_route_line");
|
||||
@@ -213,20 +215,21 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
if (!MapUtil.isEmpty(json)) {
|
||||
throw new BadRequestException("设备:【" + device_code + "】在路由已存在,无法删除!");
|
||||
}
|
||||
log.debug("删除舞台里面的设备!");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("device_id", "");
|
||||
map.put("device_code", "");
|
||||
map.put("device_name", "");
|
||||
stageActorTab.update(map, "device_code = '" + device_code + "'");
|
||||
|
||||
log.debug("根据设备编码查询在缓存里面的舞台数据,并删除掉!");
|
||||
JSONArray jsonArr = WQL.getWO("QStage_01").addParam("flag", "1").addParam("device_code", device_code).process().getResultJSONArray(0);
|
||||
for (int i = 0; i < jsonArr.size(); i++) {
|
||||
String stage_code = jsonArr.getJSONObject(i).getString("stage_code");
|
||||
redisUtils.del("stage:mst:" + stage_code);
|
||||
redisUtils.del("stage:dtl:" + stage_code);
|
||||
}
|
||||
// log.debug("删除舞台里面的设备!");
|
||||
// Map<String, String> map = new HashMap<>();
|
||||
// map.put("device_id", "");
|
||||
// map.put("device_code", "");
|
||||
// map.put("device_name", "");
|
||||
// stageActorTab.update(map, "device_code = '" + device_code + "'");
|
||||
|
||||
// log.debug("根据设备编码查询在缓存里面的舞台数据,并删除掉!");
|
||||
// JSONArray jsonArr = WQL.getWO("QStage_01").addParam("flag", "1").addParam("device_code", device_code).process().getResultJSONArray(0);
|
||||
// for (int i = 0; i < jsonArr.size(); i++) {
|
||||
// String stage_code = jsonArr.getJSONObject(i).getString("stage_code");
|
||||
// redisUtils.del("stage:mst:" + stage_code);
|
||||
// redisUtils.del("stage:dtl:" + stage_code);
|
||||
// }
|
||||
log.debug("删除缓存里面的设备!");
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(device_code);
|
||||
List<Device> allDevice = deviceAppService.findAllDevice();
|
||||
@@ -254,6 +257,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
}
|
||||
}
|
||||
wo.delete("device_id = '" + device_id + "'");
|
||||
wo_extra.delete("device_id = '" + device_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,6 +647,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
JSONObject parentForm = jsonObject.getJSONObject("parentForm");
|
||||
//得到扩展属性表字段记录
|
||||
JSONObject form = jsonObject.getJSONObject("form");
|
||||
JSONObject modeform = jsonObject.getJSONObject("modeform");
|
||||
//设备标识
|
||||
String device_id = parentForm.getString("device_id");
|
||||
String device_code = parentForm.getString("device_code");
|
||||
@@ -767,8 +772,8 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
}
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||
if (StrUtil.equals(device_type, "storage")) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||
int x = form.getInteger("x");
|
||||
int maxY = form.getInteger("maxY");
|
||||
int minY = form.getInteger("minY");
|
||||
@@ -794,6 +799,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
}
|
||||
} else {
|
||||
//空盘堆叠驱动 需要按照数量生成
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_storage_cell");
|
||||
if (StrUtil.equals(driver_code, "standard_emptypallet_site") && form.containsKey("max_emptypalletnum")) {
|
||||
int num = form.getInteger("max_emptypalletnum");
|
||||
for (int i = 1; i < num + 1; i++) {
|
||||
@@ -830,8 +836,33 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
}
|
||||
|
||||
}
|
||||
JSONArray tableData = new JSONArray();
|
||||
if(ObjectUtil.isNotEmpty(modeform)){
|
||||
tableData = modeform.getJSONArray("tableData");
|
||||
}
|
||||
|
||||
//deviceAppService.reload();
|
||||
if (tableData != null) {
|
||||
//设备扩展表【acs_device_extra】
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_device_extra");
|
||||
wo.delete("device_id = '" + device_id + "' and filed_type = '04'");
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject param = new JSONObject();
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
param.put("extra_id", IdUtil.simpleUUID());
|
||||
//heartbeat
|
||||
param.put("extra_code", json.getString("mode"));
|
||||
param.put("extra_name", json.getString("request"));
|
||||
param.put("remark", json.getString("mode"));
|
||||
param.put("order_seq", i + 1);
|
||||
//DB读
|
||||
param.put("filed_type", "04");
|
||||
param.put("device_id", device_id);
|
||||
param.put("device_code", device_code);
|
||||
param.put("create_by", SecurityUtils.getCurrentUsername());
|
||||
param.put("create_time", DateUtil.now());
|
||||
wo.insert(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1260,7 +1291,19 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSONArray modeRequest = WQLObject.getWQLObject("acs_device_extra").query("filed_type='04' and device_id = '" + device_id + "'", "order_seq").getResultJSONArray(0);
|
||||
JSONArray mq_arr = new JSONArray();
|
||||
for (int i = 0; i < modeRequest.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
String extra_code = modeRequest.getJSONObject(i).getString("extra_code");
|
||||
String extra_name = modeRequest.getJSONObject(i).getString("extra_name");
|
||||
jo.put("mode", extra_code);
|
||||
jo.put("request", extra_name);
|
||||
mq_arr.add(jo);
|
||||
}
|
||||
if (!mq_arr.isEmpty()) {
|
||||
result.put("modeform", mq_arr);
|
||||
}
|
||||
} else {
|
||||
//处理DB读和写属性
|
||||
// result.put("rs", ReadUtil.getReadableItemDtos());
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
LEFT JOIN acs_opc_plc plc ON d.opc_plc_id = plc.plc_id
|
||||
WHERE
|
||||
d.is_delete = '0'
|
||||
and e.filed_type != '01'
|
||||
and e.filed_type in ('02','03')
|
||||
OPTION 输入.blurry <> ""
|
||||
( d.device_code LIKE 输入.blurry or d.device_name LIKE 输入.blurry)
|
||||
ENDOPTION
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package org.nl.acs.device_driver;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 驱动类型
|
||||
* https://blog.csdn.net/moneyshi/article/details/82978073
|
||||
*/
|
||||
public enum RequestMethodEnum {
|
||||
order_verify(1, "order_verify", "人工排产确认"),
|
||||
|
||||
order_finish(2, "order_finish", "工单完成"),
|
||||
|
||||
apply_put_full_vehicle(3, "apply_put_full_vehicle", "申请补满料盅托盘(叫料)"),
|
||||
|
||||
apply_put_empty_vehicle(4, "apply_put_empty_vehicle", "申请补空料盅托盘(叫空盘)"),
|
||||
|
||||
apply_take_empty_vehicle(5, "apply_take_empty_vehicle", "申请取走空料盅托盘(取空盘)"),
|
||||
|
||||
apply_take_full_vehicle(6, "apply_take_full_vehicle", "申请取走满料盅托盘(入库)"),
|
||||
|
||||
apply_force_take_full_vehicle(7, "apply_force_take_full_vehicle", "申请强制取走满料盅托盘(强制入库)"),
|
||||
|
||||
apply_force_take_full_vehicle_in_storage(8, "apply_force_take_full_vehicle_in_storage", "申请强制满托入缓存"),
|
||||
|
||||
barcode_sucess_apply(9, "barcode_sucess_apply", "扫码成功申请"),
|
||||
|
||||
get_vehicle_info(10, "get_vehicle_info", "获取组盘信息"),
|
||||
|
||||
force_no_package(11, "force_no_package", "强制去包装位-不包装"),
|
||||
|
||||
apply_labelling(12, "apply_labelling", "申请贴标"),
|
||||
|
||||
apply_one_grab(13, "apply_one_grab", "单次放置完成");
|
||||
|
||||
|
||||
//驱动索引
|
||||
private int index;
|
||||
//驱动编码
|
||||
private String code;
|
||||
// 驱动名字
|
||||
private String name;
|
||||
//驱动描述
|
||||
private String desc;
|
||||
//设备驱动类型
|
||||
private String type;
|
||||
|
||||
// 构造方法
|
||||
RequestMethodEnum(int index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public static JSONArray getList() {
|
||||
JSONArray arr = new JSONArray();
|
||||
for (RequestMethodEnum em : RequestMethodEnum.values()) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", em.getCode());
|
||||
json.put("name", em.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static JSONArray getListByType(String type) {
|
||||
JSONArray arr = new JSONArray();
|
||||
for (RequestMethodEnum em : RequestMethodEnum.values()) {
|
||||
if (em.getType().equals(type)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", em.getCode());
|
||||
json.put("name", em.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static String getName(String code) {
|
||||
for (RequestMethodEnum c : RequestMethodEnum.values()) {
|
||||
if (c.code == code) {
|
||||
return c.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package org.nl.acs.device_driver;
|
||||
|
||||
public interface StandardRequestMethod {
|
||||
|
||||
/**
|
||||
* 人工排产确认
|
||||
* @return
|
||||
*/
|
||||
public default boolean order_verify() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 工单完成
|
||||
* @return
|
||||
*/
|
||||
public default boolean order_finish() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 申请补满料盅托盘
|
||||
* @return
|
||||
*/
|
||||
public default boolean apply_put_full_vehicle() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 申请补空料盅托盘
|
||||
* @return
|
||||
*/
|
||||
public default boolean apply_put_empty_vehicle() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 申请取走空料盅托盘
|
||||
* @return
|
||||
*/
|
||||
public default boolean apply_take_empty_vehicle() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 申请取走满料盅托盘(入库)
|
||||
* @return
|
||||
*/
|
||||
public default boolean apply_take_full_vehicle() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 申请强制取走满料盅托盘
|
||||
* @return
|
||||
*/
|
||||
public default boolean apply_force_take_full_vehicle() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 申请强制满托入缓存
|
||||
* @return
|
||||
*/
|
||||
public default boolean apply_force_take_full_vehicle_in_storage() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 扫码成功申请
|
||||
* @return
|
||||
*/
|
||||
public default boolean barcode_sucess_apply() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取组盘信息
|
||||
* @return
|
||||
*/
|
||||
public default boolean get_vehicle_info() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
/**
|
||||
* 强制去包装位-不包装
|
||||
* @return
|
||||
*/
|
||||
public default boolean force_no_package() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 申请贴标
|
||||
* @return
|
||||
*/
|
||||
public default boolean apply_labelling() {
|
||||
throw new RuntimeException("未实现");
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* NDC单工位AGV
|
||||
*/
|
||||
@Service
|
||||
public class AgvNdcOneDefination implements DeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "agv_ndc_one";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "NDC1楼AGV";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "NDC1楼AGV";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new AgvNdcOneDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return AgvNdcOneDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.agv);
|
||||
return types;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,426 @@
|
||||
package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||
|
||||
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;
|
||||
import org.mvel2.util.ErrorUtil;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.agv.utils.OneAgvPhase;
|
||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.start.auto.run.NDCSocketConnectionAutoRun;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* NDC单工位AGV
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor {
|
||||
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
|
||||
OneAgvPhase oneAgvPhase = new OneAgvPhase();
|
||||
|
||||
int agvaddr = 0;
|
||||
int agvaddr_copy = 0;
|
||||
int weight = 0;
|
||||
String device_code = "";
|
||||
int phase = 0;
|
||||
String error_type = "agv_error_type";
|
||||
String error_code = "0";
|
||||
int x = 0; //x坐标
|
||||
int y = 0; //y坐标
|
||||
int angle = 0; //角度
|
||||
int electric_qty = 0; //电量
|
||||
int status = 0; //三色灯状态
|
||||
int error = 0;
|
||||
int last_error = 0;
|
||||
String error_message = "";
|
||||
|
||||
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
|
||||
this.error = error;
|
||||
this.error_code = error_code;
|
||||
this.error_message = error_message;
|
||||
}
|
||||
|
||||
private Instruction instruction;
|
||||
|
||||
int mode = 2;
|
||||
|
||||
// @LokiLog(type = LokiLogType.AGV)
|
||||
public synchronized void processSocket(int[] arr) throws Exception {
|
||||
device_code = this.getDeviceCode();
|
||||
byte[] data = null;
|
||||
phase = arr[16] * 256 + arr[17];
|
||||
// agv任务号
|
||||
int index = arr[12] * 256 + arr[13];
|
||||
//任务号
|
||||
int ikey = arr[26] * 256 + arr[27];
|
||||
//站点号
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno);
|
||||
Instruction link_inst = null;
|
||||
List<Instruction> insts = null;
|
||||
Instruction inst = null;
|
||||
boolean link_flag = false;
|
||||
Device agv_device = null;
|
||||
if (carno != 0) {
|
||||
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
|
||||
}
|
||||
if (ikey != 0) {
|
||||
if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
this.instruction = inst;
|
||||
}
|
||||
// if (ObjectUtil.isEmpty(inst)){
|
||||
// inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
// }
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
}
|
||||
|
||||
Device device = null;
|
||||
String old_device_code = null;
|
||||
String emptyNum = null;
|
||||
String device_code = null;
|
||||
|
||||
// if (phase == 0x67) {
|
||||
// //故障信息
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// }
|
||||
|
||||
//普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
//货架
|
||||
StandardStorageDeviceDriver standardStorageDeviceDriver;
|
||||
|
||||
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
inst.setCarno(String.valueOf(carno));
|
||||
instructionService.update(inst);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey);
|
||||
|
||||
//到达取货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x03) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
//取货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x05) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code);
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
}
|
||||
//到达放货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x07) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
//放货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x09) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//到达位置点
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0x64) {//param,agv货位id待定
|
||||
//1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
agvaddr_copy = agvaddr;
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else if (phase == 0x50) {//进入交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else if (phase == 0x51) {//离开交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else if (phase == 0x67) {//agv异常
|
||||
if (ikey == 0) {
|
||||
this.setErrorInfo(ikey, "0", "正常");
|
||||
} else {
|
||||
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
last_error = error;
|
||||
} else if (phase == 0x70) {
|
||||
//x坐标
|
||||
x = ikey;
|
||||
} else if (phase == 0x71) {
|
||||
//y坐标
|
||||
y = ikey;
|
||||
} else if (phase == 0x72) {
|
||||
//车辆角度
|
||||
angle = ikey;
|
||||
} else if (phase == 0x73) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
} else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
phase = 0;
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
|
||||
NDCSocketConnectionAutoRun.write(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String Bytes2HexString(byte[] b) {
|
||||
String ret = "";
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
String hex = Integer.toHexString(b[i] & 0xFF);
|
||||
if (hex.length() == 1) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
ret += hex.toUpperCase();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
//agv编码
|
||||
jo.put("car_no", this.getDevice().getDevice_code());
|
||||
//agv名称
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
//x坐标
|
||||
jo.put("x", this.getX());
|
||||
//y坐标
|
||||
jo.put("y", this.getY());
|
||||
//角度
|
||||
jo.put("angle", this.getAngle());
|
||||
jo.put("phase", phase);
|
||||
jo.put("phase_name", oneAgvPhase.getPhaseName(phase));
|
||||
//电量
|
||||
jo.put("electricity", this.getElectric_qty());
|
||||
String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常";
|
||||
//agv状态
|
||||
jo.put("status_name", status_name);
|
||||
//任务号
|
||||
jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code());
|
||||
//异常
|
||||
jo.put("fault", this.getError_message());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -50,19 +50,7 @@ public class LnshKilnTrussDefination implements OpcDeviceDriverDefination {
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING4.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D56"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D60"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D64"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -135,29 +135,29 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB4.B1", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB4.B2"));
|
||||
list.add(new ItemDto(item_error, "故障代码", "DB4.B3"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB4.STRING4.50"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB4.D56"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB4.D60"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB4.D64"));
|
||||
list.add(new ItemDto(item_weight, "当前生产重量", "DB4.D68"));
|
||||
list.add(new ItemDto(item_order_No, "工单号", "DB4.STRING72.50"));
|
||||
list.add(new ItemDto(item_mix_num, "碾次", "DB4.D124"));
|
||||
list.add(new ItemDto(item_material, "当前生产物料", "DB4.STRING128.50"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB6.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB6.B1", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_status, "设备状态", "DB6.B2"));
|
||||
list.add(new ItemDto(item_error, "故障代码", "DB6.B3"));
|
||||
list.add(new ItemDto(item_open_time, "开机时间", "DB6.STRING4.50"));
|
||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB6.D56"));
|
||||
list.add(new ItemDto(item_production_time, "生产时间", "DB6.D60"));
|
||||
list.add(new ItemDto(item_error_time, "故障时间", "DB6.D64"));
|
||||
list.add(new ItemDto(item_weight, "当前生产重量", "DB6.D68"));
|
||||
list.add(new ItemDto(item_order_No, "工单号", "DB6.STRING72.50"));
|
||||
list.add(new ItemDto(item_mix_num, "碾次", "DB6.D124"));
|
||||
list.add(new ItemDto(item_material, "当前生产物料", "DB6.STRING128.50"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(item_to_command, "反馈", "DB5.W0", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_to_error, "error", "DB5.W2"));
|
||||
list.add(new ItemDto(item_to_order_No, "工单号", "DB5.STRING4.50"));
|
||||
list.add(new ItemDto(item_to_weight, "生产重量", "DB5.D56"));
|
||||
list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB5.STRING60.50"));
|
||||
list.add(new ItemDto(item_to_command, "反馈", "DB7.W0", Boolean.TRUE));
|
||||
list.add(new ItemDto(item_to_error, "error", "DB7.W2"));
|
||||
list.add(new ItemDto(item_to_order_No, "工单号", "DB7.STRING4.50"));
|
||||
list.add(new ItemDto(item_to_weight, "生产重量", "DB7.D56"));
|
||||
list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB7.STRING60.50"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,25 +52,7 @@ public class LnshMixingMillDefination implements OpcDeviceDriverDefination {
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB4.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB4.B1", Boolean.TRUE));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB4.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB4.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB4.STRING4.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB4.D56"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB4.D60"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB4.D64"));
|
||||
list.add(new ItemDto(ItemProtocol.item_weight, "当前生产重量", "DB4.D68"));
|
||||
list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB4.STRING72.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mix_num, "碾次", "DB4.D124"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB4.STRING128.50"));
|
||||
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
@@ -8,12 +9,17 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.AgvUtil;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.StandardRequestMethod;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
@@ -21,15 +27,16 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -42,9 +49,11 @@ import java.util.Map;
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
@@ -115,7 +124,7 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
@@ -132,50 +141,13 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
|
||||
if (mode != last_mode) {
|
||||
this.setRequireSucess(false);
|
||||
logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + " -> " + mode);
|
||||
}
|
||||
if (error != last_error) {
|
||||
logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + " -> " + error);
|
||||
}
|
||||
if (status != last_status) {
|
||||
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
||||
}
|
||||
if (!open_time.equals(last_open_time)) {
|
||||
logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + " -> " + open_time);
|
||||
}
|
||||
if (standby_time != last_standby_time) {
|
||||
logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + " -> " + standby_time);
|
||||
}
|
||||
if (production_time != last_production_time) {
|
||||
logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + " -> " + production_time);
|
||||
}
|
||||
if (error_time != last_error_time) {
|
||||
logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + " -> " + error_time);
|
||||
}
|
||||
if (weight != last_weight) {
|
||||
logServer.deviceItemValue(this.device_code,"weight" ,String.valueOf(weight));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号weight:" + last_weight + " -> " + weight);
|
||||
}
|
||||
if (!StrUtil.equals(material,last_material)) {
|
||||
logServer.deviceItemValue(this.device_code,"material" ,String.valueOf(material));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + " -> " + material);
|
||||
}
|
||||
if (!StrUtil.equals(order_No,last_order_No)) {
|
||||
logServer.deviceItemValue(this.device_code,"order_No" ,order_No);
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + " -> " + order_No);
|
||||
}
|
||||
if (mix_num != last_mix_num) {
|
||||
logServer.deviceItemValue(this.device_code,"mix_num" ,String.valueOf(mix_num));
|
||||
logServer.deviceExecuteLog(this.device_code,"","","信号mix_num:" + last_mix_num + " -> " + mix_num);
|
||||
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + " -> " + error);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
@@ -196,44 +168,22 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
//排产单确认
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("type", "1");
|
||||
enterProduction(json);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
//工单完成反馈
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("qty", weight);
|
||||
json.put("type", "2");
|
||||
enterProduction(json);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
//取货完成
|
||||
case 3:
|
||||
writing(3);
|
||||
return;
|
||||
//放货完成
|
||||
case 4:
|
||||
writing(4);
|
||||
return;
|
||||
if (mode > 2) {
|
||||
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) {
|
||||
String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString();
|
||||
try {
|
||||
applyRequest(modethod);
|
||||
} catch (Exception e) {
|
||||
message = "错误:" + e.getMessage();
|
||||
this.setIserror(true);
|
||||
}
|
||||
} else {
|
||||
message = "无效模式请求,驱动未配置此请求方法";
|
||||
}
|
||||
} else {
|
||||
message = "无请求";
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_status = status;
|
||||
@@ -248,39 +198,6 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
last_mix_num = mix_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排产单确认
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean enterProduction(JSONObject json) {
|
||||
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;
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
@@ -352,7 +269,6 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException {
|
||||
if (obj == null || StrUtil.isBlank(fieldName)) {
|
||||
return null;
|
||||
@@ -450,4 +366,98 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyRequest(String modethod) throws Exception {
|
||||
Object obj1 = this;
|
||||
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;
|
||||
Object obj = this.getClass().getDeclaredConstructor().newInstance();
|
||||
Method method1 = this.getClass().getMethod(modethod, null);
|
||||
method1.invoke(this, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean order_verify() {
|
||||
if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("type", "1");
|
||||
message = RequestMethodEnum.getName("order_verify") + "order_verify 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + json));
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, RequestMethodEnum.getName("order_verify") + jsonObject));
|
||||
}
|
||||
} else {
|
||||
message = "order_verify接口请求失败,无返回信息";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public synchronized boolean order_finish() {
|
||||
if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("type", "1");
|
||||
message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + json));
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, RequestMethodEnum.getName("order_verify") + jsonObject));
|
||||
}
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求失败,无返回信息";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请补空料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_put_empty_vehicle() {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
|
||||
request.setRequestNo(IdUtil.simpleUUID());
|
||||
request.setRequestDate(AgvUtil.getDate());
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,23 +50,9 @@ public class LnshPackageLineDefination implements OpcDeviceDriverDefination {
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList<ItemDto> list = new ArrayList<>();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "VB6000"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "VB6001", Boolean.TRUE));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "VB6002"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "VB6010.20"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "VD6030"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "VD6035"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "VD6040"));
|
||||
list.add(new ItemDto(ItemProtocol.item_vehicle_code, "载具编码", "VW6005"));
|
||||
list.add(new ItemDto(ItemProtocol.item_vehicle_type, "载具类型", "VB6003"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "故障类型", "VB6004"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
|
||||
@@ -52,31 +52,7 @@ public class LnshPackagePalletManipulatorDefination implements OpcDeviceDriverDe
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB1.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_putStation, "当前工位", "DB1.D4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB1.STRING8.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_qty, "拆/码垛数量", "DB1.D60"));
|
||||
list.add(new ItemDto(ItemProtocol.item_order_qty, "工单总数量", "DB1.D64"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING68.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D120"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D124"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D128"));
|
||||
list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB1.STRING132.50"));
|
||||
|
||||
list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB1.W184"));
|
||||
list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB1.W186"));
|
||||
list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB1.W188"));
|
||||
list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB1.W190"));
|
||||
list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB1.W192"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -245,67 +245,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
case 4:
|
||||
//排产单确认
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("type", "1");
|
||||
enterProduction(json);
|
||||
}
|
||||
break;
|
||||
// case 5:
|
||||
// //获取托盘信息
|
||||
// if (!requireSucess) {
|
||||
// getVehicle();
|
||||
// }
|
||||
// break;
|
||||
// case 6:
|
||||
// //码垛完成
|
||||
// if (!requireSucess) {
|
||||
// applyEmpty();
|
||||
// palletizing();
|
||||
// }
|
||||
// break;
|
||||
// case 7:
|
||||
// //码垛强制完成
|
||||
// if (!requireSucess) {
|
||||
// mandatoryPalletizing();
|
||||
// }
|
||||
// break;
|
||||
// case 8:
|
||||
// //申请空盘
|
||||
// if (!requireSucess) {
|
||||
// applyEmpty();
|
||||
// }
|
||||
// break;
|
||||
case 9:
|
||||
//工单完成
|
||||
if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("qty", qty);
|
||||
json.put("type", "2");
|
||||
enterProduction(json);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
//取货完成
|
||||
case 1:
|
||||
return;
|
||||
//放货完成
|
||||
case 2:
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
@@ -340,298 +280,6 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 排产单确认
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean enterProduction(JSONObject json) {
|
||||
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;
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
// ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No);
|
||||
// if (this.mode == 4) {
|
||||
// dto.setOrder_status("1");
|
||||
// } else if (this.mode == 9) {
|
||||
// dto.setOrder_status("2");
|
||||
// }
|
||||
// produceshiftorderService.update(dto);
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取托盘信息
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean getVehicle() {
|
||||
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();
|
||||
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("vehicle_code",barcode);
|
||||
JSONObject jo = new JSONObject();
|
||||
|
||||
if (jo.getInteger("status") == 200) {
|
||||
JSONObject content = jo.getJSONObject("content");
|
||||
String qty = content.getString("qty");
|
||||
String material_code = content.getString("material_code");
|
||||
String material_name = content.getString("material_name");
|
||||
String product_code = content.getString("product_code");
|
||||
String AlongSide = content.getString("AlongSide");
|
||||
String BshortSide = content.getString("BshortSide");
|
||||
String Htrapezoidal = content.getString("Htrapezoidal");
|
||||
String Wthickness = content.getString("Wthickness");
|
||||
String tray_qty = content.getString("tray_qty");
|
||||
String tray_high = content.getString("tray_high");
|
||||
String crib_category = content.getString("crib_category");
|
||||
String palletX1_line = content.getString("palletX1_line");
|
||||
String palletY1_row = content.getString("palletY1_row");
|
||||
String palletA1_angle = content.getString("palletA1_angle");
|
||||
String palletX2_line = content.getString("palletX2_line");
|
||||
String palletY2_row = content.getString("palletY2_row");
|
||||
String palletA2_angle = content.getString("palletA2_angle");
|
||||
String palletX3_line = content.getString("palletX3_line");
|
||||
String palletY3_row = content.getString("palletY3_row");
|
||||
String palletA3_angle = content.getString("palletA3_angle");
|
||||
String pressCribX1_line = content.getString("pressCribX1_line");
|
||||
String pressCribY1_row = content.getString("pressCribY1_row");
|
||||
String pressCribA1_angle = content.getString("pressCribA1_angle");
|
||||
String pressCribX2_line = content.getString("pressCribX2_line");
|
||||
String pressCribY2_row = content.getString("pressCribY2_row");
|
||||
String pressCribA2_angle = content.getString("pressCribA2_angle");
|
||||
String pressCribX3_line = content.getString("pressCribX3_line");
|
||||
String pressCribY3_row = content.getString("pressCribY3_row");
|
||||
String pressCribA3_angle = content.getString("pressCribA3_angle");
|
||||
String Zoffset = content.getString("Zoffset");
|
||||
String pallet_layerQty = content.getString("pallet_layerQty");
|
||||
String pressCrib_layerQty = content.getString("pressCrib_layerQty");
|
||||
String codeLayerX1_interval = content.getString("codeLayerX1_interval");
|
||||
String codeLayerY1_interval = content.getString("codeLayerY1_interval");
|
||||
String codeLayerX2_interval = content.getString("codeLayerX2_interval");
|
||||
String codeLayerY2_interval = content.getString("codeLayerY2_interval");
|
||||
String codeLayerX3_interval = content.getString("codeLayerX3_interval");
|
||||
String codeLayerY3_interval = content.getString("codeLayerY3_interval");
|
||||
String codeLayerX1_offset = content.getString("codeLayerX1_offset");
|
||||
String codeLayerY1_offset = content.getString("codeLayerY1_offset");
|
||||
String codeLayerX2_offset = content.getString("codeLayerX2_offset");
|
||||
String codeLayerY2_offset = content.getString("codeLayerY2_offset");
|
||||
String codeLayerX3_offset = content.getString("codeLayerX3_offset");
|
||||
String codeLayerY3_offset = content.getString("codeLayerY3_offset");
|
||||
String pressLayerX1_interval = content.getString("pressLayerX1_interval");
|
||||
String pressLayerY1_interval = content.getString("pressLayerY1_interval");
|
||||
String pressLayerX2_interval = content.getString("pressLayerX2_interval");
|
||||
String pressLayerY2_interval = content.getString("pressLayerY2_interval");
|
||||
String pressLayerX3_interval = content.getString("pressLayerX3_interval");
|
||||
String pressLayerY3_interval = content.getString("pressLayerY3_interval");
|
||||
String pressLayerX1_offset = content.getString("pressLayerX1_offset");
|
||||
String pressLayerY1_offset = content.getString("pressLayerY1_offset");
|
||||
String pressLayerX2_offset = content.getString("pressLayerX2_offset");
|
||||
String pressLayerY2_offset = content.getString("pressLayerY2_offset");
|
||||
String pressLayerX3_offset = content.getString("pressLayerX3_offset");
|
||||
String pressLayerY3_offset = content.getString("pressLayerY3_offset");
|
||||
String one_cribTotal = content.getString("one_cribTotal");
|
||||
String two_cribTotal = content.getString("two_cribTotal");
|
||||
String one_qty = content.getString("one_qty");
|
||||
String two_qty = content.getString("two_qty");
|
||||
String tool_coordinate = content.getString("tool_coordinate");
|
||||
|
||||
this.writing("to_material_qty",qty);
|
||||
this.writing("to_material_code",material_code);
|
||||
this.writing("to_product_code",product_code);
|
||||
this.writing("to_AlongSide",AlongSide);
|
||||
this.writing("to_BshortSide",BshortSide);
|
||||
this.writing("to_Htrapezoidal",Htrapezoidal);
|
||||
this.writing("to_Wthickness",Wthickness);
|
||||
this.writing("to_tray_qty",tray_qty);
|
||||
this.writing("to_tray_high",tray_high);
|
||||
this.writing("to_crib_category",crib_category);
|
||||
this.writing("to_palletX1_line",palletX1_line);
|
||||
this.writing("to_palletY1_row",palletY1_row);
|
||||
this.writing("to_palletA1_angle",palletA1_angle);
|
||||
this.writing("to_palletX2_line",palletX2_line);
|
||||
this.writing("to_palletY2_row",palletY2_row);
|
||||
this.writing("to_palletA2_angle",palletA2_angle);
|
||||
this.writing("to_palletX3_line",palletX3_line);
|
||||
this.writing("to_palletY3_row",palletY3_row);
|
||||
this.writing("to_palletA3_angle",palletA3_angle);
|
||||
this.writing("to_pressCribX1_line",pressCribX1_line);
|
||||
this.writing("to_pressCribY1_row",pressCribY1_row);
|
||||
this.writing("to_pressCribA1_angle",pressCribA1_angle);
|
||||
this.writing("to_pressCribX2_line",pressCribX2_line);
|
||||
this.writing("to_pressCribY2_row",pressCribY2_row);
|
||||
this.writing("to_pressCribA2_angle",pressCribA2_angle);
|
||||
this.writing("to_pressCribX3_line",pressCribX3_line);
|
||||
this.writing("to_pressCribY3_row",pressCribY3_row);
|
||||
this.writing("to_pressCribA3_angle",pressCribA3_angle);
|
||||
this.writing("to_Zoffset",Zoffset);
|
||||
this.writing("to_pallet_layerQty",pallet_layerQty);
|
||||
this.writing("to_pressCrib_layerQty",pressCrib_layerQty);
|
||||
this.writing("to_codeLayerX1_interval",codeLayerX1_interval);
|
||||
this.writing("to_codeLayerY1_interval",codeLayerY1_interval);
|
||||
this.writing("to_codeLayerX2_interval",codeLayerX2_interval);
|
||||
this.writing("to_codeLayerY2_interval",codeLayerY2_interval);
|
||||
this.writing("to_codeLayerX3_interval",codeLayerX3_interval);
|
||||
this.writing("to_codeLayerY3_interval",codeLayerY3_interval);
|
||||
this.writing("to_codeLayerX1_offset",codeLayerX1_offset);
|
||||
this.writing("to_codeLayerY1_offset",codeLayerY1_offset);
|
||||
this.writing("to_codeLayerX2_offset",codeLayerX2_offset);
|
||||
this.writing("to_codeLayerY2_offset",codeLayerY2_offset);
|
||||
this.writing("to_codeLayerX3_offset",codeLayerX3_offset);
|
||||
this.writing("to_codeLayerY3_offset",codeLayerY3_offset);
|
||||
this.writing("to_pressLayerX1_interval",pressLayerX1_interval);
|
||||
this.writing("to_pressLayerY1_interval",pressLayerY1_interval);
|
||||
this.writing("to_pressLayerX2_interval",pressLayerX2_interval);
|
||||
this.writing("to_pressLayerY2_interval",pressLayerY2_interval);
|
||||
this.writing("to_pressLayerX3_interval",pressLayerX3_interval);
|
||||
this.writing("to_pressLayerY3_interval",pressLayerY3_interval);
|
||||
this.writing("to_pressLayerX1_offset",pressLayerX1_offset);
|
||||
this.writing("to_pressLayerY1_offset",pressLayerY1_offset);
|
||||
this.writing("to_pressLayerX2_offset",pressLayerX2_offset);
|
||||
this.writing("to_pressLayerY2_offset",pressLayerY2_offset);
|
||||
this.writing("to_pressLayerX3_offset",pressLayerX3_offset);
|
||||
this.writing("to_pressLayerY3_offset",pressLayerY3_offset);
|
||||
this.writing("to_one_cribTotal",one_cribTotal);
|
||||
this.writing("to_two_cribTotal",two_cribTotal);
|
||||
this.writing("to_one_qty",one_qty);
|
||||
this.writing("to_two_qty",two_qty);
|
||||
this.writing("to_tool_coordinate",tool_coordinate);
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 码垛完成
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean palletizing() {
|
||||
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();
|
||||
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("is_full","1");
|
||||
json.put("product_code",product_code);
|
||||
json.put("AlongSide",AlongSide);
|
||||
json.put("BshortSide",BshortSide);
|
||||
json.put("Htrapezoidal",Htrapezoidal);
|
||||
json.put("Wthickness",Wthickness);
|
||||
|
||||
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 码垛强制完成
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean mandatoryPalletizing() {
|
||||
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();
|
||||
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("is_full","0");
|
||||
json.put("product_code",product_code);
|
||||
json.put("AlongSide",AlongSide);
|
||||
json.put("BshortSide",BshortSide);
|
||||
json.put("Htrapezoidal",Htrapezoidal);
|
||||
json.put("Wthickness",Wthickness);
|
||||
|
||||
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请空盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyEmpty() {
|
||||
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();
|
||||
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");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_business() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,21 +52,7 @@ public class LnshPalletizingManipulatorDefination implements OpcDeviceDriverDefi
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "动作", "DB1.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB1.B4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING6.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D58"));
|
||||
list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D62"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D66"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -651,7 +651,6 @@ public class ItemProtocol {
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
} else {
|
||||
setIsonline(true);
|
||||
|
||||
@@ -52,79 +52,7 @@ public class LnshPalletizingManipulatorSiteDefination implements OpcDeviceDriver
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB3.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB3.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB3.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB3.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB3.B4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB3.B5"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB3.D6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB3.D10"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB3.STRING14.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB3.W66"));
|
||||
list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "DB3.W68"));
|
||||
list.add(new ItemDto(ItemProtocol.item_unqualified_qty, "不合格数量", "DB3.W70"));
|
||||
|
||||
list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB3.W72"));
|
||||
list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB3.W74"));
|
||||
list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB3.W76"));
|
||||
list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB3.W78"));
|
||||
list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB3.W80"));
|
||||
list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB3.W82"));
|
||||
list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB3.W84"));
|
||||
list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB3.W86"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB3.W88"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB3.W90"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB3.W92"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB3.W94"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB3.W96"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB3.W98"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB3.W100"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB3.W102"));
|
||||
list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB3.W104"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB3.W106"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB3.W108"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB3.W110"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB3.W112"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB3.W114"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB3.W116"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB3.W118"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB3.W120"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB3.W122"));
|
||||
list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB3.W124"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB3.W126"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB3.W128"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB3.W130"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB3.W132"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB3.W134"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB3.W136"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB3.W138"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB3.W140"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB3.W142"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB3.W144"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB3.W146"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB3.W148"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB3.W150"));
|
||||
list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB3.W152"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB3.W154"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB3.W156"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB3.W158"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB3.W160"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB3.W162"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB3.W164"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB3.W166"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB3.W168"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB3.W170"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB3.W172"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB3.W174"));
|
||||
list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB3.W176"));
|
||||
list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB3.W178"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -118,24 +118,24 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB4.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB4.B2"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB4.B3"));
|
||||
list.add(new ItemDto(item_ioaction, "进出信号", "DB4.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB4.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB4.D6"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB4.D10"));
|
||||
list.add(new ItemDto(item_material, "物料", "DB4.STRING14.50"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB4.W66"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB8.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作模式", "DB8.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB8.B2"));
|
||||
list.add(new ItemDto(item_action, "取放信号", "DB8.B3"));
|
||||
list.add(new ItemDto(item_ioaction, "进出信号", "DB8.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB8.B5"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB8.D6"));
|
||||
list.add(new ItemDto(item_weight, "重量", "DB8.D10"));
|
||||
list.add(new ItemDto(item_material, "物料", "DB8.STRING14.50"));
|
||||
list.add(new ItemDto(item_barcode, "条码", "DB8.W66"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB5.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB5.W2"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB5.D4"));
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB9.W0", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB9.W2"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB9.D4"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,22 +52,7 @@ public class LnshStationDefination implements OpcDeviceDriverDefination {
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos2() {
|
||||
List<ItemDto> list = new ArrayList();
|
||||
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB4.B0"));
|
||||
list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB4.B1", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB4.B2"));
|
||||
list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB4.B3"));
|
||||
list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB4.B4"));
|
||||
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB4.B5"));
|
||||
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB4.D6"));
|
||||
list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB4.D10"));
|
||||
list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB4.STRING14.50"));
|
||||
list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB4.W66"));
|
||||
return list;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_station;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
@@ -8,12 +9,17 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.AgvUtil;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.StandardRequestMethod;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
@@ -22,11 +28,12 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -39,9 +46,11 @@ import java.util.Map;
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
@@ -116,7 +125,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
String message = null;
|
||||
message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
|
||||
@@ -193,101 +202,25 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
Object ignore_pickup_check = this.getExtraValue().get("ignore_pickup_check");
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 4:
|
||||
//叫料
|
||||
if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
|
||||
if (!requireSucess) {
|
||||
callMaterial();
|
||||
}
|
||||
} else {
|
||||
if (!requireSucess && this.move == 0) {
|
||||
callMaterial();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
//申请空盘
|
||||
if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
|
||||
if (!requireSucess) {
|
||||
applyEmpty();
|
||||
}
|
||||
} else {
|
||||
if (!requireSucess && this.move == 0) {
|
||||
applyEmpty();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
//申请入库
|
||||
if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
|
||||
if (!requireSucess) {
|
||||
putStorage();
|
||||
}
|
||||
} else {
|
||||
if (!requireSucess && this.move != 0) {
|
||||
putStorage();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
//申请出窑分配
|
||||
if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
|
||||
if (!requireSucess) {
|
||||
applyOuttoKiln();
|
||||
}
|
||||
} else {
|
||||
if (!requireSucess && this.move != 0) {
|
||||
applyOuttoKiln();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
//入窑扫码
|
||||
// if (!requireSucess && this.move != 0) {
|
||||
// reverseGroup();
|
||||
// }
|
||||
break;
|
||||
case 11:
|
||||
// 半托缓存强制去包装
|
||||
if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
|
||||
if (!requireSucess) {
|
||||
toPackage();
|
||||
}
|
||||
} else {
|
||||
if (!requireSucess && this.move != 0) {
|
||||
toPackage();
|
||||
}
|
||||
}
|
||||
case 15:
|
||||
// 送空托盘
|
||||
if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) {
|
||||
if (!requireSucess) {
|
||||
sendEmpty();
|
||||
}
|
||||
} else {
|
||||
if (!requireSucess && this.move != 0) {
|
||||
sendEmpty();
|
||||
}
|
||||
|
||||
|
||||
if (mode > 2) {
|
||||
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) {
|
||||
String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString();
|
||||
try {
|
||||
applyRequest(modethod);
|
||||
} catch (Exception e) {
|
||||
message = "错误:" + e.getMessage();
|
||||
this.setIserror(true);
|
||||
}
|
||||
} else {
|
||||
message = "无效模式请求,驱动未配置此请求方法";
|
||||
}
|
||||
} else {
|
||||
message = "无请求";
|
||||
}
|
||||
|
||||
// switch (flag) {
|
||||
// //取货完成
|
||||
// case 2:
|
||||
// writing(2);
|
||||
// return;
|
||||
// //放货完成
|
||||
// case 4:
|
||||
// writing(3);
|
||||
// return;
|
||||
// }
|
||||
Object ignore_pickup_check = this.getExtraValue().get("ignore_pickup_check");
|
||||
}
|
||||
|
||||
last_mode = mode;
|
||||
@@ -302,132 +235,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请空盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyEmpty() {
|
||||
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", "4");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 叫料
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean callMaterial() {
|
||||
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", "2");
|
||||
json.put("qty", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请入库
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean putStorage() {
|
||||
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", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请出窑去包装
|
||||
*
|
||||
* @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 (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
JSONObject jo = JSONObject.parseObject(result.body());
|
||||
String is_package = jo.getString("is_package");
|
||||
this.writing(2, Integer.parseInt(is_package));
|
||||
this.writing(1);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
@@ -527,77 +335,6 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
return "";
|
||||
}
|
||||
|
||||
public synchronized void reverseGroup() {
|
||||
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);
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
String task_id = SpringContextHolder.getBean(InstructionService.class).findByCode(String.valueOf(task)).getTask_id();
|
||||
String task_uuid = SpringContextHolder.getBean(TaskService.class).findById(task_id).getExt_task_uuid();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_uuid);
|
||||
json.put("vehicle_code", barcode);
|
||||
HttpResponse result = acsToWmsService.reverseGroup(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
this.writing(1);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制去包装
|
||||
*/
|
||||
public synchronized void toPackage() {
|
||||
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);
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", "5");
|
||||
json.put("device_code", device_code);
|
||||
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void sendEmpty() {
|
||||
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);
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", "3");
|
||||
json.put("device_code", device_code);
|
||||
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() throws Exception {
|
||||
@@ -711,4 +448,286 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyRequest(String modethod) throws Exception {
|
||||
Object obj1 = this;
|
||||
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;
|
||||
Object obj = this.getClass().getDeclaredConstructor().newInstance();
|
||||
Method method1 = this.getClass().getMethod(modethod, null);
|
||||
method1.invoke(this, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请补满料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_put_full_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "2");
|
||||
json.put("qty", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请补空料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_put_empty_vehicle() {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setRequestNo(IdUtil.simpleUUID());
|
||||
request.setRequestDate(AgvUtil.getDate());
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请取走空料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_take_empty_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "2");
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请取走满料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_take_full_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请强制取走满料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_force_take_full_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请强制满托入缓存
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_force_take_full_vehicle_in_storage() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码成功申请
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean barcode_sucess_apply() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("vehicle_code", barcode);
|
||||
HttpResponse result = acsToWmsService.applyOuttoKiln(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组盘信息
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean get_vehicle_info() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制去包装-不包装
|
||||
*/
|
||||
public synchronized boolean force_no_package() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", "5");
|
||||
json.put("device_code", device_code);
|
||||
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 申请贴标
|
||||
*/
|
||||
public synchronized boolean apply_labelling() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", "5");
|
||||
json.put("device_code", device_code);
|
||||
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
package org.nl.acs.ext.wms;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.log.LokiLog;
|
||||
import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* ACS连接外部系统工具类:
|
||||
*/
|
||||
@Slf4j
|
||||
public class LmsUtil {
|
||||
|
||||
public static <W> String notifyAcs(String api, W requestParam) {
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);;
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
//判断是否连接立库WCS系统
|
||||
String isConnect = paramService.findByCode("hasWms").getValue();
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
throw new BadRequestException("参数配置表中-hasWms为:0");
|
||||
}
|
||||
String liKu_wcs_url = paramService.findByCode("wmsurl").getValue();
|
||||
try {
|
||||
log.info("请求LMS参数:{}", JSON.toJSONString(requestParam));
|
||||
String body = HttpRequest
|
||||
.post(liKu_wcs_url + api).setConnectionTimeout(3000)
|
||||
.body(JSON.toJSONString(requestParam))
|
||||
.execute()
|
||||
.body();
|
||||
log.info("请求LMS参数返回参数:{}", body);
|
||||
return body;
|
||||
} catch (Exception e) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "false");
|
||||
result.put("code", "1");
|
||||
result.put("comment", e.getMessage());
|
||||
log.info("请求LMS异常返回参数:{}", String.valueOf(result));
|
||||
return String.valueOf(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.acs.ext.wms;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
|
||||
/**
|
||||
* @author: geng by
|
||||
* @createDate: 2022/11/24
|
||||
*/
|
||||
public class RespUtil {
|
||||
public static <T> Resp getResp(String result, T t) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
Resp<T> resp = new Resp<>();
|
||||
resp.setData(t);
|
||||
resp = JSONObject.toJavaObject(jsonObject, Resp.class);
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class BaseRequest {
|
||||
|
||||
/**
|
||||
* 请求号:uuid 唯一,LMS需要返回对应值
|
||||
*/
|
||||
private String requestNo;
|
||||
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
private String requestDate;
|
||||
|
||||
/**
|
||||
* 请求方法编号
|
||||
*/
|
||||
private String request_medthod_code;
|
||||
|
||||
/**
|
||||
* 请求方法名称
|
||||
*/
|
||||
private String request_medthod_name;
|
||||
|
||||
|
||||
/**
|
||||
* 系统编号
|
||||
*/
|
||||
private String systemCode;
|
||||
|
||||
/**
|
||||
* 扩展参数:砖型等
|
||||
*/
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class BaseResponse {
|
||||
|
||||
/**
|
||||
* 请求号
|
||||
*/
|
||||
private String requestNo;
|
||||
|
||||
/**
|
||||
* 响应时间
|
||||
*/
|
||||
private String responseDate;
|
||||
|
||||
/**
|
||||
* 结果 200成功
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调用立库接口统一返回参数类
|
||||
*
|
||||
* @author: geng by
|
||||
* @createDate: 2022/11/24
|
||||
*/
|
||||
@Data
|
||||
public class Resp<T> {
|
||||
/**
|
||||
* 成功返回true,失败返回false
|
||||
*/
|
||||
public String result;
|
||||
|
||||
/**
|
||||
* 错误码(0表示成功)1代表入库目的位置有货,其他更多情况待定
|
||||
*/
|
||||
public String code;
|
||||
|
||||
/**
|
||||
* 错误信息,如果成功则为null
|
||||
*/
|
||||
public String comment;
|
||||
|
||||
/**
|
||||
* 报文携带的数据
|
||||
*/
|
||||
public T data;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.nl.acs.ext.wms.data.applyTask;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
|
||||
@Data
|
||||
public class ApplyTaskRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 请求设备
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private String weight;
|
||||
|
||||
/**
|
||||
* 工单号
|
||||
*/
|
||||
private String order_code;
|
||||
|
||||
/**
|
||||
* 物料
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String qty;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.nl.acs.ext.wms.data.applyTask;
|
||||
|
||||
import org.nl.acs.ext.wms.data.BaseResponse;
|
||||
|
||||
public class ApplyTaskResponse extends BaseResponse {
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.nl.acs.ext.wms.data.feedBackTaskStatus;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
|
||||
@Data
|
||||
public class FeedBackTaskStautsRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
private String task_id;
|
||||
|
||||
/**
|
||||
* 任务code
|
||||
*/
|
||||
private String task_code;
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String task_status;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private String task_type;
|
||||
|
||||
/**
|
||||
* 车号
|
||||
*/
|
||||
private String car_no;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 动作 1请求取货 2取货完成 3请求放货 4放货完成
|
||||
*/
|
||||
private String action;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package org.nl.acs.ext.wms.data.feedBackTaskStatus;
|
||||
|
||||
import org.nl.acs.ext.wms.data.BaseResponse;
|
||||
|
||||
public class FeedBackTaskStautsResponse extends BaseResponse {
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package org.nl.acs.ext.wms.service;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -19,6 +22,11 @@ public interface AcsToWmsService {
|
||||
HttpResponse lnshApplyTaskToWms(JSONObject json);
|
||||
|
||||
|
||||
/**
|
||||
* ACS向WMS申请晟华任务
|
||||
*/
|
||||
public Resp<ApplyTaskResponse> applyTask(ApplyTaskRequest request);
|
||||
|
||||
/**
|
||||
* ACS向WMS申请贴标
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,11 @@ import org.nl.acs.config.AcsConfig;
|
||||
import org.nl.acs.device.address.service.AddressService;
|
||||
import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.ext.wms.LmsUtil;
|
||||
import org.nl.acs.ext.wms.RespUtil;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
@@ -23,7 +28,6 @@ import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -268,6 +272,23 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Resp<ApplyTaskResponse> applyTask(ApplyTaskRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String api = addressService.findByCode("lnshApplyTaskToWms").getMethods_url();
|
||||
log.info("lnshApplyTaskToWms-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String result = LmsUtil.notifyAcs(api, requestParam);
|
||||
log.info("lnshApplyTaskToWms-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new ApplyTaskResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse lnshApplyTaskToWms(JSONObject json) {
|
||||
try {
|
||||
|
||||
@@ -314,8 +314,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
lnshMixingMillDeviceDriver.writing("to_order_No", producetask_code);
|
||||
lnshMixingMillDeviceDriver.writing("to_weight", qty);
|
||||
lnshMixingMillDeviceDriver.writing("to_material_code", material_code);
|
||||
lnshMixingMillDeviceDriver.writing(1);
|
||||
lnshMixingMillDeviceDriver.writing(1);
|
||||
lnshMixingMillDeviceDriver.writing(100);
|
||||
lnshMixingMillDeviceDriver.writing(100);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
|
||||
@@ -345,8 +345,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
lnshPressDeviceDriver.writing("to_BshortSide", BshortSide);
|
||||
lnshPressDeviceDriver.writing("to_Htrapezoidal", Htrapezoidal);
|
||||
lnshPressDeviceDriver.writing("to_Wthickness", Wthickness);
|
||||
lnshPressDeviceDriver.writing(1);
|
||||
lnshPressDeviceDriver.writing(1);
|
||||
lnshPressDeviceDriver.writing(100);
|
||||
lnshPressDeviceDriver.writing(100);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
|
||||
@@ -378,8 +378,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_Htrapezoidal", Htrapezoidal);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_Wthickness", Wthickness);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing("to_vehicle_type", String.valueOf(json.getIntValue("vehicle_type") - 2));
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing(1);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing(1);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing(100);
|
||||
lnshPackagePalletManipulatorDeviceDriver.writing(100);
|
||||
is_flag = true;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
|
||||
@@ -409,8 +409,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
lnshSplitManipulatorDeviceDriver.writing("to_BshortSide", BshortSide);
|
||||
lnshSplitManipulatorDeviceDriver.writing("to_Htrapezoidal", Htrapezoidal);
|
||||
lnshSplitManipulatorDeviceDriver.writing("to_Wthickness", Wthickness);
|
||||
lnshSplitManipulatorDeviceDriver.writing(1);
|
||||
lnshSplitManipulatorDeviceDriver.writing(1);
|
||||
lnshSplitManipulatorDeviceDriver.writing(100);
|
||||
lnshSplitManipulatorDeviceDriver.writing(100);
|
||||
is_flag = true;
|
||||
}
|
||||
//下发成功后,写入工单信息表记录
|
||||
@@ -983,8 +983,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (driver.getMode() != 0
|
||||
&& driver.getError() == 0
|
||||
&& driver.getMove() != 0) {
|
||||
driver.writing(1);
|
||||
driver.writing(1);
|
||||
driver.writing(100);
|
||||
driver.writing(100);
|
||||
} else {
|
||||
String message = "";
|
||||
if (driver.getMode() != 0) {
|
||||
|
||||
@@ -8,10 +8,10 @@ import com.alibaba.fastjson.JSONObject;
|
||||
* 任务状态
|
||||
*/
|
||||
public enum InstStatusEnum {
|
||||
READY(1, "READY", "就绪"),
|
||||
ISSUE(2, "ISSUE", "已下发"),
|
||||
BUSY(3, "BUSY", "执行中"),
|
||||
FINISHED(4, "FINISHED", "完成");
|
||||
READY(1, "0", "就绪"),
|
||||
BUSY(2, "1", "执行中"),
|
||||
FINISHED(3, "2", "完成"),
|
||||
CANCEL(4, "3", "取消");
|
||||
|
||||
|
||||
//索引
|
||||
|
||||
@@ -70,7 +70,8 @@ public class DeviceManageDto {
|
||||
|
||||
while (var2.hasNext()) {
|
||||
DeviceExtraManageDto dto = (DeviceExtraManageDto) var2.next();
|
||||
result.put(dto.getExtra_code(), dto.parseName());
|
||||
// result.put(dto.getExtra_code(), dto.parseName());
|
||||
result.put(dto.getExtra_code(), dto.getExtra_name());
|
||||
}
|
||||
|
||||
this.extra_map = result;
|
||||
|
||||
@@ -8,9 +8,10 @@ import com.alibaba.fastjson.JSONObject;
|
||||
* 任务状态
|
||||
*/
|
||||
public enum TaskStatusEnum {
|
||||
READY(1, "READY", "就绪"),
|
||||
BUSY(2, "BUSY", "执行中"),
|
||||
FINISHED(3, "FINISHED", "完成");
|
||||
READY(1, "0", "就绪"),
|
||||
BUSY(2, "1", "执行中"),
|
||||
FINISHED(3, "2", "完成"),
|
||||
CANCEL(3, "3", "取消");
|
||||
|
||||
|
||||
//索引
|
||||
|
||||
Reference in New Issue
Block a user