|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|