Browse Source

修改库存品查询

dev-warehouse
caoyizhong 2 years ago
parent
commit
bf6bd8934f
  1. 21
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java
  2. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionUnpackingDetailsEntity.java
  3. 19
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java
  4. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionStockListDTO.java
  5. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java
  6. 64
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml
  7. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java
  8. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  9. 110
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java

21
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockListEntity.java

@ -98,6 +98,11 @@ public class DistributionStockListEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "货物名称") @ApiModelProperty(value = "货物名称")
private String descriptionGoods; private String descriptionGoods;
/**
* 货物规则
*/
@ApiModelProperty(value = "货物规则")
private String cargoNorms;
/** /**
* 车牌 * 车牌
@ -252,6 +257,11 @@ public class DistributionStockListEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "门店名称") @ApiModelProperty(value = "门店名称")
private String storeName; private String storeName;
/**
* SKU
*/
@ApiModelProperty(value = "SKu")
private String sku;
/** /**
* 冻结数量 * 冻结数量
*/ */
@ -263,6 +273,17 @@ public class DistributionStockListEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "拆包ID") @ApiModelProperty(value = "拆包ID")
private Long pid; private Long pid;
/**
* 托盘ID
*/
@ApiModelProperty(value = "托盘ID")
private Long trayId;
/**
* 托盘名称
*/
@ApiModelProperty(value = "托盘名称")
private Long trayName;

4
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionUnpackingDetailsEntity.java

@ -75,7 +75,7 @@ public class DistributionUnpackingDetailsEntity extends TenantEntity {
* 订单ID * 订单ID
*/ */
@ApiModelProperty(value = "订单ID") @ApiModelProperty(value = "订单ID")
private String stockArticleId; private Long stockArticleId;
/** /**
* 库存品Id * 库存品Id
*/ */
@ -96,7 +96,7 @@ public class DistributionUnpackingDetailsEntity extends TenantEntity {
*/ */
@ApiModelProperty(value = "拆包数量") @ApiModelProperty(value = "拆包数量")
private Integer unpackingQuantity; private Integer unpackingQuantity;
public DistributionUnpackingDetailsEntity(String stockArticleId, String orderSelfNumber, Long stockListId, String itemName, Integer unpackingQuantity){ public DistributionUnpackingDetailsEntity(Long stockArticleId, String orderSelfNumber, Long stockListId, String itemName, Integer unpackingQuantity){
this.stockArticleId = stockArticleId; this.stockArticleId = stockArticleId;
this.orderSelfNumber = orderSelfNumber; this.orderSelfNumber = orderSelfNumber;
this.stockListId = stockListId; this.stockListId = stockListId;

19
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java

@ -16,6 +16,7 @@
*/ */
package com.logpm.distribution.controller; package com.logpm.distribution.controller;
import com.logpm.distribution.dto.DistributionStockListDTO;
import com.logpm.distribution.excel.StockListImporter; import com.logpm.distribution.excel.StockListImporter;
import com.logpm.distribution.vo.DistributionStockArticleVO; import com.logpm.distribution.vo.DistributionStockArticleVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -82,6 +83,18 @@ public class DistributionStockListController extends BladeController {
return R.data(pages); return R.data(pages);
} }
/**
* 库存品管理 分页自己
*/
@GetMapping("/listOwn")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入distributionStockList")
public R<IPage<DistributionStockListVO>> listOwn(@ApiIgnore @RequestParam Map<String, Object> distributionStockList, Query query) {
IPage<DistributionStockListVO> pages = distributionStockListService.pageOwn(Condition.getPage(query), distributionStockList);
return R.data(pages);
}
/** /**
* 库存品管理 自定义分页 * 库存品管理 自定义分页
*/ */
@ -125,11 +138,11 @@ public class DistributionStockListController extends BladeController {
/** /**
* 库存品管理 拆包 * 库存品管理 拆包
*/ */
@PostMapping("/parcels") @PostMapping("/parcels")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入distributionStockList") @ApiOperation(value = "新增或修改", notes = "传入distributionStockList")
public R parcels(@Valid @RequestBody DistributionStockListEntity distributionStockList) { public R parcels(@Valid @RequestBody DistributionStockListDTO distributionStockListDTO) {
return R.status(distributionStockListService.parcels(distributionStockList)); return R.status(distributionStockListService.parcels(distributionStockListDTO));
} }
/** /**

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/dto/DistributionStockListDTO.java

@ -36,4 +36,9 @@ public class DistributionStockListDTO extends DistributionStockListEntity {
*/ */
private Integer inventoryQuantity; private Integer inventoryQuantity;
/* //物料id
private String materialId;*/
//入库个数
private Integer storeNum;
} }

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java

@ -51,4 +51,5 @@ public interface DistributionStockListMapper extends BaseMapper<DistributionStoc
*/ */
List<DistributionStockListExcel> exportDistributionStockList(@Param("ew") Wrapper<DistributionStockListEntity> queryWrapper); List<DistributionStockListExcel> exportDistributionStockList(@Param("ew") Wrapper<DistributionStockListEntity> queryWrapper);
IPage<DistributionStockListVO> pageOwn(IPage page,@Param("param") DistributionStockListEntity distributionStockListEntity);
} }

