opt:株洲中钨优化
This commit is contained in:
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdCsSupplierbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
@@ -156,23 +157,23 @@ public class PdaIosInController {
|
||||
public ResponseEntity<Object> zwConfirmIn(@RequestBody ZwConfirmInDto dto) {
|
||||
|
||||
if(CollectionUtils.isEmpty(dto.getParam_list())){
|
||||
throw new IllegalArgumentException("请传入参数!");
|
||||
throw new BadRequestException("请传入参数!");
|
||||
}
|
||||
|
||||
for(ZwConfirmInParamDto paramDto : dto.getParam_list()){
|
||||
if(StringUtils.isBlank(paramDto.getVehicle_code()) || StringUtils.isBlank(paramDto.getSite_code())
|
||||
|| StringUtils.isBlank(paramDto.getForm_data_code()))
|
||||
throw new IllegalArgumentException("载具、卸货区点位、单据不能为空!");
|
||||
throw new BadRequestException("载具、卸货区点位、单据不能为空!");
|
||||
}
|
||||
// 校验是否存在重复的载具
|
||||
List<String> vehicleCodeList = dto.getParam_list().stream().map(ZwConfirmInParamDto::getVehicle_code).collect(Collectors.toList());
|
||||
if(vehicleCodeList.size() != vehicleCodeList.stream().distinct().count()){
|
||||
throw new IllegalArgumentException("存在重复的载具!");
|
||||
throw new BadRequestException("存在重复的载具!");
|
||||
}
|
||||
// 校验是否存在重复的卸货区点位
|
||||
List<String> siteCodeList = dto.getParam_list().stream().map(ZwConfirmInParamDto::getSite_code).collect(Collectors.toList());
|
||||
if(siteCodeList.size() != siteCodeList.stream().distinct().count()){
|
||||
throw new IllegalArgumentException("存在重复的卸货区点位!");
|
||||
throw new BadRequestException("存在重复的卸货区点位!");
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(pdaIosInService.zwConfirmIn(dto), HttpStatus.OK);
|
||||
|
||||
@@ -774,7 +774,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
|
||||
Map<String, List<ZwConfirmInParamDto>> paramMap = dtoList.getParam_list().stream()
|
||||
.collect(Collectors.groupingBy(ZwConfirmInParamDto::getForm_data_code));
|
||||
|
||||
Integer i = 0;
|
||||
for (Map.Entry<String, List<ZwConfirmInParamDto>> entry : paramMap.entrySet()) {
|
||||
//校验是否重复
|
||||
if (entry.getValue().stream()
|
||||
@@ -804,9 +804,6 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
}
|
||||
|
||||
//循环判断每个 如果有问题,则抛出异常
|
||||
String lastSchBasePoint = null;
|
||||
Integer taskGroupSeq = 0 ;
|
||||
String taskGroupId = IdUtil.getStringId();
|
||||
List<JSONObject> jsonObjectList = new ArrayList<>();
|
||||
for (ZwConfirmInParamDto paramDto : entry.getValue()) {
|
||||
|
||||
@@ -828,9 +825,8 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
throw new BadRequestException("存在正在执行任务的点位"+paramDto.getSite_code());
|
||||
}
|
||||
|
||||
taskGroupSeq++;
|
||||
//当前点位
|
||||
String schBasePointString = lastSchBasePoint;
|
||||
String schBasePointString ;
|
||||
JSONObject whereJson = new JSONObject();
|
||||
whereJson.put("vehicle_code", paramDto.getVehicle_code());
|
||||
whereJson.put("search", paramDto.getVehicle_code());
|
||||
@@ -839,7 +835,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
whereJson.put("site_code", paramDto.getSite_code());
|
||||
whereJson.put("noEmptyVehicle", "1");
|
||||
String material_model = getVehicleMaterial(whereJson).getString("material_model");
|
||||
if (StringUtils.isEmpty(material_model)) {
|
||||
if (StringUtils.isBlank(material_model)) {
|
||||
throw new BadRequestException("组盘的物料未配置【物料型号】!");
|
||||
}
|
||||
|
||||
@@ -875,8 +871,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
throw new BadRequestException("载具" + paramDto.getVehicle_code() + "不在" + paramDto.getSite_code() + "上");
|
||||
}
|
||||
|
||||
//如果是第一个,则不知道搬出来的托盘应该放哪里,因此需要计算得出,其他的则是【上一个点位】
|
||||
if (StringUtils.isBlank(lastSchBasePoint)) {
|
||||
//每次都需要计算得出
|
||||
LambdaQueryWrapper<SchBasePoint> queryWrapper = new LambdaQueryWrapper<>(SchBasePoint.class)
|
||||
.select(SchBasePoint::getPoint_code)
|
||||
.eq(SchBasePoint::getRegion_code, "YLXCQ")
|
||||
@@ -892,11 +887,10 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
}
|
||||
|
||||
//剔除任务执行中的点位
|
||||
|
||||
final List<String> emptyPointStringList = schBasePointList.stream().map(SchBasePoint::getPoint_code)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//找到空点位正在执行的任务(正常来说不应该存在)
|
||||
//找到空点位正在执行的任务
|
||||
List<SchBaseTask> taskingSchBaseTaskList = iSchBaseTaskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||
.and(wp -> wp
|
||||
@@ -912,7 +906,10 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
|
||||
//如果不存在,则正常执行
|
||||
if(CollectionUtils.isEmpty(taskingSchBaseTaskList)){
|
||||
schBasePointString = schBasePointList.get(0).getPoint_code();
|
||||
if (CollectionUtils.isEmpty(emptyPointStringList) || emptyPointStringList.size() < dtoList.getParam_list().size()) {
|
||||
throw new BadRequestException("空点位太少,请多设置空点位");
|
||||
}
|
||||
schBasePointString = emptyPointStringList.get(i++);
|
||||
} else {
|
||||
List<String> pointList1 = taskingSchBaseTaskList.stream().map(SchBaseTask::getPoint_code1)
|
||||
.collect(Collectors.toList());
|
||||
@@ -930,9 +927,13 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
&& !pointList4.contains(a))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
schBasePointString = pointStringList.get(0);
|
||||
if (CollectionUtils.isEmpty(pointStringList) || pointStringList.size() < dtoList.getParam_list().size()) {
|
||||
throw new BadRequestException("空点位太少,请多设置空点位");
|
||||
}
|
||||
|
||||
schBasePointString = pointStringList.get(i++);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//point1为库存空托盘点
|
||||
//point2为卸货区空托盘应该放置的点
|
||||
@@ -945,14 +946,10 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
whereJson.put("sch_base_point", schBasePointString);
|
||||
whereJson.put("bill_type",StatusEnum.IOBILL_TYPE_IN.code("来料入库"));
|
||||
whereJson.put("priority","1");
|
||||
whereJson.put("task_group_seq",taskGroupSeq);
|
||||
whereJson.put("task_group_id",taskGroupId);
|
||||
|
||||
whereJson.put("form_data_code", entry.getValue().get(0).getForm_data_code());
|
||||
|
||||
jsonObjectList.add(whereJson);
|
||||
//下一个的托盘放置点为本次的起点
|
||||
lastSchBasePoint = whereJson.getString("site_code");
|
||||
}
|
||||
|
||||
//校验没有问题,则进行入库世纪操作
|
||||
@@ -978,7 +975,6 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@@ -1392,7 +1388,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
whereJson.put("site_code", site_code);
|
||||
whereJson.put("noEmptyVehicle", "1");
|
||||
String material_model = getVehicleMaterial(whereJson).getString("material_model");
|
||||
if (StringUtils.isEmpty(material_model)) {
|
||||
if (StringUtils.isBlank(material_model)) {
|
||||
throw new BadRequestException("组盘的物料未配置【物料型号】!");
|
||||
}
|
||||
|
||||
@@ -1449,15 +1445,14 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
}
|
||||
|
||||
JSONObject outJson = new JSONObject();
|
||||
|
||||
outJson.put("point_code",schBasePointList.get(0).getPoint_code());
|
||||
//查询托盘的
|
||||
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("vehicle_code"));
|
||||
if(mdPbStoragevehicleinfo != null ){
|
||||
|
||||
outJson.put("recommended_sect_code",mdPbStoragevehicleinfo.getRecommended_sect_code());
|
||||
}
|
||||
|
||||
outJson.put("point_code",schBasePointList.get(0).getPoint_code());
|
||||
outJson.put("recommended_sect_code",mdPbStoragevehicleinfo.getRecommended_sect_code());
|
||||
|
||||
return PdaResponse.requestParamOk(outJson);
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,9 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
@Autowired
|
||||
private PdaPointTask pdaPointTask;
|
||||
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
|
||||
/**
|
||||
* 入库服务服务
|
||||
@@ -381,6 +384,21 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
.set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_code, null)
|
||||
.set("1".equals(whereJson.getString("point_status")), SchBasePoint::getVehicle_qty, 0)
|
||||
.eq(SchBasePoint::getPoint_code, whereJson.getString("point_code")));
|
||||
|
||||
//查询点位上的载具
|
||||
List<SchBasePoint> schBasePointList = iSchBasePointService.list(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, whereJson.getString("point_code"))
|
||||
);
|
||||
if (CollectionUtils.isNotEmpty(schBasePointList)) {
|
||||
//删除
|
||||
Set<String> groupSet = iMdPbGroupplateService.list(new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, schBasePointList.get(0).getVehicle_code()))
|
||||
.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
|
||||
if (CollectionUtils.isNotEmpty(groupSet)) {
|
||||
iMdPbGroupplateService.delete(groupSet);
|
||||
}
|
||||
}
|
||||
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ public class InBillTask extends AbstractTask {
|
||||
//更新组盘表 status 20->10
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code()));
|
||||
.eq(GroupPlate::getStoragevehicle_code,taskObj.getVehicle_code2()));
|
||||
}
|
||||
|
||||
//分配表清除任务
|
||||
|
||||
@@ -1001,7 +1001,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(mdPbStoragevehicleinfoList)){
|
||||
mdPbStoragevehicleinfoList.get(0).setRecommended_sect_code(ioStorInvDis.getSect_code());
|
||||
mdPbStoragevehicleinfoList.get(0).setRecommended_sect_code(ioStorInvDis.getSect_id());
|
||||
mdPbStoragevehicleinfoList.get(0).setUpdate_time(DateUtil.now());
|
||||
mdPbStoragevehicleinfoMapper.updateById(mdPbStoragevehicleinfoList.get(0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user