Browse Source

rev:手持新改接口

modbus_client
gengby 9 months ago
parent
commit
46c18e95d4
  1. 41
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/ItemProtocol.java
  2. 47
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionDeviceDriver.java
  3. 5
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionStationDefinition.java
  4. 100
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java
  5. 53
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/PdaService.java
  6. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/BindVehicleDto.java
  7. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/VehicleInStoreDto.java
  8. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml
  9. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/PointVo.java
  10. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/RegionVo.java
  11. 426
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java
  12. 31
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/region/service/RegionEnum.java
  13. 22
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/dtk/mapper/DTKMapper.java
  14. 35
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/dtk/mapper/DTKMapper.xml
  15. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/lmzb/LMZBQKTask.java
  16. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/lmzp/LMZPQKTask.java
  17. 163
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/p2p/FixPointTask.java
  18. 70
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/p2p/P2PTask.java
  19. 19
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/JLHCHKTask.java
  20. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/JLHCQMTask.java
  21. 117
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/ZPKTPRKTask.java
  22. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/ZPQKTask.java
  23. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/ZPRKTask.java
  24. 18
      lms/nladmin-ui/src/views/wms/sch/point/ViewDialog.vue

41
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/ItemProtocol.java

@ -10,11 +10,37 @@ import lombok.Setter;
@Setter
public class ItemProtocol {
/**
* 心跳
*/
public static final String ITEM_HEARTBEAT = "heartbeat";
/**
* 工作模式
*/
public static final String ITEM_MODE = "mode";
/**
* 光电信号
*/
public static final String ITEM_MOVE = "move";
/**
* 动作信号
*/
public static final String ITEM_ACTION = "action";
/**
* 报警信号
*/
public static final String ITEM_ERROR = "error";
/**
* 下发命令
*/
public static final String ITEM_TO_COMMAND = "to_command";
boolean isOnline;
private final PhotoelectricDetectionDeviceDriver driver;
@ -34,7 +60,22 @@ public class ItemProtocol {
}
}
public int getHeartbeat() {
return this.getOpcIntegerValue(ItemProtocol.ITEM_HEARTBEAT);
}
public int getMode() {
return this.getOpcIntegerValue(ItemProtocol.ITEM_MODE);
}
public int getMove() {
return this.getOpcIntegerValue(ItemProtocol.ITEM_MOVE);
}
public int getAction() {
return this.getOpcIntegerValue(ItemProtocol.ITEM_ACTION);
}
public int getError() {
return this.getOpcIntegerValue(ItemProtocol.ITEM_ERROR);
}
public int getToCommand() {
return this.getOpcIntegerValue(ItemProtocol.ITEM_TO_COMMAND);
}
}

47
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionDeviceDriver.java

@ -35,13 +35,43 @@ import java.util.Map;
@RequiredArgsConstructor
public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod, HeartbeatableDeviceDriver {
/**
* 心跳
*/
private int heartbeat = 0;
private int lastHeartbeat = this.heartbeat;
/**
* 工作模式
*/
private int mode = 0;
private int lastMode = this.mode;
// 光电信号
/**
* 光电信号
*/
private int move = 0;
private int lastMove = this.move;
private final static int MODE = 3;
/**
* 动作信号
*/
private int action = 0;
private int lastAction = this.action;
/**
* 报警信号
*/
private int error = 0;
private int lastError = this.error;
/**
* 下发命令
*/
private int toCommand = 0;
private int lastToCommand = this.toCommand;
private static final int MODE = 3;
private String currentDeviceCode = null;
private boolean isOnline = false;
@ -67,14 +97,20 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver
try {
this.currentDeviceCode = this.getDeviceCode();
this.heartbeat = this.itemProtocol.getHeartbeat();
this.mode = this.itemProtocol.getMode();
this.move = this.itemProtocol.getMove();
this.action = this.itemProtocol.getAction();
this.error = this.itemProtocol.getError();
this.toCommand = this.itemProtocol.getToCommand();
if (this.move != this.lastMove) {
if (move == 0) {
requireSuccess = false;
}
}
if (MODE > 0 && !requireSuccess) {
if (mode > 0 && !requireSuccess) {
Object methodName = this.device.getExtraValue().get(String.valueOf(MODE));
if (ObjectUtil.isNotEmpty(methodName)) {
try {
@ -99,7 +135,12 @@ public class PhotoelectricDetectionDeviceDriver extends AbstractOpcDeviceDriver
log.error(e.getMessage(), e);
return;
}
this.lastHeartbeat = this.heartbeat;
this.lastMode = this.mode;
this.lastMove = this.move;
this.lastAction = this.action;
this.lastError = this.error;
this.lastToCommand = this.toCommand;
}
private void executionMethodByMode(String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

5
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/shangdianke/PhotoelectricDetectionStationDefinition.java

@ -52,13 +52,18 @@ public class PhotoelectricDetectionStationDefinition implements OpcDeviceDriverD
@Override
public List<ItemDTO> getReadableItemDTOs() {
ArrayList<ItemDTO> itemDTOs = new ArrayList<>();
itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_HEARTBEAT, "心跳", ""));
itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_MODE, "工作模式", ""));
itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_MOVE, "光电信号", ""));
itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_ACTION, "动作信号", ""));
itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_ERROR, "报警信号", ""));
return itemDTOs;
}
@Override
public List<ItemDTO> getWriteableItemDTOs() {
ArrayList<ItemDTO> itemDTOs = new ArrayList<>();
itemDTOs.add(new ItemDTO(ItemProtocol.ITEM_TO_COMMAND, "下发命令", ""));
return itemDTOs;
}
}

100
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java

