|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.logpm.distribution.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
@ -23,6 +24,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.basic.entity.BasicPrintTemplateEntity; |
|
|
|
|
import com.logpm.basic.feign.IBasicPrintTemplateClient; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataDriverArteryEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataDriverArteryClient; |
|
|
|
@ -37,6 +40,7 @@ import com.logpm.distribution.mapper.*;
|
|
|
|
|
import com.logpm.distribution.service.*; |
|
|
|
|
import com.logpm.distribution.vo.*; |
|
|
|
|
import com.logpm.distribution.vo.app.*; |
|
|
|
|
import com.logpm.distribution.vo.print.PrintPreviewVO; |
|
|
|
|
import com.logpm.distribution.wrapper.DistributionDeliveryListWrapper; |
|
|
|
|
import com.logpm.distribution.wrapper.DistributionParcelListWrapper; |
|
|
|
|
import com.logpm.distribution.wrapper.DistributionReservationWrapper; |
|
|
|
@ -55,11 +59,14 @@ import org.springblade.common.constant.order.OrderStatusConstant;
|
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageLoadingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant; |
|
|
|
|
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; |
|
|
|
|
import org.springblade.common.constant.reservation.*; |
|
|
|
|
import org.springblade.common.constant.stockup.StockAssignStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
|
import org.springblade.common.serviceConstant.ServiceConstant; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
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.mp.support.Query; |
|
|
|
@ -68,6 +75,7 @@ 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.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.system.cache.DictBizCache; |
|
|
|
|
import org.springblade.system.feign.IDictBizClient; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
@ -93,6 +101,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
private final DistributionDeliveryInfoMapper distributionDeliveryInfoMapper; |
|
|
|
|
private final DistributionReservationMapper distributionReservationMapper; |
|
|
|
|
private final IDistributionReservationStockarticleService distributionReservationStockarticleService; |
|
|
|
|
private final IDistributionReservationStocklistService distributionReservationStocklistService; |
|
|
|
|
private final IDistributionReservationPackageService distributionReservationPackageService; |
|
|
|
|
private final DistributionReservationPackageMapper distributionReservationPackageMapper; |
|
|
|
|
private final DistributionParcelListMapper distributionParcelListMapper; |
|
|
|
@ -125,6 +134,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
private final IBasicdataWarehouseClient warehouseClient; |
|
|
|
|
private final IDisStockListDetailService disStockListDetailService; |
|
|
|
|
private final DistributionStockListMapper distributionStockListMapper; |
|
|
|
|
private final IBasicPrintTemplateClient basicPrintTemplateClient; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionDeliveryListEntity> selectDistributionDeliveryListPage(IPage<DistributionDeliveryListEntity> page, DistributionDeliveryListDTO distributionDeliveryList) { |
|
|
|
@ -1570,7 +1580,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<DistributionAppDeliveryListVO> distributionAppDeliveryListVOS = new ArrayList<>(); |
|
|
|
|
boolean delivery = false; |
|
|
|
|
String value1 = DictBizCache.getValue("role_class", "delivery_driver"); |
|
|
|
|
if(roleId.contains(value1)) delivery = true; |
|
|
|
|
if (roleId.contains(value1)) delivery = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// R<String> value = dictBizClient.getValue("role_class", roleId);
|
|
|
|
@ -2112,9 +2122,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//查询出这个订单下的包件信息
|
|
|
|
|
// List<DistributionReservationPackageEntity> oldPackageList = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationEntity.getId(), reservationStockarticleEntities.get(0).getStockArticleId());
|
|
|
|
|
Map<Long, List<DistributionReservationPackageEntity>> oldPackageList = distributionReservationPackageMapper.selectList(Wrappers.<DistributionReservationPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationPackageEntity::getReservationId, reservationEntity.getId()) |
|
|
|
|
.eq(DistributionReservationPackageEntity::getStockArticleId, s.getId()) |
|
|
|
|
.ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue())) |
|
|
|
|
.eq(DistributionReservationPackageEntity::getReservationId, reservationEntity.getId()) |
|
|
|
|
.eq(DistributionReservationPackageEntity::getStockArticleId, s.getId()) |
|
|
|
|
.ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue())) |
|
|
|
|
.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId)); |
|
|
|
|
//查看订单包件是否发生变化
|
|
|
|
|
List<DistributionParcelListEntity> packageListInfo = s.getPackageListInfo(); |
|
|
|
@ -3127,4 +3137,129 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// });
|
|
|
|
|
return distributionStockListEntities; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PrintPreviewVO printBatch(String ids) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrintPreviewVO printPreviewVO = new PrintPreviewVO(); |
|
|
|
|
List<Map> data = new ArrayList<>(); |
|
|
|
|
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_1.getValue()); |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
|
throw new ServiceException("模板内容未找到"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); |
|
|
|
|
printPreviewVO.setTemplateHtml(html); |
|
|
|
|
printPreviewVO.setTemplateId(template.getId()); |
|
|
|
|
|
|
|
|
|
String[] idArray = ids.split(","); |
|
|
|
|
if (ObjectUtils.isNull(idArray)) { |
|
|
|
|
throw new ServiceException("参数错误"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (String id : idArray) { |
|
|
|
|
|
|
|
|
|
// 获取需要的数据
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
DistributionDeliveryListEntity byId = this.getById(id); |
|
|
|
|
|
|
|
|
|
//查询这个配送下面的预约单
|
|
|
|
|
|
|
|
|
|
List<DistributionReservationEntity> distributionReservationEntityList = distributionReservationMapper.findByDeliveryId(byId.getId()); |
|
|
|
|
|
|
|
|
|
for (DistributionReservationEntity distributionReservationEntity : distributionReservationEntityList) { |
|
|
|
|
|
|
|
|
|
map.put("配送单号", distributionReservationEntity.getReservationCode()); |
|
|
|
|
// todo 商场电话是否需要查询商场信息得到电话
|
|
|
|
|
map.put("商场电话", distributionReservationEntity.getReservationCode()); |
|
|
|
|
|
|
|
|
|
map.put("送货日期", DateUtil.format(distributionReservationEntity.getReservationDate(), "yyyy-MM-dd") + " 全天"); |
|
|
|
|
|
|
|
|
|
map.put("客户名称", distributionReservationEntity.getConsignee()); |
|
|
|
|
|
|
|
|
|
map.put("客户电话", distributionReservationEntity.getDeliveryPhone()); |
|
|
|
|
|
|
|
|
|
map.put("送货地址", distributionReservationEntity.getDeliveryAddress()); |
|
|
|
|
|
|
|
|
|
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2
|
|
|
|
|
List<Map<String,Object>> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("定制品集合", spaclOrderList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("备注", distributionReservationEntity.getRemarks()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("送货司机", byId.getTrainNumber() + "/" + byId.getDriverName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.add(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return printPreviewVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建预约单下面的订单信息 |
|
|
|
|
* |
|
|
|
|
* @param id 预约单ID |
|
|
|
|
* @param i 构建类型 1 表示订单 2 表示库存品 |
|
|
|
|
* @return List |
|
|
|
|
*/ |
|
|
|
|
private List<Map<String,Object>> buildSpaclOrders(DistributionReservationEntity distributionReservationEntity, int i) { |
|
|
|
|
|
|
|
|
|
List<DistributionReservationStocklistEntity> distributionReservationStocklistEntities; |
|
|
|
|
|
|
|
|
|
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntityList; |
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> result = new ArrayList<>(); |
|
|
|
|
switch (i) { |
|
|
|
|
case 1: |
|
|
|
|
// 订单
|
|
|
|
|
distributionReservationStockarticleEntityList = distributionReservationStockarticleService.lambdaQuery().eq(DistributionReservationStockarticleEntity::getReservationId, distributionReservationEntity.getId()).list(); |
|
|
|
|
|
|
|
|
|
// 取值
|
|
|
|
|
for (DistributionReservationStockarticleEntity distributionReservationStockarticleEntity : distributionReservationStockarticleEntityList) { |
|
|
|
|
|
|
|
|
|
Map<String,Object> temp = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleMapper.selectById(distributionReservationStockarticleEntity.getStockArticleId()); |
|
|
|
|
|
|
|
|
|
temp.put("合同号",distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
temp.put("产品名称",distributionStockArticleEntity.getDescriptionGoods()); |
|
|
|
|
//todo 单位是否需要查询物料表
|
|
|
|
|
temp.put("单位","件"); |
|
|
|
|
temp.put("数量",distributionReservationStockarticleEntity.getReservationNum()); |
|
|
|
|
temp.put("备货区",null); |
|
|
|
|
//todo 这里还没完成
|
|
|
|
|
|
|
|
|
|
result.add(temp); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
distributionReservationStocklistEntities = distributionReservationStocklistService.lambdaQuery().eq(DistributionReservationStocklistEntity::getReservationId, distributionReservationEntity.getId()).list(); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|