|
@@ -19,6 +19,7 @@ import com.sd.business.entity.order.enums.OrderClassifyEnum;
|
|
|
import com.sd.business.entity.order.po.OrderInfo;
|
|
|
import com.sd.business.entity.order.po.OrderSku;
|
|
|
import com.sd.business.entity.order.po.OrderSkuProductionCost;
|
|
|
+import com.sd.business.entity.outbound.po.OutboundOrder;
|
|
|
import com.sd.business.entity.sku.bo.SkuSpecBo;
|
|
|
import com.sd.business.entity.sku.po.SkuSpec;
|
|
|
import com.sd.business.entity.statement.dto.*;
|
|
@@ -30,6 +31,7 @@ import com.sd.business.service.inventory.InventoryFinishedOrderDetailService;
|
|
|
import com.sd.business.service.order.OrderService;
|
|
|
import com.sd.business.service.order.OrderSkuProductionCostService;
|
|
|
import com.sd.business.service.order.OrderSkuService;
|
|
|
+import com.sd.business.service.outbound.OutboundOrderService;
|
|
|
import com.sd.business.service.sku.SkuSpecService;
|
|
|
import com.sd.business.service.statement.StatementOfAccountExportService;
|
|
|
import com.sd.business.service.statement.StatementOfAccountMergeService;
|
|
@@ -38,9 +40,11 @@ import com.sd.business.strategy.impl.DefaultExportStrategy;
|
|
|
import com.sd.business.strategy.impl.DocumentByOrderExcelExportStrategy;
|
|
|
import com.sd.business.strategy.impl.SalesOutWarehouseDetailsExportStrategy;
|
|
|
import com.sd.framework.util.Assert;
|
|
|
+import com.sd.framework.util.excel.util.ExcelUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
@@ -59,6 +63,9 @@ import java.util.stream.Collectors;
|
|
|
public class StatementOfAccountMergeServiceImpl implements StatementOfAccountMergeService {
|
|
|
|
|
|
@Autowired
|
|
|
+ private HttpServletResponse response;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private StatementOfAccountService statementOfAccountService;
|
|
|
|
|
|
@Autowired
|
|
@@ -85,6 +92,9 @@ public class StatementOfAccountMergeServiceImpl implements StatementOfAccountMer
|
|
|
@Autowired
|
|
|
private InventoryFinishedOrderDetailService inventoryFinishedOrderDetailService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OutboundOrderService outboundOrderService;
|
|
|
+
|
|
|
@Override
|
|
|
public Page<StatementOfAccountMergePageVo> getPage(StatementOfAccountMergePageDto dto) {
|
|
|
|
|
@@ -510,6 +520,15 @@ public class StatementOfAccountMergeServiceImpl implements StatementOfAccountMer
|
|
|
DateUtil.formatDate(new Date()) + " 销售收入成本表");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void exportDeliveryOfGoodsExcel(List<Long> idList) {
|
|
|
+ List<String> orderWlnCodeList = getOrderWlnCodeList(idList);
|
|
|
+ List<OutboundOrder> outboundOrderList = getOutboundOrderList(orderWlnCodeList);
|
|
|
+ List<DeliveryOfGoodsVO> deliveryOfGoodsVOList = getDeliveryOfGoodsVOList(outboundOrderList);
|
|
|
+ ExcelUtil.export(response, "货物交接单", "货物交接单明细", deliveryOfGoodsVOList, DeliveryOfGoodsVO.class);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private List<Long> getIdList(GetDocumentDto dto) {
|
|
|
|
|
|
String idGroupConcat = dto.getIdGroupConcat();
|
|
@@ -525,4 +544,80 @@ public class StatementOfAccountMergeServiceImpl implements StatementOfAccountMer
|
|
|
return idList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取万里牛订单编号列表
|
|
|
+ *
|
|
|
+ * @param idList 对账单id列表
|
|
|
+ * @return 万里牛订单编号列表
|
|
|
+ */
|
|
|
+ private List<String> getOrderWlnCodeList(List<Long> idList) {
|
|
|
+ if (idList.isEmpty()) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ List<OrderInfo> list = orderService.list(q -> q.in(OrderInfo::getStatementOfAccountId, idList));
|
|
|
+ return list.stream().map(OrderInfo::getWlnCode).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取出库单列表
|
|
|
+ *
|
|
|
+ * @param orderWlnCodeList 万里牛订单编号列表
|
|
|
+ * @return 出库单列表
|
|
|
+ */
|
|
|
+ private List<OutboundOrder> getOutboundOrderList(List<String> orderWlnCodeList) {
|
|
|
+ if (orderWlnCodeList.isEmpty()) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ return outboundOrderService.list(q -> q.in(OutboundOrder::getOrderWlnCode, orderWlnCodeList));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取货物交接单数据列表
|
|
|
+ *
|
|
|
+ * @param outboundOrderList 出库单列表
|
|
|
+ * @return 货物交接单数据列表
|
|
|
+ */
|
|
|
+ private List<DeliveryOfGoodsVO> getDeliveryOfGoodsVOList(List<OutboundOrder> outboundOrderList) {
|
|
|
+ if (outboundOrderList.isEmpty()) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> skuSpecCodeList = outboundOrderList.stream().map(OutboundOrder::getSkuSpecCode).collect(Collectors.toList());
|
|
|
+ Map<String, String> map = skuSpecService.mapKV(SkuSpec::getCode, SkuSpec::getName, q -> q.in(SkuSpec::getCode, skuSpecCodeList));
|
|
|
+
|
|
|
+ return outboundOrderList.stream()
|
|
|
+ .map(item -> {
|
|
|
+ DeliveryOfGoodsVO deliveryOfGoodsVO = new DeliveryOfGoodsVO();
|
|
|
+ deliveryOfGoodsVO.setReceiptNumber(item.getCode());
|
|
|
+ deliveryOfGoodsVO.setBusinessDate(item.getOutboundTime());
|
|
|
+ deliveryOfGoodsVO.setWarehouse(getWarehouseName(item.getStorageCode()));
|
|
|
+ deliveryOfGoodsVO.setSpec(map.get(item.getSkuSpecCode()));
|
|
|
+ deliveryOfGoodsVO.setOutboundQuantity(item.getQuantity());
|
|
|
+ deliveryOfGoodsVO.setOrderCode(item.getOrderCode());
|
|
|
+ deliveryOfGoodsVO.setOrderWlnCode(item.getOrderWlnCode());
|
|
|
+ deliveryOfGoodsVO.setExpress(item.getExpress());
|
|
|
+ return deliveryOfGoodsVO;
|
|
|
+ })
|
|
|
+ .sorted(Comparator.comparing(DeliveryOfGoodsVO::getBusinessDate))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private String getWarehouseName(String code) {
|
|
|
+ if (Objects.equals(code, "T007")) {
|
|
|
+ return "胜德体育仓-佰卓";
|
|
|
+ }
|
|
|
+ if (Objects.equals(code, "B012")) {
|
|
|
+ return "胜德体育仓-A9";
|
|
|
+ }
|
|
|
+ if (Objects.equals(code, "B013")) {
|
|
|
+ return "胜德体育仓-A1";
|
|
|
+ }
|
|
|
+ if (Objects.equals(code, "B014")) {
|
|
|
+ return "胜德体育仓-A8";
|
|
|
+ }
|
|
|
+
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+
|
|
|
}
|