@@ -50,7 +50,7 @@ public enum StatusEnum {
|
||||
KZ_EMPTY_REQ("4", "叫空框请求(刻字)", ""),
|
||||
BZ_FULL_REQ("5", "叫满框请求(包装)", ""),
|
||||
BZ_EMPTY_REQ("6", "送空框请求(包装)", ""),
|
||||
QX_LACK_REQ("7", "清洗机缺料请求", ""),
|
||||
QX_LACK_REQ("7", "清洗机上料请求", ""),
|
||||
QX_FULL_REQ("8", "清洗机满料请求", ""),
|
||||
QXXL_FULL_REQ("9", "取满框请求(清洗下料)", ""),
|
||||
QXXL_EMPTY_REQ("10", "叫空框请求(清洗下料)", ""),
|
||||
|
||||
@@ -14,13 +14,21 @@ public interface NDCAgvService {
|
||||
Map<String, AgvDto> findAllAgvFromCache();
|
||||
|
||||
/**
|
||||
* 删除NDC任务
|
||||
* 删除NDC任务(诺宝)
|
||||
*
|
||||
* @param inst
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAgvInstToNDC(Instruction inst) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除NDC任务(叉车)
|
||||
*
|
||||
* @param inst
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAgvOneInstToNDC(Instruction inst) throws Exception;
|
||||
|
||||
/**
|
||||
* 下发任务
|
||||
*
|
||||
|
||||
@@ -66,6 +66,38 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
public void deleteAgvOneInstToNDC(Instruction inst) throws Exception {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
int index = Integer.parseInt(inst.getAgv_jobno());
|
||||
|
||||
byte indexhigh = (byte) IntToHexHigh(index);
|
||||
byte indexlow = (byte) IntToHexLow(index);
|
||||
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "index:" + index;
|
||||
str1 += "ikey:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF);
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X06,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X6E,
|
||||
(byte) 0X00, (byte) 0X02,
|
||||
(byte) indexhigh, (byte) indexlow,
|
||||
};
|
||||
log.info("下发删除AGV指令--{}", Bytes2HexString(b));
|
||||
if (ObjectUtil.isNotEmpty(b)) {
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
System.out.println("下发删除agv指令数据:" + Bytes2HexString(b));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
|
||||
@@ -69,6 +69,8 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
String ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
int port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
socket = new Socket(ip, port);
|
||||
//加上超时时间5秒
|
||||
// socket.setSoTimeout(5000);
|
||||
byte[] bytes = new byte[256];
|
||||
dos = new DataOutputStream(socket.getOutputStream());
|
||||
dis = new DataInputStream(socket.getInputStream());
|
||||
|
||||
@@ -631,7 +631,9 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
||||
celldto.setX(formatNum(x));
|
||||
celldto.setY(formatNum(i));
|
||||
celldto.setZ(formatNum(j));
|
||||
//celldto.setAddress(Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")));
|
||||
// celldto.setAddress(Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")));
|
||||
//临时生成货位用
|
||||
celldto.setAddress(Integer.parseInt("3"+device_code.substring(device_code.length()-1)+formatNum(i)+formatNum(j).substring(formatNum(j).length()-1)));
|
||||
celldto.setCreate_by("init");
|
||||
// celldto.setCreate_time(SecurityUtils.getCurrentUsername());
|
||||
celldto.setCreate_time(DateUtil.now());
|
||||
|
||||
@@ -73,6 +73,9 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
int error = 0;
|
||||
//上料批次号
|
||||
int in_pcsn = 0;
|
||||
//上料命令确认完毕
|
||||
int to_in_confirm_finish = 0;
|
||||
|
||||
|
||||
int last_mode = 0;
|
||||
int last_is_open = 0;
|
||||
@@ -82,6 +85,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
int last_allowed_in = 0;
|
||||
int last_error = 0;
|
||||
int last_in_pcsn = 0;
|
||||
int last_to_in_confirm_finish = 0;
|
||||
|
||||
Boolean isonline = true;
|
||||
String message = null;
|
||||
@@ -118,6 +122,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
allowed_in = this.itemProtocol.getItem_allowed_in();
|
||||
error = this.itemProtocol.getItem_error();
|
||||
in_pcsn = this.itemProtocol.getItem_in_pcsn();
|
||||
to_in_confirm_finish = this.itemProtocol.getItem_to_in_confirm_finish();
|
||||
if (mode != last_mode) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode);
|
||||
}
|
||||
@@ -200,22 +205,36 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
|
||||
//反馈mes清洗上料完成
|
||||
if (mode == 1 && task_finish == 1 && !requireSucess) {
|
||||
boolean flag = feedMesTaskClear(in_pcsn);
|
||||
this.noFeedMessage = null;
|
||||
// if (mode == 1 && task_finish == 1 && !requireSucess) {
|
||||
// boolean flag = feedMesTaskClear(in_pcsn);
|
||||
// this.noFeedMessage = null;
|
||||
// if (flag) {
|
||||
// this.message = "反馈清洗上料完成成功";
|
||||
// }
|
||||
// } else {
|
||||
// if (task_finish == 1) {
|
||||
// String notFeedMessage = "未反馈mes清洗上料完成原因:";
|
||||
// if (mode != 1) {
|
||||
// notFeedMessage += "";
|
||||
// }
|
||||
//// if (requireSucess) {
|
||||
//// notFeedMessage += "请求标记未复位,";
|
||||
//// }
|
||||
// this.noFeedMessage = this.replace(notFeedMessage);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (mode == 1 && task_finish == 1 ) {
|
||||
boolean flag = washTask(in_pcsn);
|
||||
if (flag) {
|
||||
this.message = "反馈清洗上料完成成功";
|
||||
}
|
||||
} else {
|
||||
if (task_finish == 1) {
|
||||
String notFeedMessage = "未反馈mes清洗上料完成原因:";
|
||||
if (mode != 1) {
|
||||
notFeedMessage += "";
|
||||
}
|
||||
if (requireSucess) {
|
||||
notFeedMessage += "请求标记未复位,";
|
||||
}
|
||||
this.noFeedMessage = this.replace(notFeedMessage);
|
||||
}
|
||||
|
||||
if (mode == 1 && to_in_confirm_finish == 1 ) {
|
||||
boolean flag = washTaskRun(in_pcsn);
|
||||
if (flag) {
|
||||
this.message = "反馈清洗上料执行中";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,7 +272,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
//下发储料仓去皮
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_peel","1");
|
||||
//下发称重
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_open_weight","1");
|
||||
// hailiangCleaningMachineStorageStationDeviceDriver.writing("to_open_weight","1");
|
||||
}
|
||||
});
|
||||
//修改工单状态为执行中
|
||||
@@ -344,6 +363,70 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 上料完成以后反馈mes 上料设备号
|
||||
*/
|
||||
private boolean washTask(int in_pcsn) {
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findOrderByDeviceCode(this.getDevice_code());
|
||||
if (dto != null) {
|
||||
if (!StrUtil.equals(dto.getOrder_code(),String.valueOf(in_pcsn))){
|
||||
return false;
|
||||
}
|
||||
this.writing("to_confirm_finished", "1");
|
||||
String[] in_devices = dto.getIn_devices().split(",");
|
||||
//上料完成清除储料仓内存中的物料信息
|
||||
Arrays.stream(in_devices).forEach(device_code -> {
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.setMaterial_code(null);
|
||||
//下发储料仓去皮
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_peel","1");
|
||||
}
|
||||
});
|
||||
//修改工单状态为执行中
|
||||
dto.setOrder_status("2");
|
||||
produceshiftorderService.update(dto);
|
||||
// TODO 反馈mes
|
||||
JSONObject reqParam = new JSONObject();
|
||||
reqParam.put("in_pcsn", in_pcsn);
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上料执行中反馈mes
|
||||
*/
|
||||
private boolean washTaskRun(int in_pcsn) {
|
||||
ProduceshiftorderDto dto = produceshiftorderService.findOrderByDeviceCode(this.getDevice_code());
|
||||
if (dto != null) {
|
||||
if (!StrUtil.equals(dto.getOrder_code(),String.valueOf(in_pcsn))){
|
||||
return false;
|
||||
}
|
||||
|
||||
//修改工单状态为执行中
|
||||
dto.setOrder_status("1");
|
||||
produceshiftorderService.update(dto);
|
||||
// TODO 反馈mes
|
||||
JSONObject reqParam = new JSONObject();
|
||||
reqParam.put("in_pcsn", in_pcsn);
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备监控信息
|
||||
@@ -393,7 +476,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
*/
|
||||
@Override
|
||||
public void issuedOrderInfo(ProduceshiftorderDto dto) {
|
||||
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver;
|
||||
|
||||
String[] in_devices = dto.getIn_devices().split(",");
|
||||
//上料储料仓总重量
|
||||
int weightSum = 0;
|
||||
@@ -404,7 +487,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
String in_device = in_devices[i];
|
||||
Device device = deviceAppService.findDeviceByCode(in_device);
|
||||
if (device != null) {
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
weightSum += hailiangCleaningMachineStorageStationDeviceDriver.getSilo_weight();
|
||||
qtySum += hailiangCleaningMachineStorageStationDeviceDriver.getFull_number();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_feeding", "1");
|
||||
@@ -412,7 +495,7 @@ public class HailiangCleaningFeedingLineDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
//下发电气信号
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_pcsn",dto.getOrder_id());//下发批次号,暂时用工单号
|
||||
map.put("to_pcsn",dto.getOrder_code());//下发批次号,暂时用工单号
|
||||
map.put("to_all_num", String.valueOf(qtySum));
|
||||
map.put("to_all_weight", String.valueOf(weightSum));
|
||||
map.put("to_in_confirm_finish", "1");
|
||||
|
||||
@@ -69,7 +69,9 @@ public class ItemProtocol {
|
||||
public int getItem_task_finish() {
|
||||
return this.getOpcIntegerValue(item_task_finish);
|
||||
}
|
||||
|
||||
public int getItem_to_in_confirm_finish() {
|
||||
return this.getOpcIntegerValue(item_to_in_confirm_finish);
|
||||
}
|
||||
public int getItem_allowed_in() {
|
||||
return this.getOpcIntegerValue(item_allowed_in);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
|
||||
}
|
||||
}
|
||||
//工作模式联机、强制搬出请求 就申请agv任务
|
||||
if (mode == 1 && empty_req == 1 && put_line_ready ==0 && !requireSucess) {
|
||||
if (mode == 1 && compel_full_req == 1 && put_line_ready ==0 && !requireSucess) {
|
||||
boolean flag = apply_task(StatusEnum.QXXL_COMPEL_REQ.getCode());
|
||||
this.noApplyTaskMessage = null;
|
||||
if (flag) {
|
||||
@@ -444,9 +444,10 @@ public class HailiangCleaningPutLineDeviceDriver extends AbstractOpcDeviceDriver
|
||||
reqParam.put("type", code);
|
||||
reqParam.put("device_code", this.getDevice_code());
|
||||
reqParam.put("in_pcsn", this.getIn_pcsn());
|
||||
reqParam.put("barcode", this.getBarcode());
|
||||
reqParam.put("full_weight", this.getFull_weight());
|
||||
reqParam.put("all_num",this.getAll_num());
|
||||
reqParam.put("workorder_code", this.getIn_pcsn());
|
||||
reqParam.put("vehicle_code", this.getBarcode());
|
||||
reqParam.put("weight", this.getFull_weight());
|
||||
reqParam.put("qty",this.getAll_num());
|
||||
HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
|
||||
@@ -259,22 +259,25 @@ public class EalingMachineDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
public void issuedOrderInfo(ProduceshiftorderDto dto) {
|
||||
EalingOrderDto ealingOrderDto = dto.getEalingOrderDto();
|
||||
if (ObjectUtil.isNotEmpty(ealingOrderDto)) {
|
||||
String x = "0";
|
||||
String y = "0";
|
||||
String[] xys = ealingOrderDto.getX_y().split(",");
|
||||
if (xys.length == 2) {
|
||||
x = xys[0];
|
||||
y = xys[1];
|
||||
}
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_clear", "1");
|
||||
map.put("to_order", ealingOrderDto.getOrder_code());
|
||||
map.put("to_order_box_num", ealingOrderDto.getOrder_box_num());
|
||||
map.put("to_order_bag_num", ealingOrderDto.getOrder_bag_num());
|
||||
// map.put("to_bag_num_of_box", ealingOrderDto.getBag_num_of_box());
|
||||
// map.put("to_one_box_weight", ealingOrderDto.getOne_box_weight());
|
||||
// map.put("to_one_bag_weight", ealingOrderDto.getOne_bag_weight());
|
||||
map.put("to_template_no", ealingOrderDto.getTemplate_no());
|
||||
|
||||
//模板号大于100 再下发这些信息
|
||||
if (StrUtil.isNotEmpty(ealingOrderDto.getTemplate_no()) && Integer.parseInt(ealingOrderDto.getTemplate_no()) > 100) {
|
||||
String x = "0";
|
||||
String y = "0";
|
||||
String[] xys = ealingOrderDto.getX_y().split(",");
|
||||
if (xys.length == 2) {
|
||||
x = xys[0];
|
||||
y = xys[1];
|
||||
}
|
||||
map.put("to_x" + x, x);
|
||||
map.put("to_y" + y, y);
|
||||
map.put("to_bag_length", ealingOrderDto.getBag_length());
|
||||
|
||||
@@ -482,7 +482,9 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
//到达取货点
|
||||
if (agvphase == 0x03) {
|
||||
if (ObjectUtil.isNotEmpty(inst) && gd_move == 1) {
|
||||
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());
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
@@ -505,7 +507,8 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
//取货完成
|
||||
if (agvphase == 0x05) {
|
||||
if (ObjectUtil.isNotEmpty(inst) && gd_move == 0) {
|
||||
// if (ObjectUtil.isNotEmpty(inst) && gd_move == 0) {
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode());
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
@@ -526,8 +529,11 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
}
|
||||
}
|
||||
|
||||
//到达放货点
|
||||
if (agvphase == 0x07) {
|
||||
if (ObjectUtil.isNotEmpty(inst) && gd_move == 0) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", inst.getInstruction_code(), "刻字上料PS20上报到达放货点:" + ",inst == null :" + ObjectUtil.isEmpty(inst));
|
||||
// if (ObjectUtil.isNotEmpty(inst) && gd_move == 0) {
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_TO_PUT_FALL_SEND_FULL.getCode());
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0);
|
||||
@@ -548,13 +554,15 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
}
|
||||
}
|
||||
|
||||
//放货完成
|
||||
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)) {
|
||||
//放框完成
|
||||
writing("to_agv_put_finish", "1");
|
||||
if (empty_req == 1){
|
||||
// if (empty_req == 1){
|
||||
//判断电气上报的【剩余实时重量】>10kg 将【上料总重量】写给电气
|
||||
if (engraving_storage_now_weight > 10){
|
||||
// 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);
|
||||
@@ -564,10 +572,10 @@ public class HailiangEngravingInDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
noFeedAgvMessage = null;
|
||||
message = this.messageInfo(agvphase);
|
||||
logServer.deviceExecuteLog(device_code, "", "", this.messageInfo(agvphase));
|
||||
}else {
|
||||
writing("to_agv_put_finish", "1");
|
||||
}
|
||||
}
|
||||
// }else {
|
||||
// writing("to_agv_put_finish", "1");
|
||||
// }
|
||||
// }
|
||||
|
||||
} else {
|
||||
String notFeedAgvMessage = "";
|
||||
|
||||
@@ -34,6 +34,7 @@ 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.EalingOrderDto;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
@@ -586,11 +587,21 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
// if (!this.getItemProtocol().getIsonline()) {
|
||||
// throw new BadRequestException("设备未开机,工单下发失败");
|
||||
// }
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_clear", "1");
|
||||
map.put("to_order", dto.getOrder_code());
|
||||
map.put("to_order_prod_num", String.valueOf(dto.getQty()));
|
||||
this.writing(map);
|
||||
EalingOrderDto ealingOrderDto = dto.getEalingOrderDto();
|
||||
if (ealingOrderDto != null) {
|
||||
String box_total_num = ealingOrderDto.getOrder_box_num();
|
||||
String bag_total_num = ealingOrderDto.getOrder_bag_num();
|
||||
String time = ealingOrderDto.getTime();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_clear", "1");
|
||||
map.put("to_order", dto.getOrder_code());
|
||||
// map.put("to_order_prod_num", String.valueOf(dto.getQty()));
|
||||
map.put("to_order_prod_num", bag_total_num);//包装机总包数
|
||||
map.put("to_box_total_num", box_total_num);//总箱数
|
||||
map.put("to_bag_total_num", bag_total_num);//总袋数
|
||||
|
||||
this.writing(map);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -253,7 +253,7 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_device_running_time, "包装机设备运转时间(S)", "DB1.D112"));
|
||||
list.add(new ItemDto(item_await_time, "包装机待机时间(S)", "DB1.D116"));
|
||||
list.add(new ItemDto(item_now_up_box_num, "当前装箱数量", "DB1.D124"));
|
||||
list.add(new ItemDto(item_now_bag_num_of_box, "当前装箱机箱实时袋数量", "DB1.D128"));
|
||||
list.add(new ItemDto(item_now_bag_num_of_box, "当前箱实时袋数量", "DB1.D128"));
|
||||
list.add(new ItemDto(item_now_bag_num, "当前装箱机袋装的总数量", "DB1.D132"));
|
||||
list.add(new ItemDto(item_now_seal_box_num, "当前封箱数量", "DB1.D136"));
|
||||
list.add(new ItemDto(item_order, "工单号", "DB1.D160"));
|
||||
|
||||
@@ -325,7 +325,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
|
||||
/**
|
||||
* 专家暂停
|
||||
* 专机暂停
|
||||
*/
|
||||
@Override
|
||||
public void toStop() {
|
||||
|
||||
@@ -199,7 +199,7 @@ public class UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
String is_foreward = ealingOrderDto.getIs_foreward();
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_clear", "1");
|
||||
map.put("to_is_foreward", is_foreward);
|
||||
map.put("to_foreward", is_foreward);
|
||||
map.put("to_order_box_num", ealingOrderDto.getOrder_box_num());
|
||||
map.put("to_order", ealingOrderDto.getOrder_code());
|
||||
this.writing(map);
|
||||
|
||||
@@ -128,4 +128,51 @@ public class WmsToAcsController {
|
||||
return new ResponseEntity<>(wmstoacsService.replaceDevice(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/putOver")
|
||||
@Log("余料上完")
|
||||
@ApiOperation("余料上完")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> putOver(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.putOver(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/handPour")
|
||||
@Log("手工倒料")
|
||||
@ApiOperation("手工倒料")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> handPour(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.handPour(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/startDischarge")
|
||||
@Log("开始卸料")
|
||||
@ApiOperation("开始卸料")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> startDischarge(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.startDischarge(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/handWeigh")
|
||||
@Log("手动称重")
|
||||
@ApiOperation("手动称重")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> handWeigh(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.handWeigh(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cleanPut")
|
||||
@Log("清洗下料")
|
||||
@ApiOperation("清洗下料")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> cleanPut(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.cleanPut(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cleaningIn")
|
||||
@Log("清洗上料")
|
||||
@ApiOperation("清洗上料")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> cleaningIn(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(wmstoacsService.cleaningIn(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,5 +162,11 @@ public interface AcsToWmsService {
|
||||
HttpResponse shipDeviceUpdate(JSONObject param);
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param);
|
||||
|
||||
|
||||
/**
|
||||
* 反馈清洗上料状态
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
HttpResponse washTask(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -107,5 +107,59 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
Map<String, Object> queryDeviceDBValue(String whereJson);
|
||||
|
||||
/**
|
||||
* 余料上完
|
||||
*
|
||||
* @param param 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> putOver(JSONObject param);
|
||||
|
||||
/**
|
||||
* 人工倒料
|
||||
*
|
||||
* @param param 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> handPour(JSONObject param);
|
||||
|
||||
/**
|
||||
* 开始卸料
|
||||
*
|
||||
* @param param 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> startDischarge(JSONObject param);
|
||||
|
||||
/**
|
||||
* 手动称重
|
||||
*
|
||||
* @param param 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> handWeigh(JSONObject param);
|
||||
|
||||
/**
|
||||
* 清洗下料
|
||||
*
|
||||
* @param param 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> cleanPut(JSONObject param);
|
||||
|
||||
/**
|
||||
* 刻字上料(mes直接下任务acs,此接口暂未用)
|
||||
*
|
||||
* @param param 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> engravingIn(JSONObject param);
|
||||
|
||||
/**
|
||||
* 清洗上料
|
||||
*
|
||||
* @param param 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> cleaningIn(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -689,4 +689,31 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse washTask(JSONObject param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
log.info("acs开始向mes反馈清洗上料状态,请求参数:{}", JSON.toJSONString(param));
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("washTask");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsurl + methods_url;
|
||||
HttpResponse result = null;
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute();
|
||||
log.info("acs向mes反馈工单状态成功,请求路径:{},请求参数:{},响应参数:{}", url, JSON.toJSONString(param), result.body());
|
||||
} catch (Exception e) {
|
||||
log.error("acs向mes反馈工单状态失败,请求路径:{},请求参数:{},失败原因:{}", url, JSON.toJSONString(param), e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.acs.ext.wms.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -12,9 +13,14 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.IssuedDeviceOrderInfo;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_auto_cache_line.HailiangAutoCacheLineDeviceDriver;
|
||||
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_storage_station.HailiangCleaningMachineStorageStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_put_line.HailiangCleaningPutLineDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_in.HailiangEngravingInDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_pour_station.HailiangSpecialPourStationDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control.StandardCoveyorControlDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcscanner.StandardCoveyorControlWithPlcScannerDeviceDriver;
|
||||
@@ -29,7 +35,6 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceExtraManageDto;
|
||||
import org.nl.acs.order.service.ProduceshiftorderService;
|
||||
import org.nl.acs.order.service.dto.EalingOrderDto;
|
||||
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
|
||||
@@ -39,11 +44,11 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -156,6 +161,44 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
TaskDto start_device_task = taskService.findByStartCode(start_point_code);
|
||||
if (start_device_task != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
// json.put("message", "已存在该设备的任务,设备号:" + start_point_code + ",对应的任务号:" + task_code);
|
||||
json.put("message", "已提交过任务!请勿重复点击!");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
//刻字上料任务特殊处理
|
||||
if (StrUtil.equals(start_point_code,"A1_KZ_SL")) {
|
||||
Device device = deviceAppService.findDeviceByCode(start_point_code);
|
||||
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingInDeviceDriver) {
|
||||
hailiangEngravingInDeviceDriver = (HailiangEngravingInDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangEngravingInDeviceDriver.getGd_move() == 0) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", "上面无料框!请核实后再点击按钮!");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StrUtil.equals(put_point_code,"A1_KZ_SL")) {
|
||||
Device device = deviceAppService.findDeviceByCode(put_point_code);
|
||||
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingInDeviceDriver) {
|
||||
hailiangEngravingInDeviceDriver = (HailiangEngravingInDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangEngravingInDeviceDriver.getGd_move() == 1) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", "上面有料框!请核实后再点击按钮!");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String start_device_code = "";
|
||||
String next_device_code = "";
|
||||
@@ -267,7 +310,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
if (ObjectUtil.isNotEmpty(package_ext)) {
|
||||
//是否启用封箱线
|
||||
is_used_fxx = ObjectUtil.isEmpty(package_ext.get("is_used_fxx")) ? null : package_ext.get("is_used_fxx").toString();
|
||||
//拆箱数量
|
||||
//拆箱数量()
|
||||
// unboxingOrderDto.setOrder_box_num(ObjectUtil.isEmpty(package_ext.get("demol_num")) ? null : package_ext.get("demol_num").toString());
|
||||
ealingOrderDto.setOrder_box_num(ObjectUtil.isEmpty(package_ext.get("demol_num")) ? null : package_ext.get("demol_num").toString());
|
||||
//装箱模版
|
||||
@@ -276,8 +319,22 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
lane_tray_template= ObjectUtil.isEmpty(package_ext.get("stack_model")) ? null : package_ext.get("stack_model").toString();
|
||||
//是否正反转
|
||||
ealingOrderDto.setIs_foreward(ObjectUtil.isEmpty(package_ext.get("is_foreward")) ? null : package_ext.get("is_foreward").toString());
|
||||
//袋数
|
||||
//总袋数
|
||||
ealingOrderDto.setOrder_bag_num(ObjectUtil.isEmpty(package_ext.get("order_bag_num")) ? null : package_ext.get("order_bag_num").toString());
|
||||
//装箱机设备
|
||||
ealing_device_code = ObjectUtil.isEmpty(package_ext.get("ealing_device_code")) ? null : package_ext.get("ealing_device_code").toString();
|
||||
//开箱机设备
|
||||
unboxing_device_code = ObjectUtil.isEmpty(package_ext.get("unboxing_device_code")) ? null : package_ext.get("unboxing_device_code").toString();
|
||||
//封箱机是否自动确认(1:自动确认 2:定时确认 3:人工确认)
|
||||
ealingOrderDto.setIs_auto_confirm(ObjectUtil.isEmpty(package_ext.get("auto_confirm")) ? null : package_ext.get("auto_confirm").toString());
|
||||
//确认时间
|
||||
ealingOrderDto.setTime(ObjectUtil.isEmpty(package_ext.get("time")) ? null : package_ext.get("time").toString());
|
||||
//每箱袋数
|
||||
ealingOrderDto.setBag_num_of_box(ObjectUtil.isEmpty(package_ext.get("one_bag_num")) ? null : package_ext.get("one_bag_num").toString());
|
||||
//每箱重量
|
||||
ealingOrderDto.setOne_box_weight(ObjectUtil.isEmpty(package_ext.get("demol_weight")) ? null : package_ext.get("demol_weight").toString());
|
||||
//每袋重量
|
||||
ealingOrderDto.setOne_bag_weight(ObjectUtil.isEmpty(package_ext.get("one_bag_weight")) ? null : package_ext.get("one_bag_weight").toString());
|
||||
}
|
||||
ealingOrderDto.setOrder_code(workorder_code);
|
||||
|
||||
@@ -1078,5 +1135,322 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
// return resultJson;
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> putOver(JSONObject param) {
|
||||
log.info("接收WMS余料上完,下发参数:{}", JSON.toJSONString(param));
|
||||
String start_point_code = param.getString("start_point_code");
|
||||
String next_point_code = param.getString("next_point_code");
|
||||
String weight = param.getString("weight");
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
throw new BadRequestException("起点号不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
throw new BadRequestException("终点号不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(weight)) {
|
||||
throw new BadRequestException("下发重量不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(start_point_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + start_point_code);
|
||||
}
|
||||
//刻字上料
|
||||
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingInDeviceDriver) {
|
||||
hailiangEngravingInDeviceDriver = (HailiangEngravingInDeviceDriver) device.getDeviceDriver();
|
||||
hailiangEngravingInDeviceDriver.writing("to_engraving_sn",next_point_code);
|
||||
hailiangEngravingInDeviceDriver.writing("to_in_weight",weight);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 200);
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("接收WMS余料上完成功,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> handPour(JSONObject param) {
|
||||
log.info("接收WMS人工倒料,下发参数:{}", JSON.toJSONString(param));
|
||||
String device_code = param.getString("device_code");
|
||||
int qtySum = param.getIntValue("qty");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(qtySum+"")) {
|
||||
throw new BadRequestException("下发数量不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + device_code);
|
||||
}
|
||||
//专机倒料
|
||||
HailiangSpecialPourStationDeviceDriver hailiangSpecialPourStationDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangSpecialPourStationDeviceDriver) {
|
||||
hailiangSpecialPourStationDeviceDriver = (HailiangSpecialPourStationDeviceDriver) device.getDeviceDriver();
|
||||
qtySum += hailiangSpecialPourStationDeviceDriver.getStorage_stock_num();
|
||||
hailiangSpecialPourStationDeviceDriver.writing("to_pour_num",String.valueOf(qtySum));
|
||||
}
|
||||
//清洗机储料仓
|
||||
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
qtySum += hailiangCleaningMachineStorageStationDeviceDriver.getFull_number();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_dumping_num",String.valueOf(qtySum));
|
||||
//下发储料仓开始称重
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_open_weight","1");
|
||||
//要睡一秒吗
|
||||
}
|
||||
//刻字机上料位(电气是重量)
|
||||
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingInDeviceDriver) {
|
||||
hailiangEngravingInDeviceDriver = (HailiangEngravingInDeviceDriver) device.getDeviceDriver();
|
||||
qtySum += hailiangEngravingInDeviceDriver.getEngraving_storage_now_weight();
|
||||
hailiangEngravingInDeviceDriver.writing("to_in_weight",String.valueOf(qtySum));
|
||||
}
|
||||
|
||||
//刻字机倒料位
|
||||
HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) {
|
||||
hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver();
|
||||
qtySum += hailiangEngravingMachineDeviceDriver.getLettering_silo_number();
|
||||
hailiangEngravingMachineDeviceDriver.writing("to_to_dumping_num",String.valueOf(qtySum));
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 200);
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("接收WMS人工倒料成功,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> startDischarge(JSONObject param) {
|
||||
log.info("接收WMS开始卸料,下发参数:{}", JSON.toJSONString(param));
|
||||
String device_code = param.getString("device_code");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + device_code);
|
||||
}
|
||||
//刻字上料
|
||||
HailiangEngravingInDeviceDriver hailiangEngravingInDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangEngravingInDeviceDriver) {
|
||||
hailiangEngravingInDeviceDriver = (HailiangEngravingInDeviceDriver) device.getDeviceDriver();
|
||||
hailiangEngravingInDeviceDriver.writing("to_agv_put_finish", "1");
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 200);
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("接收WMS开始卸料成功,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> handWeigh(JSONObject param) {
|
||||
log.info("接收WMS人工称重,下发参数:{}", JSON.toJSONString(param));
|
||||
String device_code = param.getString("device_code");
|
||||
int qtySum = param.getIntValue("qty");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(qtySum+"")) {
|
||||
throw new BadRequestException("下发数量不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + device_code);
|
||||
}
|
||||
int weight = 0;
|
||||
//清洗机储料仓
|
||||
HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver;
|
||||
if (device.getDeviceDriver() instanceof HailiangCleaningMachineStorageStationDeviceDriver) {
|
||||
hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) device.getDeviceDriver();
|
||||
qtySum += hailiangCleaningMachineStorageStationDeviceDriver.getFull_number();
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_dumping_num",String.valueOf(qtySum));
|
||||
//下发储料仓开始称重
|
||||
hailiangCleaningMachineStorageStationDeviceDriver.writing("to_open_weight","1");
|
||||
//下发称重后,读取重量要睡一秒吗
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
weight = hailiangCleaningMachineStorageStationDeviceDriver.getSilo_weight();
|
||||
}
|
||||
|
||||
JSONObject resultJson = new JSONObject();
|
||||
resultJson.put("status", 200);
|
||||
resultJson.put("message", "操作成功");
|
||||
resultJson.put("weight",weight);
|
||||
log.info("接收WMS人工倒料成功,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> cleanPut(JSONObject param) {
|
||||
log.info("接收WMS清洗下料,下发参数:{}", JSON.toJSONString(param));
|
||||
String device_code = param.getString("device_code");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + 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("vehicle_code", hailiangCleaningPutLineDeviceDriver.getBarcode());
|
||||
resultJson.put("weight", hailiangCleaningPutLineDeviceDriver.getFull_weight());
|
||||
}
|
||||
resultJson.put("status", 200);
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("接收WMS清洗下料成功,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@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)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应设备:" + 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());
|
||||
}
|
||||
resultJson.put("status", 200);
|
||||
resultJson.put("message", "操作成功");
|
||||
log.info("接收WMS刻字上料成功,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Map<String, Object> cleaningIn(JSONObject param) {
|
||||
// log.info("接收WMS清洗上料,下发参数:{}", JSON.toJSONString(param));
|
||||
// String device_code = param.getString("device_code");
|
||||
// String in_pcsn = param.getString("in_pcsn");
|
||||
// String[] in_devices = param.getString("in_devices").split(",");
|
||||
// if (StrUtil.isEmpty(device_code)) {
|
||||
// throw new BadRequestException("设备号不能为空!");
|
||||
// }
|
||||
// Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
// if (ObjectUtil.isEmpty(device)) {
|
||||
// throw new BadRequestException("未找到对应清洗上料设备:" + device_code);
|
||||
// }
|
||||
// JSONObject resultJson = new JSONObject();
|
||||
// //清洗上料
|
||||
// HailiangCleaningMachineStorageStationDeviceDriver hailiangCleaningMachineStorageStationDeviceDriver;
|
||||
// HailiangCleaningFeedingLineDriver hailiangCleaningFeedingLineDriver;
|
||||
// //上料储料仓总重量
|
||||
// int weightSum = 0;
|
||||
// //上料储料仓总数量
|
||||
// int qtySum = 0;
|
||||
//
|
||||
// if (device.getDeviceDriver() instanceof HailiangCleaningFeedingLineDriver) {
|
||||
// hailiangCleaningFeedingLineDriver = (HailiangCleaningFeedingLineDriver) device.getDeviceDriver();
|
||||
// if (hailiangCleaningFeedingLineDriver.getMode() == 1 && hailiangCleaningFeedingLineDriver.getIn_ready() == 1 && hailiangCleaningFeedingLineDriver.getAllowed_in() == 1 ) {
|
||||
// //遍历上料储料仓设备 求重量和数量和下发给清洗上料位
|
||||
// for (int i = 0; i < in_devices.length; i++) {
|
||||
// String in_device = in_devices[i];
|
||||
// Device m_device = deviceAppService.findDeviceByCode(in_device);
|
||||
// if (m_device != null) {
|
||||
// hailiangCleaningMachineStorageStationDeviceDriver = (HailiangCleaningMachineStorageStationDeviceDriver) m_device.getDeviceDriver();
|
||||
// weightSum += hailiangCleaningMachineStorageStationDeviceDriver.getSilo_weight();
|
||||
// qtySum += hailiangCleaningMachineStorageStationDeviceDriver.getFull_number();
|
||||
// hailiangCleaningMachineStorageStationDeviceDriver.writing("to_feeding", "1");
|
||||
// }
|
||||
// }
|
||||
// //下发上料位电气信号
|
||||
// if (device.getDeviceDriver() instanceof HailiangCleaningFeedingLineDriver) {
|
||||
// hailiangCleaningFeedingLineDriver = (HailiangCleaningFeedingLineDriver) device.getDeviceDriver();
|
||||
// Map<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_pcsn",in_pcsn);//下发批次号
|
||||
// map.put("to_all_num", String.valueOf(qtySum));
|
||||
// map.put("to_all_weight", String.valueOf(weightSum));
|
||||
// map.put("to_in_confirm_finish", "1");
|
||||
// hailiangCleaningFeedingLineDriver.writing(map);
|
||||
// //反馈给mes执行中状态
|
||||
// JSONObject reqParam = new JSONObject();
|
||||
// reqParam.put("in_pcsn", hailiangCleaningFeedingLineDriver.getIn_pcsn());
|
||||
// reqParam.put("status", StatusEnum.TASK_RUNNING.getCode());
|
||||
//// HttpResponse httpResponse = acsToWmsService.washTask(reqParam);
|
||||
//// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
//// this.writing("to_in_confirm_req", "1");
|
||||
//// requireSucess = true;
|
||||
//// return true;
|
||||
//// }
|
||||
// }
|
||||
// }else {
|
||||
// //光电信号不允许上料
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// resultJson.put("status", 200);
|
||||
// resultJson.put("message", "操作成功");
|
||||
// log.info("接收WMS清洗上料成功,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
// return resultJson;
|
||||
// }
|
||||
@Override
|
||||
public Map<String, Object> cleaningIn(JSONObject param) {
|
||||
log.info("接收WMS清洗上料,下发参数:{}", JSON.toJSONString(param));
|
||||
String device_code = param.getString("device_code");
|
||||
String in_pcsn = param.getString("in_pcsn");
|
||||
String in_devices = param.getString("in_devices");
|
||||
// String[] in_devices = param.getString("in_devices").split(",");
|
||||
JSONArray errArr = new JSONArray();
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
throw new BadRequestException("未找到对应清洗上料设备:" + device_code);
|
||||
}
|
||||
JSONObject resultJson = new JSONObject();
|
||||
ProduceshiftorderDto dto = new ProduceshiftorderDto();
|
||||
dto.setExt_order_id(in_pcsn);
|
||||
dto.setOrder_code(in_pcsn);
|
||||
dto.setQty(BigDecimal.valueOf(999999));
|
||||
dto.setMaterial_code("qxsl");
|
||||
dto.setDevice_code(device_code);
|
||||
dto.setIs_needmove("0");
|
||||
dto.setIn_devices(in_devices);
|
||||
dto.setCreate_by("mes");
|
||||
try {
|
||||
produceshiftorderService.create(dto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("in_pcsn", in_pcsn);
|
||||
json.put("message", e.getMessage());
|
||||
errArr.add(json);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(errArr)) {
|
||||
resultJson.put("status", 200);
|
||||
} else {
|
||||
resultJson.put("status", 400);
|
||||
}
|
||||
resultJson.put("errArr", errArr);
|
||||
resultJson.put("message", errArr.size() > 0 ? "存在下发未成功的清洗任务!" : "操作成功!");
|
||||
resultJson.put("data", new JSONObject());
|
||||
log.info("接收wms下发清洗下料,响应参数:{}", JSON.toJSONString(resultJson));
|
||||
return resultJson;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,7 +1034,12 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||
// NDC agv指令不当场取消指令,需要等agv上报
|
||||
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
||||
ndcAgvService.deleteAgvInstToNDC(entity);
|
||||
if (StrUtil.equals(entity.getInstruction_type(),AgvTypeEnum.PS_TYPE_1.getTaskType()) || StrUtil.equals(entity.getInstruction_type(),AgvTypeEnum.PS_TYPE_2.getTaskType()) || StrUtil.equals(entity.getInstruction_type(),AgvTypeEnum.RT_TYPE_1.getTaskType())){
|
||||
ndcAgvService.deleteAgvOneInstToNDC(entity);
|
||||
}else {
|
||||
ndcAgvService.deleteAgvInstToNDC(entity);
|
||||
}
|
||||
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -245,6 +245,15 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//码垛机械手(巷道),包装线体
|
||||
// if (StrUtil.isNotEmpty(dto.机械手设备号(待mes传))) {
|
||||
Device md_device = deviceAppService.findDeviceByCode("A1_MDJXS_1");
|
||||
if (md_device != null && md_device.getDeviceDriver() instanceof IssuedDeviceOrderInfo) {
|
||||
issuedDeviceOrderInfo = (IssuedDeviceOrderInfo) md_device.getDeviceDriver();
|
||||
issuedDeviceOrderInfo.issuedOrderInfo(dto);
|
||||
}
|
||||
// }
|
||||
}
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
wo.insert(json);
|
||||
|
||||
Reference in New Issue
Block a user