fix :清洗上料,下料

Signed-off-by: jiaoliming <dawnjiao@foxmail.com>
This commit is contained in:
jiaoliming
2023-07-25 11:03:20 +08:00
parent 240d5aa8b4
commit 3b02e7bc1c
8 changed files with 477 additions and 52 deletions

View File

@@ -42,6 +42,7 @@ public interface AcsConfig {
String ERPURL = "erpurl";
//是否存在wms系统
String HASWMS = "hasWms";
String ISTEST = "isTest";
String ISFEEDDEVICESTATUS = "isFeedDeviceStatus";
//路由选择
String ROUTE = "route";

View File

@@ -499,6 +499,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
map.put("to_all_num", String.valueOf(qtySum));
map.put("to_all_weight", String.valueOf(weightSum));
map.put("to_in_confirm_finish", "1");
map.put("allowed_in","1");
this.writing(map);
}

View File

@@ -87,7 +87,7 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
//上料批次号
int in_pcsn = 0;
//收料位1条码
int barcode = 0;
String barcode = "";
//收料位1批次入料总数量
int all_num = 0;
//收料位1批次入料总重量
@@ -99,6 +99,11 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
//待机时间S)
int await_time = 0;
int barcode_1 = 0;
int barcode_2 = 0;
int barcode_3 = 0;
int barcode_4 = 0;
//工作模式
int last_mode = 0;
@@ -189,11 +194,15 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
now_weight = this.itemProtocol.getItem_now_weight();
full_weight = this.itemProtocol.getItem_full_weight();
in_pcsn = this.itemProtocol.getItem_in_pcsn();
barcode = this.itemProtocol.getItem_barcode();
barcode_1 = this.itemProtocol.getItem_barcode_1();
barcode_2 = this.itemProtocol.getItem_barcode_2();
barcode_3 = this.itemProtocol.getItem_barcode_3();
barcode_4 = this.itemProtocol.getItem_barcode_4();
all_num = this.itemProtocol.getItem_all_num();
all_weight = this.itemProtocol.getItem_all_weight();
device_running_time = this.itemProtocol.getItem_device_running_time();
await_time = this.itemProtocol.getItem_await_time();
barcode = stringToascii(barcode_1) + stringToascii(barcode_2) + stringToascii(barcode_3) + stringToascii(barcode_4);
if (mode != last_mode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
@@ -430,6 +439,225 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
last_await_time = await_time;
}
public String stringToascii(int num) {
String str = "";
switch (num) {
case 48:
str = "0";
break;
case 49:
str = "1";
break;
case 50:
str = "2";
break;
case 51:
str = "3";
break;
case 52:
str = "4";
break;
case 53:
str = "5";
break;
case 54:
str = "6";
break;
case 55:
str = "7";
break;
case 56:
str = "8";
break;
case 57:
str = "9";
break;
case 65:
str = "A";
break;
case 66:
str = "B";
break;
case 67:
str = "C";
break;
case 68:
str = "D";
break;
case 69:
str = "E";
break;
case 70:
str = "F";
break;
case 71:
str = "G";
break;
case 72:
str = "H";
break;
case 73:
str = "I";
break;
case 74:
str = "J";
break;
case 75:
str = "K";
break;
case 76:
str = "L";
break;
case 77:
str = "M";
break;
case 78:
str = "N";
break;
case 79:
str = "O";
break;
case 80:
str = "P";
break;
case 81:
str = "Q";
break;
case 82:
str = "R";
break;
case 83:
str = "S";
break;
case 84:
str = "T";
break;
case 85:
str = "U";
break;
case 86:
str = "V";
break;
case 87:
str = "W";
break;
case 88:
str = "X";
break;
case 89:
str = "Y";
break;
case 90:
str = "Z";
break;
case 97:
str = "a";
break;
case 98:
str = "b";
break;
case 99:
str = "c";
break;
case 100:
str = "d";
break;
case 101:
str = "e";
break;
case 102:
str = "f";
break;
case 103:
str = "g";
break;
case 104:
str = "h";
break;
case 105:
str = "i";
break;
case 106:
str = "j";
break;
case 107:
str = "k";
break;
case 108:
str = "l";
break;
case 109:
str = "m";
break;
case 110:
str = "n";
break;
case 111:
str = "o";
break;
case 112:
str = "p";
break;
case 113:
str = "q";
break;
case 114:
str = "r";
break;
case 115:
str = "s";
break;
case 116:
str = "t";
break;
case 117:
str = "u";
break;
case 118:
str = "v";
break;
case 119:
str = "w";
break;
case 120:
str = "x";
break;
case 121:
str = "y";
break;
case 122:
str = "z";
break;
case 40:
str = "(";
break;
case 41:
str = ")";
break;
case 43:
str = "+";
break;
case 45:
str = "-";
break;
case 47:
str = "/";
break;
case 91:
str = "[";
break;
case 93:
str = "]";
break;
case 95:
str = "_";
break;
default:
str = "*";
}
return str;
}
/**
* 申请任务
*

View File

@@ -3,8 +3,6 @@ package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_put_l
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_feeding_line.HailiangCleaningFeedingLineDriver;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine.HailiangCleaningMachineDeviceDriver;
import java.util.ArrayList;
import java.util.List;
@@ -28,7 +26,11 @@ public class ItemProtocol {
public static String item_error = "error"; //报警信号
public static String item_now_weight = "now_weight";//收料位1实时重量
public static String item_full_weight = "full_weight";//收料位1满料框重量
public static String item_barcode = "barcode";//收料位1条码
public static String item_barcode_1 = "barcode_1";//收料位1条码
public static String item_barcode_2 = "barcode_2";//收料位1条码
public static String item_barcode_3 = "barcode_3";//收料位1条码
public static String item_barcode_4 = "barcode_4";//收料位1条码
public static String item_in_pcsn = "in_pcsn";//收料位1批次号(上料批次号)
public static String item_all_num = "all_num";//收料位1批次入料总数量
public static String item_all_weight = "all_weight";//收料位1批次入料总重量
@@ -116,9 +118,7 @@ public class ItemProtocol {
public int getItem_in_pcsn() {
return this.getOpcIntegerValue(item_in_pcsn);
}
public int getItem_barcode() {
return this.getOpcIntegerValue(item_barcode);
}
public int getItem_all_num() {
return this.getOpcIntegerValue(item_all_num);
}
@@ -143,8 +143,35 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_mode);
}
public int getItem_barcode_1() {
return this.getOpcIntegerValue(item_barcode_1);
}
public int getItem_barcode_2() {
return this.getOpcIntegerValue(item_barcode_2);
}
public int getItem_barcode_3() {
return this.getOpcIntegerValue(item_barcode_3);
}
public int getItem_barcode_4() {
return this.getOpcIntegerValue(item_barcode_4);
}
Boolean isonline;
public Byte getOpcByteValue(String protocol) {
Byte value = this.driver.getByteValue(protocol);
if (value == null) {
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 57;
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
@@ -154,7 +181,6 @@ public class ItemProtocol {
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
@@ -174,7 +200,10 @@ public class ItemProtocol {
list.add(new ItemDto(item_error, "故障信息", "DB1.W4"));
list.add(new ItemDto(item_now_weight, "收料位1实时重量", "DB1.D84"));
list.add(new ItemDto(item_full_weight, "收料位1满料框重量", "DB1.D88"));
list.add(new ItemDto(item_barcode, "收料位1条码", "DB1.D100"));
list.add(new ItemDto(item_barcode_1, "收料位1条码", "DB1.B100"));
list.add(new ItemDto(item_barcode_2, "收料位1条码", "DB1.B101"));
list.add(new ItemDto(item_barcode_3, "收料位1条码", "DB1.B102"));
list.add(new ItemDto(item_barcode_4, "收料位1条码", "DB1.B103"));
list.add(new ItemDto(item_in_pcsn, "收料位1批次号", "DB1.D116"));
list.add(new ItemDto(item_all_num, "收料位1批次入料总数量", "DB1.D120"));
list.add(new ItemDto(item_all_weight, "收料位1批次入料总重量", "DB1.D124"));

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.acsEnum.InstActionEnum;
import org.nl.acs.acsEnum.StatusEnum;
import org.nl.acs.acsEnum.WorkerOrderEnum;
@@ -19,6 +20,7 @@ import org.nl.acs.device_driver.basedriver.hailiang_one.ApplyTaskTime;
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
import org.nl.acs.device_driver.basedriver.hailiang_one.MonitoringLargeScreenData;
import org.nl.acs.device_driver.basedriver.hailiang_one.RemoveDevicePhase;
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -38,13 +40,11 @@ import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
@@ -73,7 +73,8 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
@Autowired
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
//线体状态
int status = 0;
//线体开机状态
@@ -193,7 +194,7 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
Boolean requireSucess = false;
//反馈设备状态请求标记
Boolean feedDeviceStatusFlag = false;
Boolean is_test = false;
//agv请求动作信息
private int agvphase = 0;
private int index = 0;
@@ -462,33 +463,10 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
//无货、联机、空箱请求申请AGV搬运任务
if (gd_move == 1 && mode == 1 && empty_req == 1 && !requireSucess) {
//刻字上料
//判断电气上报的【剩余实时重量】>10kg 将【上料总重量】写给电气
// if (engraving_storage_now_weight > 10){
writing("to_all_weight", String.valueOf(engraving_all_weight));
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
OneNDCSocketConnectionAutoRun.write(data);
//agv任务完成反馈mes
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
if (taskDto != null) {
taskDto.setExt_param(new HashMap<>());
taskDto.getExt_param().put("take_finish", "1");
taskDto.getExt_param().put("weight", String.valueOf(engraving_storage_now_weight));
taskserver.update(taskDto);
}
}
this.set(0, 0, null);
noFeedAgvMessage = null;
message = this.messageInfo(agvphase);
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
// }else {
// writing("to_agv_put_finish", "1");
// boolean flag_wash = washTaskRun(task);
// if (flag_wash) {
// this.message = "反馈刻字上料执行中";
// }
boolean flag = apply_empty_task();
this.noApplyTaskMessage = null;
if (flag) {
@@ -586,13 +564,32 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
//放货完成
if (agvphase == 0x09) {
// if (ObjectUtil.isNotEmpty(inst) && mode == 1 && allow_put == 1) {
if (ObjectUtil.isNotEmpty(inst) && mode == 1) {
// if (ObjectUtil.isNotEmpty(inst) && mode == 1) {//正式方案需要联机
//一体机临时方案不判断联机
if (StrUtil.equals(paramService.findByCode(AcsConfig.ISTEST).getValue(), "1")) {
is_test = ObjectUtil.isNotEmpty(inst);
}else {
is_test = ObjectUtil.isNotEmpty(inst) && mode == 1;
}
if (is_test) {
//放框完成
writing("to_agv_put_finish", "1");
//判断电气上报的【剩余实时重量】>10kg ,保障电气拉开气闸门下料
while (engraving_storage_now_weight < 10000){
writing("to_agv_put_finish", "1");
logServer.deviceExecuteLog(device_code, "", "任务号"+inst.getTask_code(), "下发开闸门开始----");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
int i = 0;
while (this.engraving_storage_now_weight < 10000 && i<5){
writing("to_agv_put_finish", "1");
i++;
logServer.deviceExecuteLog(device_code, "", "任务号"+inst.getTask_code(), "重量小于10KG循环下发拉闸门");
}
logServer.deviceExecuteLog(device_code, "", "任务号"+inst.getTask_code(), "关闭闸门----反馈称重");
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
@@ -600,6 +597,7 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
//agv任务完成反馈mes
if (inst != null) {
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
logServer.deviceExecuteLog(device_code, "", "任务号"+inst.getTask_code(), "任务="+taskDto.getTask_code());
if (taskDto != null) {
taskDto.setExt_param(new HashMap<>());
taskDto.getExt_param().put("take_finish", "1");
@@ -622,10 +620,17 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
this.noFeedAgvMessage = this.replace(notFeedAgvMessage);
}
}
if (mode == 1 && task_finish == 1 ) {
boolean flag = washTask(task);
if (flag) {
this.message = "反馈刻字上料完成成功";
}
}
// }
last_status = status;
last_is_open = is_open;
last_is_running = is_running;
@@ -757,6 +762,38 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
// }
// }
/**
* 上料完成以后反馈mes 上料设备号
*/
private boolean washTaskRun(int task_code) {
// TODO 反馈mes
JSONObject reqParam = new JSONObject();
reqParam.put("task_code", task_code);
reqParam.put("status", StatusEnum.TASK_RUNNING.getCode());
HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
}
return false;
}
/**
* 上料完成以后反馈mes 上料设备号
*/
private boolean washTask(int task_code) {
this.writing("to_confirm_finished", "1");
// TODO 反馈mes
JSONObject reqParam = new JSONObject();
reqParam.put("task_code", task_code);
reqParam.put("status", StatusEnum.TASK_FINISH.getCode());
HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
requireSucess = true;
return true;
}
return false;
}
/**
* 下发工单信息

View File

@@ -81,6 +81,64 @@ public class ItemProtocol {
//重量数组
public static String item_to_weight_array = "to_weight_array";
//任务顺序1
public static String item_to_sort1 = "to_sort1";
//任务顺序2
public static String item_to_sort2 = "to_sort2";
//任务顺序3
public static String item_to_sort3 = "to_sort3";
public static String item_to_sort4 = "to_sort4";
public static String item_to_sort5 = "to_sort5";
public static String item_to_sort6 = "to_sort6";
public static String item_to_sort7 = "to_sort7";
public static String item_to_sort8 = "to_sort8";
public static String item_to_sort9 = "to_sort9";
public static String item_to_sort10 = "to_sort10";
public static String item_to_sort11 = "to_sort11";
public static String item_to_sort12 = "to_sort12";
public static String item_to_sort13 = "to_sort13";
public static String item_to_sort14 = "to_sort14";
public static String item_to_sort15 = "to_sort15";
//站点1
public static String item_to_devices1 = "to_devices1";
//站点2
public static String item_to_devices2 = "to_devices2";
//站点3
public static String item_to_devices3 = "to_devices3";
public static String item_to_devices4 = "to_devices4";
public static String item_to_devices5 = "to_devices5";
public static String item_to_devices6 = "to_devices6";
public static String item_to_devices7 = "to_devices7";
public static String item_to_devices8 = "to_devices8";
public static String item_to_devices9 = "to_devices9";
public static String item_to_devices10 = "to_devices10";
public static String item_to_devices11 = "to_devices11";
public static String item_to_devices12 = "to_devices12";
public static String item_to_devices13 = "to_devices13";
public static String item_to_devices14 = "to_devices14";
public static String item_to_devices15 = "to_devices15";
//站点上料重量1
public static String item_to_weight1 = "to_weight1";
//站点2
public static String item_to_weight2 = "to_weight2";
//站点3
public static String item_to_weight3 = "to_weight3";
public static String item_to_weight4 = "to_weight4";
public static String item_to_weight5 = "to_weight5";
public static String item_to_weight6 = "to_weight6";
public static String item_to_weight7 = "to_weight7";
public static String item_to_weight8 = "to_weight8";
public static String item_to_weight9 = "to_weight9";
public static String item_to_weight10 = "to_weight10";
public static String item_to_weight11 = "to_weight11";
public static String item_to_weight12 = "to_weight12";
public static String item_to_weight13 = "to_weight13";
public static String item_to_weight14 = "to_weight14";
public static String item_to_weight15 = "to_weight15";
private HailiangEngravingInDeviceDriver driver;
public ItemProtocol(HailiangEngravingInDeviceDriver driver) {
@@ -275,7 +333,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_engraving_sn, "刻字机编号", "DB2.W6"));
list.add(new ItemDto(item_to_clean_open, "清洗机开关", "DB2.W8"));
list.add(new ItemDto(item_to_clear, "当前产量清零", "DB2.W12"));
list.add(new ItemDto(item_to_confirm_finished, "确认完成", "DB2.W14"));
// list.add(new ItemDto(item_to_confirm_finished, "确认完成", "DB2.W14"));
list.add(new ItemDto(item_to_dis_weight, "称重校验是否禁用", "DB2.W16"));
list.add(new ItemDto(item_to_confirm_finished, "任务确认完成", "DB2.W20"));
list.add(new ItemDto(item_to_agv_put_finish, "AGV放货完成", "DB2.W24"));
@@ -288,8 +346,53 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_all_weight, "上料总重量", "DB2.D104"));
list.add(new ItemDto(item_to_fl_self_weight, "回流塑料框自重", "DB2.D108"));
list.add(new ItemDto(item_to_sort_array, "排序数组", "DB200.W0[15]"));
list.add(new ItemDto(item_to_devices_array, "设备数组", "DB200.W30[15]"));
list.add(new ItemDto(item_to_devices_array, "站点数组", "DB200.W30[15]"));
list.add(new ItemDto(item_to_weight_array, "重量数组", "DB200.REAL60[15]"));
list.add(new ItemDto(item_to_sort1, "排序1", "DB200.W0"));
list.add(new ItemDto(item_to_sort2, "排序2", "DB200.W2"));
list.add(new ItemDto(item_to_sort3, "排序3", "DB200.W4"));
list.add(new ItemDto(item_to_sort4, "排序4", "DB200.W6"));
list.add(new ItemDto(item_to_sort5, "排序5", "DB200.W8"));
list.add(new ItemDto(item_to_sort6, "排序6", "DB200.W10"));
list.add(new ItemDto(item_to_sort7, "排序7", "DB200.W12"));
list.add(new ItemDto(item_to_sort8, "排序8", "DB200.W14"));
list.add(new ItemDto(item_to_sort9, "排序9", "DB200.W16"));
list.add(new ItemDto(item_to_sort10, "排序10", "DB200.W18"));
list.add(new ItemDto(item_to_sort11, "排序11", "DB200.W20"));
list.add(new ItemDto(item_to_sort12, "排序12", "DB200.W22"));
list.add(new ItemDto(item_to_sort13, "排序13", "DB200.W24"));
list.add(new ItemDto(item_to_sort14, "排序14", "DB200.W26"));
list.add(new ItemDto(item_to_sort15, "排序15", "DB200.W28"));
list.add(new ItemDto(item_to_devices1, "站点1", "DB200.W30"));
list.add(new ItemDto(item_to_devices2, "站点2", "DB200.W32"));
list.add(new ItemDto(item_to_devices3, "站点3", "DB200.W34"));
list.add(new ItemDto(item_to_devices4, "站点4", "DB200.W36"));
list.add(new ItemDto(item_to_devices5, "站点5", "DB200.W38"));
list.add(new ItemDto(item_to_devices6, "站点6", "DB200.W40"));
list.add(new ItemDto(item_to_devices7, "站点7", "DB200.W42"));
list.add(new ItemDto(item_to_devices8, "站点8", "DB200.W44"));
list.add(new ItemDto(item_to_devices9, "站点9", "DB200.W46"));
list.add(new ItemDto(item_to_devices10, "站点10", "DB200.W48"));
list.add(new ItemDto(item_to_devices11, "站点11", "DB200.W50"));
list.add(new ItemDto(item_to_devices12, "站点12", "DB200.W52"));
list.add(new ItemDto(item_to_devices13, "站点13", "DB200.W54"));
list.add(new ItemDto(item_to_devices14, "站点14", "DB200.W56"));
list.add(new ItemDto(item_to_devices15, "站点15", "DB200.W58"));
list.add(new ItemDto(item_to_weight1, "站点1上料重量", "DB200.REAL60"));
list.add(new ItemDto(item_to_weight2, "站点2上料重量", "DB200.REAL64"));
list.add(new ItemDto(item_to_weight3, "站点3上料重量", "DB200.REAL68"));
list.add(new ItemDto(item_to_weight4, "站点4上料重量", "DB200.REAL72"));
list.add(new ItemDto(item_to_weight5, "站点5上料重量", "DB200.REAL76"));
list.add(new ItemDto(item_to_weight6, "站点6上料重量", "DB200.REAL80"));
list.add(new ItemDto(item_to_weight7, "站点7上料重量", "DB200.REAL84"));
list.add(new ItemDto(item_to_weight8, "站点8上料重量", "DB200.REAL88"));
list.add(new ItemDto(item_to_weight9, "站点9上料重量", "DB200.REAL92"));
list.add(new ItemDto(item_to_weight10, "站点10上料重量", "DB200.REAL96"));
list.add(new ItemDto(item_to_weight11, "站点11上料重量", "DB200.REAL100"));
list.add(new ItemDto(item_to_weight12, "站点12上料重量", "DB200.REAL104"));
list.add(new ItemDto(item_to_weight13, "站点13上料重量", "DB200.REAL108"));
list.add(new ItemDto(item_to_weight14, "站点14上料重量", "DB200.REAL112"));
list.add(new ItemDto(item_to_weight15, "站点15上料重量", "DB200.REAL116"));
return list;
}

View File

@@ -4,6 +4,7 @@ package org.nl.acs.device_driver.driver;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sun.jna.platform.win32.WinDef;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.OpcItemDto;
@@ -98,4 +99,10 @@ public interface OpcDeviceDriver extends DeviceDriver {
// return (Float)redisUtils.get(this.getItem(protocol));
return (Float) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
default Byte getByteValue(String protocol) {
return (Byte) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
default char getCharValue(String protocol) {
return (char) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
}

View File

@@ -28,6 +28,7 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanne
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.acs.acsEnum.StatusEnum;
import org.nl.acs.acsEnum.WorkerOrderEnum;
@@ -43,6 +44,7 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
@@ -69,6 +71,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private ParamService paramService;
@Autowired
private InstructionService instructionService;
@Autowired
AcsToWmsService acsToWmsService;
@Override
public Map<String, Object> createFromWms(List<JSONObject> tasks) {
@@ -1333,18 +1337,33 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
throw new BadRequestException("未找到对应设备:" + start_device_code);
}
JSONObject resultJson = new JSONObject();
//刻字上料
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
if (device.getDeviceDriver() instanceof HailiangEngravingInDeviceDriver) {
hailiangEngravingInDeviceDriver = (HailiangEngravingInDeviceDriver) device.getDeviceDriver();
hailiangEngravingInDeviceDriver.writing("to_sort_array",to_sort_array);
hailiangEngravingInDeviceDriver.writing("to_devices_array",to_devices_array);
hailiangEngravingInDeviceDriver.writing("to_weight_array",to_weight_array);
String[] sort = to_sort_array.split(",");
for (int i=0;i< sort.length;i++){
hailiangEngravingInDeviceDriver.writing("to_sort"+(i+1),sort[i]);
}
String[] devices = to_devices_array.split(",");
for (int i=0;i< devices.length;i++){
String[] device_i = devices[i].split("_");
hailiangEngravingInDeviceDriver.writing("to_devices"+(i+1),device_i[device_i.length-1]);
}
String[] weight = to_weight_array.split(",");
for (int i=0;i< weight.length;i++){
hailiangEngravingInDeviceDriver.writing("to_weight"+(i+1),weight[i]);
}
hailiangEngravingInDeviceDriver.writing("to_all_weight", all_weight);
// hailiangEngravingInDeviceDriver.writing("to_all_weight",String.valueOf(hailiangEngravingInDeviceDriver.getEngraving_storage_now_weight()));
hailiangEngravingInDeviceDriver.writing("to_task",to_task);
}
// TODO 反馈mes
JSONObject reqParam = new JSONObject();
reqParam.put("task_code", to_task);
reqParam.put("status", StatusEnum.TASK_RUNNING.getCode());
HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
resultJson.put("status", 200);
resultJson.put("message", "操作成功");
log.info("接收WMS刻字上料成功,响应参数:{}", JSON.toJSONString(resultJson));