Showing
4 changed files
with
201 additions
and
12 deletions
| ... | ... | @@ -38,6 +38,7 @@ import com.lframework.xingyun.sc.service.statistics.OrderDetailReportService; |
| 38 | 38 | import com.lframework.xingyun.sc.vo.customer.credit.QueryCustomerCreditVo; |
| 39 | 39 | import com.lframework.xingyun.sc.vo.order.*; |
| 40 | 40 | import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo; |
| 41 | +import com.lframework.xingyun.sc.vo.statistics.orderDetail.UpdateOrderDetailReportVo; | |
| 41 | 42 | import org.apache.commons.collections.CollectionUtils; |
| 42 | 43 | import org.apache.commons.lang3.StringUtils; |
| 43 | 44 | import org.springframework.transaction.annotation.Transactional; |
| ... | ... | @@ -440,6 +441,24 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 440 | 441 | if (CollectionUtils.isNotEmpty(updatePurchaseOrderLineVoList)) { |
| 441 | 442 | for (UpdatePurchaseOrderLineVo updatePurchaseOrderLineVo : updatePurchaseOrderLineVoList) { |
| 442 | 443 | purchaseOrderLineService.update(updatePurchaseOrderLineVo); |
| 444 | + | |
| 445 | + //修改订单详情 | |
| 446 | + UpdateOrderDetailReportVo vo1 = new UpdateOrderDetailReportVo(); | |
| 447 | + vo1.setPurchaseOrderLineId(updatePurchaseOrderLineVo.getId()); | |
| 448 | + vo1.setDeliveryDate(updatePurchaseOrderLineVo.getDeliveryDate()); | |
| 449 | + vo1.setPriceListNo(vo.getPriceListNo()); | |
| 450 | + if (updatePurchaseOrderLineVo.getPackagingFee() != null) { | |
| 451 | + vo1.setPackagingFee(updatePurchaseOrderLineVo.getPackagingFee().toPlainString()); | |
| 452 | + } | |
| 453 | + vo1.setInvoicingStatus(vo.getInvoicingStatus()); | |
| 454 | + vo1.setPieceWeightHeader(vo.getPieceWeightHeader()); | |
| 455 | + vo1.setSurface(vo.getSurface()); | |
| 456 | + vo1.setTolerance(vo.getTolerance()); | |
| 457 | + vo1.setPerformance(vo.getPerformance()); | |
| 458 | + vo1.setPackaging(vo.getPackaging()); | |
| 459 | + vo1.setRemarks(vo.getRemarks()); | |
| 460 | + vo1.setShippingCost(vo.getShippingCost()); | |
| 461 | + orderDetailReportService.update(vo1); | |
| 443 | 462 | } |
| 444 | 463 | } |
| 445 | 464 | |
| ... | ... | @@ -497,6 +516,25 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 497 | 516 | if (CollectionUtils.isNotEmpty(updatePurchaseOrderLineVoList)) { |
| 498 | 517 | for (UpdatePurchaseOrderLineVo updatePurchaseOrderLineVo : updatePurchaseOrderLineVoList) { |
| 499 | 518 | purchaseOrderLineService.update(updatePurchaseOrderLineVo); |
| 519 | + | |
| 520 | + //修改订单详情 | |
| 521 | + UpdateOrderDetailReportVo vo1 = new UpdateOrderDetailReportVo(); | |
| 522 | + vo1.setPurchaseOrderLineId(updatePurchaseOrderLineVo.getId()); | |
| 523 | + vo1.setDeliveryDate(updatePurchaseOrderLineVo.getDeliveryDate()); | |
| 524 | + vo1.setAssessmentExceedsAgreement(updatePurchaseOrderLineVo.getAssessmentExceedsAgreement()); | |
| 525 | + vo1.setPriceListNo(vo.getPriceListNo()); | |
| 526 | + if (updatePurchaseOrderLineVo.getPackagingFee() != null) { | |
| 527 | + vo1.setPackagingFee(updatePurchaseOrderLineVo.getPackagingFee().toPlainString()); | |
| 528 | + } | |
| 529 | + vo1.setInvoicingStatus(vo.getInvoicingStatus()); | |
| 530 | + vo1.setPieceWeightHeader(vo.getPieceWeightHeader()); | |
| 531 | + vo1.setSurface(vo.getSurface()); | |
| 532 | + vo1.setTolerance(vo.getTolerance()); | |
| 533 | + vo1.setPerformance(vo.getPerformance()); | |
| 534 | + vo1.setPackaging(vo.getPackaging()); | |
| 535 | + vo1.setRemarks(vo.getRemarks()); | |
| 536 | + vo1.setShippingCost(vo.getShippingCost()); | |
| 537 | + orderDetailReportService.update(vo1); | |
| 500 | 538 | } |
| 501 | 539 | } |
| 502 | 540 | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/statistics/OrderDetailReportServiceImpl.java
| 1 | 1 | package com.lframework.xingyun.sc.impl.statistics; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 3 | 5 | import com.github.pagehelper.PageInfo; |
| 4 | 6 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 5 | 7 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| ... | ... | @@ -26,6 +28,7 @@ import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo; |
| 26 | 28 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; |
| 27 | 29 | import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo; |
| 28 | 30 | import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo; |
| 31 | +import com.lframework.xingyun.sc.vo.statistics.orderDetail.UpdateOrderDetailReportVo; | |
| 29 | 32 | import org.apache.commons.collections.CollectionUtils; |
| 30 | 33 | import org.apache.commons.lang3.StringUtils; |
| 31 | 34 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -216,6 +219,30 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR |
| 216 | 219 | return data.getId(); |
| 217 | 220 | } |
| 218 | 221 | |
| 222 | + @OpLog(type = OtherOpLogType.class, name = "修改订单明细,ID:{}", params = {"#id"}) | |
| 223 | + @Transactional(rollbackFor = Exception.class) | |
| 224 | + @Override | |
| 225 | + public void update(UpdateOrderDetailReportVo vo) { | |
| 226 | + | |
| 227 | + LambdaUpdateWrapper<OrderDetailReport> updateWrapper = Wrappers.lambdaUpdate(OrderDetailReport.class) | |
| 228 | + .set(OrderDetailReport::getDeliveryDate, vo.getDeliveryDate() == null ? null : vo.getDeliveryDate()) | |
| 229 | + .set(OrderDetailReport::getAssessmentExceedsAgreement, StringUtil.isBlank(vo.getAssessmentExceedsAgreement()) ? null : vo.getAssessmentExceedsAgreement()) | |
| 230 | + .set(OrderDetailReport::getPriceListNo, StringUtil.isBlank(vo.getPriceListNo()) ? null : vo.getPriceListNo()) | |
| 231 | + .set(OrderDetailReport::getPackagingFee, StringUtil.isBlank(vo.getPackagingFee()) ? null : vo.getPackagingFee()) | |
| 232 | + .set(OrderDetailReport::getInvoicingStatus, StringUtil.isBlank(vo.getInvoicingStatus()) ? null : vo.getInvoicingStatus()) | |
| 233 | + .set(OrderDetailReport::getPieceWeightHeader, StringUtil.isBlank(vo.getPieceWeightHeader()) ? null : vo.getPieceWeightHeader()) | |
| 234 | + .set(OrderDetailReport::getSurface, StringUtil.isBlank(vo.getSurface()) ? null : vo.getSurface()) | |
| 235 | + .set(OrderDetailReport::getTolerance, StringUtil.isBlank(vo.getTolerance()) ? null : vo.getTolerance()) | |
| 236 | + .set(OrderDetailReport::getPerformance, StringUtil.isBlank(vo.getPerformance()) ? null : vo.getPerformance()) | |
| 237 | + .set(OrderDetailReport::getPackaging, StringUtil.isBlank(vo.getPackaging()) ? null : vo.getPackaging()) | |
| 238 | + .set(OrderDetailReport::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks()) | |
| 239 | + .set(OrderDetailReport::getShippingCost, StringUtil.isBlank(vo.getShippingCost()) ? null : vo.getShippingCost()) | |
| 240 | + .eq(OrderDetailReport::getPurchaseOrderLineId, vo.getPurchaseOrderLineId()); | |
| 241 | + | |
| 242 | + getBaseMapper().update(updateWrapper); | |
| 243 | + | |
| 244 | + } | |
| 245 | + | |
| 219 | 246 | @Override |
| 220 | 247 | public void processHistoricalData() { |
| 221 | 248 | QueryPurchaseOrderInfoVo vo2 = new QueryPurchaseOrderInfoVo(); |
| ... | ... | @@ -223,7 +250,10 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR |
| 223 | 250 | if (CollectionUtils.isNotEmpty(query)) { |
| 224 | 251 | for (PurchaseOrderInfo purchaseOrderInfo : query) { |
| 225 | 252 | ContractDistributorStandard standard = contractDistributorStandardService.findById(purchaseOrderInfo.getContractId()); |
| 226 | - CustomerCredit customerCredit = customerCreditService.findById(purchaseOrderInfo.getCustomerCreditId()); | |
| 253 | + CustomerCredit customerCredit = null; | |
| 254 | + if (StringUtils.isNotEmpty(purchaseOrderInfo.getCustomerCreditId())) { | |
| 255 | + customerCredit = customerCreditService.findById(purchaseOrderInfo.getCustomerCreditId()); | |
| 256 | + } | |
| 227 | 257 | QueryPurchaseOrderLineVo vo1 = new QueryPurchaseOrderLineVo(); |
| 228 | 258 | vo1.setPurchaseOrderId(purchaseOrderInfo.getId()); |
| 229 | 259 | List<PurchaseOrderLine> lineVoList = purchaseOrderLineService.query(vo1); |
| ... | ... | @@ -262,14 +292,18 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR |
| 262 | 292 | vo.setSuggestedPrice(subtract.toPlainString()); |
| 263 | 293 | } catch (NumberFormatException e) { |
| 264 | 294 | // 日志记录或按业务处理:超协价格式无效,忽略计算 |
| 265 | - log.error("assessmentExceedsAgreement====>" + assessmentExceedsAgreement); | |
| 295 | + log.error("超协价格式错误,使用原始销售价。value=" + assessmentExceedsAgreement); | |
| 266 | 296 | } |
| 267 | 297 | } |
| 268 | 298 | vo.setDeliveryDate(line.getDeliveryDate()); |
| 269 | 299 | vo.setAssessmentExceedsAgreement(line.getAssessmentExceedsAgreement()); |
| 270 | - vo.setSalesPrice(line.getSalesPrice().toPlainString()); | |
| 300 | + if (line.getSalesPrice() != null) { | |
| 301 | + vo.setSalesPrice(line.getSalesPrice().toPlainString()); | |
| 302 | + } | |
| 271 | 303 | vo.setPriceListNo(purchaseOrderInfo.getPriceListNo()); |
| 272 | - vo.setPackagingFee(line.getPackagingFee().toPlainString()); | |
| 304 | + if (line.getPackagingFee() != null) { | |
| 305 | + vo.setPackagingFee(line.getPackagingFee().toPlainString()); | |
| 306 | + } | |
| 273 | 307 | vo.setInvoicingStatus(purchaseOrderInfo.getInvoicingStatus()); |
| 274 | 308 | vo.setPieceWeightHeader(purchaseOrderInfo.getPieceWeightHeader()); |
| 275 | 309 | vo.setSurface(purchaseOrderInfo.getSurface()); |
| ... | ... | @@ -295,14 +329,14 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR |
| 295 | 329 | vo.setContractType(contractType); |
| 296 | 330 | if ("加工".equals(contractType)) { |
| 297 | 331 | String contractDistributorLineId = line.getContractDistributorLineId(); |
| 298 | - ContractStdProcessingLine processingLine = contractStdProcessingLineService.findById(contractDistributorLineId); | |
| 299 | - | |
| 300 | - if (processingLine != null) { | |
| 301 | - String materialProductRatio = processingLine.getMaterialProductRatio(); | |
| 302 | - SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("RAW_TO_PROD_RATIO", materialProductRatio); | |
| 303 | - | |
| 304 | - if (dataDicItem != null) { | |
| 305 | - vo.setContractType(dataDicItem.getName() + contractType); | |
| 332 | + if (StringUtils.isNotEmpty(contractDistributorLineId)) { | |
| 333 | + ContractStdProcessingLine processingLine = contractStdProcessingLineService.findById(contractDistributorLineId); | |
| 334 | + if (processingLine != null) { | |
| 335 | + String materialProductRatio = processingLine.getMaterialProductRatio(); | |
| 336 | + SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("RAW_TO_PROD_RATIO", materialProductRatio); | |
| 337 | + if (dataDicItem != null) { | |
| 338 | + vo.setContractType(dataDicItem.getName() + contractType); | |
| 339 | + } | |
| 306 | 340 | } |
| 307 | 341 | } |
| 308 | 342 | } | ... | ... |
| ... | ... | @@ -5,6 +5,8 @@ import com.lframework.starter.web.core.components.resp.PageResult; |
| 5 | 5 | import com.lframework.xingyun.sc.entity.OrderDetailReport; |
| 6 | 6 | import com.lframework.xingyun.sc.vo.statistics.orderDetail.CreateOrderDetailReportVo; |
| 7 | 7 | import com.lframework.xingyun.sc.vo.statistics.orderDetail.QueryOrderDetailReportVo; |
| 8 | +import com.lframework.xingyun.sc.vo.statistics.orderDetail.UpdateOrderDetailReportVo; | |
| 9 | + | |
| 8 | 10 | import java.util.List; |
| 9 | 11 | |
| 10 | 12 | /** |
| ... | ... | @@ -40,6 +42,12 @@ public interface OrderDetailReportService extends BaseMpService<OrderDetailRepor |
| 40 | 42 | String create(CreateOrderDetailReportVo vo); |
| 41 | 43 | |
| 42 | 44 | /** |
| 45 | + * 修改 | |
| 46 | + * @param vo | |
| 47 | + */ | |
| 48 | + void update(UpdateOrderDetailReportVo vo); | |
| 49 | + | |
| 50 | + /** | |
| 43 | 51 | * 处理历史数据 |
| 44 | 52 | */ |
| 45 | 53 | void processHistoricalData(); | ... | ... |
| 1 | +package com.lframework.xingyun.sc.vo.statistics.orderDetail; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import javax.validation.constraints.NotBlank; | |
| 5 | +import java.time.LocalDate; | |
| 6 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 7 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 9 | +import org.hibernate.validator.constraints.Length; | |
| 10 | +import java.io.Serializable; | |
| 11 | + | |
| 12 | +@Data | |
| 13 | +public class UpdateOrderDetailReportVo implements BaseVo, Serializable { | |
| 14 | + | |
| 15 | + private static final long serialVersionUID = 1L; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 物料行ID不能为空 | |
| 19 | + */ | |
| 20 | + @ApiModelProperty(value = "ID", required = true) | |
| 21 | + @NotBlank(message = "物料行ID不能为空!") | |
| 22 | + private String purchaseOrderLineId; | |
| 23 | + | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 发货日期 | |
| 27 | + */ | |
| 28 | + @ApiModelProperty("发货日期") | |
| 29 | + @TypeMismatch(message = "发货日期格式有误!") | |
| 30 | + private LocalDate deliveryDate; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 超协价 | |
| 34 | + */ | |
| 35 | + @ApiModelProperty("超协价") | |
| 36 | + @Length(message = "超协价最多允许50个字符!") | |
| 37 | + private String assessmentExceedsAgreement; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 价格表编号 | |
| 41 | + */ | |
| 42 | + @ApiModelProperty("价格表编号") | |
| 43 | + @Length(message = "价格表编号最多允许50个字符!") | |
| 44 | + private String priceListNo; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 包装费 | |
| 48 | + */ | |
| 49 | + @ApiModelProperty("包装费") | |
| 50 | + @Length(message = "包装费最多允许50个字符!") | |
| 51 | + private String packagingFee; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 开票情况 | |
| 55 | + */ | |
| 56 | + @ApiModelProperty("开票情况") | |
| 57 | + @Length(message = "开票情况最多允许50个字符!") | |
| 58 | + private String invoicingStatus; | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 件重条头 | |
| 62 | + */ | |
| 63 | + @ApiModelProperty("件重条头") | |
| 64 | + @Length(message = "件重条头最多允许65,535个字符!") | |
| 65 | + private String pieceWeightHeader; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 表面 | |
| 69 | + */ | |
| 70 | + @ApiModelProperty("表面") | |
| 71 | + @Length(message = "表面最多允许65,535个字符!") | |
| 72 | + private String surface; | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 公差 | |
| 76 | + */ | |
| 77 | + @ApiModelProperty("公差") | |
| 78 | + @Length(message = "公差最多允许65,535个字符!") | |
| 79 | + private String tolerance; | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 性能 | |
| 83 | + */ | |
| 84 | + @ApiModelProperty("性能") | |
| 85 | + @Length(message = "性能最多允许65,535个字符!") | |
| 86 | + private String performance; | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 包装 | |
| 90 | + */ | |
| 91 | + @ApiModelProperty("包装") | |
| 92 | + @Length(message = "包装最多允许65,535个字符!") | |
| 93 | + private String packaging; | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * 备注 | |
| 97 | + */ | |
| 98 | + @ApiModelProperty("备注") | |
| 99 | + @Length(message = "备注最多允许65,535个字符!") | |
| 100 | + private String remarks; | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 运费 | |
| 104 | + */ | |
| 105 | + @ApiModelProperty("运费") | |
| 106 | + @Length(message = "运费最多允许50个字符!") | |
| 107 | + private String shippingCost; | |
| 108 | + | |
| 109 | +} | ... | ... |