Browse Source

增加商场物料查询和修改、库存品查询

dev-pushdata-important
汤建军 1 year ago
parent
commit
ac1b0e9f4f
  1. 15
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionMerchantStockListVO.java
  2. 69
      blade-service/logpm-basic/src/main/java/com/logpm/basic/app/BasicMaterielPDAlController.java
  3. 42
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockListPDAController.java
  4. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java
  5. 18
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java
  6. 47
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml
  7. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java
  8. 86
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java

15
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionMerchantStockListVO.java

@ -0,0 +1,15 @@
package com.logpm.distribution.vo.app;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
public class DistributionMerchantStockListVO {
private String allocation;
private String trayName;
private Integer num;
}

69
blade-service/logpm-basic/src/main/java/com/logpm/basic/app/BasicMaterielPDAlController.java

@ -0,0 +1,69 @@
package com.logpm.basic.app;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.service.IBasicMaterialService;
import com.logpm.basic.service.impl.BasicMaterialServiceImpl;
import com.logpm.basic.vo.BasicMaterialVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@AllArgsConstructor
@RequestMapping("/app/materiel")
@Api(value = "配送管理", tags = "增值服务App接口")
public class BasicMaterielPDAlController {
private IBasicMaterialService basicMaterialService;
@GetMapping("/list")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询增值服务列表", notes = "DistributionAppDeliveryListDTO")
public R<List<BasicMaterialEntity>> list(@RequestParam String materielStr,@RequestParam Integer type) {
String tenantId = AuthUtil.getTenantId();
if (Func.isEmpty(tenantId)){
return null;
}
LambdaQueryWrapper<BasicMaterialEntity> apply = Wrappers.<BasicMaterialEntity>query().lambda()
.eq(BasicMaterialEntity::getTenantId, tenantId);
switch (type){
case 1:
if (Func.isNotEmpty(materielStr)){
apply.like(BasicMaterialEntity::getName, materielStr);
}
break;
case 2:
if (Func.isNotEmpty(materielStr)){
apply.like(BasicMaterialEntity::getProductCode, materielStr);
}
break;
}
List<BasicMaterialEntity> materialEntities = basicMaterialService.list(apply.last("limit 20"));
return R.data(materialEntities);
}
@PostMapping("/updateMateriel")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "PDA维护物料信息", notes = "DistributionStockListVO")
private R updateMateriel(@Valid @RequestBody BasicMaterialEntity basicMaterial){
boolean flag = basicMaterialService.updateById(basicMaterial);
return R.status(flag);
}
}

42
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockListPDAController.java

@ -0,0 +1,42 @@
package com.logpm.distribution.appcontroller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.distribution.service.IDistributionStockListService;
import com.logpm.distribution.vo.app.DistributionMerchantStockListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationContextFactory;
import org.springframework.boot.web.servlet.context.XmlServletWebServerApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/app/stocklist")
@AllArgsConstructor
@Api(value = "商家查看库存品", tags = "商家查看库存品")
public class DistributionStockListPDAController {
@GetMapping("/list")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "PDA查询库存品列表", notes = "DistributionStockListVO")
private R<List<DistributionMerchantStockListVO>> getMerchantStockList(@RequestParam String materielCode){
IDistributionStockListService distributionStockListService = SpringUtil.getBean(IDistributionStockListService.class);
List<DistributionMerchantStockListVO> stockListEntityList =distributionStockListService.getMerchantStockList(materielCode);
return R.data(stockListEntityList);
};
}

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

@ -16,7 +16,6 @@
*/
package com.logpm.distribution.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.distribution.dto.DistributionStockListDTO;
@ -38,7 +37,6 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;

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

@ -25,6 +25,7 @@ import com.logpm.distribution.vo.DistributionStockListAllocationVO;
import com.logpm.distribution.vo.DistributionStockListVO;
import com.logpm.distribution.vo.DistributionStockupStockListInfoVO;
import com.logpm.distribution.vo.StockListInfoListVO;
import com.logpm.distribution.vo.app.DistributionMerchantStockListVO;
import com.logpm.distribution.vo.app.StockMallVO;
import org.apache.ibatis.annotations.Param;
@ -134,4 +135,21 @@ public interface DistributionStockListMapper extends BaseMapper<DistributionStoc
* @param size
*/
void decreaseStockListQuantityOccupied(@Param("stockListId") Long stockListId,@Param("num") int num);
/**
* 查询商家端库存品
* @param tenantId
* @param materielCode
* @return
*/
List<DistributionStockListEntity> getMerchantStockList(@Param("tenantId") String tenantId,@Param("materielCode") String materielCode);
/**
* 查询商家有数据库存品信息
* @param id
* @return
*/
List<DistributionMerchantStockListVO> selectMerchantHaveDataStockListInfo(@Param("stockListId") Long stockListId);
List<DistributionMerchantStockListVO> selectMerchantNotHaveDataStockListInfo(@Param("stockListId")Long id);
}

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

