Browse Source

Merge remote-tracking branch 'origin/dev-warehouse' into dev-warehouse

# Conflicts:
#	blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java
dev-warehouse
0.0 2 years ago
parent
commit
e2f5490802
  1. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAllocationClient.java
  2. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  3. 8
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseUpdownGoodsEntity.java
  4. 9
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataGoodsAllocationClient.java
  5. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  6. 40
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java
  7. 13
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpShelfOrderDTO.java
  8. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpdownTypeDTO.java
  9. 3
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java
  10. 10
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml
  11. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownTypeMapper.java
  12. 18
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownTypeMapper.xml
  13. 7
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java
  14. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java
  15. 27
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java
  16. 153
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

2
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAllocationClient.java

@ -54,4 +54,6 @@ public interface IBasicdataGoodsAllocationClient {
@GetMapping(API_PREFIX+"/getEntityByAllocationCode")
BasicdataGoodsAllocationEntity getEntityByAllocationCode(@RequestParam("allocationCode") String allocationCode);
@PostMapping(API_PREFIX+"/updateAllocationStatus")
void updateAllocationStatus(@RequestParam("allocationId") Long allocationId, @RequestParam("allocationStatus") String allocationStatus);
}

3
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -65,4 +65,7 @@ public interface IDistributionParcelListClient {
@GetMapping(API_PREFIX+"/findEntityListByOrderCode")
List<DistributionParcelListEntity> findEntityListByOrderCode(@RequestParam String orderCode);
@GetMapping(API_PREFIX+"/findALLNoUpShelfPackageByOrderCode")
List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCode(@RequestParam String orderCode);
}

8
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseUpdownGoodsEntity.java

@ -33,19 +33,19 @@ public class WarehouseUpdownGoodsEntity extends TenantEntity {
private Long updownTypeId ;
/** 货区id */
@ApiModelProperty(name = "货区id",notes = "")
private String areaId ;
private Long areaId ;
/** 货区名称 */
@ApiModelProperty(name = "货区名称",notes = "")
private String areaTitle ;
/** 货架id */
@ApiModelProperty(name = "货架id",notes = "")
private String shelfId ;
private Long shelfId ;
/** 货架名称 */
@ApiModelProperty(name = "货架名称",notes = "")
private String shelfTitle ;
/** 货位id */
@ApiModelProperty(name = "货位id",notes = "")
private String allocationId ;
private Long allocationId ;
/** 货位名称 */
@ApiModelProperty(name = "货位名称",notes = "")
private String allocationTitle ;
@ -69,7 +69,7 @@ public class WarehouseUpdownGoodsEntity extends TenantEntity {
private String goodsName ;
/** 数量 */
@ApiModelProperty(name = "数量",notes = "")
private String num ;
private Integer num ;
/** 商场id */
@ApiModelProperty(name = "商场id",notes = "")
private Long marketId ;

9
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataGoodsAllocationClient.java

@ -16,6 +16,7 @@
*/
package com.logpm.basicdata.feign;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.basicdata.entity.BasicdataGoodsAllocationEntity;
import com.logpm.basicdata.service.IBasicdataGoodsAllocationService;
@ -65,4 +66,12 @@ public class BasicdataGoodsAllocationClient implements IBasicdataGoodsAllocation
return BasicdataGoodsAllocationService.getEntityByAllocationCode(allocationCode);
}
@Override
public void updateAllocationStatus(Long allocationId, String allocationStatus) {
UpdateWrapper<BasicdataGoodsAllocationEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("allocation_status",allocationStatus)
.eq("id",allocationId);
BasicdataGoodsAllocationService.update(updateWrapper);
}
}

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -88,4 +88,13 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
return distributionParcelListService.list(queryWrapper);
}
@Override
public List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCode(String orderCode) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_code",orderCode)
.eq("is_deleted",0)
.eq("order_package_grounding_status",10);
return distributionParcelListService.list(queryWrapper);
}
}

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

