rev 缓存线、专机取放货条件更改
This commit is contained in:
@@ -349,7 +349,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
chm.put("error_code", "0");
|
||||
acsToWmsService.feedDeviceStatusType(chm);
|
||||
feedDeviceStatusFlag = true;
|
||||
} else if (this.itemProtocol.getIsonline() && (error == 1 || error == 51) && !feedDeviceStatusFlag) {
|
||||
} else if (this.itemProtocol.getIsonline() && !feedDeviceStatusFlag) {
|
||||
JSONObject chm = new JSONObject();
|
||||
chm.put("device_code", this.getDevice_code());
|
||||
//设备报警
|
||||
@@ -388,11 +388,12 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
|
||||
|
||||
if (mode == 1 && prepare_ready == 1 && move == 0 && in_ready == 0 && task != 0 && prepare_barcode != 99999 && (agvphase == 0x0A || agvphase == 0x21)) {
|
||||
//error == 35 表示准备位扫码异常 error == 34表示对接位扫码异常
|
||||
if (mode == 1 && prepare_ready == 1 && move == 0 && in_ready == 0 && task != 0 && error != 35 && (agvphase == 0x0A || agvphase == 0x21)) {
|
||||
this.writing("to_agv_put_ready", "1");
|
||||
this.writing("to_agv_put_finish", "0");
|
||||
//this.writing("to_agv_put_finish", "0");
|
||||
}
|
||||
if (mode == 1 && prepare_ready == 1 && move == 0 && task != 0 && prepare_barcode != 99999 && (agvphase == 0x0E || agvphase == 0x25 || agvphase == 0x03)) {
|
||||
if (mode == 1 && prepare_ready == 1 && move == 0 && task != 0 && error != 35 && (agvphase == 0x0E || agvphase == 0x25 || agvphase == 0x03)) {
|
||||
if (inst != null) {
|
||||
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
|
||||
if (taskDto != null) {
|
||||
@@ -435,7 +436,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
//agv到达送满框1或送满框2
|
||||
//需要判断工作模式是联机,对接位无货,准备位就绪,对接位入箱就绪,任务号不等于0,准备位条码正常
|
||||
//并且agv当前执行的指令存在并且指令号与缓存线提供的任务号一致才反馈agv允许放货
|
||||
if (mode == 1 && move == 0 && prepare_ready == 1 && in_ready == 1 && task != 0 && prepare_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
|
||||
if (mode == 1 && move == 0 && prepare_ready == 1 && in_ready == 1 && task != 0 && error != 35 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_TO_PUT_FALL_SEND_FULL.getCode());
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
|
||||
@@ -466,7 +467,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (in_ready != 1) {
|
||||
noFeedMessage += "对接位入箱未就绪,";
|
||||
}
|
||||
if (prepare_barcode == 99999) {
|
||||
if (error == 35) {
|
||||
noFeedMessage += "准备位条码异常,";
|
||||
}
|
||||
this.noFeedAgvMessage = this.replace(noFeedMessage);
|
||||
@@ -476,20 +477,16 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
} else if (agvphase == 0x0C || agvphase == 0x23) {
|
||||
//agv送满框1完毕或送满框2完毕
|
||||
//需要判断缓存线工作模式联机,对接位有货,任务号不为0,对接位条码正常才反馈agv以及电气放货完成
|
||||
if (mode == 1 && move == 1 && task != 0 && prepare_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
|
||||
|
||||
if (mode == 1 && in_finish == 1 && task != 0 && docking_barcode != 0 && error != 35 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
|
||||
if (inst != null) {
|
||||
TaskDto taskDto = taskserver.findByCodeFromCache(inst.getTask_code());
|
||||
if (taskDto != null) {
|
||||
if (docking_barcode != 0) {
|
||||
taskDto.setExt_param(new HashMap<>());
|
||||
taskDto.getExt_param().put("inbox", "" + docking_barcode);
|
||||
}
|
||||
taskDto.setExt_param(new HashMap<>());
|
||||
taskDto.getExt_param().put("inbox", "" + docking_barcode);
|
||||
taskDto.setVehicle_code(String.valueOf(docking_barcode));
|
||||
taskserver.update(taskDto);
|
||||
}
|
||||
}
|
||||
|
||||
this.writing("to_agv_put_finish", "1");
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_PUT_FALL_SEND_FULL_FINISH.getCode());
|
||||
instructionService.update(inst);
|
||||
@@ -510,14 +507,14 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (in_ready != 1) {
|
||||
noFeedMessage += "对接位入箱未就绪,";
|
||||
}
|
||||
if (prepare_barcode == 99999) {
|
||||
if (error == 35) {
|
||||
noFeedMessage += "准备位条码异常,";
|
||||
}
|
||||
this.noFeedAgvMessage = this.replace(noFeedMessage);
|
||||
}
|
||||
} else if (agvphase == 0x0E || agvphase == 0x25) {
|
||||
//agv到达取空框1或取空框2
|
||||
if (mode == 1 && move == 1 && out_ready == 1 && task != 0 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task && prepare_barcode != 99999) {
|
||||
if (mode == 1 && move == 1 && out_ready == 1 && task != 0 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
|
||||
this.writing("to_agv_get_ready", "1");
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET_EMPTY.getCode());
|
||||
instructionService.update(inst);
|
||||
@@ -532,11 +529,8 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (move != 1) {
|
||||
noFeedMessage += "对接位光电无货,";
|
||||
}
|
||||
if (prepare_ready != 1) {
|
||||
noFeedMessage += "准备位未就绪,";
|
||||
}
|
||||
if (prepare_barcode == 99999) {
|
||||
noFeedMessage += "对接位条码异常,";
|
||||
if (out_ready != 1) {
|
||||
noFeedMessage += "对接位出箱未就绪,";
|
||||
}
|
||||
this.noFeedAgvMessage = this.replace(noFeedMessage);
|
||||
}
|
||||
@@ -589,9 +583,9 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
*/
|
||||
if (agvphase == 0x03) {
|
||||
//缓存线出满框 到达取货点
|
||||
if (mode == 1 && move == 1 && out_ready == 1 && task != 0 && docking_barcode != 99999 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
|
||||
if (mode == 1 && move == 1 && out_ready == 1 && task != 0 && error != 34 && ObjectUtil.isNotEmpty(inst) && Integer.parseInt(inst.getInstruction_code()) == task) {
|
||||
this.writing("to_agv_get_ready", "1");
|
||||
this.writing("to_agv_put_finish", "0");
|
||||
//this.writing("to_agv_put_finish", "0");
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
|
||||
@@ -618,13 +612,10 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (move != 0) {
|
||||
noFeedMessage += "对接位光电有货,";
|
||||
}
|
||||
if (prepare_ready != 1) {
|
||||
noFeedMessage += "准备位未就绪,";
|
||||
}
|
||||
if (out_ready != 1) {
|
||||
noFeedMessage += "对接位出箱未就绪,";
|
||||
}
|
||||
if (prepare_barcode == 99999) {
|
||||
if (error == 35) {
|
||||
noFeedMessage += "准备位条码异常,";
|
||||
}
|
||||
this.noFeedAgvMessage = this.replace(noFeedMessage);
|
||||
@@ -633,7 +624,7 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
} else if (agvphase == 0x05) {
|
||||
//缓存线出满框 取货完毕
|
||||
if (mode == 1 && move == 0 && prepare_barcode != 99999 && ObjectUtil.isNotEmpty(inst)) {
|
||||
if (mode == 1 && move == 0 && ObjectUtil.isNotEmpty(inst)) {
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_GET_FINISH.getCode());
|
||||
instructionService.update(inst);
|
||||
byte[] data = agvService.sendAgvTwoModeInst(agvphase, index, 0);
|
||||
@@ -653,9 +644,6 @@ public class HailiangAutoCacheLineDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (move != 0) {
|
||||
noFeedMessage += "对接位光电有货,";
|
||||
}
|
||||
if (prepare_barcode == 99999) {
|
||||
noFeedMessage += "对接位条码异常,";
|
||||
}
|
||||
this.noFeedAgvMessage = this.replace(noFeedMessage);
|
||||
}
|
||||
} else if (agvphase == 0x13 || agvphase == 0x17) {
|
||||
|
||||
@@ -43,25 +43,25 @@ public class ItemProtocol {
|
||||
//任务类型
|
||||
public static String item_task_type = "task_type";
|
||||
//物料规格
|
||||
public static String item_material_spec1= "material_spec1";
|
||||
public static String item_material_spec1 = "material_spec1";
|
||||
|
||||
public static String item_material_spec2= "material_spec2";
|
||||
public static String item_material_spec2 = "material_spec2";
|
||||
|
||||
public static String item_material_spec3= "material_spec3";
|
||||
public static String item_material_spec3 = "material_spec3";
|
||||
|
||||
public static String item_material_spec4= "material_spec4";
|
||||
public static String item_material_spec4 = "material_spec4";
|
||||
|
||||
public static String item_material_spec5= "material_spec5";
|
||||
public static String item_material_spec5 = "material_spec5";
|
||||
|
||||
public static String item_material_spec6= "material_spec6";
|
||||
public static String item_material_spec6 = "material_spec6";
|
||||
|
||||
public static String item_material_spec7= "material_spec7";
|
||||
public static String item_material_spec7 = "material_spec7";
|
||||
|
||||
public static String item_material_spec8= "material_spec8";
|
||||
public static String item_material_spec8 = "material_spec8";
|
||||
|
||||
public static String item_material_spec9= "material_spec9";
|
||||
public static String item_material_spec9 = "material_spec9";
|
||||
|
||||
public static String item_material_spec10= "material_spec10";
|
||||
public static String item_material_spec10 = "material_spec10";
|
||||
//准备位条码
|
||||
public static String item_prepare_barcode = "prepare_barcode";
|
||||
//对接位条码
|
||||
@@ -163,45 +163,45 @@ public class ItemProtocol {
|
||||
public static String item_to_pause_out_check = "to_pause_out_check";
|
||||
|
||||
//物料规格
|
||||
public static String item_to_material_spec1= "to_material_spec1";
|
||||
public static String item_to_material_spec1 = "to_material_spec1";
|
||||
|
||||
public static String item_to_material_spec2= "to_material_spec2";
|
||||
public static String item_to_material_spec2 = "to_material_spec2";
|
||||
|
||||
public static String item_to_material_spec3= "to_material_spec3";
|
||||
public static String item_to_material_spec3 = "to_material_spec3";
|
||||
|
||||
public static String item_to_material_spec4= "to_material_spec4";
|
||||
public static String item_to_material_spec4 = "to_material_spec4";
|
||||
|
||||
public static String item_to_material_spec5= "to_material_spec5";
|
||||
public static String item_to_material_spec5 = "to_material_spec5";
|
||||
|
||||
public static String item_to_material_spec6= "to_material_spec6";
|
||||
public static String item_to_material_spec6 = "to_material_spec6";
|
||||
|
||||
public static String item_to_material_spec7= "to_material_spec7";
|
||||
public static String item_to_material_spec7 = "to_material_spec7";
|
||||
|
||||
public static String item_to_material_spec8= "to_material_spec8";
|
||||
public static String item_to_material_spec8 = "to_material_spec8";
|
||||
|
||||
public static String item_to_material_spec9= "to_material_spec9";
|
||||
public static String item_to_material_spec9 = "to_material_spec9";
|
||||
|
||||
public static String item_to_material_spec10= "to_material_spec10";
|
||||
public static String item_to_material_spec10 = "to_material_spec10";
|
||||
|
||||
public static String item_to_material_spec11= "to_material_spec11";
|
||||
public static String item_to_material_spec11 = "to_material_spec11";
|
||||
|
||||
public static String item_to_material_spec12= "to_material_spec12";
|
||||
public static String item_to_material_spec12 = "to_material_spec12";
|
||||
|
||||
public static String item_to_material_spec13= "to_material_spec13";
|
||||
public static String item_to_material_spec13 = "to_material_spec13";
|
||||
|
||||
public static String item_to_material_spec14= "to_material_spec14";
|
||||
public static String item_to_material_spec14 = "to_material_spec14";
|
||||
|
||||
public static String item_to_material_spec15= "to_material_spec15";
|
||||
public static String item_to_material_spec15 = "to_material_spec15";
|
||||
|
||||
public static String item_to_material_spec16= "to_material_spec16";
|
||||
public static String item_to_material_spec16 = "to_material_spec16";
|
||||
|
||||
public static String item_to_material_spec17= "to_material_spec17";
|
||||
public static String item_to_material_spec17 = "to_material_spec17";
|
||||
|
||||
public static String item_to_material_spec18= "to_material_spec18";
|
||||
public static String item_to_material_spec18 = "to_material_spec18";
|
||||
|
||||
public static String item_to_material_spec19= "to_material_spec19";
|
||||
public static String item_to_material_spec19 = "to_material_spec19";
|
||||
|
||||
public static String item_to_material_spec20= "to_material_spec20";
|
||||
public static String item_to_material_spec20 = "to_material_spec20";
|
||||
|
||||
//准备位条码准备
|
||||
public static String item_to_prepare_barcode_write = "to_prepare_barcode_write";
|
||||
@@ -271,7 +271,6 @@ public class ItemProtocol {
|
||||
public static String item_to_barcode30 = "to_barcode30";
|
||||
|
||||
|
||||
|
||||
private HailiangAutoCacheLineDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(HailiangAutoCacheLineDeviceDriver driver) {
|
||||
@@ -285,6 +284,7 @@ public class ItemProtocol {
|
||||
public int getError() {
|
||||
return this.getOpcIntegerValue(item_error);
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
}
|
||||
|
||||
// 修改工单状态为生产中
|
||||
if (mode == 1 && order > 0 && order_now == 0) {
|
||||
if (mode == 1 && order > 0) {
|
||||
ProduceshiftorderDto pdto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
if (pdto != null) {
|
||||
if (pdto.getOrder_status().equals(WorkerOrderEnum.READY.getCode())) {
|
||||
|
||||
@@ -211,7 +211,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
// 修改工单状态为生产中
|
||||
if (mode == 1 && order > 0 && now_order_prod_num == 0) {
|
||||
if (mode == 1 && order > 0 && order_prod_allnum > 0) {
|
||||
ProduceshiftorderDto pdto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
if (pdto != null) {
|
||||
if (pdto.getOrder_status().equals(WorkerOrderEnum.READY.getCode())) {
|
||||
@@ -222,7 +222,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
//修改工单状态为自动完成
|
||||
if (mode == 1 && finish != last_finish && finish == 1 && order > 0) {
|
||||
if (mode == 1 && finish != last_finish && finish == 1 && order > 0 && now_order_prod_num == order_prod_allnum) {
|
||||
ProduceshiftorderDto pdto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
if (pdto != null) {
|
||||
if (pdto.getOrder_status().equals(WorkerOrderEnum.PRODUCTING.getCode())) {
|
||||
|
||||
@@ -304,30 +304,6 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Date date = new Date();
|
||||
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
// return false;
|
||||
// } else {
|
||||
// //判断是否需要AGV搬运 需要就申请任务 不需要不申请
|
||||
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(this.getOrder()));
|
||||
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
|
||||
// JSONObject reqParam = new JSONObject();
|
||||
// reqParam.put("device_code", this.getDevice_code());
|
||||
// reqParam.put("type", StatusEnum.FULL_REQ.getCode());
|
||||
// reqParam.put("quantity", this.getFull_number());
|
||||
// reqParam.put("workorder_code", this.getOrder());
|
||||
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
// if (resp.getInteger("status") == 200) {
|
||||
// requireSucess = true;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -281,28 +281,6 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Date date = new Date();
|
||||
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
// return false;
|
||||
// } else {
|
||||
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
|
||||
// JSONObject reqParam = new JSONObject();
|
||||
// reqParam.put("device_code", this.getDevice_code());
|
||||
// reqParam.put("type", StatusEnum.LACK_REQ.getCode());
|
||||
// reqParam.put("workorder_code", this.getOrder());
|
||||
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
// if (httpResponse != null && httpResponse.getStatus() == 200) {
|
||||
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
// if (resp.getInteger("status") == 200) {
|
||||
// requireSucess = true;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
|
||||
// 修改工单状态为生产中
|
||||
if (mode == 1 && order > 0 && order_now == 0) {
|
||||
if (mode == 1 && order > 0) {
|
||||
ProduceshiftorderDto pdto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
if (pdto != null) {
|
||||
if (pdto.getOrder_status().equals(WorkerOrderEnum.READY.getCode())) {
|
||||
@@ -537,26 +537,6 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Date date = new Date();
|
||||
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
// return false;
|
||||
// } else {
|
||||
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
// TaskDto taskDto = taskService.findByStartCode(device_code);
|
||||
// if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
|
||||
// JSONObject reqParam = new JSONObject();
|
||||
// reqParam.put("device_code", this.getDevice_code());
|
||||
// reqParam.put("type", StatusEnum.BZ_EMPTY_REQ.getCode());
|
||||
// reqParam.put("workorder_code", this.getOrder());
|
||||
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
// requireSucess = true;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -587,29 +567,6 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Date date = new Date();
|
||||
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
// return false;
|
||||
// } else {
|
||||
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
// TaskDto taskDto = taskService.findByNextCode(device_code);
|
||||
// if (produceshiftorderDto != null && produceshiftorderDto.getIs_needmove().equals(StatusEnum.NEED_MOVE.getCode()) && taskDto == null) {
|
||||
// JSONObject reqParam = new JSONObject();
|
||||
// reqParam.put("device_code", this.getDevice_code());
|
||||
// reqParam.put("type", StatusEnum.BZ_FULL_REQ.getCode());
|
||||
// reqParam.put("workorder_code", this.getOrder());
|
||||
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
// if (resp.getInteger("status") == 200) {
|
||||
// requireSucess = true;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
|
||||
// 修改工单状态为生产中
|
||||
if (mode == 1 && order > 0 && now_order_prod_num == 0) {
|
||||
if (mode == 1 && order > 0 && order_prod_allnum > 0) {
|
||||
ProduceshiftorderDto pdto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
if (pdto != null) {
|
||||
if (pdto.getOrder_status().equals(WorkerOrderEnum.READY.getCode())) {
|
||||
|
||||
@@ -284,7 +284,6 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
* @return
|
||||
*/
|
||||
public synchronized boolean apply_task() {
|
||||
|
||||
if (redisUtils.hasKey("apply:" + this.device_code)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -308,31 +307,6 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Date date = new Date();
|
||||
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
// return false;
|
||||
// } else {
|
||||
// //判断是否需要AGV搬运 需要就申请任务 不需要不申请
|
||||
// JSONObject reqParam = new JSONObject();
|
||||
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(this.getOrder()));
|
||||
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
|
||||
// reqParam.put("type", StatusEnum.FULL_REQ.getCode());
|
||||
// reqParam.put("device_code", this.getDevice_code());
|
||||
// reqParam.put("quantity", this.getFull_number());
|
||||
// reqParam.put("workorder_code", this.getOrder());
|
||||
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
// if (resp.getInteger("status") == 200) {
|
||||
// requireSucess = true;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -288,32 +288,6 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Date date = new Date();
|
||||
// if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
// return false;
|
||||
// } else {
|
||||
// ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
// if (produceshiftorderDto != null && StrUtil.equals(produceshiftorderDto.getIs_needmove(), StatusEnum.NEED_MOVE.getCode())) {
|
||||
// JSONObject reqParam = new JSONObject();
|
||||
// reqParam.put("device_code", this.getDevice_code());
|
||||
// reqParam.put("type", StatusEnum.LACK_REQ.getCode());
|
||||
// reqParam.put("workorder_code", this.getOrder());
|
||||
// HttpResponse httpResponse = acsToWmsService.applyTaskToWms(reqParam);
|
||||
// if (httpResponse != null && httpResponse.getStatus() == 200) {
|
||||
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||
// if (resp.getInteger("status") == 200) {
|
||||
// requireSucess = true;
|
||||
// return true;
|
||||
// } else {
|
||||
// message = "申请任务失败,原因:" + resp.getString("message");
|
||||
// }
|
||||
// } else {
|
||||
// message = "申请任务失败,原因:接口不通!";
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
|
||||
}
|
||||
|
||||
// 修改工单状态为生产中
|
||||
if (mode == 1 && order > 0 && order_now == 0) {
|
||||
if (mode == 1 && order > 0) {
|
||||
ProduceshiftorderDto pdto = produceshiftorderService.findByCodeFromCache(String.valueOf(order));
|
||||
if (pdto != null) {
|
||||
if (pdto.getOrder_status().equals("0")) {
|
||||
|
||||
@@ -348,4 +348,6 @@ public interface InstructionService {
|
||||
* @param dto
|
||||
*/
|
||||
void removeCacheLinePhase(Instruction dto);
|
||||
|
||||
Instruction findInstByPutDeviceCode(String put_device_code);
|
||||
}
|
||||
|
||||
@@ -1021,6 +1021,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
deviceService.changeDeviceStatus(jo1);
|
||||
|
||||
this.update(entity);
|
||||
removeCacheLinePhase(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1434,11 +1435,28 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (put_device != null && put_device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) put_device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(0, 0, null);
|
||||
if (hailiangAutoCacheLineDeviceDriver.getTask() != 0 && hailiangAutoCacheLineDeviceDriver.getTask() == Integer.parseInt(dto.getInstruction_code())) {
|
||||
hailiangAutoCacheLineDeviceDriver.writing("to_task_finish", "1");
|
||||
}
|
||||
}
|
||||
if (start_device != null && next_device != null && start_device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver && next_device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) start_device.getDeviceDriver();
|
||||
hailiangAutoCacheLineDeviceDriver.set(0, 0, null);
|
||||
if (hailiangAutoCacheLineDeviceDriver.getTask() != 0 && hailiangAutoCacheLineDeviceDriver.getTask() == Integer.parseInt(dto.getInstruction_code())) {
|
||||
hailiangAutoCacheLineDeviceDriver.writing("to_task_finish", "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findInstByPutDeviceCode(String put_device_code) {
|
||||
return Optional
|
||||
.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(i -> i.getPut_device_code().equals(put_device_code))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,6 +574,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
Instruction dto = instructionService.createInstDtoByTask(taskDto, link_no);
|
||||
instructionService.create(dto);
|
||||
taskDto.setTask_status(StatusEnum.TASK_RUNNING.getCode());
|
||||
this.update(taskDto);
|
||||
}
|
||||
if (tasksByLinkNum.size() == 2) {
|
||||
TaskDto taskDto1 = tasksByLinkNum.get(0);
|
||||
@@ -589,6 +591,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
Instruction dto1 = instructionService.createInstDtoByTask(taskDto1, link_no);
|
||||
Instruction dto2 = instructionService.createInstDtoByTask(taskDto2, link_no);
|
||||
instructionService.createTwoInst(dto1, dto2);
|
||||
taskDto1.setTask_status(StatusEnum.TASK_RUNNING.getCode());
|
||||
taskDto1.setUpdate_time(DateUtil.now());
|
||||
this.update(taskDto1);
|
||||
taskDto2.setTask_status(StatusEnum.TASK_RUNNING.getCode());
|
||||
taskDto2.setUpdate_time(DateUtil.now());
|
||||
this.update(taskDto2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.acsEnum.AgvTypeEnum;
|
||||
import org.nl.acs.acsEnum.StatusEnum;
|
||||
import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_auto_cache_line.HailiangAutoCacheLineDeviceDriver;
|
||||
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.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
@@ -29,6 +32,8 @@ public class AutoCreateInst {
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -57,7 +62,7 @@ public class AutoCreateInst {
|
||||
.orElse(new ArrayList<>())
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(TaskDto::getLink_num));
|
||||
|
||||
HailiangAutoCacheLineDeviceDriver hailiangAutoCacheLineDeviceDriver;
|
||||
//遍历分组任务 如果任务数为2则是下发双任务,如果任务数为1 则下发单任务
|
||||
for (Map.Entry<String, List<TaskDto>> task_values : link_num_tasks.entrySet()) {
|
||||
List<TaskDto> tasks =
|
||||
@@ -81,6 +86,31 @@ public class AutoCreateInst {
|
||||
if (StrUtil.equals(taskDto.getIs_send(), StatusEnum.NO_SEND.getCode())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//单入任务 判断缓存线是否有任务
|
||||
String task_type = taskDto.getTask_type();
|
||||
if (StrUtil.equals(task_type, AgvTypeEnum.NB_TYPE_3.getAgvInstType())) {
|
||||
String put_device_code = taskDto.getPut_device_code();
|
||||
Device device = deviceAppService.findDeviceByCode(put_device_code);
|
||||
if (device != null && device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangAutoCacheLineDeviceDriver.getTask() != 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
//单工任务 判断缓存线是否有任务
|
||||
if (StrUtil.equals(task_type, AgvTypeEnum.NB_TYPE_2.getAgvInstType())) {
|
||||
String start_device_code = taskDto.getStart_device_code();
|
||||
Device device = deviceAppService.findDeviceByCode(start_device_code);
|
||||
if (device != null && device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangAutoCacheLineDeviceDriver.getTask() != 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//生产指令关联编号
|
||||
String link_no = CodeUtil.getNewCode("LINK_NO");
|
||||
|
||||
@@ -99,11 +129,30 @@ public class AutoCreateInst {
|
||||
taskService.update(taskDto);
|
||||
|
||||
} else if (tasks.size() == TASK_SIZE_2) {
|
||||
//生产指令关联编号
|
||||
String link_no = CodeUtil.getNewCode("LINK_NO");
|
||||
|
||||
TaskDto taskDto1 = tasks.get(0);
|
||||
TaskDto taskDto2 = tasks.get(1);
|
||||
|
||||
//关联编号一致 任务类型不一致 不生成任务
|
||||
if (!taskDto1.getTask_type().equals(taskDto2.getTask_type())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//如果是双入任务 则判断缓存线是否有任务
|
||||
if (StrUtil.equals(taskDto1.getTask_type(), AgvTypeEnum.NB_TYPE_4.getAgvInstType())) {
|
||||
Device device = deviceAppService.findDeviceByCode(taskDto1.getPut_device_code());
|
||||
if (device != null && device.getDeviceDriver() instanceof HailiangAutoCacheLineDeviceDriver) {
|
||||
hailiangAutoCacheLineDeviceDriver = (HailiangAutoCacheLineDeviceDriver) device.getDeviceDriver();
|
||||
if (hailiangAutoCacheLineDeviceDriver.getTask() != 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//生产指令关联编号
|
||||
String link_no = CodeUtil.getNewCode("LINK_NO");
|
||||
|
||||
|
||||
Instruction instDto1 = instructionService.createInstDtoByTask(taskDto1, link_no);
|
||||
Instruction instDto2 = instructionService.createInstDtoByTask(taskDto2, link_no);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user