@ -508,6 +508,53 @@
) t
LEFT JOIN logpm_distribution_stock_list ldsl ON ldsl.incoming_batch = t.order_code and ldsl.cargo_number=t.material_code
</select>
<select id="getMerchantStockList" resultType="com.logpm.distribution.entity.DistributionStockListEntity">
SELECT * FROM logpm_distribution_stock_list WHERE tenant_id = #{tenantId} AND cargo_number= #{materielCode}
</select>
<select id="selectMerchantHaveDataStockListInfo"
resultType="com.logpm.distribution.vo.app.DistributionMerchantStockListVO">
SELECT
lwga.qr_code AS allocation,
lwt.pallet_name AS trayName,
count( ldpl.order_package_code) AS num
FROM
logpm_distribution_stock_list AS ldsl
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldsl.incoming_batch = ldpl.order_code
AND ldpl.conditions = 2
LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON ldpl.order_package_code = lwtg.association_value AND lwtg.association_type = 3
LEFT JOIN logpm_warehouse_updown_goods AS lwug ON ldpl.order_package_code = lwug.association_value AND lwug.association_type = 3
LEFT JOIN logpm_warehouse_tray AS lwt ON lwt.id = lwtg.tray_id
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwug.allocation_id = lwga.id
WHERE
ldsl.id = #{stockListId}
GROUP BY
lwug.allocation_id,
lwtg.tray_id
</select>
<select id="selectMerchantNotHaveDataStockListInfo"
resultType="com.logpm.distribution.vo.app.DistributionMerchantStockListVO">
SELECT
lwga.qr_code AS allocation,
lwt.pallet_name AS trayName,
CASE
WHEN lwug.id is not null THEN lwug.num
WHEN lwtg.id is not null THEN lwtg.num
ELSE
ldsl.quantity_stock
END num
FROM
logpm_distribution_stock_list AS ldsl
LEFT JOIN logpm_warehouse_tray_goods AS lwtg ON ldsl.cargo_number = lwtg.association_value AND lwtg.association_type = 4 AND lwtg.incoming_batch = ldsl.incoming_batch
LEFT JOIN logpm_warehouse_updown_goods AS lwug ON ldsl.cargo_number = lwug.association_value AND lwug.association_type = 4 AND lwug.incoming_batch = ldsl.incoming_batch
LEFT JOIN logpm_warehouse_tray AS lwt ON lwt.id = lwtg.tray_id
LEFT JOIN logpm_warehouse_goods_allocation AS lwga ON lwug.allocation_id = lwga.id
WHERE
ldsl.id = #{stockListId}
GROUP BY
lwug.allocation_id,
lwtg.tray_id
</select>
<update id="updeteSourceTypeById" >
update logpm_distribution_stock_list

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

@ -21,6 +21,7 @@ import com.logpm.distribution.dto.DistributionStockListDTO;
import com.logpm.distribution.entity.DistributionStockListEntity;
import com.logpm.distribution.excel.DistributionStockListExcel;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.DistributionMerchantStockListVO;
import com.logpm.distribution.vo.app.StockMallVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
@ -168,14 +169,20 @@ public interface IDistributionStockListService extends BaseService<DistributionS
/**
* 查看指定二维码包条码
* @param stockListId
* @param packageId
* @return
*/
OrderPackgeCodeDataVO showInventorySourcePackageCode(String incomingBatch, Long packageIds) throws Exception;
void updeteSourceTypeById(String sourceType, Long stockListId);
/**
* 查询商家库存品信息
* @param materielCode
* @return
*/
List<DistributionMerchantStockListVO> getMerchantStockList(String materielCode);
// /**
// * 查询库存品详情

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