@ -1,6 +1,7 @@
package com.logpm.warehouse.api;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.warehouse.dto.UpShelfOrderDTO;
import com.logpm.warehouse.dto.UpdownTypeDTO;
import com.logpm.warehouse.service.IWarehouseUpdownTypeService;
import com.logpm.warehouse.vo.TragetAllocationVO;
@ -66,7 +67,7 @@ public class WarehouseUpdownTypeApiController {
@PostMapping("/upShelfScanAllocation")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "上架扫描库位", notes = "传入trayTypeDTO")
public R upShelfScanAllocation(@RequestBody UpdownTypeDTO updownTypeDTO) {
public R upShelfScanAllocation(@RequestBody UpdownTypeDTO updownTypeDTO ) {
String method = "###########upShelfScanAllocation: ";
log.info(method + "上架扫描库位 updownTypeDTO={}", updownTypeDTO);
String code = updownTypeDTO.getCode();//码值
@ -88,14 +89,37 @@ public class WarehouseUpdownTypeApiController {
}
}
// @ResponseBody
// @PostMapping("/upShelfScanAllocation")
// @ApiOperationSupport(order = 1)
// @ApiOperation(value = "上架扫描库位", notes = "传入trayTypeDTO")
// public R upShelfScanAllocation(@RequestBody UpdownTypeDTO updownTypeDTO) {
// String method = "###########upShelfScanAllocation: ";
// log.info(method + "上架扫描库位 updownTypeDTO={}", updownTypeDTO);
@ResponseBody
@PostMapping("/upShelfOrder")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "上架订单维度", notes = "传入trayTypeDTO")
public R upShelfOrder(@RequestBody UpdownTypeDTO updownTypeDTO ) {
String method = "###########upShelfOrder: ";
log.info(method + "上架订单维度 updownTypeDTO={}", updownTypeDTO);
List<UpShelfOrderDTO> upShelfOrderList = updownTypeDTO.getUpShelfOrderList();
String allocationCode = updownTypeDTO.getTargetAllocation();//库位码
try{
int size = upShelfOrderList.size();
if(size == 0 ){
log.warn(method+"没有处理的数据");
return R.fail(403,"无处理数据");
}
if(StringUtil.isBlank(allocationCode)){
log.warn(method+"库位信息不能为空 allocationCode={}",allocationCode);
return R.fail(403,"库位信息不能为空");
}
//查询该库位的货物信息
return warehouseUpdownTypeService.upShelfOrder(upShelfOrderList,allocationCode);
}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,"系统异常,联系管理员");
}
}

13
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/UpShelfOrderDTO.java

@ -0,0 +1,13 @@
package com.logpm.warehouse.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class UpShelfOrderDTO implements Serializable {
private String serviceNumber;//服务号
private String orderCode;//订单号
}

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

@ -3,6 +3,8 @@ package com.logpm.warehouse.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class UpdownTypeDTO implements Serializable {
@ -17,4 +19,6 @@ public class UpdownTypeDTO implements Serializable {
private Integer downShelfType;//下架类型 1按件下架 2按库位下架 3按托盘下架
private List<UpShelfOrderDTO> upShelfOrderList = new ArrayList<>();
}

3
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java

@ -58,6 +58,9 @@ public interface WarehouseUpdownGoodsMapper extends BaseMapper<WarehouseUpdownGo
List<UpShelfDataVO> findStockByUpdownTypeId(@Param("updownTypeId") Long updownTypeId);
List<WarehouseUpdownGoodsEntity> findListByUpdownTypeIdAndOrderCode(@Param("updownTypeId") Long updownTypeId, @Param("orderCode") String orderCode);
// /**
// * 根据货位查询货物
// *

10
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml

@ -121,4 +121,14 @@
and lwug.updown_type_id = #{updownTypeId}
</select>
<select id="findListByUpdownTypeIdAndOrderCode" resultType="com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity">
select lwug.*
from logpm_warehouse_updown_goods lwug
left join logpm_distribution_parcel_list ldpl on ldpl.id = lwug.association_id and ldpl.is_deleted = 0
where lwug.is_deleted = 0
and lwug.association_type = 3
and ldpl.order_code = #{orderCode}
and lwug.updown_type_id = #{updownTypeId}
</select>
</mapper>

4
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownTypeMapper.java

@ -14,4 +14,8 @@ public interface WarehouseUpdownTypeMapper extends BaseMapper<WarehouseUpdownTyp
List<GoodsVO> selectPackageListByUpdownTypeId(@Param("updownTypeId") Long updownTypeId);
List<GoodsVO> selectZeroListByUpdownTypeId(@Param("updownTypeId") Long updownTypeId);
void updateOrderTotalNumAndTotalNum(@Param("updownTypeId") Long updownTypeId, @Param("orderTotalNumber") Integer orderTotalNumber, @Param("quantity") Integer quantity);
void updateTotalNum(@Param("updownTypeId") Long updownTypeId, @Param("quantity") Integer quantity);
}

