货位一键出库代码测试调整

main
judy 1 year ago
parent 154bbbab61
commit 2a3a304077
  1. 2
      shkj-wms/src/main/java/com/shkj/wms/domain/BusinDataTaskGoods.java
  2. 32
      shkj-wms/src/main/java/com/shkj/wms/service/impl/BusinDataTaskServiceImpl.java

@ -69,4 +69,6 @@ public class BusinDataTaskGoods implements Serializable {
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
private String createBy;
}

@ -514,6 +514,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
* 4.
*/
try {
BaseLocationVo baseLocationVo = iBaseLocationService.queryLocationByCode(locationCode);
if (baseLocationVo == null){
return Result.err().msg("未查询到货位信息,请确认!"+locationCode);
@ -535,10 +536,7 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
return Result.err().msg("此货位未查询到保险杠信息,请确认!"+locationCode);
}
}
//预占库存
baseLocationVo.setLocationStatus("4");
BaseLocation baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class);
iBaseLocationService.updateById(baseLocation);
//需要搬运到的码头信息
String toPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_out_point);
@ -547,21 +545,28 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
List<BasePoint> pointList = iBasePointService.list(new LambdaQueryWrapper<BasePoint>()
.in(BasePoint::getPointNo, toPoints)
.eq(BasePoint::getIsOccupy,"0")
.eq(BasePoint::getIsActive,"1")
);
String taskPath="";
if (pointList !=null && pointList.size()>0){
taskPath=pointList.get(0).getPointNo();
}
if (StringUtils.isEmpty(taskPath)){
if (pointList !=null && pointList.size()==0){
return Result.err().msg("搬运码头无空闲,不可出库");
}
BasePoint basePoint = pointList.get(0);
taskPath= basePoint.getPointNo();
//预占码头信息
basePoint.setIsOccupy("1");
iBasePointService.updateBasePoint(basePoint);
//预占库存
baseLocationVo.setLocationStatus("4");
BaseLocation baseLocation = BeanUtil.toBean(baseLocationVo, BaseLocation.class);
iBaseLocationService.updateById(baseLocation);
//生成作业任务
int index=0;
List<BusinDataTaskGoods> taskGoodsList = new ArrayList<>();
List<SysStockDetail> sysStockDetails = new ArrayList<>();
for (SysStockDetailVo sysStockDetailVo : sysStockDetailVoList) {
Long taskId=0L;
for (SysStockDetailVo sysStockDetailVo : sysStockDetailVoList) {
if(index ==0) {
BusinDataTask task = new BusinDataTask();
task.setTaskType(TaskTypeEnum.named_loc.getValue());
@ -578,7 +583,8 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
task.setFromLayer(baseLocationVo.getLayer());
task.setFromColumn(baseLocationVo.getLocationColumn());
task.setTunnel(baseLocationVo.getTunnel());
businDataTaskMapper.insertBusinDataTask(task);
task.setLocationId(baseLocationVo.getId());
this.save(task);
taskId = task.getId();
index++;
}
@ -586,9 +592,11 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
//保险杠信息
BusinDataTaskGoods taskGoods = new BusinDataTaskGoods();
taskGoods.setGoodsNo(sysStockDetailVo.getGoodsNo());
taskGoods.setQrCode(sysStockDetailVo.getQrCode());
taskGoods.setTaskCode(taskId);
taskGoods.setIsPunching(sysStockDetailVo.getIsPuch());
taskGoods.setBranchId(SecurityUtils.getCurrentBranchId());
taskGoods.setCreateBy(SecurityUtils.getUsername());
taskGoodsList.add(taskGoods);
//出库预占
@ -599,6 +607,10 @@ public class BusinDataTaskServiceImpl extends ServiceImpl<BusinDataTaskMapper, B
}
iSysStockDetailService.updateBatchById(sysStockDetails);
return iBusinDataTaskGoodsService.saveBatch(taskGoodsList)?Result.ok():Result.err().msg("指定货位出库失败");
}catch (Exception e){
log.error("指定货位出库失败:"+e.getMessage());
return Result.err().msg("指定货位出库失败");
}
}
@Override

Loading…
Cancel
Save