Browse Source

add: 添加自动门功能,手动推送物料功能

master
yanps 2 months ago
parent
commit
3b4f567083
  1. 68
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java
  3. 8
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java
  4. 7
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java
  5. 60
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  6. 77
      acs/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue
  7. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/user/dao/mapper/SysUserMapper.xml
  8. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/user/impl/ISysUserServiceImpl.java
  9. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java
  10. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  11. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java
  12. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java
  13. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/ConnectorToWmsService.java
  14. 34
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java
  15. 27
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java
  16. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java
  17. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/impl/FabServiceImpl.java
  18. 13
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java
  19. 19
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/handheldEnum/RouteEnum.java
  20. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java
  21. 59
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java
  22. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java
  23. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java
  24. 23
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java
  25. 3
      lms/nladmin-ui/src/views/system/user/index.vue

68
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -1,12 +1,14 @@
package org.nl.acs.auto.run; package org.nl.acs.auto.run;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.Instruction;
@ -131,7 +133,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//车号 //车号
int carno = arr[20]; int carno = arr[20];
//充电桩站点号 //充电桩站点号
int station=arr[25]; int station = arr[25];
Instruction link_inst = null; Instruction link_inst = null;
Instruction inst = null; Instruction inst = null;
List<Instruction> insts = null; List<Instruction> insts = null;
@ -157,7 +159,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
// //
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
//开始任务/上报订单号 //开始任务/上报订单号
if (phase == 0x01) { if (phase == 0x01) {
if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) {
@ -196,11 +198,11 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
//充电任务下发成功上报 //充电任务下发成功上报
}else if (phase == 0x64){ } else if (phase == 0x64) {
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}",agvaddr,station); log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}", agvaddr, station);
List<Dict> dictList= dictService.getDictByName("station"); List<Dict> dictList = dictService.getDictByName("station");
for(Dict dict : dictList){ for (Dict dict : dictList) {
if (Integer.parseInt(dict.getPara1())==station){ if (Integer.parseInt(dict.getPara1()) == station) {
dict.setValue("1"); dict.setValue("1");
dict.setPara2(String.valueOf(agvaddr)); dict.setPara2(String.valueOf(agvaddr));
dictService.updateDetail(dict); dictService.updateDetail(dict);
@ -208,8 +210,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
} }
//充电成功 //充电成功
}else if (phase == 0x65){ } else if (phase == 0x65) {
log.info("AGV车号{}反馈充电中,充电桩{}",agvaddr,station); log.info("AGV车号{}反馈充电中,充电桩{}", agvaddr, station);
// log.info("AGV车号{}反馈充电成功,释放充电桩{}",agvaddr,station); // log.info("AGV车号{}反馈充电成功,释放充电桩{}",agvaddr,station);
// List<Dict> dictList= dictService.getDictByName("station"); // List<Dict> dictList= dictService.getDictByName("station");
// for(Dict dict : dictList){ // for(Dict dict : dictList){
@ -221,24 +223,57 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
// } // }
// } // }
//充电取消上报 //充电取消上报
}else if (phase == 0x66){ } else if (phase == 0x66) {
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}",agvaddr,station); log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}", agvaddr, station);
List<Dict> dictList= dictService.getDictByName("station"); List<Dict> dictList = dictService.getDictByName("station");
for(Dict dict : dictList){ for (Dict dict : dictList) {
if (Integer.parseInt(dict.getPara1())==station){ if (Integer.parseInt(dict.getPara1()) == station) {
dict.setValue("0"); dict.setValue("0");
dict.setPara2(""); dict.setPara2("");
dictService.updateDetail(dict); dictService.updateDetail(dict);
break; break;
} }
} }
} else if (phase == 0x50) {
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
String is_enter = standardAutodoorDeviceDriver.getExtraValue().get("is_enter").toString();
if (StrUtil.isNotBlank(is_enter) && !"true".equals(is_enter)) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
}
}
} else {
log.info(agvaddr + "对应设备号为空!");
}
} else if (phase == 0x51) {
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
String is_enter = standardAutodoorDeviceDriver.getExtraValue().get("is_enter").toString();
if (StrUtil.isNotBlank(is_enter) && !"true".equals(is_enter)) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
}
}
} else {
log.info(device_code + "对应设备号为空!");
}
} else { } else {
//上报异常信息 //上报异常信息
//(不需要WCS反馈) //(不需要WCS反馈)
if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) { if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) {
device = deviceAppService.findDeviceByCode("agv"+ Integer.toString(agvaddr)); device = deviceAppService.findDeviceByCode("agv" + Integer.toString(agvaddr));
} else { } else {
device = deviceAppService.findDeviceByCode("agv"+ Integer.toString(arr[20])); device = deviceAppService.findDeviceByCode("agv" + Integer.toString(arr[20]));
} }
if (ObjectUtil.isNotEmpty(device)) { if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
@ -246,7 +281,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
agvNdcOneDeviceDriver.processSocket(arr); agvNdcOneDeviceDriver.processSocket(arr);
} }
} }
} }
if (!ObjectUtil.isEmpty(data)) { if (!ObjectUtil.isEmpty(data)) {
write(data); write(data);

2
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java

@ -31,7 +31,7 @@ public enum DriverTypeEnum {
XGAGV(9, "xg_agv", "xg_agv", "agv"), XGAGV(9, "xg_agv", "xg_agv", "agv"),
AUTODOOR(10, "standard_autodoor", "标准版-自动门", "autodoor"), AUTODOOR(10, "standard_autodoor", "标准版-自动门", "conveyor"),
TUBANXIAN_SITE(11, "tubanxian_site", "涂板线", "conveyor"), TUBANXIAN_SITE(11, "tubanxian_site", "涂板线", "conveyor"),
GUHUASHI_SITE(12, "guhuashi_site", "固化室", "conveyor"), GUHUASHI_SITE(12, "guhuashi_site", "固化室", "conveyor"),
TIANNENG_SITE(13, "tianneng_site", "天能-检测站点", "conveyor"), TIANNENG_SITE(13, "tianneng_site", "天能-检测站点", "conveyor"),

8
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java

@ -106,4 +106,12 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.notifyAcs(param), HttpStatus.OK); return new ResponseEntity<>(wmstoacsService.notifyAcs(param), HttpStatus.OK);
} }
@PostMapping("/updateRouteLock")
@Log("wms下发锁定释放路线动作")
@ApiOperation("wms下发锁定释放路线动作")
@SaIgnore
public ResponseEntity<Object> updateRouteLock(@RequestBody JSONObject param) {
return new ResponseEntity<>(wmstoacsService.updateRoute(param), HttpStatus.OK);
}
} }

