@@ -126,7 +126,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
StandardStorageDeviceDriver standardStorageDeviceDriver;
|
||||
//刻字上料线体
|
||||
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
|
||||
//清洗下料
|
||||
//
|
||||
HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver;
|
||||
|
||||
//开始任务/上报订单号
|
||||
|
||||
@@ -42,6 +42,7 @@ 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.concurrent.TimeUnit;
|
||||
@@ -70,6 +71,8 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
@Autowired
|
||||
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
|
||||
|
||||
//线体状态
|
||||
int status = 0;
|
||||
@@ -420,20 +423,20 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17 + ",inst == null :" + ObjectUtil.isEmpty(inst));
|
||||
}
|
||||
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
//this.setIsonline(false);
|
||||
//this.setIserror(true);
|
||||
message = "信号量同步异常";
|
||||
//未联机
|
||||
} else if (mode == 0) {
|
||||
//this.setIsonline(false);
|
||||
//this.setIserror(true);
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else {
|
||||
//this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
// if (!this.itemProtocol.getIsonline()) {
|
||||
// //this.setIsonline(false);
|
||||
// //this.setIserror(true);
|
||||
// message = "信号量同步异常";
|
||||
// //未联机
|
||||
// } else if (mode == 0) {
|
||||
// //this.setIsonline(false);
|
||||
// //this.setIserror(true);
|
||||
// message = "未联机";
|
||||
// //有报警
|
||||
// } else {
|
||||
// //this.setIsonline(true);
|
||||
// this.setIserror(false);
|
||||
// message = "";
|
||||
//有货、联机、满料请求申请AGV搬运任务
|
||||
// if (gd_move == 1 && mode == 1 && empty_req == 1 && !requireSucess) {
|
||||
// boolean flag = apply_task();
|
||||
@@ -458,7 +461,34 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
// }
|
||||
|
||||
//无货、联机、空箱请求申请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();
|
||||
this.noApplyTaskMessage = null;
|
||||
if (flag) {
|
||||
@@ -482,7 +512,6 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
//到达取货点
|
||||
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 (ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
|
||||
@@ -557,26 +586,31 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
//放货完成
|
||||
if (agvphase == 0x09) {
|
||||
// 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");
|
||||
// if (empty_req == 1){
|
||||
//判断电气上报的【剩余实时重量】>10kg 将【上料总重量】写给电气
|
||||
// if (engraving_storage_now_weight > 10000){
|
||||
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);
|
||||
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");
|
||||
// }
|
||||
// }
|
||||
|
||||
//判断电气上报的【剩余实时重量】>10kg ,保障电气拉开气闸门下料
|
||||
while (engraving_storage_now_weight < 10000){
|
||||
writing("to_agv_put_finish", "1");
|
||||
}
|
||||
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 {
|
||||
String notFeedAgvMessage = "";
|
||||
if (gd_move != 1) {
|
||||
@@ -590,7 +624,7 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
last_status = status;
|
||||
last_is_open = is_open;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_in;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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_full_weight = "fl_full_weight"; //回流满框重量
|
||||
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";
|
||||
@@ -69,6 +74,12 @@ public class ItemProtocol {
|
||||
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_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;
|
||||
|
||||
@@ -185,6 +196,16 @@ public class ItemProtocol {
|
||||
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) {
|
||||
return move;
|
||||
@@ -201,7 +222,16 @@ public class ItemProtocol {
|
||||
return value;
|
||||
}
|
||||
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() {
|
||||
@@ -233,6 +263,9 @@ public class ItemProtocol {
|
||||
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_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;
|
||||
}
|
||||
|
||||
@@ -254,6 +287,9 @@ public class ItemProtocol {
|
||||
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_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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,4 +175,11 @@ public class WmsToAcsController {
|
||||
public ResponseEntity<Object> cleaningIn(@RequestBody JSONObject param) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1303,10 +1303,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
//清洗下料
|
||||
HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningPutLineDeviceDriver) {
|
||||
hailiangCleaningPutLineDeviceDriver = (HailiangCleaningPutLineDeviceDriver) device.getDeviceDriver();
|
||||
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("status", 200);
|
||||
@@ -1318,23 +1318,32 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Override
|
||||
public Map<String, Object> engravingIn(JSONObject param) {
|
||||
log.info("接收WMS刻字上料,下发参数:{}", JSON.toJSONString(param));
|
||||
String device_code = param.getString("device_code");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
String start_device_code = param.getString("start_point_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("设备号不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
Device device = deviceAppService.findDeviceByCode(start_device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + device_code);
|
||||
throw new BadRequestException("未找到对应设备:" + start_device_code);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
|
||||
//清洗下料
|
||||
HailiangCleaningPutLineDeviceDriver hailiangCleaningPutLineDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
hailiangCleaningPutLineDeviceDriver = (HailiangCleaningPutLineDeviceDriver) device.getDeviceDriver();
|
||||
resultJson.put("in_pcsn", hailiangCleaningPutLineDeviceDriver.getIn_pcsn());
|
||||
resultJson.put("vechile_code", hailiangCleaningPutLineDeviceDriver.getBarcode());
|
||||
resultJson.put("weight", hailiangCleaningPutLineDeviceDriver.getFull_weight());
|
||||
//刻字上料
|
||||
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);
|
||||
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("message", "操作成功");
|
||||
@@ -1428,7 +1437,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
dto.setExt_order_id(in_pcsn);
|
||||
dto.setOrder_code(in_pcsn);
|
||||
dto.setQty(BigDecimal.valueOf(999999));
|
||||
dto.setMaterial_code("qxsl");
|
||||
dto.setMaterial_code("QXSL");
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setIs_needmove("0");
|
||||
dto.setIn_devices(in_devices);
|
||||
|
||||
Reference in New Issue
Block a user