@ -48,12 +48,6 @@ public class PdaController {
private IPdmBdWorkorderService workorderService;
@PostMapping("/queryPoints")
@Log("获取点位信息")
public ResponseEntity<Object> queryPoints(@Validated @RequestBody PointsQueryDto requestParam) {
return new ResponseEntity<>(pdaService.queryPoints(requestParam), HttpStatus.OK);
}
@PostMapping("/group/getVehicleType")
@Log("获取载具类型")
public ResponseEntity<Object> getVehicleType() {
@ -66,78 +60,114 @@ public class PdaController {
return new ResponseEntity<>(pdaService.queryMaterial(), HttpStatus.OK);
}
@PostMapping("/group/manual")
@Log("组盘")
public ResponseEntity<PdaResponseVo> manualDiskAssembly(@Validated @RequestBody ManualGroupDto requestParam) {
return new ResponseEntity<>(pdaService.manualCreateByPda(requestParam), HttpStatus.OK);
}
@PostMapping("/queryVehicleGroup")
@Log("获取待配盘信息")
public ResponseEntity<Object> queryVehicleGroup() {
return new ResponseEntity<>(pdaService.queryVehicleGroup(), HttpStatus.OK);
}
@PostMapping("/group/manual")
@Log("开始组盘")
public ResponseEntity<PdaResponseVo> manualDiskAssembly(@Validated @RequestBody ManualGroupDto requestParam) {
return new ResponseEntity<>(pdaService.manualCreateByPda(requestParam), HttpStatus.OK);
}
@PostMapping("/group/link")
@Log("开始配盘")
@Log("配盘-确认")
public ResponseEntity<PdaResponseVo> link(@Validated @RequestBody List<GroupLinkDto> requestParam) {
return new ResponseEntity<>(pdaService.link(requestParam), HttpStatus.OK);
}
@PostMapping("/group/printf")
@Log("打印标签")
@PostMapping("/fullVehicleIn")
@Log("入库")
public ResponseEntity<PdaResponseVo> fullVehicleIn(@Validated @RequestBody CommonPointQueryDto requestParam) {
return new ResponseEntity<>(pdaService.fullVehicleIn(requestParam), HttpStatus.OK);
}
@PostMapping("/printf")
@Log("打印")
public ResponseEntity<PrintTagVo> printf(@Validated @RequestBody CommonVehicleInfoDto requestParam) {
return new ResponseEntity<>(pdaService.printf(requestParam), HttpStatus.OK);
}
@PostMapping("/callEmptyVehicle")
@Log("呼叫空托盘")
@Log("空托盘出库")
public ResponseEntity<PdaResponseVo> callEmptyVehicle(@Validated @RequestBody CommonPointQueryDto requestParam) {
return new ResponseEntity<>(pdaService.callEmptyVehicle(requestParam), HttpStatus.OK);
}
@PostMapping("/fullVehicleIn")
@Log("满托入库")
public ResponseEntity<PdaResponseVo> fullVehicleIn(@Validated @RequestBody CommonPointQueryDto requestParam) {
return new ResponseEntity<>(pdaService.fullVehicleIn(requestParam), HttpStatus.OK);
@PostMapping("/emptyInStore")
@Log("空托盘入库")
public ResponseEntity<PdaResponseVo> emptyInStore(@Validated @RequestBody VehicleInStoreDto requestParam) {
return new ResponseEntity<>(pdaService.emptyInStore(requestParam), HttpStatus.OK);
}
@PostMapping("/queryLinkMaterial")
@Log("根据物料信息查询配盘信息")
public ResponseEntity<Object> queryLinkMaterial(@Validated @RequestBody MaterialQueryDto requestParam) {
return new ResponseEntity<>(pdaService.queryLinkMaterial(requestParam), HttpStatus.OK);
}
@PostMapping("/fullVehicleOut")
@Log("满托出库")
@Log("出库")
public ResponseEntity<PdaResponseVo> fullVehicleOut(@Validated @RequestBody FullVehicleOutDto requestParam) {
return new ResponseEntity<>(pdaService.fullVehicleOut(requestParam), HttpStatus.OK);
}
@PostMapping("/vehicleGoBack")
@Log("余料回库")
public ResponseEntity<PdaResponseVo> fullVehicleOut(@Validated @RequestBody VehicleGoBackDto requestParam) {
return new ResponseEntity<>(pdaService.vehicleGoBack(requestParam), HttpStatus.OK);
@PostMapping("/queryGroupInfoByVehicle")
@Log("根据载具编码查询配盘信息")
public ResponseEntity<Object> queryGroupInfoByVehicle(@Validated @RequestBody CommonVehicleInfoDto requestParam) {
return new ResponseEntity<>(pdaService.queryGroupInfoByVehicle(requestParam), HttpStatus.OK);
}
@PostMapping("/fullVehicleOutConfirm")
@Log("满托出库确认")
@Log("出库确认")
public ResponseEntity<PdaResponseVo> fullVehicleOutConfirm(@Validated @RequestBody FullVehicleOutConfirmDto requestParam) {
return new ResponseEntity<>(pdaService.fullVehicleOutConfirm(requestParam), HttpStatus.OK);
}
@PostMapping("/queryLinkMaterial")
@Log("根据物料信息查询配盘信息")
public ResponseEntity<Object> queryLinkMaterial(@Validated @RequestBody MaterialQueryDto requestParam) {
return new ResponseEntity<>(pdaService.queryLinkMaterial(requestParam), HttpStatus.OK);
@PostMapping("/vehicleGoBack")
@Log("余料回库")
public ResponseEntity<PdaResponseVo> fullVehicleOut(@Validated @RequestBody VehicleGoBackDto requestParam) {
return new ResponseEntity<>(pdaService.vehicleGoBack(requestParam), HttpStatus.OK);
}
@PostMapping("/queryAllPoints")
@Log("查询起点及其对应终点")
public ResponseEntity<Object> queryAllPoints() {
return new ResponseEntity<>(pdaService.queryAllPoints(), HttpStatus.OK);
@PostMapping("/queryEndPointsByStart")
@Log("根据起点查询对应的终点列表")
public ResponseEntity<Object> queryEndPointsByStart(@Validated @RequestBody FullVehicleOutDto requestParam) {
return new ResponseEntity<>(pdaService.queryEndPointsByStart(requestParam), HttpStatus.OK);
}
@PostMapping("/createP2pTask")
@Log("创建点对点流传任务")
@Log("下料")
public ResponseEntity<PdaResponseVo> createP2pTask(@Validated @RequestBody FullVehicleOutDto requestParam) {
return new ResponseEntity<>(pdaService.createP2pTask(requestParam), HttpStatus.OK);
}
@PostMapping("/unbindVehicle")
@Log("解绑")
public ResponseEntity<PdaResponseVo> unbindVehicle(@Validated @RequestBody BindVehicleDto requestParam) {
return new ResponseEntity<PdaResponseVo>(pdaService.unbindVehicle(requestParam), HttpStatus.OK);
}
@PostMapping("/bindVehicle")
@Log("绑定")
public ResponseEntity<PdaResponseVo> bindVehicle(@Validated @RequestBody BindVehicleDto requestParam) {
return new ResponseEntity<PdaResponseVo>(pdaService.bindVehicle(requestParam), HttpStatus.OK);
}
@PostMapping("/queryDevice")
@Log("查询设备")
public ResponseEntity<Object> queryDevice() {
return new ResponseEntity<>(pdaService.queryDevice(), HttpStatus.OK);
}
@PostMapping("/taskConfirm")
@Log("定点作业")
public ResponseEntity<PdaResponseVo> taskConfirm(@Validated @RequestBody FullVehicleOutDto requestParam) {
return new ResponseEntity<PdaResponseVo>(pdaService.taskConfirm(requestParam), HttpStatus.OK);
}
@PostMapping("/deviceCheck/verify")
@Log("设备点检")

53
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/PdaService.java

@ -14,14 +14,6 @@ import java.util.List;
public interface PdaService {
/**
* 获取入库对接位和出库对接位点位信息
*
* @param requestParam
* @return
*/
List<PointVo> queryPoints(PointsQueryDto requestParam);
/**
* 获取载具类型
*
@ -120,11 +112,12 @@ public interface PdaService {
List<VehicleLinkVo> queryLinkMaterial(MaterialQueryDto requestParam);
/**
* 查询所有定点任务的起点及其对应终点
* 根据起点查询对应的终点列表
*
* @param requestParam
* @return
*/
List<PointVo> queryAllPoints();
List<PointVo> queryEndPointsByStart(FullVehicleOutDto requestParam);
/**
* 创建点对点的任务
@ -345,5 +338,45 @@ public interface PdaService {
*/
PdaResponseVo deleteMaterialInfo(RequestMaterialInfoVo requestMaterialInfoVo);
/**
* 空托盘入库
*
* @param requestParam
* @return
*/
PdaResponseVo emptyInStore(VehicleInStoreDto requestParam);
/**
* 根据载具编码查询配盘信息
*
* @param requestParam
* @return
*/
VehicleLinkVo queryGroupInfoByVehicle(CommonVehicleInfoDto requestParam);
/**
* 解绑
*
* @param requestParam
* @return
*/
PdaResponseVo unbindVehicle(BindVehicleDto requestParam);
/**
* 绑定
*
* @param requestParam
* @return
*/
PdaResponseVo bindVehicle(BindVehicleDto requestParam);
/**
* 查询设备
*
* @return
*/
List<RegionVo> queryDevice();
PdaResponseVo taskConfirm(FullVehicleOutDto requestParam);
}

14
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/BindVehicleDto.java

@ -0,0 +1,14 @@
package org.nl.wms.pda.service.dao.dto;
import lombok.Data;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/1/27
*/
@Data
public class BindVehicleDto {
private String point_code;
private String vehicle_code;
}

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/dto/VehicleInStoreDto.java

@ -0,0 +1,15 @@
package org.nl.wms.pda.service.dao.dto;
import lombok.Data;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/2/27
*/
@Data
public class VehicleInStoreDto {
private String vehicle_type;
private String vehicle_code;
private String point_code;
}

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/mapper/PdaMapper.xml

@ -30,12 +30,15 @@
m.material_name,
g.point_code,
g.vehicle_code,
g.vehicle_type,
d.label as vehicle_type,
g.material_qty
from `sch_base_vehiclematerialgroup` g
left join md_base_material m
on g.material_id = m.material_id
where link_status = '0'
left join `sys_dict` d
on d.`value` = g.vehicle_type
where d.`code` = 'vehicle_type'
and link_status = '0'
and group_status = '2'
and group_bind_material_status = '2'
</select>

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/PointVo.java

@ -12,8 +12,7 @@ import java.util.List;
*/
@Data
public class PointVo {
private String point_id;
private String point_code;
private String point_code2;
private String point_name;
private List<PointVo> end_points = new ArrayList<>();
}

18
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/dao/vo/RegionVo.java

@ -0,0 +1,18 @@
package org.nl.wms.pda.service.dao.vo;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/2/28
*/
@Data
public class RegionVo {
private String region_code;
private String region_name;
private List<Object> deviceArr = new ArrayList<>();
}

426
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java

@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.CopyUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.database.material.service.IMdBaseMaterialService;
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
@ -33,6 +32,9 @@ 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.dao.SchBasePoint;
import org.nl.wms.sch.region.service.ISchBaseRegionService;
import org.nl.wms.sch.region.service.RegionEnum;
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.*;
@ -42,9 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -74,19 +74,8 @@ public class PdaServiceImpl implements PdaService {
private WmsToAcsService wmsToAcsService;
@Autowired
private IPdmBdRequestMaterialRecordService requestMaterialRecordService;
@Override
public List<PointVo> queryPoints(PointsQueryDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
String region_code = null;
if (StrUtil.equals(requestParam.getType(), "1")) {
region_code = "ZP";
} else if (StrUtil.equals(requestParam.getType(), "2")) {
region_code = "JLHC";
}
Assert.notBlank(region_code, "传入参数有误!");
return pdaMapper.queryPoints(region_code);
}
@Autowired
private ISchBaseRegionService regionService;
@Override
public List<DropdownListVo> getVehicleType() {
@ -156,6 +145,22 @@ public class PdaServiceImpl implements PdaService {
new LambdaQueryWrapper<>();
lqw.in(SchBaseVehiclematerialgroup::getGroup_id, groups);
List<SchBaseVehiclematerialgroup> list = vehiclematerialgroupService.list(lqw);
Assert.notNull(list, "组盘信息有误,数据库中不存在该组盘信息!");
//校验配盘信息物料是否一致
boolean flag = list.stream()
.map(SchBaseVehiclematerialgroup::getMaterial_id)
.distinct()
.count() == 1;
if (!flag) {
throw new BadRequestException("所选配盘信息有误,物料信息不一致!");
}
//校验配盘信息数量和是否为整数
double qty_sum = list.stream()
.mapToDouble(schBaseVehiclematerialgroup -> Double.parseDouble(schBaseVehiclematerialgroup.getMaterial_qty()))
.sum();
if ((qty_sum % 1 != 0)) {
throw new BadRequestException("所选配盘信息有误,物料数量和不为整数!");
}
String pcsn_code = CodeUtil.getNewCode("PCSN_CODE");
for (SchBaseVehiclematerialgroup vehiclematerialgroup : list) {
vehiclematerialgroup.setLink_status(LinkStatusEnum.LINK_FINISH.getType());
@ -168,6 +173,27 @@ public class PdaServiceImpl implements PdaService {
return PdaResponseVo.pdaResultOk("配盘完成");
}
@Override
public PdaResponseVo fullVehicleIn(CommonPointQueryDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
String point_code = requestParam.getPoint_code();
Assert.notBlank(point_code, "当前点位不能为空!");
SchBasePoint point = pointService.getById(point_code);
if (ObjectUtil.isEmpty(point)) {
throw new BadRequestException("点位:" + point_code + ",对应的点位信息不存在!");
}
if (!PointStatusEnum.FULL_POINT.getCode().equals(point.getPoint_status())) {
throw new BadRequestException("点位:" + point_code + ",状态不是有料状态!");
}
JSONObject param = new JSONObject();
param.put("device_code", point_code);
param.put("config_code", "ZPRKTask");
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("满托入库请求成功");
}
@Override
public PrintTagVo printf(CommonVehicleInfoDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
@ -179,10 +205,11 @@ public class PdaServiceImpl implements PdaService {
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType());
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
Assert.notNull(vehiclematerialgroup, "载具:" + vehicle_code + ",未进行配盘!");
MdBaseMaterial material = materialService.getById(vehiclematerialgroup.getMaterial_id());
PrintTagVo printTagVo = new PrintTagVo();
printTagVo.setVehicle_code(vehiclematerialgroup.getVehicle_code());
printTagVo.setMaterial_code(vehiclematerialgroup.getMaterial_code());
printTagVo.setMaterial_name(vehiclematerialgroup.getMaterial_name());
printTagVo.setMaterial_code(material.getMaterial_code());
printTagVo.setMaterial_name(material.getMaterial_name());
printTagVo.setMaterial_qty(vehiclematerialgroup.getMaterial_qty());
printTagVo.setPcsn(vehiclematerialgroup.getPcsn());
printTagVo.setPrint_time(DateUtil.now());
@ -192,39 +219,103 @@ public class PdaServiceImpl implements PdaService {
@Override
public PdaResponseVo callEmptyVehicle(CommonPointQueryDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
String point_code = requestParam.getPoint_code();
SchBasePoint point = pointService.getById(point_code);
if (ObjectUtil.isEmpty(point)) {
throw new BadRequestException("点位:" + point_code + ",对应的点位信息不存在!");
}
if (!point.getPoint_status().equals(PointStatusEnum.EMPTY_POINT.getCode())) {
throw new BadRequestException("点位:" + point_code + ",点位状态不为空位!");
}
if (!RegionEnum.ZP.getRegion_code().equals(point.getRegion_code())) {
throw new BadRequestException("点位:" + point_code + ",不属于组盘区域,无法进行空托盘出库!");
}
JSONObject param = new JSONObject();
param.put("device_code", requestParam.getPoint_code());
param.put("config_code", "ZPQKTask");
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("呼叫空托请求成功");
return PdaResponseVo.pdaResultOk("空托盘出库请求成功");
}
@Override
public PdaResponseVo fullVehicleIn(CommonPointQueryDto requestParam) {
public PdaResponseVo emptyInStore(VehicleInStoreDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
String point_code = requestParam.getPoint_code();
Assert.notBlank(requestParam.getVehicle_code(), "载具编码不能为空!");
LambdaQueryWrapper<SchBasePoint> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SchBasePoint::getRegion_code, RegionEnum.YCL.getRegion_code());
List<SchBasePoint> points = pointService.list(lambdaQueryWrapper);
List<String> vehicles = points.stream().map(SchBasePoint::getVehicle_code).collect(Collectors.toList());
if (vehicles.contains(requestParam.getVehicle_code())) {
throw new BadRequestException("原材料库中已存在该载具信息:" + requestParam.getVehicle_code() + "!");
}
Assert.notBlank(requestParam.getVehicle_type(), "载具类型不能为空!");
LambdaQueryWrapper<SchBasePoint> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBasePoint::getPoint_code, point_code)
.eq(SchBasePoint::getPoint_status, PointStatusEnum.FULL_POINT.getCode())
.eq(SchBasePoint::getIs_used, true);
lqw.eq(SchBasePoint::getPoint_code, requestParam.getPoint_code())
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode());
SchBasePoint point = pointService.getOne(lqw);
if (ObjectUtil.isEmpty(point)) {
throw new BadRequestException("点位:" + point_code + ",状态不是有料状态!");
throw new BadRequestException("点位:" + requestParam.getPoint_code() + "状态不为空位!");
}
if (!RegionEnum.ZP.getRegion_code().equals(point.getRegion_code())) {
throw new BadRequestException("点位:" + requestParam.getPoint_code() + "不属于组盘区域,无法进行空托盘入库!");
}
JSONObject param = new JSONObject();
param.put("device_code", point_code);
param.put("config_code", "ZPRKTask");
param.put("device_code", requestParam.getPoint_code());
param.put("vehicle_type", requestParam.getVehicle_type());
param.put("vehicle_code", requestParam.getVehicle_code());
param.put("config_code", "ZPKTPRKTask");
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("托入库请求成功");
return PdaResponseVo.pdaResultOk("托入库请求成功");
}
@Override
public List<VehicleLinkVo> queryLinkMaterial(MaterialQueryDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
Assert.notBlank(requestParam.getMaterial_id(), "物料ID不能为空!");
MdBaseMaterial material = materialService.getById(requestParam.getMaterial_id());
Assert.notNull(material, "物料信息有误!未查询出对应的物料信息,物料编码:" + requestParam.getMaterial_code());
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getMaterial_id, requestParam.getMaterial_id())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType())
.orderByDesc(SchBaseVehiclematerialgroup::getPcsn, SchBaseVehiclematerialgroup::getUpdate_time);
List<SchBaseVehiclematerialgroup> list = vehiclematerialgroupService.list(lqw);
List<VehicleLinkVo> vehicleLinkVoList = new ArrayList<>();
for (SchBaseVehiclematerialgroup group : list) {
SchBasePoint point = pointService.getById(group.getPoint_code());
if (!RegionEnum.YCL.getRegion_code().equals(point.getRegion_code())) {
continue;
}
VehicleLinkVo vehicleLinkVo = new VehicleLinkVo();
vehicleLinkVo.setMaterial_id(group.getMaterial_id());
vehicleLinkVo.setGroup_id(group.getGroup_id());
vehicleLinkVo.setVehicle_code(group.getVehicle_code());
vehicleLinkVo.setMaterial_name(material.getMaterial_name());
vehicleLinkVo.setPoint_code(group.getPoint_code());
vehicleLinkVo.setPoint_name(group.getPoint_name());
vehicleLinkVo.setPcsn(group.getPcsn());
vehicleLinkVo.setVehicle_type(group.getVehicle_type());
vehicleLinkVo.setMaterial_code(material.getMaterial_code());
vehicleLinkVo.setMaterial_qty(group.getMaterial_qty());
vehicleLinkVoList.add(vehicleLinkVo);
}
return vehicleLinkVoList;
}
@Override
public PdaResponseVo fullVehicleOut(FullVehicleOutDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
Assert.notBlank(requestParam.getPoint_code1(), "起始点位不能为空!");
Assert.notNull(pointService.getById(requestParam.getPoint_code1()), requestParam.getPoint_code1() + ",对应的点位信息不存在!");
Assert.notBlank(requestParam.getPoint_code2(), "出库点位不能为空!");
Assert.notNull(pointService.getById(requestParam.getPoint_code2()), requestParam.getPoint_code2() + ",对应的点位信息不存在!");
JSONObject param = new JSONObject();
param.put("device_code", requestParam.getPoint_code1());
param.put("device_code2", requestParam.getPoint_code2());
@ -232,56 +323,59 @@ public class PdaServiceImpl implements PdaService {
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("满托出库请求成功");
return PdaResponseVo.pdaResultOk("出库请求成功");
}
@Override
public PdaResponseVo vehicleGoBack(VehicleGoBackDto requestParam) {
public VehicleLinkVo queryGroupInfoByVehicle(CommonVehicleInfoDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
String vehicle_code = requestParam.getVehicle_code();
Assert.notNull(vehicle_code, "载具号不能为空!");
String residue_num = requestParam.getResidue_num();
Assert.notNull(residue_num, "余料数量不能为空!");
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw =
new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
Assert.notBlank(requestParam.getVehicle_code(), "载具编码不能为空!");
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, requestParam.getVehicle_code())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
SchBaseVehiclematerialgroup groupOne = vehiclematerialgroupService.getOne(lqw);
if (ObjectUtil.isNotEmpty(groupOne)) {
this.checkQty(groupOne, residue_num);
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
if (ObjectUtil.isEmpty(vehiclematerialgroup)) {
return new VehicleLinkVo();
}
JSONObject param = new JSONObject();
param.put("device_code", requestParam.getPoint_code());
param.put("config_code", "JLHCHKTask");
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("余料回库请求成功");
VehicleLinkVo vo = new VehicleLinkVo();
vo.setPoint_code(vehiclematerialgroup.getPoint_code());
vo.setMaterial_id(vehiclematerialgroup.getMaterial_id());
vo.setMaterial_code(vehiclematerialgroup.getMaterial_code());
vo.setMaterial_name(vehiclematerialgroup.getMaterial_name());
vo.setPcsn(vehiclematerialgroup.getPcsn());
vo.setMaterial_qty(vehiclematerialgroup.getMaterial_qty());
return vo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public PdaResponseVo fullVehicleOutConfirm(FullVehicleOutConfirmDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
String point_code = requestParam.getPoint_code();
Assert.notBlank(point_code, "点位编码不能为空!");
SchBasePoint point = pointService.getById(point_code);
Assert.notNull(point, point_code + "对应点位信息不存在!");
if (StrUtil.isNotEmpty(point.getIng_task_code())) {
throw new BadRequestException("满托出库确认失败,存在未完成的任务!");
throw new BadRequestException("出库确认失败,存在未完成的任务!");
}
String vehicle_code = requestParam.getVehicle_code();
Assert.notBlank(vehicle_code, "载具号不能为空!");
if (!RegionEnum.JLHC.getRegion_code().equals(point.getRegion_code()) &&
!RegionEnum.YCL.getRegion_code().equals(point.getRegion_code())) {
throw new BadRequestException("出库点位所属区域不是" + RegionEnum.JLHC.getRegion_name() + "," + RegionEnum.YCL.getRegion_name() + ",无法进行出库确认!");
}
Assert.notBlank(requestParam.getVehicle_code(), "载具号不能为空!");
String residue_num = requestParam.getResidue_num();
Assert.notBlank(residue_num, "余料数量不能为空!");
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw =
new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, requestParam.getVehicle_code())
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
SchBaseVehiclematerialgroup groupOne = vehiclematerialgroupService.getOne(lqw);
Assert.notNull(groupOne, "载具号:'" + vehicle_code + "',对应的组盘信息不存在!");
Assert.notNull(groupOne, "载具号:'" + requestParam.getVehicle_code() + "',对应的组盘信息不存在!");
this.checkQty(groupOne, residue_num);
//如果余料数量为0
if (residue_num.matches("^0*(\\.\\d+)?$")) {
@ -312,67 +406,65 @@ public class PdaServiceImpl implements PdaService {
copyGroup.setMaterial_qty(residue_num);
vehiclematerialgroupService.create(copyGroup);
}
return PdaResponseVo.pdaResultOk("满托出库确认请求成功");
return PdaResponseVo.pdaResultOk("出库确认请求成功");
}
@Override
public List<VehicleLinkVo> queryLinkMaterial(MaterialQueryDto requestParam) {
public PdaResponseVo vehicleGoBack(VehicleGoBackDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getMaterial_id, requestParam.getMaterial_id())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
String point_code = requestParam.getPoint_code();
Assert.notBlank(point_code, "出库点位不能为空!");
SchBasePoint point = pointService.getById(requestParam.getPoint_code());
Assert.notNull(point, point_code + "对应的点位信息不存在!");
if (!RegionEnum.JLHC.getRegion_code().equals(point.getRegion_code())) {
throw new BadRequestException("回库请求失败,出库点位所属区域不是" + RegionEnum.JLHC.getRegion_name());
}
String vehicle_code = requestParam.getVehicle_code();
Assert.notNull(vehicle_code, "载具号不能为空!");
String residue_num = requestParam.getResidue_num();
Assert.notNull(residue_num, "余料数量不能为空!");
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw =
new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType())
.orderByDesc(SchBaseVehiclematerialgroup::getPcsn, SchBaseVehiclematerialgroup::getUpdate_time);
List<SchBaseVehiclematerialgroup> list = vehiclematerialgroupService.list(lqw);
List<VehicleLinkVo> vehicleLinkVoList = new ArrayList<>();
for (SchBaseVehiclematerialgroup group : list) {
SchBasePoint point = pointService.getById(group.getPoint_code());
if (!point.getRegion_code().equals("YCL")) {
continue;
}
MdBaseMaterial material = materialService.getById(group.getMaterial_id());
Assert.notNull(material, "物料信息有误!未查询出对应的物料信息,物料id:" + group.getMaterial_id());
VehicleLinkVo vehicleLinkVo = new VehicleLinkVo();
vehicleLinkVo.setMaterial_id(group.getMaterial_id());
vehicleLinkVo.setGroup_id(group.getGroup_id());
vehicleLinkVo.setVehicle_code(group.getVehicle_code());
vehicleLinkVo.setMaterial_name(material.getMaterial_name());
vehicleLinkVo.setPoint_code(group.getPoint_code());
vehicleLinkVo.setPoint_name(group.getPoint_name());
vehicleLinkVo.setPcsn(group.getPcsn());
vehicleLinkVo.setVehicle_type(group.getVehicle_type());
vehicleLinkVo.setMaterial_code(material.getMaterial_code());
vehicleLinkVo.setMaterial_qty(group.getMaterial_qty());
vehicleLinkVoList.add(vehicleLinkVo);
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
SchBaseVehiclematerialgroup groupOne = vehiclematerialgroupService.getOne(lqw);
if (ObjectUtil.isNotEmpty(groupOne)) {
this.checkQty(groupOne, residue_num);
}
return vehicleLinkVoList;
JSONObject param = new JSONObject();
param.put("device_code", requestParam.getPoint_code());
param.put("config_code", "JLHCHKTask");
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("余料回库请求成功");
}
@Override
public List<PointVo> queryAllPoints() {
LambdaQueryWrapper<SchBasePoint> lqw = new LambdaQueryWrapper<>();
//除这些区域外 其它区域都存在定点流转任务
//叫料缓存区、组盘区、空托盘缓存区1、空托盘缓存区2、原材料
lqw.notIn(SchBasePoint::getRegion_code, "JLHC", "ZP", "KTPHC1", "KTPHC2", "YCL")
.and(la -> la.isNotNull(SchBasePoint::getNext_point_code))
.eq(SchBasePoint::getIs_used, true);
List<PointVo> list = this.copyPointVoList(pointService.list(lqw));
for (PointVo pointVo : list) {
List<PointVo> end_points = pointVo.getEnd_points();
SchBasePoint point = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, pointVo.getPoint_code()).eq(SchBasePoint::getIs_used, true));
if (StrUtil.isNotEmpty(point.getNext_point_code())) {
String[] nextPointCodes = point.getNext_point_code().split(",");
for (int i = 0; i < nextPointCodes.length; i++) {
String nextPointCode = nextPointCodes[i];
SchBasePoint one = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, nextPointCode).eq(SchBasePoint::getIs_used, true));
PointVo pv = new PointVo();
pv.setPoint_id(IdUtil.simpleUUID());
pv.setPoint_code(one.getPoint_code());
pv.setPoint_name(one.getPoint_name());
end_points.add(pv);
}
}
public List<PointVo> queryEndPointsByStart(FullVehicleOutDto requestParam) {
Assert.notNull(requestParam, "请求参数不能为空!");
Assert.notBlank(requestParam.getPoint_code1(), "当前点位不能为空!");
SchBasePoint point = pointService.getById(requestParam.getPoint_code1());
Assert.notNull(point, requestParam.getPoint_code1() + "对应的点位信息不存在!");
List<String> regions = Arrays.asList(RegionEnum.ZP.getRegion_code(), RegionEnum.JLHC.getRegion_code(), RegionEnum.YCL.getRegion_code());
if (regions.contains(point.getRegion_code())) {
throw new BadRequestException("当前点位信息有误,请检查该点位是否为任务流传所属区域!");
}
List<PointVo> list = new ArrayList<>();
if (StrUtil.isEmpty(point.getNext_point_code())) {
return list;
}
String[] nextPointCodes = point.getNext_point_code().split(",");
for (int i = 0; i < nextPointCodes.length; i++) {
String nextPointCode = nextPointCodes[i];
SchBasePoint one = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, nextPointCode).eq(SchBasePoint::getIs_used, true));
PointVo pv = new PointVo();
pv.setPoint_code2(one.getPoint_code());
pv.setPoint_name(one.getPoint_name());
list.add(pv);
}
return list;
}
@ -388,19 +480,125 @@ public class PdaServiceImpl implements PdaService {
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("创建点对点任务请求成功");
return PdaResponseVo.pdaResultOk("下料请求成功");
}
@Override
public PdaResponseVo unbindVehicle(BindVehicleDto requestParam) {
Assert.notNull(requestParam, "请求参数不能为空!");
Assert.notBlank(requestParam.getPoint_code(), "当前点位不能为空!");
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getPoint_code, requestParam.getPoint_code())
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
if (ObjectUtil.isNotEmpty(vehiclematerialgroup)) {
vehiclematerialgroup.setPoint_code(null);
vehiclematerialgroup.setPoint_name(null);
vehiclematerialgroupService.update(vehiclematerialgroup);
}
SchBasePoint point = pointService.getById(requestParam.getPoint_code());
Assert.notNull(point, requestParam.getPoint_code() + "对应点位信息不存在!");
point.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
point.setVehicle_code("");
point.setVehicle_type("");
point.setVehicle_qty(0);
pointService.update(point);
return PdaResponseVo.pdaResultOk("解绑成功");
}
@Override
public PdaResponseVo bindVehicle(BindVehicleDto requestParam) {
Assert.notNull(requestParam, "请求参数不能为空!");
Assert.notBlank(requestParam.getPoint_code(), "当前点位不能为空!");
Assert.notBlank(requestParam.getVehicle_code(), "载具编码不能为空!");
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, requestParam.getVehicle_code())
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
SchBasePoint point = pointService.getById(requestParam.getPoint_code());
Assert.notNull(point, requestParam.getPoint_code() + "对应点位信息不存在!");
String point_status = PointStatusEnum.EMPTY_VEHICLE.getCode();
if (ObjectUtil.isNotEmpty(vehiclematerialgroup)) {
point_status = PointStatusEnum.FULL_POINT.getCode();
vehiclematerialgroup.setPoint_code(requestParam.getPoint_code());
vehiclematerialgroup.setPoint_name(point.getPoint_name());
vehiclematerialgroupService.update(vehiclematerialgroup);
}
point.setPoint_status(point_status);
point.setVehicle_code(requestParam.getVehicle_code());
point.setVehicle_qty(1);
pointService.update(point);
return PdaResponseVo.pdaResultOk("绑定成功");
}
@Override
public List<RegionVo> queryDevice() {
List<SchBaseRegion> regions = regionService.list();
List<SchBasePoint> points = pointService.list(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getIs_used, true));
return regions.stream().map(region -> {
RegionVo regionVo = new RegionVo();
regionVo.setRegion_code(region.getRegion_code());
regionVo.setRegion_name(region.getRegion_name());
List<Object> deviceArr = points.stream()
.filter(point -> point.getRegion_code().equals(region.getRegion_code()))
.map(point -> {
Map<String, String> map = new HashMap<>();
map.put("point_code", point.getPoint_code());
map.put("point_name", point.getPoint_name());
return map;
})
.collect(Collectors.toList());
regionVo.setDeviceArr(deviceArr);
return regionVo;
}).collect(Collectors.toList());
}
@Override
public PdaResponseVo taskConfirm(FullVehicleOutDto requestParam) {
Assert.notNull(requestParam, "参数不能为空!");
Assert.notBlank(requestParam.getPoint_code1(), "起点点位不能为空!");
LambdaQueryWrapper<SchBasePoint> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBasePoint::getPoint_code, requestParam.getPoint_code1())
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
.eq(SchBasePoint::getIs_used, true);
SchBasePoint point1 = pointService.getOne(lqw);
if (ObjectUtil.isNotEmpty(point1)) {
throw new BadRequestException(requestParam.getPoint_code1() + "点位状态为空位,无法进行定点任务下发!");
}
Assert.notBlank(requestParam.getPoint_code2(), "终点点位不能为空!");
lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBasePoint::getPoint_code, requestParam.getPoint_code2())
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
.eq(SchBasePoint::getIs_used, true);
SchBasePoint point2 = pointService.getOne(lqw);
if (ObjectUtil.isEmpty(point2)) {
throw new BadRequestException(requestParam.getPoint_code2() + "点位状态不为空位,无法进行定点任务下发!");
}
JSONObject param = new JSONObject();
param.put("device_code", requestParam.getPoint_code1());
param.put("device_code2", requestParam.getPoint_code2());
param.put("config_code", "FixPointTask");
param.put("requestNo", IdUtil.simpleUUID());
param.put("user_id", "1");
taskService.apply(param);
return PdaResponseVo.pdaResultOk("创建定点任务请求成功");
}
@Override
public List<PointVo> copyPointVoList(List<SchBasePoint> list) {
List<PointVo> pointVoList = new ArrayList<>();
for (SchBasePoint point : list) {
PointVo pointVo = new PointVo();
pointVo.setPoint_id(IdUtil.simpleUUID());
pointVo.setPoint_code(point.getPoint_code());
pointVo.setPoint_name(point.getPoint_name());
pointVoList.add(pointVo);
}
// for (SchBasePoint point : list) {
// PointVo pointVo = new PointVo();
// pointVo.setPoint_id(IdUtil.simpleUUID());
// pointVo.setPoint_code(point.getPoint_code());
// pointVo.setPoint_name(point.getPoint_name());
// pointVoList.add(pointVo);
// }
return pointVoList;
}

31
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/region/service/RegionEnum.java

@ -0,0 +1,31 @@
package org.nl.wms.sch.region.service;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @Description TODO
* @Author Gengby
* @Date 2024/2/27
*/
@Getter
@AllArgsConstructor
public enum RegionEnum {
ZP("ZP", "组盘区"),
_2FMCZKJ("2FMCZKJ", "2F面层制壳间"),
_3FLMZS("3FLMZS", "3F蜡模组树区"),
BCXKZB("BCXKZB", "备成型壳制备区"),
JLHC("JLHC", "叫料缓存区"),
KTPHC1("KTPHC1", "空托盘缓存1区"),
KTPHC2("KTPHC2", "空托盘缓存2区"),
LMZB("LMZB", "蜡模制备区"),
LMZP("LMZP", "蜡模组盘区"),
XKBS("XKBS", "型壳焙烧区"),
YCL("YCL", "原材料库"),
ZDZK("ZDZK", "自动制壳区"),
ZQTL("ZQTL", "蒸汽脱蜡区");
private String region_code;
private String region_name;
}

22
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/dtk/mapper/DTKMapper.java

@ -1,22 +0,0 @@
package org.nl.wms.sch.task_manage.task.tasks.dtk.mapper;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import java.util.List;
/**
* @Author: lyd
* @Description: 叠托库mapper
* @Date: 2023/6/21
*/
public interface DTKMapper {
List<SchBasePoint> findPointForDTSK(List<String> regionCode);
/**
* 拆盘机找空盘
*
* @param regionCode
* @return
*/
List<SchBasePoint> findPointForCTQK(List<String> regionCode);
}

35
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/dtk/mapper/DTKMapper.xml

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.sch.task_manage.task.tasks.dtk.mapper.DTKMapper">
<select id="findPointForDTSK" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
SELECT
p.*
FROM
`sch_base_point` p
WHERE p.point_type = '1'
AND (p.ing_task_code = '' OR p.ing_task_code IS NULL)
AND p.point_status = '1'
AND p.region_code IN
<foreach collection="regionCode" item="code" separator="," open="(" close=")">
#{code}
</foreach>
ORDER BY
p.in_empty_seq ASC
</select>
<select id="findPointForCTQK" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
SELECT p.*
FROM `sch_base_point` p
WHERE (
(p.point_type = '1' AND p.region_code = #{regionCode[0]})
)
AND (p.ing_task_code = '' OR p.ing_task_code IS NULL)
AND p.point_status = '2'
AND p.is_used = 1
AND p.region_code IN
<foreach collection="regionCode" item="code" separator="," open="(" close=")">
#{code}
</foreach>
ORDER BY
p.out_empty_seq ASC
</select>
</mapper>

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/lmzb/LMZBQKTask.java

@ -70,7 +70,8 @@ public class LMZBQKTask extends AbstractTask {
task.setPoint_code1(point.getPoint_code());
task.setRemark("");
task.setVehicle_qty(point.getVehicle_qty());
task.setVehicle_type(point.getCan_vehicle_type());
task.setVehicle_type(point.getVehicle_type());
task.setVehicle_code(point.getVehicle_code());
task.setTask_status(TaskStatus.CREATED.getCode());
taskService.save(task);
// 点位更新
@ -147,11 +148,21 @@ public class LMZBQKTask extends AbstractTask {
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点清空
if (ObjectUtil.isNotEmpty(startPointObj)) {
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPoint(startPointObj);
//终点不需要记录点位状态和载具信息
startPointObj.setIng_task_code("");
pointService.update(startPointObj);
}
//终点更新载具信息 点位状态
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setVehicle_type(taskObj.getVehicle_type());
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
endPointObj.setVehicle_code(taskObj.getVehicle_code());
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
pointService.update(endPointObj);
}
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/lmzp/LMZPQKTask.java

@ -70,7 +70,8 @@ public class LMZPQKTask extends AbstractTask {
task.setPoint_code1(point.getPoint_code());
task.setRemark("");
task.setVehicle_qty(point.getVehicle_qty());
task.setVehicle_type(point.getCan_vehicle_type());
task.setVehicle_type(point.getVehicle_type());
task.setVehicle_code(point.getVehicle_code());
task.setTask_status(TaskStatus.CREATED.getCode());
taskService.save(task);
// 点位更新
@ -147,11 +148,21 @@ public class LMZPQKTask extends AbstractTask {
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点清空
if (ObjectUtil.isNotEmpty(startPointObj)) {
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPoint(startPointObj);
//终点不需要记录点位状态和载具信息
startPointObj.setIng_task_code("");
pointService.update(startPointObj);
}
//终点更新载具信息 点位状态
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setVehicle_code(taskObj.getVehicle_code());
endPointObj.setVehicle_type(taskObj.getVehicle_type());
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
pointService.update(endPointObj);
}
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());

163
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/dtk/CTQKTask.java → lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/p2p/FixPointTask.java

@ -1,131 +1,105 @@
package org.nl.wms.sch.task_manage.task.tasks.dtk;
package org.nl.wms.sch.task_manage.task.tasks.p2p;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.system.service.notice.ISysNoticeService;
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.dao.SchBasePoint;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
import org.nl.wms.sch.task_manage.AbstractTask;
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.PointStatusEnum;
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
import org.nl.wms.sch.task_manage.enums.*;
import org.nl.wms.sch.task_manage.task.TaskType;
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
import org.nl.wms.sch.task_manage.task.tasks.dtk.mapper.DTKMapper;
import org.nl.wms.util.PointUtils;
import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author: lyd
* @Description: 拆盘机呼叫空托
* @Date: 2023/6/21
* 定点作业
*
* @author onepiece
*/
@Component(value = "DTKQKTask")
@TaskType("DTKQKTask")
public class CTQKTask extends AbstractTask {
private static final String TASK_CONFIG_CODE = "DTKQKTask";
@Component(value = "FixPointTask")
@TaskType("FixPointTask")
public class FixPointTask extends AbstractTask {
private static final String TASK_CONFIG_CODE = "FixPointTask";
@Autowired
private ISchBasePointService pointService;
@Autowired
private ISchBaseTaskService taskService;
@Autowired
private ISchBaseTaskconfigService taskConfigService;
@Autowired
private ISysNoticeService noticeService;
@Autowired
private DTKMapper dtkMapper;
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
@Override
public void create() throws BadRequestException {
// 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
for (SchBaseTask task : tasks) {
TaskUtils.setUpdateByAcs(task);
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
.collect(Collectors.toList());
// 找起点
SchBasePoint point = findStartPoint(startRegionStr);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("暂无托盘!");
taskService.updateById(task);
// 消息通知
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
continue;
}
// 设置终点并修改创建成功状态
task.setPoint_code1(point.getPoint_code());
task.setRemark("");
task.setVehicle_qty(point.getVehicle_qty());
task.setTask_status(TaskStatus.CREATED.getCode());
taskService.updateById(task);
// 点位信息更新
point.setIng_task_code(task.getTask_code());
pointService.update(point);
PointUtils.setUpdateByAcs(point);
pointService.updateById(point);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void createCompletion(SchBaseTask task) {
// 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
TaskUtils.setUpdateByAcs(task);
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
.collect(Collectors.toList());
// 找起点
SchBasePoint point = findStartPoint(startRegionStr);
if (ObjectUtil.isEmpty(point)) {
String point_code1 = task.getPoint_code1();
SchBasePoint point1 = this.findPoint(point_code1);
if (ObjectUtil.isEmpty(point1)) {
// 消息通知
noticeService.createNotice("拆盘机暂无托盘!", TASK_CONFIG_CODE + task.getPoint_code2(),
noticeService.createNotice("定点任务创建失败," + point1 + "存在任务!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("拆盘机暂无托盘!");
throw new BadRequestException("定点任务创建失败," + point1 + "存在任务!");
}
String point_code2 = task.getPoint_code2();
SchBasePoint point2 = this.findPoint(point_code2);
if (ObjectUtil.isEmpty(point2)) {
// 消息通知
noticeService.createNotice("定点任务创建失败," + point2 + "存在任务!", TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("定点任务创建失败," + point2 + "存在任务!");
}
// 设置终点并修改创建成功状态
task.setPoint_code1(point.getPoint_code());
task.setRemark("");
task.setVehicle_qty(point.getVehicle_qty());
task.setVehicle_type(GeneralDefinition.STEEL_TRAY);
task.setVehicle_code(point1.getVehicle_code());
task.setVehicle_qty(point1.getVehicle_qty());
task.setVehicle_type(point1.getVehicle_type());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
taskService.save(task);
// 点位更新
point.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point);
pointService.updateById(point);
point1.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point1);
pointService.updateById(point1);
point2.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point2);
pointService.updateById(point2);
}
/**
* 从区域中获取一推钢托盘
* 创建定点任务时判断点位是否存在任务
*
* @param startRegionStr
* @param point_code
* @return
*/
private SchBasePoint findStartPoint(List<String> startRegionStr) {
// 钢托盘缓存区域的空盘是1 状态不同
List<SchBasePoint> points = dtkMapper.findPointForCTQK(startRegionStr);
return ObjectUtil.isNotEmpty(points) ? points.get(0) : null;
private SchBasePoint findPoint(String point_code) {
LambdaQueryWrapper<SchBasePoint> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBasePoint::getPoint_code, point_code)
.and(la -> la.isNull(SchBasePoint::getIng_task_code)
.or()
.eq(SchBasePoint::getIng_task_code, ""))
.eq(SchBasePoint::getIs_used, true);
return pointService.getOne(lqw);
}
@Override
protected void updateStatus(String task_code, TaskStatus status) {
// 校验任务
@ -174,16 +148,34 @@ public class CTQKTask extends AbstractTask {
// 获取参数
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点清空
if (ObjectUtil.isNotEmpty(startPointObj)) {
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPoint(startPointObj);
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
endPointObj.setVehicle_type(GeneralDefinition.STEEL_TRAY);
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
if (ObjectUtil.isNotEmpty(startPointObj) && ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setVehicle_qty(startPointObj.getVehicle_qty());
endPointObj.setVehicle_code(startPointObj.getVehicle_code());
endPointObj.setVehicle_type(startPointObj.getVehicle_type());
endPointObj.setPoint_status(startPointObj.getPoint_status());
endPointObj.setIng_task_code("");
endPointObj.setUpdate_time(DateUtil.now());
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, startPointObj.getVehicle_code())
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
if (ObjectUtil.isNotEmpty(vehiclematerialgroup)) {
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
vehiclematerialgroup.setMove_way(vehiclematerialgroup.getMove_way() + " -> " + endPointObj.getPoint_code());
vehiclematerialgroup.setUpdate_id(SecurityUtils.getCurrentUserId());
vehiclematerialgroup.setUpdate_name(SecurityUtils.getCurrentNickName());
vehiclematerialgroup.setUpdate_time(DateUtil.now());
vehiclematerialgroupService.update(vehiclematerialgroup);
}
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPoint(startPointObj);
startPointObj.setIng_task_code("");
pointService.updateById(startPointObj);
}
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
@ -197,12 +189,19 @@ public class CTQKTask extends AbstractTask {
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点解锁
if (ObjectUtil.isNotEmpty(startPointObj)) {
startPointObj.setIng_task_code("");
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
pointService.updateById(startPointObj);
}
//终点解锁
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);
}
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
taskObj.setFinished_type(taskFinishedType.getCode());

70
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/p2p/P2PTask.java

@ -9,7 +9,6 @@ import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.GeneralDefinition;
@ -29,8 +28,7 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* 手持点对点任务
* 流转点位
* 生产下料
* 如果手持指定终点则使用该终点
* 如果手持未指定终点则根据点位表中配置的下一点位信息进行查找
*
@ -56,10 +54,18 @@ public class P2PTask extends AbstractTask {
@Transactional(rollbackFor = Exception.class)
public void createCompletion(SchBaseTask task) {
TaskUtils.setUpdateByAcs(task);
String point_code1 = task.getPoint_code1();
SchBasePoint point1 = pointService.getById(point_code1);
if (ObjectUtil.isEmpty(point1)) {
// 消息通知
noticeService.createNotice("任务创建失败,'" + point_code1 + "'对应的点位信息不存在!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("任务创建失败,'" + point_code1 + "'对应的点位信息不存在!");
}
String point_code2 = task.getPoint_code2();
SchBasePoint endPoint = null;
SchBasePoint point2 = null;
if (StrUtil.isEmpty(point_code2)) {
endPoint = findEndPoint(task.getPoint_code1());
point2 = findEndPoint(task.getPoint_code1());
} else {
LambdaQueryWrapper<SchBasePoint> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBasePoint::getPoint_code, point_code2)
@ -67,26 +73,30 @@ public class P2PTask extends AbstractTask {
.or()
.eq(SchBasePoint::getIng_task_code, ""))
.eq(SchBasePoint::getIs_used, true);
endPoint = pointService.getOne(lqw);
point2 = pointService.getOne(lqw);
}
if (ObjectUtil.isEmpty(endPoint)) {
if (ObjectUtil.isEmpty(point2)) {
// 消息通知
noticeService.createNotice("任务创建失败,该点位存在任务!", TASK_CONFIG_CODE + task.getPoint_code1(),
noticeService.createNotice("任务创建失败,该点位存在任务!", TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("任务创建失败,该点位存在任务!");
}
// 设置终点并修改创建成功状态
task.setPoint_code2(endPoint.getPoint_code());
task.setPoint_code2(point2.getPoint_code());
task.setRemark("");
task.setVehicle_qty(endPoint.getVehicle_qty());
task.setVehicle_type(endPoint.getCan_vehicle_type());
task.setVehicle_qty(point1.getVehicle_qty());
task.setVehicle_type(point1.getCan_vehicle_type());
task.setVehicle_code(point1.getVehicle_code());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
taskService.save(task);
// 点位更新
endPoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(endPoint);
pointService.updateById(endPoint);
point1.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point1);
pointService.updateById(point1);
point2.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point2);
pointService.updateById(point2);
}
/**
@ -166,25 +176,23 @@ public class P2PTask extends AbstractTask {
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点清空
if (ObjectUtil.isNotEmpty(startPointObj)) {
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
PointUtils.clearPoint(startPointObj);
startPointObj.setIng_task_code("");
pointService.updateById(startPointObj);
//终点不需要记录点位状态和载具信息
//如果终点是空托盘缓存1区或者空托盘缓存2区 则更改终点点位的状态
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
if (ObjectUtil.isNotEmpty(endPointObj)) {
if ("KTPHC1".equals(endPointObj.getRegion_code()) || "KTPHC2".equals(endPointObj.getRegion_code())) {
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
//endPointObj.setVehicle_type(GeneralDefinition.VEHICLE_TYPE_1500_1500);
//endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
}
endPointObj.setIng_task_code("");
endPointObj.setUpdate_time(DateUtil.now());
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);
}
}
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
endPointObj.setVehicle_type(taskObj.getVehicle_type());
endPointObj.setVehicle_code(taskObj.getVehicle_code());
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
endPointObj.setUpdate_time(DateUtil.now());
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);
}
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
@ -197,8 +205,14 @@ public class P2PTask extends AbstractTask {
@Transactional(rollbackFor = Exception.class)
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点解锁
if (ObjectUtil.isNotEmpty(startPointObj)) {
startPointObj.setIng_task_code("");
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
pointService.updateById(startPointObj);
}
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
PointUtils.setUpdateByType(endPointObj, taskFinishedType);

19
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/JLHCHKTask.java

@ -76,12 +76,9 @@ public class JLHCHKTask extends AbstractTask {
//判断组盘信息中对应的物料信息是否为0 为0就不记录载具信息
//不为0 就记录载具信息
SchBasePoint startPointObj = pointService.getById(task.getPoint_code1());
boolean flag = this.isZero(startPointObj.getVehicle_code(), startPointObj.getPoint_code());
if (!flag) {
task.setVehicle_qty(startPointObj.getVehicle_qty());
task.setVehicle_type(startPointObj.getVehicle_type());
task.setVehicle_code(startPointObj.getVehicle_code());
}
task.setVehicle_qty(startPointObj.getVehicle_qty());
task.setVehicle_type(startPointObj.getVehicle_type());
task.setVehicle_code(startPointObj.getVehicle_code());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
taskService.save(task);
@ -182,15 +179,15 @@ public class JLHCHKTask extends AbstractTask {
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
endPointObj.setVehicle_type(taskObj.getVehicle_type());
endPointObj.setVehicle_code(taskObj.getVehicle_code());
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
boolean flag = this.isZero(taskObj.getVehicle_code(), taskObj.getPoint_code1());
if (!flag) {
endPointObj.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
endPointObj.setVehicle_type(taskObj.getVehicle_type());
endPointObj.setVehicle_code(taskObj.getVehicle_code());
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code,taskObj.getVehicle_code())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,GroupBindMaterialStatusEnum.BOUND.getValue());
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, taskObj.getVehicle_code())
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue());
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/JLHCQMTask.java

@ -55,7 +55,7 @@ public class JLHCQMTask extends AbstractTask {
SchBasePoint startPointObj = findPoint(task.getPoint_code1());
if (ObjectUtil.isEmpty(startPointObj)) {
// 消息通知
noticeService.createNotice(task.getPoint_code1() + "点位存在任务!", TASK_CONFIG_CODE + task.getPoint_code2(),
noticeService.createNotice(task.getPoint_code1() + "点位存在任务!", TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException(task.getPoint_code1() + "点位存在任务!");
}

117
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/dtk/DTSKTask.java → lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/ZPKTPRKTask.java

@ -1,9 +1,13 @@
package org.nl.wms.sch.task_manage.task.tasks.dtk;
package org.nl.wms.sch.task_manage.task.tasks.ycl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.system.service.notice.ISysNoticeService;
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.dao.SchBasePoint;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
@ -12,12 +16,12 @@ import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
import org.nl.wms.sch.task_manage.task.TaskType;
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
import org.nl.wms.sch.task_manage.task.tasks.dtk.mapper.DTKMapper;
import org.nl.wms.util.PointUtils;
import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -29,14 +33,14 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* @Author: lyd
* @Description: 叠托送空盘任务-> 货架
* @Date: 2023/6/21
* 组盘区空托入库
*
* @author onepiece
*/
@Component(value = "DTKSKTask")
@TaskType("DTKSKTask")
public class DTSKTask extends AbstractTask {
private static final String TASK_CONFIG_CODE = "DTKSKTask";
@Component(value = "ZPKTPRKTask")
@TaskType("ZPKTPRKTask")
public class ZPKTPRKTask extends AbstractTask {
private static final String TASK_CONFIG_CODE = "ZPKTPRKTask";
@Autowired
private ISchBasePointService pointService;
@Autowired
@ -46,40 +50,11 @@ public class DTSKTask extends AbstractTask {
@Autowired
private ISysNoticeService noticeService;
@Autowired
private DTKMapper dtkMapper;
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
@Override
public void create() throws BadRequestException {
// 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
for (SchBaseTask task : tasks) {
TaskUtils.setUpdateByAcs(task);
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
.collect(Collectors.toList());
// 找终点
SchBasePoint point = findNextPoint(nextRegionStr);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.updateById(task);
// 消息通知
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getPoint_code1(),
NoticeTypeEnum.WARN.getCode());
continue;
}
// 设置终点并修改创建成功状态
task.setPoint_code2(point.getPoint_code());
task.setVehicle_type(GeneralDefinition.STEEL_TRAY);
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.updateById(task);
point.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point);
pointService.updateById(point);
}
}
@Override
@ -92,29 +67,45 @@ public class DTSKTask extends AbstractTask {
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
.collect(Collectors.toList());
// 找终点
SchBasePoint point = findNextPoint(nextRegionStr);
SchBasePoint point = findEndPoint(nextRegionStr);
if (ObjectUtil.isEmpty(point)) {
// 消息通知
noticeService.createNotice("货架暂无货位存放空托盘!", TASK_CONFIG_CODE + task.getPoint_code1(),
noticeService.createNotice("原材料库未找到终点空位!", TASK_CONFIG_CODE + task.getPoint_code2(),
NoticeTypeEnum.WARN.getCode());
throw new BadRequestException("货架暂无货位存放空托盘!");
throw new BadRequestException("原材料库未找到终点空位!");
}
// 设置终点并修改创建成功状态
task.setPoint_code2(point.getPoint_code());
task.setVehicle_type(GeneralDefinition.STEEL_TRAY);
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
task.setVehicle_qty(1);
task.setTask_status(TaskStatus.CREATED.getCode());
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
taskService.save(task);
// 点位更新
point.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(point);
pointService.updateById(point);
}
private SchBasePoint findNextPoint(List<String> nextRegionStr) {
List<SchBasePoint> points = dtkMapper.findPointForDTSK(nextRegionStr);
return ObjectUtil.isNotEmpty(points) ? points.get(0) : null;
/**
* 从原材料库找空位
*
* @param nextRegionStr
* @return
*/
private SchBasePoint findEndPoint(List<String> nextRegionStr) {
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
// 默认一直都有载具
lam.in(SchBasePoint::getRegion_code, nextRegionStr)
// 点位状态是空位
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
// 当前执行的任务为空或者NULL,有数据表示锁住
.and(la -> la.isNull(SchBasePoint::getIng_task_code)
.or()
.eq(SchBasePoint::getIng_task_code, ""))
.eq(SchBasePoint::getIs_used, true);
List<SchBasePoint> schBasePoints = pointService.list(lam);
return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null;
}
@Override
@ -162,24 +153,19 @@ public class DTSKTask extends AbstractTask {
@Transactional(rollbackFor = Exception.class)
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
String startPoint = taskObj.getPoint_code1();
String endPoint = taskObj.getPoint_code2();
String vehicleType = ObjectUtil.isNotEmpty(taskObj.getVehicle_type()) ? taskObj.getVehicle_type() : "";
SchBasePoint endPointObj = pointService.getById(endPoint);
SchBasePoint startPointObj = pointService.getById(startPoint);
// 设置载具类型、点位状态、释放点位
if (ObjectUtil.isNotEmpty(endPoint)) {
//更新终点的点位信息
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
endPointObj.setVehicle_type(vehicleType);
// 设置载具数量
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
endPointObj.setVehicle_code(taskObj.getVehicle_code());
endPointObj.setVehicle_type(taskObj.getVehicle_type());
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
endPointObj.setUpdate_time(DateUtil.now());
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);
// 起点清空
PointUtils.clearPoint(startPointObj);
}
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
taskObj.setFinished_type(taskFinishedType.getCode());
@ -190,10 +176,9 @@ public class DTSKTask extends AbstractTask {
@Transactional(rollbackFor = Exception.class)
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
String endPoint = taskObj.getPoint_code2();
SchBasePoint endPointObj = pointService.getById(endPoint);
// 释放点位
if (ObjectUtil.isNotEmpty(endPoint)) {
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点解锁
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/ZPQKTask.java

@ -67,9 +67,9 @@ public class ZPQKTask extends AbstractTask {
// 设置起点并修改创建成功状态
task.setPoint_code1(point.getPoint_code());
task.setRemark("");
//task.setVehicle_code(point.getVehicle_code());
//task.setVehicle_qty(point.getVehicle_qty());
//task.setVehicle_type(point.getCan_vehicle_type());
task.setVehicle_code(point.getVehicle_code());
task.setVehicle_qty(point.getVehicle_qty());
task.setVehicle_type(point.getVehicle_type());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
taskService.save(task);
@ -157,6 +157,9 @@ public class ZPQKTask extends AbstractTask {
//终点更新
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setVehicle_code(taskObj.getVehicle_code());
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
endPointObj.setVehicle_type(taskObj.getVehicle_type());
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj);

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ycl/ZPRKTask.java

@ -198,7 +198,7 @@ public class ZPRKTask extends AbstractTask {
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
// 起点解锁
// 解锁
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
PointUtils.setUpdateByType(endPointObj, taskFinishedType);

18
lms/nladmin-ui/src/views/wms/sch/point/ViewDialog.vue

@ -59,27 +59,27 @@
<el-form-item label="物料规格">
<el-input v-model="groups.material_spec" style="width: 200px;"/>
</el-form-item>
<el-form-item label="泥料编码">
<el-input v-model="groups.raw_material_code" style="width: 200px;"/>
</el-form-item>
<!-- <el-form-item label="泥料编码">-->
<!-- <el-input v-model="groups.raw_material_code" style="width: 200px;"/>-->
<!-- </el-form-item>-->
<el-form-item label="物料批次">
<el-input v-model="groups.pcsn" style="width: 200px;"/>
</el-form-item>
<el-form-item label="物料数量">
<el-input v-model="groups.material_qty" style="width: 200px;"/>
</el-form-item>
<el-form-item label="物料重量">
<el-input v-model="groups.material_weight" style="width: 200px;"/>
</el-form-item>
<!-- <el-form-item label="物料重量">-->
<!-- <el-input v-model="groups.material_weight" style="width: 200px;"/>-->
<!-- </el-form-item>-->
<el-form-item label="设备">
<el-input v-model="groups.point_name" style="width: 200px;"/>
</el-form-item>
<el-form-item label="入库时间">
<el-input v-model="groups.instorage_time" style="width: 200px;"/>
</el-form-item>
<el-form-item label="静置时间(分)">
<el-input v-model="groups.standing_time" style="width: 200px;"/>
</el-form-item>
<!-- <el-form-item label="静置时间(分)">-->
<!-- <el-input v-model="groups.standing_time" style="width: 200px;"/>-->
<!-- </el-form-item>-->
<el-form-item label="绑定状态">
<el-input v-model="groups.group_bind_material_status_name" style="width: 200px;"/>
</el-form-item>

Loading…
Cancel
Save