Browse Source

add: 添加取放货逻辑

master
yanps 4 months ago
parent
commit
f51ffedaa2
  1. 4
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 60
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  3. 2
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java
  4. 13
      acs/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml
  5. 7
      acs/nladmin-ui/src/views/acs/device/driver/standard_ordinary_site.vue
  6. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/GoodsEnum.java
  7. 13
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/controller/AcsToWmsController.java
  8. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java
  9. 135
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  10. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/dto/ConnectorDto.java
  11. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java
  12. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java
  13. 8
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java
  14. 30
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  15. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  16. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/cnt/CNTTask.java
  17. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/cnt/FTGTask.java
  18. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/PointUtils.java

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

@ -236,9 +236,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//上报异常信息 //上报异常信息
//(不需要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(Integer.toString(agvaddr)); device = deviceAppService.findDeviceByCode("agv"+ Integer.toString(agvaddr));
} else { } else {
device = deviceAppService.findDeviceByCode(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) {

60
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -154,7 +154,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return; return;
} }
device_code = deviceService.queryDeviceCodeByAddress(agvaddr); device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (agvaddr != 0) { /*if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, "-")) { if (StrUtil.contains(old_device_code, "-")) {
String[] point = old_device_code.split("-"); String[] point = old_device_code.split("-");
@ -166,6 +166,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else { } else {
device_code = old_device_code; device_code = old_device_code;
} }
}*/
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device_code = old_device_code;
} }
device = deviceAppService.findDeviceByCode(device_code); device = deviceAppService.findDeviceByCode(device_code);
@ -188,13 +193,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if ("1".equals(plc_to_agv)) { if ("1".equals(plc_to_agv)) {
plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1"); plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1");
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) { if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) {
data = feedBackStatus(data, index, 1, inst, task); data = feedBackStatus(data, index, 1, inst, task,2,false);
plcToAgvDeviceDriver.writing("AGVInOP", "1"); plcToAgvDeviceDriver.writing("AGVInOP", "1");
} }
} else if ("2".equals(plc_to_agv)) { } else if ("2".equals(plc_to_agv)) {
plcToAgvDeviceDriver.writing("AGVSetOutReqLower", "1"); plcToAgvDeviceDriver.writing("AGVSetOutReqLower", "1");
if (plcToAgvDeviceDriver.getAGVSetOutLowerAllowed() == 1) { if (plcToAgvDeviceDriver.getAGVSetOutLowerAllowed() == 1) {
data = feedBackStatus(data, index, 1, inst, task); data = feedBackStatus(data, index, 1, inst, task,2,false);
plcToAgvDeviceDriver.writing("AGVInOP", "1"); plcToAgvDeviceDriver.writing("AGVInOP", "1");
} }
} }
@ -206,7 +211,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try { try {
data = feedBackStatus(data, index, 1, inst, task); data = feedBackStatus(data, index, 1, inst, task,1,false);
} catch (Exception e) { } catch (Exception e) {
log.info("到达取货点反馈AGV状态失败:{}", e.getMessage()); log.info("到达取货点反馈AGV状态失败:{}", e.getMessage());
} }
@ -229,16 +234,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (agvaddr != 0) { if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, "-")) { device_code = old_device_code;
String[] point = old_device_code.split("-");
device_code = point[0];
} else if (StrUtil.contains(old_device_code, ".")) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
} }
device = deviceAppService.findDeviceByCode(device_code); device = deviceAppService.findDeviceByCode(device_code);
@ -260,10 +256,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) { } catch (Exception e) {
log.info("下发AGVInOP信号:{}失败", "0"); log.info("下发AGVInOP信号:{}失败", "0");
} }
data = feedBackStatus(data, index, 2, inst, task); data = feedBackStatus(data, index, 2, inst, task,2,false);
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try { try {
data = feedBackStatus(data, index, 2, inst, task); data = feedBackStatus(data, index, 2, inst, task,1,false);
} catch (Exception e) { } catch (Exception e) {
log.info("取货完成反馈AGV状态失败:{}", e.getMessage()); log.info("取货完成反馈AGV状态失败:{}", e.getMessage());
} }
@ -284,18 +280,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
return; return;
} }
if (agvaddr != 0) { /*if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, "-")) { if (StrUtil.contains(old_device_code, "-")) {
String[] point = old_device_code.split("-"); String[] point = old_device_code.split("-");
emptyNum = point[1];
device_code = point[0]; device_code = point[0];
} else if (StrUtil.contains(old_device_code, ".")) { } else if (StrUtil.contains(old_device_code, ".")) {
String[] point = old_device_code.split("\\."); String[] point = old_device_code.split("\\.");
device_code = point[0]; device_code = point[0];
emptyNum = point[1];
} else { } else {
device_code = old_device_code; device_code = old_device_code;
} }
}*/
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device_code = old_device_code;
} }
device = deviceAppService.findDeviceByCode(device_code); device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) { if (ObjectUtil.isEmpty(device_code)) {
@ -315,13 +315,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if ("1".equals(plc_to_agv)) { if ("1".equals(plc_to_agv)) {
plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1"); plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1");
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) { if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) {
data = feedBackStatus(data, index, 3, inst, task); data = feedBackStatus(data, index, 3, inst, task,2,false);
plcToAgvDeviceDriver.writing("AGVInOP", "1"); plcToAgvDeviceDriver.writing("AGVInOP", "1");
} }
} else if ("2".equals(plc_to_agv)) { } else if ("2".equals(plc_to_agv)) {
plcToAgvDeviceDriver.writing("AGVSetInReqLower", "1"); plcToAgvDeviceDriver.writing("AGVSetInReqLower", "1");
if (plcToAgvDeviceDriver.getAGVSetInLowerAllowed() == 1) { if (plcToAgvDeviceDriver.getAGVSetInLowerAllowed() == 1) {
data = feedBackStatus(data, index, 3, inst, task); data = feedBackStatus(data, index, 3, inst, task,2,false);
plcToAgvDeviceDriver.writing("AGVInOP", "1"); plcToAgvDeviceDriver.writing("AGVInOP", "1");
} }
} }
@ -333,7 +333,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try { try {
data = feedBackStatus(data, index, 3, inst, task); data = feedBackStatus(data, index, 2, inst, task,1,false);
} catch (Exception e) { } catch (Exception e) {
log.info("到达放货点反馈AGV状态失败:{}", e.getMessage()); log.info("到达放货点反馈AGV状态失败:{}", e.getMessage());
} }
@ -351,7 +351,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
return; return;
} }
if (agvaddr != 0) { /*if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, "-")) { if (StrUtil.contains(old_device_code, "-")) {
String[] point = old_device_code.split("-"); String[] point = old_device_code.split("-");
@ -363,6 +363,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else { } else {
device_code = old_device_code; device_code = old_device_code;
} }
}*/
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device_code = old_device_code;
} }
device = deviceAppService.findDeviceByCode(device_code); device = deviceAppService.findDeviceByCode(device_code);
@ -387,10 +392,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) { } catch (Exception e) {
log.info("下发AGVInOP信号:{}失败", "0"); log.info("下发AGVInOP信号:{}失败", "0");
} }
data = feedBackStatus(data, index, 4, inst, task); data = feedBackStatus(data, index, 4, inst, task,2,false);
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try { try {
data = feedBackStatus(data, index, 4, inst, task); StandardOrdinarySiteDeviceDriver standar = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
boolean is_empty = (boolean)standar.getDevice().getExtraValue().get("is_empty");
data = feedBackStatus(data, index, 2, inst, task,1,false);
} catch (Exception e) { } catch (Exception e) {
log.info("放货完成反馈AGV状态失败:{},", e.getMessage()); log.info("放货完成反馈AGV状态失败:{},", e.getMessage());
} }
@ -458,16 +465,19 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return data; return data;
} }
private byte[] feedBackStatus(byte[] data, int index, int agvStatus, Instruction inst, TaskDto task) { private byte[] feedBackStatus(byte[] data, int index, int agvStatus, Instruction inst, TaskDto task,int connector_and_sorting,boolean is_empty) {
String hasWms = paramService.findByCode("hasWms").getValue(); String hasWms = paramService.findByCode("hasWms").getValue();
if (StrUtil.isNotEmpty(hasWms) && "1".equals(hasWms)) { if (StrUtil.isNotEmpty(hasWms) && "1".equals(hasWms)) {
log.info("存在LMS系统,需要反馈,指令号:{}",inst.getInstruction_code()); log.info("存在LMS系统,需要反馈,指令号:{}",inst.getInstruction_code());
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("is_connector", connector_and_sorting == 1? 1:2);
jo.put("task_type",task.getTask_type());
jo.put("vehicle_code", inst.getVehicle_code()); jo.put("vehicle_code", inst.getVehicle_code());
jo.put("status", agvStatus); jo.put("status", agvStatus);
jo.put("device_code", this.device_code); jo.put("device_code", this.device_code);
jo.put("task_code", inst.getTask_code()); jo.put("task_code", inst.getTask_code());
jo.put("is_empty", is_empty);
ja.add(jo); ja.add(jo);
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(ja); HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(ja);
log.info("指令号:{},phase:{},acs反馈wms结果:{}", inst.getInstruction_code(), phase, httpResponse); log.info("指令号:{},phase:{},acs反馈wms结果:{}", inst.getInstruction_code(), phase, httpResponse);

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

@ -150,6 +150,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("task_id", task_id); jo.put("task_id", task_id);
jo.put("vehicle_code", vehicle_code);
jo.put("device_code",address);
String result2 = null; String result2 = null;
AddressDto addressDto = addressService.findByCode("requestTaskAgain"); AddressDto addressDto = addressService.findByCode("requestTaskAgain");

13
acs/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml

@ -18,13 +18,12 @@ https://juejin.cn/post/6844903775631572999
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="${logPath}"/> <property name="LOG_HOME" value="${logPath}"/>
<!--引入默认的一些设置--> <!--引入默认的一些设置-->
<!-- <include resource="log/AutoCreateInst.xml"/>--> <include resource="log/AutoCreateInst.xml"/>
<!-- <include resource="log/AcsToWms.xml"/>--> <include resource="log/AcsToWms.xml"/>
<!-- <include resource="log/WmsToAcs.xml"/>--> <include resource="log/WmsToAcs.xml"/>
<!-- <include resource="log/NDCSocketConnectionAutoRun.xml"/>--> <include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
<!-- <include resource="log/AgvNdcOneDeviceDriver.xml"/>--> <include resource="log/AgvNdcOneDeviceDriver.xml"/>
<!-- <include resource="log/NDCAgvServiceImpl.xml"/>--> <include resource="log/NDCAgvServiceImpl.xml"/>
<!-- <include resource="log/LnshRGVDeviceDriver.xml"/>-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- 控制台高亮--> <!-- 控制台高亮-->

7
acs/nladmin-ui/src/views/acs/device/driver/standard_ordinary_site.vue

@ -74,8 +74,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="是否开启等待" label-width="150px"> <el-form-item label="空放货完成反馈" label-width="150px">
<el-switch v-model="form.wait" /> <el-switch v-model="form.is_empty" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -179,7 +179,8 @@ export default {
station_manager: true, station_manager: true,
auto_clean_task: true, auto_clean_task: true,
input_material: true, input_material: true,
reqWms: true reqWms: true,
is_empty: true
}, },
rules: {} rules: {}
} }

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/enums/GoodsEnum.java

@ -13,10 +13,10 @@ public enum GoodsEnum {
OUT_OF_STOCK("无货","0"), OUT_OF_STOCK("无货","0"),
IN_STOCK("有货","1"),
EMPTY_PALLETS("空料容","1"), EMPTY_PALLETS("空料容","1"),
IN_STOCK("有货","2"),
PICK_UP("取货","1"), PICK_UP("取货","1"),
DELIVER_GOODS("送货","2"); DELIVER_GOODS("送货","2");

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

@ -91,11 +91,20 @@ public class AcsToWmsController {
@PostMapping("/feedAgvTaskStatus") @PostMapping("/feedAgvTaskStatus")
@Log("acs通知wms") @Log("agv取放货反馈")
@ApiOperation("acs通知wms") @ApiOperation("agv取放货反馈")
@SaIgnore @SaIgnore
@Deprecated @Deprecated
public ResponseEntity<Object> feedAgvTaskStatus(@RequestBody JSONObject param) { public ResponseEntity<Object> feedAgvTaskStatus(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.feedAgvTaskStatus(param), HttpStatus.OK); return new ResponseEntity<>(acsToWmsService.feedAgvTaskStatus(param), HttpStatus.OK);
} }
@PostMapping("/feedAgvAgain")
@Log("acs申请二次放货点")
@ApiOperation("acs申请二次放货点")
@SaIgnore
@Deprecated
public ResponseEntity<Object> feedAgvAgain(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.feedAgvAgain(param), HttpStatus.OK);
}
} }

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

