diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanDeviceErrorLog.java b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanDeviceErrorLog.java new file mode 100644 index 000000000..1dbc5041c --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanDeviceErrorLog.java @@ -0,0 +1,36 @@ +package org.nl.acs.autotask; + +/** + * @Author : TuQiang + * @create 2024/5/27 9:45 + */ + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.AcsConfig; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.wql.core.bean.WQLObject; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * 自动清除日志(设备故障)数据 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class CleanDeviceErrorLog { + + private final ParamService paramService; + + public void run() { + //delete from acs_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10; + log.info("开始打印日志"); + int days = Integer.parseInt(paramService.findByCode(AcsConfig.AutoCleanDays).getValue()); + WQLObject logTab = WQLObject.getWQLObject("acs_device_error_log"); + logTab.delete("DATE(error_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); + log.info("自动清理日志执行成功...!"); + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java index e57361faf..94878b292 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java @@ -121,4 +121,16 @@ public interface AcsConfig { * 日志级别 */ String LOGLEVEL = "log_level"; + /** + * AGV偏移量A点 + */ + String OFFSET_A = "offSet_A"; + /** + * AGV偏移量B点 + */ + String OFFSET_B = "offSet_B"; + /** + * 选择A点还是B点 + */ + String CHOOSE = "choose"; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java index 1908f1bdf..89004f32f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/rest/AddressController.java @@ -31,6 +31,12 @@ public class AddressController { return new ResponseEntity<>(addressService.queryAll(whereJson, page), HttpStatus.OK); } + @GetMapping("/queryAddressCodeList") + @Log("查询接口方法地址编码") + public ResponseEntity queryAddressCodeList() { + return new ResponseEntity<>(addressService.queryAddressCodeList(), HttpStatus.OK); + } + @PostMapping @Log("新增接口方法地址") public ResponseEntity create(@Validated @RequestBody AddressDto dto) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/AddressService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/AddressService.java index d5cd4064c..d82ebea6d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/AddressService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/AddressService.java @@ -1,5 +1,6 @@ package org.nl.acs.address.service; +import com.alibaba.fastjson.JSONObject; import org.nl.acs.common.base.PageInfo; import org.nl.acs.common.base.CommonService; import org.nl.acs.address.domain.Address; @@ -146,4 +147,6 @@ public interface AddressService extends CommonService
{ * @throws IOException / */ void download(List dtos, HttpServletResponse response) throws IOException; + + JSONObject queryAddressCodeList(); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java index 49bfbe939..548a77539 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/address/service/impl/AddressServiceImpl.java @@ -1,5 +1,6 @@ package org.nl.acs.address.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; @@ -198,4 +199,21 @@ public class AddressServiceImpl extends CommonServiceImpl list = new ArrayList<>(); + List addressDtoList = this.queryAll(new HashMap()); + if (CollectionUtil.isNotEmpty(addressDtoList)){ + for (AddressDto addressDto : addressDtoList) { + JSONObject jo = new JSONObject(); + jo.put("label",addressDto.getMethods_name()); + jo.put("value",addressDto.getMethods_code()); + list.add(jo); + } + } + JSONObject ja1 = new JSONObject(); + ja1.put("content",list); + return ja1; + } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index 068c6efed..52656158c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -117,7 +117,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } int[] arr = new int[count]; - StringBuffer bs = new StringBuffer(); + StringBuffer bs = new StringBuffer(); for (int i = 0; i < count; i++) { int temp = b[i]; @@ -241,6 +241,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1 ) { log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + }else { + log.info("未下发NDC信号原因: 下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); } } } else { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 426488d94..8b530daaa 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; import org.nl.acs.common.base.CommonFinalParam; @@ -39,6 +40,7 @@ import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.impl.TaskServiceImpl; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.enums.LogTypeEnum; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; @@ -310,16 +312,36 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); + ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); + String choose = paramService.findByCode(AcsConfig.CHOOSE).getValue(); String length1 = rangingStationsDeviceDriver.getLength1(); - Float len = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { - len = Float.parseFloat(length1); + String length2 = rangingStationsDeviceDriver.getLength2(); + Float len1 = 0.0F; + Float len2 = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { + len1 = Float.parseFloat(length1); + len2 = Float.parseFloat(length2); } - int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + if("A".equals(choose)){ + String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue(); + if(ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)){ + Integer integer = Integer.valueOf(offSet_A); + len1 = len1 - integer; + } + }else if("B".equals(choose)){ + String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue(); + if(ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)){ + Integer integer = Integer.valueOf(offSet_B); + len1 = integer + len1; + } + } + if(len1 * len2 < 1 ){ + int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); @@ -588,15 +610,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); String length1 = rangingStationsDeviceDriver.getLength1(); - Float len = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { - len = Float.parseFloat(length1); + String length2 = rangingStationsDeviceDriver.getLength2(); + Float len1 = 0.0F; + Float len2 = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { + len1 = Float.parseFloat(length1); + len2 = Float.parseFloat(length2); } - int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + if(len1 * len2 < 1 ){ + int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); @@ -862,15 +889,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); String length1 = rangingStationsDeviceDriver.getLength1(); - Float len = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { - len = Float.parseFloat(length1); + String length2 = rangingStationsDeviceDriver.getLength2(); + Float len1 = 0.0F; + Float len2 = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { + len1 = Float.parseFloat(length1); + len2 = Float.parseFloat(length2); } - int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + if(len1 * len2 < 1 ){ + int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); @@ -1090,15 +1122,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); String length1 = rangingStationsDeviceDriver.getLength1(); - Float len = 0.0F; - if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { - len = Float.parseFloat(length1); + String length2 = rangingStationsDeviceDriver.getLength2(); + Float len1 = 0.0F; + Float len2 = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1) && ObjectUtil.isNotEmpty(length2) && !"null".equals(length2)) { + len1 = Float.parseFloat(length1); + len2 = Float.parseFloat(length2); } - int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; - if (roundedNumber == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + if(len1 * len2 < 1 ){ + int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/ItemProtocol.java index cb14d827a..c52bbaf23 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/ItemProtocol.java @@ -20,8 +20,8 @@ public class ItemProtocol { public static String item_to_target = "to_target"; public static String item_to_task = "to_task"; public static String item_weight = "weight"; - public static String item_material_type = "material_type"; - public static String item_barcode = "barcode"; + /*public static String item_material_type = "material_type"; + public static String item_barcode = "barcode";*/ private StandardInspectSiteDeviceDriver driver; @@ -50,13 +50,13 @@ public class ItemProtocol { } - public int getMaterialType() { + /*public int getMaterialType() { return this.getOpcIntegerValue(item_material_type); } public int getBarcode() { return this.getOpcIntegerValue(item_barcode); - } + }*/ public int getToCommand() { return this.getOpcIntegerValue(item_to_command); @@ -98,9 +98,9 @@ public class ItemProtocol { list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true))); list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3")); list.add(new ItemDto(item_action, "取放信号", "DB600.B4")); - list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6")); + /*list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6"));*/ list.add(new ItemDto(item_error, "报警信号", "DB600.B7")); - list.add(new ItemDto(item_barcode, "条码", "DB600.D8")); + /*list.add(new ItemDto(item_barcode, "条码", "DB600.D8"));*/ return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 3e0932572..01ae289fe 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -178,8 +178,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp move = this.itemProtocol.getMove(); hasGoods = this.itemProtocol.getMove(); action = this.itemProtocol.getAction(); - material_type = this.itemProtocol.getMaterialType(); - barcode = this.itemProtocol.getBarcode(); + /*material_type = this.itemProtocol.getMaterialType(); + barcode = this.itemProtocol.getBarcode();*/ if (mode != last_mode) { this.setRequireSucess(false); if (mode == 2) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java index 2a779a2fe..463dafdda 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java @@ -27,9 +27,9 @@ public class ItemProtocol { //报警 public static String item_error = "error"; //x轴坐标 - public static String item_x_position = "x_position"; + public static String item_x_position = "x"; //y轴坐标 - public static String item_y_position = "y_position"; + public static String item_y_position = "y"; //下发命令 public static String item_to_command = "to_command"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java index 54f2b9f8c..c09bd93ab 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/ItemProtocol.java @@ -18,9 +18,9 @@ public class ItemProtocol { //工作模式 public static String item_mode = "mode"; //光电信号 - public static String item_move = "move"; + public static String item_move = "move1"; //动作信号 - public static String item_action = "action"; + public static String item_action = "action1"; //任务号 public static String item_task = "task"; //报警 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java index 68b186ad4..30651b243 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java @@ -164,6 +164,8 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl String device_code; String message = null; + private Date instruction_require_time = new Date(); + private int instruction_require_time_out = 3000; @Override public Device getDevice() { @@ -300,56 +302,62 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl * 申请套管 */ private synchronized void apply_casing(int mode) throws Exception { - ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); - ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE); - //气涨轴尺寸 - applyPlugPullSiteRequest.setSize(String.valueOf(size)); - applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { - Map data = applyPlugPullSitResponse.getData(); - String number = data.get("number"); - String leftSize = data.get("leftSize"); - String rightSize = data.get("rightSize"); - //套管1物料 - String to_material1 = data.get("left"); - //套管2物料 - String to_material2 = data.get("right"); - //套管1规格 - String to_spec1 = data.get("leftSpec"); - //套管2规格 - String to_spec2 = data.get("rightSpec"); - Map map = new LinkedHashMap<>(); - //下发纸管信息 - - map.put("to_material1", to_material1); - map.put("to_material2", to_material2); - - if (StrUtil.isNotEmpty(leftSize)){ - map.put("to_size1", leftSize); - } - if (StrUtil.isNotEmpty(rightSize)){ - map.put("to_size2", rightSize); - } - map.put("to_spec1", to_spec1); - if (ObjectUtil.isNotEmpty(to_spec2)) { - map.put("to_spec2", to_spec2); - } - map.put("to_command", mode); - map.put("to_qty1", number); - this.writing(map); - requireSucess = true; - logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); - message = "申请套管成功"; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; } else { - message = applyPlugPullSitResponse.getMessage(); - Map map = new LinkedHashMap<>(); - map.put("to_command", 99); - this.writing(map); - requireSucess = true; - message = "申请套管失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); + ApplyPlugPullSitResponse applyPlugPullSitResponse; + applyPlugPullSiteRequest.setDevice_code(device_code); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_ONE); + //气涨轴尺寸 + applyPlugPullSiteRequest.setSize(String.valueOf(size)); + applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map data = applyPlugPullSitResponse.getData(); + String number = data.get("number"); + String leftSize = data.get("leftSize"); + String rightSize = data.get("rightSize"); + //套管1物料 + String to_material1 = data.get("left"); + //套管2物料 + String to_material2 = data.get("right"); + //套管1规格 + String to_spec1 = data.get("leftSpec"); + //套管2规格 + String to_spec2 = data.get("rightSpec"); + Map map = new LinkedHashMap<>(); + //下发纸管信息 + + map.put("to_material1", to_material1); + map.put("to_material2", to_material2); + + if (StrUtil.isNotEmpty(leftSize)) { + map.put("to_size1", leftSize); + } + if (StrUtil.isNotEmpty(rightSize)) { + map.put("to_size2", rightSize); + } + map.put("to_spec1", to_spec1); + if (ObjectUtil.isNotEmpty(to_spec2)) { + map.put("to_spec2", to_spec2); + } + map.put("to_command", mode); + map.put("to_qty1", number); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); + message = "申请套管成功"; + } else { + message = applyPlugPullSitResponse.getMessage(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); + this.writing(map); + requireSucess = true; + message = "申请套管失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + } } } @@ -357,28 +365,34 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl * 套管完成 */ private synchronized void bushingSucess(int mode) throws Exception { - ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); - ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(device_code); - //上报规格和重量 - applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1)); - applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1)); - applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2)); - applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2)); - applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO); - applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { - this.writeSignal(mode); - logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); - message = "套管完成成功"; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; } else { - message = applyPlugPullSitResponse.getMessage(); - Map map = new LinkedHashMap<>(); - map.put("to_command", 99); - this.writing(map); - requireSucess = true; - message = "申请套管失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); + ApplyPlugPullSitResponse applyPlugPullSitResponse; + applyPlugPullSiteRequest.setDevice_code(device_code); + //上报规格和重量 + applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1)); + applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1)); + applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2)); + applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2)); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO); + applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + this.writeSignal(mode); + logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); + message = "套管完成成功"; + } else { + message = applyPlugPullSitResponse.getMessage(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); + this.writing(map); + requireSucess = true; + message = "申请套管失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请套管反馈失败,返回参数:" + applyPlugPullSitResponse); + } } } @@ -387,27 +401,33 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl * 拔轴完成 */ private synchronized void pullShaftSucess(int mode) throws Exception { - ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); - ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode)); - applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE); - applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { - Map map = new LinkedHashMap<>(); - map.put("to_command", mode); - this.writing(map); - requireSucess = true; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); - message = "拔轴完成成功"; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; } else { - message = applyPlugPullSitResponse.getMessage(); - Map map = new LinkedHashMap<>(); - map.put("to_command", 99); - this.writing(map); - requireSucess = true; - message = "拔轴完成失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); + ApplyPlugPullSitResponse applyPlugPullSitResponse; + applyPlugPullSiteRequest.setDevice_code(device_code); + applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode)); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_THREE); + applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map map = new LinkedHashMap<>(); + map.put("to_command", mode); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + message = "拔轴完成成功"; + } else { + message = applyPlugPullSitResponse.getMessage(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); + this.writing(map); + requireSucess = true; + message = "拔轴完成失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + } } } @@ -415,55 +435,61 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl * 申请拔轴 */ private synchronized void applyPullShaft(int mode) throws Exception { - ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); - ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode)); - applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR); - applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { - Map data = applyPlugPullSitResponse.getData(); - //拔管1物料 - Object to_material3 = data.get("currentLeft"); - //拔管2物料 - Object to_material4 = data.get("currentRight"); - //拔管1尺寸 - Object to_size3 = data.get("currentLeftSize"); - //拔管2尺寸 - Object to_size4 = data.get("currentRightSize"); - //拔管1规格 - Object to_spec3 = data.get("currentLeftSpec"); - //拔管2规格 - Object to_spec4 = data.get("currentRightSpec"); - Object to_qty2 = data.get("pullCount"); - Map map = new LinkedHashMap<>(); - map.put("to_material3", to_material3); - if (ObjectUtil.isNotEmpty(to_material4)) { - map.put("to_material4", to_material4); - } - map.put("to_size3", to_size3); - if (ObjectUtil.isNotEmpty(to_size4)) { - map.put("to_size4", to_size4); - } - map.put("to_spec3", to_spec3); - if (ObjectUtil.isNotEmpty(to_spec4)) { - map.put("to_spec4", to_spec4); - } - map.put("to_qty2", to_qty2); - map.put("to_qzz_type", size); - map.put("to_command", mode); - this.writing(map); - requireSucess = true; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); - message = "申请拔轴成功"; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; } else { - message = applyPlugPullSitResponse.getMessage(); - Map map = new LinkedHashMap<>(); - map.put("to_command", 99); - this.writing(map); - requireSucess = true; - message = "申请拔轴失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); + ApplyPlugPullSitResponse applyPlugPullSitResponse; + applyPlugPullSiteRequest.setDevice_code(device_code); + applyPlugPullSiteRequest.setQzz_no(String.valueOf(barcode)); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FOUR); + applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map data = applyPlugPullSitResponse.getData(); + //拔管1物料 + Object to_material3 = data.get("currentLeft"); + //拔管2物料 + Object to_material4 = data.get("currentRight"); + //拔管1尺寸 + Object to_size3 = data.get("currentLeftSize"); + //拔管2尺寸 + Object to_size4 = data.get("currentRightSize"); + //拔管1规格 + Object to_spec3 = data.get("currentLeftSpec"); + //拔管2规格 + Object to_spec4 = data.get("currentRightSpec"); + Object to_qty2 = data.get("pullCount"); + Map map = new LinkedHashMap<>(); + map.put("to_material3", to_material3); + if (ObjectUtil.isNotEmpty(to_material4)) { + map.put("to_material4", to_material4); + } + map.put("to_size3", to_size3); + if (ObjectUtil.isNotEmpty(to_size4)) { + map.put("to_size4", to_size4); + } + map.put("to_spec3", to_spec3); + if (ObjectUtil.isNotEmpty(to_spec4)) { + map.put("to_spec4", to_spec4); + } + map.put("to_qty2", to_qty2); + map.put("to_qzz_type", size); + map.put("to_command", mode); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + message = "申请拔轴成功"; + } else { + message = applyPlugPullSitResponse.getMessage(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); + this.writing(map); + requireSucess = true; + message = "申请拔轴失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + } } } @@ -471,24 +497,30 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl * 缓存线已满,生成行架任务 */ private synchronized void applyTask(int mode) throws Exception { - ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); - ApplyPlugPullSitResponse applyPlugPullSitResponse; - applyPlugPullSiteRequest.setDevice_code(device_code); - applyPlugPullSiteRequest.setSize(String.valueOf(size)); - applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE); - applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); - if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { - Map map = new LinkedHashMap<>(); - map.put("to_command", mode); - this.writing(map); - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); - message = "生成行架任务成功"; - requireSucess = true; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; } else { - message = applyPlugPullSitResponse.getMessage(); - requireSucess = true; - message = "申请行架任务失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); + ApplyPlugPullSitResponse applyPlugPullSitResponse; + applyPlugPullSiteRequest.setDevice_code(device_code); + applyPlugPullSiteRequest.setSize(String.valueOf(size)); + applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_FIVE); + applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); + if (applyPlugPullSitResponse.getCode() == CommonFinalParam.STATUS_OPEN) { + Map map = new LinkedHashMap<>(); + map.put("to_command", mode); + this.writing(map); + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse); + message = "生成行架任务成功"; + requireSucess = true; + } else { + message = applyPlugPullSitResponse.getMessage(); + requireSucess = true; + message = "申请行架任务失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse); + } } } @@ -632,7 +664,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("mode", mode); jo.put("move", move); /*jo.put("action", action);*/ - jo.put("error", ErrorUtil.getDictDetail("error_type", String.valueOf(this.getError()))); + jo.put("error", ErrorUtil.getDictDetail("cbj_error_type", String.valueOf(this.getError()))); jo.put("isOnline", this.getIsonline()); jo.put("isError", this.getIserror()); jo.put("message", message); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java index 91b029f4d..3f62dbc02 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/ItemProtocol.java @@ -27,9 +27,9 @@ public class ItemProtocol { //报警 public static String item_error = "error"; //x轴坐标 - public static String item_x_position = "x_position"; + public static String item_x_position = "x"; //y轴坐标 - public static String item_y_position = "y_position"; + public static String item_y_position = "y"; //下发命令 public static String item_to_command = "to_command"; @@ -42,7 +42,7 @@ public class ItemProtocol { //是否拔轴 public static String item_to_pull = "to_pull"; //是否套轴 - public static String item_to_sleeve = "to_sleeve"; + public static String item_to_sleeve = "is_bushing"; //尺寸 public static String item_to_size = "to_size"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java index 69d68550f..118518e1c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/ItemProtocol.java @@ -32,9 +32,9 @@ public class ItemProtocol { */ public static String item_walk_y = "walk_y"; //x坐标 - public static String item_x_position = "x_position"; + public static String item_x_position = "x"; //动作信号 - public static String item_y_position = "y_position"; + public static String item_y_position = "y"; /** * 报警 */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 87f776a76..0a5e82120 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -284,7 +284,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl try { finish_instruction(inst); Map map = new LinkedHashMap<>(); - map.put("to_command", 9); + map.put("to_command", 5); this.writing(map); this.setRequireSucess(true); } catch (Exception e) { @@ -533,7 +533,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl public void isSetAddress(Device device) { if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) { logServer.deviceExecuteLog(device_code, "", "task:" + task, "设备:" + device.getDevice_code() + "未设置电气调度号!"); - notCreateInstMessage = "设备:" + device.getDevice_code() + "未设置电气调度号!"; + notCreateInstMessage = device.getDevice_code() + "universal_notCreateInstMessage1";; throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!"); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java index 790ae0dc1..03b1864db 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/waste_foil_weighing_station/WasteFoilWeighingStationDriver.java @@ -224,20 +224,26 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl * 取消称重 */ public synchronized void cancelWeight() { - GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest(); - GetWasteFoilWeightResponse getWasteFoilWeightResponse; - getWasteFoilWeightRequest.setDevice_code(device_code); - getWasteFoilWeightRequest.setType("3"); - getWasteFoilWeightRequest.setLastWeight(String.valueOf(old_weight)); - getWasteFoilWeightRequest.setCurrentWeight(String.valueOf(weight)); - getWasteFoilWeightRequest.setWeightGap(String.valueOf(gap_weight)); - getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest); - if (getWasteFoilWeightResponse.getstatus()==200){ - feedbackSucess = true; - message = "取消称重成功..."; - }else { - feedbackSucess = false; - message = "取消称重失败"; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest(); + GetWasteFoilWeightResponse getWasteFoilWeightResponse; + getWasteFoilWeightRequest.setDevice_code(device_code); + getWasteFoilWeightRequest.setType("3"); + getWasteFoilWeightRequest.setLastWeight(String.valueOf(old_weight)); + getWasteFoilWeightRequest.setCurrentWeight(String.valueOf(weight)); + getWasteFoilWeightRequest.setWeightGap(String.valueOf(gap_weight)); + getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest); + if (getWasteFoilWeightResponse.getstatus() == 200) { + feedbackSucess = true; + message = "取消称重成功..."; + } else { + feedbackSucess = false; + message = "取消称重失败"; + } } } @@ -245,17 +251,23 @@ public class WasteFoilWeighingStationDriver extends AbstractOpcDeviceDriver impl * 申请任务 */ public synchronized void applyTask() { - GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest(); - GetWasteFoilWeightResponse getWasteFoilWeightResponse; - getWasteFoilWeightRequest.setDevice_code(device_code); - getWasteFoilWeightRequest.setType("4"); - getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest); - if (getWasteFoilWeightResponse.getstatus()==200){ - feedbackSucess = true; - message = "申请任务成功..."; - }else { - feedbackSucess = false; - message = "申请任务失败"; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + GetWasteFoilWeightRequest getWasteFoilWeightRequest = new GetWasteFoilWeightRequest(); + GetWasteFoilWeightResponse getWasteFoilWeightResponse; + getWasteFoilWeightRequest.setDevice_code(device_code); + getWasteFoilWeightRequest.setType("4"); + getWasteFoilWeightResponse = acsToWmsService.feedbackWeight(getWasteFoilWeightRequest); + if (getWasteFoilWeightResponse.getstatus() == 200) { + feedbackSucess = true; + message = "申请任务成功..."; + } else { + feedbackSucess = false; + message = "申请任务失败"; + } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 274ca52a7..ca3012424 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -470,7 +470,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { log.info("ApplyPlugPullSitResponse----返回参数{}", result); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); LuceneLogDto luceneLogDto = new LuceneLogDto(4,"ApplyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getCode()), - JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请套管"); + JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请" + + ("1".equals(param.getType()) ? "套轴": "2".equals(param.getType()) ? "套轴完成": "3".equals(param.getType()) ? "拔轴完成": + "4".equals(param.getType()) ? "拔轴": "缓存线已满,生成行架任务")); luceneLogService.interfaceExecuteLog(luceneLogDto); } catch (Exception e) { JSONObject map = new JSONObject(); @@ -513,7 +515,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class); } LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyfeedbackSubVolumeWeightRequest", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()), - JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS向LMS申请套管"); + JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS反馈LMS子卷重量"); luceneLogService.interfaceExecuteLog(luceneLogDto); } return applyfeedbackSubVolumeWeightResponse; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 49cb45156..fd9535102 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -579,20 +579,31 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { try { //称重完成 if (StrUtil.equals("1", type)) { + wasteFoilWeighingStationDriver.writing("to_command", "6"); Thread.sleep(1000); //休眠1秒 - if (wasteFoilWeighingStationDriver.getMode() == 6) { - jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 - jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量 - jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差 - wasteFoilWeighingStationDriver.writing("to_command", "6"); + while (true) { + if (wasteFoilWeighingStationDriver.getMode()==6){ + jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 + jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量 + jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差 + break; + } } + wasteFoilWeighingStationDriver.writing("to_command", "0"); } //称重确认信号 else if (StrUtil.equals("2", type)) { + wasteFoilWeighingStationDriver.writing("to_command", "7"); Thread.sleep(1000); //休眠1秒 - if (wasteFoilWeighingStationDriver.getMode() == 7) { - wasteFoilWeighingStationDriver.writing("to_command", "8"); + while (true) { + if (wasteFoilWeighingStationDriver.getMode()==7){ + jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 + jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量 + jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差 + break; + } } + wasteFoilWeighingStationDriver.writing("to_command", "0"); } } catch (InterruptedException e) { e.printStackTrace(); @@ -822,953 +833,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { public JSONObject notifyAcs(JSONObject param) { return null; } -/** - private final ApplicationContext applicationContext; - private final InstructionService instructionService; - private final TaskService taskService; - private final DeviceService deviceService; - private final DeviceAppService deviceAppService; - private final RouteLineService routeLineService; - private final AcsToLiKuService acsToLiKuService; - private final DictDetailService dictDetailService; - private final DictService dictService; - private String log_file_type = "log_file_type"; - private String log_type = "LMS请求ACS"; - - @Override public CancelTaskResponse cancelFromWms(String param) throws Exception { - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - JSONArray datas = JSONArray.parseArray(param); - CancelTaskResponse response = new CancelTaskResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - CancelTaskRequest request = JsonUtl.format(param, CancelTaskRequest.class); - - String task_uuid = request.getExt_task_id(); - String task_code = request.getTask_code(); - String vehicle_code = request.getVehicle_code(); - - if (StrUtil.isEmpty(task_uuid)) { - throw new WDKException("任务标识不能为空"); - } - if (StrUtil.isEmpty(task_code)) { - throw new WDKException("任务号不能为空"); - } - String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue(); - if (StrUtil.equals(cancelTaskCheck, CommonFinalParam.ONE)) { - taskService.cancel(task_uuid); - } else if (StrUtil.equals(cancelTaskCheck, "0")) { - Instruction inst = instructionService.findByTaskcode(task_code); - if (inst == null) { - taskService.cancel(task_uuid); - } else { - throw new RuntimeException("指令正在执行中,操作失败!"); - } - } - - } - - if (ObjectUtil.isEmpty(errArr)) { - response.setStatus(200); - } else { - response.setStatus(400); - } - response.setMessage("success"); - response.setErrArr(errArr); - log.info("cancelFromWms--------------:输出参数:" + response); - - return response; - } - - @Override public Map updateDeviceGoodsFromWms(String param) { - JSONArray datas = JSONArray.parseArray(param); - log.info("updateDeviceGoodsFromWms--------------:输入参数" + datas.toString()); - for (int i = 0; i < datas.size(); i++) { - JSONObject data = datas.getJSONObject(i); - String device_code = data.getString("point_code"); - String has_goods = data.getString("has_goods"); - - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("hasGoodStatus", has_goods); - deviceService.changeDeviceStatus(jo); - - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - @Override public Map areaControl(JSONObject form) { - String device_code = form.getString("device_code"); - String type = form.getString("type"); - - Device device = deviceAppService.findDeviceByCode(device_code); - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - @Override public PutActionResponse putAction(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("putAction--------------:输出参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - PutActionResponse response = new PutActionResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - PutActionRequest request = JsonUtl.format(data, PutActionRequest.class); - String device_code = request.getDevice_code(); - String code = request.getCode(); - String value = request.getValue(); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - HongXiangStationDeviceDriver hongXiangStationDeviceDriver; - LampThreecolorDeviceDriver lampThreecolorDeviceDriver; - if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - hongXiangStationDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { - lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); - lampThreecolorDeviceDriver.writing(code, value); - } - - - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", backja); - // log.info("queryDevice--------------:输出参数" + resultJson.toString()); - return resultJson; - - } finally { - MDC.remove(log_file_type); - } - - - } - - - @Override public Map queryDeviceDBValue(String whereJson) { - JSONArray datas = JSONArray.parseArray(whereJson); - log.info("orderStatusUpdate--------------:输入参数" + datas.toString()); - JSONObject map = new JSONObject(); - if (datas.size() > 0) { - for (int i = 0; i < datas.size(); i++) { - JSONObject jsonObject = datas.getJSONObject(i); - String device_code = jsonObject.getString("device_code"); - String dbName = jsonObject.getString("DB"); - Device device = deviceAppService.findDeviceByCode(device_code); - List extra = device.getExtra(); - for (int j = 0; j < extra.size(); j++) { - DeviceExtraManageDto deviceExtraManageDto = extra.get(j); - String deviceCode = deviceExtraManageDto.getDevice_code(); - String extra_name = deviceExtraManageDto.getExtra_name(); - if (deviceCode.equals(device_code) && extra_name.equals(dbName)) { - String extra_code = deviceExtraManageDto.getExtra_code(); - String[] split = extra_code.split("\\."); - extra_code = split[split.length - 1]; - extra_code = extra_code.substring(0, 1).toUpperCase() + extra_code.substring(1); - IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class); - Integer dbValue = driverService.getDbValue(device, extra_code); - map.put(dbName, dbValue); - break; - } - } - } - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", map); - return resultJson; - } - - @Override public Map querydevice(String whereJson) { - return null; - } - - - @Override public Map putPlusPullAction(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("putPlusPullAction-----输入参数{}", param); - JSONObject jo = JSON.parseObject(param); - String device_code = jo.getString("device_code"); - String size = jo.getString("size"); - String type = jo.getString("type"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "未找到对应的设备:" + device_code); - return resultJson; - } - PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; - if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { - plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); - // 0 穿轴 1拔轴 - if (StrUtil.equals(type, CommonFinalParam.ONE)) { - - if (plugPullDeviceSiteDeviceDriver.getMode() == 1) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备工作模式未自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getAction() == 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备未全自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备未待机"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getControl() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备未远程控制"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getMove() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备有轴"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1 - && plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 0 - && plugPullDeviceSiteDeviceDriver.getControl() == 0) { - - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_size"); - map.put("value", size); - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_type"); - map2.put("value", type); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", "1"); - list.add(map3); - plugPullDeviceSiteDeviceDriver.writing(list); - - } else { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "当前设备状态不满足下发条件"); - return resultJson; - } - - } else if (StrUtil.equals(type, "0")) { - - if (plugPullDeviceSiteDeviceDriver.getMode() == 1) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备工作模式未自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getAction() == 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备未全自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备未待机"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getControl() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备未远程控制"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getMove() != 1) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备没有轴"); - return resultJson; - } - - if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1 - && plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 1 - && plugPullDeviceSiteDeviceDriver.getControl() == 0) { - - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_size"); - map.put("value", size); - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_type"); - map2.put("value", type); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", CommonFinalParam.ONE); - list.add(map3); - plugPullDeviceSiteDeviceDriver.writing(list); - - } else { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "当前设备状态不满足下发条件"); - return resultJson; - } - } - } - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - log.info("putPlusPullAction--------------:输出参数" + resultJson.toString()); - return resultJson; - - } finally { - MDC.remove(log_file_type); - } - } - - - @Override public CreateTaskResponse crateTask(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("crateTask-----输入参数{}", param); - JSONArray datas = JSONArray.parseArray(param); - CreateTaskResponse response = new CreateTaskResponse(); - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue(); - JSONArray errArr = new JSONArray(); - if (StrUtil.equals(cancelTaskCheck, "0")) { - response.setStatus(400); - response.setMessage("ACS系统需要更新,请稍等"); - response.setErrArr(datas); - return response; - } - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class); - String paper_array = request.getPaper_array(); - String ext_task_id = request.getExt_task_id(); - String task_code = request.getTask_code(); - String start_device_code = request.getStart_device_code(); - String start_device_code2 = request.getStart_device_code2(); - String next_device_code = request.getNext_device_code(); - String next_device_code2 = request.getNext_device_code2(); - String put_device_code = request.getPut_device_code(); - String priority = request.getPriority(); - String vehicle_code = request.getVehicle_code(); - String vehicle_type = request.getVehicle_type(); - String route_plan_code = request.getRoute_plan_code(); - String task_type = request.getTask_type(); - String truss_type = request.getTruss_type(); - String is_bushing = request.getIs_bushing(); - String version = request.getVersion(); - String bushing_num = request.getBushing_num(); - String storage_task_type = request.getDtl_type(); - String agv_system_type = request.getAgv_system_type(); - String remark = request.getRemark(); - double oven_time = 0.00d; - if (StrUtil.isNotEmpty(request.getOven_time())) { - oven_time = Double.parseDouble(request.getOven_time()); - } - String temperature = request.getTemperature(); - String start_height = request.getStart_height(); - String next_height = request.getNext_height(); - Map params = request.getParams(); - - String start_point_code = ""; - String start_point_code2 = ""; - String next_point_code = ""; - String next_point_code2 = ""; - String put_point_code = ""; - if (StrUtil.isEmpty(task_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "任务号不能为空"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(start_device_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "起点不能为空"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(next_device_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "终点不能为空"); - errArr.add(json); - continue; - } - - if (StrUtil.equals(task_type, "8")) { - next_device_code = request.getPut_device_code(); - put_device_code = request.getNext_device_code(); - } - - JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(start_device_json)) { - start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code"); - } - JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(next_device_json)) { - next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code"); - } - JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(start_device_json2)) { - start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code"); - } - JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code2 + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(next_device_json2)) { - next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json2.get("storage_code"); - } - JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(put_device_json)) { - put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code"); - } - if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) { - String str[] = start_point_code.split("-"); - start_device_code = str[0]; - } else { - start_device_code = start_point_code; - } - - if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) { - String str[] = next_point_code.split("-"); - next_device_code = str[0]; - } else { - next_device_code = next_point_code; - } - - if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) { - String str[] = start_point_code2.split("-"); - start_device_code2 = str[0]; - } else { - start_device_code2 = start_point_code2; - } - - if (StrUtil.isNotEmpty(next_point_code2) && next_point_code2.indexOf("-") > 0) { - String str[] = next_point_code2.split("-"); - next_device_code2 = str[0]; - } else { - next_device_code2 = next_point_code2; - } - - if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) { - String str[] = put_point_code.split("-"); - put_device_code = str[0]; - } else { - put_device_code = put_point_code; - } - - if (StrUtil.isEmpty(route_plan_code)) { - route_plan_code = "normal"; - } - - if (StrUtil.equals(task_type, "5")) { - Device device = deviceAppService.findDeviceByCode(next_device_code); - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); - if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) { - if (siemensConveyorDeviceDriver.getMove() == 1) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "终点" + siemensConveyorDeviceDriver.getDevice_code() + "有货无法生成任务"); - errArr.add(json); - continue; - } - } - } - - if (taskService.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务"); - errArr.add(json); - continue; - } - } - - TaskDto taskDto = taskService.findByCodeFromCache(task_code); - if (taskDto != null) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "存在相同的任务号:" + task_code); - errArr.add(json); - continue; - } - if (!StrUtil.isEmpty(vehicle_code)) { - TaskDto vehicle_dto = taskService.findByContainer(vehicle_code); - if (vehicle_dto != null) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code); - errArr.add(json); - continue; - } - } - - if (StrUtil.isEmpty(start_point_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", request.getStart_device_code() + " 该设备号未找到对应点位"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(next_point_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", request.getNext_device_code() + " 该设备号未找到对应点位"); - errArr.add(json); - continue; - } - - JSONObject jo = new JSONObject(); - jo.put("task_id", IdUtil.simpleUUID()); - jo.put("task_code", task_code); - jo.put("start_point_code", start_point_code); - jo.put("next_point_code", next_point_code); - jo.put("start_point_code2", start_point_code2); - jo.put("next_point_code2", next_point_code2); - jo.put("put_point_code", put_point_code); - jo.put("start_parent_code", start_point_code); - jo.put("next_parent_code", next_point_code); - jo.put("start_device_code", start_device_code); - jo.put("next_device_code", next_device_code); - jo.put("start_device_code2", start_device_code2); - jo.put("next_device_code2", next_device_code2); - jo.put("put_device_code", put_device_code); - jo.put("priority", priority); - jo.put("vehicle_code", vehicle_code); - jo.put("vehicle_type", vehicle_type); - jo.put("storage_task_type", storage_task_type); - jo.put("agv_system_type", agv_system_type); - jo.put("start_height", start_height); - jo.put("next_height", next_height); - jo.put("oven_time", (int) Math.ceil(oven_time)); - jo.put("remark", remark); - jo.put("params", params); - jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); - jo.put("paper_array", JSONUtil.toJsonStr(paper_array)); - jo.put("truss_type", JSONUtil.toJsonStr(truss_type)); - jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing)); - jo.put("version", JSONUtil.toJsonStr(version)); - jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num)); - - - if (!StrUtil.isEmpty(ext_task_id)) { - jo.put("ext_task_id", ext_task_id); - } - - TaskDto task_dto = jo.toJavaObject(TaskDto.class); - try { - // task_type=7 则是立库任务需要下刻下发 - if (StrUtil.equals(task_dto.getTask_type(), "7")) { - //创建临时指令 不创建、不生成 - //等立库反馈成功才能创建任务和指令 - Instruction inst = null; - try { - inst = taskService.createTemporaryInst(task_dto); - } catch (Exception e) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "起始点:"+ task_dto.getStart_point_code() + ",终点:"+ - task_dto.getNext_point_code()+",条码:" + task_dto.getVehicle_code() + - "," + e.getMessage()); - errArr.add(json); - continue; - } - Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(), inst); - - if (StrUtil.equals(resp.result, "true")) { - //创建任务和指令 - taskService.create(task_dto); - inst.setSend_status(CommonFinalParam.ONE); - taskService.extCreateInst(inst); - - } else { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", resp.getComment()); - json.put("code", resp.code); - json.put("data", data); - errArr.add(json); - continue; - } - - } else { - taskService.create(task_dto); - } - } catch (Exception e) { - // e.printStackTrace(); - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", e.getMessage()); - errArr.add(json); - continue; - } - } - if (ObjectUtil.isEmpty(errArr)) { - response.setStatus(200); - response.setMessage("success"); - } else { - response.setStatus(400); - if (ObjectUtil.isNotEmpty(errArr)) { - response.setMessage(errArr.getJSONObject(0).getString("message")); - } else { - response.setMessage("false"); - } - response.setErrArr(errArr); - } - log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response)); - - return response; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override public Map unLock(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("unLock--------------:输入参数" + param); - JSONObject jo = JSONObject.parseObject(param); - String task_code = String.valueOf(jo.get("task_code")); - if (StrUtil.isEmpty(task_code)) { - throw new BadRequestException("任务号不能为空"); - } - String device_code = String.valueOf(jo.get("device_code")); - if (StrUtil.isEmpty(device_code)) { - throw new BadRequestException("设备号不能为空"); - } - String vehicle_code = String.valueOf(jo.get("vehicle_code")); - if (StrUtil.isEmpty(vehicle_code)) { - throw new BadRequestException("载具号不能为空"); - } - OutConfirmRequest outConfirmRequest = new OutConfirmRequest(); - outConfirmRequest.setOutPortNo(device_code); - outConfirmRequest.setPalletCode(vehicle_code); - Instruction instruction = instructionService.findByCode(String.valueOf(task_code)); - if (ObjectUtil.isNotEmpty(instruction)) { - task_code = instruction.getInstruction_code(); - outConfirmRequest.setOrderId(task_code); - } - Resp resp = acsToLiKuService.outConfirm(outConfirmRequest); - if (StrUtil.equals(resp.getResult(), "false")) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", 400); - resultJson.put("message", resp.getComment()); - log.info("unLock--------------:输出参数" + resultJson); - return resultJson; - } - } catch (Exception e) { - e.printStackTrace(); - JSONObject resultJson = new JSONObject(); - resultJson.put("status", 400); - resultJson.put("message", e.getMessage()); - log.info("unLock--------------:输出参数" + resultJson); - return resultJson; - } finally { - MDC.remove(log_file_type); - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - log.info("unLock--------------:输出参数" + resultJson); - return resultJson; - } - - // @Override - // public Map sendAgvChargeTask(JSONObject param) { - // log.info("sendAgvChargeTask--------------:输入参数" + param.toString()); - // String agv_system = param.getString("agv_system"); - // String car_no = param.getString("car_no"); - // if (StrUtil.isEmpty(agv_system)) { - // throw new BadRequestException("AGV系统类型不能为空"); - // } - // if (StrUtil.isEmpty(car_no)) { - // throw new BadRequestException("AGV车号不能为空"); - // } - // Device device = deviceAppService.findDeviceByCode(car_no); - // if (device == null) { - // throw new BadRequestException("agv车号在ACS系统中不存在!"); - // } - // NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class); - // agvService.createChargingTaskToNDC(agv_system, car_no); - // JSONObject resp = new JSONObject(); - // resp.put("status", 200); - // resp.put("message", "操作成功"); - // return resp; - // } - // - // @Override - // public Map queryDeviceInfo(JSONObject param) { - // log.info("queryDeviceInfo--------------:输入参数" + param.toString()); - // String region_code = param.getString("region_code"); - //// if (StrUtil.isEmpty(region_code)) { - //// throw new BadRequestException("区域编码不能为空"); - //// } - // AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - // AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; - // List devices = deviceAppService.findDevice(DeviceType.agv); - // JSONArray data = new JSONArray(); - // if (StrUtil.isEmpty(region_code)) { - // throw new BadRequestException("区域编码不能为空"); - // } - AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; - List devices = deviceAppService.findDevice(DeviceType.agv); - JSONArray data = new JSONArray(); - if (StrUtil.isEmpty(region_code)) { - if (ObjectUtil.isNotEmpty(devices)) { - for (int i = 0; i < devices.size(); i++) { - Device device = devices.get(i); - Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code()); - if (agvDevice.getDeviceDriver() instanceof DeviceStageMonitor) { - DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) agvDevice.getDeviceDriver(); - try { - JSONObject jo = deviceStageMonitor.getDeviceStatusName(); - data.add(jo); - } catch (Exception e) { - log.error("反馈AGV信息失败:{}", e.getMessage()); - } - } - } - } - } else { - if (ObjectUtil.isNotEmpty(devices)) { - for (int i = 0; i < devices.size(); i++) { - Device device = devices.get(i); - Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code()); - if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { - if (StrUtil.equals(region_code, "1")) { - agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); - JSONObject jo = agvNdcTwoDeviceDriver.getDeviceStatusName(); - data.add(jo); - } - } - if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { - if (StrUtil.equals(region_code, "5")) { - agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver(); - JSONObject jo = agvNdcOneDeviceDriver.getDeviceStatusName(); - data.add(jo); - } - } - } - } - } - JSONObject resp = new JSONObject(); - resp.put("status", 200); - resp.put("message", "操作成功"); - resp.put("data", data); - return resp; - } - - @Override public Map syncfaultInfo() { - log.info("syncfaultInfo--------------:输入参数"); - JSONArray data = new JSONArray(); - List dicts = dictService.queryAll(); - if (ObjectUtil.isNotEmpty(dicts)) { - List error_dists = dicts - .stream() - .filter(dict -> dict.getName().contains("error_type")) - .collect(Collectors.toList()); - if (ObjectUtil.isNotEmpty(error_dists)) { - for (int i = 0; i < error_dists.size(); i++) { - Dict dict = error_dists.get(i); - String dictName = dict.getName(); - List dictDetailDtos = dictDetailService.getDictByName(dictName); - for (DictDetailDto dictDetailDto : dictDetailDtos) { - JSONObject faultInfo = new JSONObject(); - faultInfo.put("fault_type", dictName); - faultInfo.put("fault_code", dictDetailDto.getValue()); - faultInfo.put("fault_info", dictDetailDto.getLabel()); - data.add(faultInfo); - } - } - } - } - JSONObject resp = new JSONObject(); - resp.put("status", 200); - resp.put("message", "操作成功"); - resp.put("data", data); - return resp; - } - - @Override public Map realTimefaultInfo(JSONObject param) { - log.info("realTimefaultInfo--------------:输入参数" + param.toString()); - String device_code = param.getString("device_code"); - JSONArray data = new JSONArray(); - if (StrUtil.isNotEmpty(device_code)) { - String[] devices = device_code.split(","); - Device device = null; - for (String deviceCode : devices) { - device = deviceAppService.findDeviceByCode(deviceCode); - if (device == null) { - continue; - } - if (device.getDeviceDriver() instanceof FeedLmsRealFailed) { - FeedLmsRealFailed feedLmsRealFailed = (FeedLmsRealFailed) device.getDeviceDriver(); - JSONObject jsonObject = feedLmsRealFailed.feedLmsRealFailedInfo(); - data.add(jsonObject); - } - } - } - JSONObject resp = new JSONObject(); - resp.put("status", 200); - resp.put("message", "操作成功"); - resp.put("data", data); - return resp; - } - - - @Override public Map paperTubeAction(JSONObject param) { - log.info("paperTubeAction--------------:输入参数" + param.toString()); - JSONObject resp = new JSONObject(); - String device_code = param.getString("device_code"); - String type = param.getString("type"); - String material_code = param.getString("material_code"); - String qty = param.getString("qty"); - - if (StrUtil.isNotEmpty(device_code)) { - - Device device = deviceAppService.findDeviceByCode(device_code); - if (device == null) { - resp.put("status", 400); - resp.put("message", "未找到对应设备"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) { - PaperTubeConveyorDeviceDriver paperTubeConveyorDeviceDriver = (PaperTubeConveyorDeviceDriver) device.getDeviceDriver(); - if (paperTubeConveyorDeviceDriver.getMode() != 2) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "未待机,无法下发信号"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - if (StrUtil.equals(type, "1")) { - if (paperTubeConveyorDeviceDriver.getInventory_qty() > 0) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "当前数量为" + paperTubeConveyorDeviceDriver.getInventory_qty() + "无法设置物料"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - try{ - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_material"); - map.put("value", material_code); - list.add(map); - paperTubeConveyorDeviceDriver.writing(list); - - } catch (Exception e){ - e.printStackTrace(); - } - } else if (StrUtil.equals(type, "2")) { - if (paperTubeConveyorDeviceDriver.getInventory_qty() < Integer.parseInt(qty)) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "当前数量为" + paperTubeConveyorDeviceDriver.getInventory_qty() + "小于出库数量" + qty); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - if (StrUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial())) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "设备上报物料为空无法出库"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } else { - if (!StrUtil.equals(paperTubeConveyorDeviceDriver.getMaterial(), material_code)) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "设备上报物料为" + paperTubeConveyorDeviceDriver.getMaterial() + "与出库物料" + material_code + "不匹配"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - } - if (paperTubeConveyorDeviceDriver.getTo_command() != 0 || paperTubeConveyorDeviceDriver.getTo_target() != 0) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "下发命令信号值为" + paperTubeConveyorDeviceDriver.getTo_command() + ",下发目标站:" + paperTubeConveyorDeviceDriver.getTo_target() + ",已存在待执行的任务"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_out_qty"); - map.put("value", qty); - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_target"); - map2.put("value", device.getAddress()); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", 2); - list.add(map3); - try{ - // paperTubeConveyorDeviceDriver.writing("to_out_qty", qty); - // paperTubeConveyorDeviceDriver.writing("to_target", device.getAddress()); - // paperTubeConveyorDeviceDriver.writing("to_command", "2"); - paperTubeConveyorDeviceDriver.writing(list); - } catch (Exception e){ - e.printStackTrace(); - } - - } else if(StrUtil.equals(type, "3")){ - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_command"); - map.put("value", 3); - list.add(map); - paperTubeConveyorDeviceDriver.writing(list); - } - } - - } - resp.put("status", 200); - resp.put("message", "操作成功"); - return resp; - }**/ - } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 01b6a3253..808732513 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -1164,14 +1164,14 @@ public class InstructionServiceImpl extends CommonServiceImpl"+dto.getNext_device_code()); } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java index fbf7b0086..9beeff580 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/rest/LuceneController.java @@ -30,9 +30,16 @@ public class LuceneController { @GetMapping("/getAll") @Log("日志检索") - + //@PreAuthorize("@el.check('task:list')") public ResponseEntity get(@RequestParam Map whereJson, Pageable page) { return new ResponseEntity<>(luceneService.getAll(whereJson, page), HttpStatus.OK); } + + @GetMapping("/getAddressLog") + @Log("接口日志检索") + //@PreAuthorize("@el.check('task:list')") + public ResponseEntity getAddressLog(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(luceneService.getAddressLog(whereJson, page), HttpStatus.OK); + } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java index 1eae1d589..759fd5cb9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/LuceneService.java @@ -15,4 +15,6 @@ public interface LuceneService { * @return Map */ Map getAll(Map whereJson, Pageable page); + + Map getAddressLog(Map whereJson, Pageable page); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java index 396718ac5..4dc43c273 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/impl/LuceneServiceImpl.java @@ -126,6 +126,100 @@ public class LuceneServiceImpl implements LuceneService { } } + @Override + public Map getAddressLog(Map whereJson, Pageable page) { + //获取要查询的路径,也就是索引所在的位置 + try { + Resource resource = new ClassPathResource("config/application.yml"); + YamlPropertiesFactoryBean yamlPropertiesFactoryBean = new YamlPropertiesFactoryBean(); + yamlPropertiesFactoryBean.setResources(resource); + Properties properties = yamlPropertiesFactoryBean.getObject(); + // 获取配置值 + String luceneDir = properties.getProperty("lucene.index.path"); + FSDirectory directory = FSDirectory.open(Paths.get(luceneDir)); + DirectoryReader open = DirectoryReader.open(directory); + IndexSearcher searcher = new IndexSearcher(open); + // 实际上Lucene本身不支持分页。因此我们需要自己进行逻辑分页。我们要准备分页参数: + int pageSize = Integer.parseInt(whereJson.get("size").toString());// 每页条数 + int pageNum = Integer.parseInt(whereJson.get("page").toString());// 当前页码 + + BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder(); + //时间范围查询 + String startDate = (String) whereJson.get("begin_time"); + String endDate = (String) whereJson.get("end_time"); + + if (startDate == null){ + Calendar calendar=Calendar.getInstance(); + calendar.set(1970, 0, 1); + startDate = DateUtil.format(calendar.getTime(),"yyyy-MM-dd HH:mm:ss.SSS"); + }else{ + startDate = getDate(startDate); + } + if (endDate == null){ + endDate = DateUtil.format(new DateTime(),"yyyy-MM-dd HH:mm:ss.SSS"); + } else { + endDate = getDate(endDate); + } + TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); + booleanQueryBuilder.add(termRangeQuery, BooleanClause.Occur.MUST); + if (whereJson.get("device_code") != null){ + Query termQuery = new TermQuery(new Term("device_code", (String) whereJson.get("device_code"))); + booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); + } + if (whereJson.get("method") != null){ + Query termQuery = new TermQuery(new Term("method", (String) whereJson.get("method"))); + booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); + } + if (whereJson.get("status_code") != null){ + Query termQuery = new TermQuery(new Term("status_code", (String) whereJson.get("status_code"))); + booleanQueryBuilder.add(termQuery,BooleanClause.Occur.MUST); + } + if (whereJson.get("requestparam") != null){ + WildcardQuery query = new WildcardQuery(new Term("requestparam", "*"+(String) whereJson.get("requestparam")+"*")); + booleanQueryBuilder.add(query,BooleanClause.Occur.MUST); + } + if (whereJson.get("responseparam") != null){ + WildcardQuery query = new WildcardQuery(new Term("responseparam", "*"+(String) whereJson.get("responseparam")+"*")); + booleanQueryBuilder.add(query,BooleanClause.Occur.MUST); + } + if (whereJson.get("blurry") != null) { + WildcardQuery query = new WildcardQuery(new Term("fieldContent", "*"+(String) whereJson.get("blurry")+"*")); + booleanQueryBuilder.add(query, BooleanClause.Occur.MUST); + } + + TopFieldCollector collector = TopFieldCollector.create(new Sort(new SortField("logTime", SortField.Type.LONG,true)), 20000, 0); + searcher.search(booleanQueryBuilder.build(), collector); + TopDocs topDocs = collector.topDocs(pageNum*pageSize, pageSize); + int totalSize = collector.getTotalHits(); + ScoreDoc[] scoreDocs = topDocs.scoreDocs; + + List list = new ArrayList<>(); + for (ScoreDoc scoreDoc : scoreDocs) { + Document doc = open.document(scoreDoc.doc); + JSONObject object = new JSONObject(); + object.put("content",doc.get("fieldContent")); + object.put("device_code",doc.get("device_code")); + object.put("logTime",doc.get("logTime")); + object.put("method",doc.get("method")); + object.put("status_code",doc.get("status_code")); + object.put("requestparam",doc.get("requestparam")); + object.put("responseparam",doc.get("responseparam")); + if(doc.get("fieldContent") != null) { + list.add(object); + } + } + open.close(); + directory.close(); + JSONObject jo = new JSONObject(); + jo.put("content", list); + jo.put("totalElements", totalSize); + return jo; + } catch (Exception e) { + log.error("索引查询为空", e); + throw new NullPointerException("索引查询为空"); + } + } + public static String getDate(String timeString) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");//时间格式 Date date = sdf.parse(timeString); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java index c7e8fc51f..1120c9f73 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java @@ -264,7 +264,7 @@ public class OnlineUserService { String tokenValue = StpUtil.getTokenValue(); SaCookieConfig cfg = SaManager.getConfig().getCookie(); SaCookie cookie = new SaCookie() - .setName(StpUtil.getTokenValue()) + .setName("Authorization") .setValue(tokenValue) .setMaxAge(-1) .setDomain(cfg.getDomain()) diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error.properties index 321af8bcd..23b328f5b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error.properties @@ -25,5 +25,5 @@ error_sysFile=\u4E0A\u4F20\u5931\u8D25 error_sysLimit=\u8BBF\u95EE\u6B21\u6570\u9650\u5236\! zh_device_name_isNotNull = \u4E2D\u6587\u8BBE\u5907\u540D\u79F0\u4E0D\u80FD\u4F4D\u7A7A error_not_configured=\u5B57\u5178\u8868\u672A\u914D\u7F6E\u5BF9\u5E94\u7684\u62A5\u8B66\u4FE1\u606F -error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF\uFF01 +error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF: error_regional_max=\u533A\u57DF\u6307\u4EE4\u6570\u91CF\u5DF2\u6700\u5927\u503C diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_en_US.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_en_US.properties index ab59e1e55..0de312039 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_en_US.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_en_US.properties @@ -25,6 +25,6 @@ error_sysFile=Upload failed error_sysLimit=Access limit\! zh_device_name_isNotNull = Chinese device name cannot be empty\! error_not_configured=The dictionary table is not configured with alarm information -error_creat_route=The route already exists! +error_creat_route=The route already exists: error_regional_max=Maximum limit for regional instructions reached diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_in_ID.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_in_ID.properties index 96369c52c..3308eeae6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_in_ID.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_in_ID.properties @@ -25,5 +25,5 @@ error_sysFile=Upload gagal error_sysLimit=Batas akses\! zh_device_name_isNotNull= Nama perangkat dalam bahasa Cina tidak boleh kosong! error_not_configured=Informasi alarm tak dikonfigurasi dari tabel kamus -error_creat_route=Itu sudah ada! +error_creat_route=Itu sudah ada: error_regional_max=Jumlah maksimum instruksi wilayah telah tercapai diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_zh_CN.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_zh_CN.properties index 3b79b0e55..549311e35 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_zh_CN.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/error/error_zh_CN.properties @@ -25,6 +25,6 @@ error_sysFile=\u4E0A\u4F20\u5931\u8D25 error_sysLimit=\u8BBF\u95EE\u6B21\u6570\u9650\u5236\! zh_device_name_isNotNull = \u4E2D\u6587\u8BBE\u5907\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A error_not_configured=\u5B57\u5178\u8868\u672A\u914D\u7F6E\u5BF9\u5E94\u7684\u62A5\u8B66\u4FE1\u606F -error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF\uFF01 +error_creat_route=\u5DF2\u5B58\u5728\u8BE5\u8DEF\u7531\u8DEF\u7EBF: error_regional_max=\u533A\u57DF\u6307\u4EE4\u6570\u91CF\u5DF2\u6700\u5927\u503C diff --git a/acs2/nladmin-ui/src/api/acs/Address.js b/acs2/nladmin-ui/src/api/acs/Address.js index 381c96c7c..a51f3b07c 100644 --- a/acs2/nladmin-ui/src/api/acs/Address.js +++ b/acs2/nladmin-ui/src/api/acs/Address.js @@ -8,6 +8,13 @@ export function add(data) { }) } +export function queryAddressCodeList() { + return request({ + url: 'api/Address/queryAddressCodeList', + method: 'get' + }) +} + export function del(ids) { return request({ url: 'api/Address/', @@ -24,4 +31,4 @@ export function edit(data) { }) } -export default { add, edit, del } +export default { add, edit, del, queryAddressCodeList } diff --git a/acs2/nladmin-ui/src/views/acs/task/index.vue b/acs2/nladmin-ui/src/views/acs/task/index.vue index 2cc2345b7..5b01edc92 100644 --- a/acs2/nladmin-ui/src/views/acs/task/index.vue +++ b/acs2/nladmin-ui/src/views/acs/task/index.vue @@ -301,6 +301,9 @@ /> + + +
@@ -405,6 +408,9 @@ + + +
{{ $t('task.select.Placeholder') }} diff --git a/acs2/nladmin-ui/src/views/monitor/logQuery/index.vue b/acs2/nladmin-ui/src/views/monitor/logQuery/index.vue new file mode 100644 index 000000000..fbd64af79 --- /dev/null +++ b/acs2/nladmin-ui/src/views/monitor/logQuery/index.vue @@ -0,0 +1,106 @@ + + + + + diff --git a/acs2/nladmin-ui/src/views/monitor/logQuery/search.vue b/acs2/nladmin-ui/src/views/monitor/logQuery/search.vue new file mode 100644 index 000000000..d41f85f6f --- /dev/null +++ b/acs2/nladmin-ui/src/views/monitor/logQuery/search.vue @@ -0,0 +1,125 @@ + + + + + + diff --git a/acs2/nladmin-ui/src/views/monitor/lucene/index.vue b/acs2/nladmin-ui/src/views/monitor/lucene/index.vue index 3b9d82854..a83b8cbdd 100644 --- a/acs2/nladmin-ui/src/views/monitor/lucene/index.vue +++ b/acs2/nladmin-ui/src/views/monitor/lucene/index.vue @@ -24,7 +24,7 @@ - + @@ -59,7 +59,7 @@ export default { page: 0 }, query: { - createTime: [new Date(new Date().setTime(new Date().getTime() - 3600 * 1000)), new Date(new Date().setTime(new Date().getTime() + 3600 * 1000))] + createTime: [new Date(new Date().setTime(new Date().getTime() - 3600 * 1000)), new Date(new Date().setTime(new Date().getTime() + 3600 * 1000))], } }) }, diff --git a/acs2/nladmin-ui/src/views/monitor/lucene/search.vue b/acs2/nladmin-ui/src/views/monitor/lucene/search.vue index a3657aa30..c5fc1f359 100644 --- a/acs2/nladmin-ui/src/views/monitor/lucene/search.vue +++ b/acs2/nladmin-ui/src/views/monitor/lucene/search.vue @@ -57,10 +57,9 @@ type="datetimerange" :picker-options="pickerOptions" format="yyyy-MM-dd HH:mm:ss" - range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" - align="right" + class="date-item1" />
@@ -111,3 +110,15 @@ export default { } } + + + diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index ad8d2dd60..59d557da8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -1076,7 +1076,9 @@ public class MesToLmsServiceImpl implements MesToLmsService { String demand_limit = detail.getString("Attribute4");//客户需求抗拉下限 String standard_limit = detail.getString("Attribute5");//内控标准抗拉下限 String actual_value = detail.getString("Attribute6");//生产实际抗拉值 - String Attribute7 = detail.getString("7");//生产实际抗拉值 + String Attribute7 = detail.getString("Attribute7");//包装关系类型 + String Attribute8 = detail.getString("Attribute8");//产品类型 + String Attribute9 = detail.getString("Attribute9");//接头数 if (ObjectUtil.isNotEmpty(Attribute7) && "1".equals(Attribute7)) { sub_type = "2"; } @@ -1131,6 +1133,9 @@ public class MesToLmsServiceImpl implements MesToLmsService { jo.put("un_plan_product_property3", UnPlanProductProperty3); jo.put("width_standard", width_standard); jo.put("thickness_request", thickness_request); + jo.put("material_type", Attribute8); + jo.put("joint_num", Attribute9); + jo.put("thickness_request", thickness_request); jo.put("status", "0"); jo.put("create_id", "1"); jo.put("create_name", "管理员"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java index 86c2303bb..a4b39fac9 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java @@ -131,7 +131,7 @@ public class PrintServiceImpl implements PrintService { fw = new FileWriter(filePath); OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(file), "utf-8"); BufferedWriter bw = new BufferedWriter(write); - bw.write("bz_print_no,package_box_sn1,package_box_sn2,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight,customer_name,customer_description,thickness,mass_per_unit_area,length,box_type,sap_pcsn,box_length,box_width,box_high\n"); + bw.write("bz_print_no,package_box_sn1,package_box_sn2,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight,customer_name,customer_description,thickness,mass_per_unit_area,length,box_type,sap_pcsn,box_length,box_width,box_high,material_type,joint_type\n"); bw.write(bz_print_no + "," + package_box_sn1 + "," @@ -158,7 +158,9 @@ public class PrintServiceImpl implements PrintService { + box_jo.getString("sap_pcsn") + "," + box_jo.getString("box_length") + "," + box_jo.getString("box_width") + "," - + box_jo.getString("box_high") + "\n" + + box_jo.getString("box_high") + "," + + box_jo.getString("material_type") + "," + + NumberUtil.round(box_jo.getString("joint_type"),2) + "\n" ); bw.close(); @@ -271,7 +273,7 @@ public class PrintServiceImpl implements PrintService { fw = new FileWriter(filePath); OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(file), "utf-8"); BufferedWriter bw = new BufferedWriter(write); - bw.write("bz_print_no,package_box_sn1,package_box_sn2,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight,customer_name,customer_description,thickness,mass_per_unit_area,length,box_type,sap_pcsn,box_length,box_width,box_high\n"); + bw.write("bz_print_no,package_box_sn1,package_box_sn2,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight,customer_name,customer_description,thickness,mass_per_unit_area,length,box_type,sap_pcsn,box_length,box_width,box_high,material_type,joint_type\n"); bw.write(bz_print_no + "," + package_box_sn1 + "," @@ -298,7 +300,9 @@ public class PrintServiceImpl implements PrintService { + box_jo.getString("sap_pcsn") + "," + box_jo.getString("box_length") + "," + box_jo.getString("box_width") + "," - + box_jo.getString("box_high") + "\n" + + box_jo.getString("box_high") + "," + + box_jo.getString("material_type") + "," + + NumberUtil.round(box_jo.getString("joint_type"),2) + "\n" ); bw.close(); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index 49269355a..80e1c57c5 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java index d0a2d955c..cabbfb7e6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java @@ -5678,6 +5678,36 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { subTab.update(jsonSub); + + if ("1003".equals(jo_mst.getString("bill_type")) || "1006".equals(jo_mst.getString("bill_type"))) { + //如果为返检出库或者改切出库删除对应的包装关系 + JSONArray dis_rows = new JSONArray(); + if (jo_mst.getString("is_overdue").equals("1")) { + dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' and is_overdue = '0'").getResultJSONArray(0); + } else { + dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); + } + + for (int j = 0; j < dis_rows.size(); j++) { + JSONObject dis_row = dis_rows.getJSONObject(j); + String sect_code = dis_row.getString("sect_code"); + JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_code = '" + sect_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(sect_jo)) { + throw new BadRequestException("未查询到对应的库区!"); + } + //如果是虚拟区的出库,直接把包装关系删除;如果为立库的包装关系,将解绑删除标识置为1。当发货区解绑时,删除包装关系 + String pcsn = dis_row.getString("pcsn"); + if ("09".equals(sect_jo.getString("sect_type_attr"))) { + WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("container_name = '" + pcsn + "'"); + } else { + HashMap map = new HashMap<>(); + map.put("need_delete", "1"); + WQLObject.getWQLObject("pdm_bi_subpackagerelation").update(map, "container_name = '" + pcsn + "'"); + } + + } + } + // 解锁起点 JSONObject from_start = new JSONObject(); from_start.put("struct_id", dis.getString("struct_id")); diff --git a/lms/nladmin-ui/src/assets/images/avatar1.png b/lms/nladmin-ui/src/assets/images/avatar1.png deleted file mode 100644 index 997732a45..000000000 Binary files a/lms/nladmin-ui/src/assets/images/avatar1.png and /dev/null differ diff --git a/lms/nladmin-ui/src/assets/images/background11.jpg b/lms/nladmin-ui/src/assets/images/background11.jpg deleted file mode 100644 index 471a65c4e..000000000 Binary files a/lms/nladmin-ui/src/assets/images/background11.jpg and /dev/null differ diff --git a/lms/nladmin-ui/src/assets/images/background111.jpg b/lms/nladmin-ui/src/assets/images/background111.jpg deleted file mode 100644 index 529b89abd..000000000 Binary files a/lms/nladmin-ui/src/assets/images/background111.jpg and /dev/null differ diff --git a/lms/nladmin-ui/src/assets/images/background1111.jpg b/lms/nladmin-ui/src/assets/images/background1111.jpg deleted file mode 100644 index 62d024d85..000000000 Binary files a/lms/nladmin-ui/src/assets/images/background1111.jpg and /dev/null differ diff --git a/lms/nladmin-ui/src/assets/images/background2.jpg b/lms/nladmin-ui/src/assets/images/background2.jpg deleted file mode 100644 index 69e634863..000000000 Binary files a/lms/nladmin-ui/src/assets/images/background2.jpg and /dev/null differ diff --git a/lms/nladmin-ui/src/assets/images/background222.jpg b/lms/nladmin-ui/src/assets/images/background222.jpg deleted file mode 100644 index e3a2c719f..000000000 Binary files a/lms/nladmin-ui/src/assets/images/background222.jpg and /dev/null differ diff --git a/lms/nladmin-ui/src/assets/images/background3.jpg b/lms/nladmin-ui/src/assets/images/background3.jpg deleted file mode 100644 index 5424ccdb3..000000000 Binary files a/lms/nladmin-ui/src/assets/images/background3.jpg and /dev/null differ