|
|
|
@ -19,7 +19,6 @@ package com.logpm.distribution.service.impl;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
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.StringUtils; |
|
|
|
@ -88,7 +87,6 @@ import java.io.IOException;
|
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1828,6 +1826,65 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public OrderCodeDataVO showOrderCode(Map<String, Object> params) throws Exception { |
|
|
|
|
OrderCodeDataVO orderCodeDataVO = new OrderCodeDataVO(); |
|
|
|
|
List<Map<String,Object>> data = new ArrayList<>(); |
|
|
|
|
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_14.getValue()); |
|
|
|
|
if (ObjectUtil.isEmpty(template)) { |
|
|
|
|
throw new ServiceException("模板内容未找到"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String html = TemplateUtil.getTemplateByUrl(template.getTemplateUrl()); |
|
|
|
|
orderCodeDataVO.setTemplateHtml(html); |
|
|
|
|
orderCodeDataVO.setTemplateId(template.getId()); |
|
|
|
|
String ids = (String) params.get("ids"); |
|
|
|
|
|
|
|
|
|
String[] idArray = ids.split(","); |
|
|
|
|
if (ObjectUtils.isNull(idArray)) { |
|
|
|
|
throw new ServiceException("参数错误"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
for (String orderId : idArray) { |
|
|
|
|
JSONObject jsonObject = baseMapper.findShowOrderCodeData(Long.parseLong(orderId)); |
|
|
|
|
String orderCode = jsonObject.getString("orderCode"); |
|
|
|
|
String waybillNo = jsonObject.getString("waybillNo"); |
|
|
|
|
String descriptionGoods = jsonObject.getString("descriptionGoods"); |
|
|
|
|
Integer totalNumber = jsonObject.getInteger("totalNumber"); |
|
|
|
|
|
|
|
|
|
Map<String, Object> map = jsonObject.getInnerMap(); |
|
|
|
|
map.put("id", orderId); |
|
|
|
|
String filename = QRCodeUtil.createCodeToFile(orderCode); |
|
|
|
|
map.put("orderCodeImage", QRCodeUtil.getEmpAutograph(filename)); |
|
|
|
|
// 订单号 生成二维码
|
|
|
|
|
String fileTypeName = QRCodeUtil.createCodeToFile(orderCode); |
|
|
|
|
map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); |
|
|
|
|
if(orderCode.equals(waybillNo)){ |
|
|
|
|
map.put("product",descriptionGoods+"("+totalNumber+")"); |
|
|
|
|
}else{ |
|
|
|
|
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("stock_article_id",Long.parseLong(orderId)); |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper); |
|
|
|
|
StringBuilder product = new StringBuilder(); |
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : list) { |
|
|
|
|
String firsts = parcelListEntity.getFirsts(); |
|
|
|
|
Integer quantity = parcelListEntity.getQuantity(); |
|
|
|
|
if(StringUtils.isBlank(product)){ |
|
|
|
|
product.append(firsts).append("(").append(quantity).append(")"); |
|
|
|
|
}else{ |
|
|
|
|
product.append(",").append(firsts).append("(").append(quantity).append(")"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
map.put("product",product.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
data.add(map); |
|
|
|
|
} |
|
|
|
|
orderCodeDataVO.setDataList(data); |
|
|
|
|
|
|
|
|
|
return orderCodeDataVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DistributionStockArticleEntity findZeroByOrderCodeAndWarehouseId(String orderCode, Long warehouseId) { |
|
|
|
|