|
|
|
@ -17,6 +17,8 @@
|
|
|
|
|
package com.logpm.distribution.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
@ -28,7 +30,9 @@ 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.IBasicdataCarrierClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataDriverArteryClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataVehicleClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
import com.logpm.distribution.bean.Resp; |
|
|
|
|
import com.logpm.distribution.dto.*; |
|
|
|
@ -60,12 +64,15 @@ 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.orderpackage.OrderPackageStockupStatusConstant; |
|
|
|
|
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.exception.CustomerException; |
|
|
|
|
import org.springblade.common.serviceConstant.ServiceConstant; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
import org.springblade.common.utils.QRCodeUtil; |
|
|
|
|
import org.springblade.common.utils.TemplateUtil; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
@ -84,6 +91,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Isolation; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
@ -137,6 +145,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
private final DistributionStockListMapper distributionStockListMapper; |
|
|
|
|
private final IWarehouseUpdownTypeClient warehouseUpdownTypeClient; |
|
|
|
|
private final IBasicPrintTemplateClient basicPrintTemplateClient; |
|
|
|
|
private final IBasicdataVehicleClient basicdataVehicleClient; |
|
|
|
|
private final IBasicdataCarrierClient basicdataCarrierClient; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionDeliveryListEntity> selectDistributionDeliveryListPage(IPage<DistributionDeliveryListEntity> page, DistributionDeliveryListDTO distributionDeliveryList) { |
|
|
|
@ -218,7 +228,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
List<DistributionStockupVO> distributionStockupVOList = distributionStockupMapper.getMarketDeliveryStockupInfo(detail.getId()); |
|
|
|
|
//这里需要处理一下
|
|
|
|
|
if (distributionStockupVOList.size() > 1) { |
|
|
|
|
Date outboundDate = distributionStockupVOList.stream().filter(o -> o.getOutboundDate() != null).max(Comparator.comparing(DistributionStockupVO::getOutboundDate)).get().getOutboundDate(); |
|
|
|
|
// Date outboundDate = distributionStockupVOList.stream().filter(o -> o.getOutboundDate() != null).max(Comparator.comparing(DistributionStockupVO::getOutboundDate)).get().getOutboundDate();
|
|
|
|
|
HashSet<String> forkliftName = new HashSet<>(); |
|
|
|
|
HashSet<String> loaderName = new HashSet<>(); |
|
|
|
|
HashSet<String> stockUser = new HashSet<>(); |
|
|
|
@ -241,7 +251,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
distributionStockupVO.setForkliftName(String.join(",", forkliftName)); |
|
|
|
|
distributionStockupVO.setStockupArea(String.join(",", goodsArea)); |
|
|
|
|
distributionStockupVO.setStockupUser(String.join(",", stockUser)); |
|
|
|
|
distributionStockupVO.setOutboundDate(outboundDate); |
|
|
|
|
// distributionStockupVO.setOutboundDate(outboundDate);
|
|
|
|
|
distributionDeliveryListVO.setStockupInfo(distributionStockupVO); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
@ -1791,19 +1801,37 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//查询客户
|
|
|
|
|
List<DistributionAppReservationVO> customList = distributionDeliveryInfoMapper.selectAppcustomListPage(page, distributionDeliveryList.getId()); |
|
|
|
|
for (DistributionAppReservationVO distributionAppReservationVO : customList) { |
|
|
|
|
//查询备货是否完成
|
|
|
|
|
int aLong = distributionStockMapper.selectCount(new QueryWrapper<DistributionStockEntity>().lambda() |
|
|
|
|
.eq(DistributionStockEntity::getReservationId, distributionAppReservationVO.getId()) |
|
|
|
|
.eq(DistributionStockEntity::getType, 1) |
|
|
|
|
).intValue(); |
|
|
|
|
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppReservationVO.getId()); |
|
|
|
|
List<DisStockListDetailEntity> stockListDetailEntityList = distributionReservationMapper.selectInventoryListByReservation(distributionAppReservationVO.getId()); |
|
|
|
|
boolean stockArticleStockupStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageStockupStatus()) && s.getOrderPackageStockupStatus().equals(OrderPackageStockupStatusConstant.yibeihu.getValue())); |
|
|
|
|
boolean inventoryStockupStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode())); |
|
|
|
|
if (stockArticleStockupStatus && inventoryStockupStatus ){ |
|
|
|
|
distributionAppReservationVO.setIsstock("是"); |
|
|
|
|
distributionAppReservationVO.setIsload("是"); |
|
|
|
|
if (aLong < distributionAppReservationVO.getReservationNum()) { |
|
|
|
|
}else { |
|
|
|
|
distributionAppReservationVO.setIsstock("否"); |
|
|
|
|
} |
|
|
|
|
if (distributionAppReservationVO.getLoadingNub() < distributionAppReservationVO.getReservationNum()) { |
|
|
|
|
boolean stockArticleLoadingStatus = parcelListEntities.stream().allMatch(s -> Func.isNotEmpty(s.getOrderPackageLoadingStatus()) && s.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); |
|
|
|
|
boolean inventoryLoadingStatus = stockListDetailEntityList.stream().allMatch(i -> Func.isNotEmpty(i.getStockPackageCode()) && i.getStockLockingStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); |
|
|
|
|
if (stockArticleLoadingStatus && inventoryLoadingStatus){ |
|
|
|
|
distributionAppReservationVO.setIsload("是"); |
|
|
|
|
}else { |
|
|
|
|
distributionAppReservationVO.setIsload("否"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// //查询备货是否完成
|
|
|
|
|
// int aLong = distributionStockMapper.selectCount(new QueryWrapper<DistributionStockEntity>().lambda()
|
|
|
|
|
// .eq(DistributionStockEntity::getReservationId, distributionAppReservationVO.getId())
|
|
|
|
|
// .eq(DistributionStockEntity::getType, 1)
|
|
|
|
|
// ).intValue();
|
|
|
|
|
// distributionAppReservationVO.setIsstock("是");
|
|
|
|
|
// distributionAppReservationVO.setIsload("是");
|
|
|
|
|
// if (aLong < distributionAppReservationVO.getReservationNum()) {
|
|
|
|
|
// distributionAppReservationVO.setIsstock("否");
|
|
|
|
|
// }
|
|
|
|
|
// if (distributionAppReservationVO.getLoadingNub() < distributionAppReservationVO.getReservationNum()) {
|
|
|
|
|
// distributionAppReservationVO.setIsload("否");
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
return page.setRecords(customList); |
|
|
|
|
} |
|
|
|
@ -3154,42 +3182,227 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PrintPreviewVO printBatch(String ids) throws Exception { |
|
|
|
|
public List<PrintPreviewVO> printBatch(String ids, Integer type) 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()); |
|
|
|
|
BasicPrintTemplateEntity template = getPrintTemplate(type); |
|
|
|
|
|
|
|
|
|
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); |
|
|
|
|
// printPreviewVO.setTemplateHtml(html);
|
|
|
|
|
// printPreviewVO.setTemplateId(template.getId());
|
|
|
|
|
String[] idArray = ids.split(","); |
|
|
|
|
if (ObjectUtils.isNull(idArray)) { |
|
|
|
|
throw new ServiceException("参数错误"); |
|
|
|
|
} |
|
|
|
|
if (2 == type) { |
|
|
|
|
|
|
|
|
|
return handleShiPeiData(template, idArray,html); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (1 == type) { |
|
|
|
|
return handleShangPeiData(template.getId(), idArray,html); |
|
|
|
|
} else { |
|
|
|
|
log.warn("###########printBatch: 未知的打印类型"); |
|
|
|
|
throw new CustomerException(403, "未知的打印类型"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (String id : idArray) { |
|
|
|
|
@Override |
|
|
|
|
public void testData(String s) throws Exception { |
|
|
|
|
String[] split = s.split(","); |
|
|
|
|
handleShangPeiData(1111L, split,"111"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取需要的数据
|
|
|
|
|
private List<PrintPreviewVO> handleShangPeiData(Long templateId, String[] idArray,String html) throws Exception { |
|
|
|
|
List<PrintPreviewVO> result = new ArrayList<>(); |
|
|
|
|
List<Map<String,Object>> test = new ArrayList<>(); |
|
|
|
|
for (String id : idArray) { |
|
|
|
|
|
|
|
|
|
//查询对应配送单
|
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = baseMapper.selectById(id);//配送单
|
|
|
|
|
if(Objects.isNull(deliveryListEntity)){ |
|
|
|
|
log.warn("#########handleShangPeiData: 配送单信息不存在 deliveryListEntityId={}",id); |
|
|
|
|
throw new CustomerException(403,"配送单信息不存在"); |
|
|
|
|
} |
|
|
|
|
Long deliveryListEntityId = deliveryListEntity.getId(); |
|
|
|
|
String taskTime = deliveryListEntity.getTaskTime();//配送时间
|
|
|
|
|
String kind = deliveryListEntity.getKind(); |
|
|
|
|
String dirverName = ""; |
|
|
|
|
String dirverPhone = ""; |
|
|
|
|
String carNumber = ""; |
|
|
|
|
|
|
|
|
|
if("1".equals(kind)){ |
|
|
|
|
QueryWrapper<DistributionDeliverySelfEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("delivery_id",deliveryListEntityId); |
|
|
|
|
DistributionDeliverySelfEntity deliverySelfEntity = distributionDeliverySelfService.getOne(queryWrapper); |
|
|
|
|
dirverName = deliverySelfEntity.getDriverName(); |
|
|
|
|
dirverPhone = deliverySelfEntity.getDriverPhone(); |
|
|
|
|
carNumber = deliverySelfEntity.getVehicleNub(); |
|
|
|
|
}else if("2".equals(kind)){ |
|
|
|
|
QueryWrapper<DistributionDeliveryTripartiteEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("delivery_id",deliveryListEntityId); |
|
|
|
|
DistributionDeliveryTripartiteEntity deliveryTripartiteEntity = distributionDeliveryTripartiteService.getOne(queryWrapper); |
|
|
|
|
dirverName = deliveryTripartiteEntity.getDriverName(); |
|
|
|
|
dirverPhone = deliveryTripartiteEntity.getDriverPhone(); |
|
|
|
|
carNumber = deliveryTripartiteEntity.getVehicleNum(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<DistributionReservationEntity> distributionReservationEntityList = distributionReservationMapper.findByDeliveryId(deliveryListEntityId); |
|
|
|
|
//循环查询出来的预约单
|
|
|
|
|
for (DistributionReservationEntity reservationEntity:distributionReservationEntityList){ |
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("配送单号", reservationEntity.getReservationCode()); |
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(reservationEntity.getReservationCode()); |
|
|
|
|
map.put("配送单二维码",QRCodeUtil.getEmpAutograph(fileTypeName)); |
|
|
|
|
map.put("收货单单位",reservationEntity.getReceivingUnit());//收货单单位
|
|
|
|
|
map.put("商场名称",reservationEntity.getStoreName());//商场名称
|
|
|
|
|
map.put("收货人",reservationEntity.getConsignee());//收货人
|
|
|
|
|
map.put("收货人电话",reservationEntity.getDeliveryPhone());//收货人电话
|
|
|
|
|
map.put("收货人地址",reservationEntity.getDeliveryAddress());//收货人地址
|
|
|
|
|
map.put("配送时间",taskTime);//配送时间
|
|
|
|
|
map.put("承运商",deliveryListEntity.getDistributionCompany()); |
|
|
|
|
map.put("配送仓库",deliveryListEntity.getWarehouseName()); |
|
|
|
|
map.put("出库时间",deliveryListEntity.getWarehouseName()); |
|
|
|
|
map.put("送货司机",dirverName+"/"+dirverPhone); |
|
|
|
|
map.put("车牌号",carNumber); |
|
|
|
|
|
|
|
|
|
Long reservationId = reservationEntity.getId();//预约id
|
|
|
|
|
//通过预约id查询所有包件并按三级品类分组
|
|
|
|
|
List<Map<String,Object>> categoryList = distributionReservationMapper.findAllCategoryNum(reservationId); |
|
|
|
|
//计算一个总计
|
|
|
|
|
Map<String,Object> total = new HashMap<>(); |
|
|
|
|
Integer totalNum = 0; |
|
|
|
|
for (Map<String,Object> m:categoryList){ |
|
|
|
|
Set<String> set = m.keySet(); |
|
|
|
|
String categoryName = ""; |
|
|
|
|
Long num = 0L; |
|
|
|
|
for (String s:set){ |
|
|
|
|
if("num".equals(s)){ |
|
|
|
|
num = (Long)m.get(s); |
|
|
|
|
totalNum = totalNum + num.intValue(); |
|
|
|
|
}else{ |
|
|
|
|
categoryName = (String)m.get(s); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
total.put(categoryName,num); |
|
|
|
|
} |
|
|
|
|
total.put("合计件数",totalNum); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先查询预约单对应有哪些订单
|
|
|
|
|
QueryWrapper<DistributionReservationStockarticleEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("reservation_id",reservationId); |
|
|
|
|
List<DistributionReservationStockarticleEntity> reservationStockarticleList = distributionReservationStockarticleService.list(queryWrapper); |
|
|
|
|
List<Map<String,Object>> ls = new ArrayList<>(); |
|
|
|
|
BigDecimal totalPrice = BigDecimal.ZERO; |
|
|
|
|
for (int i = 0; i < reservationStockarticleList.size(); i++) { |
|
|
|
|
DistributionReservationStockarticleEntity reservationStockarticleEntity = reservationStockarticleList.get(i); |
|
|
|
|
Long stockArticleId = reservationStockarticleEntity.getStockArticleId();//订单id
|
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(stockArticleId); |
|
|
|
|
if(Objects.isNull(stockArticleEntity)){ |
|
|
|
|
log.warn("#########handleShangPeiData: 订单信息不存在 stockArticleId={}",stockArticleId); |
|
|
|
|
throw new CustomerException(403,"订单信息不存在"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String,Object> orderMap = new HashMap<>(); |
|
|
|
|
orderMap.put("序号",i+1); |
|
|
|
|
orderMap.put("运单号",stockArticleEntity.getWaybillNumber()); |
|
|
|
|
orderMap.put("合同号",stockArticleEntity.getOrderCode()); |
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的库位信息
|
|
|
|
|
List<String> allocationStrList = distributionReservationMapper.getAllocationByStockArticleIdAndReservationId(stockArticleId,reservationId); |
|
|
|
|
String allocationStr = StringUtils.join(allocationStrList, ","); |
|
|
|
|
orderMap.put("货位",allocationStr); |
|
|
|
|
//通过订单id和预约id查询对应包件的备货区信息
|
|
|
|
|
List<String> stockupAreaStrList = distributionReservationMapper.getStockupAreaByStockArticleIdAndReservationId(stockArticleId,reservationId); |
|
|
|
|
String stockupAreaStr = StringUtils.join(stockupAreaStrList, ","); |
|
|
|
|
orderMap.put("备货区",stockupAreaStr); |
|
|
|
|
|
|
|
|
|
//查询当前订单的品类数量
|
|
|
|
|
List<Map<String,Object>> mapList = distributionReservationMapper.getCategoryByStockArticleIdAndReservationId(stockArticleId,reservationId); |
|
|
|
|
Map<String,Object> numObj = new HashMap<>(); |
|
|
|
|
Integer tn = 0; |
|
|
|
|
Set<String> set = total.keySet(); |
|
|
|
|
for (String key:set){ |
|
|
|
|
if(!"合计件数".equals(key)){ |
|
|
|
|
numObj.put(key,0); |
|
|
|
|
for (Map<String,Object> m:mapList){ |
|
|
|
|
String thirdProduct = (String)m.get("thirdProduct"); |
|
|
|
|
Long num = (Long)m.get("num"); |
|
|
|
|
if(thirdProduct.equals(key)){ |
|
|
|
|
numObj.put(key,num); |
|
|
|
|
tn = tn + num.intValue(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
numObj.put("合计数量",tn); |
|
|
|
|
orderMap.put("产品明细",numObj); |
|
|
|
|
|
|
|
|
|
//通过订单id和预约id查询对应包件的物料信息
|
|
|
|
|
List<String> materialNameStrList = distributionReservationMapper.getMaterialNameByStockArticleIdAndReservationId(stockArticleId,reservationId); |
|
|
|
|
String materialNameStr = StringUtils.join(materialNameStrList, ","); |
|
|
|
|
orderMap.put("物料名称",materialNameStr); |
|
|
|
|
orderMap.put("到付运费",0);//todo 需要累加到totalPrice上
|
|
|
|
|
ls.add(orderMap); |
|
|
|
|
} |
|
|
|
|
total.put("到付费用",totalPrice); |
|
|
|
|
map.put("明细",ls); |
|
|
|
|
map.put("合计",total); |
|
|
|
|
test.add(map); |
|
|
|
|
String popHtml =TemplateUtil.popTemplate("商配配配送单",map,html); |
|
|
|
|
PrintPreviewVO printPreviewVO = new PrintPreviewVO(); |
|
|
|
|
printPreviewVO.setTemplateId(templateId); |
|
|
|
|
printPreviewVO.setTemplateHtml(popHtml); |
|
|
|
|
result.add(printPreviewVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
log.info("#############test: test={}",test); |
|
|
|
|
String s = JSON.toJSONString(test); |
|
|
|
|
JSONArray array= JSONArray.parseArray(JSON.toJSONString(test)); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 得到填充内容 |
|
|
|
|
* @param template |
|
|
|
|
* @param idArray |
|
|
|
|
* @param html |
|
|
|
|
* @return |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
private List<PrintPreviewVO> handleShiPeiData(BasicPrintTemplateEntity template, String[] idArray,String html) throws Exception { |
|
|
|
|
|
|
|
|
|
List<PrintPreviewVO> result = new ArrayList<>(); |
|
|
|
|
List<Map> data = new ArrayList<>(); |
|
|
|
|
for (String id : idArray) { |
|
|
|
|
|
|
|
|
|
// 获取需要的数据
|
|
|
|
|
|
|
|
|
|
DistributionDeliveryListEntity byId = this.getById(id); |
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isNull(byId)) { |
|
|
|
|
throw new ServiceException("未找到相关数据"); |
|
|
|
|
} |
|
|
|
|
//查询这个配送下面的预约单
|
|
|
|
|
|
|
|
|
|
List<DistributionReservationEntity> distributionReservationEntityList = distributionReservationMapper.findByDeliveryId(byId.getId()); |
|
|
|
|
|
|
|
|
|
for (DistributionReservationEntity distributionReservationEntity : distributionReservationEntityList) { |
|
|
|
|
if (distributionReservationEntityList.isEmpty()) { |
|
|
|
|
throw new ServiceException("未找到相关数据"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (DistributionReservationEntity distributionReservationEntity : distributionReservationEntityList) { |
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
log.debug(">>>> distributionReservationEntity {}",distributionReservationEntity); |
|
|
|
|
map.put("配送单号", distributionReservationEntity.getReservationCode()); |
|
|
|
|
// todo 商场电话是否需要查询商场信息得到电话
|
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(distributionReservationEntity.getReservationCode()); |
|
|
|
|
map.put("配送单二维码",QRCodeUtil.getEmpAutograph(fileTypeName)); |
|
|
|
|
|
|
|
|
|
// todo 查询运单的收货人电话
|
|
|
|
|
map.put("商场名称", distributionReservationEntity.getMallName()); |
|
|
|
|
map.put("商场电话", distributionReservationEntity.getReservationCode()); |
|
|
|
|
|
|
|
|
|
map.put("送货日期", DateUtil.format(distributionReservationEntity.getReservationDate(), "yyyy-MM-dd") + " 全天"); |
|
|
|
@ -3203,32 +3416,40 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2
|
|
|
|
|
List<Map<String, Object>> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("定制品集合", spaclOrderList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("备注", distributionReservationEntity.getRemarks()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("送货司机", byId.getTrainNumber() + "/" + byId.getDriverName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("送货司机", byId.getVehicleName() + "/" + byId.getDriverName()); |
|
|
|
|
data.add(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String popHtml =TemplateUtil.popTemplate("市配配送单",map,html); |
|
|
|
|
PrintPreviewVO printPreviewVO = new PrintPreviewVO(); |
|
|
|
|
printPreviewVO.setTemplateId(template.getId()); |
|
|
|
|
printPreviewVO.setTemplateHtml(popHtml); |
|
|
|
|
result.add(printPreviewVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return printPreviewVO; |
|
|
|
|
private BasicPrintTemplateEntity getPrintTemplate(Integer type) { |
|
|
|
|
BasicPrintTemplateEntity template = null; |
|
|
|
|
if (2 == type) { |
|
|
|
|
template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_1.getValue()); |
|
|
|
|
} else if (1 == type) { |
|
|
|
|
template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_12.getValue()); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
|
throw new ServiceException("模板内容未找到"); |
|
|
|
|
} |
|
|
|
|
return template; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建预约单下面的订单信息 |
|
|
|
|
* |
|
|
|
|
* @param id 预约单ID |
|
|
|
|
* @param distributionReservationEntity 预约单 |
|
|
|
|
* @param i 构建类型 1 表示订单 2 表示库存品 |
|
|
|
|
* @return List |
|
|
|
|
*/ |
|
|
|
@ -3258,6 +3479,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
temp.put("数量", distributionReservationStockarticleEntity.getReservationNum()); |
|
|
|
|
temp.put("备货区", null); |
|
|
|
|
//todo 这里还没完成
|
|
|
|
|
temp.put("货位", null); |
|
|
|
|
|
|
|
|
|
result.add(temp); |
|
|
|
|
|
|
|
|
|