Commit 851d90a878ffe82fd9044cacd538e339ea519ebd

Authored by 房远帅
2 parents 71cffe0f 871eac5b

Merge branch 'master_after0506_report02_1' into master_after0506

@@ -409,7 +409,7 @@ CREATE TABLE IF NOT EXISTS `tbl_purchase_order_revoke_line` @@ -409,7 +409,7 @@ CREATE TABLE IF NOT EXISTS `tbl_purchase_order_revoke_line`
409 `length_tol_neg` decimal(10, 4) DEFAULT NULL COMMENT '长度公差负', 409 `length_tol_neg` decimal(10, 4) DEFAULT NULL COMMENT '长度公差负',
410 `status` varchar(50) DEFAULT NULL COMMENT '状态', 410 `status` varchar(50) DEFAULT NULL COMMENT '状态',
411 `quantity` decimal(15, 4) NOT NULL COMMENT '原数量kg', 411 `quantity` decimal(15, 4) NOT NULL COMMENT '原数量kg',
412 - `sales_price` decimal(15, 4) NOT NULL COMMENT '销售价格', 412 + `sales_price` decimal(15, 4) DEFAULT NULL COMMENT '销售价格',
413 `delivery_date` date DEFAULT NULL COMMENT '发货日期', 413 `delivery_date` date DEFAULT NULL COMMENT '发货日期',
414 `revoke_quantity` decimal(15, 4) DEFAULT NULL COMMENT '撤销数量', 414 `revoke_quantity` decimal(15, 4) DEFAULT NULL COMMENT '撤销数量',
415 `show_order` int DEFAULT '0' COMMENT '排序', 415 `show_order` int DEFAULT '0' COMMENT '排序',
@@ -145,6 +145,12 @@ public class GetPurchaseOrderRevokeBo extends BaseBo<PurchaseOrderRevoke> { @@ -145,6 +145,12 @@ public class GetPurchaseOrderRevokeBo extends BaseBo<PurchaseOrderRevoke> {
145 @ApiModelProperty("订货单撤销表物料行") 145 @ApiModelProperty("订货单撤销表物料行")
146 private List<PurchaseOrderRevokeLine> purchaseOrderRevokeLineList; 146 private List<PurchaseOrderRevokeLine> purchaseOrderRevokeLineList;
147 147
  148 + /**
  149 + * 合同类型
  150 + */
  151 + @ApiModelProperty("合同类型")
  152 + private String contractType;
  153 +
148 public GetPurchaseOrderRevokeBo() { 154 public GetPurchaseOrderRevokeBo() {
149 155
150 } 156 }
@@ -260,6 +260,12 @@ public class OrderChangeRecordBo extends BaseBo<OrderInfoChangeRecord> { @@ -260,6 +260,12 @@ public class OrderChangeRecordBo extends BaseBo<OrderInfoChangeRecord> {
260 @ApiModelProperty("是否是变更发起人") 260 @ApiModelProperty("是否是变更发起人")
261 private Boolean changeCreateBy; 261 private Boolean changeCreateBy;
262 262
  263 + /**
  264 + * 合同类型
  265 + */
  266 + @ApiModelProperty("合同类型")
  267 + private String contractType;
  268 +
263 269
264 public OrderChangeRecordBo() { 270 public OrderChangeRecordBo() {
265 271
@@ -152,6 +152,12 @@ public class GetReplenishmentOrderBo extends BaseBo<ReplenishmentOrder> { @@ -152,6 +152,12 @@ public class GetReplenishmentOrderBo extends BaseBo<ReplenishmentOrder> {
152 @ApiModelProperty("补货单物料行") 152 @ApiModelProperty("补货单物料行")
153 private List<GetReplenishmentOrderLineBo> replenishmentOrderLineList; 153 private List<GetReplenishmentOrderLineBo> replenishmentOrderLineList;
154 154
  155 + /**
  156 + * 合同类型
  157 + */
  158 + @ApiModelProperty("合同类型")
  159 + private String contractType;
  160 +
155 public GetReplenishmentOrderBo() { 161 public GetReplenishmentOrderBo() {
156 162
157 } 163 }
@@ -5,9 +5,13 @@ import com.lframework.starter.web.core.annotations.security.HasPermission; @@ -5,9 +5,13 @@ import com.lframework.starter.web.core.annotations.security.HasPermission;
5 import com.lframework.starter.web.core.controller.DefaultBaseController; 5 import com.lframework.starter.web.core.controller.DefaultBaseController;
6 import com.lframework.starter.web.core.utils.JsonUtil; 6 import com.lframework.starter.web.core.utils.JsonUtil;
7 import com.lframework.xingyun.sc.bo.order.change.OrderChangeRecordBo; 7 import com.lframework.xingyun.sc.bo.order.change.OrderChangeRecordBo;
  8 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
8 import com.lframework.xingyun.sc.entity.OrderInfoChangeRecord; 9 import com.lframework.xingyun.sc.entity.OrderInfoChangeRecord;
  10 +import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
9 import com.lframework.xingyun.sc.entity.PurchaseOrderLine; 11 import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
10 import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus; 12 import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus;
  13 +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
  14 +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
11 import com.lframework.xingyun.sc.utils.ExcelUtil; 15 import com.lframework.xingyun.sc.utils.ExcelUtil;
12 import com.lframework.xingyun.sc.utils.LatexFormulaExcelExporterUtil; 16 import com.lframework.xingyun.sc.utils.LatexFormulaExcelExporterUtil;
13 import com.lframework.xingyun.sc.utils.ResponseUtil; 17 import com.lframework.xingyun.sc.utils.ResponseUtil;
@@ -60,6 +64,10 @@ public class OrderChangeRecordController extends DefaultBaseController { @@ -60,6 +64,10 @@ public class OrderChangeRecordController extends DefaultBaseController {
60 64
61 @Resource 65 @Resource
62 private OrderChangeRecordService orderChangeRecordService; 66 private OrderChangeRecordService orderChangeRecordService;
  67 + @Resource
  68 + private PurchaseOrderInfoService purchaseOrderInfoService;
  69 + @Resource
  70 + private ContractDistributorStandardService contractDistributorStandardService;
63 71
64 /** 72 /**
65 * 查询列表 73 * 查询列表
@@ -90,6 +98,16 @@ public class OrderChangeRecordController extends DefaultBaseController { @@ -90,6 +98,16 @@ public class OrderChangeRecordController extends DefaultBaseController {
90 throw new DefaultClientException("订货单变更记录不存在!"); 98 throw new DefaultClientException("订货单变更记录不存在!");
91 } 99 }
92 OrderChangeRecordBo result = new OrderChangeRecordBo(data); 100 OrderChangeRecordBo result = new OrderChangeRecordBo(data);
  101 + PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(result.getOrderId());
  102 + if (purchaseOrderInfo != null) {
  103 + String contractId = purchaseOrderInfo.getContractId();
  104 + if (StringUtils.isNotEmpty(contractId)) {
  105 + ContractDistributorStandard contractDistributorStandard = contractDistributorStandardService.findById(contractId);
  106 + if (contractDistributorStandard != null) {
  107 + result.setContractType(contractDistributorStandard.getType());
  108 + }
  109 + }
  110 + }
93 111
94 return InvokeResultBuilder.success(result); 112 return InvokeResultBuilder.success(result);
95 } 113 }
@@ -182,20 +200,12 @@ public class OrderChangeRecordController extends DefaultBaseController { @@ -182,20 +200,12 @@ public class OrderChangeRecordController extends DefaultBaseController {
182 200
183 // 过滤需要显示的变更前记录(DELETE 或 UPDATE 且有变化) 201 // 过滤需要显示的变更前记录(DELETE 或 UPDATE 且有变化)
184 List<PurchaseOrderLine> beforeLines = beforeChangeSpecList.stream() 202 List<PurchaseOrderLine> beforeLines = beforeChangeSpecList.stream()
185 - .filter(line -> "DELETE".equals(line.getType()) ||  
186 - ("UPDATE".equals(line.getType()) &&  
187 - (line.getBrandChange() || line.getLengthChange() || line.getWidthChange() ||  
188 - line.getThicknessChange() || line.getStatusChange() ||  
189 - line.getQuantityChange() || line.getSalesPriceChange()))) 203 + .filter(this::shouldPrintChangeLine)
190 .collect(Collectors.toList()); 204 .collect(Collectors.toList());
191 205
192 // 过滤需要显示的变更后记录(ADD 或 UPDATE 且有变化) 206 // 过滤需要显示的变更后记录(ADD 或 UPDATE 且有变化)
193 List<PurchaseOrderLine> afterLines = afterChangeSpecList.stream() 207 List<PurchaseOrderLine> afterLines = afterChangeSpecList.stream()
194 - .filter(line -> "ADD".equals(line.getType()) ||  
195 - ("UPDATE".equals(line.getType()) &&  
196 - (line.getBrandChange() || line.getLengthChange() || line.getWidthChange() ||  
197 - line.getThicknessChange() || line.getStatusChange() ||  
198 - line.getQuantityChange() || line.getSalesPriceChange()))) 208 + .filter(this::shouldPrintChangeLine)
199 .collect(Collectors.toList()); 209 .collect(Collectors.toList());
200 210
201 // ========== 填充变更前区域(起始行:5)========== 211 // ========== 填充变更前区域(起始行:5)==========
@@ -209,44 +219,7 @@ public class OrderChangeRecordController extends DefaultBaseController { @@ -209,44 +219,7 @@ public class OrderChangeRecordController extends DefaultBaseController {
209 PurchaseOrderLine line = i < beforeLines.size() ? beforeLines.get(i) : null; 219 PurchaseOrderLine line = i < beforeLines.size() ? beforeLines.get(i) : null;
210 int rowIdx = beforeStartRow + i; 220 int rowIdx = beforeStartRow + i;
211 if (line != null) { 221 if (line != null) {
212 - ExcelUtil.setCellValue(sheet, rowIdx, 0, line.getIndustry());  
213 - ExcelUtil.setCellValue(sheet, rowIdx, 1, line.getQuality());  
214 - ExcelUtil.setCellValue(sheet, rowIdx, 2, line.getBrand());  
215 - List<LatexFormulaExcelExporterUtil.FormulaComponent> formulaComponentList = new ArrayList<>(3);  
216 - if (line.getThickness() != null) {  
217 - LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();  
218 - formulaComponent.setBase(line.getThickness());  
219 - formulaComponent.setSup(line.getThicknessTolPos());  
220 - formulaComponent.setSub(line.getThicknessTolNeg());  
221 - formulaComponentList.add(formulaComponent);  
222 - }  
223 -  
224 - if (line.getWidth() != null) {  
225 - LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();  
226 - formulaComponent.setBase(line.getWidth());  
227 - formulaComponent.setSup(line.getWidthTolPos());  
228 - formulaComponent.setSub(line.getWidthTolNeg());  
229 - formulaComponentList.add(formulaComponent);  
230 - }  
231 -  
232 - if (line.getLength() != null) {  
233 - LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();  
234 - formulaComponent.setBase(line.getLength());  
235 - formulaComponent.setSup(line.getLengthTolPos());  
236 - formulaComponent.setSub(line.getLengthTolNeg());  
237 - formulaComponentList.add(formulaComponent);  
238 - }  
239 -  
240 - String latex = LatexFormulaExcelExporterUtil.convertToLatex(formulaComponentList);  
241 - if (StringUtils.isNotBlank(latex)) {  
242 - LatexFormulaExcelExporterUtil.insertLatexImageToCell(workbook, sheet, latex, rowIdx, 3, 1, 1);  
243 - }  
244 - ExcelUtil.setCellValue(sheet, rowIdx, 4, line.getStatus());  
245 - ExcelUtil.setCellValue(sheet, rowIdx, 5, line.getQuantity());  
246 - ExcelUtil.setCellValue(sheet, rowIdx, 6, line.getSalesPrice());  
247 - ExcelUtil.setCellValue(sheet, rowIdx, 7,  
248 - line.getDeliveryDate() == null ? "" : line.getDeliveryDate().format(dateFormatter));  
249 - ExcelUtil.setCellValue(sheet, rowIdx, 8, line.getAssessmentExceedsAgreement()); 222 + fillChangePrintRow(workbook, sheet, rowIdx, line, dateFormatter);
250 } else { 223 } else {
251 for (int col = 0; col <= 8; col++) { 224 for (int col = 0; col <= 8; col++) {
252 ExcelUtil.setCellValue(sheet, rowIdx, col, ""); 225 ExcelUtil.setCellValue(sheet, rowIdx, col, "");
@@ -264,44 +237,7 @@ public class OrderChangeRecordController extends DefaultBaseController { @@ -264,44 +237,7 @@ public class OrderChangeRecordController extends DefaultBaseController {
264 PurchaseOrderLine line = i < afterLines.size() ? afterLines.get(i) : null; 237 PurchaseOrderLine line = i < afterLines.size() ? afterLines.get(i) : null;
265 int rowIdx = afterStartRow + i; 238 int rowIdx = afterStartRow + i;
266 if (line != null) { 239 if (line != null) {
267 - ExcelUtil.setCellValue(sheet, rowIdx, 0, line.getIndustry());  
268 - ExcelUtil.setCellValue(sheet, rowIdx, 1, line.getQuality());  
269 - ExcelUtil.setCellValue(sheet, rowIdx, 2, line.getBrand());  
270 - List<LatexFormulaExcelExporterUtil.FormulaComponent> formulaComponentList = new ArrayList<>(3);  
271 - if (line.getThickness() != null) {  
272 - LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();  
273 - formulaComponent.setBase(line.getThickness());  
274 - formulaComponent.setSup(line.getThicknessTolPos());  
275 - formulaComponent.setSub(line.getThicknessTolNeg());  
276 - formulaComponentList.add(formulaComponent);  
277 - }  
278 -  
279 - if (line.getWidth() != null) {  
280 - LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();  
281 - formulaComponent.setBase(line.getWidth());  
282 - formulaComponent.setSup(line.getWidthTolPos());  
283 - formulaComponent.setSub(line.getWidthTolNeg());  
284 - formulaComponentList.add(formulaComponent);  
285 - }  
286 -  
287 - if (line.getLength() != null) {  
288 - LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();  
289 - formulaComponent.setBase(line.getLength());  
290 - formulaComponent.setSup(line.getLengthTolPos());  
291 - formulaComponent.setSub(line.getLengthTolNeg());  
292 - formulaComponentList.add(formulaComponent);  
293 - }  
294 -  
295 - String latex = LatexFormulaExcelExporterUtil.convertToLatex(formulaComponentList);  
296 - if (StringUtils.isNotBlank(latex)) {  
297 - LatexFormulaExcelExporterUtil.insertLatexImageToCell(workbook, sheet, latex, rowIdx, 3, 1, 1);  
298 - }  
299 - ExcelUtil.setCellValue(sheet, rowIdx, 4, line.getStatus());  
300 - ExcelUtil.setCellValue(sheet, rowIdx, 5, line.getQuantity());  
301 - ExcelUtil.setCellValue(sheet, rowIdx, 6, line.getSalesPrice());  
302 - ExcelUtil.setCellValue(sheet, rowIdx, 7,  
303 - line.getDeliveryDate() == null ? "" : line.getDeliveryDate().format(dateFormatter));  
304 - ExcelUtil.setCellValue(sheet, rowIdx, 8, line.getAssessmentExceedsAgreement()); 240 + fillChangePrintRow(workbook, sheet, rowIdx, line, dateFormatter);
305 } else { 241 } else {
306 for (int col = 0; col <= 8; col++) { 242 for (int col = 0; col <= 8; col++) {
307 ExcelUtil.setCellValue(sheet, rowIdx, col, ""); 243 ExcelUtil.setCellValue(sheet, rowIdx, col, "");
@@ -492,4 +428,96 @@ public class OrderChangeRecordController extends DefaultBaseController { @@ -492,4 +428,96 @@ public class OrderChangeRecordController extends DefaultBaseController {
492 target.setAssessmentExceedsAgreementChange(!Objects.equals(before.getAssessmentExceedsAgreement(), after.getAssessmentExceedsAgreement())); 428 target.setAssessmentExceedsAgreementChange(!Objects.equals(before.getAssessmentExceedsAgreement(), after.getAssessmentExceedsAgreement()));
493 } 429 }
494 430
  431 + /**
  432 + * 判断当前记录是否需要在规格变更打印中展示。
  433 + *
  434 + * @param line 订货单明细
  435 + * @return true:需要打印;false:不需要打印
  436 + */
  437 + private boolean shouldPrintChangeLine(PurchaseOrderLine line) {
  438 + if (line == null) {
  439 + return false;
  440 + }
  441 + if ("DELETE".equals(line.getType()) || "ADD".equals(line.getType())) {
  442 + return true;
  443 + }
  444 + return "UPDATE".equals(line.getType()) && (line.getBrandChange()
  445 + || line.getLengthChange()
  446 + || line.getWidthChange()
  447 + || line.getThicknessChange()
  448 + || line.getStatusChange()
  449 + || line.getQuantityChange()
  450 + || line.getSalesPriceChange()
  451 + || line.getDeliveryDateChange()
  452 + || line.getAssessmentExceedsAgreementChange());
  453 + }
  454 +
  455 + /**
  456 + * 填充规格变更单打印行数据,并按订货单一致的方式渲染规格。
  457 + *
  458 + * @param workbook 工作簿
  459 + * @param sheet 工作表
  460 + * @param rowIdx 行号
  461 + * @param line 订货单明细
  462 + * @param dateFormatter 日期格式化器
  463 + * @throws IOException 规格渲染异常
  464 + */
  465 + private void fillChangePrintRow(Workbook workbook, Sheet sheet, int rowIdx, PurchaseOrderLine line,
  466 + DateTimeFormatter dateFormatter) throws IOException {
  467 + ExcelUtil.setCellValue(sheet, rowIdx, 0, line.getIndustry());
  468 + ExcelUtil.setCellValue(sheet, rowIdx, 1, line.getQuality());
  469 + ExcelUtil.setCellValue(sheet, rowIdx, 2, line.getBrand());
  470 + renderSpecForChangePrint(workbook, sheet, rowIdx, line);
  471 + ExcelUtil.setCellValue(sheet, rowIdx, 4, line.getStatus());
  472 + ExcelUtil.setCellValue(sheet, rowIdx, 5, line.getQuantity());
  473 + ExcelUtil.setCellValue(sheet, rowIdx, 6, line.getSalesPrice());
  474 + ExcelUtil.setCellValue(sheet, rowIdx, 7,
  475 + line.getDeliveryDate() == null ? "" : line.getDeliveryDate().format(dateFormatter));
  476 + ExcelUtil.setCellValue(sheet, rowIdx, 8, line.getAssessmentExceedsAgreement());
  477 + }
  478 +
  479 + /**
  480 + * 按订货单打印规则渲染规格,避免规格图片过大并保持左对齐。
  481 + *
  482 + * @param workbook 工作簿
  483 + * @param sheet 工作表
  484 + * @param rowIdx 行号
  485 + * @param line 订货单明细
  486 + * @throws IOException 规格渲染异常
  487 + */
  488 + private void renderSpecForChangePrint(Workbook workbook, Sheet sheet, int rowIdx, PurchaseOrderLine line)
  489 + throws IOException {
  490 + List<LatexFormulaExcelExporterUtil.FormulaComponent> formulaComponentList = new ArrayList<>(3);
  491 + if (line.getThickness() != null) {
  492 + LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();
  493 + formulaComponent.setBase(line.getThickness());
  494 + formulaComponent.setSup(line.getThicknessTolPos());
  495 + formulaComponent.setSub(line.getThicknessTolNeg());
  496 + formulaComponentList.add(formulaComponent);
  497 + }
  498 +
  499 + if (line.getWidth() != null) {
  500 + LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();
  501 + formulaComponent.setBase(line.getWidth());
  502 + formulaComponent.setSup(line.getWidthTolPos());
  503 + formulaComponent.setSub(line.getWidthTolNeg());
  504 + formulaComponentList.add(formulaComponent);
  505 + }
  506 +
  507 + if (line.getLength() != null) {
  508 + LatexFormulaExcelExporterUtil.FormulaComponent formulaComponent = new LatexFormulaExcelExporterUtil.FormulaComponent();
  509 + formulaComponent.setBase(line.getLength());
  510 + formulaComponent.setSup(line.getLengthTolPos());
  511 + formulaComponent.setSub(line.getLengthTolNeg());
  512 + formulaComponentList.add(formulaComponent);
  513 + }
  514 +
  515 + String latex = LatexFormulaExcelExporterUtil.convertToContractSpecLatexSingleLineFixed3(formulaComponentList);
  516 + if (StringUtils.isNotBlank(latex)) {
  517 + LatexFormulaExcelExporterUtil.insertLatexImageToCellLeftAligned(workbook, sheet, latex, rowIdx, 3, 1, 1);
  518 + } else {
  519 + ExcelUtil.setCellValue(sheet, rowIdx, 3, "");
  520 + }
  521 + }
  522 +
495 } 523 }
@@ -16,6 +16,7 @@ import javax.validation.constraints.NotBlank; @@ -16,6 +16,7 @@ import javax.validation.constraints.NotBlank;
16 import com.lframework.xingyun.sc.bo.order.GetPurchaseOrderInfoBo; 16 import com.lframework.xingyun.sc.bo.order.GetPurchaseOrderInfoBo;
17 import com.lframework.xingyun.sc.bo.order.GetPurchaseOrderRevokeBo; 17 import com.lframework.xingyun.sc.bo.order.GetPurchaseOrderRevokeBo;
18 import com.lframework.xingyun.sc.entity.*; 18 import com.lframework.xingyun.sc.entity.*;
  19 +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
19 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; 20 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
20 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; 21 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
21 import com.lframework.xingyun.sc.service.order.PurchaseOrderRevokeLineService; 22 import com.lframework.xingyun.sc.service.order.PurchaseOrderRevokeLineService;
@@ -28,6 +29,7 @@ import io.swagger.annotations.ApiOperation; @@ -28,6 +29,7 @@ import io.swagger.annotations.ApiOperation;
28 import com.lframework.starter.common.utils.CollectionUtil; 29 import com.lframework.starter.common.utils.CollectionUtil;
29 import io.swagger.annotations.Api; 30 import io.swagger.annotations.Api;
30 import org.apache.commons.collections.CollectionUtils; 31 import org.apache.commons.collections.CollectionUtils;
  32 +import org.apache.commons.lang3.StringUtils;
31 import org.springframework.web.bind.annotation.DeleteMapping; 33 import org.springframework.web.bind.annotation.DeleteMapping;
32 import org.springframework.beans.factory.annotation.Autowired; 34 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.validation.annotation.Validated; 35 import org.springframework.validation.annotation.Validated;
@@ -58,6 +60,8 @@ public class PurchaseOrderRevokeController extends DefaultBaseController { @@ -58,6 +60,8 @@ public class PurchaseOrderRevokeController extends DefaultBaseController {
58 private PurchaseOrderRevokeLineService purchaseOrderRevokeLineService; 60 private PurchaseOrderRevokeLineService purchaseOrderRevokeLineService;
59 @Resource 61 @Resource
60 private FlowTaskWrapperMapper flowTaskWrapperMapper; 62 private FlowTaskWrapperMapper flowTaskWrapperMapper;
  63 + @Resource
  64 + private ContractDistributorStandardService contractDistributorStandardService;
61 65
62 /** 66 /**
63 * 查询列表 67 * 查询列表
@@ -124,6 +128,16 @@ public class PurchaseOrderRevokeController extends DefaultBaseController { @@ -124,6 +128,16 @@ public class PurchaseOrderRevokeController extends DefaultBaseController {
124 if (CollectionUtil.isNotEmpty(query)) { 128 if (CollectionUtil.isNotEmpty(query)) {
125 result.setPurchaseOrderRevokeLineList(query); 129 result.setPurchaseOrderRevokeLineList(query);
126 } 130 }
  131 + PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(data.getPurchaseOrderId());
  132 + if (purchaseOrderInfo != null) {
  133 + String contractId = purchaseOrderInfo.getContractId();
  134 + if (StringUtils.isNotEmpty(contractId)) {
  135 + ContractDistributorStandard contractDistributorStandard = contractDistributorStandardService.findById(contractId);
  136 + if (contractDistributorStandard != null) {
  137 + result.setContractType(contractDistributorStandard.getType());
  138 + }
  139 + }
  140 + }
127 141
128 return InvokeResultBuilder.success(result); 142 return InvokeResultBuilder.success(result);
129 } 143 }
@@ -26,9 +26,11 @@ import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo; @@ -26,9 +26,11 @@ import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo;
26 import com.lframework.xingyun.sc.bo.purchase.GetReplenishmentOrderBo; 26 import com.lframework.xingyun.sc.bo.purchase.GetReplenishmentOrderBo;
27 import com.lframework.xingyun.sc.bo.purchase.GetReplenishmentOrderLineBo; 27 import com.lframework.xingyun.sc.bo.purchase.GetReplenishmentOrderLineBo;
28 import com.lframework.xingyun.sc.bo.purchase.QueryReplenishmentOrderBo; 28 import com.lframework.xingyun.sc.bo.purchase.QueryReplenishmentOrderBo;
  29 +import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
29 import com.lframework.xingyun.sc.entity.PurchaseOrderInfo; 30 import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
30 import com.lframework.xingyun.sc.entity.ReplenishmentOrder; 31 import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
31 import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine; 32 import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
  33 +import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
32 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; 34 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
33 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderLineService; 35 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderLineService;
34 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService; 36 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
@@ -77,6 +79,8 @@ public class ReplenishmentOrderController extends DefaultBaseController { @@ -77,6 +79,8 @@ public class ReplenishmentOrderController extends DefaultBaseController {
77 private ReplenishmentOrderLineService replenishmentOrderLineService; 79 private ReplenishmentOrderLineService replenishmentOrderLineService;
78 @Resource 80 @Resource
79 private FlowTaskWrapperMapper flowTaskWrapperMapper; 81 private FlowTaskWrapperMapper flowTaskWrapperMapper;
  82 + @Resource
  83 + private ContractDistributorStandardService contractDistributorStandardService;
80 84
81 85
82 public static final String AUDIT_STATUS_DIC_CODE = "AUDIT_STATUS"; // 审核状态 86 public static final String AUDIT_STATUS_DIC_CODE = "AUDIT_STATUS"; // 审核状态
@@ -195,6 +199,13 @@ public class ReplenishmentOrderController extends DefaultBaseController { @@ -195,6 +199,13 @@ public class ReplenishmentOrderController extends DefaultBaseController {
195 result.setStatusName(sysDataDicItem == null ? "" : sysDataDicItem.getName()); 199 result.setStatusName(sysDataDicItem == null ? "" : sysDataDicItem.getName());
196 PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(data.getPurchaseOrderId()); 200 PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(data.getPurchaseOrderId());
197 result.setPurchaseOrderName(purchaseOrderInfo == null ? "" : purchaseOrderInfo.getOrderNo()); 201 result.setPurchaseOrderName(purchaseOrderInfo == null ? "" : purchaseOrderInfo.getOrderNo());
  202 + String contractId = purchaseOrderInfo.getContractId();
  203 + if (StringUtils.isNotEmpty(contractId)) {
  204 + ContractDistributorStandard contractDistributorStandard = contractDistributorStandardService.findById(contractId);
  205 + if (contractDistributorStandard != null) {
  206 + result.setContractType(contractDistributorStandard.getType());
  207 + }
  208 + }
198 209
199 Wrapper<ReplenishmentOrderLine> lineWrapper = Wrappers.lambdaQuery(ReplenishmentOrderLine.class) 210 Wrapper<ReplenishmentOrderLine> lineWrapper = Wrappers.lambdaQuery(ReplenishmentOrderLine.class)
200 .eq(ReplenishmentOrderLine::getReplenishmentOrderId, id) 211 .eq(ReplenishmentOrderLine::getReplenishmentOrderId, id)
@@ -1455,6 +1455,7 @@ public class ContractDistributorStandardServiceImpl extends @@ -1455,6 +1455,7 @@ public class ContractDistributorStandardServiceImpl extends
1455 data.setPerformance(vo.getPerformance()); 1455 data.setPerformance(vo.getPerformance());
1456 data.setComponent(vo.getComponent()); 1456 data.setComponent(vo.getComponent());
1457 data.setPackaging(vo.getPackaging()); 1457 data.setPackaging(vo.getPackaging());
  1458 + data.setRemarks(vo.getRemarks());
1458 // data.setStandardizedAt(LocalDateTime.now()); 1459 // data.setStandardizedAt(LocalDateTime.now());
1459 getBaseMapper().insert(data); 1460 getBaseMapper().insert(data);
1460 1461
@@ -36,6 +36,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditService; @@ -36,6 +36,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
36 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; 36 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
37 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; 37 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
38 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService; 38 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  39 +import com.lframework.xingyun.sc.utils.OrderDetailReportUtil;
39 import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; 40 import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo;
40 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo; 41 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
41 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; 42 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo;
@@ -586,7 +587,8 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR @@ -586,7 +587,8 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR
586 vo.setQuality(line.getQuality()); 587 vo.setQuality(line.getQuality());
587 vo.setContractType(orderDetailReport.getContractType()); 588 vo.setContractType(orderDetailReport.getContractType());
588 vo.setStockUpCompanyName(orderInfo.getStockUpCompanyName()); 589 vo.setStockUpCompanyName(orderInfo.getStockUpCompanyName());
589 - //vo.setOrderType(); 590 + vo.setType(orderInfo.getType());
  591 + vo.setOrderType(OrderDetailReportUtil.buildOrderType(type, orderInfo.getType()));
590 vo.setShowOrder(2); 592 vo.setShowOrder(2);
591 vo.setCreateById(contractCreateById); 593 vo.setCreateById(contractCreateById);
592 orderDetailReportService.create(vo); 594 orderDetailReportService.create(vo);
@@ -38,6 +38,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditService; @@ -38,6 +38,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
38 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; 38 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
39 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; 39 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
40 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService; 40 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  41 +import com.lframework.xingyun.sc.utils.OrderDetailReportUtil;
41 import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo; 42 import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo;
42 import com.lframework.xingyun.sc.vo.order.*; 43 import com.lframework.xingyun.sc.vo.order.*;
43 import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo; 44 import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo;
@@ -416,7 +417,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -416,7 +417,7 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
416 } 417 }
417 } 418 }
418 vo.setStockUpCompanyName(purchaseOrderInfo.getStockUpCompanyName()); 419 vo.setStockUpCompanyName(purchaseOrderInfo.getStockUpCompanyName());
419 -// vo.setOrderType(); 420 + vo.setOrderType(OrderDetailReportUtil.buildOrderType(type, purchaseOrderInfo.getType()));
420 vo.setShowOrder(0); 421 vo.setShowOrder(0);
421 vo.setType(purchaseOrderInfo.getType()); 422 vo.setType(purchaseOrderInfo.getType());
422 vo.setCreateById(purchaseOrderInfo.getContractCreateById()); 423 vo.setCreateById(purchaseOrderInfo.getContractCreateById());
@@ -26,6 +26,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditService; @@ -26,6 +26,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
26 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; 26 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
27 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; 27 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
28 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService; 28 import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService;
  29 +import com.lframework.xingyun.sc.utils.OrderDetailReportUtil;
29 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo; 30 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
30 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; 31 import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo;
31 import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo; 32 import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo;
@@ -408,7 +409,7 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR @@ -408,7 +409,7 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR
408 } 409 }
409 } 410 }
410 vo.setStockUpCompanyName(purchaseOrderInfo.getStockUpCompanyName()); 411 vo.setStockUpCompanyName(purchaseOrderInfo.getStockUpCompanyName());
411 - //vo.setOrderType(); 412 + vo.setOrderType(OrderDetailReportUtil.buildOrderType(type, purchaseOrderInfo.getType()));
412 vo.setShowOrder(0); 413 vo.setShowOrder(0);
413 vo.setType(purchaseOrderInfo.getType()); 414 vo.setType(purchaseOrderInfo.getType());
414 vo.setCreateById(purchaseOrderInfo.getContractCreateById()); 415 vo.setCreateById(purchaseOrderInfo.getContractCreateById());
  1 +package com.lframework.xingyun.sc.utils;
  2 +
  3 +/**
  4 + * 订单明细报表工具类。
  5 + */
  6 +public final class OrderDetailReportUtil {
  7 +
  8 + private OrderDetailReportUtil() {
  9 + }
  10 +
  11 + /**
  12 + * 根据合同类型和订货单类型构建订单类型展示值。
  13 + *
  14 + * @param contractType 合同类型
  15 + * @param purchaseOrderType 订货单类型
  16 + * @return 订单类型展示值
  17 + */
  18 + public static String buildOrderType(String contractType, String purchaseOrderType) {
  19 + if ("DISTRIB_STD".equals(contractType)) {
  20 + return "经销";
  21 + }
  22 + if ("INTL_STD_CONTRACT".equals(contractType)) {
  23 + return "外贸";
  24 + }
  25 + if ("PROCESS_STD_AGMT".equals(contractType)) {
  26 + return "加工";
  27 + }
  28 + if ("DIST_STOCK_CONTRACT".equals(contractType) || "INTL_INVENTORY_AGMT".equals(contractType)) {
  29 + if ("NO_PRODUCTION".equals(purchaseOrderType)) {
  30 + return "库存已锁价";
  31 + }
  32 + if ("PRODUCTION".equals(purchaseOrderType)) {
  33 + return "库存未锁价";
  34 + }
  35 + return "库存";
  36 + }
  37 + if ("DRAFT_DIST_AGMT".equals(contractType) || "INTL_OPEN_SPEC_AGMT".equals(contractType)) {
  38 + if ("NO_PRODUCTION".equals(purchaseOrderType)) {
  39 + return "未锁规";
  40 + }
  41 + if ("PRODUCTION".equals(purchaseOrderType)) {
  42 + return "已锁规";
  43 + }
  44 + return "未锁规";
  45 + }
  46 + return "";
  47 + }
  48 +}