Commit 5f8cdcf0b2be6728b160f79943615d387ce0bd10

Authored by 房远帅
2 parents 6d4f77d4 3795622d

Merge branch 'master_after0506_report' into master_after0506

@@ -4,13 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat; @@ -4,13 +4,19 @@ import com.fasterxml.jackson.annotation.JsonFormat;
4 import java.math.BigDecimal; 4 import java.math.BigDecimal;
5 import com.lframework.starter.common.constants.StringPool; 5 import com.lframework.starter.common.constants.StringPool;
6 import com.lframework.starter.web.core.bo.BaseBo; 6 import com.lframework.starter.web.core.bo.BaseBo;
  7 +import com.lframework.starter.web.core.utils.ApplicationUtil;
  8 +import com.lframework.starter.web.inner.entity.SysDataDicItem;
  9 +import com.lframework.starter.web.inner.service.system.SysDataDicItemService;
7 import java.time.LocalDate; 10 import java.time.LocalDate;
8 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
  12 +import java.util.Map;
  13 +import java.util.concurrent.ConcurrentHashMap;
9 14
10 import com.lframework.xingyun.sc.entity.OrderDetailReport; 15 import com.lframework.xingyun.sc.entity.OrderDetailReport;
11 import io.swagger.annotations.ApiModelProperty; 16 import io.swagger.annotations.ApiModelProperty;
12 17
13 import lombok.Data; 18 import lombok.Data;
  19 +import org.apache.commons.lang3.StringUtils;
