Commit e78c57139f3804b1c39a372c013d0f86433c9cea
Merge remote-tracking branch 'origin/master_0929' into master_0929
Showing
25 changed files
with
536 additions
and
20 deletions
| ... | ... | @@ -154,11 +154,13 @@ create table if not exists `tbl_contract_distributor_line` |
| 154 | 154 | `length_tol_neg` DECIMAL(10, 4) COMMENT '长度公差负', |
| 155 | 155 | `status` VARCHAR(50) COMMENT '状态', |
| 156 | 156 | `quantity` DECIMAL(15, 4) COMMENT '数量', |
| 157 | + `processing_fee` DECIMAL(15, 4) COMMENT '加工费', | |
| 157 | 158 | `unit_price` DECIMAL(15, 4) COMMENT '单价', |
| 158 | 159 | `amount_excluding_tax` DECIMAL(15, 2) COMMENT '不含税金额', |
| 159 | 160 | `total_amount` DECIMAL(15, 2) COMMENT '总金额', |
| 160 | 161 | `delivery_date` DATE COMMENT '发货日期', |
| 161 | 162 | `show_order` INT DEFAULT 0 COMMENT '排序', |
| 163 | + `item_id` varchar(50) COMMENT '前端用ID', | |
| 162 | 164 | `create_by_id` varchar(32) not null comment '创建人ID', |
| 163 | 165 | `create_by` varchar(20) not null comment '创建人', |
| 164 | 166 | `update_by_id` varchar(32) not null comment '更新人ID', | ... | ... |
| ... | ... | @@ -3,6 +3,8 @@ package com.lframework.xingyun.sc.bo.contract; |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | 4 | import com.lframework.starter.common.constants.StringPool; |
| 5 | 5 | import com.lframework.starter.web.core.bo.BaseBo; |
| 6 | +import com.lframework.starter.web.core.components.validation.IsNumberPrecision; | |
| 7 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 6 | 8 | import com.lframework.xingyun.sc.entity.ContractDistributorLine; |
| 7 | 9 | import io.swagger.annotations.ApiModelProperty; |
| 8 | 10 | import lombok.Data; |
| ... | ... | @@ -79,6 +81,12 @@ public class GetContractDistributorLineBo extends BaseBo<ContractDistributorLine |
| 79 | 81 | private BigDecimal quantity; |
| 80 | 82 | |
| 81 | 83 | /** |
| 84 | + * 加工费 | |
| 85 | + */ | |
| 86 | + @ApiModelProperty(value = "加工费") | |
| 87 | + private BigDecimal processingFee; | |
| 88 | + | |
| 89 | + /** | |
| 82 | 90 | * 单价 |
| 83 | 91 | */ |
| 84 | 92 | @ApiModelProperty("单价") |
| ... | ... | @@ -157,6 +165,12 @@ public class GetContractDistributorLineBo extends BaseBo<ContractDistributorLine |
| 157 | 165 | @ApiModelProperty("长度公差负") |
| 158 | 166 | private BigDecimal lengthTolNeg; |
| 159 | 167 | |
| 168 | + /** | |
| 169 | + * 前端用ID | |
| 170 | + */ | |
| 171 | + @ApiModelProperty(value = "前端用ID") | |
| 172 | + private String itemId; | |
| 173 | + | |
| 160 | 174 | public GetContractDistributorLineBo() { |
| 161 | 175 | |
| 162 | 176 | } | ... | ... |
| ... | ... | @@ -216,6 +216,12 @@ public class GetPurchaseOrderInfoBo extends BaseBo<PurchaseOrderInfo> { |
| 216 | 216 | @ApiModelProperty("订货单表物料行") |
| 217 | 217 | private List<PurchaseOrderLine> purchaseOrderLineList; |
| 218 | 218 | |
| 219 | + /** | |
| 220 | + * 规格变更状态 | |
| 221 | + */ | |
| 222 | + @ApiModelProperty("规格变更状态") | |
| 223 | + private String specChangeStatus; | |
| 224 | + | |
| 219 | 225 | |
| 220 | 226 | |
| 221 | 227 | public GetPurchaseOrderInfoBo() { | ... | ... |
| ... | ... | @@ -454,7 +454,7 @@ public class ContractDistributorStandardController extends DefaultBaseController |
| 454 | 454 | throw new DefaultClientException("参数错误!"); |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - // todo ymk 锁规接口待完善 | |
| 457 | + contractDistributorStandardService.specificationLock(vo); | |
| 458 | 458 | |
| 459 | 459 | contractDistributorStandardService.cleanCacheByKey(vo.getId()); |
| 460 | 460 | ... | ... |
| ... | ... | @@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.controller.order; |
| 3 | 3 | import com.lframework.starter.web.core.annotations.security.HasPermission; |
| 4 | 4 | import com.lframework.starter.web.core.controller.DefaultBaseController; |
| 5 | 5 | import com.lframework.xingyun.sc.bo.order.change.OrderSpecificationChangeRecordBo; |
| 6 | +import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus; | |
| 6 | 7 | import com.lframework.xingyun.sc.vo.order.change.QueryOrderSpecificationChangeRecordVo; |
| 7 | 8 | import com.lframework.xingyun.sc.service.order.OrderSpecificationChangeRecordService; |
| 8 | 9 | import com.lframework.xingyun.sc.vo.order.change.CreateOrderSpecificationChangeRecordVo; |
| ... | ... | @@ -107,4 +108,16 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl |
| 107 | 108 | orderSpecificationChangeRecordService.deleteById(id); |
| 108 | 109 | return InvokeResultBuilder.success(); |
| 109 | 110 | } |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 取消变更 | |
| 114 | + */ | |
| 115 | + @ApiOperation("取消变更") | |
| 116 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | |
| 117 | + @HasPermission({"order:change:cancel"}) | |
| 118 | + @GetMapping("/cancel") | |
| 119 | + public InvokeResult<Void> cancelById(@NotBlank(message = "id不能为空!") String id) { | |
| 120 | + orderSpecificationChangeRecordService.updateStatus(id, OrderSpecChangeStatus.CANCEL.getCode()); | |
| 121 | + return InvokeResultBuilder.success(); | |
| 122 | + } | |
| 110 | 123 | } | ... | ... |
| ... | ... | @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; |
| 5 | 5 | import com.baomidou.mybatisplus.annotation.TableName; |
| 6 | 6 | import com.lframework.starter.web.core.dto.BaseDto; |
| 7 | 7 | import com.lframework.starter.web.core.entity.BaseEntity; |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 8 | 9 | import lombok.Data; |
| 9 | 10 | |
| 10 | 11 | import java.math.BigDecimal; |
| ... | ... | @@ -75,6 +76,11 @@ public class ContractDistributorLine extends BaseEntity implements BaseDto { |
| 75 | 76 | private BigDecimal quantity; |
| 76 | 77 | |
| 77 | 78 | /** |
| 79 | + * 加工费 | |
| 80 | + */ | |
| 81 | + private BigDecimal processingFee; | |
| 82 | + | |
| 83 | + /** | |
| 78 | 84 | * 单价 |
| 79 | 85 | */ |
| 80 | 86 | private BigDecimal unitPrice; |
| ... | ... | @@ -100,6 +106,11 @@ public class ContractDistributorLine extends BaseEntity implements BaseDto { |
| 100 | 106 | private Integer showOrder; |
| 101 | 107 | |
| 102 | 108 | /** |
| 109 | + * 前端用ID | |
| 110 | + */ | |
| 111 | + private String itemId; | |
| 112 | + | |
| 113 | + /** | |
| 103 | 114 | * 创建人ID |
| 104 | 115 | */ |
| 105 | 116 | @TableField(fill = FieldFill.INSERT) | ... | ... |
| ... | ... | @@ -77,6 +77,11 @@ public class OrderSpecificationChangeRecord extends BaseEntity implements BaseDt |
| 77 | 77 | private String status; |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | + * 变更原因及变更后的质量要求 | |
| 81 | + */ | |
| 82 | + private String description; | |
| 83 | + | |
| 84 | + /** | |
| 80 | 85 | * 创建人ID |
| 81 | 86 | */ |
| 82 | 87 | @TableField(fill = FieldFill.INSERT) | ... | ... |
| ... | ... | @@ -175,6 +175,11 @@ public class PurchaseOrderInfo extends BaseEntity implements BaseDto { |
| 175 | 175 | private String customerTier; |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | + * 规格变更状态 | |
| 179 | + */ | |
| 180 | + private String specChangeStatus; | |
| 181 | + | |
| 182 | + /** | |
| 178 | 183 | * 创建人ID |
| 179 | 184 | */ |
| 180 | 185 | @TableField(fill = FieldFill.INSERT) | ... | ... |
| 1 | +package com.lframework.xingyun.sc.enums; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.EnumValue; | |
| 4 | +import com.lframework.starter.web.core.enums.BaseEnum; | |
| 5 | + | |
| 6 | +public enum OrderSpecChangeStatus implements BaseEnum<String> { | |
| 7 | + | |
| 8 | + | |
| 9 | + IN_PROGRESS("IN_PROGRESS", "变更中"), | |
| 10 | + COMPLETED("COMPLETED", "已完成"), | |
| 11 | + CANCEL("CANCEL", "已取消"), | |
| 12 | + ; | |
| 13 | + | |
| 14 | + | |
| 15 | + @EnumValue | |
| 16 | + private final String code; | |
| 17 | + | |
| 18 | + private final String desc; | |
| 19 | + | |
| 20 | + OrderSpecChangeStatus(String code, String desc) { | |
| 21 | + this.code = code; | |
| 22 | + this.desc = desc; | |
| 23 | + } | |
| 24 | + | |
| 25 | + @Override | |
| 26 | + public String getCode() { | |
| 27 | + return this.code; | |
| 28 | + } | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public String getDesc() { | |
| 32 | + return this.desc; | |
| 33 | + } | |
| 34 | + | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 通过code获取desc | |
| 38 | + * | |
| 39 | + * @param code 状态码 | |
| 40 | + * @return 描述信息 | |
| 41 | + */ | |
| 42 | + public static String getDescByCode(String code) { | |
| 43 | + for (OrderSpecChangeStatus status : OrderSpecChangeStatus.values()) { | |
| 44 | + if (status.getCode().equals(code)) { | |
| 45 | + return status.getDesc(); | |
| 46 | + } | |
| 47 | + } | |
| 48 | + return null; | |
| 49 | + } | |
| 50 | +} | ... | ... |
| ... | ... | @@ -73,6 +73,7 @@ public class ContractDistributorLineServiceImpl extends BaseMpServiceImpl<Contra |
| 73 | 73 | data.setLength(vo.getLength()); |
| 74 | 74 | data.setStatus(vo.getStatus()); |
| 75 | 75 | data.setQuantity(vo.getQuantity()); |
| 76 | + data.setProcessingFee(vo.getProcessingFee()); | |
| 76 | 77 | data.setUnitPrice(vo.getUnitPrice()); |
| 77 | 78 | data.setAmountExcludingTax(vo.getAmountExcludingTax()); |
| 78 | 79 | data.setTotalAmount(vo.getTotalAmount()); |
| ... | ... | @@ -85,6 +86,7 @@ public class ContractDistributorLineServiceImpl extends BaseMpServiceImpl<Contra |
| 85 | 86 | data.setWidthTolNeg(vo.getWidthTolNeg()); |
| 86 | 87 | data.setLengthTolPos(vo.getLengthTolPos()); |
| 87 | 88 | data.setLengthTolNeg(vo.getLengthTolNeg()); |
| 89 | + data.setItemId(vo.getItemId()); | |
| 88 | 90 | |
| 89 | 91 | getBaseMapper().insert(data); |
| 90 | 92 | |
| ... | ... | @@ -114,6 +116,7 @@ public class ContractDistributorLineServiceImpl extends BaseMpServiceImpl<Contra |
| 114 | 116 | .set(ContractDistributorLine::getLength, vo.getLength()) |
| 115 | 117 | .set(ContractDistributorLine::getStatus, vo.getStatus()) |
| 116 | 118 | .set(ContractDistributorLine::getQuantity, vo.getQuantity()) |
| 119 | + .set(ContractDistributorLine::getProcessingFee, vo.getProcessingFee()) | |
| 117 | 120 | .set(ContractDistributorLine::getUnitPrice, vo.getUnitPrice()) |
| 118 | 121 | .set(ContractDistributorLine::getAmountExcludingTax, vo.getAmountExcludingTax()) |
| 119 | 122 | .set(ContractDistributorLine::getTotalAmount, vo.getTotalAmount()) |
| ... | ... | @@ -126,6 +129,7 @@ public class ContractDistributorLineServiceImpl extends BaseMpServiceImpl<Contra |
| 126 | 129 | .set(ContractDistributorLine::getWidthTolNeg, vo.getWidthTolNeg()) |
| 127 | 130 | .set(ContractDistributorLine::getLengthTolPos, vo.getLengthTolPos()) |
| 128 | 131 | .set(ContractDistributorLine::getLengthTolNeg, vo.getLengthTolNeg()) |
| 132 | + .set(ContractDistributorLine::getItemId, vo.getItemId()) | |
| 129 | 133 | .eq(ContractDistributorLine::getId, vo.getId()); |
| 130 | 134 | |
| 131 | 135 | getBaseMapper().update(updateWrapper); | ... | ... |
| ... | ... | @@ -41,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional; |
| 41 | 41 | |
| 42 | 42 | import javax.annotation.Resource; |
| 43 | 43 | import java.io.Serializable; |
| 44 | +import java.math.BigDecimal; | |
| 44 | 45 | import java.time.LocalDate; |
| 45 | 46 | import java.time.LocalDateTime; |
| 46 | 47 | import java.util.ArrayList; |
| ... | ... | @@ -238,6 +239,7 @@ public class ContractDistributorStandardServiceImpl extends |
| 238 | 239 | createContractDistributorLineVo.setLength(updateContractDistributorLineVo.getLength()); |
| 239 | 240 | createContractDistributorLineVo.setStatus(updateContractDistributorLineVo.getStatus()); |
| 240 | 241 | createContractDistributorLineVo.setQuantity(updateContractDistributorLineVo.getQuantity()); |
| 242 | + createContractDistributorLineVo.setProcessingFee(updateContractDistributorLineVo.getProcessingFee()); | |
| 241 | 243 | createContractDistributorLineVo.setUnitPrice(updateContractDistributorLineVo.getUnitPrice()); |
| 242 | 244 | createContractDistributorLineVo.setAmountExcludingTax(updateContractDistributorLineVo.getAmountExcludingTax()); |
| 243 | 245 | createContractDistributorLineVo.setTotalAmount(updateContractDistributorLineVo.getTotalAmount()); |
| ... | ... | @@ -250,6 +252,7 @@ public class ContractDistributorStandardServiceImpl extends |
| 250 | 252 | createContractDistributorLineVo.setWidthTolNeg(updateContractDistributorLineVo.getWidthTolNeg()); |
| 251 | 253 | createContractDistributorLineVo.setLengthTolPos(updateContractDistributorLineVo.getLengthTolPos()); |
| 252 | 254 | createContractDistributorLineVo.setLengthTolNeg(updateContractDistributorLineVo.getLengthTolNeg()); |
| 255 | + createContractDistributorLineVo.setItemId(updateContractDistributorLineVo.getItemId()); | |
| 253 | 256 | |
| 254 | 257 | contractDistributorLineService.create(createContractDistributorLineVo); |
| 255 | 258 | } |
| ... | ... | @@ -558,6 +561,72 @@ public class ContractDistributorStandardServiceImpl extends |
| 558 | 561 | OpLogUtil.setExtra(vo); |
| 559 | 562 | } |
| 560 | 563 | |
| 564 | + @Override | |
| 565 | + @OpLog(type = OtherOpLogType.class, name = "合同锁规,ID:{}", params = {"#vo.id"}) | |
| 566 | + @Transactional(rollbackFor = Exception.class) | |
| 567 | + public void specificationLock(UpdateContractDistributorStandardVo vo) { | |
| 568 | + ContractDistributorStandard data = getBaseMapper().selectById(vo.getId()); | |
| 569 | + if (ObjectUtil.isNull(data)) { | |
| 570 | + throw new DefaultClientException("合同不存在!"); | |
| 571 | + } | |
| 572 | + | |
| 573 | + List<UpdateContractDistributorLineVo> lineVoList = vo.getContractDistributorLineList(); | |
| 574 | + if (CollectionUtils.isEmpty(lineVoList)) { | |
| 575 | + throw new DefaultClientException("合同行数据为空!"); | |
| 576 | + } | |
| 577 | + | |
| 578 | + Wrapper<ContractDistributorStandard> childWrapper = Wrappers.lambdaQuery(ContractDistributorStandard.class) | |
| 579 | + .eq(ContractDistributorStandard::getParentId, vo.getId()); | |
| 580 | + | |
| 581 | + List<ContractDistributorStandard> childContractList = getBaseMapper().selectList(childWrapper); | |
| 582 | + BigDecimal allChildTotalQuantity = vo.getTotalQuantity().add(CollectionUtils.isEmpty(childContractList) ? new BigDecimal(0) : childContractList.get(0).getTotalQuantity()); | |
| 583 | + if (allChildTotalQuantity.compareTo(data.getTotalQuantity()) > 0) { | |
| 584 | + throw new DefaultClientException("锁规总数量大于合同总数量,锁规失败!"); | |
| 585 | + } | |
| 586 | + | |
| 587 | + // 判断锁规是否完成(锁规两次或锁规数量等于合同数量) | |
| 588 | + boolean checkPriceSpecLocked = CollectionUtils.isNotEmpty(childContractList) || (allChildTotalQuantity.compareTo(data.getTotalQuantity()) == 0); | |
| 589 | + | |
| 590 | + data.setId(IdUtil.getUUID()); | |
| 591 | + data.setTotalQuantity(vo.getTotalQuantity()); | |
| 592 | + data.setTotalAmountCapital(vo.getTotalAmountCapital()); | |
| 593 | + data.setTotalAmountExcludingTax(vo.getTotalAmountExcludingTax()); | |
| 594 | + data.setTotalAmountIncludingTax(vo.getTotalAmountIncludingTax()); | |
| 595 | + data.setStatus("STANDARD"); | |
| 596 | + data.setParentId(vo.getId()); | |
| 597 | + getBaseMapper().insert(data); | |
| 598 | + | |
| 599 | + Wrapper<ContractDistributorLine> lineWrapper = Wrappers.lambdaQuery(ContractDistributorLine.class) | |
| 600 | + .eq(ContractDistributorLine::getContractId, vo.getId()) | |
| 601 | + .orderByAsc(ContractDistributorLine::getShowOrder); | |
| 602 | + List<ContractDistributorLine> oldContractDistributorLineList = contractDistributorLineService.list(lineWrapper); | |
| 603 | + Map<String, ContractDistributorLine> contractDistributorLineMap = CollectionUtils.emptyIfNull(oldContractDistributorLineList) | |
| 604 | + .stream().collect(Collectors.toMap(ContractDistributorLine::getId, Function.identity())); | |
| 605 | + | |
| 606 | + for (UpdateContractDistributorLineVo lineVo : lineVoList) { | |
| 607 | + ContractDistributorLine contractDistributorLine = contractDistributorLineMap.remove(lineVo.getId()); | |
| 608 | + if (contractDistributorLine == null) { | |
| 609 | + throw new DefaultClientException("合同行数据不存在!"); | |
| 610 | + } | |
| 611 | + | |
| 612 | + contractDistributorLine.setId(IdUtil.getUUID()); | |
| 613 | + contractDistributorLine.setContractId(data.getId()); | |
| 614 | + contractDistributorLine.setQuantity(lineVo.getQuantity()); | |
| 615 | + contractDistributorLine.setUnitPrice(lineVo.getUnitPrice()); | |
| 616 | + contractDistributorLine.setAmountExcludingTax(lineVo.getAmountExcludingTax()); | |
| 617 | + contractDistributorLine.setTotalAmount(lineVo.getTotalAmount()); | |
| 618 | + contractDistributorLineService.getBaseMapper().insert(contractDistributorLine); | |
| 619 | + } | |
| 620 | + | |
| 621 | + Wrapper<ContractDistributorStandard> changeLocked = Wrappers.lambdaUpdate(ContractDistributorStandard.class) | |
| 622 | + .set(ContractDistributorStandard::getPriceSpecLocked, checkPriceSpecLocked) | |
| 623 | + .eq(ContractDistributorStandard::getId, vo.getId()); | |
| 624 | + getBaseMapper().update(changeLocked); | |
| 625 | + | |
| 626 | + OpLogUtil.setVariable("id", vo.getId()); | |
| 627 | + OpLogUtil.setExtra(vo); | |
| 628 | + } | |
| 629 | + | |
| 561 | 630 | @CacheEvict(value = ContractDistributorStandard.CACHE_NAME, key = "@cacheVariables.tenantId() + #key") |
| 562 | 631 | @Override |
| 563 | 632 | public void cleanCacheByKey(Serializable key) { | ... | ... |
| ... | ... | @@ -3,30 +3,32 @@ package com.lframework.xingyun.sc.impl.order; |
| 3 | 3 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 5 | import com.github.pagehelper.PageInfo; |
| 6 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 7 | +import com.lframework.starter.web.core.utils.*; | |
| 8 | +import com.lframework.starter.web.inner.entity.SysUser; | |
| 9 | +import com.lframework.starter.web.inner.service.system.SysUserService; | |
| 6 | 10 | import com.lframework.xingyun.sc.entity.OrderSpecificationChangeRecord; |
| 7 | 11 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 8 | -import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 9 | 12 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 10 | -import com.lframework.starter.web.core.utils.OpLogUtil; | |
| 11 | 13 | import com.lframework.starter.common.exceptions.impl.DefaultClientException; |
| 12 | -import com.lframework.starter.web.core.utils.IdUtil; | |
| 13 | 14 | import com.lframework.starter.common.utils.ObjectUtil; |
| 14 | 15 | import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 15 | -import com.lframework.starter.web.core.utils.PageHelperUtil; | |
| 16 | 16 | import com.lframework.starter.common.utils.Assert; |
| 17 | 17 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 18 | 18 | import com.lframework.xingyun.sc.entity.PurchaseOrderLine; |
| 19 | +import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus; | |
| 20 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | |
| 19 | 21 | import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; |
| 20 | -import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; | |
| 21 | -import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo; | |
| 22 | 22 | import com.lframework.xingyun.sc.vo.order.change.*; |
| 23 | 23 | import org.apache.commons.collections4.CollectionUtils; |
| 24 | +import org.apache.commons.lang3.StringUtils; | |
| 24 | 25 | import org.springframework.transaction.annotation.Transactional; |
| 25 | 26 | import com.lframework.xingyun.sc.mappers.OrderSpecificationChangeRecordMapper; |
| 26 | 27 | import com.lframework.xingyun.sc.service.order.OrderSpecificationChangeRecordService; |
| 27 | 28 | import org.springframework.stereotype.Service; |
| 28 | 29 | |
| 29 | 30 | import javax.annotation.Resource; |
| 31 | +import java.math.BigDecimal; | |
| 30 | 32 | import java.util.*; |
| 31 | 33 | |
| 32 | 34 | @Service |
| ... | ... | @@ -35,6 +37,10 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
| 35 | 37 | |
| 36 | 38 | @Resource |
| 37 | 39 | private PurchaseOrderLineService purchaseOrderLineService; |
| 40 | + @Resource | |
| 41 | + private SysUserService sysUserService; | |
| 42 | + @Resource | |
| 43 | + private PurchaseOrderInfoService purchaseOrderInfoService; | |
| 38 | 44 | |
| 39 | 45 | |
| 40 | 46 | @Override |
| ... | ... | @@ -69,7 +75,7 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
| 69 | 75 | } |
| 70 | 76 | // 变更前 |
| 71 | 77 | Map<String, List<PurchaseOrderLine>> beforeChangeMap = new HashMap<>(orderIds.size()); |
| 72 | - List<PurchaseOrderLine> beforeChangeList = purchaseOrderLineService.listByIds(orderIds); | |
| 78 | + List<PurchaseOrderLine> beforeChangeList = purchaseOrderLineService.listByOrderIds(orderIds); | |
| 73 | 79 | for (PurchaseOrderLine purchaseOrderLine : beforeChangeList) { |
| 74 | 80 | String purchaseOrderId = purchaseOrderLine.getPurchaseOrderId(); |
| 75 | 81 | List<PurchaseOrderLine> list = beforeChangeMap.computeIfAbsent(purchaseOrderId, k -> new ArrayList<>()); |
| ... | ... | @@ -95,9 +101,20 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
| 95 | 101 | |
| 96 | 102 | @Override |
| 97 | 103 | public OrderSpecificationChangeRecord findById(String id) { |
| 104 | + OrderSpecificationChangeRecord changeRecord = getBaseMapper().selectById(id); | |
| 105 | + if (changeRecord == null) { | |
| 106 | + throw new DefaultClientException("订货单规格变更记录不存在!"); | |
| 107 | + }; | |
| 108 | + String orderId = changeRecord.getOrderId(); | |
| 109 | + // 获取规格数据 | |
| 110 | + // 变更前 | |
| 111 | + List<PurchaseOrderLine> beforeChangeList = purchaseOrderLineService.listByOrderIds(Collections.singletonList(orderId)); | |
| 112 | + changeRecord.setBeforeChangeSpecList(beforeChangeList); | |
| 113 | + // 变更后 | |
| 114 | + List<PurchaseOrderLine> afterChangeList = purchaseOrderLineService.listByChangeIds(Collections.singletonList(id)); | |
| 115 | + changeRecord.setAfterChangeSpecList(afterChangeList); | |
| 98 | 116 | |
| 99 | - | |
| 100 | - return getBaseMapper().selectById(id); | |
| 117 | + return changeRecord; | |
| 101 | 118 | } |
| 102 | 119 | |
| 103 | 120 | @OpLog(type = OtherOpLogType.class, name = "新增订货单规格变更记录,ID:{}", params = {"#id"}) |
| ... | ... | @@ -110,10 +127,39 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
| 110 | 127 | data.setOrderId(vo.getOrderId()); |
| 111 | 128 | data.setOrderQuantity(vo.getOrderQuantity()); |
| 112 | 129 | data.setDeliveryDate(vo.getDeliveryDate()); |
| 130 | + // 审核中 | |
| 131 | + data.setStatus("AUDIT"); | |
| 113 | 132 | |
| 114 | - getBaseMapper().insert(data); | |
| 133 | + // 获取当前人员信息 | |
| 134 | + String userId = SecurityUtil.getCurrentUser().getId(); | |
| 135 | + SysUser user = sysUserService.findById(userId); | |
| 115 | 136 | // 处理规格数据 |
| 137 | + BigDecimal totalQuantity = new BigDecimal(0); | |
| 138 | + List<PurchaseOrderLine> orderLineList = new ArrayList<>(); | |
| 116 | 139 | List<CreateOrderSpecificationInfoVo> orderSpecList = vo.getOrderSpecList(); |
| 140 | + for (int i = 0; i < orderSpecList.size(); i++) { | |
| 141 | + CreateOrderSpecificationInfoVo createSpecVo = orderSpecList.get(i); | |
| 142 | + PurchaseOrderLine orderLine = JsonUtil.parseObject(JsonUtil.toJsonString(createSpecVo), PurchaseOrderLine.class); | |
| 143 | + orderLine.setId(IdUtil.getId()); | |
| 144 | + orderLine.setChangeId(id); | |
| 145 | + orderLine.setCreateById(userId); | |
| 146 | + orderLine.setCreateBy(user.getName()); | |
| 147 | + orderLine.setUpdateById(userId); | |
| 148 | + orderLine.setUpdateBy(user.getName()); | |
| 149 | + if (orderLine.getShowOrder() == null) { | |
| 150 | + orderLine.setShowOrder(i + 1); | |
| 151 | + } | |
| 152 | + totalQuantity = totalQuantity.add(orderLine.getQuantity()); | |
| 153 | + | |
| 154 | + orderLineList.add(orderLine); | |
| 155 | + } | |
| 156 | + if (data.getOrderQuantity() == null) { | |
| 157 | + data.setOrderQuantity(totalQuantity.doubleValue()); | |
| 158 | + } | |
| 159 | + getBaseMapper().insert(data); | |
| 160 | + purchaseOrderLineService.batchAdd(orderLineList); | |
| 161 | + // 更新订货单规格变更状态 | |
| 162 | + purchaseOrderInfoService.updateSpecChangeStatus(vo.getOrderId(), OrderSpecChangeStatus.IN_PROGRESS.getCode()); | |
| 117 | 163 | |
| 118 | 164 | OpLogUtil.setVariable("id", data.getId()); |
| 119 | 165 | OpLogUtil.setExtra(vo); |
| ... | ... | @@ -133,10 +179,30 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
| 133 | 179 | .set(OrderSpecificationChangeRecord::getOrderId, vo.getOrderId()) |
| 134 | 180 | .set(OrderSpecificationChangeRecord::getOrderQuantity, vo.getOrderQuantity()) |
| 135 | 181 | .set(OrderSpecificationChangeRecord::getDeliveryDate, vo.getDeliveryDate()) |
| 182 | + .set(OrderSpecificationChangeRecord::getStatus, "AUDIT") | |
| 136 | 183 | .eq(OrderSpecificationChangeRecord::getId, vo.getId()); |
| 137 | - getBaseMapper().update(updateWrapper); | |
| 184 | + // 获取当前人员信息 | |
| 185 | + String userId = SecurityUtil.getCurrentUser().getId(); | |
| 186 | + SysUser user = sysUserService.findById(userId); | |
| 138 | 187 | // 更新规格数据 |
| 188 | + BigDecimal totalQuantity = new BigDecimal(0); | |
| 189 | + List<PurchaseOrderLine> orderLineList = new ArrayList<>(); | |
| 139 | 190 | List<UpdateOrderSpecificationInfoVo> orderSpecList = vo.getOrderSpecList(); |
| 191 | + for (UpdateOrderSpecificationInfoVo updateSpecVo : orderSpecList) { | |
| 192 | + PurchaseOrderLine orderLine = JsonUtil.parseObject(JsonUtil.toJsonString(updateSpecVo), PurchaseOrderLine.class); | |
| 193 | + orderLine.setUpdateById(userId); | |
| 194 | + orderLine.setUpdateBy(user.getName()); | |
| 195 | + totalQuantity = totalQuantity.add(orderLine.getQuantity()); | |
| 196 | + | |
| 197 | + orderLineList.add(orderLine); | |
| 198 | + } | |
| 199 | + if (vo.getOrderQuantity() == null) { | |
| 200 | + updateWrapper.set(OrderSpecificationChangeRecord::getOrderQuantity, totalQuantity.doubleValue()); | |
| 201 | + } else { | |
| 202 | + updateWrapper.set(OrderSpecificationChangeRecord::getOrderQuantity, vo.getOrderQuantity()); | |
| 203 | + } | |
| 204 | + getBaseMapper().update(updateWrapper); | |
| 205 | + purchaseOrderLineService.batchUpdate(orderLineList); | |
| 140 | 206 | |
| 141 | 207 | OpLogUtil.setVariable("id", data.getId()); |
| 142 | 208 | OpLogUtil.setExtra(vo); |
| ... | ... | @@ -148,4 +214,29 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
| 148 | 214 | public void deleteById(String id) { |
| 149 | 215 | getBaseMapper().deleteById(id); |
| 150 | 216 | } |
| 217 | + | |
| 218 | + /** | |
| 219 | + * 更新状态 | |
| 220 | + * | |
| 221 | + * @param id 主键ID | |
| 222 | + * @param status 状态 | |
| 223 | + */ | |
| 224 | + @Override | |
| 225 | + public void updateStatus(String id, String status) { | |
| 226 | + if (StringUtils.isBlank(id) || StringUtils.isBlank(status)) { | |
| 227 | + return; | |
| 228 | + } | |
| 229 | + OrderSpecificationChangeRecord record = getById(id); | |
| 230 | + if (record == null) { | |
| 231 | + throw new DefaultClientException("规格变更记录不存在!"); | |
| 232 | + } | |
| 233 | + LambdaUpdateWrapper<OrderSpecificationChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderSpecificationChangeRecord.class); | |
| 234 | + updateWrapper.set(OrderSpecificationChangeRecord::getStatus, status) | |
| 235 | + .eq(OrderSpecificationChangeRecord::getId, id); | |
| 236 | + getBaseMapper().update(updateWrapper); | |
| 237 | + if (OrderSpecChangeStatus.CANCEL.getCode().equals(status)) { | |
| 238 | + // 更新订货单规格变更状态 | |
| 239 | + purchaseOrderInfoService.updateSpecChangeStatus(record.getOrderId(), status); | |
| 240 | + } | |
| 241 | + } | |
| 151 | 242 | } | ... | ... |
| ... | ... | @@ -321,6 +321,23 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 321 | 321 | getBaseMapper().update(updateWrapper); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | + /** | |
| 325 | + * 更新规格变更状态 | |
| 326 | + * | |
| 327 | + * @param id 主键ID | |
| 328 | + * @param status 状态 | |
| 329 | + */ | |
| 330 | + @Override | |
| 331 | + public void updateSpecChangeStatus(String id, String status) { | |
| 332 | + if (StringUtils.isBlank(id) || StringUtils.isBlank(status)) { | |
| 333 | + return; | |
| 334 | + } | |
| 335 | + LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class) | |
| 336 | + .set(PurchaseOrderInfo::getSpecChangeStatus, status) | |
| 337 | + .eq(PurchaseOrderInfo::getId, id); | |
| 338 | + getBaseMapper().update(updateWrapper); | |
| 339 | + } | |
| 340 | + | |
| 324 | 341 | @Override |
| 325 | 342 | public void cleanCacheByKey(Serializable key) { |
| 326 | 343 | ... | ... |
| ... | ... | @@ -24,7 +24,7 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService; |
| 24 | 24 | import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; |
| 25 | 25 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; |
| 26 | 26 | import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo; |
| 27 | -import org.apache.commons.lang3.StringUtils; | |
| 27 | +import org.apache.commons.collections4.CollectionUtils; | |
| 28 | 28 | import org.springframework.transaction.annotation.Transactional; |
| 29 | 29 | import org.springframework.stereotype.Service; |
| 30 | 30 | |
| ... | ... | @@ -209,17 +209,43 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | @Override |
| 212 | - public List<PurchaseOrderLine> listByOrderId(String orderId) { | |
| 213 | - if (StringUtils.isBlank(orderId)) { | |
| 212 | + public List<PurchaseOrderLine> listByOrderIds(List<String> orderIds) { | |
| 213 | + if (CollectionUtils.isEmpty(orderIds)) { | |
| 214 | 214 | return Collections.emptyList(); |
| 215 | 215 | } |
| 216 | 216 | LambdaQueryWrapper<PurchaseOrderLine> queryWrapper = Wrappers.lambdaQuery(PurchaseOrderLine.class); |
| 217 | - queryWrapper.eq(PurchaseOrderLine::getChangeId, orderId) | |
| 217 | + queryWrapper.in(PurchaseOrderLine::getPurchaseOrderId, orderIds) | |
| 218 | 218 | .orderByAsc(PurchaseOrderLine::getShowOrder); |
| 219 | 219 | |
| 220 | 220 | return getBaseMapper().selectList(queryWrapper); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | + /** | |
| 224 | + * 批量新增 | |
| 225 | + * | |
| 226 | + * @param specList 数据集合 | |
| 227 | + */ | |
| 228 | + @Override | |
| 229 | + public void batchAdd(List<PurchaseOrderLine> specList) { | |
| 230 | + if (CollectionUtils.isEmpty(specList)) { | |
| 231 | + return; | |
| 232 | + } | |
| 233 | + getBaseMapper().batchAdd(specList); | |
| 234 | + } | |
| 235 | + | |
| 236 | + /** | |
| 237 | + * 批量更新 | |
| 238 | + * | |
| 239 | + * @param specList 数据集合 | |
| 240 | + */ | |
| 241 | + @Override | |
| 242 | + public void batchUpdate(List<PurchaseOrderLine> specList) { | |
| 243 | + if (CollectionUtils.isEmpty(specList)) { | |
| 244 | + return; | |
| 245 | + } | |
| 246 | + getBaseMapper().batchUpdate(specList); | |
| 247 | + } | |
| 248 | + | |
| 223 | 249 | @Override |
| 224 | 250 | public void cleanCacheByKey(Serializable key) { |
| 225 | 251 | ... | ... |
| ... | ... | @@ -21,4 +21,18 @@ public interface PurchaseOrderLineMapper extends BaseMapper<PurchaseOrderLine> { |
| 21 | 21 | * @return |
| 22 | 22 | */ |
| 23 | 23 | List<PurchaseOrderLine> query(@Param("vo") QueryPurchaseOrderLineVo vo); |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 批量新增 | |
| 27 | + * | |
| 28 | + * @param specList 数据集合 | |
| 29 | + */ | |
| 30 | + int batchAdd(@Param("specList") List<PurchaseOrderLine> specList); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 批量新增 | |
| 34 | + * | |
| 35 | + * @param specList 数据集合 | |
| 36 | + */ | |
| 37 | + int batchUpdate(@Param("specList") List<PurchaseOrderLine> specList); | |
| 24 | 38 | } | ... | ... |
| ... | ... | @@ -88,4 +88,11 @@ public interface ContractDistributorStandardService extends BaseMpService<Contra |
| 88 | 88 | */ |
| 89 | 89 | void stockContractPriceLock(UpdateContractDistributorStandardVo vo); |
| 90 | 90 | |
| 91 | + /** | |
| 92 | + * 锁规 | |
| 93 | + * | |
| 94 | + * @param vo | |
| 95 | + */ | |
| 96 | + void specificationLock(UpdateContractDistributorStandardVo vo); | |
| 97 | + | |
| 91 | 98 | } |
| \ No newline at end of file | ... | ... |
| ... | ... | @@ -57,4 +57,12 @@ public interface OrderSpecificationChangeRecordService extends BaseMpService<Ord |
| 57 | 57 | * @param id 主键ID |
| 58 | 58 | */ |
| 59 | 59 | void deleteById(String id); |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 更新状态 | |
| 63 | + * | |
| 64 | + * @param id 主键ID | |
| 65 | + * @param status 状态 | |
| 66 | + */ | |
| 67 | + void updateStatus(String id, String status); | |
| 60 | 68 | } | ... | ... |
| ... | ... | @@ -88,4 +88,12 @@ public interface PurchaseOrderInfoService extends BaseMpService<PurchaseOrderInf |
| 88 | 88 | * @param status 撤销状态 |
| 89 | 89 | */ |
| 90 | 90 | void updateRevokeStatus(String id, String status); |
| 91 | + | |
| 92 | + /** | |
| 93 | + * 更新规格变更状态 | |
| 94 | + * | |
| 95 | + * @param id 主键ID | |
| 96 | + * @param status 状态 | |
| 97 | + */ | |
| 98 | + void updateSpecChangeStatus(String id, String status); | |
| 91 | 99 | } | ... | ... |
| ... | ... | @@ -75,8 +75,22 @@ public interface PurchaseOrderLineService extends BaseMpService<PurchaseOrderLin |
| 75 | 75 | /** |
| 76 | 76 | * 根据订货单ID查询 |
| 77 | 77 | * |
| 78 | - * @param orderId 订货单ID | |
| 78 | + * @param orderIds 订货单ID集合 | |
| 79 | 79 | * @return List<PurchaseOrderLine> |
| 80 | 80 | */ |
| 81 | - List<PurchaseOrderLine> listByOrderId(String orderId); | |
| 81 | + List<PurchaseOrderLine> listByOrderIds(List<String> orderIds); | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 批量新增 | |
| 85 | + * | |
| 86 | + * @param specList 数据集合 | |
| 87 | + */ | |
| 88 | + void batchAdd(List<PurchaseOrderLine> specList); | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 批量更新 | |
| 92 | + * | |
| 93 | + * @param specList 数据集合 | |
| 94 | + */ | |
| 95 | + void batchUpdate(List<PurchaseOrderLine> specList); | |
| 82 | 96 | } | ... | ... |
| ... | ... | @@ -92,6 +92,14 @@ public class CreateContractDistributorLineVo implements BaseVo, Serializable { |
| 92 | 92 | private BigDecimal quantity; |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | + * 加工费 | |
| 96 | + */ | |
| 97 | + @ApiModelProperty(value = "加工费") | |
| 98 | + @TypeMismatch(message = "加工费格式有误!") | |
| 99 | + @IsNumberPrecision(message = "加工费最多允许4位小数!", value = 4) | |
| 100 | + private BigDecimal processingFee; | |
| 101 | + | |
| 102 | + /** | |
| 95 | 103 | * 单价 |
| 96 | 104 | */ |
| 97 | 105 | @ApiModelProperty(value = "单价") |
| ... | ... | @@ -178,4 +186,9 @@ public class CreateContractDistributorLineVo implements BaseVo, Serializable { |
| 178 | 186 | @TypeMismatch(message = "长度公差负格式有误!") |
| 179 | 187 | private BigDecimal lengthTolNeg; |
| 180 | 188 | |
| 189 | + /** | |
| 190 | + * 前端用ID | |
| 191 | + */ | |
| 192 | + @ApiModelProperty(value = "前端用ID") | |
| 193 | + private String itemId; | |
| 181 | 194 | } | ... | ... |
| ... | ... | @@ -96,6 +96,14 @@ public class UpdateContractDistributorLineVo implements BaseVo, Serializable { |
| 96 | 96 | private BigDecimal quantity; |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | + * 加工费 | |
| 100 | + */ | |
| 101 | + @ApiModelProperty(value = "加工费") | |
| 102 | + @TypeMismatch(message = "加工费格式有误!") | |
| 103 | + @IsNumberPrecision(message = "加工费最多允许4位小数!", value = 4) | |
| 104 | + private BigDecimal processingFee; | |
| 105 | + | |
| 106 | + /** | |
| 99 | 107 | * 单价 |
| 100 | 108 | */ |
| 101 | 109 | @ApiModelProperty(value = "单价") |
| ... | ... | @@ -181,5 +189,10 @@ public class UpdateContractDistributorLineVo implements BaseVo, Serializable { |
| 181 | 189 | @TypeMismatch(message = "长度公差负格式有误!") |
| 182 | 190 | private BigDecimal lengthTolNeg; |
| 183 | 191 | |
| 192 | + /** | |
| 193 | + * 前端用ID | |
| 194 | + */ | |
| 195 | + @ApiModelProperty(value = "前端用ID") | |
| 196 | + private String itemId; | |
| 184 | 197 | } |
| 185 | 198 | ... | ... |
| ... | ... | @@ -9,7 +9,6 @@ import com.lframework.starter.web.core.vo.BaseVo; |
| 9 | 9 | import javax.validation.constraints.NotEmpty; |
| 10 | 10 | import javax.validation.constraints.NotNull; |
| 11 | 11 | |
| 12 | -import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; | |
| 13 | 12 | import io.swagger.annotations.ApiModelProperty; |
| 14 | 13 | import com.lframework.starter.web.core.components.validation.TypeMismatch; |
| 15 | 14 | import org.hibernate.validator.constraints.Length; |
| ... | ... | @@ -48,6 +47,12 @@ public class CreateOrderSpecificationChangeRecordVo implements BaseVo, Serializa |
| 48 | 47 | private LocalDate deliveryDate; |
| 49 | 48 | |
| 50 | 49 | /** |
| 50 | + * 变更原因及变更后的质量要求 | |
| 51 | + */ | |
| 52 | + @ApiModelProperty(value = "变更原因及变更后的质量要求") | |
| 53 | + private String description; | |
| 54 | + | |
| 55 | + /** | |
| 51 | 56 | * 规格变更记录 |
| 52 | 57 | */ |
| 53 | 58 | @Valid | ... | ... |
| ... | ... | @@ -53,6 +53,12 @@ public class UpdateOrderSpecificationChangeRecordVo implements BaseVo, Serializa |
| 53 | 53 | private LocalDate deliveryDate; |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | + * 变更原因及变更后的质量要求 | |
| 57 | + */ | |
| 58 | + @ApiModelProperty(value = "变更原因及变更后的质量要求") | |
| 59 | + private String description; | |
| 60 | + | |
| 61 | + /** | |
| 56 | 62 | * 规格变更记录 |
| 57 | 63 | */ |
| 58 | 64 | @Valid | ... | ... |
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | <result column="length" property="length"/> |
| 14 | 14 | <result column="status" property="status"/> |
| 15 | 15 | <result column="quantity" property="quantity"/> |
| 16 | + <result column="processing_fee" property="processingFee"/> | |
| 16 | 17 | <result column="unit_price" property="unitPrice"/> |
| 17 | 18 | <result column="amount_excluding_tax" property="amountExcludingTax"/> |
| 18 | 19 | <result column="total_amount" property="totalAmount"/> |
| ... | ... | @@ -31,6 +32,7 @@ |
| 31 | 32 | <result column="width_tol_neg" property="widthTolNeg"/> |
| 32 | 33 | <result column="length_tol_pos" property="lengthTolPos"/> |
| 33 | 34 | <result column="length_tol_neg" property="lengthTolNeg"/> |
| 35 | + <result column="item_id" property="itemId"/> | |
| 34 | 36 | </resultMap> |
| 35 | 37 | |
| 36 | 38 | <sql id="ContractDistributorLine_sql"> |
| ... | ... | @@ -44,6 +46,7 @@ |
| 44 | 46 | tb.length, |
| 45 | 47 | tb.status, |
| 46 | 48 | tb.quantity, |
| 49 | + tb.processing_fee, | |
| 47 | 50 | tb.unit_price, |
| 48 | 51 | tb.amount_excluding_tax, |
| 49 | 52 | tb.total_amount, |
| ... | ... | @@ -61,7 +64,8 @@ |
| 61 | 64 | tb.width_tol_pos, |
| 62 | 65 | tb.width_tol_neg, |
| 63 | 66 | tb.length_tol_pos, |
| 64 | - tb.length_tol_neg | |
| 67 | + tb.length_tol_neg, | |
| 68 | + tb.item_id | |
| 65 | 69 | FROM tbl_contract_distributor_line AS tb |
| 66 | 70 | </sql> |
| 67 | 71 | ... | ... |
| ... | ... | @@ -80,4 +80,115 @@ |
| 80 | 80 | </where> |
| 81 | 81 | ORDER BY tb.show_order ASC |
| 82 | 82 | </select> |
| 83 | + | |
| 84 | + <insert id="batchAdd" parameterType="java.util.List"> | |
| 85 | + INSERT INTO tbl_purchase_order_line ( | |
| 86 | + id, purchase_order_id, change_id, industry, quality, brand, | |
| 87 | + thickness, thickness_tol_pos, thickness_tol_neg, | |
| 88 | + width, width_tol_pos, width_tol_neg, | |
| 89 | + length, length_tol_pos, length_tol_neg, | |
| 90 | + status, quantity, sales_price, delivery_date, show_order, | |
| 91 | + assessment_exceeds_agreement, create_by_id, create_by, update_by_id, update_by | |
| 92 | + ) VALUES | |
| 93 | + <foreach collection="specList" item="item" separator=","> | |
| 94 | + ( | |
| 95 | + #{item.id}, #{item.purchaseOrderId}, #{item.changeId}, #{item.industry}, #{item.quality}, #{item.brand}, | |
| 96 | + #{item.thickness}, #{item.thicknessTolPos}, #{item.thicknessTolNeg}, | |
| 97 | + #{item.width}, #{item.widthTolPos}, #{item.widthTolNeg}, | |
| 98 | + #{item.length}, #{item.lengthTolPos}, #{item.lengthTolNeg}, | |
| 99 | + #{item.status}, #{item.quantity}, #{item.salesPrice}, #{item.deliveryDate}, #{item.showOrder}, | |
| 100 | + #{item.assessmentExceedsAgreement}, #{item.createById}, #{item.createBy}, #{item.updateById}, #{item.updateBy} | |
| 101 | + ) | |
| 102 | + </foreach> | |
| 103 | + </insert> | |
| 104 | + | |
| 105 | + <update id="batchUpdate" parameterType="java.util.List"> | |
| 106 | + UPDATE tbl_purchase_order_line | |
| 107 | + SET | |
| 108 | + industry = | |
| 109 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 110 | + WHEN #{item.id} THEN #{item.industry} | |
| 111 | + </foreach>, | |
| 112 | + quality = | |
| 113 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 114 | + WHEN #{item.id} THEN #{item.quality} | |
| 115 | + </foreach>, | |
| 116 | + brand = | |
| 117 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 118 | + WHEN #{item.id} THEN #{item.brand} | |
| 119 | + </foreach>, | |
| 120 | + thickness = | |
| 121 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 122 | + WHEN #{item.id} THEN #{item.thickness} | |
| 123 | + </foreach>, | |
| 124 | + thickness_tol_pos = | |
| 125 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 126 | + WHEN #{item.id} THEN #{item.thicknessTolPos} | |
| 127 | + </foreach>, | |
| 128 | + thickness_tol_neg = | |
| 129 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 130 | + WHEN #{item.id} THEN #{item.thicknessTolNeg} | |
| 131 | + </foreach>, | |
| 132 | + width = | |
| 133 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 134 | + WHEN #{item.id} THEN #{item.width} | |
| 135 | + </foreach>, | |
| 136 | + width_tol_pos = | |
| 137 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 138 | + WHEN #{item.id} THEN #{item.widthTolPos} | |
| 139 | + </foreach>, | |
| 140 | + width_tol_neg = | |
| 141 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 142 | + WHEN #{item.id} THEN #{item.widthTolNeg} | |
| 143 | + </foreach>, | |
| 144 | + length = | |
| 145 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 146 | + WHEN #{item.id} THEN #{item.length} | |
| 147 | + </foreach>, | |
| 148 | + length_tol_pos = | |
| 149 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 150 | + WHEN #{item.id} THEN #{item.lengthTolPos} | |
| 151 | + </foreach>, | |
| 152 | + length_tol_neg = | |
| 153 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 154 | + WHEN #{item.id} THEN #{item.lengthTolNeg} | |
| 155 | + </foreach>, | |
| 156 | + status = | |
| 157 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 158 | + WHEN #{item.id} THEN #{item.status} | |
| 159 | + </foreach>, | |
| 160 | + quantity = | |
| 161 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 162 | + WHEN #{item.id} THEN #{item.quantity} | |
| 163 | + </foreach>, | |
| 164 | + sales_price = | |
| 165 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 166 | + WHEN #{item.id} THEN #{item.salesPrice} | |
| 167 | + </foreach>, | |
| 168 | + delivery_date = | |
| 169 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 170 | + WHEN #{item.id} THEN #{item.deliveryDate} | |
| 171 | + </foreach>, | |
| 172 | + show_order = | |
| 173 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 174 | + WHEN #{item.id} THEN #{item.showOrder} | |
| 175 | + </foreach>, | |
| 176 | + assessment_exceeds_agreement = | |
| 177 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 178 | + WHEN #{item.id} THEN #{item.assessmentExceedsAgreement} | |
| 179 | + </foreach>, | |
| 180 | + update_by_id = | |
| 181 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 182 | + WHEN #{item.id} THEN #{item.updateById} | |
| 183 | + </foreach>, | |
| 184 | + update_by = | |
| 185 | + <foreach collection="specList" item="item" open="CASE id" close="END"> | |
| 186 | + WHEN #{item.id} THEN #{item.updateBy} | |
| 187 | + </foreach>, | |
| 188 | + update_time = NOW() | |
| 189 | + WHERE id IN | |
| 190 | + <foreach collection="specList" item="item" open="(" separator="," close=")"> | |
| 191 | + #{item.id} | |
| 192 | + </foreach> | |
| 193 | + </update> | |
| 83 | 194 | </mapper> | ... | ... |