From af525b736988f06412651d4056858affb62ab29c Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Tue, 24 Oct 2023 17:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=A2=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/DictBizConstant.java | 2 + .../BasicdataStorageServicesEntity.java | 2 +- .../controller/BasicdataClientController.java | 15 ++ .../excel/BasicDataClienImporter.java | 20 ++ .../basicdata/excel/BasicdataClientExcel.java | 107 +++++--- .../service/IBasicdataClientService.java | 2 + .../service/IBasicdataWarehouseService.java | 4 + .../impl/BasicdataClientServiceImpl.java | 239 +++++++++++++++++- .../mapper/DistrilbutionBillStockMapper.xml | 2 +- .../impl/DistributionAsyncServiceImpl.java | 34 ++- .../impl/DistributionStockServiceImpl.java | 16 +- .../impl/DistributionStockupServiceImpl.java | 10 +- 12 files changed, 387 insertions(+), 66 deletions(-) create mode 100644 blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicDataClienImporter.java diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java index a8b91e376..5c8e470de 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java @@ -84,6 +84,8 @@ public class DictBizConstant { public static final String PALLET_STOCKNODATA_TYPE = "pallet_stocknodata_type";//打托类型 1服务号 2合同号 3商场 4门店 5客户 6仓库 7其他 public static final String PALLET_ARTIFICIAL_TYPE = "pallet_artificial_type";//人工打托类型 public static final String TRAY_TYPE = "tray_type";//托盘类型 + public static final String CLIENT_TYPE = "client_type";//客户类型 + public static final String BASIC_FREIGHT_TYPE = "basic_freight_type";//客户类型 干 仓 配 public static final String WAREHOUSE_TRAY_BINDING_TYPE = "warehouse_tray_binding_type";//托盘货物绑定类型 public static final String WAREHOUSE_TRAY_ENTRY_TYPE = "warehouse_tray_entry_type";//托盘货物录入类型 diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java index 53f5369fa..aedcd2a9f 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java @@ -68,7 +68,7 @@ public class BasicdataStorageServicesEntity extends TenantEntity { @ApiModelProperty(value = "客户ID") private Long clientId; /** - * 区分类型 + * 区分类型 1.门店 2. 客户 */ @ApiModelProperty(value = "区分类型") private Integer distinguish; diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java index e3c6e1265..7e66509a3 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java @@ -24,6 +24,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.basicdata.entity.BasicdataClientEntity; import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; import com.logpm.basicdata.entity.BasicdataStoreContactEntity; +import com.logpm.basicdata.excel.BasicDataClienImporter; import com.logpm.basicdata.excel.BasicdataClientExcel; import com.logpm.basicdata.service.IBasicdataClientService; import com.logpm.basicdata.service.IBasicdataStoreBusinessService; @@ -44,6 +45,7 @@ import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.system.feign.IUserClient; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; import javax.servlet.http.HttpServletResponse; @@ -233,4 +235,17 @@ public class BasicdataClientController extends BladeController { ExcelUtil.export(response, "基础客户表数据" + DateUtil.time(), "基础客户表数据表", list, BasicdataClientExcel.class); } + /** + * 导入数据 + */ + @PostMapping("/import-basicDataClient") + @ApiOperationSupport(order = 9) + @ApiOperation(value = "导入数据", notes = "传入basicDataClient") + public R importBasicDataClient(MultipartFile file, Integer isCovered) { + isCovered = 1; + BasicDataClienImporter clientImporter = new BasicDataClienImporter(basicdataClientService, isCovered == 1); + ExcelUtil.save(file, clientImporter, BasicdataClientExcel.class); + return R.success("操作成功"); + } + } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicDataClienImporter.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicDataClienImporter.java new file mode 100644 index 000000000..f4d83869e --- /dev/null +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicDataClienImporter.java @@ -0,0 +1,20 @@ +package com.logpm.basicdata.excel; + +import com.logpm.basicdata.service.IBasicdataClientService; +import lombok.RequiredArgsConstructor; +import org.springblade.core.excel.support.ExcelImporter; + +import java.util.List; +@RequiredArgsConstructor +public class BasicDataClienImporter implements ExcelImporter { + + private final IBasicdataClientService service; + private final Boolean isCovered; + + + @Override + public void save(List data) { + service.importClient(data, isCovered); + } + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java index 61cade513..c0736f5d9 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java @@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.ContentRowHeight; import com.alibaba.excel.annotation.write.style.HeadRowHeight; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @@ -42,77 +43,111 @@ public class BasicdataClientExcel implements Serializable { private static final long serialVersionUID = 1L; /** - * 租户号 + * 客户名称 */ @ColumnWidth(20) - @ExcelProperty("租户号") - private String tenantId; + @ExcelProperty("客户名称") + private String clientName; /** - * 是否已删除 + * 客户编码 */ @ColumnWidth(20) - @ExcelProperty("是否已删除") - private Integer isDeleted; + @ExcelProperty("客户编码") + private String clientCode; /** - * 预留1 + * 服务类型 干 仓 配 暂无用 */ @ColumnWidth(20) - @ExcelProperty("预留1") - private String reserve1; + @ExcelProperty("服务类型") + private String typeService; /** - * 预留2 + * 客户类型 干 仓 配 暂无用 */ @ColumnWidth(20) - @ExcelProperty("预留2") - private String reserve2; + @ExcelProperty("客户类型") + private String clientType; + /** - * 预留3 + * 详细地址 */ @ColumnWidth(20) - @ExcelProperty("预留3") - private String reserve3; + @ExcelProperty("详细地址") + private String detailedly; /** - * 预留4 + * 省份 */ @ColumnWidth(20) - @ExcelProperty("预留4") - private String reserve4; + @ExcelProperty("省") + private String bladeRegionProvinceId; /** - * 预留5 + * 市 */ @ColumnWidth(20) - @ExcelProperty("预留5") - private String reserve5; + @ExcelProperty("市") + private String bladeRegionCityId; /** - * 客户名称 + * 区/县 */ @ColumnWidth(20) - @ExcelProperty("客户名称") - private String clientName; + @ExcelProperty("区/县") + private String bladeRegionAreaId; /** - * 客户类型;1 C端 2 B端 + * 是否控货 */ @ColumnWidth(20) - @ExcelProperty("客户类型;1 C端 2 B端") - private Integer typeService; + @ExcelProperty("是否控货") + private String cargoControl; + /** - * 省份 + * 发站仓 */ @ColumnWidth(20) - @ExcelProperty("省份") - private String bladeRegionProvinceId; + @ExcelProperty("发站仓") + private String sendWarehouseName; /** - * 市 + * 服务仓 */ @ColumnWidth(20) - @ExcelProperty("市") - private String bladeRegionCityId; + @ExcelProperty("服务仓") + private String serveWarehouseName; /** - * 区/县 + * 联系人 */ @ColumnWidth(20) - @ExcelProperty("区/县") - private String bladeRegionAreaId; + @ExcelProperty("联系人") + private String linkman; + /** + * 联系电话 + */ + @ColumnWidth(20) + @ExcelProperty("联系电话") + private String phone; + /** + * 品牌 + */ + @ColumnWidth(20) + @ExcelProperty("品牌") + private String brandName; + /** + * 三方商场 + */ + @ColumnWidth(20) + @ExcelProperty("三方商场编码") + private String tripartiteCoding; + /** + * 三方商场 + */ + @ColumnWidth(20) + @ExcelProperty("三方商场名称") + private String tripartiteMall; + + /** + * 配送类型 + */ + @ColumnWidth(20) + @ExcelProperty("配送类型") + private String mold; + /** * 合同附件 */ diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java index f4db79639..38775b912 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java @@ -90,4 +90,6 @@ public interface IBasicdataClientService extends BaseService dictList(); + + void importClient(List data, Boolean isCovered); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java index 647573e45..79a57f235 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataWarehouseService.java @@ -129,5 +129,9 @@ public interface IBasicdataWarehouseService extends BaseService warehouseListqx(); + /** + * 仓库入库单 查询所属部门 + * @return + */ List detailWarehouse(); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java index 6c0937ef4..f2397a0df 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java @@ -24,21 +24,26 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.entity.*; import com.logpm.basicdata.excel.BasicdataClientExcel; +import com.logpm.basicdata.excel.BasicdataStorageServicesExcel; import com.logpm.basicdata.mapper.BasicdataClientMapper; import com.logpm.basicdata.service.*; import com.logpm.basicdata.vo.BasicdataClientVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.DictBizConstant; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.system.cache.DictBizCache; +import org.springblade.system.entity.DictBiz; +import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * 基础客户表 服务实现类 @@ -53,9 +58,12 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl data, Boolean isCovered) { + log.info("客户导入数据"); + List storeContactEntities = new ArrayList<>(); // 联系人 + List tripartiteMallEntities = new ArrayList<>(); // 三方商场 + List storeBrandEntities = new ArrayList<>(); // 品牌 + List storageServicesEntities = new ArrayList<>(); // 服务仓 + List storeBusinessEntities = new ArrayList<>(); // 服务类型 + //查询仓库信息 + List list1 = warehouseService.warehouseListqx(); + List dictBizs = DictBizCache.getList(DictBizConstant.DISTRIBUTION_TYPE);//商 市 自 + List clientBiz = DictBizCache.getList(DictBizConstant.CLIENT_TYPE); //客 工 + List freightBiz = DictBizCache.getList(DictBizConstant.BASIC_FREIGHT_TYPE); //客 工 + Set set =new HashSet<>(); + for (BasicdataClientExcel i : data) { + log.info("导入数据《》《》{}",i); + if(set.isEmpty()){ + set.add(i.getClientCode()); + }else{ + boolean b = set.stream().anyMatch(a -> a.equals(i.getClientCode())); + if(b){ + continue; + } + } + + BasicdataClientEntity basicdataClient = new BasicdataClientEntity(); + BeanUtil.copyProperties(i,basicdataClient); + +// Optional first = dictBizs.stream().filter(ii -> ii.getDictValue().equals(i.getTypeService())).findFirst(); + Optional clientFirst = clientBiz.stream().filter(ii -> ii.getDictValue().equals(i.getClientType())).findFirst(); +// i.setTypeService(first.get().getDictValue()); + basicdataClient.setClientType(clientFirst.get().getDictKey()); + //查询是不是重复 + List basicdataClientEntities = baseMapper.selectList(Wrappers.query().lambda().eq(BasicdataClientEntity::getClientCode, i.getClientCode())); + if(basicdataClientEntities.isEmpty()){ + basicdataClient.setPid("0"); + basicdataClient.setCargoControl(false); + basicdataClient.setStatus(0); + basicdataClient.setIsDeleted(0); + basicdataClient.setCreateTime(new Date()); + baseMapper.insert(basicdataClient); + if(ObjectUtils.isNull(basicdataClient.getId())){ + throw new ServiceException("客户ID不存在"); + } + //添加服务类型 + if(ObjectUtils.isNotNull(i.getTypeService())){ + BasicdataStoreBusinessEntity storeBusinessEntity = new BasicdataStoreBusinessEntity(); + storeBusinessEntity.setClientId(basicdataClient.getId().toString()); + storeBusinessEntity.setTypeService(i.getTypeService()); + storeBusinessEntity.setMold(i.getMold()); + storeBusinessEntities.add(storeBusinessEntity); + } + //添加服务仓 + if(ObjectUtils.isNotNull(i.getServeWarehouseName())){ + BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity(); + servicesEntity.setClientId(basicdataClient.getId()); + servicesEntity.setDistinguish(2); + if(ObjectUtils.isNotNull(i.getSendWarehouseName())){ +// Long id = list1.stream().filter(q -> q.getName().equals(i.getSendWarehouseName())).findFirst().get().getId(); +// servicesEntity.setSendWarehouseId(String.valueOf(id)); + servicesEntity.setSendWarehouseName(i.getSendWarehouseName()); + } + Long id = list1.stream().filter(q -> q.getName().equals(i.getServeWarehouseName())).findFirst().get().getId(); + servicesEntity.setServeWarehouseId(id); + servicesEntity.setServeWarehouseName(i.getServeWarehouseName()); + storageServicesEntities.add(servicesEntity); + } + //添加品牌 + if(ObjectUtils.isNotNull(i.getBrandName())){ + BasicdataStoreBrandEntity storeBrandEntity= new BasicdataStoreBrandEntity(); + storeBrandEntity.setClientId(basicdataClient.getId()); + storeBrandEntity.setShopId(basicdataClient.getId().toString()); + BasicdataBrandEntity one = basicdataBrandService.getOne(Wrappers.query().lambda().eq(BasicdataBrandEntity::getBrandName, i.getBrandName())); + if(ObjectUtils.isNull(one)){ + throw new ServiceException("品牌不存在"); + } + storeBrandEntity.setBrandId(String.valueOf(one.getId())); + storeBrandEntity.setBrandName(i.getBrandName()); + storeBrandEntities.add(storeBrandEntity); + } + //添加联系人 + if(ObjectUtils.isNotNull(i.getLinkman())){ + BasicdataStoreContactEntity storeContactEntity = new BasicdataStoreContactEntity(); + storeContactEntity.setShopId(basicdataClient.getId()); + storeContactEntity.setPhone(i.getPhone()); + storeContactEntity.setLinkman(i.getLinkman()); + storeContactEntities.add(storeContactEntity); + + } + //添加三方商场 + if(ObjectUtils.isNotNull(i.getTripartiteMall())){ + BasicdataTripartiteMallEntity tripartiteMallEntity = new BasicdataTripartiteMallEntity(); + tripartiteMallEntity.setClientId(basicdataClient.getId()); + tripartiteMallEntity.setTripartiteMall(i.getTripartiteMall()); + tripartiteMallEntity.setTripartiteCoding(i.getTripartiteCoding()); + tripartiteMallEntities.add(tripartiteMallEntity); + } + + } + } + + //品牌 + if(!storeBrandEntities.isEmpty()){ + List list = new ArrayList<>(); + storeBrandEntities.stream().forEach(i ->{ + if(i.getBrandName().contains(",")){ + String[] split = i.getBrandName().split(","); + for (int j = 0; j < split.length; j++) { + BasicdataStoreBrandEntity business = new BasicdataStoreBrandEntity(); + BeanUtil.copyProperties(i,business); + List list2 = basicdataBrandService.list(Wrappers.query().lambda() + .eq(BasicdataBrandEntity::getBrandName, i.getBrandName()) + ); + business.setBrandName(split[j]); + business.setBrandId(list2.get(0).getId().toString()); + list.add(business); + } + }else{ + List list2 = basicdataBrandService.list(Wrappers.query().lambda() + .eq(BasicdataBrandEntity::getBrandName, i.getBrandName()) + ); + i.setBrandName(i.getBrandName()); + i.setBrandId(list2.get(0).getId().toString()); + list.add(i); + } + }); + basicdataStoreBrandService.saveBatch(list); + } + //服务类型 + if(!storeBusinessEntities.isEmpty()){ + List list = new ArrayList<>(); + storeBusinessEntities.stream().forEach(i ->{ +// List dictBizs = DictBizCache.getList(DictBizConstant.DISTRIBUTION_TYPE); + if(i.getTypeService().contains(",")){ + String[] split = i.getTypeService().split(","); + for (int j = 0; j < split.length; j++) { + BasicdataStoreBusinessEntity business = new BasicdataStoreBusinessEntity(); + BeanUtil.copyProperties(i,business); + int finalJ = j; + if(split[j].equals("配送")){ + switch ( business.getMold()){ + case "商配": + business.setMold("1"); + break; + case "市配": + business.setMold("2"); + break; + case "自提": + business.setMold("3"); + break; + } + + }else{ + business.setMold(null); + } + String dictValue = freightBiz.stream().filter(q -> q.getDictValue().equals(split[finalJ])).findFirst().get().getDictKey(); + business.setTypeService(dictValue); + list.add(business); + } + }else{ + String dictValue = freightBiz.stream().filter(q -> q.getDictValue().equals(i.getTypeService())).findFirst().get().getDictKey(); + i.setTypeService(dictValue); + if(i.getTypeService().equals("配送")){ + String mold = i.getMold(); + switch (mold){ + case "商配": + i.setMold("1"); + break; + case "市配": + i.setMold("2"); + break; + case "自提": + i.setMold("3"); + break; + } + + }else{ + i.setMold(null); + } + list.add(i); + } + }); + basicdataStoreBusinessService.saveBatch(list); + } + //服务仓 + if(!storageServicesEntities.isEmpty()){ + List servicesEntityList = new ArrayList<>(); + storageServicesEntities.stream().forEach(i ->{ + if(i.getSendWarehouseName().contains(",")){ + String[] split = i.getSendWarehouseName().split(","); + for (int j = 0; j < split.length; j++) { + BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity(); + Long id = list1.stream().filter(q -> q.getName().equals(i.getSendWarehouseName())).findFirst().get().getId(); + BeanUtil.copyProperties(i,servicesEntity); + servicesEntity.setSendWarehouseId(id.toString()); + servicesEntity.setSendWarehouseName(split[j]); + servicesEntityList.add(servicesEntity); + } + }else{ + Long id = list1.stream().filter(q -> q.getName().equals(i.getSendWarehouseName())).findFirst().get().getId(); + i.setSendWarehouseId(id.toString()); + servicesEntityList.add(i); + } + }); + basicdataStorageServicesService.saveBatch(servicesEntityList); + } + //联系人 + if(!storeContactEntities.isEmpty()){ + basicdataStoreContactService.saveBatch(storeContactEntities); + } + //三方 + if(!tripartiteMallEntities.isEmpty()){ + basicdataTripartiteMallService.saveBatch(tripartiteMallEntities); + } + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml index 280884b2e..7677b9ab8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml @@ -98,7 +98,7 @@ from logpm_distribution_stockup_info ldsi LEFT JOIN logpm_distrilbution_bill_stock ldbs on ldsi.reservation_id = ldbs.bill_lading_id LEFT JOIN logpm_distribution_stock_article ldsa on ldsa.id = ldbs.stock_article_id and ldsa.is_zero = '0' - LEFT JOIN logpm_distribution_parcel_list ldpl on ldpl.stock_article_id = ldsa.id and ldpl.order_package_grounding_status = 10 + LEFT JOIN logpm_distribution_parcel_list ldpl on ldpl.stock_article_id = ldsa.id LEFT JOIN logpm_distribution_stock lds on ldpl.id = lds.parcel_list_id where ldsi.stockup_id = #{stockupId} and ldsi.reservation_id = #{reservationId} and ldsa.is_zero = '0' diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index fa3d21fee..87b84be44 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -1361,16 +1361,22 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { @Override @Transactional(rollbackFor = Exception.class) public void stockupUpdateState(StockupDTO stockupDTO) { + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); - //查询包件备货状态 - List distributionParcelListEntities = distributionParcelListMapper.selectList(Wrappers.query().lambda() - .eq(DistributionParcelListEntity::getOrderPackageCode, stockupDTO.getPacketBarCode())); - //修改 - if(!distributionParcelListEntities.isEmpty()){ - DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity(); - distributionParcelListEntity.setId(distributionParcelListEntities.get(0).getId()); - distributionParcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); - distributionParcelListMapper.updateById(distributionParcelListEntity); + if(stockupDTO.getScanType().equals(1)){ + //包件 + //查询包件备货状态 + List distributionParcelListEntities = distributionParcelListMapper.selectList(Wrappers.query().lambda() + .eq(DistributionParcelListEntity::getOrderPackageCode, stockupDTO.getPacketBarCode()) + .eq(ObjectUtils.isNotNull(myCurrentWarehouse),DistributionParcelListEntity::getWarehouseId,myCurrentWarehouse.getId() ) + ); + //修改 + if(!distributionParcelListEntities.isEmpty()){ + DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity(); + distributionParcelListEntity.setId(distributionParcelListEntities.get(0).getId()); + distributionParcelListEntity.setOrderPackageStockupStatus(OrderPackageStockupStatusConstant.yibeihu.getValue()); + distributionParcelListMapper.updateById(distributionParcelListEntity); + } } //备货中 @@ -1382,11 +1388,11 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { AtomicReference nuy = new AtomicReference<>(0); // 以扫 AtomicReference ku = new AtomicReference<>(0); // 库 //查询有没有零担数据 - List zeroList = reservationZeroPackageService.getZeroList(stockupDTO.getReservationId()); - if(!zeroList.isEmpty()){ - int sum = zeroList.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); - nu.set(nu.get() + sum); - } +// List zeroList = reservationZeroPackageService.getZeroList(stockupDTO.getReservationId()); +// if(!zeroList.isEmpty()){ +// int sum = zeroList.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); +// nu.set(nu.get() + sum); +// } distributionStockupInfoEntities.forEach(i -> { //预约包件 //查询已扫描的数量 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java index d2ecde01d..0098f8e71 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java @@ -359,13 +359,19 @@ public class DistributionStockServiceImpl extends BaseServiceImplquery().lambda() - .eq(ObjectUtils.isNotNull(id),DistributionStockEntity::getStockArticle,id) - .eq(DistributionStockEntity::getStockupId,parseLong) - ).intValue(); + List stockEntityList = baseMapper.selectList(Wrappers.query().lambda() + .eq(ObjectUtils.isNotNull(id), DistributionStockEntity::getStockArticle, id) + .eq(DistributionStockEntity::getStockupId, parseLong) + ); + return stockEntityList.stream().mapToInt(DistributionStockEntity::getStockQuantity).sum(); } @Override diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java index dad19afbf..946f8794a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java @@ -1271,11 +1271,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl distributionStockupSelfVOS = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId()); DistributionStockupSelfVO distributionStockup= new DistributionStockupSelfVO(); - AtomicReference j = new AtomicReference<>(0); AtomicReference y = new AtomicReference<>(0); distributionStockupSelfVOS.forEach(i -> { if(ObjectUtils.isNull(i.getAllocationId())){ - j.updateAndGet(v -> v + 1); y.updateAndGet(v -> v + i.getScanNum()); if(ObjectUtils.isNull(distributionStockup.getConsignee())){ distributionStockup.setConsignee(i.getConsignee()); @@ -1295,7 +1293,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl list = distributionParcelListService.selectOrderInfoSelfList(stockupDTO); Iterator iterator = list.iterator(); - + AtomicReference j = new AtomicReference<>(0); if(Objects.isNull(stockupDTO.getAllocationId())){ + while (iterator.hasNext()){ + j.updateAndGet(v -> v + 1); PackageStockupVO next = iterator.next(); if(ObjectUtils.isNotNull(next.getAllocationId()) ){ iterator.remove(); @@ -1327,6 +1327,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl v + 1); PackageStockupVO next = iterator.next(); if(ObjectUtils.isNull(next.getPositionCode()) ){ iterator.remove(); @@ -1341,6 +1342,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl