Browse Source

1.库内作业bug修复

2.库内作业需求逻辑修改
training
zhenghaoyu 1 year ago
parent
commit
4785123cdd
  1. 1
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ParcelListVO.java
  2. 36
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java
  3. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpdownTypeDTO.java
  4. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java
  5. 30
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java
  6. 147
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

1
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ParcelListVO.java

@ -20,5 +20,6 @@ public class ParcelListVO implements Serializable {
private String shelfTitle;//货架
private String allocationTitle;//货位
private Integer isFleeing;//是否窜货 0否 1是
private Integer deletedStatus;//是否可删除 0否 1是
}

36
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java

@ -909,4 +909,40 @@ public class WarehouseUpdownTypeApiController {
}
@ResponseBody
@PostMapping("/moveAllocationByAllocation")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "移库库位", notes = "传入trayTypeDTO")
public R moveAllocationByAllocation(@RequestBody UpdownTypeDTO updownTypeDTO) {
String method = "###########moveAllocationByAllocation: ";
log.info(method + "移库库位 updownTypeDTO={}", updownTypeDTO);
Long allocationId = updownTypeDTO.getAllocationId();//目标库位码
Long targetAllocationId = updownTypeDTO.getTargetAllocationId();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
if(Objects.isNull(targetAllocationId)){
log.warn(method+"目标库位码不能为空 targetAllocationId={}",targetAllocationId);
return R.fail(403,"目标库位码不能为空");
}
if(Objects.isNull(allocationId)){
log.warn(method+"库位码不能为空 allocationId={}",allocationId);
return R.fail(403,"库位码不能为空");
}
//查询该库位的货物信息
return warehouseUpdownTypeService.moveAllocationByAllocation(allocationId,targetAllocationId,myCurrentWarehouse.getId());
}catch (CustomerException e){
log.warn(e.message);
return R.fail(e.code,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
}

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpdownTypeDTO.java

@ -17,7 +17,7 @@ public class UpdownTypeDTO implements Serializable {
@ApiModelProperty(name = "来源库位码",notes = "来源库位码")
private String sourceAllocation;//来源库位码
@ApiModelProperty(name = "目标库位码",notes = "目标库位码")
private String targetAllocation;//目标库位码
private Long targetAllocationId;//目标库位码
@ApiModelProperty(name = "移库方式",notes = "移库方式 1货物 2托盘")
private Integer moveType;//移库方式 1货物 2托盘
@ApiModelProperty(name = "移库方式",notes = "上架扫描类型 1服务号 2订单自编码 3包条码 4托盘码")

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java

@ -62,4 +62,6 @@ public interface IWarehouseUpdownTypeService extends BaseService<WarehouseUpdown
OrderUpshelfDetailVO orderUpshelfDetail(String orderCode);
UpShelfAllocationVO moveAllocationScanAllocation(Long allocationId, Long warehouseId);
R moveAllocationByAllocation(Long allocationId, Long targetAllocationId, Long warehouseId);
}

30
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -338,7 +338,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(qw);
if(!Objects.isNull(trayGoodsEntity)){
log.warn("#########orderScanOrderPackageCode: 包件已打托 orderPackageCode={}",orderPackageCode);
throw new CustomerException(403,"包件已打托");
return Resp.scanFail(2001,"包件已打托","包件已打托");
}
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsEntityQueryWrapper = new QueryWrapper<>();
@ -346,41 +346,41 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(updownGoodsEntityQueryWrapper);
if(!Objects.isNull(updownGoodsEntity)){
log.warn("#########orderScanOrderPackageCode: 包件已上架 orderPackageCode={}",orderPackageCode);
return R.fail(403,"包件已上架");
return Resp.scanFail(2001,"包件已上架","包件已上架");
}
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode(trayCode);
if(Objects.isNull(basicdataTrayEntity)){
log.warn("#########orderScanOrderPackageCode: 未找到托盘信息 trayCode={}",trayCode);
return R.fail(403,"未找到托盘信息");
return Resp.scanFail(2001,"未找到托盘信息","未找到托盘信息");
}
Integer disableType = basicdataTrayEntity.getDisableType();
Long trayId = basicdataTrayEntity.getId();
if(disableType == 2){
log.warn("###############orderScanOrderPackageCode: 该托盘已被禁用 trayCode={}",trayCode);
return R.fail(403,"该托盘已被禁用");
return Resp.scanFail(2001,"该托盘已被禁用","该托盘已被禁用");
}
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCode(orderPackageCode);
if(Objects.isNull(parcelListEntity)){
log.warn("##############orderScanOrderPackageCode: 包件不存在 orderPackageCode={}",orderPackageCode);
return R.fail(403,"包件不存在");
return Resp.scanFail(2001,"包件不存在","包件不存在");
}
String orderCode = parcelListEntity.getOrderCode();//订单自编码
Long wid = parcelListEntity.getWarehouseId();
if(!wid.equals(warehouseId)){
log.warn("##############orderScanOrderPackageCode: 包件不在当前仓 orderPackageCode={} wid={} warehouseId={}",orderPackageCode,wid,warehouseId);
return R.fail(403,"包件不在当前仓");
return Resp.scanFail(2001,"包件不在当前仓","包件不在当前仓");
}
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCode(orderCode);
if(Objects.isNull(stockArticleEntity)){
log.warn("#########orderScanOrderPackageCode: 未找到订单信息 orderCode={}",orderCode);
return R.fail(403,"未找到订单信息");
return Resp.scanFail(2001,"未找到订单信息","未找到订单信息");
}
Integer genre = stockArticleEntity.getGenre();
if(genre == 2){
log.warn("#########orderScanOrderPackageCode: 该包件已转库存品 orderCode={}",orderCode);
return R.fail(403,"该包件已转库存品");
return Resp.scanFail(2001,"该包件已转库存品","该包件已转库存品");
}
//查询打托方式信息
@ -401,12 +401,12 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
if(!trayTypeEntityWarehouseId.equals(warehouseId)){
log.warn("##############orderScanOrderPackageCode: 托盘已在其他仓库打托 {}={}",trayTypeEntityWarehouseId,warehouseId);
return R.fail(403,"托盘已在其他仓库打托");
return Resp.scanFail(2001,"托盘已在其他仓库打托","托盘已在其他仓库打托");
}
if(!tt.equals(trayType)){
log.warn("##############orderScanOrderPackageCode: 打托方式不正确 {}={}",trayType,tt);
return R.fail(403,"打托方式不正确");
return Resp.scanFail(2001,"打托方式不正确","打托方式不正确");
}
//判断包件是否已存在托盘
@ -414,7 +414,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
String oldTrayCode = trayGoodsEntity.getTrayCode();
if(oldTrayCode.equals(trayCode)){
log.warn("##############orderScanOrderPackageCode: 该包条已打托 trayCode={}",trayCode);
return R.fail(403,"该包条已打托");
return Resp.scanFail(2001,"该包条已打托","该包条已打托");
}
//存入包件与托盘绑定关系表
downPackageByOrderPackageCode(orderPackageCode,"扫描分拣:下托");
@ -1676,6 +1676,14 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
Integer scanNum = warehouseTrayGoodsService.findScanPracelListNum(orderCode,trayTypeId);
orderDetailVO.setScanNum(scanNum);
List<ParcelListVO> list = warehouseTrayGoodsService.findAllPackageDetailByOrderCode(orderCode);
for (ParcelListVO parcelListVO:list){
String trayName = parcelListVO.getTrayName();
if(trayCode.equals(trayName)){
parcelListVO.setDeletedStatus(1);
}else{
parcelListVO.setDeletedStatus(0);
}
}
orderDetailVO.setParcelList(list);
return orderDetailVO;
}