7
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java

@ -92,5 +92,10 @@ public interface WmsToAcsService {
*/ */
JSONObject notifyAcs(JSONObject param); JSONObject notifyAcs(JSONObject param);
/**
* wms下发锁定释放路线
* @param param
* @return
*/
Object updateRoute(JSONObject param);
} }

60
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -6,12 +6,16 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import nl.basjes.shaded.org.springframework.util.Assert;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.common.IDriverService; import org.nl.acs.common.IDriverService;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device.domain.DeviceExtra;
import org.nl.acs.device.service.DeviceExtraService;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
@ -36,14 +40,12 @@ import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
import org.slf4j.MDC; import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@ -59,6 +61,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
private final RouteLineService routeLineService; private final RouteLineService routeLineService;
private final AcsToLiKuService acsToLiKuService; private final AcsToLiKuService acsToLiKuService;
private final StorageCellMapper storageCellMapper; private final StorageCellMapper storageCellMapper;
@Autowired
private DeviceExtraService deviceExtraService;
private String log_file_type = "log_file_type"; private String log_file_type = "log_file_type";
private String log_type = "LMS请求ACS"; private String log_type = "LMS请求ACS";
@ -466,14 +470,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
for (int i = 0; i < reqs.size(); i++) { for (int i = 0; i < reqs.size(); i++) {
CreateTaskRequest req = reqs.get(i); CreateTaskRequest req = reqs.get(i);
String task_code = req.getTask_code(); String task_code = req.getTask_code();
String task_id =req.getTask_id(); String task_id = req.getTask_id();
String start_device_code = req.getStart_device_code(); String start_device_code = req.getStart_device_code();
String next_device_code = req.getNext_device_code(); String next_device_code = req.getNext_device_code();
String priority = req.getPriority(); String priority = req.getPriority();
String vehicle_code = req.getVehicle_code(); String vehicle_code = req.getVehicle_code();
String vehicle_type = req.getVehicle_type(); String vehicle_type = req.getVehicle_type();
String task_type = req.getTask_type(); String task_type = req.getTask_type();
String agv_task_type=req.getAgv_task_type(); String agv_task_type = req.getAgv_task_type();
String remark = req.getRemark(); String remark = req.getRemark();
Map<String, String> params = req.getParams(); Map<String, String> params = req.getParams();
@ -577,7 +581,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
} }
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("ext_task_id",task_id); jo.put("ext_task_id", task_id);
jo.put("task_code", task_code); jo.put("task_code", task_code);
jo.put("task_id", IdUtil.simpleUUID()); jo.put("task_id", IdUtil.simpleUUID());
jo.put("start_point_code", start_point_code); jo.put("start_point_code", start_point_code);
@ -631,29 +635,30 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
public JSONObject notifyAcs(JSONObject param) { public JSONObject notifyAcs(JSONObject param) {
log.info("notifyAcs - 请求参数 {}", param); log.info("notifyAcs - 请求参数 {}", param);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
Integer type=param.getInteger("type"); Integer type = param.getInteger("type");
String device_code=param.getString("device_code"); String device_code = param.getString("device_code");
Device device = deviceAppService.findDeviceByCode(device_code);; Device device = deviceAppService.findDeviceByCode(device_code);
switch(type){ ;
switch (type) {
case 1: case 1:
//LMS通知固化室极板已进满信号,开始固化 //LMS通知固化室极板已进满信号,开始固化
if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) { if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver(); GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver();
guhuashiSiteDeviceDriver.writing("VW70043",1); guhuashiSiteDeviceDriver.writing("VW70043", 1);
} }
break; break;
case 2: case 2:
//LMS通知固化室在下班时未进满信号,开始固化 //LMS通知固化室在下班时未进满信号,开始固化
if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) { if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver(); GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver();
guhuashiSiteDeviceDriver.writing("VW70045",1); guhuashiSiteDeviceDriver.writing("VW70045", 1);
} }
break; break;
case 3: case 3:
//LMS通知固化室极板已出完 //LMS通知固化室极板已出完
if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) { if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver(); GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver = (GuhuashiSiteDeviceDriver) device.getDeviceDriver();
guhuashiSiteDeviceDriver.writing("VW70053",1); guhuashiSiteDeviceDriver.writing("VW70053", 1);
} }
break; break;
default: default:
@ -666,4 +671,31 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return result; return result;
} }
@Override
public Object updateRoute(JSONObject param) {
Assert.notNull(param.getString("pointCode"), "参数Point不能为空");
String pointCode = param.getString("pointCode");
if (pointCode.contains(",")) {
String[] split = pointCode.split(",");
Arrays.stream(split).forEach(point -> {
deviceExtraService.update(Wrappers.lambdaUpdate(DeviceExtra.class)
.eq(DeviceExtra::getDevice_code, point)
.eq(DeviceExtra::getExtra_name, "is_enter")
.eq(DeviceExtra::getExtra_code, "is_enter")
.set("0".equals(param.getString("status")),DeviceExtra::getExtra_value, "false")
.set("1".equals(param.getString("status")),DeviceExtra::getExtra_value, "true")
);
});
} else {
deviceExtraService.update(Wrappers.lambdaUpdate(DeviceExtra.class)
.eq(DeviceExtra::getDevice_code, pointCode)
.eq(DeviceExtra::getExtra_name, "is_enter")
.eq(DeviceExtra::getExtra_code, "is_enter")
.set("0".equals(param.getString("status")),DeviceExtra::getExtra_value, "false")
.set("1".equals(param.getString("status")),DeviceExtra::getExtra_value, "true")
);
}
return null;
}
} }