18
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownTypeMapper.xml

@ -28,4 +28,22 @@
and ldsa.is_zero = 1
</select>
<update id="updateOrderTotalNumAndTotalNum" >
update logpm_warehouse_updown_type
set total_num = total_num + #{quantity},
order_total_num = order_total_num + #{orderTotalNumber}
where id = #{updownTypeId}
and total_num + #{quantity} &gt;= 0
and order_total_num + #{orderTotalNumber} &gt;=0
</update>
<update id="updateTotalNum">
update logpm_warehouse_updown_type
set total_num = total_num + #{quantity}
where id = #{updownTypeId}
and total_num + #{quantity} &gt;= 0
</update>
</mapper>

7
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java

@ -17,7 +17,9 @@
package com.logpm.warehouse.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity;
import com.logpm.warehouse.vo.UpShelfDataVO;
import com.logpm.warehouse.vo.WarehouseUpdownGoodsVO;
import com.logpm.warehouse.excel.WarehouseUpdownGoodsExcel;
@ -69,4 +71,9 @@ public interface IWarehouseUpdownGoodsService extends BaseService<WarehouseUpdow
List<UpShelfDataVO> findZeroByUpdownTypeId(Long updownTypeId);
List<UpShelfDataVO> findStockByUpdownTypeId(Long updownTypeId);
List<WarehouseUpdownGoodsEntity> findListByUpdownTypeIdAndOrderCode(Long updownTypeId, String orderCode);
void bindingAllocationAndPackage(WarehouseUpdownTypeEntity updownTypeEntity, DistributionParcelListEntity parcelListEntity);
}

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

@ -1,10 +1,12 @@
package com.logpm.warehouse.service;
import com.logpm.warehouse.dto.UpShelfOrderDTO;
import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity;
import com.logpm.warehouse.vo.TragetAllocationVO;
import com.logpm.warehouse.vo.UpShelfAllocationVO;
import com.logpm.warehouse.vo.UpShelfDataVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import java.util.List;
@ -16,4 +18,6 @@ public interface IWarehouseUpdownTypeService extends BaseService<WarehouseUpdown
UpShelfAllocationVO upShelfScanAllocation(String code);
R upShelfOrder(List<UpShelfOrderDTO> upShelfOrderList,String allocationCode);
}

27
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java

@ -17,7 +17,9 @@
package com.logpm.warehouse.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity;
import com.logpm.warehouse.vo.UpShelfDataVO;
import com.logpm.warehouse.vo.WarehouseUpdownGoodsVO;
import com.logpm.warehouse.excel.WarehouseUpdownGoodsExcel;
@ -81,4 +83,29 @@ public class WarehouseUpdownGoodsServiceImpl extends BaseServiceImpl<WarehouseUp
return baseMapper.findStockByUpdownTypeId(updownTypeId);
}
@Override
public List<WarehouseUpdownGoodsEntity> findListByUpdownTypeIdAndOrderCode(Long updownTypeId, String orderCode) {
return baseMapper.findListByUpdownTypeIdAndOrderCode(updownTypeId,orderCode);
}
@Override
public void bindingAllocationAndPackage(WarehouseUpdownTypeEntity updownTypeEntity, DistributionParcelListEntity parcelListEntity) {
WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity();
updownGoodsEntity.setUpdownTypeId(updownTypeEntity.getId());
updownGoodsEntity.setAreaId(updownTypeEntity.getAreaId());
updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle());
updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId());
updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle());
updownGoodsEntity.setAllocationId(updownGoodsEntity.getAllocationId());
updownGoodsEntity.setAllocationTitle(updownGoodsEntity.getAllocationTitle());
updownGoodsEntity.setPositionCode(updownGoodsEntity.getPositionCode());
updownGoodsEntity.setGoodsType(updownGoodsEntity.getGoodsType());
updownGoodsEntity.setAssociationId(parcelListEntity.getId());
updownGoodsEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
updownGoodsEntity.setAssociationType("3");//包件
updownGoodsEntity.setGoodsName(updownGoodsEntity.getGoodsName());
updownGoodsEntity.setNum(parcelListEntity.getQuantity());
baseMapper.insert(updownGoodsEntity);
}
}

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