64
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml

@ -22,7 +22,7 @@
<result column="Incoming_batch" property="incomingBatch"/> <result column="Incoming_batch" property="incomingBatch"/>
<result column="description_goods" property="descriptionGoods"/> <result column="description_goods" property="descriptionGoods"/>
<result column="cargo_number" property="cargoNumber"/> <result column="cargo_number" property="cargoNumber"/>
<result column="warehouse" property="warehouse"/> <result column="warehouse" property="warehouseId"/>
<!-- <result column="market" property="market"/>--> <!-- <result column="market" property="market"/>-->
<result column="cargo_unit" property="cargoUnit"/> <result column="cargo_unit" property="cargoUnit"/>
<result column="storage_location" property="storageLocation"/> <result column="storage_location" property="storageLocation"/>
@ -44,4 +44,66 @@
SELECT * FROM logpm_distribution_stock_list ${ew.customSqlSegment} SELECT * FROM logpm_distribution_stock_list ${ew.customSqlSegment}
</select> </select>
<select id="pageOwn" resultType="com.logpm.distribution.vo.DistributionStockListVO">
select ldsi.service_number serviceNumber,ldsi.service_type serviceType,ldsi.description_goods descriptionGoods,ldsi.cargo_number cargoNumber,ldsi.despatch ,ldsi.incoming_batch incomingBatch,
CASE WHEN ldsi.pid is null THEN
(select sum(l.quantity_stock)
from logpm_distribution_stock_list l
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id and l.pid is null )
ELSE (select sum(l.quantity_stock)
from logpm_distribution_stock_list l
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id and l.pid is not null )
END 'quantityStock',
CASE WHEN ldsi.pid is null THEN
(select count(ldrs.reservation_num)
FROM logpm_distribution_reservation_stocklist ldrs
where ldrs.stocklist_id in (select l.id
from logpm_distribution_stock_list l
where l.market_id =ldsi.market_id and l.material_id = ldsi.material_id and l.pid is null))
ELSE (select count(ldrs.reservation_num)
FROM logpm_distribution_reservation_stocklist ldrs
where ldrs.stocklist_id in (select l.id
from logpm_distribution_stock_list l
where l.market_id =ldsi.market_id and l.material_id = ldsi.material_id and l.pid is not null))
END 'quantityOccupied',
CASE WHEN ldsi.pid is null THEN
(select sum(l.outbound_quantity)
from logpm_distribution_stock_list l
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id AND l.pid is null)
else (select sum(l.outbound_quantity)
from logpm_distribution_stock_list l
where l.market_id = ldsi.market_id and l.material_id = ldsi.material_id and l.pid is not null)
END 'outboundQuantity',
ldsi.brand_name brandName,ldsi.market_name marketName,ldsi.store_name storeName,ldsi.warehouse_name warehouseName,ldsi.cargo_unit cargoUnit,
CASE WHEN ldsi.pid is null THEN
(select count(*)
from logpm_distribution_stock_list lds
where lds.pid in (select l.id
from logpm_distribution_stock_list l
where l.market_id =ldsi.market_id and l.material_id = ldsi.material_id and l.pid is null ))
ELSE (select count(*)
from logpm_distribution_stock_list lds
where lds.pid in (select l.id
from logpm_distribution_stock_list l
where l.market_id =ldsi.market_id and l.material_id = ldsi.material_id and l.pid is not null ))
END 'unpack',
ldsi.market_id marketId,ldsi.store_id storeId,ldsi.material_id materialId,ldsi.id,ldsi.unpacking_quantity unpackingQuantity
from logpm_distribution_stock_list ldsi
<where>
<if test=" param.serviceNumber != null and param.serviceNumber != ''"> and ldsi.service_number like concat('%',#{param.serviceNumber},'%') </if>
<if test=" param.serviceType != null and param.serviceType != ''"> and ldsi.service_type = #{param.serviceType}</if>
<if test=" param.descriptionGoods != null and param.descriptionGoods != ''"> and ldsi.description_goods like concat('%', #{param.descriptionGoods},'%')</if>
<if test=" param.cargoNumber != null and param.cargoNumber != ''"> and ldsi.cargo_number like concat('%',#{param.cargoNumber},'%')</if>
<if test=" param.despatch != null and param.despatch != ''"> and ldsi.despatch like concat('%', #{param.despatch},'%')</if>
<if test=" param.incomingBatch != null and param.incomingBatch != ''"> and ldsi.incoming_batch like concat('%', #{param.incomingBatch},'%')</if>
<if test=" param.brandName != null and param.brandName != ''"> and ldsi.brand_name like concat('%',#{param.brandName},'%')</if>
<if test=" param.marketName != null and param.marketName != ''"> and ldsi.market_name like concat('%',#{param.marketName},'%')</if>
<if test=" param.storeName != null and param.storeName != ''"> and ldsi.store_name like concat('%',#{param.storeName},'%')</if>
<if test=" param.warehouseName != null and param.warehouseName != ''"> and ldsi.warehouse_name like concat('%',#{param.warehouseName},'%')</if>
<if test=" param.unpack != null and param.unpack != ''"> and ldsi.unpack = #{param.unpack}</if>
</where>
</select>
</mapper> </mapper>

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java

@ -17,6 +17,7 @@
package com.logpm.distribution.service; package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.logpm.distribution.dto.DistributionStockListDTO;
import com.logpm.distribution.entity.DistributionStockListEntity; import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.vo.DistributionStockArticleVO; import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.DistributionStockListVO; import com.logpm.distribution.vo.DistributionStockListVO;
@ -26,6 +27,7 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 库存品管理 服务类 * 库存品管理 服务类
@ -68,9 +70,11 @@ public interface IDistributionStockListService extends BaseService<DistributionS
*/ */
void importUser(List<DistributionStockListExcel> data, Boolean isCovered); void importUser(List<DistributionStockListExcel> data, Boolean isCovered);
Boolean parcels(DistributionStockListEntity distributionStockList); Boolean parcels(DistributionStockListDTO distributionStockListDTO);
DistributionStockListVO getQueryData(Long storeId, Long clientId,Long materialId); DistributionStockListVO getQueryData(Long storeId, Long clientId,Long materialId);
Boolean getAddStockList(DistributionStockListEntity distributionStockListEntity); Boolean getAddStockList(DistributionStockListEntity distributionStockListEntity);
IPage<DistributionStockListVO> pageOwn(IPage<Object> page, Map<String, Object> distributionStockList);
} }

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -260,7 +260,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
distributionStockListEntity.setStorageLocation(Optional.ofNullable(distributionParcelList.getGoodsAllocation()).orElse(null)); //库位信息 distributionStockListEntity.setStorageLocation(Optional.ofNullable(distributionParcelList.getGoodsAllocation()).orElse(null)); //库位信息
distributionStockListEntity.setMallName(Optional.ofNullable(distributionStockArticleEntity.getMallName()).orElse(null)); //商场名称 distributionStockListEntity.setMallName(Optional.ofNullable(distributionStockArticleEntity.getMallName()).orElse(null)); //商场名称
distributionStockListEntity.setQuantityStock(Optional.ofNullable(distributionStockArticleEntity.getHandQuantity()).orElse(null)); //库存数量 distributionStockListEntity.setQuantityStock(Optional.ofNullable(distributionStockArticleEntity.getHandQuantity()).orElse(null)); //库存数量
distributionStockListEntity.setOutboundQuantity(Optional.ofNullable(distributionStockArticleEntity.getHandQuantity()).orElse(null)); //出库数量 distributionStockListEntity.setOutboundQuantity(0); //出库数量
distributionStockListEntity.setDespatch(Optional.ofNullable(distributionStockArticleEntity.getTrainNumber()).orElse(null));//车次号 distributionStockListEntity.setDespatch(Optional.ofNullable(distributionStockArticleEntity.getTrainNumber()).orElse(null));//车次号
distributionStockListEntity.setUnit(Optional.ofNullable(distributionParcelList.getMaterialUnit()).orElse(null));//单位 distributionStockListEntity.setUnit(Optional.ofNullable(distributionParcelList.getMaterialUnit()).orElse(null));//单位
distributionStockListEntity.setStoreId( Optional.ofNullable(distributionStockArticleEntity.getStoreId()).orElse(null) );//门店ID distributionStockListEntity.setStoreId( Optional.ofNullable(distributionStockArticleEntity.getStoreId()).orElse(null) );//门店ID

110
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java

@ -16,8 +16,10 @@
*/ */
package com.logpm.distribution.service.impl; package com.logpm.distribution.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basic.feign.IBasicTenantCodeClient; import com.logpm.basic.feign.IBasicTenantCodeClient;
import com.logpm.distribution.dto.DistributionStockListDTO;
import com.logpm.distribution.entity.*; import com.logpm.distribution.entity.*;
import com.logpm.distribution.service.*; import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.DistributionStockArticleVO; import com.logpm.distribution.vo.DistributionStockArticleVO;
@ -34,9 +36,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@ -113,56 +113,62 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl<Distributi
/** /**
* *
* @param distributionStockList * @param distributionStockListDTO
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean parcels(DistributionStockListEntity distributionStockList) { public Boolean parcels(DistributionStockListDTO distributionStockListDTO) {
List<DistributionStockEntity> list = new ArrayList<>(); //查询客户是不是有该物资的拆包
List<DistributionUnpackingDetailsEntity> detailsEntities = new ArrayList<>(); DistributionStockListEntity one2 = this.getOne(Wrappers.<DistributionStockListEntity>query().lambda()
distributionStockList.getParcels().forEach( i ->{ .eq(DistributionStockListEntity::getPid, distributionStockListDTO.getId())
//查询包件信息 .eq(DistributionStockListEntity::getMaterialId, distributionStockListDTO.getMaterialId())
DistributionParcelDetailsEntity one = distributionParcelDetailsService.getOne(Wrappers.<DistributionParcelDetailsEntity>query().lambda() .eq(DistributionStockListEntity::getMarketId, distributionStockListDTO.getMarketId())
.eq(DistributionParcelDetailsEntity::getId, i.getParcelsId()) .eq(ObjectUtil.isNotEmpty(distributionStockListDTO.getStoreId()), DistributionStockListEntity::getStoreId, distributionStockListDTO.getStoreId())
.eq(DistributionParcelDetailsEntity::getIsDeleted, 0) );
); //客户物资信息
for (Integer integer = 0; integer < i.getUnpackingQuantity(); integer++) { DistributionStockListEntity one = this.getOne(Wrappers.<DistributionStockListEntity>query().lambda()
//添加拆包信息 .eq(DistributionStockListEntity::getId, distributionStockListDTO.getId())
DistributionStockEntity distributionStock = new DistributionStockEntity(); /*.eq(DistributionStockListEntity::getMarketId, distributionStockListDTO.getMarketId())
distributionStock.setStockListId(Long.parseLong(one.getStockArticleId())); .eq(ObjectUtil.isNotEmpty(distributionStockListDTO.getStoreId()), DistributionStockListEntity::getStoreId, distributionStockListDTO.getStoreId())
distributionStock.setParcelListId(Long.parseLong(one.getParcelListId())); .isNull(DistributionStockListEntity::getPid)*/
distributionStock.setConditions(1); //1 在库 );
distributionStock.setUnpackingQuantity(1); if(ObjectUtil.isNotEmpty(one2)){
distributionStock.setUnit(one.getUnit()); //有修改
distributionStock.setGoodsAllocation(one.getGoodsAllocation()); DistributionStockListEntity d = new DistributionStockListEntity();
// String s1 = basicTenantCodeClient.shelfCode(AuthUtil.getTenantId(), "7"); d.setId(one2.getId());
String random = Func.random(15, RandomType.INT); int i = one2.getQuantityStock() + distributionStockListDTO.getStoreNum();
// distributionStock.setCoding(s1+random); d.setQuantityStock(i);
distributionStock.setCoding(random); this.updateById(d);
list.add(distributionStock);
//添加拆包记录 }else{
DistributionStockListEntity one1 = baseMapper.selectById( distributionStockList.getId()); //没有新增
DistributionUnpackingDetailsEntity distributionUnpackingDetails= new DistributionUnpackingDetailsEntity(one.getStockArticleId(),one1.getOrderSelfNumbering(),distributionStockList.getId(),one.getName(),i.getUnpackingQuantity()); DistributionStockListEntity distributionStockListEntity = new DistributionStockListEntity();
detailsEntities.add(distributionUnpackingDetails); BeanUtils.copyProperties(one,distributionStockListEntity);
} distributionStockListEntity.setPid(one.getId());
}); distributionStockListEntity.setSku(distributionStockListDTO.getSku());
if(list.size() > 0){ distributionStockListEntity.setQuantityStock(distributionStockListDTO.getStoreNum());
//修改库存品信息 distributionStockListEntity.setUnpackingQuantity(0);
int total = distributionStockList.getParcels().stream().mapToInt(DistributionStockEntity::getUnpackingQuantity).sum(); distributionStockListEntity.setId(null);
DistributionStockListEntity distributionStockList1 = new DistributionStockListEntity(); this.save(distributionStockListEntity);
distributionStockList1.setId(distributionStockList.getId());
distributionStockList1.setUnpack(true);
distributionStockList1.setQuantityStock(total);
distributionStockList1.setOutboundQuantity(0);
baseMapper.updateById(distributionStockList1);
//添加拆包
distributionStockService.saveBatch(list);
}
if(detailsEntities.size() > 0){
//添加拆包记录
distributionUnpackingDetailsService.saveBatch(detailsEntities);
} }
//修改客户物资记录
DistributionStockListEntity distributionStockListEntity = new DistributionStockListEntity();
distributionStockListEntity.setId(one.getId());
distributionStockListEntity.setQuantityStock(one.getQuantityStock()-distributionStockListDTO.getUnpackingQuantity());
distributionStockListEntity.setUnpackingQuantity(distributionStockListDTO.getUnpackingQuantity());
baseMapper.updateById(distributionStockListEntity);
//添加拆包记录
DistributionUnpackingDetailsEntity distributionUnpackingDetails= new DistributionUnpackingDetailsEntity();
distributionUnpackingDetails.setStockArticleId(Optional.ofNullable(one.getStockArticleId()).orElse(null));
distributionUnpackingDetails.setOrderSelfNumber(Optional.ofNullable(one.getOrderSelfNumbering()).orElse(null));
distributionUnpackingDetails.setItemName(Optional.ofNullable(one.getDescriptionGoods()).orElse(null));
distributionUnpackingDetails.setUnpackingQuantity(Optional.ofNullable(one.getUnpackingQuantity()).orElse(null));
distributionUnpackingDetails.setStockListId(Optional.ofNullable(distributionStockListDTO.getId()).orElse(null));
distributionUnpackingDetailsService.save(distributionUnpackingDetails);
return true; return true;
} }
@ -211,4 +217,12 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl<Distributi
return this.save(distributionStockList); return this.save(distributionStockList);
} }
@Override
public IPage<DistributionStockListVO> pageOwn(IPage<Object> page, Map<String, Object> distributionStockList) {
DistributionStockListEntity distributionStockListEntity = JSONObject.parseObject(JSONObject.toJSONString(distributionStockList), DistributionStockListEntity.class);
IPage<DistributionStockListVO> page1= baseMapper.pageOwn(page,distributionStockListEntity);
return page1;
}
} }

Loading…
Cancel
Save