Browse Source

库存品备货区库位物料上架

chenglong
汤建军 1 year ago
parent
commit
3575722b95
  1. 123
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownStockupAreaApiController.java
  2. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpShelfStockDTO.java
  3. 44
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownStockupAreaMapper.java
  4. 54
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownStockupAreaMapper.xml
  5. 28
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownStockupAreaService.java
  6. 255
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java

123
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownStockupAreaApiController.java

@ -7,6 +7,7 @@ import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.vo.UpDownStockupAreaVO;
import com.logpm.warehouse.bean.Resp;
import com.logpm.warehouse.dto.UpShelfPackageDTO;
import com.logpm.warehouse.dto.UpShelfStockDTO;
import com.logpm.warehouse.dto.UpStockupAreaPackageDTO;
import com.logpm.warehouse.dto.UpdownTypeDTO;
import com.logpm.warehouse.entity.WarehouseUpdownStockupAreaEntity;
@ -151,6 +152,128 @@ public class WarehouseUpdownStockupAreaApiController {
}
}
@ResponseBody
@GetMapping("/upShelfPackageData")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "备货库位上架包条级别扫描接口", notes = "传入trayTypeDTO")
public R upShelfPackageData(@RequestParam Long allocationId ) {
String method = "###########upShelfScanPackage: ";
log.info(method + "查询库位数据 allocationId={}", allocationId);
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
if(Objects.isNull(allocationId)){
log.warn(method+"库位id不能为空 allocationId={}",allocationId);
return R.fail(403,"请扫描先扫描库位");
}
return warehouseUpdownStockupAreaService.upShelfPackageData(myCurrentWarehouse.getId(),allocationId);
}catch (CustomerException e){
log.warn(e.message);
return Resp.scanFail(e.code,e.message,e.message);
}catch (Exception e){
log.error(method+"系统异常,联系管理员",e);
return R.fail(500,"系统异常,联系管理员");
}
}
@ResponseBody
@PostMapping("/getStockByParam")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "获取库存品数据", notes = "传入trayTypeDTO")
public R getStockByParam(@RequestBody UpdownTypeDTO updownTypeDTO) {
String method = "###########getStockByParam: ";
log.info(method + "获取库存品数据 updownTypeDTO={}", updownTypeDTO);
Integer stockType = updownTypeDTO.getStockType();
String value = updownTypeDTO.getValue();
Long marketId = updownTypeDTO.getMarketId();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
if(Objects.isNull(stockType)){
log.warn(method+"查询库存品的类型不明确 stockType={}",stockType);
return R.fail(403,"查询库存品的类型不明确");
}
if(StringUtil.isBlank(value)){
log.warn(method+"查询值不能为空 value={}",value);
return R.fail(403,"查询值不能为空");
}
if(Objects.isNull(marketId)){
log.warn(method+"商场id不能为空 marketId={}",marketId);
return R.fail(403,"商场id不能为空");
}
//查询该库位的货物信息
return warehouseUpdownStockupAreaService.getStockByParam(stockType,value,marketId,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,"系统异常,联系管理员");
}
}
@ResponseBody
@PostMapping("/upShelfStockList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "上架库存品维度", notes = "传入trayTypeDTO")
public R upShelfStockList(@RequestBody UpdownTypeDTO updownTypeDTO ) {
String method = "###########upShelfStockList: ";
log.info(method + "上架库存品维度 updownTypeDTO={}", updownTypeDTO);
Long allocationId = updownTypeDTO.getAllocationId();//库位编码
List<UpShelfStockDTO> upShelfStockList = updownTypeDTO.getUpShelfStockList();
try{
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(Objects.isNull(myCurrentWarehouse)){
log.warn(method+"仓库信息不能为空");
return R.fail(403,"仓库信息不能为空");
}
int size = upShelfStockList.size();
if(size == 0 ){
log.warn(method+"没有处理的数据");
return R.fail(403,"无处理数据");
}
for (UpShelfStockDTO dto:upShelfStockList){
Integer enterNum = dto.getEnterNum();
if(Objects.isNull(enterNum) || enterNum == 0){
log.warn(method+"请输入正确的数量");
return R.fail(403,"请输入正确的数量");
}
}
if(Objects.isNull(allocationId)){
log.warn(method+"库位信息不能为空 allocationId={}",allocationId);
return R.fail(403,"库位信息不能为空");
}
//查询该库位的货物信息
return warehouseUpdownStockupAreaService.upShelfStockList(upShelfStockList,allocationId,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/UpShelfStockDTO.java

@ -13,6 +13,8 @@ public class UpShelfStockDTO implements Serializable {
private Long marketId;
@ApiModelProperty(name = "物料编码",notes = "物料编码")
private String materialCode;//物料编码
// @ApiModelProperty(name = "物料编码",notes = "物料编码")
private String materialName;//物料编码
@ApiModelProperty(name = "录入数量",notes = "录入数量")
private Integer enterNum;//录入数量
@ApiModelProperty(name = "库位id",notes = "库位id")

44
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownStockupAreaMapper.java

@ -38,4 +38,48 @@ import java.util.Map;
*/
public interface WarehouseUpdownStockupAreaMapper extends BaseMapper<WarehouseUpdownStockupAreaEntity> {
/**
* 查询备货库位
* @param allocationId
* @return
*/
Integer selectOrderTotal(@Param("allocationId") Long allocationId);
/**
* 查询备货库位包件总数
* @param allocationId
* @return
*/
Integer selectPackageTotal(@Param("allocationId")Long allocationId);
/**
*
* 查询库存品总数
* @param allocationId
* @return
*/
Integer selectInventoryTotal(@Param("allocationId")Long allocationId);
/**
* 查询库存品数量
* @param allocationId
* @return
*/
Integer selectStockListTotal(@Param("allocationId")Long allocationId);
/**
* 查询备货库位存在数据源的包件
* @param warehouseId
* @param allocationId
* @return
*/
List<Map<String, Object>> selectStockUpAreaOrder(@Param("warehouseId")Long warehouseId,@Param("allocationId") Long allocationId);
/**
* 查询备货库位库存品信息
* @param warehouseId
* @param allocationId
* @return
*/
List<Map<String, Object>> selectStockUpAreaStockList(@Param("warehouseId")Long warehouseId,@Param("allocationId") Long allocationId);
}

54
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownStockupAreaMapper.xml

@ -61,7 +61,61 @@
<result column="goods_name" property="goodsName"/>
<result column="num" property="num"/>
</resultMap>
<select id="selectOrderTotal" resultType="java.lang.Integer">
SELECT
IF(COUNT(ldsa.id) is not null,COUNT(ldsa.id),0) AS orderTotal
FROM
logpm_warehouse_updown_stockup_area AS lwusa
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON lwusa.association_id = ldpl.id
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldpl.stock_article_id = ldsa.id
WHERE
lwusa.allocation_id = #{allocationId} AND lwusa.goods_type = '1' AND lwusa.association_type IN ('2','3','5')
</select>
<select id="selectPackageTotal" resultType="java.lang.Integer">
SELECT
sum(num)
FROM
logpm_warehouse_updown_stockup_area
WHERE
allocation_id = #{allocationId} AND goods_type = '1' AND association_type IN ('2','3')
</select>
<select id="selectInventoryTotal" resultType="java.lang.Integer">
SELECT
IF(sum(num) is null,0,sum(num))
FROM
logpm_warehouse_updown_stockup_area
WHERE
allocation_id = #{allocationId} AND goods_type = '2' AND association_type IN ('3')
</select>
<select id="selectStockListTotal" resultType="java.lang.Integer">
SELECT
IF(count(materiel_code) is not null,count(materiel_code),0)
FROM
logpm_warehouse_updown_stockup_area
WHERE
allocation_id = #{allocationId} AND goods_type = '2' AND association_type IN ('3')
GROUP BY
materiel_code
</select>
<select id="selectStockUpAreaOrder" resultType="java.util.Map">
SELECT
ldsa.order_code AS orderCode,
GROUP_CONCAT(ldpl.waybill_number) AS waybillNumber,
ldsa.total_number AS totalNumber,
sum(lwusa.num) AS totalNum,
IF(ldsa.total_number = sum( lwusa.num ),1,0) AS complete
FROM
logpm_warehouse_updown_stockup_area AS lwusa
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON lwusa.association_id = ldpl.id
LEFT JOIN logpm_distribution_stock_article AS ldsa ON ldpl.stock_article_id = ldsa.id
WHERE
lwusa.allocation_id = #{allocationId} AND lwusa.warehouse_id = #{warehouseId} AND lwusa.goods_type = '1' AND lwusa.association_type IN ('2','3','5')
GROUP BY
ldsa.id
</select>
<select id="selectStockUpAreaStockList" resultType="java.util.Map">
</select>
</mapper>

28
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownStockupAreaService.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.vo.UpDownStockupAreaVO;
import com.logpm.warehouse.dto.UpShelfPackageDTO;
import com.logpm.warehouse.dto.UpShelfStockDTO;
import com.logpm.warehouse.dto.UpStockupAreaPackageDTO;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.entity.WarehouseUpdownStockupAreaEntity;
@ -65,4 +66,31 @@ public interface IWarehouseUpdownStockupAreaService extends BaseService<Warehous
* @return
*/
UpShelfAllocationVO upShelfScanAllocation(Long allocationId, Long warehouseId);
/**
* 查询备货库位数据
* @param id
* @param allocationId
* @return
*/
R upShelfPackageData(Long warehouseId, Long allocationId);
/**
* 物料查询接口
* @param stockType
* @param value
* @param marketId
* @param id
* @return
*/
R getStockByParam(Integer stockType, String value, Long marketId, Long id);
/**
* 库存品上架
* @param upShelfStockList
* @param allocationId
* @param warehouseId
* @return
*/
R upShelfStockList(List<UpShelfStockDTO> upShelfStockList, Long allocationId, Long warehouseId);
}

255
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownStockupAreaServiceImpl.java

@ -19,27 +19,28 @@ package com.logpm.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataGoodsAllocationEntity;
import com.logpm.basicdata.entity.BasicdataGoodsAreaEntity;
import com.logpm.basicdata.entity.BasicdataGoodsShelfEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.entity.*;
import com.logpm.basicdata.feign.IBasicdataGoodsAllocationClient;
import com.logpm.basicdata.feign.IBasicdataGoodsAreaClient;
import com.logpm.basicdata.feign.IBasicdataGoodsShelfClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.feign.IDisStockListDetailClient;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.distribution.feign.IDistributionStockListClient;
import com.logpm.distribution.vo.UpDownStockupAreaVO;
import com.logpm.warehouse.bean.Resp;
import com.logpm.warehouse.dto.UpShelfPackageDTO;
import com.logpm.warehouse.dto.UpShelfStockDTO;
import com.logpm.warehouse.dto.UpStockupAreaPackageDTO;
import com.logpm.warehouse.entity.*;
import com.logpm.warehouse.feign.WarehouseGoodsAllocationClient;
import com.logpm.warehouse.mapper.WarehouseUpdownStockupAreaMapper;
import com.logpm.warehouse.service.*;
import com.logpm.warehouse.vo.UpShelfAllocationVO;
import com.logpm.warehouse.vo.UpShelfDataVO;
import com.logpm.warehouse.vo.*;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.exception.CustomerException;
@ -47,12 +48,15 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 货位与货物绑定表 服务实现类
@ -90,6 +94,12 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
private final IDistributionStockArticleClient distributionStockArticleClient;
private final IDistributionStockListClient distributionStockListClient;
private final WarehouseGoodsAllocationClient warehouseGoodsAllocationClient;
/**
@ -144,7 +154,7 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
/**
* @param upStockupAreaPackageDTOS
* @param allocationId
* @param id
* @param warehouseId
* @return
*/
@Override
@ -303,17 +313,246 @@ public class WarehouseUpdownStockupAreaServiceImpl extends BaseServiceImpl<Wareh
upShelfAllocationVO.setShelfTitle(goodsShelfName);
upShelfAllocationVO.setAllocationId(allocationId);
upShelfAllocationVO.setAllocationTitle(goodsAllocationName);
//查询已上架的包件列表
List<WarehouseUpdownStockupAreaEntity> list = this.list(Wrappers.<WarehouseUpdownStockupAreaEntity>query().lambda()
.eq(WarehouseUpdownStockupAreaEntity::getWarehouseId, warehouseId)
.eq(WarehouseUpdownStockupAreaEntity::getAllocationId, allocationId)
);
//查询库位订单总数
Integer orderTotal = baseMapper.selectOrderTotal(allocationId);
//查询库位单子总数
Integer packageTotal = baseMapper.selectPackageTotal(allocationId);
//查询库位库存品总数
Integer stockListTotal = baseMapper.selectStockListTotal(allocationId);
//查询库位库存品总数
Integer inventoryTotal = baseMapper.selectInventoryTotal(allocationId);
if (Func.isEmpty(stockListTotal)){
upShelfAllocationVO.setStockTotalNum(0);
}else {
upShelfAllocationVO.setStockTotalNum(stockListTotal);
}
upShelfAllocationVO.setTotalNum(orderTotal);
upShelfAllocationVO.setOrderNum(packageTotal);
upShelfAllocationVO.setStockNum(inventoryTotal);
return upShelfAllocationVO;
}
/**
* @param warehouseId
* @param allocationId
* @return
*/
@Override
public R upShelfPackageData(Long warehouseId, Long allocationId) {
List<WarehouseUpdownStockupAreaEntity> warehouseUpdownStockupAreaEntities = this.list(Wrappers.<WarehouseUpdownStockupAreaEntity>query().lambda()
.eq(WarehouseUpdownStockupAreaEntity::getWarehouseId, warehouseId)
.eq(WarehouseUpdownStockupAreaEntity::getAllocationId, allocationId)
);
List<Map<String,Object>> maps = new ArrayList<>();
if (Func.isNotEmpty(warehouseUpdownStockupAreaEntities)){
//备货库位上存在上架数据,这里进行数据的处理然后给前端数据
//处理有数据的包件
List<WarehouseUpdownStockupAreaEntity> haveSourceData = warehouseUpdownStockupAreaEntities.stream().filter(f -> "1".equals(f.getGoodsType())).collect(Collectors.toList());
if (Func.isNotEmpty(haveSourceData)){
List<Map<String,Object>> packageMap = baseMapper.selectStockUpAreaOrder(warehouseId,allocationId);
maps.addAll(packageMap);
}
//查询无数据库存品信息
List<WarehouseUpdownStockupAreaEntity> notSourceInventoryData = warehouseUpdownStockupAreaEntities.stream().filter(f -> "2".equals(f.getGoodsType())&&"3".equals(f.getAssociationType())).collect(Collectors.toList());
if (Func.isNotEmpty(notSourceInventoryData)){
List<Map<String,Object>> inventoryMap = baseMapper.selectStockUpAreaStockList(warehouseId,allocationId);
maps.addAll(inventoryMap);
}
}
return R.data(maps);
}
/**
* @param stockType
* @param value
* @param marketId
* @param warehouseId
* @return
*/
@Override
public R getStockByParam(Integer stockType, String value, Long marketId, Long warehouseId) {
List<UpdownStockVO> ls = new ArrayList<>();
//1物料编码 2物料名称
if(1==stockType){
//物料编码
String materialCode = value;
List<DistributionStockListEntity> stockListEntityList = distributionStockListClient.getListByMarketIdAndMaterialCode(marketId, materialCode,warehouseId);
if(!Objects.isNull(stockListEntityList) && stockListEntityList.size() > 0){
for (DistributionStockListEntity stockListEntity:stockListEntityList){
UpdownStockVO vo = stockToUpdownStockVO(stockListEntity,warehouseId);
ls.add(vo);
}
}
}else if (2==stockType){
//物料名称
String materialName = value;
List<DistributionStockListEntity> stockListList = distributionStockListClient.getEntityByMarketIdAndMaterialName(marketId, materialName,warehouseId);
for (DistributionStockListEntity stockListEntity:stockListList){
ls.add(stockToUpdownStockVO(stockListEntity,warehouseId));
}
}else{
log.warn("#################getStockByParam: 未知的库存品查询类型");
}
return R.data(ls);
}
/**
* @param allList
* @param allocationId
* @param warehouseId
* @return
*/
@Override
@Transactional
public R upShelfStockList(List<UpShelfStockDTO> allList, Long allocationId, Long warehouseId) {
String collected = allList.stream().filter(f -> f.getEnterNum() <= 0).map(UpShelfStockDTO::getMaterialCode).collect(Collectors.joining(","));
if (Func.isNotBlank(collected)){
return Resp.scanFail(collected+"请输入正确的上架数量" , "请输入正确的上架数量, 物料编码为");
}
List<UpShelfStockDTO> upShelfStockList = allList;
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId);
if(Objects.isNull(goodsAllocationEntity)){
log.warn("##############upShelfOrder: 库位不存在 allocationId={}",allocationId);
return R.fail(403,"库位不存在");
}
String enableStatus = goodsAllocationEntity.getEnableStatus();
Long goodsShelfId = goodsAllocationEntity.getGoodsShelfId();
if("2".equals(enableStatus)){
log.warn("##############upShelfOrder: 库位已被禁用 allocationId={}",allocationId);
return R.fail(403,"库位已被禁用");
}
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient.getEntityByGoodsShelfId(goodsShelfId);
if(Objects.isNull(goodsShelfEntity)){
log.warn("##############upShelfOrder: 货架不存在 goodsShelfId={}",goodsShelfId);
return R.fail(403,"货架不存在");
}
Long goodsAreaId = goodsShelfEntity.getGoodsAreaId();
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient.getEntityByGoodsAreaId(goodsAreaId);
if(Objects.isNull(goodsAreaEntity)){
log.warn("##############upShelfOrder: 货区不存在 goodsAreaId={}",goodsAreaId);
return R.fail(403,"货区不存在");
}
String areaType = goodsAreaEntity.getAreaType();
if(!"1".equals(areaType)){
log.warn("#################upShelfOrder: 备货区不能上下架 goodsAreaId={}",goodsAreaId);
throw new CustomerException(403,"请扫描备货库位");
}
Long wid = goodsAreaEntity.getWarehouseId();
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(wid);
if(Objects.isNull(warehouseEntity)){
log.warn("##############upShelfOrder: 仓库不存在 wid={}",wid);
return R.fail(403,"仓库不存在");
}
if(!wid.equals(warehouseId)){
log.warn("##############upShelfOrder: 库位不在本仓库中 warehouseId={}",warehouseId);
return R.fail(403,"库位不在本仓库中");
}
QueryWrapper<WarehouseUpdownStockupAreaEntity> updownTypeQueryWrapper = new QueryWrapper<>();
updownTypeQueryWrapper
.eq("allocation_id",allocationId)
.eq("shelf_id",goodsShelfId)
.eq("area_id",goodsAreaId)
.eq("is_deleted",0);
List<WarehouseUpdownStockupAreaEntity> newUpShelfInventoryList = new ArrayList<>();
List<WarehouseUpdownStockupAreaLogEntity> newUpShelfInventoryLogList = new ArrayList<>();
for (UpShelfStockDTO upShelfStockDTO : upShelfStockList) {
updownTypeQueryWrapper.eq("materiel_code",upShelfStockDTO.getMaterialCode());
updownTypeQueryWrapper.eq("association_value",upShelfStockDTO.getMaterialCode());
updownTypeQueryWrapper.eq("incoming_batch",upShelfStockDTO.getIncomingBatch());
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = this.getOne(updownTypeQueryWrapper);
if (Func.isEmpty(updownStockupAreaEntity)){
//不存在备货库位上架,这里需要进行构建新的数据进行保存
WarehouseUpdownStockupAreaEntity warehouseUpdownStockupArea = createdNewUpShelfInventory(allocationId, warehouseId, upShelfStockDTO, updownStockupAreaEntity, goodsAreaId, goodsAreaEntity, goodsShelfId, goodsShelfEntity, goodsAllocationEntity);
newUpShelfInventoryList.add(warehouseUpdownStockupArea);
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func.copy(warehouseUpdownStockupArea, WarehouseUpdownStockupAreaLogEntity.class);
warehouseUpdownStockupAreaLogEntity.setBindingType(1);
newUpShelfInventoryLogList.add(warehouseUpdownStockupAreaLogEntity);
}else {
//存在,需要进行新的上架数量维护
int updateNum = updownStockupAreaEntity.getNum() + upShelfStockDTO.getEnterNum();
updownStockupAreaEntity.setNum(updateNum);
this.updateById(updownStockupAreaEntity);
WarehouseUpdownStockupAreaLogEntity warehouseUpdownStockupAreaLogEntity = Func.copy(updownStockupAreaEntity, WarehouseUpdownStockupAreaLogEntity.class);
warehouseUpdownStockupAreaLogEntity.setBindingType(1);
warehouseUpdownStockupAreaLogEntity.setId(null);
warehouseUpdownStockupAreaLogEntity.setNum(upShelfStockDTO.getEnterNum());
newUpShelfInventoryLogList.add(warehouseUpdownStockupAreaLogEntity);
}
}
if (Func.isNotEmpty(newUpShelfInventoryList)){
this.saveBatch(newUpShelfInventoryList);
}
if (Func.isNotEmpty(newUpShelfInventoryLogList)){
warehouseUpdownStockupAreaLogService.saveBatch(newUpShelfInventoryLogList);
}
int upShelfNum = newUpShelfInventoryLogList.stream().mapToInt(WarehouseUpdownStockupAreaLogEntity::getNum).sum();
String msg = "上架成功";
//更新货位缓存
warehouseGoodsAllocationClient.updateAllocationCache(allocationId.toString());
// if (sum>0){msg =msg+sum+"超出输入数量,或输入数量为0,请输入正确数量再进行操作";}
return Resp.scanSuccess(msg,"成功上架"+upShelfNum+"件");
}
private WarehouseUpdownStockupAreaEntity createdNewUpShelfInventory(Long allocationId, Long warehouseId, UpShelfStockDTO upShelfStockDTO, WarehouseUpdownStockupAreaEntity updownTypeEntity, Long goodsAreaId, BasicdataGoodsAreaEntity goodsAreaEntity, Long goodsShelfId, BasicdataGoodsShelfEntity goodsShelfEntity, BasicdataGoodsAllocationEntity goodsAllocationEntity) {
WarehouseUpdownStockupAreaEntity updownStockupAreaEntity = new WarehouseUpdownStockupAreaEntity();
updownStockupAreaEntity.setWarehouseId(warehouseId);
updownStockupAreaEntity.setAreaId(goodsAreaId);
updownStockupAreaEntity.setAreaTitle(goodsAreaEntity.getHeadline());
updownStockupAreaEntity.setShelfId(goodsShelfId);
updownStockupAreaEntity.setShelfTitle(goodsShelfEntity.getGoodsShelfName());
updownStockupAreaEntity.setAllocationId(allocationId);
updownStockupAreaEntity.setAllocationTitle(goodsAllocationEntity.getGoodsAllocationName());
updownStockupAreaEntity.setPositionCode(goodsAllocationEntity.getQrCode());
updownStockupAreaEntity.setAssociationValue(upShelfStockDTO.getMaterialCode());
updownStockupAreaEntity.setIncomingBatch(upShelfStockDTO.getIncomingBatch());
updownStockupAreaEntity.setAssociationType("3");
updownStockupAreaEntity.setUpdownType("物料");
updownStockupAreaEntity.setGoodsType("1");
updownStockupAreaEntity.setNum(upShelfStockDTO.getEnterNum());
updownStockupAreaEntity.setMarketId(upShelfStockDTO.getMarketId());
updownStockupAreaEntity.setMaterielCode(upShelfStockDTO.getMaterialCode());
updownStockupAreaEntity.setMaterielName(upShelfStockDTO.getMaterialName());
return updownStockupAreaEntity;
}
return upShelfAllocationVO;
private UpdownStockVO stockToUpdownStockVO(DistributionStockListEntity stockListEntity,Long warehouseId) {
Long marketId = stockListEntity.getMarketId();
// Long materialId = stockListEntity.getMaterialId();
Integer quantityStock = stockListEntity.getQuantityStock();
String cargoNumber = stockListEntity.getCargoNumber();//物料编码
String descriptionGoods = stockListEntity.getDescriptionGoods();//物料名称
String incomingBatch = stockListEntity.getIncomingBatch();//批次号
UpdownStockVO updownStockVO = new UpdownStockVO();
updownStockVO.setMaterialCode(cargoNumber);
updownStockVO.setMaterialName(descriptionGoods);
updownStockVO.setIncomingBatch(incomingBatch);
updownStockVO.setWaybillCode("");
updownStockVO.setOrderCode(stockListEntity.getOrderCode());
updownStockVO.setTotalNumber(stockListEntity.getQuantityStock());
List<PositionVO> updownGoodsByStock = warehouseUpdownGoodsService.getUpdownGoodsByStock(marketId, cargoNumber, incomingBatch,warehouseId);
List<PositionVO> trayGoodsByStock = warehouseTrayGoodsService.getTrayGoodsByStockNoAllocationId(marketId, cargoNumber, incomingBatch,warehouseId);
updownGoodsByStock.addAll(trayGoodsByStock);
for (PositionVO positionVO:updownGoodsByStock){
Integer num = positionVO.getNum();
quantityStock = quantityStock - num;
}
updownStockVO.setResidueNumber(quantityStock);
updownStockVO.setList(updownGoodsByStock);
updownStockVO.setGoodsType(3);
return updownStockVO;
}
}

Loading…
Cancel
Save