77
acs/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue

@ -54,85 +54,14 @@
<el-form-item label="电气调度号" label-width="150px"> <el-form-item label="电气调度号" label-width="150px">
<el-switch v-model="form.OPCServer" /> <el-switch v-model="form.OPCServer" />
</el-form-item> </el-form-item>
<el-form-item label="是否允许进入" label-width="150px">
<el-switch v-model="form.is_enter" />
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </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"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="role-span" /> <span class="role-span" />

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/user/dao/mapper/SysUserMapper.xml

@ -7,6 +7,7 @@
sys_user.person_name as personName, sys_user.person_name as personName,
sys_user.gender, sys_user.gender,
sys_user.phone, sys_user.phone,
sys_user.devices as devices,
sys_user.email, sys_user.email,
sys_user.avatar_name as avatarName, sys_user.avatar_name as avatarName,
sys_user.avatar_path as avatarPath, sys_user.avatar_path as avatarPath,
@ -52,6 +53,7 @@
<result column="updateTime" property="update_time" /> <result column="updateTime" property="update_time" />
<result column="extpersonId" property="extperson_id" /> <result column="extpersonId" property="extperson_id" />
<result column="extuserId" property="extuser_id" /> <result column="extuserId" property="extuser_id" />
<result column="devices" property="devices" />
<collection property="depts" ofType="org.nl.system.service.dept.dao.SysDept"> <collection property="depts" ofType="org.nl.system.service.dept.dao.SysDept">
<id property="dept_id" column="dept_id"/> <id property="dept_id" column="dept_id"/>
<result column="dept_name" property="name"/> <result column="dept_name" property="name"/>

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/user/impl/ISysUserServiceImpl.java

@ -1,8 +1,10 @@
package org.nl.system.service.user.impl; package org.nl.system.service.user.impl;
import cn.dev33.satoken.secure.SaSecureUtil; import cn.dev33.satoken.secure.SaSecureUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -31,6 +33,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.Serializable;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -73,6 +76,17 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
@Override @Override
public List<SysUserDetail> getUserDetail(UserQuery query, PageQuery pageQuery) { public List<SysUserDetail> getUserDetail(UserQuery query, PageQuery pageQuery) {
List<SysUserDetail> userDetail = sysUserMapper.getUserDetail(query, pageQuery); List<SysUserDetail> userDetail = sysUserMapper.getUserDetail(query, pageQuery);
userDetail.stream().forEach(detail -> {
if (StrUtil.isNotEmpty(detail.getDevices())) {
String devices = detail.getDevices();
CollUtil.addAll(JSONUtil.parseArray(devices), String.class);
List<String> lists = new ArrayList<>();
JSONUtil.parseArray(devices).stream().forEach(device -> {
lists.add(device.toString());
});
detail.setDevice(lists);
}
});
return userDetail; return userDetail;
} }
@ -82,7 +96,7 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
public void create(Map userDetail) { public void create(Map userDetail) {
SysUser username = this.getOne(Wrappers.lambdaQuery(SysUser.class) SysUser username = this.getOne(Wrappers.lambdaQuery(SysUser.class)
.eq(SysUser::getUsername, userDetail.get("username"))); .eq(SysUser::getUsername, userDetail.get("username")));
if (ObjectUtil.isEmpty(username)) { if (ObjectUtil.isNotEmpty(username)) {
throw new BadRequestException("用户名已存在"); throw new BadRequestException("用户名已存在");
} }
SysUser sysUser = new SysUser(); SysUser sysUser = new SysUser();
@ -132,6 +146,7 @@ public class ISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> imp
} catch (Exception ex) { } catch (Exception ex) {
throw new RuntimeException(); throw new RuntimeException();
} }
sysUser.setDevices(StrUtil.toString(sysUser.getDevice()));
sysUser.setUpdate_time(new Date()); sysUser.setUpdate_time(new Date());
sysUser.setUpdate_id(SecurityUtils.getCurrentUserId()); sysUser.setUpdate_id(SecurityUtils.getCurrentUserId());
this.updateById(sysUser); this.updateById(sysUser);

