Browse Source

opt: 组盘,点位页面优化,lms冲床下料入库功能添加;acs添加心跳设备

master
yanps 1 month ago
parent
commit
4a82af6167
  1. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java
  2. 9
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/plc_to_agv/PlcToAgvDeviceDriver.java
  3. 89
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/ItemProtocol.java
  4. 61
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDefination.java
  5. 223
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/sorting/SortingDeviceDriver.java
  6. 4
      acs/nladmin-ui/src/views/acs/device/config.vue
  7. 552
      acs/nladmin-ui/src/views/acs/device/driver/sorting.vue
  8. 14
      lms/nladmin-system/nlsso-server/pom.xml
  9. 23
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  10. 150
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java
  11. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/LmsToWmsService.java
  12. 11
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/wms/service/impl/LmsToWmsServiceImpl.java
  13. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml
  14. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  15. 105
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java
  16. 12
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java
  17. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java
  18. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/AtTask.java
  19. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/BlankingTask.java
  20. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/EmptyCageTask.java
  21. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/MtTask.java
  22. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/RackTask.java
  23. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/handheld/ToStoreHouseTask.java
  24. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCMTask.java
  25. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationCNTask.java
  26. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSMTTask.java
  27. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/PcOperationSNTTask.java
  28. 30
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/pcoperation/ProcessingSMTTask.java
  29. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCMTTask.java
  30. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCNTTask.java
  31. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java
  32. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSNTTask.java
  33. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingTwoCNTTask.java
  34. 36
      lms/nladmin-ui/src/views/wms/sch/point/index.vue

2
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"),

9
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)

89
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<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_Heartbeat, "心跳", "DB600.D6"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_Heartbeat, "心跳", "DB600.D6"));
return list;
}
}

61
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<? extends DeviceDriver> getDeviceDriverType() {
return SortingDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

223
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<String, Object> 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<String, Object> itemMap = new HashMap<String, Object>();
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<String, Object> map) {
if (!"heartbeat".equals(map.get("heartbeat"))) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> 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<String, Object> itemMap) {
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
public List<String> 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<String> 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;
}
}

4
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],

552
acs/nladmin-ui/src/views/acs/device/driver/sorting.vue

