diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionMerchantStockListVO.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistributionMerchantStockListVO.java new file mode 100644 index 000000000..af6f6f0ce --- /dev/null +++ b/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; +} diff --git a/blade-service/logpm-basic/src/main/java/com/logpm/basic/app/BasicMaterielPDAlController.java b/blade-service/logpm-basic/src/main/java/com/logpm/basic/app/BasicMaterielPDAlController.java new file mode 100644 index 000000000..19bf6c8f4 --- /dev/null +++ b/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(@RequestParam String materielStr,@RequestParam Integer type) { + String tenantId = AuthUtil.getTenantId(); + if (Func.isEmpty(tenantId)){ + return null; + } + LambdaQueryWrapper apply = Wrappers.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 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); + } + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockListPDAController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockListPDAController.java new file mode 100644 index 000000000..527303f46 --- /dev/null +++ b/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> getMerchantStockList(@RequestParam String materielCode){ + IDistributionStockListService distributionStockListService = SpringUtil.getBean(IDistributionStockListService.class); + List stockListEntityList =distributionStockListService.getMerchantStockList(materielCode); + return R.data(stockListEntityList); + }; + + + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java index 80863dd0b..9b7721b79 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockListController.java +++ b/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.*; diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java index 415c792ff..1f5b965bd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java +++ b/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 getMerchantStockList(@Param("tenantId") String tenantId,@Param("materielCode") String materielCode); + + /** + * 查询商家有数据库存品信息 + * @param id + * @return + */ + List selectMerchantHaveDataStockListInfo(@Param("stockListId") Long stockListId); + + List selectMerchantNotHaveDataStockListInfo(@Param("stockListId")Long id); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml index d62f25cd4..53fd57982 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml +++ b/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 + + + update logpm_distribution_stock_list diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java index ac7a33ed4..8352d6588 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java +++ b/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 getMerchantStockList(String materielCode); + + // /** // * 查询库存品详情 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java index c75f1a8ae..39f7dcf9b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java +++ b/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 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 getMerchantStockList(String materielCode) { + BladeUser user = AuthUtil.getUser(); + List stockListEntities = baseMapper.getMerchantStockList(user.getTenantId(),materielCode); + List distributionMerchantStockListVOS = new ArrayList<>(); + if (Func.isNotEmpty(stockListEntities)){ + for (DistributionStockListEntity stockListEntity : stockListEntities) { + switch (stockListEntity.getSourceType()){ + case "1": + //订单转入 + List merchantStockListVOS = baseMapper.selectMerchantHaveDataStockListInfo(stockListEntity.getId()); + if (Func.isNotEmpty(merchantStockListVOS)){ + distributionMerchantStockListVOS.addAll(merchantStockListVOS); + } + break; + case "2": + //数据导入 + List 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 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