@ -34,11 +34,9 @@ import com.logpm.distribution.entity.*;
import com.logpm.distribution.excel.DistributionStockListExcel;
import com.logpm.distribution.mapper.DistributionReservationMapper;
import com.logpm.distribution.mapper.DistributionStockListMapper;
import com.logpm.distribution.service.IDistributionReservationStocklistService;
import com.logpm.distribution.service.IDistributionStockListInfoService;
import com.logpm.distribution.service.IDistributionStockListService;
import com.logpm.distribution.service.IDistributionUnpackingDetailsService;
import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.DistributionMerchantStockListVO;
import com.logpm.distribution.vo.app.StockMallVO;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient;
@ -51,6 +49,7 @@ import org.springblade.common.utils.TemplateUtil;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
@ -59,6 +58,8 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictBizCache;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -74,26 +75,34 @@ import java.util.stream.Collectors;
* @since 2023-06-15
*/
@Service
@AllArgsConstructor
@Slf4j
public class DistributionStockListServiceImpl extends BaseServiceImpl<DistributionStockListMapper, DistributionStockListEntity> implements IDistributionStockListService {
private final IDistributionUnpackingDetailsService distributionUnpackingDetailsService;
@Autowired
private IDistributionUnpackingDetailsService distributionUnpackingDetailsService;
@Autowired
private IBasicdataClientClient basicdataClientClient;
@Autowired
private IBasicdataWarehouseClient basicdataWarehouseClient;
@Autowired
private IBasicMaterialClient basicMaterialClient;
@Autowired
private final IBasicdataClientClient basicdataClientClient;
private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IBasicMaterialClient basicMaterialClient;
private final IDistributionStockListInfoService distributionStockListInfoService;
private IDistributionStockListInfoService distributionStockListInfoService;
// private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IDistributionReservationStocklistService reservationStocklistService;
private final IWarehouseTrayGoodsClient warehouseTrayGoodsClient;
@Autowired
private IDistributionReservationStocklistService reservationStocklistService;
@Autowired
private IWarehouseTrayGoodsClient warehouseTrayGoodsClient;
@Autowired
private IBasicPrintTemplateClient basicPrintTemplateClient;
private final DistributionReservationMapper distributionReservationMapper;
@Autowired
private DistributionReservationMapper distributionReservationMapper;
@Autowired
@Lazy
private IDistributionParcelListService distributionParcelListService;
@ -626,6 +635,51 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl<Distributi
public void updeteSourceTypeById(String sourceType, Long stockListId) {
baseMapper.updeteSourceTypeById(sourceType,stockListId);
}
@Override
public List<DistributionMerchantStockListVO> getMerchantStockList(String materielCode) {
BladeUser user = AuthUtil.getUser();
List<DistributionStockListEntity> stockListEntities = baseMapper.getMerchantStockList(user.getTenantId(),materielCode);
List<DistributionMerchantStockListVO> distributionMerchantStockListVOS = new ArrayList<>();
if (Func.isNotEmpty(stockListEntities)){
for (DistributionStockListEntity stockListEntity : stockListEntities) {
switch (stockListEntity.getSourceType()){
case "1":
//订单转入
List<DistributionMerchantStockListVO> merchantStockListVOS = baseMapper.selectMerchantHaveDataStockListInfo(stockListEntity.getId());
if (Func.isNotEmpty(merchantStockListVOS)){
distributionMerchantStockListVOS.addAll(merchantStockListVOS);
}
break;
case "2":
//数据导入
List<DistributionMerchantStockListVO> merchantNotHaveDataStockListVOS =baseMapper.selectMerchantNotHaveDataStockListInfo(stockListEntity.getId());
if (Func.isNotEmpty(merchantNotHaveDataStockListVOS)){
distributionMerchantStockListVOS.addAll(merchantNotHaveDataStockListVOS);
}
break;
}
}
}
if (Func.isNotEmpty(distributionMerchantStockListVOS)){
boolean flag = distributionMerchantStockListVOS.stream().anyMatch(m -> m.getTrayName() == null && m.getAllocation() == null);
if (flag){
//存在有无库位无托盘的库存品
//对无库位无托盘进行汇总
int sum = distributionMerchantStockListVOS.stream().filter(m -> m.getAllocation() == null && m.getTrayName() == null).mapToInt(DistributionMerchantStockListVO::getNum).sum();
List<DistributionMerchantStockListVO> collected = distributionMerchantStockListVOS.stream().filter(m -> m.getAllocation() == null && m.getTrayName() == null).collect(Collectors.toList());
DistributionMerchantStockListVO distributionMerchantStockListVO = new DistributionMerchantStockListVO();
distributionMerchantStockListVO.setNum(sum);
distributionMerchantStockListVOS = collected;
}
}
return distributionMerchantStockListVOS;
}
}
// @Override

Loading…
Cancel
Save