147
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

@ -924,11 +924,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
if(Objects.isNull(updownTypeEntity)){
updownTypeEntity = createUpdownType("100",goodsAllocationEntity,goodsShelfEntity,goodsAreaEntity,warehouseId);
}
String s = bindingAllocationAndStockAndLog(upShelfStockList, updownTypeEntity);
Map<String,Object> map = bindingAllocationAndStockAndLog(upShelfStockList, updownTypeEntity);
updateUpdownTypeNum(updownTypeEntity);
num = (Integer)map.get("allNum");
String s = (String) map.get("s");
num = updownTypeEntity.getStockNum();
updateUpdownTypeNum(updownTypeEntity);
if(!StringUtil.isBlank(trayCode)){
for (UpShelfStockDTO upShelfStockDTO:upShelfStockList){
@ -1591,12 +1592,12 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
detailVO.setTotalNumber(stockArticleEntity.getTotalNumber());
//根据订单自编码查询已上架的数据
ParcelListVO updownParcelListVO = warehouseUpdownGoodsService.findAllUpShelfDataByOrderCode(orderCode);
return null;
List<ParcelListVO> list = warehouseTrayGoodsService.findAllPackageDetailByOrderCode(orderCode);
for (ParcelListVO parcelListVO:list){
parcelListVO.setDeletedStatus(0);
}
detailVO.setList(list);
return detailVO;
}
@Override
@ -1666,6 +1667,123 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
}
}
@Override
public R moveAllocationByAllocation(Long allocationId, Long targetAllocationId, Long warehouseId) {
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId);
if(Objects.isNull(goodsAllocationEntity)){
log.warn("#############moveAllocationByAllocation: 库位信息不存在 allocationId={}",allocationId);
return Resp.scanFail(403,"库位信息不存在","库位信息不存在");
}
Long wid = goodsAllocationEntity.getWarehouseId();
if(wid.equals(warehouseId)){
log.warn("#############moveAllocationByAllocation: 库位不在当前仓 allocationId={}",allocationId);
return Resp.scanFail(403,"库位不在当前仓","库位不在当前仓");
}
BasicdataGoodsAllocationEntity targetGoodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(targetAllocationId);
if(Objects.isNull(targetGoodsAllocationEntity)){
log.warn("#############moveAllocationByAllocation: 目标库位信息不存在 targetAllocationId={}",targetAllocationId);
return Resp.scanFail(403,"目标库位信息不存在","目标库位信息不存在");
}
Long targetWid = targetGoodsAllocationEntity.getWarehouseId();
if(targetWid.equals(warehouseId)){
log.warn("#############moveAllocationByAllocation: 目标库位不在当前仓 targetAllocationId={}",targetAllocationId);
return Resp.scanFail(403,"目标库位不在当前仓","目标库位不在当前仓");
}
QueryWrapper<WarehouseUpdownGoodsEntity> targetUpdownGoodsQueryWapper = new QueryWrapper<>();
targetUpdownGoodsQueryWapper.eq("allocation_id",targetAllocationId);
List<WarehouseUpdownGoodsEntity> targetList = warehouseUpdownGoodsService.list(targetUpdownGoodsQueryWapper);
if(!targetList.isEmpty()){
log.warn("#############moveAllocationByAllocation: 目标库位已有数据 targetAllocationId={}",targetAllocationId);
return Resp.scanFail(403,"目标库位已有数据","目标库位已有数据");
}
//查询需要移库的库位是否有货物
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsQueryWapper = new QueryWrapper<>();
updownGoodsQueryWapper.eq("allocation_id",allocationId);
List<WarehouseUpdownGoodsEntity> list = warehouseUpdownGoodsService.list(updownGoodsQueryWapper);
if(list.isEmpty()){
log.warn("#############moveAllocationByAllocation: 来源库位没有数据 allocationId={}",allocationId);
return Resp.scanFail(403,"来源库位没有数据","来源库位没有数据");
}
QueryWrapper<WarehouseUpdownTypeEntity> updownTypeEntityQueryWrapper = new QueryWrapper<>();
updownTypeEntityQueryWrapper.eq("allocation_id",allocationId)
.eq("is_deleted",0);
WarehouseUpdownTypeEntity updownTypeEntity = getOne(updownTypeEntityQueryWrapper);
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId);
if(Objects.isNull(trayEntity)){
//没有托盘就直接修改库位数据
changeUpdownGoodsToNewAllocation(list,targetAllocationId,updownTypeEntity);
//修改绑定数据的库位信息到新库位
downAllocation(allocationId);
}else{
String trayCode = trayEntity.getPalletCode();
moveAllocationByTrayCode(trayCode,targetAllocationId,warehouseId);
}
return Resp.scanSuccess("整库移库成功","整库移库成功");
}
private void changeUpdownGoodsToNewAllocation(List<WarehouseUpdownGoodsEntity> list, Long allocationId,WarehouseUpdownTypeEntity updownTypeEntity) {
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId);
if(Objects.isNull(goodsAllocationEntity)){
log.warn("##############changeUpdownGoodsToNewAllocation: 库位不存在 allocationId={}",allocationId);
throw new CustomerException(403,"库位不存在");
}
String enableStatus = goodsAllocationEntity.getEnableStatus();
Long goodsShelfId = goodsAllocationEntity.getGoodsShelfId();
if("2".equals(enableStatus)){
log.warn("##############changeUpdownGoodsToNewAllocation: 库位已被禁用 allocationId={}",allocationId);
throw new CustomerException(403,"库位已被禁用");
}
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient.getEntityByGoodsShelfId(goodsShelfId);
if(Objects.isNull(goodsShelfEntity)){
log.warn("##############changeUpdownGoodsToNewAllocation: 货架不存在 goodsShelfId={}",goodsShelfId);
throw new CustomerException(403,"货架不存在");
}
Long goodsAreaId = goodsShelfEntity.getGoodsAreaId();
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient.getEntityByGoodsAreaId(goodsAreaId);
if(Objects.isNull(goodsAreaEntity)){
log.warn("##############changeUpdownGoodsToNewAllocation: 货区不存在 goodsAreaId={}",goodsAreaId);
throw new CustomerException(403,"货区不存在");
}
Long wid = goodsAreaEntity.getWarehouseId();
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(wid);
if(Objects.isNull(warehouseEntity)){
log.warn("##############changeUpdownGoodsToNewAllocation: 仓库不存在 wid={}",wid);
throw new CustomerException(403,"仓库不存在");
}
WarehouseUpdownTypeEntity targetUpdownTypeEntity = new WarehouseUpdownTypeEntity();
BeanUtil.copy(updownTypeEntity,targetUpdownTypeEntity);
targetUpdownTypeEntity.setId(null);
targetUpdownTypeEntity.setAreaId(goodsAreaId);
targetUpdownTypeEntity.setAreaTitle(goodsAreaEntity.getHeadline());
targetUpdownTypeEntity.setShelfId(goodsShelfId);
targetUpdownTypeEntity.setShelfTitle(goodsShelfEntity.getGoodsShelfName());
targetUpdownTypeEntity.setAllocationId(allocationId);
targetUpdownTypeEntity.setAllocationTitle(goodsAllocationEntity.getGoodsAllocationName());
save(targetUpdownTypeEntity);
for(WarehouseUpdownGoodsEntity updownGoodsEntity:list){
updownGoodsEntity.setAreaId(goodsAreaId);
updownGoodsEntity.setAreaTitle(goodsAreaEntity.getHeadline());
updownGoodsEntity.setShelfId(goodsShelfId);
updownGoodsEntity.setShelfTitle(goodsShelfEntity.getGoodsShelfName());
updownGoodsEntity.setAllocationId(allocationId);
updownGoodsEntity.setAllocationTitle(goodsAllocationEntity.getGoodsAllocationName());
updownGoodsEntity.setPositionCode(goodsAreaEntity.getHeadline()+"-"+goodsShelfEntity.getGoodsShelfName()+"-"+goodsAllocationEntity.getGoodsAllocationName());
}
//货物重新绑定
warehouseUpdownGoodsService.saveOrUpdateBatch(list);
saveUpdownGoodsLog(list,"1",0,"移库:整库移库",targetUpdownTypeEntity.getWarehouseId());
}
private void saveUpdownGoodsLogPart(List<WarehouseUpdownGoodsEntity> updownGoodsList, int residue, String bindingType, Integer isAlltrays, String remark,Long warehouseId) {
List<WarehouseUpdownGoodsLogEntity> updownGoodsLogList = new ArrayList<>();
@ -1682,10 +1800,11 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
warehouseUpdownGoodsLogService.saveBatch(updownGoodsLogList);
}
private String bindingAllocationAndStockAndLog(List<UpShelfStockDTO> upShelfStockList, WarehouseUpdownTypeEntity updownTypeEntity) {
private Map<String,Object> bindingAllocationAndStockAndLog(List<UpShelfStockDTO> upShelfStockList, WarehouseUpdownTypeEntity updownTypeEntity) {
List<WarehouseUpdownGoodsEntity> updownGoodsList = new ArrayList<>();
List<WarehouseUpdownGoodsEntity> updownGoodsLogList = new ArrayList<>();
StringBuffer stringBuffer = new StringBuffer();
Integer allNum = 0;
for (UpShelfStockDTO upShelfStockDTO:upShelfStockList){
Long marketId = upShelfStockDTO.getMarketId();
Long allocationId = updownTypeEntity.getAllocationId();
@ -1745,12 +1864,16 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
updownGoodsList.add(updownGoodsEntity);
updownGoodsLogList.add(updownGoodsEntity);
}
allNum = allNum + enterNum;
}
warehouseUpdownGoodsService.saveOrUpdateBatch(updownGoodsList);
saveUpdownGoodsLog(updownGoodsLogList,"1",0,"扫描上架:库存品上架",updownTypeEntity.getWarehouseId());
return stringBuffer.toString();
Map<String,Object> map = new HashMap<>();
map.put("allNum",allNum);
map.put("s",stringBuffer.toString());
return map;
}
private UpdownStockVO stockToUpdownStockVO(DistributionStockListEntity stockListEntity) {

Loading…
Cancel
Save