@ -35,4 +35,11 @@ public interface AcsToWmsService {
* @return * @return
*/ */
Object feedAgvTaskStatus(JSONObject param); Object feedAgvTaskStatus(JSONObject param);
/**
* 申请二次分配点位
* @param param
* @return
*/
Object feedAgvAgain(JSONObject param);
} }

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

@ -1,6 +1,7 @@
package org.nl.wms.ext.acs.service.impl; package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
@ -8,12 +9,15 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpStatus;
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 lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.GoodsEnum; import org.nl.common.enums.GoodsEnum;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService; import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.cockpit.service.dao.DasDeviceFault; import org.nl.wms.cockpit.service.dao.DasDeviceFault;
import org.nl.wms.cockpit.service.mapper.CockpitMapper; import org.nl.wms.cockpit.service.mapper.CockpitMapper;
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.AcsToWmsService;
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
import org.nl.wms.ext.acs.service.dto.to.acs.AgainApplyResponse; import org.nl.wms.ext.acs.service.dto.to.acs.AgainApplyResponse;
@ -23,6 +27,7 @@ import org.nl.wms.ext.connector.service.WmsToConnectorService;
import org.nl.wms.ext.connector.service.dto.ConnectorDto; import org.nl.wms.ext.connector.service.dto.ConnectorDto;
import org.nl.wms.ext.record.service.ISysInteractRecordService; import org.nl.wms.ext.record.service.ISysInteractRecordService;
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.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;
@ -34,6 +39,7 @@ import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.nl.wms.sch.task_manage.task.TaskFactory; import org.nl.wms.sch.task_manage.task.TaskFactory;
import org.nl.wms.sch.task_manage.task.core.TaskStatus; import org.nl.wms.sch.task_manage.task.core.TaskStatus;
import org.nl.wms.sch.task_manage.task.core.TaskType;
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -67,7 +73,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired @Autowired
private ISchBasePointService pointService; private ISchBasePointService pointService;
@Autowired @Autowired
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService;
@Autowired @Autowired
private TaskFactory taskFactory; private TaskFactory taskFactory;
@Autowired @Autowired
@ -82,6 +88,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private WmsToConnectorService connectorService; private WmsToConnectorService connectorService;
@Autowired @Autowired
private ISchBaseTaskconfigService taskConfigService; private ISchBaseTaskconfigService taskConfigService;
@Autowired
private IMdBaseVehicleService iMdBaseVehicleService;
/** /**
* 初始化反射方法 * 初始化反射方法
@ -269,7 +277,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (ObjectUtil.isNotEmpty(param)) { if (ObjectUtil.isNotEmpty(param)) {
String status = param.getString("status"); String status = param.getString("status");
String task_code = param.getString("task_code"); String task_code = param.getString("task_code");
// 1.connector;2.sorting
String is_connector = param.getString("is_connector"); String is_connector = param.getString("is_connector");
String task_type = param.getString("task_type");
boolean is_empty = param.getBoolean("is_empty");
if (StrUtil.isEmpty(status) || StrUtil.isEmpty(task_code)) { if (StrUtil.isEmpty(status) || StrUtil.isEmpty(task_code)) {
throw new BadRequestException("状态或任务号为空!"); throw new BadRequestException("状态或任务号为空!");
} }
@ -280,15 +291,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
switch (status) { switch (status) {
case "1": case "1":
//申请取货 //申请取货
requestPickup(schBaseTask, status); requestPickup(schBaseTask, status, is_connector);
break; break;
case "2": case "2":
//取货完成 //取货完成
pickupComplete(schBaseTask, status, is_connector); pickupComplete(schBaseTask, status, is_connector, task_type);
break; break;
case "4": case "4":
//放货完成 //放货完成
releaseComplete(schBaseTask, status); releaseComplete(schBaseTask, status, is_connector, task_type, is_empty);
break; break;
default: default:
break; break;
@ -297,15 +308,56 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return null; return null;
} }
@Override
public Object feedAgvAgain(JSONObject param) {
if(ObjectUtil.isNotEmpty(param)){
String task_id = param.getString("task_id");
String device_code = param.getString("device_code");
if(StrUtil.isEmpty(task_id) || StrUtil.isEmpty(device_code)){
throw new BadRequestException("task_id或device_code为空!");
}
SchBaseTask schBaseTask = taskService.getById(task_id);
if(ObjectUtil.isEmpty(schBaseTask)){
throw new BadRequestException("任务不存在!task_id:" + task_id);
}
if(device_code.equals(schBaseTask.getPoint_code2())) throw new BadRequestException("设备号与任务设备不匹配!");
//查询点位是否存在
SchBasePoint schBasePoint = pointService.selectByPointCode(device_code);
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("点位不存在!device_code:" + device_code);
SchBasePoint schBasePoint1 = pointService.selectByNextWaitPoint(device_code);
//
}
return null;
}
/** /**
* 放货完成 * 放货完成
* *
* @param schBaseTask * @param schBaseTask
* @param status * @param status
*/ */
private void releaseComplete(SchBaseTask schBaseTask, String status) { private void releaseComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType, boolean is_empty) {
//TODO:放货完成反馈给Connector //TODO:空料容放货完成反馈给Connector
if ("1".equals(is_connector)) {
if (!is_empty) {
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code2());
} else {
JSONObject json = new JSONObject();
json.put("vehicle_code", schBaseTask.getVehicle_code());
json.put("status", status);
json.put("device_code", schBaseTask.getPoint_code2());
json.put("task_code", schBaseTask.getTask_code());
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code1());
}
}
}
private void finishTask(String task_code, String point_code) {
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code)
.set(SchBasePoint::getIs_lock, false));
taskService.update(Wrappers.lambdaUpdate(SchBaseTask.class).eq(SchBaseTask::getTask_code, task_code)
.set(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()));
} }
/** /**
@ -314,20 +366,31 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
* @param schBaseTask * @param schBaseTask
* @param status * @param status
*/ */
private void pickupComplete(SchBaseTask schBaseTask, String status, String is_connector) { private void pickupComplete(SchBaseTask schBaseTask, String status, String is_connector, String taskType) {
//TODO:取货完成创建第二条任务:补空托盘 //TODO:取货完成创建第二条任务:补空托盘
if("1".equals(is_connector)){ if ("1".equals(is_connector)) {
List<SchBaseTask> list = taskService.list(Wrappers.lambdaQuery(SchBaseTask.class).eq(SchBaseTask::getPoint_code2, schBaseTask.getPoint_code1())
.in(SchBaseTask::getTask_status, TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(), TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode()));
if (CollUtil.isNotEmpty(list) || list.size() > 0) {
throw new BadRequestException("该点位已有任务,请等待任务完成");
}
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(schBaseTask.getVehicle_code());
AbstractTask connectorTask = taskFactory.getTask("FTGTask"); AbstractTask connectorTask = taskFactory.getTask("FTGTask");
// 准备参数:设备编码 // 准备参数:设备编码
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", schBaseTask.getPoint_code2()); param.put("device_code", schBaseTask.getPoint_code1());
param.put("config_code", "FTGTask"); param.put("config_code", "FTGTask");
param.put("create_mode", GeneralDefinition.AUTO_CREATION); param.put("create_mode", GeneralDefinition.AUTO_CREATION);
/*param.put("vehicle_code", vehicle_code); param.put("vehicle_type", StrUtil.isNotEmpty(mdBaseVehicle.getVehicle_type()) ? mdBaseVehicle.getVehicle_type() : "");
param.put("task_type", task_type);
param.put("task_code", task_code);
param.put("remark",remark);*/
connectorTask.apply(param); connectorTask.apply(param);
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1()).set(SchBasePoint::getIs_lock, true));
JSONObject json = new JSONObject();
json.put("vehicle_code", schBaseTask.getVehicle_code());
json.put("status", status);
json.put("device_code", schBaseTask.getPoint_code1());
json.put("task_code", schBaseTask.getTask_code());
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
} }
} }
@ -336,27 +399,39 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
* *
* @param schBaseTask * @param schBaseTask
*/ */
private void requestPickup(SchBaseTask schBaseTask, String status) { private void requestPickup(SchBaseTask schBaseTask, String status, String is_connector) {
//反馈connector申请取货 if ("1".equals(is_connector)) {
SchBaseTaskconfig schBaseTaskconfig = taskConfigService.selectByConfigCode(schBaseTask.getConfig_code()); //反馈connector申请取货
JSONObject json = new JSONObject(); /*SchBaseTaskconfig schBaseTaskconfig = taskConfigService.selectByConfigCode(schBaseTask.getConfig_code());*/
if (GoodsEnum.PICK_UP.getValue().equals(schBaseTaskconfig.getTask_qf_type())) { JSONObject json = new JSONObject();
json.put("vehicle_code", schBaseTask.getVehicle_code()); // if (GoodsEnum.PICK_UP.getValue().equals(schBaseTaskconfig.getTask_qf_type())) {
json.put("status", status); // json.put("vehicle_code", schBaseTask.getVehicle_code());
json.put("device_code", schBaseTask.getPoint_code2()); // json.put("status", status);
json.put("task_code", schBaseTask.getTask_code()); // json.put("device_code", schBaseTask.getPoint_code2());
} else if (GoodsEnum.DELIVER_GOODS.getValue().equals(schBaseTaskconfig.getTask_qf_type())) { // json.put("task_code", schBaseTask.getTask_code());
// } else if (GoodsEnum.DELIVER_GOODS.getValue().equals(schBaseTaskconfig.getTask_qf_type())) {
json.put("vehicle_code", schBaseTask.getVehicle_code()); json.put("vehicle_code", schBaseTask.getVehicle_code());
json.put("status", status); json.put("status", status);
json.put("device_code", schBaseTask.getPoint_code1()); json.put("device_code", schBaseTask.getPoint_code1());
json.put("task_code", schBaseTask.getTask_code()); json.put("task_code", schBaseTask.getTask_code());
} boolean flag = true;
boolean flag = true; while (flag) {
while (flag) { AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); if (acsResponse.getStatus() == 200 && StrUtil.isNotEmpty(acsResponse.getData())) {
if (acsResponse.getStatus() == 200 && StrUtil.isNotEmpty(acsResponse.getData())) { JSONArray objects = JSONObject.parseArray(acsResponse.getData());
vehiclematerialgroupService.updateByVehicleCode(schBaseTask.getVehicle_code(), acsResponse.getData()); List<ConnectorDto> connectorDtos = BeanUtil.copyToList(objects, ConnectorDto.class);
flag = false; 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.getProductionOrder());
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
}
// vehiclematerialgroupService.updateByVehicleCode(schBaseTask.getVehicle_code(), acsResponse.getData());
flag = false;
}
} }
} }
} }

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/dto/ConnectorDto.java