8
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java

@ -19,6 +19,14 @@ public interface WmsToAcsService {
*/ */
AcsResponse notifyAcs(JSONObject map); AcsResponse notifyAcs(JSONObject map);
/**
* 区域锁定
* @param map: 任务链表
* @return
*/
AcsResponse notifyAcs1(JSONObject map);
/** /**
* 下发acs任务 * 下发acs任务
* @param schBaseTask * @param schBaseTask

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -624,4 +624,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result; return result;
} }
} }

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java

@ -27,6 +27,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return resultForAcs; return resultForAcs;
} }
@Override
public AcsResponse notifyAcs1(JSONObject map) {
String api = "api/wms/updateRouteLock";
AcsResponse resultForAcs = AcsUtil.notifyAcs2(api, map);
return resultForAcs;
}
@Override @Override

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java

@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@Api(tags = "connector请求lms") @Api(tags = "connector请求lms")
@RequestMapping("/api/") @RequestMapping("/api/wms")
@Slf4j @Slf4j
@SaIgnore @SaIgnore
public class ConnectorToWmsController { public class ConnectorToWmsController {
@ -29,9 +29,20 @@ public class ConnectorToWmsController {
@Log("connector下发agv任务") @Log("connector下发agv任务")
@ApiOperation("connector下发agv任务") @ApiOperation("connector下发agv任务")
@SaIgnore @SaIgnore
@PostMapping("/wms/task") @PostMapping("/task")
public ResponseEntity<Object> createTaskByConnector(@RequestBody JSONArray jsonArray){ public ResponseEntity<Object> createTaskByConnector(@RequestBody JSONArray jsonArray){
return new ResponseEntity(connectorService.createTaskByConnector(jsonArray), HttpStatus.OK); return new ResponseEntity(connectorService.createTaskByConnector(jsonArray), HttpStatus.OK);
} }
@Log("推送物料信息")
@ApiOperation("推送物料信息")
@SaIgnore
@PostMapping("/createMaterial")
public ResponseEntity<Object> createMaterial(@RequestBody JSONArray jsonArray){
return new ResponseEntity(connectorService.createMaterial(jsonArray), HttpStatus.OK);
}
} }

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/ConnectorToWmsService.java

@ -13,4 +13,11 @@ public interface ConnectorToWmsService {
* @return * @return
*/ */
Object createTaskByConnector(JSONArray jsonArray); Object createTaskByConnector(JSONArray jsonArray);
/**
* connector推送物料信息
* @param jsonArray
* @return
*/
Object createMaterial(JSONArray jsonArray);
} }

34
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java

@ -1,18 +1,27 @@
package org.nl.wms.ext.connector.service.impl; package org.nl.wms.ext.connector.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpStatus;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import nl.basjes.shaded.org.springframework.util.Assert;
import org.nl.config.MapOf; import org.nl.config.MapOf;
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.connector.service.ConnectorToWmsService; import org.nl.wms.ext.connector.service.ConnectorToWmsService;
import org.nl.wms.ext.connector.service.dto.ConnectorDto;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint; import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.AbstractTask; import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.GeneralDefinition; 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.TaskFactory;
@ -20,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
@ -29,15 +39,14 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService {
@Autowired @Autowired
private ISchBasePointService schBasePointService; private ISchBasePointService schBasePointService;
@Autowired @Autowired
private ISchBaseTaskService schBaseTaskService; private ISchBaseTaskService schBaseTaskService;
@Autowired @Autowired
private WmsToAcsService wmsToAcsService; private WmsToAcsService wmsToAcsService;
@Autowired @Autowired
private TaskFactory taskFactory; private TaskFactory taskFactory;
@Autowired
private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
@Override @Override
public Map createTaskByConnector(JSONArray jsonArray) { public Map createTaskByConnector(JSONArray jsonArray) {
@ -114,4 +123,23 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService {
} }
return map; return map;
} }
@Override
public Object createMaterial(JSONArray jsonArray) {
log.info("connector下发物料请求参数:{}", jsonArray);
Assert.noNullElements(jsonArray, "请求参数为空!");
List<ConnectorDto> connectorDtos = BeanUtil.copyToList(jsonArray, ConnectorDto.class);
for (ConnectorDto connectorDto : connectorDtos) {
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
schBaseVehiclematerialgroup.setVehicle_code(connectorDto.getVehicle_code());
schBaseVehiclematerialgroup.setJob_name(connectorDto.getJobname());
schBaseVehiclematerialgroup.setMaterial_id(connectorDto.getProductID());
schBaseVehiclematerialgroup.setMaterial_qty(connectorDto.getCurrentqty());
schBaseVehiclematerialgroup.setRegion_code(connectorDto.getNextOperation());
schBaseVehiclematerialgroup.setExtend(JSON.toJSONString(connectorDto));
schBaseVehiclematerialgroup.setOrder_code(connectorDto.getProductionOrder());
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
}
return null;
}
} }

