|
|
|
@ -2674,7 +2674,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//查询配送下的预约信息和配送司机信息
|
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = this.getById(id); |
|
|
|
|
DistributionDeliveryListVO deliveryListVO = Func.copy(deliveryListEntity, DistributionDeliveryListVO.class); |
|
|
|
|
if (Func.isNotEmpty(deliveryListVO)){ |
|
|
|
|
if (Func.isNotEmpty(deliveryListVO)) { |
|
|
|
|
switch (deliveryListEntity.getKind()) { |
|
|
|
|
case "1": |
|
|
|
|
//查询自主配送
|
|
|
|
@ -3155,7 +3155,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PrintPreviewVO printBatch(String ids,Integer type) throws Exception { |
|
|
|
|
public List<PrintPreviewVO> printBatch(String ids, Integer type) throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PrintPreviewVO printPreviewVO = new PrintPreviewVO(); |
|
|
|
@ -3163,21 +3163,24 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
BasicPrintTemplateEntity template = getPrintTemplate(type); |
|
|
|
|
|
|
|
|
|
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); |
|
|
|
|
printPreviewVO.setTemplateHtml(html); |
|
|
|
|
printPreviewVO.setTemplateId(template.getId()); |
|
|
|
|
// printPreviewVO.setTemplateHtml(html);
|
|
|
|
|
// printPreviewVO.setTemplateId(template.getId());
|
|
|
|
|
String[] idArray = ids.split(","); |
|
|
|
|
if (ObjectUtils.isNull(idArray)) { |
|
|
|
|
throw new ServiceException("参数错误"); |
|
|
|
|
} |
|
|
|
|
if(1 == type){ |
|
|
|
|
handleShiPeiData(printPreviewVO,idArray); |
|
|
|
|
}else if(2 == type){ |
|
|
|
|
handleShangPeiData(printPreviewVO,idArray); |
|
|
|
|
}else{ |
|
|
|
|
if (1 == type) { |
|
|
|
|
|
|
|
|
|
return handleShiPeiData(template, idArray,html); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (2 == type) { |
|
|
|
|
handleShangPeiData(printPreviewVO, idArray); |
|
|
|
|
} else { |
|
|
|
|
log.warn("###########printBatch: 未知的打印类型"); |
|
|
|
|
throw new CustomerException(403,"未知的打印类型"); |
|
|
|
|
throw new CustomerException(403, "未知的打印类型"); |
|
|
|
|
} |
|
|
|
|
return printPreviewVO; |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleShangPeiData(PrintPreviewVO printPreviewVO, String[] idArray) { |
|
|
|
@ -3185,7 +3188,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleShiPeiData(PrintPreviewVO printPreviewVO,String[] idArray){ |
|
|
|
|
/** |
|
|
|
|
* 得到填充内容 |
|
|
|
|
* @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) { |
|
|
|
|
|
|
|
|
@ -3195,20 +3208,20 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
DistributionDeliveryListEntity byId = this.getById(id); |
|
|
|
|
|
|
|
|
|
if(ObjectUtils.isNull(byId)){ |
|
|
|
|
if (ObjectUtils.isNull(byId)) { |
|
|
|
|
throw new ServiceException("未找到相关数据"); |
|
|
|
|
} |
|
|
|
|
//查询这个配送下面的预约单
|
|
|
|
|
List<DistributionReservationEntity> distributionReservationEntityList = distributionReservationMapper.findByDeliveryId(byId.getId()); |
|
|
|
|
|
|
|
|
|
if(distributionReservationEntityList.isEmpty()){ |
|
|
|
|
if (distributionReservationEntityList.isEmpty()) { |
|
|
|
|
throw new ServiceException("未找到相关数据"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (DistributionReservationEntity distributionReservationEntity : distributionReservationEntityList) { |
|
|
|
|
|
|
|
|
|
map.put("配送单号", distributionReservationEntity.getReservationCode()); |
|
|
|
|
// todo 商场电话是否需要查询商场信息得到电话
|
|
|
|
|
// todo 查询运单的收货人电话
|
|
|
|
|
map.put("商场电话", distributionReservationEntity.getReservationCode()); |
|
|
|
|
|
|
|
|
|
map.put("送货日期", DateUtil.format(distributionReservationEntity.getReservationDate(), "yyyy-MM-dd") + " 全天"); |
|
|
|
@ -3220,34 +3233,34 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
map.put("送货地址", distributionReservationEntity.getDeliveryAddress()); |
|
|
|
|
|
|
|
|
|
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2
|
|
|
|
|
List<Map<String,Object>> spaclOrderList = buildSpaclOrders(distributionReservationEntity, 1); |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
printPreviewVO.setDataList(data); |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BasicPrintTemplateEntity getPrintTemplate(Integer type){ |
|
|
|
|
private BasicPrintTemplateEntity getPrintTemplate(Integer type) { |
|
|
|
|
BasicPrintTemplateEntity template = null; |
|
|
|
|
if(1 == type){ |
|
|
|
|
if (1 == type) { |
|
|
|
|
template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_1.getValue()); |
|
|
|
|
}else if(2 == type){ |
|
|
|
|
} else if (2 == type) { |
|
|
|
|
template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_12.getValue()); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
@ -3257,7 +3270,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 构建预约单下面的订单信息 |
|
|
|
|
* |
|
|
|
@ -3265,13 +3277,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
* @param i 构建类型 1 表示订单 2 表示库存品 |
|
|
|
|
* @return List |
|
|
|
|
*/ |
|
|
|
|
private List<Map<String,Object>> buildSpaclOrders(DistributionReservationEntity distributionReservationEntity, int i) { |
|
|
|
|
private List<Map<String, Object>> buildSpaclOrders(DistributionReservationEntity distributionReservationEntity, int i) { |
|
|
|
|
|
|
|
|
|
List<DistributionReservationStocklistEntity> distributionReservationStocklistEntities; |
|
|
|
|
|
|
|
|
|
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntityList; |
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> result = new ArrayList<>(); |
|
|
|
|
List<Map<String, Object>> result = new ArrayList<>(); |
|
|
|
|
switch (i) { |
|
|
|
|
case 1: |
|
|
|
|
// 订单
|
|
|
|
@ -3280,18 +3292,18 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// 取值
|
|
|
|
|
for (DistributionReservationStockarticleEntity distributionReservationStockarticleEntity : distributionReservationStockarticleEntityList) { |
|
|
|
|
|
|
|
|
|
Map<String,Object> temp = new HashMap<>(); |
|
|
|
|
Map<String, Object> temp = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleMapper.selectById(distributionReservationStockarticleEntity.getStockArticleId()); |
|
|
|
|
|
|
|
|
|
temp.put("合同号",distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
temp.put("产品名称",distributionStockArticleEntity.getDescriptionGoods()); |
|
|
|
|
temp.put("合同号", distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
temp.put("产品名称", distributionStockArticleEntity.getDescriptionGoods()); |
|
|
|
|
//todo 单位是否需要查询物料表
|
|
|
|
|
temp.put("单位","件"); |
|
|
|
|
temp.put("数量",distributionReservationStockarticleEntity.getReservationNum()); |
|
|
|
|
temp.put("备货区",null); |
|
|
|
|
temp.put("单位", "件"); |
|
|
|
|
temp.put("数量", distributionReservationStockarticleEntity.getReservationNum()); |
|
|
|
|
temp.put("备货区", null); |
|
|
|
|
//todo 这里还没完成
|
|
|
|
|
temp.put("货位",null); |
|
|
|
|
temp.put("货位", null); |
|
|
|
|
|
|
|
|
|
result.add(temp); |
|
|
|
|
|
|
|
|
|