diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 3e7b306..2c287b4 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -27,6 +27,8 @@ public enum DriverTypeEnum { PLC_TO_AGV(15, "plc_to_agv", "PLCTOAGV站点", "conveyor"), + SORTING(16, "sorting", "Sorting站点", "conveyor"), + AGV_NDC_TWO(8, "agv_ndc_two", "NDC2楼AGV", "agv"), XGAGV(9, "xg_agv", "xg_agv", "agv"), diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java index 4e17e33..2e99563 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java @@ -111,14 +111,6 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev AGVSetOutReqUpper = this.itemProtocol.getAGVSetOutReqUpper(); AGVSetOutReqLower = this.itemProtocol.getAGVSetOutReqLower(); heartbeat = this.itemProtocol.getHeartbeat(); - if (heartbeat == 1) { - List list = new ArrayList<>(); - Map map = new HashMap(); - map.put("code", "heartbeat"); - map.put("value", writing_heartbeat); - list.add(map); - writing(list); - } } catch (Exception var17) { log.info("读取信号失败,失败原因:{}", var17.getMessage()); throw new BadRequestException("读取信号失败,失败原因:" + var17.getMessage()); @@ -160,7 +152,6 @@ public class PlcToAgvDeviceDriver extends AbstractOpcDeviceDriver implements Dev itemMap.put(to_param, json.getString("value")); } } - LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("下发电气信号:" + itemMap) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/ItemProtocol.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/ItemProtocol.java new file mode 100644 index 0000000..9c5d5c2 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/ItemProtocol.java @@ -0,0 +1,89 @@ +package org.nl.acs.device_driver.basedriver.sorting; + +import cn.hutool.core.util.ObjectUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Data +public class ItemProtocol { + + public static String item_Heartbeat = "heartbeat"; + + private SortingDeviceDriver driver; + + static Object msg; + + public ItemProtocol(SortingDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_Heartbeat); + } + + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + int last_value = 0; + long date = 0; + private static final long STABILITY_DURATION_MS = 3000; // 稳定时间 3 秒 + + public int getOpcIntegerValue(String protocol) { + getExends(); + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + + public Short getOpcShortValue(String protocol) { + getExends(); + Short value = this.driver.getShortValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public void getExends() { + Object upper_lower_levels = this.driver.getExtraValue().get("upper_lower_levels"); + if (ObjectUtil.isNotEmpty(upper_lower_levels)) { + msg = upper_lower_levels; + } + } + + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_Heartbeat, "心跳", "DB600.D6")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_Heartbeat, "心跳", "DB600.D6")); + return list; + } + +} + diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDefination.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDefination.java new file mode 100644 index 0000000..6760eae --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDefination.java @@ -0,0 +1,61 @@ +package org.nl.acs.device_driver.basedriver.sorting; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * PlcToAgv站点 + */ +@Service +public class SortingDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "sorting"; + } + + @Override + public String getDriverName() { + return "Sorting站点"; + } + + @Override + public String getDriverDescription() { + return "Sorting站点"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new SortingDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return SortingDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.conveyor); + return types; + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDeviceDriver.java new file mode 100644 index 0000000..d2a17ec --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDeviceDriver.java @@ -0,0 +1,223 @@ +package org.nl.acs.device_driver.basedriver.sorting; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.mapper.TaskMapper; +import org.nl.common.exception.BadRequestException; +import org.nl.config.SpringContextHolder; +import org.nl.system.service.lucene.LuceneExecuteLogService; +import org.nl.system.service.lucene.dto.LuceneLogDto; +import org.openscada.opc.lib.da.Server; + +import java.util.*; + +/** + * PlcToAgv站点 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class SortingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + + InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); + + DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); + + RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); + + TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); + + TaskMapper taskMapper; + + AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); + + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + + + Boolean flag = false; + + String device_code; + + String writing_heartbeat = "0"; + + private long STABILITY_DURATION_MS = 8000; + + int heartbeat = 0; + int last_heartbeat = 0; + private Date instruction_require_time = new Date(); + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + String message = null; + try { + device_code = this.getDeviceCode(); + heartbeat = this.itemProtocol.getHeartbeat(); + if (heartbeat == 1) { + List list = new ArrayList<>(); + Map map = new HashMap(); + map.put("code", "heartbeat"); + map.put("value", writing_heartbeat); + list.add(map); + writing(list); + } + } catch (Exception var17) { + log.info("读取信号失败,失败原因:{}", var17.getMessage()); + throw new BadRequestException("读取信号失败,失败原因:" + var17.getMessage()); + } + last_heartbeat = heartbeat; + } + + public void writing(String param, String value) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + + Map itemMap = new HashMap<>(); + + itemMap.put(to_param, Integer.parseInt(value)); + try { + Thread.sleep(1000); + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + } + if (!"heartbeat".equals(param)) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发多个电气信号" + itemMap) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } + + public void writing(List list) { + Map itemMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + Object ob = list.get(i); + JSONObject json = (JSONObject) JSONObject.toJSON(ob); + if (!StrUtil.isEmpty(json.getString("value"))) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + json.getString("code"); + itemMap.put(to_param, json.getString("value")); + } + } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发电气信号:" + itemMap) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + try { + this.checkcontrol(itemMap); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + } + + public void writing(Map map) { + if (!"heartbeat".equals(map.get("heartbeat"))) { + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + Map itemMap = new LinkedHashMap<>(); + map.forEach((key, value) -> { + if (ObjectUtil.isNotEmpty(value)) { + itemMap.put(getToParam() + key, value); + } + }); + if (ObjectUtil.isNotEmpty(itemMap)) { + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + } + logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发多个电气信号" + itemMap) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } + } + + public String getToParam() { + return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "."; + } + + + public void set_last_container(String barcode, String type_desc) { + this.set_last_container(barcode); + this.set_last_container_type_desc(type_desc); + } + + public void set_last_container(String barcode) { + } + + public void set_last_container_type_desc(String type) { + } + + public boolean exe_business() { + return true; + } + + + public void executing(Server server, Map itemMap) { + this.control(itemMap); + } + + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + + public List getExtraDeviceCodes(String extraName) { + String extraValue = (String) this.getDevice().getExtraValue().get(extraName); + if (StrUtil.isEmpty(extraValue)) { + return new ArrayList<>(); + } + String devicesString = extraValue.substring(1, extraValue.length() - 1); + List devicesList = new ArrayList<>(); + String[] devices = devicesString.split(","); + for (int i = 0; i < devices.length; i++) { + String s = devices[i].replace("\"", "").replace("\"", ""); + devicesList.add(s); + } + return devicesList; + } +} diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 3facd7a..10cc1fa 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -76,6 +76,7 @@ import { getDicts } from '@/views/system/dict/dict' import standard_autodoor from '@/views/acs/device/driver/standard_autodoor' import standard_inspect_site from './driver/standard_inspect_site' import plc_to_agv from './driver/plc_to_agv' +import sorting from './driver/sorting' import standard_ordinary_site from './driver/standard_ordinary_site' import standard_storage from '@/views/acs/device/driver/standard_storage' import standard_scanner from '@/views/acs/device/driver/standard_scanner' @@ -115,7 +116,8 @@ export default { empty_vehicle_stacking_position, agv_ndc_two, agv_ndc_one, - xg_agv + xg_agv, + sorting }, dicts: ['device_type'], mixins: [crud], diff --git a/acs/nladmin-ui/src/views/acs/device/driver/sorting.vue b/acs/nladmin-ui/src/views/acs/device/driver/sorting.vue new file mode 100644 index 0000000..8292ce4 --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/device/driver/sorting.vue @@ -0,0 +1,552 @@ + + + + + diff --git a/lms/nladmin-system/nlsso-server/pom.xml b/lms/nladmin-system/nlsso-server/pom.xml index ee11851..63098a9 100644 --- a/lms/nladmin-system/nlsso-server/pom.xml +++ b/lms/nladmin-system/nlsso-server/pom.xml @@ -34,6 +34,20 @@ + + org.samba.jcifs + jcifs + 1.2.19 + + + + + ch.ethz.ganymed + ganymed-ssh2 + build210 + + + org.apache.pdfbox fontbox diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 4f66b92..370176a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -346,7 +346,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { SchBasePoint schBasePoint1 = null; List list = GeneralDefinition.CYZZD01.get(device_code); if (CollUtil.isEmpty(list)) { - list = GeneralDefinition.CYZZD02.get(device_code); + list = GeneralDefinition.CYZZD02.get(device_code); } if (CollUtil.isNotEmpty(list)) { for (String s : list) { @@ -509,21 +509,30 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { json.put("status", status); json.put("device_code", schBaseTask.getPoint_code1()); json.put("task_code", schBaseTask.getTask_code()); - if(schBaseTask.getPoint_code1().endsWith("1")){ + if (schBaseTask.getPoint_code1().endsWith("1")) { String replace = schBaseTask.getPoint_code1().replace("1", "2"); SchBaseTask schBaseTask1 = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) .eq(SchBaseTask::getPoint_code1, replace) - .eq(SchBaseTask::getTask_status,TaskStatus.TIMEOUT.getCode())); - if(ObjectUtil.isNotEmpty(schBaseTask1)){ + .eq(SchBaseTask::getTask_status, TaskStatus.TIMEOUT.getCode())); + if (ObjectUtil.isNotEmpty(schBaseTask1)) { schBaseTask1.setTask_status(TaskStatus.CREATED.getCode()); taskService.update(schBaseTask1); } - } else if(schBaseTask.getPoint_code1().endsWith("3")){ + } else if (schBaseTask.getPoint_code1().endsWith("3")) { String replace = schBaseTask.getPoint_code1().replace("3", "4"); SchBaseTask schBaseTask2 = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) .eq(SchBaseTask::getPoint_code1, replace) - .eq(SchBaseTask::getTask_status,TaskStatus.TIMEOUT.getCode())); - if(ObjectUtil.isNotEmpty(schBaseTask2)){ + .eq(SchBaseTask::getTask_status, TaskStatus.TIMEOUT.getCode())); + if (ObjectUtil.isNotEmpty(schBaseTask2)) { + schBaseTask2.setTask_status(TaskStatus.CREATED.getCode()); + taskService.update(schBaseTask2); + } + } else if (schBaseTask.getPoint_code1().endsWith("5")) { + String replace = schBaseTask.getPoint_code1().replace("5", "6"); + SchBaseTask schBaseTask2 = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) + .eq(SchBaseTask::getPoint_code1, replace) + .eq(SchBaseTask::getTask_status, TaskStatus.TIMEOUT.getCode())); + if (ObjectUtil.isNotEmpty(schBaseTask2)) { schBaseTask2.setTask_status(TaskStatus.CREATED.getCode()); taskService.update(schBaseTask2); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java index 3e40420..3a6961d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java @@ -34,6 +34,7 @@ import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task_manage.AbstractTask; import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.task.TaskFactory; +import org.nl.wms.sch.task_manage.task.core.TaskType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -324,80 +325,87 @@ public class HandheldServiceImpl implements HandheldService { //TODO:是否需要加上是否有无货校验 Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!"); JSONArray materials = param.getJSONArray("material"); - if (materials.size() < 1) { - throw new BadRequestException("物料下料数量不能为空!"); - } JSONObject jo = new JSONObject(); - if (StrUtil.isBlank(region_code)) { - JSONObject json = new JSONObject(); - JSONArray jsonArray = new JSONArray(); - materials.stream().forEach(material2 -> { - boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code")); - if (material_code) { - ((LinkedHashMap) material2).remove("material_code"); - } - HashMap map = new HashMap<>(); - cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material2); - map.put("order_code", jsonObject.get("order_code")); - map.put("qty", jsonObject.get("material_qty")); - jsonArray.add(map); - }); - json.put("vehicle_code", vehicle_code); - json.put("region_code", schBasePoint.getRegion_code()); - json.put("materials", jsonArray); - JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json); - if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == 200) { - JSONArray date = json1.getJSONArray("data"); - date.stream().map(date1 -> JSONObject.parseObject(StrUtil.toString(date1))).forEach(json2 -> { - List updatedMaterials = materials.stream() - .map(material -> { - cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); - if (jsonObject.get("order_code").equals(json2.getString("order_code"))) { - jsonObject.putOpt("due_date", json2.getString("due_date")); - jsonObject.putOpt("region_code", json2.getString("next_region_code")); - jsonObject.putOpt("priority", json2.getString("priority")); - return jsonObject; // 更新的对象 - } else { - return jsonObject; // 其他对象保持不变 - } - }) - .collect(Collectors.toList()); - materials.clear(); - materials.addAll(updatedMaterials); + //冲床人工入库使用 + if (materials.size() < 1) { + jo.put("device_code", device_code); + jo.put("config_code", "CNTTask"); + jo.put("create_mode", GeneralDefinition.AUTO_CREATION); + jo.put("vehicle_code", vehicle_code); + jo.put("task_type", TaskType.CARRY_TASK.getValue()); + connectorTask.apply(jo); + } else { + if (StrUtil.isBlank(region_code)) { + JSONObject json = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + materials.stream().forEach(material2 -> { + boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code")); + if (material_code) { + ((LinkedHashMap) material2).remove("material_code"); + } + HashMap map = new HashMap<>(); + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material2); + map.put("order_code", jsonObject.get("order_code")); + map.put("qty", jsonObject.get("material_qty")); + jsonArray.add(map); }); - region_code = JSONObject.parseObject(StrUtil.toString(date.get(0))).getString("region_code"); + json.put("vehicle_code", vehicle_code); + json.put("region_code", schBasePoint.getRegion_code()); + json.put("materials", jsonArray); + JSONObject json1 = wmsToConnectorService.applyRegionAndDueDate(json); + if (ObjectUtil.isNotEmpty(json1) && json1.getInteger("status") == 200) { + JSONArray date = json1.getJSONArray("data"); + date.stream().map(date1 -> JSONObject.parseObject(StrUtil.toString(date1))).forEach(json2 -> { + List updatedMaterials = materials.stream() + .map(material -> { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); + if (jsonObject.get("order_code").equals(json2.getString("order_code"))) { + jsonObject.putOpt("due_date", json2.getString("due_date")); + jsonObject.putOpt("region_code", json2.getString("next_region_code")); + jsonObject.putOpt("priority", json2.getString("priority")); + return jsonObject; // 更新的对象 + } else { + return jsonObject; // 其他对象保持不变 + } + }) + .collect(Collectors.toList()); + materials.clear(); + materials.addAll(updatedMaterials); + }); + region_code = JSONObject.parseObject(StrUtil.toString(date.get(0))).getString("region_code"); + jo.put("region_code", region_code); + } else if (ObjectUtil.isNotEmpty(json1)) { + throw new BadRequestException(json1.getString("msg")); + } + } else { jo.put("region_code", region_code); - } else if (ObjectUtil.isNotEmpty(json1)) { - throw new BadRequestException(json1.getString("msg")); } - } else { - jo.put("region_code", region_code); + jo.put("device_code", device_code); + jo.put("config_code", "BLANKINGTask"); + jo.put("create_mode", GeneralDefinition.AUTO_CREATION); + jo.put("vehicle_code", vehicle_code); + jo.put("ext_data", param); + iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) + .eq(SchBasePoint::getPoint_code, device_code) + .set(SchBasePoint::getIs_lock, true)); + connectorTask.apply(jo); + iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) + .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); + String finalRegion_code = region_code; + materials.stream().forEach(material -> { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); + SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); + schBaseVehiclematerialgroup.setVehicle_code(vehicle_code); + schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInt("material_qty")); + schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getStr("material_code")); + schBaseVehiclematerialgroup.setOrder_code(jsonObject.getStr("order_code")); + schBaseVehiclematerialgroup.setDue_date(jsonObject.getStr("due_date")); + schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName()); + schBaseVehiclematerialgroup.setPriority(jsonObject.getStr("priority")); + schBaseVehiclematerialgroup.setRegion_code(StrUtil.isBlank(finalRegion_code) ? jsonObject.getStr("region_code") : finalRegion_code); + iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); + }); } - jo.put("device_code", device_code); - jo.put("config_code", "BLANKINGTask"); - jo.put("create_mode", GeneralDefinition.AUTO_CREATION); - jo.put("vehicle_code", vehicle_code); - jo.put("ext_data", param); - iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) - .eq(SchBasePoint::getPoint_code, device_code) - .set(SchBasePoint::getIs_lock, true)); - connectorTask.apply(jo); - iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) - .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); - String finalRegion_code = region_code; - materials.stream().forEach(material -> { - cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material); - SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); - schBaseVehiclematerialgroup.setVehicle_code(vehicle_code); - schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInt("material_qty")); - schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getStr("material_code")); - schBaseVehiclematerialgroup.setOrder_code(jsonObject.getStr("order_code")); - schBaseVehiclematerialgroup.setDue_date(jsonObject.getStr("due_date")); - schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName()); - schBaseVehiclematerialgroup.setPriority(jsonObject.getStr("priority")); - schBaseVehiclematerialgroup.setRegion_code(StrUtil.isBlank(finalRegion_code) ? jsonObject.getStr("region_code") : finalRegion_code); - iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); - }); } /** @@ -430,7 +438,7 @@ public class HandheldServiceImpl implements HandheldService { iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) .eq(SchBasePoint::getPoint_code, device_code) .set(SchBasePoint::getIs_lock, true)); - iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) + /*iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) .eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)); materials.stream().forEach(material -> { String replace = StrUtil.replace(StrUtil.toString(material), "=", ":"); @@ -453,7 +461,7 @@ public class HandheldServiceImpl implements HandheldService { schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName()); schBaseVehiclematerialgroup.setRegion_code(region_code); iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); - }); + });*/ } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/LmsToWmsService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/LmsToWmsService.java new file mode 100644 index 0000000..8f7329b --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/LmsToWmsService.java @@ -0,0 +1,7 @@ +package org.nl.wms.ext.wms.service; + +/** + * @author LENOVO + */ +public interface LmsToWmsService { +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/impl/LmsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/impl/LmsToWmsServiceImpl.java new file mode 100644 index 0000000..1ac299d --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/impl/LmsToWmsServiceImpl.java @@ -0,0 +1,11 @@ +package org.nl.wms.ext.wms.service.impl; + +import org.springframework.stereotype.Service; + +/** + * lms下发wms + * @author LENOVO + */ +@Service +public class LmsToWmsServiceImpl { +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml index 04cad17..172daf6 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml @@ -80,7 +80,7 @@ sch_base_vehiclematerialgroup vg where vg.is_delete = 0 - AND vg.vehicle_code = #{query.vehicle_code} + AND vg.vehicle_code like CONCAT('%', #{query.vehicle_code}, '%') AND vg.workshop_code = #{query.workshop_code} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java index 058f322..ed7aebf 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java @@ -99,7 +99,7 @@ public class SchBasePointServiceImpl extends ServiceImpl materials = iSchBaseVehiclematerialgroupService.selectMaterialPathIsEmpty(); - if(StrUtil.isEmpty(materialUrl)) { - Param byCode = sysParamService.findByCode(GeneralDefinition.MATERIAL_URL); - materialUrl = byCode.getValue(); + + Param byCode = sysParamService.findByCode(GeneralDefinition.MATERIAL_URL); + String materialUrl = byCode.getValue(); + directory = new File(materialUrl); + if (ObjectUtil.isNotEmpty(directory) && !directory.exists()) { directory = new File(materialUrl); } if (ObjectUtil.isNotEmpty(directory) && CollUtil.isNotEmpty(materials)) { if (directory.exists() && directory.isDirectory()) { - noticeService.createNotice("开始查询物料图片路径!", "1", + noticeService.createNotice("开始查询物料图片路径!", IdUtil.randomUUID(), NoticeTypeEnum.WARN.getCode()); selectMaterialPath(directory, materials); + noticeService.createNotice("结束查询物料图片路径!", IdUtil.randomUUID(), + NoticeTypeEnum.WARN.getCode()); + } else { + noticeService.createNotice("物料图片路径!" + directory.exists(), IdUtil.randomUUID(), + NoticeTypeEnum.WARN.getCode()); + } + } + } + + public void applyMaterialPath(String url) { + System.setProperty("jcifs.smb.client.username", ""); + System.setProperty("jcifs.smb.client.password", ""); + System.setProperty("jcifs.smb.client.domain", ""); + ByteArrayOutputStream byteArrayOutputStream; + InputStream inputStream; + try { + SmbFile smbFile = new SmbFile(url); + if (ObjectUtil.isNotEmpty(smbFile) && (smbFile.isFile() || smbFile.isDirectory())) { + noticeService.createNotice("物料图片路径:" + smbFile.isFile() + ":" + smbFile.isDirectory(), IdUtil.randomUUID(), + NoticeTypeEnum.WARN.getCode()); + } else { + noticeService.createNotice("物料图片路径", IdUtil.randomUUID(), + NoticeTypeEnum.WARN.getCode()); } - noticeService.createNotice("结束查询物料图片路径!", "2", + } catch (Exception e) { + noticeService.createNotice("报错:" + e.getMessage(), IdUtil.randomUUID(), NoticeTypeEnum.WARN.getCode()); + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + // 设置远程计算机的 SMB URL + String url = "smb://192.168.10.59/Users/Administrator/Desktop/9000/9002/9002_large.png"; + + // 设置用户名和密码(如果有域名也可以指定) + String username = "Administrator"; + String password = "20001217"; + String domain = ""; // 如果没有域,可以为空字符串 + + // 配置 JCIFS 客户端的用户名、密码和域 + System.setProperty("jcifs.smb.client.username", username); + System.setProperty("jcifs.smb.client.password", password); + System.setProperty("jcifs.smb.client.domain", domain); + + try { + // 创建一个 SmbFile 对象,表示远程共享文件 + SmbFile smbFile = new SmbFile(url); + + /*SmbFile[] smbFiles = smbFile.listFiles(); + for (int i = 0; i < Arrays.stream(smbFiles).count(); i++) { + SmbFile smbFile1 = smbFiles[i]; + boolean directory = smbFile1.isDirectory(); + }*/ + + // 打开文件输入流 + InputStream inputStream = new SmbFileInputStream(smbFile); + // 使用 ByteArrayOutputStream 收集数据 + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + byteArrayOutputStream.write(buffer, 0, bytesRead); + } + // 将 ByteArrayOutputStream 转换为字节数组 + byte[] fileBytes = byteArrayOutputStream.toByteArray(); + BASE64Encoder encoder = new BASE64Encoder(); + System.out.println("data:image/png;base64," + encoder.encode(fileBytes).replace("\r\n", "")); + // 关闭文件读取器 + byteArrayOutputStream.close(); + inputStream.close(); + } catch (Exception e) { + e.printStackTrace(); } } @@ -64,12 +149,12 @@ public class AutoQueryFilePath { /** * 查找物料图片路径 */ - public void selectMaterialPath(File directory,List materials) { + public void selectMaterialPath(File directory, List materials) { File[] files = directory.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { - selectMaterialPath(file,materials); + selectMaterialPath(file, materials); } else if (file.isFile() && CollUtil.contains(materials, file.getName().substring(0, file.getName().lastIndexOf('.')))) { String material = file.getName().substring(0, file.getName().lastIndexOf('.')); iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java index 237fe17..519877c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java @@ -85,7 +85,7 @@ public class CNTTask extends AbstractTask { task.setVehicle_type(schBasePoint.getCan_vehicle_type()); task.setRemark(""); task.setTask_status(TaskStatus.CREATED.getCode()); - if (task.getPoint_code1().endsWith("1") || task.getPoint_code1().endsWith("3")) { + if (task.getPoint_code1().endsWith("1") || task.getPoint_code1().endsWith("3") || task.getPoint_code1().endsWith("5")) { task.setAcs_trace_id("4"); } else { if(task.getPoint_code1().endsWith("2")){ @@ -104,6 +104,14 @@ public class CNTTask extends AbstractTask { if(ObjectUtil.isNotEmpty(schBaseTask)){ task.setTask_status(TaskStatus.TIMEOUT.getCode()); } + } else if(task.getPoint_code1().endsWith("6")){ + String replace = task.getPoint_code1().replace("6", "5"); + SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) + .eq(SchBaseTask::getPoint_code1, replace) + .le(SchBaseTask::getTask_status,TaskStatus.EXECUTING.getCode())); + if(ObjectUtil.isNotEmpty(schBaseTask)){ + task.setTask_status(TaskStatus.TIMEOUT.getCode()); + } } } TaskUtils.setUpdateByAcs(task); @@ -188,7 +196,7 @@ public class CNTTask extends AbstractTask { } public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java index da08e6b..8febe10 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java @@ -157,7 +157,7 @@ public class FTGTask extends AbstractTask { schBasePointService.updateById(schBasePoint1); } // 获取参数 - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/AtTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/AtTask.java index 98df744..e04bbd1 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/AtTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/AtTask.java @@ -155,7 +155,7 @@ public class AtTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint1); schBasePointService.updateById(schBasePoint1); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/BlankingTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/BlankingTask.java index 7179e8f..bc7110a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/BlankingTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/BlankingTask.java @@ -175,7 +175,7 @@ public class BlankingTask extends AbstractTask { schBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) .eq(SchBaseVehiclematerialgroup::getVehicle_code, taskObj.getVehicle_code())); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java index 324ab59..13d9064 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java @@ -210,7 +210,7 @@ public class EmptyCageTask extends AbstractTask { pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) .set(SchBasePoint::getIs_lock, false)); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/MtTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/MtTask.java index 2ea1abf..76e019a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/MtTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/MtTask.java @@ -155,7 +155,7 @@ public class MtTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java index 08bad3b..d048667 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java @@ -171,7 +171,7 @@ public class RackTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/ToStoreHouseTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/ToStoreHouseTask.java index fb461b0..13e704a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/ToStoreHouseTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/ToStoreHouseTask.java @@ -156,7 +156,7 @@ public class ToStoreHouseTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCMTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCMTask.java index 1c7dee2..f51220b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCMTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCMTask.java @@ -162,7 +162,7 @@ public class PcOperationCMTask extends AbstractTask { .eq(SchBaseVehiclematerialgroup::getVehicle_code, taskObj.getVehicle_code()) .set(SchBaseVehiclematerialgroup::getIs_delete, false)); // 获取参数 - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCNTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCNTask.java index 5a82660..335c50a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCNTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCNTask.java @@ -150,7 +150,7 @@ public class PcOperationCNTask extends AbstractTask { schBasePointService.updateById(schBasePoint); } // 获取参数 - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSMTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSMTTask.java index c8a31d3..a8fb78f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSMTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSMTTask.java @@ -202,7 +202,7 @@ public class PcOperationSMTTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSNTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSNTTask.java index a8e0265..6dbe3ac 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSNTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSNTTask.java @@ -162,7 +162,7 @@ public class PcOperationSNTTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/ProcessingSMTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/ProcessingSMTTask.java index d0c4278..bdd07b9 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/ProcessingSMTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/ProcessingSMTTask.java @@ -2,6 +2,8 @@ package org.nl.wms.sch.task_manage.task.tasks.pcoperation; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -10,6 +12,7 @@ import org.apache.commons.lang3.StringUtils; import org.nl.common.enums.GoodsEnum; import org.nl.common.enums.wms.PointStatusEnum; import org.nl.common.exception.BadRequestException; +import org.nl.common.utils.SecurityUtils; import org.nl.system.service.notice.ISysNoticeService; import org.nl.wms.database.vehicle.service.IMdBaseVehicleService; import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle; @@ -87,7 +90,7 @@ public class ProcessingSMTTask extends AbstractTask { continue; } //删除组盘记录生成新的 - schBaseVehiclematerialgroupService.remove(new QueryWrapper().eq("vehicle_code", sendMaterVo.getVehicle_code())); + //schBaseVehiclematerialgroupService.remove(new QueryWrapper().eq("vehicle_code", sendMaterVo.getVehicle_code())); // 设置终点并修改创建成功状态 task.setPoint_code2(schBasePoint.getPoint_code()); task.setVehicle_type(schBasePoint.getCan_vehicle_type()); @@ -163,6 +166,29 @@ public class ProcessingSMTTask extends AbstractTask { .set(SchBasePoint::getPoint_status, point_status) .set(SchBasePoint::getIs_lock, false)); } + schBaseVehiclematerialgroupService.remove(new QueryWrapper().eq("vehicle_code", taskObj.getVehicle_code())); + cn.hutool.json.JSONObject jsonObject2 = JSONUtil.parseObj(taskObj.getRequest_param()); + JSONArray materials = jsonObject2.getJSONArray("mater"); + materials.stream().forEach(material -> { + String replace = StrUtil.replace(StrUtil.toString(material), "=", ":"); + replace = replace.replaceAll("material_code:,", ""); + cn.hutool.json.JSONObject jsonObject1 = JSONUtil.parseObj(replace); + if (replace.contains("OR")) { + Object materialCode = jsonObject1.get("order_code"); + jsonObject1.put("order_code", materialCode.toString()); + replace = jsonObject1.toString(); + } + JSONObject jsonObject = JSONObject.parseObject(replace); + SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup(); + schBaseVehiclematerialgroup.setVehicle_code(taskObj.getVehicle_code()); + schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInteger("material_qty")); + schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getString("material_code")); + schBaseVehiclematerialgroup.setOrder_code(jsonObject.getString("order_code")); + schBaseVehiclematerialgroup.setDue_date(jsonObject.getString("due_date")); + schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName()); + schBaseVehiclematerialgroup.setRegion_code(schBasePoint2.getPoint_code()); + schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup); + }); // 任务完成 taskObj.setTask_status(TaskStatus.FINISHED.getCode()); taskObj.setRemark(GeneralDefinition.TASK_FINISH); @@ -189,7 +215,7 @@ public class ProcessingSMTTask extends AbstractTask { schBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) .eq(SchBaseVehiclematerialgroup::getVehicle_code, taskObj.getVehicle_code())); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCMTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCMTTask.java index 1f44499..58d6b9a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCMTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCMTTask.java @@ -175,7 +175,7 @@ public class SortingCMTTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCNTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCNTTask.java index cd620af..9792e11 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCNTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCNTTask.java @@ -147,7 +147,7 @@ public class SortingCNTTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java index 527382e..6977de1 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java @@ -228,7 +228,7 @@ public class SortingSMTTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSNTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSNTTask.java index 7d4d2cd..7974d5f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSNTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSNTTask.java @@ -163,7 +163,7 @@ public class SortingSNTTask extends AbstractTask { PointUtils.setUpdateByAcs(schBasePoint); schBasePointService.updateById(schBasePoint); } - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingTwoCNTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingTwoCNTTask.java index f315317..4cefecd 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingTwoCNTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingTwoCNTTask.java @@ -158,7 +158,7 @@ public class SortingTwoCNTTask extends AbstractTask { schBasePointService.updateById(schBasePoint1); } // 获取参数 - taskObj.setTask_status(TaskStatus.CANCELED.getCode()); + taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); diff --git a/lms/nladmin-ui/src/views/wms/sch/point/index.vue b/lms/nladmin-ui/src/views/wms/sch/point/index.vue index a554b6f..67cf17e 100644 --- a/lms/nladmin-ui/src/views/wms/sch/point/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/point/index.vue @@ -246,31 +246,33 @@ :value="item.value" /> - - - - + +