@ -0,0 +1,552 @@
<template>
<!--检测站点-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
filterable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">输送系统</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-input v-model="form.address" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="检验有货">
<el-switch v-model="form.inspect_in_stocck" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="取货校验" label-width="150px">
<el-switch v-model="form.is_wait" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="取货完成校验" label-width="150px">
<el-switch v-model="form.is_wait_finish" />
</el-form-item>
</el-col>
<!-- <el-col :span="8">
<el-form-item label="忽视放货校验" label-width="150px">
<el-switch v-model="form.ignore_release_check" />
</el-form-item>
</el-col> -->
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="放货校验" label-width="150px">
<el-switch v-model="form.is_releases" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="放货完成校验" label-width="150px">
<el-switch v-model="form.is_releases_finish" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="呼叫">
<el-switch v-model="form.apply_task" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="响应" label-width="150px">
<el-switch v-model="form.manual_create_task" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备" prop="device_code">
<el-select
v-model="form.link_device_code"
filterable
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
<el-select
v-model="form.link_three_lamp"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否输入物料" label-width="150px">
<el-switch v-model="form.input_material" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">AGV相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="取货">
<el-switch v-model="form.is_pickup" />
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="放货">
<el-switch v-model="form.is_release" />
</el-form-item>
<el-form-item label="上下层" prop="upper_lower_levels" label-width="100px">
<el-select
v-model="form.upper_lower_levels"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in levels"
:key="item.name"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<!-- <el-col>
<el-form-item label="上下层" prop="upper_lower_levels" label-width="100px">
<el-select
v-model="form.upper_lower_levels"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in levels"
:key="item.name"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data1"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data1[scope.$index].db"
size="mini"
class="edit-input"
@input="finishReadEdit(data1[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbr_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC写入字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data2"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data2[scope.$index].db"
size="mini"
class="edit-input"
@input="finishWriteEdit(data2[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbw_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig,
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
export default {
name: 'StandardInspectSite',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
opc_id: '',
opc_code: '',
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],
deviceList: [],
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
link_three_lamp: '',
manual_create_task: true,
is_pickup: true,
is_release: true,
link_device_code: [],
address: '',
is_wait: true,
is_wait_finish: true,
is_releases: true,
is_releases_finish: true
},
rules: {},
levels: [
{
name: '上层',
value: '1'
},
{
name: '下层',
value: '2'
}
]
}
},
created() {
this.$nextTick(() => {
//
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
//
if (data.form) {
const arr = Object.keys(data.form)
//
if (arr.length > 0) {
this.form = data.form
}
}
//
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
//
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
this.data1 = data.rs
this.data2 = data.ws
this.sliceItem()
})
selectPlcList().then(data => {
this.dataOpcPlcs = data
this.plc_id = this.$props.parentForm.opc_plc_id
})
selectOpcList().then(data => {
this.dataOpcservers = data
this.opc_id = this.$props.parentForm.opc_server_id
})
deviceCrud.selectDeviceList().then(data => {
this.deviceList = data
})
})
},
methods: {
finishReadEdit(data) {
// code,mode
if (data.code.indexOf('mode') !== -1) {
debugger
const dbValue = data.db
// .
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .
const afterStr = dbValue.match(/\.(\S*)/)[1]
//
const endNumber = afterStr.substring(1)
//
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('move') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 5)
}
if (this.data1[val].code.indexOf('task') !== -1) {
this.data1[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 7)
}
}
}
},
finishWriteEdit(data) {
// code,mode
if (data.code.indexOf('to_command') !== -1) {
const dbValue = data.db
// .
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .
const afterStr = dbValue.match(/\.(\S*)/)[1]
//
const endNumber = afterStr.substring(1)
//
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data2) {
if (this.data2[val].code.indexOf('to_target') !== -1) {
this.data2[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
if (this.data2[val].code.indexOf('to_task') !== -1) {
this.data2[val].db = beforeStr + '.' + 'D' + (parseInt(endNumber) + 6)
}
}
}
},
changeOpc(val) {
this.dataOpcservers.forEach(item => {
if (item.opc_id === val) {
this.opc_code = item.opc_code
}
})
selectListByOpcID(val).then(data => {
this.dataOpcPlcs = data
this.plc_id = ''
this.plc_code = ''
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
this.plc_id = this.dataOpcPlcs[0].plc_id
this.plc_code = this.dataOpcPlcs[0].plc_code
}
this.sliceItem()
})
},
changePlc(val) {
this.dataOpcPlcs.forEach(item => {
if (item.plc_id === val) {
this.plc_code = item.plc_code
this.sliceItem()
return
}
})
},
test_read1() {
testRead(this.data1, this.opc_id).then(data => {
this.data1 = data
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
test_write1() {
testwrite(this.data2, this.opc_id).then(data => {
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
//
const parentForm = this.parentForm
parentForm.is_route = true
parentForm.plc_id = this.plc_id
parentForm.opc_id = this.opc_id
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sliceItem() { // DBItem
this.data1.forEach(item => {
const str = item.code
// .
if (str.search('.') !== -1) {
//
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
this.data2.forEach(item => {
const str = item.code
// .
if (str.search('.') !== -1) {
//
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
}
}
}
</script>
<style scoped>
</style>

14
lms/nladmin-system/nlsso-server/pom.xml

@ -34,6 +34,20 @@
<dependencies>
<dependency>
<groupId>org.samba.jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.2.19</version>
</dependency>
<dependency>
<groupId>ch.ethz.ganymed</groupId>
<artifactId>ganymed-ssh2</artifactId>
<version>build210</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>fontbox</artifactId>

23
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<String> 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);
}

150
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<String, Object> 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<cn.hutool.json.JSONObject> 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<String, Object> 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<cn.hutool.json.JSONObject> 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);
});
});*/
}

7
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 {
}

11
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 {
}

2
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
<if test="query.vehicle_code != null">
AND vg.vehicle_code = #{query.vehicle_code}
AND vg.vehicle_code like CONCAT('%', #{query.vehicle_code}, '%')
</if>
<if test="query.workshop_code != null">
AND vg.workshop_code = #{query.workshop_code}

2
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<SchBasePointMapper, Sch
.eq(ObjectUtil.isNotEmpty(point_status), SchBasePoint::getPoint_status, point_status)
.eq(ObjectUtil.isNotEmpty(is_used), SchBasePoint::getIs_used, is_used)
.eq(ObjectUtil.isNotEmpty(lock_type), SchBasePoint::getIs_lock, lock_type)
.eq(ObjectUtil.isNotEmpty(vehicleCode), SchBasePoint::getVehicle_code, vehicleCode)
.like(ObjectUtil.isNotEmpty(vehicleCode), SchBasePoint::getVehicle_code, vehicleCode)
.orderByAsc(SchBasePoint::getRegion_code)
.orderByAsc(SchBasePoint::getPoint_type)
.orderByAsc(SchBasePoint::getPoint_code)

105
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java

@ -1,10 +1,15 @@
package org.nl.wms.sch.task_manage;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.system.service.notice.ISysNoticeService;
@ -15,9 +20,16 @@ import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import sun.misc.BASE64Encoder;
import java.io.File;
import javax.imageio.ImageIO;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
/**
* 查询物料图片路径
@ -44,19 +56,92 @@ public class AutoQueryFilePath {
@SneakyThrows
public void run() {
List<String> 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<String> materials) {
public void selectMaterialPath(File directory, List<String> 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)

12
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());

2
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());

2
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());

2
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());

2
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());

2
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());

2
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());

2
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());

2
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());

2
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());

2
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());

2
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());

30
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<SchBaseVehiclematerialgroup>().eq("vehicle_code", sendMaterVo.getVehicle_code()));
//schBaseVehiclematerialgroupService.remove(new QueryWrapper<SchBaseVehiclematerialgroup>().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<SchBaseVehiclematerialgroup>().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());

2
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());

2
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());

2
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());

2
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());

2
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());

36
lms/nladmin-ui/src/views/wms/sch/point/index.vue

@ -246,31 +246,33 @@
:value="item.value"
/>
</el-select>
<!-- <el-input v-model="form.can_vehicle_type" clearable style="width: 370px;" /> -->
</el-form-item>
<!-- <el-form-item label="可放载具类型" prop="can_vehicle_types">
<el-select v-model="form.can_vehicle_types" multiple placeholder="请选择" clearable style="width: 370px;">
<el-form-item label="点位状态" prop="point_status">
<el-select
v-model="form.point_status"
size="mini"
placeholder="点位状态"
class="filter-item"
style="width: 370px;"
>
<el-option
v-for="item in dict.vehicle_type"
v-for="item in pointStatus"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> -->
<!-- <el-form-item label="载具数量" prop="vehicle_qty">
<el-input-number v-model="form.vehicle_qty" style="width: 370px;" :controls="false" class="clear-number-input" :min="0" :precision="0" :max="99999" label="载具数量" size="mini" />
</el-form-item> -->
<el-form-item label="点位状态" prop="point_status">
</el-form-item>
<el-form-item label="点位类型" prop="point_type">
<el-select
v-model="form.point_status"
v-model="form.point_type"
size="mini"
placeholder="点位状态"
placeholder="货物状态"
class="filter-item"
style="width: 370px;"
>
<el-option
v-for="item in pointStatus"
v-for="item in pointType"
:key="item.value"
:label="item.label"
:value="item.value"
@ -450,6 +452,16 @@ export default {
}
}
},
pointType: [
{
label: '空托盘',
value: '0'
},
{
label: '满料',
value: '1'
}
],
pointStatus: [
{
label: '有货',

Loading…
Cancel
Save