|
|
|
@ -36,10 +36,15 @@ import com.logpm.distribution.vo.*;
|
|
|
|
|
import com.logpm.distribution.wrapper.DistributionStockupWrapper; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseTaryAllocationEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseUpdownGoodsLogEntity; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseTaryAllocationClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownGoodsClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownGoodsLogClient; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.common.constant.CodeDesEnum; |
|
|
|
|
import org.springblade.common.constant.DictBizConstant; |
|
|
|
|
import org.springblade.common.constant.DistributionTypeConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stocklist.StockLockingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stocklist.StockSignfoStatusConstant; |
|
|
|
@ -59,6 +64,7 @@ import org.springframework.context.annotation.Lazy;
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import javax.xml.ws.BindingType; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
|
|
|
|
@ -69,6 +75,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
* @since 2023-06-15 |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
public class DistributionStockupServiceImpl extends BaseServiceImpl<DistributionStockupMapper, DistributionStockupEntity> implements IDistributionStockupService { |
|
|
|
|
|
|
|
|
|
@Lazy |
|
|
|
@ -130,6 +137,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionAsyncService distributionAsyncService; |
|
|
|
|
|
|
|
|
|
private IWarehouseUpdownGoodsLogClient warehouseUpdownGoodsLogClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionStockupVO> selectDistributionStockupPage(IPage<DistributionStockupVO> page, DistributionStockupVO distributionStockup) { |
|
|
|
@ -475,11 +484,40 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
public List<DistributionStockupOrderListVO> selectStockupOrderList(StockupDTO stockupDTO) { |
|
|
|
|
Long reservationId = stockupDTO.getReservationId();//预约单id
|
|
|
|
|
if (stockupDTO.getTypeService().equals("3")) { |
|
|
|
|
//查询客户数据
|
|
|
|
|
//查询客户数据 自
|
|
|
|
|
List<DistributionStockupOrderListVO> list = distrilbutionBillStockService.selectDistrilbutionBillSelf(reservationId); |
|
|
|
|
//查询包件的库位的
|
|
|
|
|
if(!list.isEmpty()){ |
|
|
|
|
list.forEach( i ->{ |
|
|
|
|
if(ObjectUtils.isNull(i.getAllocationId())){ |
|
|
|
|
//查询包件信息
|
|
|
|
|
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId()) |
|
|
|
|
); |
|
|
|
|
if(!list1.isEmpty()){ |
|
|
|
|
list1.forEach( a ->{ |
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoodsLog = new WarehouseUpdownGoodsLogEntity(); |
|
|
|
|
updownGoodsLog.setAssociationType("3"); |
|
|
|
|
updownGoodsLog.setAssociationId(a.getId()); |
|
|
|
|
updownGoodsLog.setBindingType("2"); //下架
|
|
|
|
|
BasicdataWarehouseEntity my = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
updownGoodsLog.setWarehouseId(my.getId()); |
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoods = warehouseUpdownGoodsLogClient.getUpdownGoods(updownGoodsLog); |
|
|
|
|
if(ObjectUtils.isNotNull(updownGoods)){ |
|
|
|
|
i.setAllocation(updownGoods.getPositionCode()); |
|
|
|
|
i.setAllocationId(updownGoods.getAllocationId()); |
|
|
|
|
i.setCompleteStact(true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return list; |
|
|
|
|
} else { |
|
|
|
|
//
|
|
|
|
|
//商 市
|
|
|
|
|
//1.根据预约单id 查询到对应的数据
|
|
|
|
|
List<DistributionStockupOrderListVO> list = distributionReservationService.selectStockupOrderList(reservationId); |
|
|
|
|
return list; |
|
|
|
@ -504,23 +542,25 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DistributionStockupOrderInfoVO selectOrderInfo(Long reservationId, Long stockArticleId, Long stockupId, Long trayId, Long allocation) { |
|
|
|
|
public DistributionStockupOrderInfoVO selectOrderInfo(StockupDTO stockupDTO) { |
|
|
|
|
//查询客户信息
|
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(reservationId); //预约信息
|
|
|
|
|
DistributionReservationEntity reservationEntity = distributionReservationService.getById(stockupDTO.getReservationId()); //预约信息
|
|
|
|
|
//通过订单id和预约id,托盘信息查询对应的包件列表
|
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoList(reservationId, stockArticleId, stockupId, trayId); |
|
|
|
|
int size = list.size(); //数量
|
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoList(stockupDTO.getReservationId(), stockupDTO.getStockArticleId(), stockupDTO.getStockupId(), stockupDTO.getTrayId()); |
|
|
|
|
// int size = list.size(); //数量
|
|
|
|
|
Integer size = 0; //数量
|
|
|
|
|
Integer scanNum = 0; |
|
|
|
|
DistributionStockupEntity byId = distributionStockupService.selectById(stockupId); |
|
|
|
|
DistributionStockupEntity byId = distributionStockupService.selectById(stockupDTO.getStockupId()); |
|
|
|
|
String allocationTitle = null; |
|
|
|
|
String trayCode = null; |
|
|
|
|
Iterator<PackageStockupVO> iterator = list.iterator(); |
|
|
|
|
|
|
|
|
|
if(ObjectUtils.isNotNull(allocation)){ |
|
|
|
|
if(ObjectUtils.isNotNull(stockupDTO.getAllocationId())){ |
|
|
|
|
//有
|
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
PackageStockupVO vo = iterator.next(); |
|
|
|
|
if(ObjectUtils.isNull(vo.getPositionCode())){ |
|
|
|
|
if(ObjectUtils.isNull(vo.getPositionCode()) || ObjectUtils.isNotNull(vo.getAllocationId()) && !vo.getAllocationId().equals(stockupDTO.getAllocationId()) ){ |
|
|
|
|
|
|
|
|
|
iterator.remove(); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
@ -546,11 +586,13 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
qw.eq("package_code", orderPackageCode); |
|
|
|
|
List<DistributionParcelDetailsEntity> parcelDetailsEntityList = distributionParcelDetailsService.list(qw); |
|
|
|
|
vo.setDetailsEntities(parcelDetailsEntityList); |
|
|
|
|
size += 1; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//没有
|
|
|
|
|
PackageStockupVO vo = iterator.next(); |
|
|
|
|
|
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
PackageStockupVO vo = iterator.next(); |
|
|
|
|
if(ObjectUtils.isNotNull(vo.getPositionCode())){ |
|
|
|
|
iterator.remove(); |
|
|
|
|
continue; |
|
|
|
@ -577,11 +619,12 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
qw.eq("package_code", orderPackageCode); |
|
|
|
|
List<DistributionParcelDetailsEntity> parcelDetailsEntityList = distributionParcelDetailsService.list(qw); |
|
|
|
|
vo.setDetailsEntities(parcelDetailsEntityList); |
|
|
|
|
size += 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DistributionStockupOrderInfoVO vo = new DistributionStockupOrderInfoVO(); |
|
|
|
|
vo.setReservationId(reservationId); //预约id
|
|
|
|
|
vo.setReservationId(stockupDTO.getReservationId()); //预约id
|
|
|
|
|
vo.setCustomer(reservationEntity.getConsignee()); //客户0
|
|
|
|
|
vo.setAddress(reservationEntity.getDeliveryAddress()); //地址
|
|
|
|
|
vo.setPlanNum(size); //计划件数
|
|
|
|
@ -596,70 +639,109 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
|
|
|
|
|
/** |
|
|
|
|
* 自提备货客户包件数据查询 |
|
|
|
|
* |
|
|
|
|
* @param reservationId 自提id |
|
|
|
|
* @param stockArticleId 订单id |
|
|
|
|
* @param stockupId 备货id |
|
|
|
|
* @param trayId 托盘id |
|
|
|
|
* reservationId 自提id |
|
|
|
|
* stockArticleId 订单id |
|
|
|
|
* stockupId 备货id |
|
|
|
|
* trayId 托盘id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public DistributionStockupOrderInfoVO selectOrderInfoSelf(Long reservationId, Long stockArticleId, Long stockupId, Long trayId,Long allocationId) { |
|
|
|
|
DistributionStockArticleEntity byId = distributionStockArticleService.getById(stockArticleId); |
|
|
|
|
DistributionStockupSelfVO distributionStockupSelfVO = new DistributionStockupSelfVO(); |
|
|
|
|
if(ObjectUtils.isNotNull(allocationId)){ |
|
|
|
|
//查询订单数量 有库位
|
|
|
|
|
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackSelf(reservationId, stockupId,allocationId); |
|
|
|
|
}else{ |
|
|
|
|
//查询订单数量 无库位
|
|
|
|
|
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(reservationId, stockupId); |
|
|
|
|
} |
|
|
|
|
public DistributionStockupOrderInfoVO selectOrderInfoSelf(StockupDTO stockupDTO) { |
|
|
|
|
DistributionStockArticleEntity byId = distributionStockArticleService.getById(stockupDTO.getStockArticleId()); |
|
|
|
|
if(stockupDTO.getStatus().equals(1)){ |
|
|
|
|
DistributionStockupSelfVO distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId()); |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, stockupDTO.getStockArticleId()) |
|
|
|
|
); |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
List<PackageStockupVO> listPack = new ArrayList<>(); |
|
|
|
|
list.forEach( i ->{ |
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoodsLogEntity = new WarehouseUpdownGoodsLogEntity(); |
|
|
|
|
updownGoodsLogEntity.setAssociationType("3"); |
|
|
|
|
updownGoodsLogEntity.setAssociationId(stockupDTO.getAllocationId()); |
|
|
|
|
updownGoodsLogEntity.setBindingType("2"); |
|
|
|
|
updownGoodsLogEntity.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
updownGoodsLogEntity.setAllocationId(i.getId()); |
|
|
|
|
WarehouseUpdownGoodsLogEntity updownGoods = warehouseUpdownGoodsLogClient.getUpdownGoods(updownGoodsLogEntity); |
|
|
|
|
PackageStockupVO packageStockupVO = new PackageStockupVO(); |
|
|
|
|
packageStockupVO.setOrderCode(i.getOrderCode()); |
|
|
|
|
packageStockupVO.setPackageBarCode(i.getOrderPackageCode()); |
|
|
|
|
packageStockupVO.setGoodsType(1); |
|
|
|
|
packageStockupVO.setGoodsTypeStr("定制品"); |
|
|
|
|
packageStockupVO.setMaterialName(i.getMaterialName()); |
|
|
|
|
packageStockupVO.setIsScanStr("已备货"); |
|
|
|
|
packageStockupVO.setIsScan(2); |
|
|
|
|
listPack.add(packageStockupVO); |
|
|
|
|
}); |
|
|
|
|
DistributionStockupOrderInfoVO vo = new DistributionStockupOrderInfoVO(); |
|
|
|
|
vo.setReservationId(stockupDTO.getReservationId()); //预约id
|
|
|
|
|
vo.setCustomer(byId.getMallName()); //客户0
|
|
|
|
|
vo.setAddress(byId.getConsigneeAddress()); //地址
|
|
|
|
|
vo.setPlanNum(distributionStockupSelfVO.getPlanNum()); //计划件数
|
|
|
|
|
vo.setScanNum(distributionStockupSelfVO.getScanNum()); //备货件数
|
|
|
|
|
vo.setStockupArea(distributionStockupSelfVO.getConsignee()); //备货区
|
|
|
|
|
vo.setWarehouseArea(distributionStockupSelfVO.getWarehouseArea()); //库位
|
|
|
|
|
vo.setTrays(distributionStockupSelfVO.getTrays()); //托盘
|
|
|
|
|
vo.setPackageList(listPack); //
|
|
|
|
|
return vo; |
|
|
|
|
|
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoSelfList(reservationId, stockArticleId, stockupId, trayId); |
|
|
|
|
Iterator<PackageStockupVO> iterator = list.iterator(); |
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
if(Objects.isNull(allocationId)){ |
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
PackageStockupVO next = iterator.next(); |
|
|
|
|
if(ObjectUtils.isNotNull(next.getPositionCode()) ){ |
|
|
|
|
iterator.remove(); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(next.getIsScan())) { |
|
|
|
|
next.setIsScanStr("已备货"); |
|
|
|
|
next.setIsScan(2); |
|
|
|
|
} else { |
|
|
|
|
next.setIsScanStr("未备货"); |
|
|
|
|
next.setIsScan(1); |
|
|
|
|
} |
|
|
|
|
DistributionStockupSelfVO distributionStockupSelfVO = new DistributionStockupSelfVO(); |
|
|
|
|
if(ObjectUtils.isNotNull(stockupDTO.getAllocationId())){ |
|
|
|
|
//查询订单数量 有库位
|
|
|
|
|
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId(),stockupDTO.getAllocationId()); |
|
|
|
|
}else{ |
|
|
|
|
//查询订单数量 无库位
|
|
|
|
|
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId()); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
PackageStockupVO next = iterator.next(); |
|
|
|
|
if(ObjectUtils.isNull(next.getPositionCode()) ){ |
|
|
|
|
iterator.remove(); |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoSelfList(stockupDTO.getReservationId(), stockupDTO.getStockArticleId(), stockupDTO.getStockupId(), stockupDTO.getTrayId()); |
|
|
|
|
Iterator<PackageStockupVO> iterator = list.iterator(); |
|
|
|
|
|
|
|
|
|
if(Objects.isNull(stockupDTO.getAllocationId())){ |
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
PackageStockupVO next = iterator.next(); |
|
|
|
|
if(ObjectUtils.isNotNull(next.getPositionCode()) ){ |
|
|
|
|
iterator.remove(); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(next.getIsScan())) { |
|
|
|
|
next.setIsScanStr("已备货"); |
|
|
|
|
next.setIsScan(2); |
|
|
|
|
} else { |
|
|
|
|
next.setIsScanStr("未备货"); |
|
|
|
|
next.setIsScan(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(next.getIsScan())) { |
|
|
|
|
next.setIsScanStr("已备货"); |
|
|
|
|
next.setIsScan(2); |
|
|
|
|
} else { |
|
|
|
|
next.setIsScanStr("未备货"); |
|
|
|
|
next.setIsScan(1); |
|
|
|
|
}else{ |
|
|
|
|
while (iterator.hasNext()){ |
|
|
|
|
PackageStockupVO next = iterator.next(); |
|
|
|
|
if(ObjectUtils.isNull(next.getPositionCode()) ){ |
|
|
|
|
iterator.remove(); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotNull(next.getIsScan())) { |
|
|
|
|
next.setIsScanStr("已备货"); |
|
|
|
|
next.setIsScan(2); |
|
|
|
|
} else { |
|
|
|
|
next.setIsScanStr("未备货"); |
|
|
|
|
next.setIsScan(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DistributionStockupOrderInfoVO vo = new DistributionStockupOrderInfoVO(); |
|
|
|
|
vo.setReservationId(stockupDTO.getReservationId()); //预约id
|
|
|
|
|
vo.setCustomer(byId.getMallName()); //客户0
|
|
|
|
|
vo.setAddress(byId.getConsigneeAddress()); //地址
|
|
|
|
|
vo.setPlanNum(distributionStockupSelfVO.getPlanNum()); //计划件数
|
|
|
|
|
vo.setScanNum(distributionStockupSelfVO.getScanNum()); //备货件数
|
|
|
|
|
vo.setStockupArea(distributionStockupSelfVO.getConsignee()); //备货区
|
|
|
|
|
vo.setWarehouseArea(distributionStockupSelfVO.getWarehouseArea()); //库位
|
|
|
|
|
vo.setTrays(distributionStockupSelfVO.getTrays()); //托盘
|
|
|
|
|
vo.setPackageList(list); //
|
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
DistributionStockupOrderInfoVO vo = new DistributionStockupOrderInfoVO(); |
|
|
|
|
vo.setReservationId(reservationId); //预约id
|
|
|
|
|
vo.setCustomer(byId.getMallName()); //客户0
|
|
|
|
|
vo.setAddress(byId.getConsigneeAddress()); //地址
|
|
|
|
|
vo.setPlanNum(distributionStockupSelfVO.getPlanNum()); //计划件数
|
|
|
|
|
vo.setScanNum(distributionStockupSelfVO.getScanNum()); //备货件数
|
|
|
|
|
vo.setStockupArea(distributionStockupSelfVO.getConsignee()); //备货区
|
|
|
|
|
vo.setWarehouseArea(distributionStockupSelfVO.getWarehouseArea()); //库位
|
|
|
|
|
vo.setTrays(distributionStockupSelfVO.getTrays()); //托盘
|
|
|
|
|
vo.setPackageList(list); //
|
|
|
|
|
|
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|