14 20
15 /** 21 /**
16 * <p> 22 * <p>
@@ -20,6 +26,10 @@ import lombok.Data; @@ -20,6 +26,10 @@ import lombok.Data;
20 */ 26 */
21 @Data 27 @Data
22 public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> { 28 public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> {
  29 + private static final String DIC_EXECUTION_STANDARD = "APPLICABLE_STANDARD";
  30 + private static final String DIC_CONTRACT_PRODUCT = "CONTRACT_PRODUCT";
  31 + private static final String DIC_SPECIAL_REQUIREMENTS = "CONDITIONS_REQUIRED";
  32 + private static final Map<String, String> DIC_NAME_CACHE = new ConcurrentHashMap<>();
23 33
24 /** 34 /**
25 * ID 35 * ID
@@ -64,6 +74,9 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> { @@ -64,6 +74,9 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> {
64 @ApiModelProperty("科办") 74 @ApiModelProperty("科办")
65 private String deptName; 75 private String deptName;
66 76
  77 + @ApiModelProperty("办事处编码")
  78 + private String deptCode;
  79 +
67 /** 80 /**
68 * 区域 81 * 区域
69 */ 82 */
@@ -290,6 +303,33 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> { @@ -290,6 +303,33 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> {
290 @ApiModelProperty("工艺要求") 303 @ApiModelProperty("工艺要求")
291 private String productionProcess; 304 private String productionProcess;
292 305
  306 + @ApiModelProperty("客户简称")
  307 + private String customerShortName;
  308 +
  309 + @ApiModelProperty("结算方式或期限")
  310 + private String settlementTerms;
  311 +
  312 + @ApiModelProperty("执行标准")
  313 + private String executionStandard;
  314 +
  315 + @ApiModelProperty("执行标准备注")
  316 + private String executionStandardRemarks;
  317 +
  318 + @ApiModelProperty("结构报表用(产品名称)")
  319 + private String structureReportUsed;
  320 +
  321 + @ApiModelProperty("合同类型编码")
  322 + private String contractTypeCode;
  323 +
  324 + @ApiModelProperty("合同类型(经销标准、经销库存、经销未锁规、外贸标准、外贸库存、外贸未锁规、加工标准)")
  325 + private String contractTypeName;
  326 +
  327 + @ApiModelProperty("特别注重要求")
  328 + private String specialRequirements;
  329 +
  330 + @ApiModelProperty("合同创建人")
  331 + private String contractCreateBy;
  332 +
293 public QueryOrderDetailReportBo() { 333 public QueryOrderDetailReportBo() {
294 334
295 } 335 }
@@ -306,6 +346,92 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> { @@ -306,6 +346,92 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> {
306 346
307 @Override 347 @Override
308 protected void afterInit(OrderDetailReport dto) { 348 protected void afterInit(OrderDetailReport dto) {
  349 + this.executionStandard = getDicItemNameOrOriginal(DIC_EXECUTION_STANDARD, this.executionStandard);
  350 + if ("其它".equals(this.executionStandard) && StringUtils.isNotBlank(this.executionStandardRemarks)) {
  351 + this.executionStandard = this.executionStandardRemarks;
  352 + }
  353 + this.structureReportUsed = getDicItemNameOrOriginal(DIC_CONTRACT_PRODUCT, this.structureReportUsed);
  354 + this.specialRequirements = getDicItemNameOrOriginal(DIC_SPECIAL_REQUIREMENTS, this.specialRequirements);
  355 + this.deptCode = convertDeptNameToDeptCode(this.deptName);
  356 + this.contractTypeName = handleContractType(this.contractTypeCode);
  357 + }
  358 +
  359 + private static String getDicItemNameOrOriginal(String dicCode, String itemCode) {
  360 + if (StringUtils.isBlank(dicCode) || StringUtils.isBlank(itemCode)) {
  361 + return itemCode;
  362 + }
  363 + String cacheKey = dicCode + "|" + itemCode;
  364 + String cached = DIC_NAME_CACHE.get(cacheKey);
  365 + if (cached != null) {
  366 + return cached;
  367 + }
  368 + SysDataDicItemService sysDataDicItemService = ApplicationUtil.getBean(SysDataDicItemService.class);
  369 + SysDataDicItem dicItem = sysDataDicItemService.findByCode(dicCode, itemCode);
  370 + String name = dicItem == null ? itemCode : dicItem.getName();
  371 + if (StringUtils.isBlank(name)) {
  372 + name = itemCode;
  373 + }
  374 + DIC_NAME_CACHE.put(cacheKey, name);
  375 + return name;
  376 + }
  377 +
  378 + private static String convertDeptNameToDeptCode(String deptName) {
  379 + if (StringUtils.isBlank(deptName)) {
  380 + return null;
  381 + }
  382 + String name = deptName.trim();
  383 + if (name.contains("北方")) {
  384 + return "BF";
  385 + }
  386 + if (name.contains("常州")) {
  387 + return "CZ";
  388 + }
  389 + if (name.contains("东莞")) {
  390 + return "DG";
  391 + }
  392 + if (name.contains("佛山")) {
  393 + return "FS";
  394 + }
  395 + if (name.contains("宁波")) {
  396 + return "NB";
  397 + }
  398 + if (name.contains("苏州")) {
  399 + return "SZ";
  400 + }
  401 + if (name.contains("温州")) {
  402 + return "WZ";
  403 + }
  404 + if (name.contains("紫铜")) {
  405 + return "ZT";
  406 + }
  407 + if (name.contains("外贸")) {
  408 + return "WM";
  409 + }
  410 + return null;
  411 + }
309 412
  413 + private static String handleContractType(String contractType) {
  414 + if ("DISTRIB_STD".equals(contractType)) {
  415 + return "经销标准";
  416 + }
  417 + if ("DIST_STOCK_CONTRACT".equals(contractType)) {
  418 + return "经销库存";
  419 + }
  420 + if ("DRAFT_DIST_AGMT".equals(contractType)) {
  421 + return "经销未锁规";
  422 + }
  423 + if ("INTL_STD_CONTRACT".equals(contractType)) {
  424 + return "外贸标准";
  425 + }
  426 + if ("INTL_INVENTORY_AGMT".equals(contractType)) {
  427 + return "外贸库存";
  428 + }
  429 + if ("INTL_OPEN_SPEC_AGMT".equals(contractType)) {
  430 + return "外贸未锁规";
  431 + }
  432 + if ("PROCESS_STD_AGMT".equals(contractType)) {
  433 + return "加工标准";
  434 + }
  435 + return null;
310 } 436 }
311 } 437 }
@@ -14,6 +14,8 @@ import com.lframework.xingyun.sc.entity.OrderDetailReport; @@ -14,6 +14,8 @@ import com.lframework.xingyun.sc.entity.OrderDetailReport;
14 import com.lframework.xingyun.sc.enums.ExportType; 14 import com.lframework.xingyun.sc.enums.ExportType;
15 import com.lframework.xingyun.sc.excel.statistics.OrderDetailReportExportTaskWorker; 15 import com.lframework.xingyun.sc.excel.statistics.OrderDetailReportExportTaskWorker;
16 import com.lframework.xingyun.sc.excel.statistics.QualityOrderDetailReportExportTaskWorker; 16 import com.lframework.xingyun.sc.excel.statistics.QualityOrderDetailReportExportTaskWorker;
  17 +import com.lframework.xingyun.sc.excel.statistics.StockInOrderDetailReportExportTaskWorker;
  18 +import com.lframework.xingyun.sc.excel.statistics.StockInboundOrderDetailReportExportTaskWorker;
17 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService; 19 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
18 import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo; 20 import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo;
19 import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo; 21 import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
@@ -64,6 +66,46 @@ public class OrderDetailReportController extends DefaultBaseController { @@ -64,6 +66,46 @@ public class OrderDetailReportController extends DefaultBaseController {
64 } 66 }
65 67
66 /** 68 /**
  69 + * 库存入库订单明查询
  70 + */
  71 + @ApiOperation("库存入库订单明查询")
  72 + @HasPermission({"statistical-report:stock-order-detail:query"})
  73 + @GetMapping("/inventoryUnlocked/query")
  74 + public InvokeResult<PageResult<QueryOrderDetailReportBo>> inventoryUnlockedQuery(@Valid QueryOrderDetailReportVo vo) {
  75 + vo.setInventoryUnlockedOnly(Boolean.TRUE);
  76 + vo.setExcludeInventoryUnlocked(null);
  77 + PageResult<OrderDetailReport> pageResult = orderDetailReportService.query(getPageIndex(vo), getPageSize(vo), vo);
  78 + List<OrderDetailReport> datas = pageResult.getDatas();
  79 + List<QueryOrderDetailReportBo> results = null;
  80 +
  81 + if (!CollectionUtil.isEmpty(datas)) {
  82 + results = datas.stream().map(QueryOrderDetailReportBo::new).collect(Collectors.toList());
  83 + }
  84 +
  85 + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
  86 + }
  87 +
  88 + /**
  89 + * 入库订单明细查询
  90 + */
  91 + @ApiOperation("入库订单明细查询")
  92 + @HasPermission({"statistical-report:warehousing-order-detail:query"})
  93 + @GetMapping("/stockIn/query")
  94 + public InvokeResult<PageResult<QueryOrderDetailReportBo>> stockInQuery(@Valid QueryOrderDetailReportVo vo) {
  95 + vo.setExcludeInventoryUnlocked(Boolean.TRUE);
  96 + vo.setInventoryUnlockedOnly(null);
  97 + PageResult<OrderDetailReport> pageResult = orderDetailReportService.query(getPageIndex(vo), getPageSize(vo), vo);
  98 + List<OrderDetailReport> datas = pageResult.getDatas();
  99 + List<QueryOrderDetailReportBo> results = null;
  100 +
  101 + if (!CollectionUtil.isEmpty(datas)) {
  102 + results = datas.stream().map(QueryOrderDetailReportBo::new).collect(Collectors.toList());
  103 + }
  104 +
  105 + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
  106 + }
  107 +
  108 + /**
67 * 根据ID查询 109 * 根据ID查询
68 */ 110 */
69 @ApiOperation("根据ID查询") 111 @ApiOperation("根据ID查询")
@@ -108,6 +150,34 @@ public class OrderDetailReportController extends DefaultBaseController { @@ -108,6 +150,34 @@ public class OrderDetailReportController extends DefaultBaseController {
108 } 150 }
109 151
110 /** 152 /**
  153 + * 库存入库订单明细导出
  154 + */
  155 + @ApiOperation("库存入库订单明细导出")
  156 + @HasPermission({"statistical-report:stock-order-detail:export"})
  157 + @PostMapping("/inventoryUnlocked/export")
  158 + public InvokeResult<Void> inventoryUnlockedExport(@Valid @RequestBody QueryOrderDetailReportVo vo) {
  159 + vo.setInventoryUnlockedOnly(Boolean.TRUE);
  160 + vo.setExcludeInventoryUnlocked(null);
  161 + vo.setExportType(ExportType.INVENTORY_UNLOCKED_ORDER_DETAIL_REPORT.getCode());
  162 + ExportTaskUtil.exportTask("库存入库订单明细报表", StockInOrderDetailReportExportTaskWorker.class, vo);
  163 + return InvokeResultBuilder.success();
  164 + }
  165 +
  166 + /**
  167 + * 入库订单明细导出
  168 + */
  169 + @ApiOperation("入库订单明细导出")
  170 + @HasPermission({"statistical-report:warehousing-order-detail:export"})
  171 + @PostMapping("/stockIn/export")
  172 + public InvokeResult<Void> stockInExport(@Valid @RequestBody QueryOrderDetailReportVo vo) {
  173 + vo.setExcludeInventoryUnlocked(Boolean.TRUE);
  174 + vo.setInventoryUnlockedOnly(null);
  175 + vo.setExportType(ExportType.STOCK_IN_ORDER_DETAIL_REPORT.getCode());
  176 + ExportTaskUtil.exportTask("入库订单明细报表", StockInboundOrderDetailReportExportTaskWorker.class, vo);
  177 + return InvokeResultBuilder.success();
  178 + }
  179 +
  180 + /**
111 * 处理历史数据 181 * 处理历史数据
112 */ 182 */
113 @ApiOperation("处理历史数据") 183 @ApiOperation("处理历史数据")
@@ -286,4 +286,55 @@ public class OrderDetailReport extends BaseEntity implements BaseDto { @@ -286,4 +286,55 @@ public class OrderDetailReport extends BaseEntity implements BaseDto {
286 @TableField(fill = FieldFill.INSERT_UPDATE) 286 @TableField(fill = FieldFill.INSERT_UPDATE)
287 private LocalDateTime updateTime; 287 private LocalDateTime updateTime;
288 288
  289 + /**
  290 + * 办事处编码
  291 + */
  292 + @TableField(exist = false)
  293 + private String deptCode;
  294 +
  295 + /**
  296 + * 客户简称(基础信息-客户简称)
  297 + */
  298 + @TableField(exist = false)
  299 + private String customerShortName;
  300 +
  301 + /**
  302 + * 结算方式
  303 + */
  304 + @TableField(exist = false)
  305 + private String settlementTerms;
  306 +
  307 + /**
  308 + * 执行标准
  309 + */
  310 + @TableField(exist = false)
  311 + private String executionStandard;
  312 +
  313 + /**
  314 + * 执行标准备注(当执行标准为“其它”时使用)
  315 + */
  316 + @TableField(exist = false)
  317 + private String executionStandardRemarks;
  318 +
  319 + /**
  320 + * 结构报表用(合同物料行产品)
  321 + */
  322 + @TableField(exist = false)
  323 + private String structureReportUsed;
  324 +
  325 + /**
  326 + * 合同类型编码
  327 + */
  328 + @TableField(exist = false)
  329 + private String contractTypeCode;
  330 +
  331 + /**
  332 + * 特别注重要求
  333 + */
  334 + @TableField(exist = false)
  335 + private String specialRequirements;
  336 +
  337 + @TableField(exist = false)
  338 + private String contractCreateBy;
  339 +
289 } 340 }
@@ -14,6 +14,8 @@ public enum ExportType implements BaseEnum<String> { @@ -14,6 +14,8 @@ public enum ExportType implements BaseEnum<String> {
14 ORDER_DETAIL_REPORT("ORDER_DETAIL_REPORT", "订单明细报表"), 14 ORDER_DETAIL_REPORT("ORDER_DETAIL_REPORT", "订单明细报表"),
15 ORDER_EXPORT_ZIP("ORDER_EXPORT_ZIP", "订货单信息"), 15 ORDER_EXPORT_ZIP("ORDER_EXPORT_ZIP", "订货单信息"),
16 QUALITY_ORDER_DETAIL_REPORT("QUALITY_ORDER_DETAIL_REPORT", "品质科订单明细报表"), 16 QUALITY_ORDER_DETAIL_REPORT("QUALITY_ORDER_DETAIL_REPORT", "品质科订单明细报表"),
  17 + INVENTORY_UNLOCKED_ORDER_DETAIL_REPORT("INVENTORY_UNLOCKED_ORDER_DETAIL_REPORT", "库存入库订单明细报表"),
  18 + STOCK_IN_ORDER_DETAIL_REPORT("STOCK_IN_ORDER_DETAIL_REPORT", "入库订单明细报表"),
17 19
18 20
19 ; 21 ;
  1 +package com.lframework.xingyun.sc.excel.statistics;
  2 +
  3 +import com.lframework.starter.common.utils.CollectionUtil;
  4 +import com.lframework.starter.mq.core.components.export.ExportTaskWorker;
  5 +import com.lframework.starter.web.core.components.resp.PageResult;
  6 +import com.lframework.starter.web.core.utils.ApplicationUtil;
  7 +import com.lframework.starter.web.core.utils.JsonUtil;
  8 +import com.lframework.starter.web.core.utils.PageResultUtil;
  9 +import com.lframework.xingyun.sc.bo.statistics.orderDetail.QueryOrderDetailReportBo;
  10 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  11 +import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  12 +import com.lframework.xingyun.sc.utils.CommonUtil;
  13 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
  14 +import org.apache.commons.lang3.StringUtils;
  15 +
  16 +import java.math.BigDecimal;
  17 +import java.time.LocalDate;
  18 +import java.time.ZoneId;
  19 +import java.util.List;
  20 +import java.util.Date;
  21 +import java.util.stream.Collectors;
  22 +
  23 +public class StockInOrderDetailReportExportTaskWorker implements
  24 + ExportTaskWorker<QueryOrderDetailReportVo, QueryOrderDetailReportBo, StockInOrderDetailReportModel> {
  25 +
  26 + @Override
  27 + public QueryOrderDetailReportVo parseParams(String json) {
  28 + return JsonUtil.parseObject(json, QueryOrderDetailReportVo.class);
  29 + }
  30 +
  31 + @Override
  32 + public PageResult<QueryOrderDetailReportBo> getDataList(int pageIndex, int pageSize, QueryOrderDetailReportVo params) {
  33 + OrderDetailReportService orderDetailReportService = ApplicationUtil.getBean(OrderDetailReportService.class);
  34 + PageResult<OrderDetailReport> pageResult = orderDetailReportService.query(pageIndex, pageSize, params);
  35 + List<QueryOrderDetailReportBo> results = null;
  36 + if (!CollectionUtil.isEmpty(pageResult.getDatas())) {
  37 + results = pageResult.getDatas().stream().map(QueryOrderDetailReportBo::new).collect(Collectors.toList());
  38 + }
  39 + return PageResultUtil.rebuild(pageResult, results);
  40 + }
  41 +
  42 + @Override
  43 + public StockInOrderDetailReportModel exportData(QueryOrderDetailReportBo data) {
  44 + String thicknessTol = CommonUtil.handleTolData(
  45 + data.getThicknessTolPos() != null ? data.getThicknessTolPos().doubleValue() : null,
  46 + data.getThicknessTolNeg() != null ? data.getThicknessTolNeg().doubleValue() : null);
  47 + String widthTol = CommonUtil.handleTolData(
  48 + data.getWidthTolPos() != null ? data.getWidthTolPos().doubleValue() : null,
  49 + data.getWidthTolNeg() != null ? data.getWidthTolNeg().doubleValue() : null);
  50 + String lengthTol = CommonUtil.handleTolData(
  51 + data.getLengthTolPos() != null ? data.getLengthTolPos().doubleValue() : null,
  52 + data.getLengthTolNeg() != null ? data.getLengthTolNeg().doubleValue() : null);
  53 +
  54 + StockInOrderDetailReportModel model = new StockInOrderDetailReportModel();
  55 + model.setOrderNo(data.getOrderNo());
  56 + model.setDeptCode(data.getDeptCode());
  57 + model.setCustomerShortName(data.getCustomerShortName());
  58 + model.setOrderDate(toDate(data.getOrderDate()));
  59 + model.setWorkshopName(data.getWorkshopName());
  60 + model.setDeptName(data.getDeptName());
  61 + model.setRegionName(data.getRegionName());
  62 + model.setCustomerName(data.getOrderingUnitName());
  63 + model.setIndustry(data.getIndustry());
  64 + model.setStructureReportUsed(data.getStructureReportUsed());
  65 + model.setBrand(data.getBrand());
  66 + model.setThickness(data.getThickness());
  67 + model.setThicknessTol(thicknessTol);
  68 + model.setWidth(data.getWidth());
  69 + model.setWidthTol(widthTol);
  70 + model.setLength(data.getLength());
  71 + model.setLengthTol(lengthTol);
  72 + model.setStatus(data.getStatus());
  73 + model.setQuantity(data.getQuantity());
  74 + model.setSuggestedPrice(toBigDecimalOrZero(data.getSuggestedPrice()));
  75 + model.setDeliveryDate(toDate(data.getDeliveryDate()));
  76 + model.setAssessmentExceedsAgreement(toBigDecimalOrZero(data.getAssessmentExceedsAgreement()));
  77 + model.setExecutionStandard(data.getExecutionStandard());
  78 + model.setSalesPrice(toBigDecimalOrZero(data.getSalesPrice()));
  79 + model.setPriceListNo(data.getPriceListNo());
  80 + model.setPackagingFee(stringToBigDecimal(data.getPackagingFee()));
  81 + model.setSettlementTerms(data.getSettlementTerms());
  82 + model.setPieceWeightHeader(data.getPieceWeightHeader());
  83 + model.setSurface(data.getSurface());
  84 + model.setTolerance(data.getTolerance());
  85 + model.setPerformance(data.getPerformance());
  86 + model.setPackaging(data.getPackaging());
  87 + model.setSpecialRequirements(data.getSpecialRequirements());
  88 + model.setRemarks(data.getRemarks());
  89 + model.setSalesman(data.getContractCreateBy());
  90 + model.setShippingCost(stringToBigDecimal(data.getShippingCost()));
  91 + model.setReturnShippingCost(stringToBigDecimal(data.getReturnShippingCost()));
  92 + model.setCustomerType(data.getCustomerType());
  93 + model.setQuality(data.getQuality());
  94 + model.setProcessingAndDistributor(data.getContractType());
  95 + model.setActualCustomer(data.getOrderingUnitName());
  96 + model.setOrderType(data.getContractTypeName());
  97 + model.setLeadCadmiumPpm("Pb≤ppm\n" + "Cd≤ppm");
  98 + model.setIronConductivity("Fe≤ppm\n" + "Co+Ni≤ppm\n" + "%IACS");
  99 + model.setReserve1(data.getIndustry());
  100 + model.setReserve3(data.getOrderNo());
  101 + return model;
  102 + }
  103 +
  104 + @Override
  105 + public Class<StockInOrderDetailReportModel> getModelClass() {
  106 + return StockInOrderDetailReportModel.class;
  107 + }
  108 +
  109 + private static Date toDate(LocalDate date) {
  110 + if (date == null) {
  111 + return null;
  112 + }
  113 + return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
  114 + }
  115 +
  116 + private static BigDecimal toBigDecimalOrZero(String value) {
  117 + if (StringUtils.isBlank(value)) {
  118 + return BigDecimal.ZERO;
  119 + }
  120 + try {
  121 + return new BigDecimal(value.trim());
  122 + } catch (Exception e) {
  123 + return BigDecimal.ZERO;
  124 + }
  125 + }
  126 +
  127 + public static BigDecimal stringToBigDecimal(String str) {
  128 + // 1. 判空处理:如果为 null 或去除空格后为空字符串,直接返回 null
  129 + if (str == null || str.trim().isEmpty()) {
  130 + return null;
  131 + }
  132 +
  133 + // 2. 尝试转换
  134 + try {
  135 + // 建议先 trim() 去除首尾空格,避免 " 100 " 这种格式报错
  136 + return new BigDecimal(str.trim());
  137 + } catch (NumberFormatException e) {
  138 + // 3. 如果字符串格式不合法(如 "abc"),根据业务需求处理,这里同样返回 null
  139 + return null;
  140 + }
  141 + }
  142 +
  143 +}
  144 +
  1 +package com.lframework.xingyun.sc.excel.statistics;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelProperty;
  4 +import com.alibaba.excel.annotation.format.DateTimeFormat;
  5 +import com.lframework.starter.web.core.components.excel.ExcelModel;
  6 +import lombok.Data;
  7 +
  8 +import java.math.BigDecimal;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * 库存入库订单明细
  13 + */
  14 +@Data
  15 +public class StockInOrderDetailReportModel implements ExcelModel {
  16 +
  17 + @ExcelProperty(value = "订单编号", index = 0)
  18 + private String orderNo;
  19 +
  20 + @ExcelProperty(value = "办事处编码", index = 1)
  21 + private String deptCode;
  22 +
  23 + @ExcelProperty(value = "客户简称", index = 2)
  24 + private String customerShortName;
  25 +
  26 + @ExcelProperty(value = "订货日期", index = 3)
  27 + @DateTimeFormat("yyyy-MM-dd")
  28 + private Date orderDate;
  29 +
  30 + @ExcelProperty(value = "生产厂", index = 4)
  31 + private String workshopName;
  32 +
  33 + @ExcelProperty(value = "科办", index = 5)
  34 + private String deptName;
  35 +
  36 + @ExcelProperty(value = "片", index = 6)
  37 + private String regionName;
  38 +
  39 + @ExcelProperty(value = "客户名称", index = 7)
  40 + private String customerName;
  41 +
  42 + @ExcelProperty(value = "行业(用途)", index = 8)
  43 + private String industry;
  44 +
  45 + @ExcelProperty(value = "结构报表用", index = 9)
  46 + private String structureReportUsed;
  47 +
  48 + @ExcelProperty(value = "牌号", index = 10)
  49 + private String brand;
  50 +
  51 + @ExcelProperty(value = "厚", index = 11)
  52 + private BigDecimal thickness;
  53 +
  54 + @ExcelProperty(value = "误差", index = 12)
  55 + private String thicknessTol;
  56 +
  57 + @ExcelProperty(value = "宽", index = 13)
  58 + private BigDecimal width;
  59 +
  60 + @ExcelProperty(value = "误差", index = 14)
  61 + private String widthTol;
  62 +
  63 + @ExcelProperty(value = "长", index = 15)
  64 + private BigDecimal length;
  65 +
  66 + @ExcelProperty(value = "误差", index = 16)
  67 + private String lengthTol;
  68 +
  69 + @ExcelProperty(value = "状态", index = 17)
  70 + private String status;
  71 +
  72 + @ExcelProperty(value = "订单数量", index = 18)
  73 + private BigDecimal quantity;
  74 +
  75 + @ExcelProperty(value = "指导价", index = 19)
  76 + private BigDecimal suggestedPrice;
  77 +
  78 + @ExcelProperty(value = "交货日期", index = 20)
  79 + @DateTimeFormat("yyyy-MM-dd")
  80 + private Date deliveryDate;
  81 +
  82 + @ExcelProperty(value = "超价协调价", index = 21)
  83 + private BigDecimal assessmentExceedsAgreement;
  84 +
  85 + @ExcelProperty(value = "执行标准", index = 22)
  86 + private String executionStandard;
  87 +
  88 + @ExcelProperty(value = "销售价", index = 23)
  89 + private BigDecimal salesPrice;
  90 +
  91 + @ExcelProperty(value = "价格表编号", index = 24)
  92 + private String priceListNo;
  93 +
  94 + @ExcelProperty(value = "包装费", index = 25)
  95 + private BigDecimal packagingFee;
  96 +
  97 + @ExcelProperty(value = "结算方式", index = 26)
  98 + private String settlementTerms;
  99 +
  100 + @ExcelProperty(value = "件重条头", index = 27)
  101 + private String pieceWeightHeader;
  102 +
  103 + @ExcelProperty(value = "表面", index = 28)
  104 + private String surface;
  105 +
  106 + @ExcelProperty(value = "公差", index = 29)
  107 + private String tolerance;
  108 +
  109 + @ExcelProperty(value = "性能", index = 30)
  110 + private String performance;
  111 +
  112 + @ExcelProperty(value = "包装", index = 31)
  113 + private String packaging;
  114 +
  115 + @ExcelProperty(value = "特别注重要求", index = 32)
  116 + private String specialRequirements;
  117 +
  118 + @ExcelProperty(value = "备注", index = 33)
  119 + private String remarks;
  120 +
  121 + @ExcelProperty(value = "业务员", index = 34)
  122 + private String salesman;
  123 +
  124 + @ExcelProperty(value = "运费", index = 35)
  125 + private BigDecimal shippingCost;
  126 +
  127 + @ExcelProperty(value = "回程运费", index = 36)
  128 + private BigDecimal returnShippingCost;
  129 +
  130 + @ExcelProperty(value = "客户类型", index = 37)
  131 + private String customerType;
  132 +
  133 + @ExcelProperty(value = "品质", index = 38)
  134 + private String quality;
  135 +
  136 + @ExcelProperty(value = "加工双经销", index = 39)
  137 + private String processingAndDistributor;
  138 +
  139 + @ExcelProperty(value = "实际客户", index = 40)
  140 + private String actualCustomer;
  141 +
  142 + @ExcelProperty(value = "订单类型", index = 41)
  143 + private String orderType;
  144 +
  145 + @ExcelProperty(value = "铅、镉含量ppm", index = 42)
  146 + private String leadCadmiumPpm;
  147 +
  148 + @ExcelProperty(value = "铁含量导电率%IACS", index = 43)
  149 + private String ironConductivity;
  150 +
  151 + @ExcelProperty(value = "备用", index = 44)
  152 + private String reserve1;
  153 +
  154 + @ExcelProperty(value = "加工来料", index = 45)
  155 + private String processingIncomingMaterial;
  156 +
  157 + @ExcelProperty(value = "加工料补价代购锌锭", index = 46)
  158 + private String processingExtraPriceOrPurchaseZinc;
  159 +
  160 + @ExcelProperty(value = "备用", index = 47)
  161 + private String reserve2;
  162 +
  163 + @ExcelProperty(value = "备用\u200B", index = 48)
  164 + private String reserve3;
  165 +
  166 + @ExcelProperty(value = "备用", index = 49)
  167 + private String reserve4;
  168 +
  169 + @ExcelProperty(value = "其中行业", index = 50)
  170 + private String industryIncluded;
  171 +
  172 + @ExcelProperty(value = "行业", index = 51)
  173 + private String industryStandard;
  174 +
  175 + @ExcelProperty(value = "客户简称", index = 52)
  176 + private String customerShortName2;
  177 +
  178 + @ExcelProperty(value = "品种", index = 53)
  179 + private String variety;
  180 +
  181 + @ExcelProperty(value = "三厂库存", index = 54)
  182 + private String thirdFactoryStock;
  183 +
  184 + @ExcelProperty(value = "电缆分类", index = 55)
  185 + private String cableCategory;
  186 +
  187 + @ExcelProperty(value = "备用", index = 56)
  188 + private String reserve5;
  189 +
  190 + @ExcelProperty(value = "备用\u200B", index = 57)
  191 + private String reserve6;
  192 +
  193 + @ExcelProperty(value = "备用", index = 58)
  194 + private String reserve7;
  195 +
  196 + @ExcelProperty(value = "备用\u200B", index = 59)
  197 + private String reserve8;
  198 +
  199 + @ExcelProperty(value = "备用", index = 60)
  200 + private String reserve9;
  201 +
  202 + @ExcelProperty(value = "备用\u200B", index = 61)
  203 + private String reserve10;
  204 +
  205 + @ExcelProperty(value = "备用", index = 62)
  206 + private String reserve11;
  207 +
  208 + @ExcelProperty(value = "备用\u200B", index = 63)
  209 + private String reserve12;
  210 +
  211 + @ExcelProperty(value = "备用", index = 64)
  212 + private String reserve13;
  213 +
  214 + @ExcelProperty(value = "备用\u200B", index = 65)
  215 + private String reserve14;
  216 +
  217 + @ExcelProperty(value = "备用", index = 66)
  218 + private String reserve15;
  219 +
  220 + @ExcelProperty(value = "备用\u200B", index = 67)
  221 + private String reserve16;
  222 +
  223 + @ExcelProperty(value = "备用", index = 68)
  224 + private String reserve17;
  225 +
  226 + @ExcelProperty(value = "备用\u200B", index = 69)
  227 + private String reserve18;
  228 +
  229 + @ExcelProperty(value = "备用", index = 70)
  230 + private String reserve19;
  231 +
  232 + @ExcelProperty(value = "备用\u200B", index = 71)
  233 + private String reserve20;
  234 +
  235 + @ExcelProperty(value = "备用", index = 72)
  236 + private String reserve21;
  237 +
  238 + @ExcelProperty(value = "备用\u200B", index = 73)
  239 + private String reserve22;
  240 +
  241 + @ExcelProperty(value = "备用", index = 74)
  242 + private String reserve23;
  243 +
  244 + @ExcelProperty(value = "备用\u200B", index = 75)
  245 + private String reserve24;
  246 +
  247 + @ExcelProperty(value = "备用", index = 76)
  248 + private String reserve25;
  249 +
  250 + @ExcelProperty(value = "备用\u200B", index = 77)
  251 + private String reserve26;
  252 +
  253 + @ExcelProperty(value = "备用", index = 78)
  254 + private String reserve27;
  255 +
  256 + @ExcelProperty(value = "备用\u200B", index = 79)
  257 + private String reserve28;
  258 +}
  1 +package com.lframework.xingyun.sc.excel.statistics;
  2 +
  3 +import com.lframework.starter.common.utils.CollectionUtil;
  4 +import com.lframework.starter.mq.core.components.export.ExportTaskWorker;
  5 +import com.lframework.starter.web.core.components.resp.PageResult;
  6 +import com.lframework.starter.web.core.utils.ApplicationUtil;
  7 +import com.lframework.starter.web.core.utils.JsonUtil;
  8 +import com.lframework.starter.web.core.utils.PageResultUtil;
  9 +import com.lframework.xingyun.sc.bo.statistics.orderDetail.QueryOrderDetailReportBo;
  10 +import com.lframework.xingyun.sc.entity.OrderDetailReport;
  11 +import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  12 +import com.lframework.xingyun.sc.utils.CommonUtil;
  13 +import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo;
  14 +import org.apache.commons.lang3.StringUtils;
  15 +
  16 +import java.math.BigDecimal;
  17 +import java.time.LocalDate;
  18 +import java.time.ZoneId;
  19 +import java.util.List;
  20 +import java.util.Date;
  21 +import java.util.stream.Collectors;
  22 +
  23 +public class StockInboundOrderDetailReportExportTaskWorker implements
  24 + ExportTaskWorker<QueryOrderDetailReportVo, QueryOrderDetailReportBo, StockInboundOrderDetailReportModel> {
  25 +
  26 + @Override
  27 + public QueryOrderDetailReportVo parseParams(String json) {
  28 + return JsonUtil.parseObject(json, QueryOrderDetailReportVo.class);
  29 + }
  30 +
  31 + @Override
  32 + public PageResult<QueryOrderDetailReportBo> getDataList(int pageIndex, int pageSize, QueryOrderDetailReportVo params) {
  33 + OrderDetailReportService orderDetailReportService = ApplicationUtil.getBean(OrderDetailReportService.class);
  34 + PageResult<OrderDetailReport> pageResult = orderDetailReportService.query(pageIndex, pageSize, params);
  35 + List<QueryOrderDetailReportBo> results = null;
  36 + if (!CollectionUtil.isEmpty(pageResult.getDatas())) {
  37 + results = pageResult.getDatas().stream().map(QueryOrderDetailReportBo::new).collect(Collectors.toList());
  38 + }
  39 + return PageResultUtil.rebuild(pageResult, results);
  40 + }
  41 +
  42 + @Override
  43 + public StockInboundOrderDetailReportModel exportData(QueryOrderDetailReportBo data) {
  44 + String thicknessTol = CommonUtil.handleTolData(
  45 + data.getThicknessTolPos() != null ? data.getThicknessTolPos().doubleValue() : null,
  46 + data.getThicknessTolNeg() != null ? data.getThicknessTolNeg().doubleValue() : null);
  47 + String widthTol = CommonUtil.handleTolData(
  48 + data.getWidthTolPos() != null ? data.getWidthTolPos().doubleValue() : null,
  49 + data.getWidthTolNeg() != null ? data.getWidthTolNeg().doubleValue() : null);
  50 + String lengthTol = CommonUtil.handleTolData(
  51 + data.getLengthTolPos() != null ? data.getLengthTolPos().doubleValue() : null,
  52 + data.getLengthTolNeg() != null ? data.getLengthTolNeg().doubleValue() : null);
  53 +
  54 + StockInboundOrderDetailReportModel model = new StockInboundOrderDetailReportModel();
  55 + model.setDate(toDate(data.getOrderDate()));
  56 + model.setOrderNo(data.getOrderNo());
  57 + model.setDeptCode(data.getDeptCode());
  58 + model.setCustomerShortName(data.getCustomerShortName());
  59 + model.setOrderDate(toDate(data.getOrderDate()));
  60 + model.setWorkshopName(data.getWorkshopName());
  61 + model.setDeptName(data.getDeptName());
  62 + model.setRegionName(data.getRegionName());
  63 + model.setCustomerName(data.getOrderingUnitName());
  64 + model.setIndustry(data.getIndustry());
  65 + model.setStructureReportUsed(data.getStructureReportUsed());
  66 + model.setBrand(data.getBrand());
  67 + model.setThickness(data.getThickness());
  68 + model.setThicknessTol(thicknessTol);
  69 + model.setWidth(data.getWidth());
  70 + model.setWidthTol(widthTol);
  71 + model.setLength(data.getLength());
  72 + model.setLengthTol(lengthTol);
  73 + model.setStatus(data.getStatus());
  74 + model.setQuantity(data.getQuantity());
  75 + model.setSuggestedPrice(toBigDecimalOrZero(data.getSuggestedPrice()));
  76 + model.setDeliveryDate(toDate(data.getDeliveryDate()));
  77 + model.setAssessmentExceedsAgreement(toBigDecimalOrZero(data.getAssessmentExceedsAgreement()));
  78 + model.setExecutionStandard(data.getExecutionStandard());
  79 + model.setSalesPrice(toBigDecimalOrZero(data.getSalesPrice()));
  80 + model.setPriceListNo(data.getPriceListNo());
  81 + model.setPackagingFee(stringToBigDecimal(data.getPackagingFee()));
  82 + model.setSettlementTerms(data.getSettlementTerms());
  83 + model.setPieceWeightHeader(data.getPieceWeightHeader());
  84 + model.setSurface(data.getSurface());
  85 + model.setTolerance(data.getTolerance());
  86 + model.setPerformance(data.getPerformance());
  87 + model.setPackaging(data.getPackaging());
  88 + model.setSpecialRequirements(data.getSpecialRequirements());
  89 + model.setRemarks(data.getRemarks());
  90 + model.setSalesman(data.getContractCreateBy());
  91 + model.setShippingCost(stringToBigDecimal(data.getShippingCost()));
  92 + model.setReturnShippingCost(stringToBigDecimal(data.getReturnShippingCost()));
  93 + model.setCustomerType(data.getCustomerType());
  94 + model.setQuality(data.getQuality());
  95 + model.setProcessingAndDistributor(data.getContractType());
  96 + model.setActualCustomer(data.getOrderingUnitName());
  97 + model.setOrderType(data.getContractTypeName());
  98 + model.setLeadCadmiumPpm("Pb≤ppm\n" + "Cd≤ppm");
  99 + model.setIronConductivity("Fe≤ppm\n" + "Co+Ni≤ppm\n" + "%IACS");
  100 + model.setReserve3(data.getOrderNo());
  101 + model.setReserve4(data.getOrderNo());
  102 + return model;
  103 + }
  104 +
  105 + @Override
  106 + public Class<StockInboundOrderDetailReportModel> getModelClass() {
  107 + return StockInboundOrderDetailReportModel.class;
  108 + }
  109 +
  110 + private static Date toDate(LocalDate date) {
  111 + if (date == null) {
  112 + return null;
  113 + }
  114 + return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant());
  115 + }
  116 +
  117 + private static BigDecimal toBigDecimalOrZero(String value) {
  118 + if (StringUtils.isBlank(value)) {
  119 + return BigDecimal.ZERO;
  120 + }
  121 + try {
  122 + return new BigDecimal(value.trim());
  123 + } catch (Exception e) {
  124 + return BigDecimal.ZERO;
  125 + }
  126 + }
  127 +
  128 + public static BigDecimal stringToBigDecimal(String str) {
  129 + // 1. 判空处理:如果为 null 或去除空格后为空字符串,直接返回 null
  130 + if (str == null || str.trim().isEmpty()) {
  131 + return null;
  132 + }
  133 +
  134 + // 2. 尝试转换
  135 + try {
  136 + // 建议先 trim() 去除首尾空格,避免 " 100 " 这种格式报错
  137 + return new BigDecimal(str.trim());
  138 + } catch (NumberFormatException e) {
  139 + // 3. 如果字符串格式不合法(如 "abc"),根据业务需求处理,这里同样返回 null
  140 + return null;
  141 + }
  142 + }
  143 +
  144 +}
  145 +
  1 +package com.lframework.xingyun.sc.excel.statistics;
  2 +
  3 +import com.alibaba.excel.annotation.ExcelProperty;
  4 +import com.alibaba.excel.annotation.format.DateTimeFormat;
  5 +import com.lframework.starter.web.core.components.excel.ExcelModel;
  6 +import lombok.Data;
  7 +
  8 +import java.math.BigDecimal;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * 入库订单明细
  13 + */
  14 +@Data
  15 +public class StockInboundOrderDetailReportModel implements ExcelModel {
  16 +
  17 + @ExcelProperty(value = "日期", index = 0)
  18 + @DateTimeFormat("yyyy-MM-dd")
  19 + private Date date;
  20 +
  21 + @ExcelProperty(value = "订单编号", index = 1)
  22 + private String orderNo;
  23 +
  24 + @ExcelProperty(value = "办事处编码", index = 2)
  25 + private String deptCode;
  26 +
  27 + @ExcelProperty(value = "客户简称", index = 3)
  28 + private String customerShortName;
  29 +
  30 + @ExcelProperty(value = "订货日期", index = 4)
  31 + @DateTimeFormat("yyyy-MM-dd")
  32 + private Date orderDate;
  33 +
  34 + @ExcelProperty(value = "生产厂", index = 5)
  35 + private String workshopName;
  36 +
  37 + @ExcelProperty(value = "科办", index = 6)
  38 + private String deptName;
  39 +
  40 + @ExcelProperty(value = "片", index = 7)
  41 + private String regionName;
  42 +
  43 + @ExcelProperty(value = "客户名称", index = 8)
  44 + private String customerName;
  45 +
  46 + @ExcelProperty(value = "行业(用途)", index = 9)
  47 + private String industry;
  48 +
  49 + @ExcelProperty(value = "结构报表用", index = 10)
  50 + private String structureReportUsed;
  51 +
  52 + @ExcelProperty(value = "牌号", index = 11)
  53 + private String brand;
  54 +
  55 + @ExcelProperty(value = "厚", index = 12)
  56 + private BigDecimal thickness;
  57 +
  58 + @ExcelProperty(value = "误差", index = 13)
  59 + private String thicknessTol;
  60 +
  61 + @ExcelProperty(value = "宽", index = 14)
  62 + private BigDecimal width;
  63 +
  64 + @ExcelProperty(value = "误差", index = 15)
  65 + private String widthTol;
  66 +
  67 + @ExcelProperty(value = "长", index = 16)
  68 + private BigDecimal length;
  69 +
  70 + @ExcelProperty(value = "误差", index = 17)
  71 + private String lengthTol;
  72 +
  73 + @ExcelProperty(value = "状态", index = 18)
  74 + private String status;
  75 +
  76 + @ExcelProperty(value = "订单数量", index = 19)
  77 + private BigDecimal quantity;
  78 +
  79 + @ExcelProperty(value = "指导价", index = 20)
  80 + private BigDecimal suggestedPrice;
  81 +
  82 + @ExcelProperty(value = "交货日期", index = 21)
  83 + @DateTimeFormat("yyyy-MM-dd")
  84 + private Date deliveryDate;
  85 +
  86 + @ExcelProperty(value = "超价协调价", index = 22)
  87 + private BigDecimal assessmentExceedsAgreement;
  88 +
  89 + @ExcelProperty(value = "执行标准", index = 23)
  90 + private String executionStandard;
  91 +
  92 + @ExcelProperty(value = "销售价", index = 24)
  93 + private BigDecimal salesPrice;
  94 +
  95 + @ExcelProperty(value = "价格表编号", index = 25)
  96 + private String priceListNo;
  97 +
  98 + @ExcelProperty(value = "包装费", index = 26)
  99 + private BigDecimal packagingFee;
  100 +
  101 + @ExcelProperty(value = "结算方式", index = 27)
  102 + private String settlementTerms;
  103 +
  104 + @ExcelProperty(value = "件重条头", index = 28)
  105 + private String pieceWeightHeader;
  106 +
  107 + @ExcelProperty(value = "表面", index = 29)
  108 + private String surface;
  109 +
  110 + @ExcelProperty(value = "公差", index = 30)
  111 + private String tolerance;
  112 +
  113 + @ExcelProperty(value = "性能", index = 31)
  114 + private String performance;
  115 +
  116 + @ExcelProperty(value = "包装", index = 32)
  117 + private String packaging;
  118 +
  119 + @ExcelProperty(value = "特别注重要求", index = 33)
  120 + private String specialRequirements;
  121 +
  122 + @ExcelProperty(value = "备注", index = 34)
  123 + private String remarks;
  124 +
  125 + @ExcelProperty(value = "业务员", index = 35)
  126 + private String salesman;
  127 +
  128 + @ExcelProperty(value = "运费", index = 36)
  129 + private BigDecimal shippingCost;
  130 +
  131 + @ExcelProperty(value = "回程运费", index = 37)
  132 + private BigDecimal returnShippingCost;
  133 +
  134 + @ExcelProperty(value = "客户类型", index = 38)
  135 + private String customerType;
  136 +
  137 + @ExcelProperty(value = "品质", index = 39)
  138 + private String quality;
  139 +
  140 + @ExcelProperty(value = "加工双经销", index = 40)
  141 + private String processingAndDistributor;
  142 +
  143 + @ExcelProperty(value = "实际客户", index = 41)
  144 + private String actualCustomer;
  145 +
  146 + @ExcelProperty(value = "订单类型", index = 42)
  147 + private String orderType;
  148 +
  149 + @ExcelProperty(value = "铅、镉含量ppm", index = 43)
  150 + private String leadCadmiumPpm;
  151 +
  152 + @ExcelProperty(value = "铁含量导电率%IACS", index = 44)
  153 + private String ironConductivity;
  154 +
  155 + @ExcelProperty(value = "备用", index = 45)
  156 + private String reserve1;
  157 +
  158 + @ExcelProperty(value = "加工来料", index = 46)
  159 + private String processingIncomingMaterial;
  160 +
  161 + @ExcelProperty(value = "加工料补价代购锌锭", index = 47)
  162 + private String processingExtraPriceOrPurchaseZinc;
  163 +
  164 + @ExcelProperty(value = "备用", index = 48)
  165 + private String reserve2;
  166 +
  167 + @ExcelProperty(value = "原库存订单号", index = 49)
  168 + private String reserve3;
  169 +
  170 + @ExcelProperty(value = "备用", index = 50)
  171 + private String reserve4;
  172 +}
  173 +
@@ -95,4 +95,10 @@ public class QueryOrderDetailReportVo extends PageVo implements BaseVo, Serializ @@ -95,4 +95,10 @@ public class QueryOrderDetailReportVo extends PageVo implements BaseVo, Serializ
95 @ApiModelProperty("状态") 95 @ApiModelProperty("状态")
96 private String status; 96 private String status;
97 97
  98 + @ApiModelProperty("仅查询库存合同未锁价订单明细")
  99 + private Boolean inventoryUnlockedOnly;
  100 +
  101 + @ApiModelProperty("排除库存合同未锁价订单明细(入库订单明细)")
  102 + private Boolean excludeInventoryUnlocked;
  103 +
98 } 104 }
@@ -54,6 +54,14 @@ @@ -54,6 +54,14 @@
54 <result column="update_by" property="updateBy"/> 54 <result column="update_by" property="updateBy"/>
55 <result column="create_time" property="createTime"/> 55 <result column="create_time" property="createTime"/>
56 <result column="update_time" property="updateTime"/> 56 <result column="update_time" property="updateTime"/>
  57 + <result column="customer_short_name" property="customerShortName"/>
  58 + <result column="settlement_terms" property="settlementTerms"/>
  59 + <result column="execution_standard" property="executionStandard"/>
  60 + <result column="execution_standard_remarks" property="executionStandardRemarks"/>
  61 + <result column="structure_report_used" property="structureReportUsed"/>
  62 + <result column="contract_type_code" property="contractTypeCode"/>
  63 + <result column="special_requirements" property="specialRequirements"/>
  64 + <result column="contract_create_by" property="contractCreateBy"/>
57 </resultMap> 65 </resultMap>
58 66
59 <sql id="OrderDetailReport_sql"> 67 <sql id="OrderDetailReport_sql">
@@ -197,9 +205,26 @@ @@ -197,9 +205,26 @@
197 tb.update_by, 205 tb.update_by,
198 tb.create_time, 206 tb.create_time,
199 tb.update_time, 207 tb.update_time,
  208 + cs.short_name AS customer_short_name,
  209 + poi.settlement_terms AS settlement_terms,
  210 + poi.execution_standard AS execution_standard,
  211 + poi.execution_standard_remarks AS execution_standard_remarks,
  212 + CASE
  213 + WHEN c.type = 'PROCESS_STD_AGMT' THEN pl.product_id
  214 + ELSE cl.product_id
  215 + END AS structure_report_used,
  216 + c.type AS contract_type_code,
  217 + c.special_terms AS special_requirements,
  218 + c.create_by AS contract_create_by,
200 MAX(tb.create_time) OVER (PARTITION BY tb.order_no, tb.purchase_order_line_id) AS group_latest_time 219 MAX(tb.create_time) OVER (PARTITION BY tb.order_no, tb.purchase_order_line_id) AS group_latest_time
201 FROM order_detail_report tb 220 FROM order_detail_report tb
202 LEFT JOIN base_data_workshop ws ON ws.id = tb.workshop_id 221 LEFT JOIN base_data_workshop ws ON ws.id = tb.workshop_id
  222 + LEFT JOIN tbl_purchase_order_line pol ON pol.id = tb.purchase_order_line_id
  223 + LEFT JOIN purchase_order_info poi ON poi.id = pol.purchase_order_id
  224 + LEFT JOIN tbl_contract_distributor_standard c ON c.id = poi.contract_id
  225 + LEFT JOIN base_data_customer_short cs ON cs.customer_id = poi.ordering_unit
  226 + LEFT JOIN tbl_contract_distributor_line cl ON cl.id = pol.contract_distributor_line_id
  227 + LEFT JOIN tbl_contract_std_processing_line pl ON pl.id = pol.contract_distributor_line_id
203 <where> 228 <where>
204 <if test="vo.ids != null and !vo.ids.isEmpty()"> 229 <if test="vo.ids != null and !vo.ids.isEmpty()">
205 AND tb.id IN 230 AND tb.id IN
@@ -256,6 +281,26 @@ @@ -256,6 +281,26 @@
256 <if test="vo.status != null and vo.status != ''"> 281 <if test="vo.status != null and vo.status != ''">
257 AND tb.status = #{vo.status} 282 AND tb.status = #{vo.status}
258 </if> 283 </if>
  284 + <if test="vo.inventoryUnlockedOnly != null and vo.inventoryUnlockedOnly">
  285 + AND c.type IN ('DIST_STOCK_CONTRACT','INTL_INVENTORY_AGMT')
  286 + AND c.status ='FORMAL'
  287 + AND poi.type='PRODUCTION'
  288 + AND (c.price_spec_locked = 0 OR c.price_spec_locked IS NULL)
  289 + </if>
  290 + <if test="vo.excludeInventoryUnlocked != null and vo.excludeInventoryUnlocked">
  291 + AND (c.id IS NULL
  292 + OR
  293 + NOT(
  294 + c.type IN ('DIST_STOCK_CONTRACT', 'INTL_INVENTORY_AGMT')
  295 + AND c.status = 'FORMAL'
  296 + AND poi.type = 'PRODUCTION'
  297 + AND (
  298 + c.price_spec_locked = 0
  299 + OR c.price_spec_locked IS NULL
  300 + )
  301 + )
  302 + )
  303 + </if>
259 </where> 304 </where>
260 ) t 305 ) t
261 ORDER BY 306 ORDER BY