@ -31,7 +31,7 @@ public class ConnectorDto {
/** /**
* 装载数量 * 装载数量
*/ */
private String Currentqty; private Integer Currentqty;
/** /**
* X尺寸 * X尺寸
*/ */

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

@ -59,17 +59,22 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService {
if (StrUtil.isEmpty(task_code) || StrUtil.isEmpty(start_device_code) || StrUtil.isEmpty(vehicle_code)) { if (StrUtil.isEmpty(task_code) || StrUtil.isEmpty(start_device_code) || StrUtil.isEmpty(vehicle_code)) {
map1.put("task_code", task_code); map1.put("task_code", task_code);
map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR); map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR);
map1.put("message",StrUtil.isEmpty(task_code) ? "任务号不能为空!" map1.put("message", StrUtil.isEmpty(task_code) ? "任务号不能为空!"
: StrUtil.isEmpty(start_device_code) ? "起点参数不能为空!" : StrUtil.isEmpty(vehicle_code) ? "载具号不能为空!" : "未知"); : StrUtil.isEmpty(start_device_code) ? "起点参数不能为空!" : StrUtil.isEmpty(vehicle_code) ? "载具号不能为空!" : "未知");
objects.add(map1); objects.add(map1);
continue; continue;
} }
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(start_device_code); SchBasePoint schBasePoint = schBasePointService.selectByPointCode(start_device_code);
if(ObjectUtil.isEmpty(schBasePoint) || StrUtil.isNotEmpty(schBasePoint.getIng_task_code())){ if (ObjectUtil.isEmpty(schBasePoint)) {
map1.put("task_code", task_code); map1.put("task_code", task_code);
map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR); map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR);
map1.put("message",ObjectUtil.isEmpty(schBasePoint) map1.put("message", start_device_code + "起点设备不存在!");
? start_device_code + "起点设备不存在!" : start_device_code + "该设备正在执行任务!"); objects.add(map1);
continue;
} else if (schBasePoint.getIs_lock()) {
map1.put("task_code", task_code);
map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR);
map1.put("message", start_device_code + "该设备正在执行任务!");
objects.add(map1); objects.add(map1);
continue; continue;
} }
@ -88,9 +93,10 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService {
param.put("vehicle_code", vehicle_code); param.put("vehicle_code", vehicle_code);
param.put("task_type", task_type); param.put("task_type", task_type);
param.put("task_code", task_code); param.put("task_code", task_code);
param.put("remark",remark); param.put("remark", remark);
param.put("ext_data", data);
connectorTask.apply(param); connectorTask.apply(param);
/*schBasePoint.setIng_task_code(task_code); /*schBasePoint.setIs_lock(true);
schBasePointService.updateById(schBasePoint);*/ schBasePointService.updateById(schBasePoint);*/
map1.put("task_code", task_code); map1.put("task_code", task_code);
map1.put("status", HttpStatus.HTTP_OK); map1.put("status", HttpStatus.HTTP_OK);

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java

@ -65,6 +65,9 @@ public class SchBaseVehiclematerialgroup implements Serializable {
@ApiModelProperty(value = "物料数量") @ApiModelProperty(value = "物料数量")
private Integer material_qty; private Integer material_qty;
@ApiModelProperty(value = "connector任务号")
private String job_name;
@ApiModelProperty(value = "物料重量") @ApiModelProperty(value = "物料重量")
private BigDecimal material_weight; private BigDecimal material_weight;

8
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/ISchBasePointService.java

@ -101,4 +101,12 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
* @return * @return
*/ */
SchBasePoint selectByReassign(String region_code ,String vehicleCode); SchBasePoint selectByReassign(String region_code ,String vehicleCode);
/**
* 根据终点等待设备查询
* @param device_code
* @return
*/
SchBasePoint selectByNextWaitPoint(String device_code);
} }