@ -7,7 +7,10 @@ import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
import com.logpm.distribution.feign.IDistributionStockArticleClient;
import com.logpm.warehouse.bean.Resp;
import com.logpm.warehouse.dto.UpShelfOrderDTO;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity;
import com.logpm.warehouse.mapper.WarehouseUpdownTypeMapper;
import com.logpm.warehouse.service.*;
@ -20,6 +23,8 @@ import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.apiwarehouse.PalletProductTypeConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -307,4 +312,152 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
return upShelfAllocationVO;
}
}
@Override
public R upShelfOrder(List<UpShelfOrderDTO> upShelfOrderList,String allocationCode) {
int num = 0;
Long trayId = null;
//判断货位是否有托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocation(allocationCode);
if(!Objects.isNull(trayEntity)){
trayId = trayEntity.getId();
}
for (UpShelfOrderDTO upShelfOrderDTO:upShelfOrderList){
String orderCode = upShelfOrderDTO.getOrderCode();
if(StringUtil.isBlank(orderCode)){
log.warn("##############upShelfOrder: 订单号不存在 orderCode={}",orderCode);
continue;
}
//查询所有该订单号未上架的数据
List<DistributionParcelListEntity> parcelListList = distributionParcelListClient.findALLNoUpShelfPackageByOrderCode(orderCode);
for (DistributionParcelListEntity parcelListEntity:parcelListList){
//包件级别的上架
if(Objects.isNull(trayId)){
//如果没有托盘就直接存入库位上
upShelfPackageNoTray(parcelListEntity,allocationCode);
}else{
//如果有托盘就存入库位和托盘上
}
}
}
return Resp.scanSuccess("处理成功","处理成功"+num+"条");
}
private void upShelfPackageNoTray(DistributionParcelListEntity parcelListEntity, String allocationCode) {
log.info("###########upShelfPackageNoTray: 上架包件没有托盘 orderPackageCode={} allocationCode={}",parcelListEntity.getOrderPackageCode(),allocationCode);
//修改上架方式的数量
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationCode(allocationCode);
if(Objects.isNull(goodsAllocationEntity)){
log.warn("##############upShelfOrder: 库位不存在 allocationCode={}",allocationCode);
throw new CustomerException(403,"库位不存在");
}
Long allocationId = goodsAllocationEntity.getId();//库位id
String enableStatus = goodsAllocationEntity.getEnableStatus();
if("2".equals(enableStatus)){
log.warn("##############upShelfOrder: 库位已被禁用 allocationCode={}",allocationCode);
throw new CustomerException(403,"库位已被禁用");
}
QueryWrapper<WarehouseUpdownTypeEntity> updownTypeEntityQueryWrapper = new QueryWrapper<>();
updownTypeEntityQueryWrapper.eq("allocation_id",allocationId)
.eq("is_deleted",0);
WarehouseUpdownTypeEntity updownTypeEntity = baseMapper.selectOne(updownTypeEntityQueryWrapper);
if(Objects.isNull(updownTypeEntity)){
updownTypeEntity = createUpdownType(goodsAllocationEntity);
}
Long updownTypeId = updownTypeEntity.getId();//上架方式id
//修改上架方式上的数据
updateUpdownTypeNumPackage(updownTypeEntity,parcelListEntity,"1");
//货物和库位绑定
warehouseUpdownGoodsService.bindingAllocationAndPackage(updownTypeEntity,parcelListEntity);
//存入包件货物上架记录
}
private void updateUpdownTypeNumPackage(WarehouseUpdownTypeEntity updownTypeEntity, DistributionParcelListEntity parcelListEntity, String addStatus) {
String orderCode = parcelListEntity.getOrderCode();
Integer quantity = parcelListEntity.getQuantity();
Long updownTypeId = updownTypeEntity.getId();
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCode(orderCode);
if(Objects.isNull(stockArticleEntity)){
log.warn("##############updateUpdownTypeNumPackage: 订单信息不存在 orderCode={}",orderCode);
throw new CustomerException(403,"订单信息不存在");
}
Integer orderTotalNumber = stockArticleEntity.getTotalNumber();
//查询该订单在该上架方式下的包件还有几条数据
List<WarehouseUpdownGoodsEntity> ls = warehouseUpdownGoodsService.findListByUpdownTypeIdAndOrderCode(updownTypeId,orderCode);
int size = ls.size();
if("1".equals(addStatus)){
if(size==0){
baseMapper.updateOrderTotalNumAndTotalNum(updownTypeId,orderTotalNumber,quantity);
}else{
baseMapper.updateTotalNum(updownTypeId,quantity);
}
}else if("2".equals(addStatus)){
if(size==0){
log.warn("##############updateUpdownTypeNumPackage: 数据格式问题 updownTypeId={} orderCode={}",updownTypeId,orderCode);
throw new CustomerException(403,"数据格式问题");
}else if(size > 1){
//如果库中有至少2条数据,那么去掉一条也不会影响改订单的总数变化,所以只减去包件的数量
baseMapper.updateTotalNum(updownTypeId,-quantity);
}else{
//如果库中有至少2条数据,那么去掉一条也不会影响改订单的总数变化,所以只减去包件的数量
baseMapper.updateOrderTotalNumAndTotalNum(updownTypeId,-orderTotalNumber,-quantity);
}
}
}
/**
* 创建库位
*/
private WarehouseUpdownTypeEntity createUpdownType(BasicdataGoodsAllocationEntity goodsAllocationEntity) {
Long goodsShelfId = goodsAllocationEntity.getGoodsShelfId();//货架id
Long allocationId = goodsAllocationEntity.getId();
String goodsAllocationName = goodsAllocationEntity.getGoodsAllocationName();
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfClient.getEntityByGoodsShelfId(goodsShelfId);
if(Objects.isNull(goodsShelfEntity)){
log.warn("##############createUpdownType: 货架不存在 goodsShelfId={}",goodsShelfId);
throw new CustomerException(403,"货架不存在");
}
String goodsShelfName = goodsShelfEntity.getGoodsShelfName();
Long goodsAreaId = goodsShelfEntity.getGoodsAreaId();
BasicdataGoodsAreaEntity goodsAreaEntity = basicdataGoodsAreaClient.getEntityByGoodsAreaId(goodsAreaId);
if(Objects.isNull(goodsAreaEntity)){
log.warn("##############createUpdownType: 货区不存在 goodsAreaId={}",goodsAreaId);
throw new CustomerException(403,"货区不存在");
}
String headline = goodsAreaEntity.getHeadline();
Long warehouseId = goodsAreaEntity.getWarehouseId();
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
if(Objects.isNull(warehouseEntity)){
log.warn("##############createUpdownType: 仓库不存在 warehouseId={}",warehouseId);
throw new CustomerException(403,"仓库不存在");
}
WarehouseUpdownTypeEntity updownTypeEntity = new WarehouseUpdownTypeEntity();
updownTypeEntity.setUpdownType("100");
updownTypeEntity.setAreaId(goodsAreaId);
updownTypeEntity.setAreaTitle(headline);
updownTypeEntity.setShelfId(goodsShelfId);
updownTypeEntity.setShelfTitle(goodsShelfName);
updownTypeEntity.setAllocationId(allocationId);
updownTypeEntity.setAllocationTitle(goodsAllocationName);
updownTypeEntity.setPositionCode(headline+"-"+goodsShelfName+"-"+goodsAllocationName);
updownTypeEntity.setTotalNum(0);
updownTypeEntity.setOrderTotalNum(0);
updownTypeEntity.setStockNum(0);
updownTypeEntity.setStockTotalNum(0);
baseMapper.insert(updownTypeEntity);
//修改库位状态为有货
basicdataGoodsAllocationClient.updateAllocationStatus(allocationId,"2");
return updownTypeEntity;
}
}

Loading…
Cancel
Save