fix : 修改刻字上料输送线逻辑

Signed-off-by: jiaoliming <dawnjiao@foxmail.com>
This commit is contained in:
jiaoliming
2023-07-22 11:53:32 +08:00
parent 76d42e71fc
commit 240d5aa8b4
7 changed files with 142 additions and 51 deletions

View File

@@ -126,7 +126,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
StandardStorageDeviceDriver standardStorageDeviceDriver; StandardStorageDeviceDriver standardStorageDeviceDriver;
//刻字上料线体 //刻字上料线体
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver; HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
//清洗下料 //
HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver; HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver;
//开始任务/上报订单号 //开始任务/上报订单号

View File

@@ -42,6 +42,7 @@ import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@@ -70,6 +71,8 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class); TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
@Autowired @Autowired
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
//线体状态 //线体状态
int status = 0; int status = 0;
@@ -420,20 +423,20 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17 + ",inst == null :" + ObjectUtil.isEmpty(inst)); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17 + ",inst == null :" + ObjectUtil.isEmpty(inst));
} }
if (!this.itemProtocol.getIsonline()) { // if (!this.itemProtocol.getIsonline()) {
//this.setIsonline(false); // //this.setIsonline(false);
//this.setIserror(true); // //this.setIserror(true);
message = "信号量同步异常"; // message = "信号量同步异常";
//未联机 // //未联机
} else if (mode == 0) { // } else if (mode == 0) {
//this.setIsonline(false); // //this.setIsonline(false);
//this.setIserror(true); // //this.setIserror(true);
message = "未联机"; // message = "未联机";
//有报警 // //有报警
} else { // } else {
//this.setIsonline(true); // //this.setIsonline(true);
this.setIserror(false); // this.setIserror(false);
message = ""; // message = "";
//有货、联机、满料请求申请AGV搬运任务 //有货、联机、满料请求申请AGV搬运任务
// if (gd_move == 1 && mode == 1 && empty_req == 1 && !requireSucess) { // if (gd_move == 1 && mode == 1 && empty_req == 1 && !requireSucess) {
// boolean flag = apply_task(); // boolean flag = apply_task();
@@ -458,7 +461,34 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
// } // }
//无货、联机、空箱请求申请AGV搬运任务 //无货、联机、空箱请求申请AGV搬运任务
if (gd_move == 0 && mode == 1 && empty_req == 1 && !requireSucess) { 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 = apply_empty_task(); boolean flag = apply_empty_task();
this.noApplyTaskMessage = null; this.noApplyTaskMessage = null;
if (flag) { if (flag) {
@@ -482,7 +512,6 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
//到达取货点 //到达取货点
if (agvphase == 0x03) { if (agvphase == 0x03) {
logServer.deviceExecuteLog(this.device_code, "", inst.getInstruction_code(), "刻字上料PS20上报到达取货点:" + ",inst == null :" + ObjectUtil.isEmpty(inst));
// if (gd_move == 1 && ObjectUtil.isNotEmpty(inst)) { // if (gd_move == 1 && ObjectUtil.isNotEmpty(inst)) {
if (ObjectUtil.isNotEmpty(inst)) { if (ObjectUtil.isNotEmpty(inst)) {
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
@@ -557,26 +586,31 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
//放货完成 //放货完成
if (agvphase == 0x09) { if (agvphase == 0x09) {
// if (ObjectUtil.isNotEmpty(inst) && mode == 1 && allow_put == 1) { // if (ObjectUtil.isNotEmpty(inst) && mode == 1 && allow_put == 1) {
if (ObjectUtil.isNotEmpty(inst)) { if (ObjectUtil.isNotEmpty(inst) && mode == 1) {
//放框完成 //放框完成
writing("to_agv_put_finish", "1"); writing("to_agv_put_finish", "1");
// if (empty_req == 1){ //判断电气上报的【剩余实时重量】>10kg ,保障电气拉开气闸门下料
//判断电气上报的【剩余实时重量】>10kg 将【上料总重量】写给电气 while (engraving_storage_now_weight < 10000){
// if (engraving_storage_now_weight > 10000){ writing("to_agv_put_finish", "1");
writing("to_all_weight", String.valueOf(engraving_all_weight)); }
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
instructionService.update(inst); instructionService.update(inst);
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
OneNDCSocketConnectionAutoRun.write(data); OneNDCSocketConnectionAutoRun.write(data);
this.set(0, 0, null); //agv任务完成反馈mes
noFeedAgvMessage = null; if (inst != null) {
message = this.messageInfo(agvphase); TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase)); if (taskDto != null) {
// }else { taskDto.setExt_param(new HashMap<>());
// writing("to_agv_put_finish", "1"); 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 { } else {
String notFeedAgvMessage = ""; String notFeedAgvMessage = "";
if (gd_move != 1) { if (gd_move != 1) {
@@ -590,7 +624,7 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
} }
} // }
last_status = status; last_status = status;
last_is_open = is_open; last_is_open = is_open;

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_in; package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_in;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto; import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
@@ -38,6 +39,10 @@ public class ItemProtocol {
public static String item_fl_now_weight = "fl_now_weight"; //回流实时重量 public static String item_fl_now_weight = "fl_now_weight"; //回流实时重量
public static String item_fl_full_weight = "fl_full_weight"; //回流满框重量 public static String item_fl_full_weight = "fl_full_weight"; //回流满框重量
public static String item_barcode = "barcode"; //料框条码 public static String item_barcode = "barcode"; //料框条码
public static String item_current_sort = "current_sort"; //当前上料序号
public static String item_current_device = "current_device"; //当前上料站点
public static String item_current_weight = "current_weight"; //当前站需要重量实时
//开机 //开机
public static String item_to_open = "to_open"; public static String item_to_open = "to_open";
@@ -69,6 +74,12 @@ public class ItemProtocol {
public static String item_to_all_weight = "to_all_weight"; public static String item_to_all_weight = "to_all_weight";
//回流塑料框自重 //回流塑料框自重
public static String item_to_fl_self_weight = "to_fl_self_weight"; public static String item_to_fl_self_weight = "to_fl_self_weight";
//任务顺序数组
public static String item_to_sort_array = "to_sort_array";
//设备数组
public static String item_to_devices_array = "to_devices_array";
//重量数组
public static String item_to_weight_array = "to_weight_array";
private HailiangEngravingInDeviceDriver driver; private HailiangEngravingInDeviceDriver driver;
@@ -185,6 +196,16 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_barcode); return this.getOpcIntegerValue(item_barcode);
} }
public float getItem_current_sort() {
return this.getOpcFloatValue(item_current_sort);
}
public float getItem_current_device() {
return this.getOpcFloatValue(item_current_device);
}
public float getItem_current_weight() {
return this.getOpcFloatValue(item_current_weight);
}
//是否有货 //是否有货
public int hasGoods(int move) { public int hasGoods(int move) {
return move; return move;
@@ -201,7 +222,16 @@ public class ItemProtocol {
return value; return value;
} }
return 0; return 0;
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getFloatValue(protocol);
if (ObjectUtil.isEmpty(value)) {
} else {
return value;
}
return 0.0f;
} }
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {
@@ -233,6 +263,9 @@ public class ItemProtocol {
list.add(new ItemDto(item_fl_now_weight, "回流实时重量", "DB1.D132")); list.add(new ItemDto(item_fl_now_weight, "回流实时重量", "DB1.D132"));
list.add(new ItemDto(item_fl_full_weight, "回流满框重量", "DB1.D136")); list.add(new ItemDto(item_fl_full_weight, "回流满框重量", "DB1.D136"));
list.add(new ItemDto(item_barcode, "料框条码", "DB1.D140")); list.add(new ItemDto(item_barcode, "料框条码", "DB1.D140"));
list.add(new ItemDto(item_current_sort, "当前上料序号", "DB1.W12"));
list.add(new ItemDto(item_current_device, "当前上料站号", "DB1.W14"));
list.add(new ItemDto(item_current_weight, "当前站需要重量实时", "DB1.REAL144"));
return list; return list;
} }
@@ -254,6 +287,9 @@ public class ItemProtocol {
list.add(new ItemDto(item_to_fl_full_weight, "回流满框重量标准值", "DB2.D100")); list.add(new ItemDto(item_to_fl_full_weight, "回流满框重量标准值", "DB2.D100"));
list.add(new ItemDto(item_to_all_weight, "上料总重量", "DB2.D104")); 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_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_weight_array, "重量数组", "DB200.REAL60[15]"));
return list; return list;
} }

View File

@@ -93,4 +93,9 @@ public interface OpcDeviceDriver extends DeviceDriver {
} }
default Float getFloatValue(String protocol) {
// RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
// return (Float)redisUtils.get(this.getItem(protocol));
return (Float) this.getOpcValueAccessor().getValue(this.getItem(protocol));
}
} }

View File

@@ -175,4 +175,11 @@ public class WmsToAcsController {
public ResponseEntity<Object> cleaningIn(@RequestBody JSONObject param) { public ResponseEntity<Object> cleaningIn(@RequestBody JSONObject param) {
return new ResponseEntity<>(wmstoacsService.cleaningIn(param), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.cleaningIn(param), HttpStatus.OK);
} }
@PostMapping("/engravingIn")
@Log("刻字上料")
@ApiOperation("刻字上料")
@SaIgnore
public ResponseEntity<Object> engravingIn(@RequestBody JSONObject param) {
return new ResponseEntity<>(wmstoacsService.engravingIn(param), HttpStatus.OK);
}
} }

View File

@@ -1303,10 +1303,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
//清洗下料 //清洗下料
HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver; HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver;
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) { if (device.getDeviceDriver() instanceof HailiangCleaningPutLineDeviceDriver) {
hailiangCleaningPutLineDeviceDriver = (HailiangCleaningPutLineDeviceDriver) device.getDeviceDriver(); hailiangCleaningPutLineDeviceDriver = (HailiangCleaningPutLineDeviceDriver) device.getDeviceDriver();
resultJson.put("in_pcsn", hailiangCleaningPutLineDeviceDriver.getIn_pcsn()); resultJson.put("in_pcsn", hailiangCleaningPutLineDeviceDriver.getIn_pcsn());
resultJson.put("vehicle_code", hailiangCleaningPutLineDeviceDriver.getBarcode()); resultJson.put("vechile_code", hailiangCleaningPutLineDeviceDriver.getBarcode());
resultJson.put("weight", hailiangCleaningPutLineDeviceDriver.getFull_weight()); resultJson.put("weight", hailiangCleaningPutLineDeviceDriver.getFull_weight());
} }
resultJson.put("status", 200); resultJson.put("status", 200);
@@ -1318,23 +1318,32 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Override @Override
public Map<String, Object> engravingIn(JSONObject param) { public Map<String, Object> engravingIn(JSONObject param) {
log.info("接收WMS刻字上料,下发参数:{}", JSON.toJSONString(param)); log.info("接收WMS刻字上料,下发参数:{}", JSON.toJSONString(param));
String device_code = param.getString("device_code"); String start_device_code = param.getString("start_point_code");
if (StrUtil.isEmpty(device_code)) { String to_sort_array = param.getString("to_sort_array");
String to_devices_array = param.getString("to_devices_array");
String to_weight_array = param.getString("to_weight_array");
//上料总重量
String all_weight = param.getString("all_weight");
String to_task = param.getString("task_code");
if (StrUtil.isEmpty(start_device_code)) {
throw new BadRequestException("设备号不能为空!"); throw new BadRequestException("设备号不能为空!");
} }
Device device = deviceAppService.findDeviceByCode(device_code); Device device = deviceAppService.findDeviceByCode(start_device_code);
if (ObjectUtil.isEmpty(device)) { if (ObjectUtil.isEmpty(device)) {
throw new BadRequestException("未找到对应设备:" + device_code); throw new BadRequestException("未找到对应设备:" + start_device_code);
} }
JSONObject resultJson = new JSONObject(); JSONObject resultJson = new JSONObject();
//清洗下 //刻字上
HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver; HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) { if (device.getDeviceDriver() instanceof HailiangEngravingInDeviceDriver) {
hailiangCleaningPutLineDeviceDriver = (HailiangCleaningPutLineDeviceDriver) device.getDeviceDriver(); hailiangEngravingInDeviceDriver = (HailiangEngravingInDeviceDriver) device.getDeviceDriver();
resultJson.put("in_pcsn", hailiangCleaningPutLineDeviceDriver.getIn_pcsn()); hailiangEngravingInDeviceDriver.writing("to_sort_array",to_sort_array);
resultJson.put("vechile_code", hailiangCleaningPutLineDeviceDriver.getBarcode()); hailiangEngravingInDeviceDriver.writing("to_devices_array",to_devices_array);
resultJson.put("weight", hailiangCleaningPutLineDeviceDriver.getFull_weight()); hailiangEngravingInDeviceDriver.writing("to_weight_array",to_weight_array);
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);
} }
resultJson.put("status", 200); resultJson.put("status", 200);
resultJson.put("message", "操作成功"); resultJson.put("message", "操作成功");
@@ -1428,7 +1437,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
dto.setExt_order_id(in_pcsn); dto.setExt_order_id(in_pcsn);
dto.setOrder_code(in_pcsn); dto.setOrder_code(in_pcsn);
dto.setQty(BigDecimal.valueOf(999999)); dto.setQty(BigDecimal.valueOf(999999));
dto.setMaterial_code("qxsl"); dto.setMaterial_code("QXSL");
dto.setDevice_code(device_code); dto.setDevice_code(device_code);
dto.setIs_needmove("0"); dto.setIs_needmove("0");
dto.setIn_devices(in_devices); dto.setIn_devices(in_devices);

View File

@@ -308,7 +308,7 @@ export default {
methods: { methods: {
// 在 Input 值改变时触发 // 在 Input 值改变时触发
handleEdit(e) { handleEdit(e) {
let value = e.replace(/^(0+)|[^d]+/g, '') // 以0开头或者输入非数字会被替换成空 let value = e.replace(/^(0+)|[^\d]+/g, '') // 以0开头或者输入非数字会被替换成空
value = value.replace(/(d{15})d*/, '$1') // 最多保留15位整数 value = value.replace(/(d{15})d*/, '$1') // 最多保留15位整数
this.form.lane_tray_template = value this.form.lane_tray_template = value
}, },