30
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java

@ -237,8 +237,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
//查询满足条件的站点 //查询满足条件的站点
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code) isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true)); .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true));
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){ if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
SchBasePoint schBasePoint = schBasePoints.get(0); SchBasePoint schBasePoint = schBasePoints.get(0);
schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setVehicle_code(vehicleCode);
@ -254,8 +254,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
} }
//分配载具类型相同的站点 //分配载具类型相同的站点
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()) isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
.eq(SchBasePoint::getIs_used, true)); .eq(SchBasePoint::getIs_used, true).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){ if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){
SchBasePoint schBasePoint = schBasePoints.get(0); SchBasePoint schBasePoint = schBasePoints.get(0);
schBasePoint.setVehicle_code(vehicleCode); schBasePoint.setVehicle_code(vehicleCode);
@ -274,7 +274,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override @Override
public SchBasePoint selectByPointCode(String start_device_code) { public SchBasePoint selectByPointCode(String start_device_code) {
return getById(start_device_code); return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getPoint_code, start_device_code)
.eq(SchBasePoint::getIs_used, true));
} }
@Override @Override
@ -284,8 +285,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!"); if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
//查询满足条件的站点 //查询满足条件的站点
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code) isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getRegion_code, region_code).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true)); .eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type()).eq(SchBasePoint::getIs_used, true));
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){ if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point()); SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point());
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!"); if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
@ -302,8 +303,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
} }
//分配载具类型相同的站点 //分配载具类型相同的站点
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false). List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getVehicle_type, mdBaseVehicle.getVehicle_type()) isNull(SchBasePoint::getVehicle_code).eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
.eq(SchBasePoint::getIs_used, true)); .eq(SchBasePoint::getIs_used, true).eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){ if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){
SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point()); SchBasePoint schBasePoint = pointMapper.selectById(schBasePoints.get(0).getNext_wait_point());
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!"); if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
@ -321,6 +322,17 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
return null; return null;
} }
@Override
public SchBasePoint selectByNextWaitPoint(String device_code) {
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getNext_wait_point, device_code).eq(SchBasePoint::getIs_used, true)
.eq(SchBasePoint::getIs_lock, false).isNull(SchBasePoint::getVehicle_code)
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
return schBasePoints.get(0);
}
return null;
}
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public SchBasePoint selectEmpVehicleByRegionCode(String region_code, String...vehicleType) { public SchBasePoint selectEmpVehicleByRegionCode(String region_code, String...vehicleType) {

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

@ -266,13 +266,14 @@ public abstract class AbstractTask {
? param.getString("create_mode") : GeneralDefinition.ACS_CREATION); ? param.getString("create_mode") : GeneralDefinition.ACS_CREATION);
task.setVehicle_code(param.getString("vehicle_code")); task.setVehicle_code(param.getString("vehicle_code"));
task.setVehicle_qty(param.getInteger("vehicle_qty")); task.setVehicle_qty(param.getInteger("vehicle_qty"));
task.setVehicle_type(param.getString("vehicle_type"));
task.setTask_status(TaskStatus.APPLY.getCode()); task.setTask_status(TaskStatus.APPLY.getCode());
task.setTask_type(StrUtil.isNotEmpty(param.getString("task_type")) ? param.getString("task_type") : taskConfig.getTask_type()); task.setTask_type(StrUtil.isNotEmpty(param.getString("task_type")) ? param.getString("task_type") : taskConfig.getTask_type());
task.setWorkshop_code(taskConfig.getWorkshop_code()); task.setWorkshop_code(taskConfig.getWorkshop_code());
task.setRemark(param.getString("remark")); task.setRemark(param.getString("remark"));
// 设置起/终点 // 设置起/终点
this.setTaskPoint(taskConfig, task, apply_point_code); this.setTaskPoint(taskConfig, task, apply_point_code);
task.setRequest_param(JSONObject.toJSONString(param)); task.setRequest_param(JSONObject.toJSONString(param.get("ext_data")));
// 设置创建人信息 // 设置创建人信息
TaskUtils.setCreateByAcsOrPda(task, param); TaskUtils.setCreateByAcsOrPda(task, param);
AbstractTask bean = SpringContextHolder.getBean(this.getClass()); AbstractTask bean = SpringContextHolder.getBean(this.getClass());

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

@ -3,7 +3,9 @@ package org.nl.wms.sch.task_manage.task.tasks.cnt;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.GoodsEnum;
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.system.service.notice.ISysNoticeService; import org.nl.system.service.notice.ISysNoticeService;
@ -87,7 +89,7 @@ public class CNTTask extends AbstractTask {
task.setTask_status(TaskStatus.CREATED.getCode()); task.setTask_status(TaskStatus.CREATED.getCode());
taskService.updateById(task); taskService.updateById(task);
schBasePoint.setIng_task_code(task.getTask_code()); schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
PointUtils.setUpdateByAcs(schBasePoint); PointUtils.setUpdateByAcs(schBasePoint);
pointService.updateById(schBasePoint); pointService.updateById(schBasePoint);
} }
@ -153,13 +155,15 @@ public class CNTTask extends AbstractTask {
// 起点清空 // 起点清空
if (ObjectUtil.isNotEmpty(schBasePoint)) { if (ObjectUtil.isNotEmpty(schBasePoint)) {
PointUtils.updateByIngTaskCode(schBasePoint); PointUtils.updateByIngTaskCode(schBasePoint);
pointService.updateById(schBasePoint); pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code, null));
} }
String point_code2 = taskObj.getPoint_code2(); String point_code2 = taskObj.getPoint_code2();
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
if (ObjectUtil.isNotEmpty(schBasePoint2)) { if (ObjectUtil.isNotEmpty(schBasePoint2)) {
PointUtils.updateByIngTaskCode(schBasePoint2); PointUtils.updateByIngTaskCode(schBasePoint2);
pointService.updateById(schBasePoint2); pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code, null));
} }
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setTask_status(TaskStatus.CANCELED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); taskObj.setRemark(GeneralDefinition.TASK_CANCEL);

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

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.GoodsEnum;
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.system.service.notice.ISysNoticeService; import org.nl.system.service.notice.ISysNoticeService;
@ -56,10 +57,8 @@ public class FTGTask extends AbstractTask {
// 找起点 // 找起点
String requestParam = task.getRequest_param(); String requestParam = task.getRequest_param();
JSONObject jsonObject = JSONObject.parseObject(requestParam); JSONObject jsonObject = JSONObject.parseObject(requestParam);
// 根据对接位查找对应的载具类型 // 查找空载具点位
SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_code()); SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_type());
if(ObjectUtil.isEmpty(schBasePoint)) continue;
jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type());
if (ObjectUtil.isEmpty(schBasePoint)) { if (ObjectUtil.isEmpty(schBasePoint)) {
task.setRemark("未找到所需点位!"); task.setRemark("未找到所需点位!");
taskService.updateById(task); taskService.updateById(task);
@ -81,7 +80,8 @@ public class FTGTask extends AbstractTask {
task.setTask_status(TaskStatus.CREATED.getCode()); task.setTask_status(TaskStatus.CREATED.getCode());
taskService.updateById(task); taskService.updateById(task);
schBasePoint.setIng_task_code(task.getTask_code()); schBasePoint.setIs_lock(true);
schBasePoint.setPoint_status(GoodsEnum.OUT_OF_STOCK.getValue());
PointUtils.setUpdateByAcs(schBasePoint); PointUtils.setUpdateByAcs(schBasePoint);
pointService.updateById(schBasePoint); pointService.updateById(schBasePoint);
} }

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/PointUtils.java

@ -117,7 +117,8 @@ public class PointUtils {
* @param schBasePoint * @param schBasePoint
*/ */
public static void updateByIngTaskCode(SchBasePoint schBasePoint) { public static void updateByIngTaskCode(SchBasePoint schBasePoint) {
schBasePoint.setIng_task_code(null); schBasePoint.setVehicle_code(null);
schBasePoint.setIs_lock(false);
} }

Loading…
Cancel
Save