手动完成工单时也要向电气下发一个信号

This commit is contained in:
loujf
2022-10-10 09:43:39 +08:00
parent 1de04cc067
commit fa6ec539a0
3 changed files with 36 additions and 10 deletions

View File

@@ -219,10 +219,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
// logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time));
// logServer.deviceExecuteLog(this.device_code,"","","信号production_time" + last_production_time + "->" + production_time);
// }
if (error_time != last_error_time) {
logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time));
logServer.deviceExecuteLog(this.device_code,"","","信号error_time" + last_error_time + "->" + error_time);
}
// if (error_time != last_error_time) {
// logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time));
// logServer.deviceExecuteLog(this.device_code,"","","信号error_time" + last_error_time + "->" + error_time);
// }
if (task_qty != last_task_qty) {
logServer.deviceItemValue(this.device_code,"task_qty" ,String.valueOf(task_qty));
logServer.deviceExecuteLog(this.device_code,"","","信号task_qty" + last_task_qty + "->" + task_qty);
@@ -308,11 +308,11 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
//执行单任务下的业务逻辑
//给后工位下发空盘放货信号
//判断条件 前工位无任务、无货 后工位有任务取货完成
if(mode ==3 && action_2 == 2 && move_2 != 0 && move_1 == 0 && ObjectUtil.isNotEmpty(inst2) && ObjectUtil.isEmpty(inst1) ){
if(mode == 3 && action_2 == 2 && move_2 != 0 && move_1 == 0 && ObjectUtil.isNotEmpty(inst2) && ObjectUtil.isEmpty(inst1) ){
writing("to_command2","2");
}
//给前工位取满托下发放货信号
if(mode ==3 && action_1 == 2 && move_1 != 0 && move_2 == 0 && task1>0 && ObjectUtil.isNotEmpty(inst1) && ObjectUtil.isEmpty(inst2) ){
if(mode == 3 && action_1 == 2 && move_1 != 0 && move_2 == 0 && task1>0 && ObjectUtil.isNotEmpty(inst1) && ObjectUtil.isEmpty(inst2) ){
writing("to_command1","2");
}
@@ -350,15 +350,15 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi
if (mode == 2 && move_2 == 0 && action_2 == 0 && !requireSucess2) {
instruction_require2();
}
if (mode == 2 && move_2 == 0 && action_2 == 0 && move_1 == 0 && ObjectUtil.isEmpty(inst2) && !requireSucess1){
instruction_require();
}
break;
case 3:
//前工位申请任务
if (mode == 3 && move_2 == 1 && action_2 == 1 && move_1 == 0 && !requireSucess1) {
instruction_require();
}
if(mode == 2 && move_2 == 0 && action_2 == 0 && move_1 == 0 && ObjectUtil.isEmpty(inst2) && !requireSucess1){
instruction_require();
}
}
switch (flag) {

View File

@@ -6,7 +6,12 @@ import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.LnshSplitManipulatorDeviceDriver;
import org.nl.acs.device_driver.lnsh.rljn_package_palletSplit_manipulator.RljnPackagePalletSplitManipulatorDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.exception.BadRequestException;
@@ -48,6 +53,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
@Autowired
AcsConfigService acsConfigService;
@Autowired
DeviceAppService deviceAppService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
HashMap<String, String> map = new HashMap<>();
@@ -170,6 +178,24 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
dto.setOrder_status("3");
this.update(dto);
Device device = deviceAppService.findDeviceByCode(dto.getDevice_code());
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
LnshSplitManipulatorDeviceDriver lnshSplitManipulatorDeviceDriver;
RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver;
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
lnshPalletizingManipulatorSiteDeviceDriver.writing(9);
}
if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) {
lnshSplitManipulatorDeviceDriver = (LnshSplitManipulatorDeviceDriver) device.getDeviceDriver();
lnshSplitManipulatorDeviceDriver.writing(9);
}
if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) {
rljnPackagePalletSplitManipulatorDeviceDriver = (RljnPackagePalletSplitManipulatorDeviceDriver) device.getDeviceDriver();
rljnPackagePalletSplitManipulatorDeviceDriver.writing(9);
}
//判断是否为wms下发的排产单
String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS);
if (StrUtil.isNotEmpty(dto.getProduct_type()) && hasWms.equals("1")) {