27
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/controller/FabController.java

@ -154,11 +154,12 @@ public class FabController {
List<SendVehicleVo> sendVehicleVoList = sendVehiclesVo.getMater(); List<SendVehicleVo> sendVehicleVoList = sendVehiclesVo.getMater();
if (CollUtil.isEmpty(sendVehicleVoList)) throw new BadRequestException("物料信息为空,请确认!"); if (CollUtil.isEmpty(sendVehicleVoList)) throw new BadRequestException("物料信息为空,请确认!");
AtomicReference<Boolean> flag = new AtomicReference<>(false); AtomicReference<Boolean> flag = new AtomicReference<>(false);
sendVehicleVoList.stream().forEach(sendVehicleVo1 -> { for (SendVehicleVo sendVehicleVo1 : sendVehicleVoList) {
if (sendVehicleVo1.getMaterial_qty() != 0) { if (sendVehicleVo1.getMaterial_qty() != 0) {
flag.set(true); flag.set(true);
break;
} }
}); }
sendVehicleVoList.removeIf(sendVehicleVo1 -> (ObjectUtil.isEmpty(sendVehicleVo1) || sendVehicleVo1.getMaterial_qty() == 0)); sendVehicleVoList.removeIf(sendVehicleVo1 -> (ObjectUtil.isEmpty(sendVehicleVo1) || sendVehicleVo1.getMaterial_qty() == 0));
if (!flag.get()) { if (!flag.get()) {
fabService.createAgvTask(toJSON, "snt"); fabService.createAgvTask(toJSON, "snt");
@ -167,10 +168,12 @@ public class FabController {
toJSON.put("vehicle_code", schBasePoint.getVehicle_code()); toJSON.put("vehicle_code", schBasePoint.getVehicle_code());
List<String> materiales = new ArrayList<>(); List<String> materiales = new ArrayList<>();
sendVehicleVoList.stream().forEach(send -> { sendVehicleVoList.stream().forEach(send -> {
SchBaseVehiclematerialgroup one = iSchBaseVehiclematerialgroupService.getOne(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) List<SchBaseVehiclematerialgroup> list = iSchBaseVehiclematerialgroupService.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getOrder_code, send.getOrder_code())); .eq(SchBaseVehiclematerialgroup::getOrder_code, send.getOrder_code()));
send.setDue_date(one.getDue_date()); if (CollUtil.isNotEmpty(list)) {
materiales.add(JSONObject.toJSONString(send)); send.setDue_date(list.get(0).getDue_date());
materiales.add(JSONObject.toJSONString(send));
}
}); });
toJSON.put("region_code", schBasePoint.getRegion_code()); toJSON.put("region_code", schBasePoint.getRegion_code());
toJSON.put("material_info", materiales); toJSON.put("material_info", materiales);
@ -282,9 +285,17 @@ public class FabController {
@Log("查询订单号") @Log("查询订单号")
@PostMapping("/orders") @PostMapping("/orders")
public ResponseEntity<TableDataInfo> selectOrders(@RequestBody SendVehicleVo sendVehicleVo) { public ResponseEntity<TableDataInfo> selectOrders(@RequestBody SendVehicleVo sendVehicleVo) {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehicleVo.getDevice_code()); if (StrUtil.isEmpty(sendVehicleVo.getDevice_code()) && StrUtil.isEmpty(sendVehicleVo.getVehicle_code())) {
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备不存在!"); throw new BadRequestException("请输入设备号或载具号!");
List<String> list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBasePoint.getVehicle_code()); }
List<String> list = null;
if (StrUtil.isNotEmpty(sendVehicleVo.getVehicle_code())) {
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(sendVehicleVo.getVehicle_code());
} else if (StrUtil.isNotEmpty(sendVehicleVo.getDevice_code())) {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(sendVehicleVo.getDevice_code());
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备不存在!");
list = iSchBaseVehiclematerialgroupService.selectOrdersByVehicleCode(schBasePoint.getVehicle_code());
}
HashSet<String> keys = new HashSet<>(); HashSet<String> keys = new HashSet<>();
list.stream().forEach(item -> { list.stream().forEach(item -> {
keys.add(item); keys.add(item);

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/dto/SendVehicleVo.java

@ -27,6 +27,10 @@ public class SendVehicleVo {
* 交期时间 * 交期时间
*/ */
private String due_date; private String due_date;
/**
* 载具号
*/
private String vehicle_code;
/** /**
* 物料信息 * 物料信息
*/ */

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/fab/service/impl/FabServiceImpl.java

@ -104,7 +104,7 @@ public class FabServiceImpl {
if(ObjectUtil.isEmpty(schBasePoint1)){ if(ObjectUtil.isEmpty(schBasePoint1)){
throw new BadRequestException("点位不存在"); throw new BadRequestException("点位不存在");
} }
if(!schBasePoint1.getPoint_status().equals(GoodsEnum.OUT_OF_STOCK.getValue())){ if(!schBasePoint1.getPoint_status().equals(GoodsEnum.OUT_OF_STOCK.getValue()) || schBasePoint1.getIs_lock()){
throw new BadRequestException("该点位不是空站点,请确认再呼叫"); throw new BadRequestException("该点位不是空站点,请确认再呼叫");
} }
param.put("device_code", callEmpVo.getDevice_code()); param.put("device_code", callEmpVo.getDevice_code());
@ -122,6 +122,7 @@ public class FabServiceImpl {
Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!"); Assert.noNullElements(new Object[]{form.getString("device_code"), form.getString("region_code")}, "参数不能为空!");
SendMaterVo sendMaterVo = form.toJavaObject(SendMaterVo.class); SendMaterVo sendMaterVo = form.toJavaObject(SendMaterVo.class);
MdBaseVehicle vehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", sendMaterVo.getVehicle_code())); MdBaseVehicle vehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", sendMaterVo.getVehicle_code()));
if(ObjectUtil.isEmpty(vehicle)) throw new BadRequestException("载具不存在");
param.put("device_code", sendMaterVo.getDevice_code()); param.put("device_code", sendMaterVo.getDevice_code());
param.put("ext_data", sendMaterVo); param.put("ext_data", sendMaterVo);
param.put("region_code", sendMaterVo.getRegion_code()); param.put("region_code", sendMaterVo.getRegion_code());

13
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/controller/HandheldController.java

@ -1,6 +1,7 @@
package org.nl.wms.ext.handheld.controller; package org.nl.wms.ext.handheld.controller;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -114,7 +115,7 @@ public class HandheldController {
@Log("修改订单工序") @Log("修改订单工序")
@ApiOperation("修改订单工序") @ApiOperation("修改订单工序")
@SaIgnore @SaIgnore
public ResponseEntity<Object> updateRegionCodeByOrder(@RequestBody JSONObject json) { public ResponseEntity<Object> updateRegionCodeByOrder(@RequestBody JSONArray json) {
handheldService.updateRegionCodeByOrder(json); handheldService.updateRegionCodeByOrder(json);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@ -146,4 +147,14 @@ public class HandheldController {
return new ResponseEntity<>(vehicleCode,HttpStatus.OK); return new ResponseEntity<>(vehicleCode,HttpStatus.OK);
} }
@PostMapping("/updateRouteStatus")
@Log("修改路线状态")
@SaIgnore
@ApiOperation("修改路线状态")
public ResponseEntity<Object> updateRouteStatus(@RequestBody JSONObject json) {
handheldService.updateRoute(json);
return new ResponseEntity<>(HttpStatus.OK);
}
} }

19
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/handheldEnum/RouteEnum.java

@ -0,0 +1,19 @@
package org.nl.wms.ext.handheld.handheldEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
/**
* 路线
* @author LENOVO
*/
@Getter
@AllArgsConstructor
public enum RouteEnum {
ROUTE_A("外协区到冲床一路线","AD1");
public String routeName;
public String pointCode;
}

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/HandheldService.java

@ -1,5 +1,6 @@
package org.nl.wms.ext.handheld.service; package org.nl.wms.ext.handheld.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.List; import java.util.List;
@ -72,7 +73,7 @@ public interface HandheldService {
* 修改订单工序 * 修改订单工序
* @param json * @param json
*/ */
void updateRegionCodeByOrder(JSONObject json); void updateRegionCodeByOrder(JSONArray json);
/** /**
* 查询用户的关联设备 * 查询用户的关联设备
@ -94,4 +95,10 @@ public interface HandheldService {
* @return * @return
*/ */
String selectVehicleByPoint(JSONObject json); String selectVehicleByPoint(JSONObject json);
/**
* 修改路线状态
* @param json
*/
void updateRoute(JSONObject json);
} }

59
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/handheld/service/impl/HandheldServiceImpl.java

@ -14,11 +14,16 @@ import org.nl.common.enums.VehicleTypeEnum;
import org.nl.common.enums.region.RegionEnum; import org.nl.common.enums.region.RegionEnum;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.RedisUtils; import org.nl.common.utils.RedisUtils;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.dao.Param;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.system.service.user.ISysUserService; import org.nl.system.service.user.ISysUserService;
import org.nl.system.service.user.dao.SysUser; import org.nl.system.service.user.dao.SysUser;
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService; import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle; import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.connector.service.WmsToConnectorService; import org.nl.wms.ext.connector.service.WmsToConnectorService;
import org.nl.wms.ext.handheld.handheldEnum.RouteEnum;
import org.nl.wms.ext.handheld.service.HandheldService; import org.nl.wms.ext.handheld.service.HandheldService;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
@ -35,6 +40,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
/** /**
* @author LENOVO * @author LENOVO
@ -60,6 +66,8 @@ public class HandheldServiceImpl implements HandheldService {
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired
private WmsToAcsService wmsToAcsService;
@Override @Override
@ -180,6 +188,11 @@ public class HandheldServiceImpl implements HandheldService {
public void cageBlankingTask(JSONObject param) { public void cageBlankingTask(JSONObject param) {
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")}, Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")},
"当前点位或目的地不能为空!"); "当前点位或目的地不能为空!");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(param.getString("device_code"));
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
if (schBasePoint.getIs_lock()) {
throw new BadRequestException("该点位正在执行任务,请稍后再试!");
}
String region_code = param.getString("region_code"); String region_code = param.getString("region_code");
String device_code = param.getString("device_code"); String device_code = param.getString("device_code");
String vehicle_code = param.getString("vehicle_code"); String vehicle_code = param.getString("vehicle_code");
@ -187,7 +200,7 @@ public class HandheldServiceImpl implements HandheldService {
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask"); AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask");
switch (type) { switch (type) {
case "1": case "1":
goShelves(param, region_code, device_code, vehicle_code, connectorTask); goShelves(schBasePoint, param, region_code, device_code, vehicle_code, connectorTask);
break; break;
case "2": case "2":
goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask); goWxOrNx(param, region_code, device_code, vehicle_code, connectorTask);
@ -209,11 +222,9 @@ public class HandheldServiceImpl implements HandheldService {
* @param vehicle_code * @param vehicle_code
* @param connectorTask * @param connectorTask
*/ */
private void goShelves(JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) { private void goShelves(SchBasePoint schBasePoint, JSONObject param, String region_code, String device_code, String vehicle_code, AbstractTask connectorTask) {
Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!"); Assert.noNullElements(param.getJSONArray("material"), "参数不能为空!");
JSONArray materials = param.getJSONArray("material"); JSONArray materials = param.getJSONArray("material");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
if (StrUtil.isBlank(region_code)) { if (StrUtil.isBlank(region_code)) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
@ -451,15 +462,14 @@ public class HandheldServiceImpl implements HandheldService {
@Override @Override
public void updateRegionCodeByOrder(JSONObject json) { public void updateRegionCodeByOrder(JSONArray json) {
Assert.noNullElements((Collection<?>) json, "参数不能为空!"); Assert.noNullElements(json, "参数不能为空!");
JSONArray material_info = json.getJSONArray("material_info"); json.stream().forEach(material -> {
material_info.stream().forEach(material -> { cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material);
JSONObject jsonObject = JSONObject.parseObject(StrUtil.toString(material));
iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getOrder_code, jsonObject.getString("order_code")) .eq(SchBaseVehiclematerialgroup::getOrder_code, jsonObject.getStr("order_code"))
.set(SchBaseVehiclematerialgroup::getDue_date, jsonObject.getString("due_date")) .set(SchBaseVehiclematerialgroup::getDue_date, jsonObject.getStr("due_date"))
.set(SchBaseVehiclematerialgroup::getRegion_code, jsonObject.getString("region_code")) .set(SchBaseVehiclematerialgroup::getRegion_code, jsonObject.getStr("region_code"))
); );
}); });
} }
@ -493,7 +503,13 @@ public class HandheldServiceImpl implements HandheldService {
if (regin_code != null) { if (regin_code != null) {
throw new BadRequestException("当前设备工序已经登陆,无法继续选择"); throw new BadRequestException("当前设备工序已经登陆,无法继续选择");
} else { } else {
redisUtils.set("mobile:" + json.getString("device_code"), json.getString("device_code")); SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
Param isInvokeConnector = sysParamService.findByCode(GeneralDefinition.HANDHELD_LOGIN_TIME);
int loginTime = 3;
if(ObjectUtil.isNotEmpty(isInvokeConnector)){
loginTime = Integer.parseInt(isInvokeConnector.getValue());
}
redisUtils.set("mobile:" + json.getString("device_code"), json.getString("device_code"),loginTime, TimeUnit.HOURS);
} }
} }
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code")); SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(json.getString("device_code"));
@ -517,5 +533,22 @@ public class HandheldServiceImpl implements HandheldService {
return schBasePoint.getVehicle_code(); return schBasePoint.getVehicle_code();
} }
@Override
public void updateRoute(JSONObject json) {
Assert.noNullElements(new String[]{json.getString("type"), json.getString("status")}, "参数不能为空!");
switch(json.getString("type")){
case "1":
JSONObject jsonObject = new JSONObject();
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
Param isConnectConnector = sysParamService.findByCode(GeneralDefinition.ADD_ROUTE_DOOR_1);
jsonObject.put("pointCode",isConnectConnector.getValue());
jsonObject.put("status",json.getString("status"));
wmsToAcsService.notifyAcs1(jsonObject);
break;
default:
break;
}
}
} }

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

@ -59,10 +59,18 @@ public class GeneralDefinition {
/** 是否连接 */ /** 是否连接 */
public static final String IS_CONNECT_ACS = "is_connect_acs"; public static final String IS_CONNECT_ACS = "is_connect_acs";
public static final String IS_CONNECT_CONNECTOR = "is_connect_connector"; public static final String IS_CONNECT_CONNECTOR = "is_connect_connector";
/**
* 外协区到冲床一自动门
*/
public static final String ADD_ROUTE_DOOR_1 = "add_route_door_1";
/** /**
* 是否调用connector小插件 * 是否调用connector小插件
*/ */
public static final String IS_INVOKE_CONNECTOR = "is_invoke_connector"; public static final String IS_INVOKE_CONNECTOR = "is_invoke_connector";
/**
* 手持登录时间
*/
public static final String HANDHELD_LOGIN_TIME = "handheld_login_time";
/** ACS路径 */ /** ACS路径 */
public static final String ACS_URL = "acs_url"; public static final String ACS_URL = "acs_url";
/** /**

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java

@ -55,13 +55,13 @@ public class CNTTask extends AbstractTask {
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息 // 配置信息
// 定义按数字后缀排序的比较器 // 定义按数字后缀排序的比较器
Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> { /*Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> {
Integer suffix1 = getNumericSuffix(s1.getPoint_code1()); Integer suffix1 = getNumericSuffix(s1.getPoint_code1());
Integer suffix2 = getNumericSuffix(s2.getPoint_code1()); Integer suffix2 = getNumericSuffix(s2.getPoint_code1());
return suffix1.compareTo(suffix2); return suffix1.compareTo(suffix2);
}; };
List<SchBaseTask> collect = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList()); List<SchBaseTask> collect = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());*/
for (SchBaseTask task : collect) { for (SchBaseTask task : tasks) {
TaskUtils.setUpdateByAcs(task); TaskUtils.setUpdateByAcs(task);
// 找起点 // 找起点
SchBasePoint schBasePoint = null; SchBasePoint schBasePoint = null;

23
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/FTGTask.java

@ -26,7 +26,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Component(value = "FTGTask") @Component(value = "FTGTask")
@ -52,13 +54,15 @@ public class FTGTask extends AbstractTask {
protected void create() throws BadRequestException { protected void create() throws BadRequestException {
// 获取任务 // 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
for (SchBaseTask task : tasks) { Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> {
TaskUtils.setUpdateByAcs(task); Integer suffix1 = getNumericSuffix(s1.getPoint_code1());
// 找起点 Integer suffix2 = getNumericSuffix(s2.getPoint_code1());
String requestParam = task.getRequest_param(); return suffix1.compareTo(suffix2);
JSONObject jsonObject = JSONObject.parseObject(requestParam); };
List<SchBaseTask> collect = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());
for (SchBaseTask task : collect) {
// 查找空载具点位 // 查找空载具点位
SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(null,task.getVehicle_type()); SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(),task.getVehicle_type());
if (ObjectUtil.isEmpty(schBasePoint)) { if (ObjectUtil.isEmpty(schBasePoint)) {
task.setRemark("未找到所需点位!"); task.setRemark("未找到所需点位!");
taskService.updateById(task); taskService.updateById(task);
@ -74,6 +78,7 @@ public class FTGTask extends AbstractTask {
task.setVehicle_code(schBasePoint.getVehicle_code()); task.setVehicle_code(schBasePoint.getVehicle_code());
task.setRemark(""); task.setRemark("");
task.setTask_status(TaskStatus.CREATED.getCode()); task.setTask_status(TaskStatus.CREATED.getCode());
TaskUtils.setUpdateByAcs(task);
taskService.updateById(task); taskService.updateById(task);
schBasePoint.setIs_lock(true); schBasePoint.setIs_lock(true);
@ -82,6 +87,12 @@ public class FTGTask extends AbstractTask {
pointService.updateById(schBasePoint); pointService.updateById(schBasePoint);
} }
} }
private static Integer getNumericSuffix(String filename) {
// 提取数字后缀
String suffix = filename.replaceAll(".*?(\\d+)$", "$1");
// 将后缀转换为整数,默认值为0
return suffix.isEmpty() ? 0 : Integer.parseInt(suffix);
}
@Override @Override
protected void updateStatus(String task_code, TaskStatus status) { protected void updateStatus(String task_code, TaskStatus status) {

3
lms/nladmin-ui/src/views/system/user/index.vue

@ -107,7 +107,7 @@
inactive-color="#F56C6C" inactive-color="#F56C6C"
/> />
</el-form-item> </el-form-item>
<el-form-item v-if="crud.status.add" style="margin-bottom: 0;" label="设备" prop="device"> <el-form-item style="margin-bottom: 0;" label="设备" prop="device">
<el-select <el-select
v-model="form.device" v-model="form.device"
style="width: 512px" style="width: 512px"
@ -170,6 +170,7 @@
<el-table-column prop="gender" label="性别" :min-width="flexWidth('gender',crud.data,'性别')" /> <el-table-column prop="gender" label="性别" :min-width="flexWidth('gender',crud.data,'性别')" />
<el-table-column prop="phone" label="电话" :min-width="flexWidth('phone',crud.data,'电话')" /> <el-table-column prop="phone" label="电话" :min-width="flexWidth('phone',crud.data,'电话')" />
<el-table-column prop="email" label="邮箱" :min-width="flexWidth('email',crud.data,'邮箱')" /> <el-table-column prop="email" label="邮箱" :min-width="flexWidth('email',crud.data,'邮箱')" />
<el-table-column prop="devices" label="登录设备" :min-width="flexWidth('devices',crud.data,'邮箱')" />
<el-table-column show-overflow-tooltip prop="depts" label="部门" :min-width="flexWidth('depts',crud.data,'邮箱')"> <el-table-column show-overflow-tooltip prop="depts" label="部门" :min-width="flexWidth('depts',crud.data,'邮箱')">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-for="(item, index) in scope.row.depts" :key="index"> <span v-for="(item, index) in scope.row.depts" :key="index">

Loading…
Cancel
Save