Commit 0c26f571f67239387fbaecd6872e945f084b9f7a

Authored by 杨鸣坤
1 parent 7255d7dd

楚江ERP:补货单

Showing 24 changed files with 2017 additions and 2 deletions
@@ -249,4 +249,51 @@ create table `tbl_holidays` @@ -249,4 +249,51 @@ create table `tbl_holidays`
249 `update_by` varchar(20) not null comment '更新人', 249 `update_by` varchar(20) not null comment '更新人',
250 `create_time` datetime default now() comment '创建时间', 250 `create_time` datetime default now() comment '创建时间',
251 `update_time` datetime default now() comment '更新时间' 251 `update_time` datetime default now() comment '更新时间'
252 -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '节假日' ROW_FORMAT = DYNAMIC;  
  252 +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '节假日' ROW_FORMAT = DYNAMIC;
  253 +
  254 +-- 补货单
  255 +DROP TABLE IF EXISTS `tbl_replenishment_order`;
  256 +create table `tbl_replenishment_order`
  257 +(
  258 + `id` varchar(32) primary key comment 'ID',
  259 + `code` varchar(50) NOT NULL COMMENT '编号',
  260 + `workshop_id` varchar(32) comment '分厂',
  261 + `dept_id` varchar(32) comment '办事处',
  262 + `customer_id` varchar(32) comment '购货单位',
  263 + `origin_plan_ship_date` DATE COMMENT '原计划发货日期',
  264 + `purchase_order_id` varchar(32) COMMENT '订货单',
  265 + `status` varchar(20) comment '状态',
  266 + `create_by_id` varchar(32) not null comment '创建人ID',
  267 + `create_by` varchar(20) not null comment '创建人',
  268 + `update_by_id` varchar(32) not null comment '更新人ID',
  269 + `update_by` varchar(20) not null comment '更新人',
  270 + `create_time` datetime default now() comment '创建时间',
  271 + `update_time` datetime default now() comment '更新时间'
  272 +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '补货单' ROW_FORMAT = DYNAMIC;
  273 +
  274 +-- 补货单物料行
  275 +DROP TABLE IF EXISTS `tbl_replenishment_order_line`;
  276 +create table `tbl_replenishment_order_line`
  277 +(
  278 + `id` varchar(32) primary key comment 'ID',
  279 + `replenishment_order_id` varchar(32) NOT NULL COMMENT '补货单',
  280 + `purchase_order_line_id` varchar(32) NOT NULL COMMENT '订货单表物料行ID',
  281 + `brand` varchar(100) COMMENT '牌号',
  282 + `thickness` decimal(10, 4) COMMENT '厚度',
  283 + `width` decimal(10, 4) COMMENT '宽度',
  284 + `length` decimal(10, 4) COMMENT '长度',
  285 + `status` varchar(50) COMMENT '状态',
  286 + `quantity` decimal(15, 4) COMMENT '需发(t)',
  287 + `shipped_quantity` decimal(15, 4) COMMENT '实发(t)',
  288 + `supplementary_quantity` decimal(15, 4) COMMENT '需求补发(t/件)',
  289 + `confirmed_delivery_date` DATE COMMENT '生产科确认交付日期',
  290 + `remarks` TEXT COMMENT '备注',
  291 + `show_order` INT DEFAULT 0 COMMENT '排序',
  292 + `item_id` varchar(50) COMMENT '前端用ID',
  293 + `create_by_id` varchar(32) not null comment '创建人ID',
  294 + `create_by` varchar(20) not null comment '创建人',
  295 + `update_by_id` varchar(32) not null comment '更新人ID',
  296 + `update_by` varchar(20) not null comment '更新人',
  297 + `create_time` datetime default now() comment '创建时间',
  298 + `update_time` datetime default now() comment '更新时间'
  299 +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '补货单物料行' ROW_FORMAT = DYNAMIC;
  1 +package com.lframework.xingyun.sc.bo.purchase;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.common.constants.StringPool;
  5 +import com.lframework.starter.web.core.bo.BaseBo;
  6 +import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
  9 +
  10 +import java.time.LocalDate;
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * <p>
  15 + * 补货单 GetBo
  16 + * </p>
  17 + */
  18 +@Data
  19 +public class GetReplenishmentOrderBo extends BaseBo<ReplenishmentOrder> {
  20 +
  21 + /**
  22 + * ID
  23 + */
  24 + @ApiModelProperty("ID")
  25 + private String id;
  26 +
  27 + /**
  28 + * 编号
  29 + */
  30 + @ApiModelProperty("编号")
  31 + private String code;
  32 +
  33 + /**
  34 + * 分厂
  35 + */
  36 + @ApiModelProperty("分厂")
  37 + private String workshopId;
  38 +
  39 + /**
  40 + * 办事处
  41 + */
  42 + @ApiModelProperty("办事处")
  43 + private String deptId;
  44 +
  45 + /**
  46 + * 购货单位
  47 + */
  48 + @ApiModelProperty("购货单位")
  49 + private String customerId;
  50 +
  51 + /**
  52 + * 原计划发货日期
  53 + */
  54 + @ApiModelProperty("原计划发货日期")
  55 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  56 + private LocalDate originPlanShipDate;
  57 +
  58 + /**
  59 + * 订货单
  60 + */
  61 + @ApiModelProperty("订货单")
  62 + private String purchaseOrderId;
  63 +
  64 + /**
  65 + * 补货单物料行
  66 + */
  67 + @ApiModelProperty("补货单物料行")
  68 + private List<GetReplenishmentOrderLineBo> replenishmentOrderLineList;
  69 +
  70 + public GetReplenishmentOrderBo() {
  71 +
  72 + }
  73 +
  74 + public GetReplenishmentOrderBo(ReplenishmentOrder dto) {
  75 +
  76 + super(dto);
  77 + }
  78 +
  79 + @Override
  80 + public BaseBo<ReplenishmentOrder> convert(ReplenishmentOrder dto) {
  81 + return super.convert(dto);
  82 + }
  83 +
  84 + @Override
  85 + protected void afterInit(ReplenishmentOrder dto) {
  86 +
  87 + }
  88 +}
  1 +package com.lframework.xingyun.sc.bo.purchase;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.common.constants.StringPool;
  5 +import com.lframework.starter.web.core.bo.BaseBo;
  6 +import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalDate;
  12 +
  13 +/**
  14 + * <p>
  15 + * 补货单物料行 GetBo
  16 + * </p>
  17 + */
  18 +@Data
  19 +public class GetReplenishmentOrderLineBo extends BaseBo<ReplenishmentOrderLine> {
  20 +
  21 + /**
  22 + * ID
  23 + */
  24 + @ApiModelProperty("ID")
  25 + private String id;
  26 +
  27 + /**
  28 + * 补货单
  29 + */
  30 + @ApiModelProperty("补货单")
  31 + private String replenishmentOrderId;
  32 +
  33 + /**
  34 + * 订货单表物料行ID
  35 + */
  36 + @ApiModelProperty("订货单表物料行ID")
  37 + private String purchaseOrderLineId;
  38 +
  39 + /**
  40 + * 牌号
  41 + */
  42 + @ApiModelProperty("牌号")
  43 + private String brand;
  44 +
  45 + /**
  46 + * 厚度
  47 + */
  48 + @ApiModelProperty("厚度")
  49 + private BigDecimal thickness;
  50 +
  51 + /**
  52 + * 宽度
  53 + */
  54 + @ApiModelProperty("宽度")
  55 + private BigDecimal width;
  56 +
  57 + /**
  58 + * 长度
  59 + */
  60 + @ApiModelProperty("长度")
  61 + private BigDecimal length;
  62 +
  63 + /**
  64 + * 状态
  65 + */
  66 + @ApiModelProperty("状态")
  67 + private String status;
  68 +
  69 + /**
  70 + * 需发(t)
  71 + */
  72 + @ApiModelProperty("需发(t)")
  73 + private BigDecimal quantity;
  74 +
  75 + /**
  76 + * 实发(t)
  77 + */
  78 + @ApiModelProperty("实发(t)")
  79 + private BigDecimal shippedQuantity;
  80 +
  81 + /**
  82 + * 需求补发(t/件)
  83 + */
  84 + @ApiModelProperty("需求补发(t/件)")
  85 + private BigDecimal supplementaryQuantity;
  86 +
  87 + /**
  88 + * 生产科确认交付日期
  89 + */
  90 + @ApiModelProperty("生产科确认交付日期")
  91 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  92 + private LocalDate confirmedDeliveryDate;
  93 +
  94 + /**
  95 + * 备注
  96 + */
  97 + @ApiModelProperty("备注")
  98 + private String remarks;
  99 +
  100 + /**
  101 + * 排序
  102 + */
  103 + @ApiModelProperty("排序")
  104 + private Integer showOrder;
  105 +
  106 + public GetReplenishmentOrderLineBo() {
  107 +
  108 + }
  109 +
  110 + public GetReplenishmentOrderLineBo(ReplenishmentOrderLine dto) {
  111 +
  112 + super(dto);
  113 + }
  114 +
  115 + @Override
  116 + public BaseBo<ReplenishmentOrderLine> convert(ReplenishmentOrderLine dto) {
  117 + return super.convert(dto);
  118 + }
  119 +
  120 + @Override
  121 + protected void afterInit(ReplenishmentOrderLine dto) {
  122 +
  123 + }
  124 +}
  1 +package com.lframework.xingyun.sc.bo.purchase;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.common.constants.StringPool;
  5 +import com.lframework.starter.web.core.bo.BaseBo;
  6 +import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
  7 +import io.swagger.annotations.ApiModelProperty;
  8 +import lombok.Data;
  9 +
  10 +import java.time.LocalDate;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * <p>
  15 + * 补货单 QueryBo
  16 + * </p>
  17 + */
  18 +@Data
  19 +public class QueryReplenishmentOrderBo extends BaseBo<ReplenishmentOrder> {
  20 +
  21 + /**
  22 + * ID
  23 + */
  24 + @ApiModelProperty("ID")
  25 + private String id;
  26 +
  27 + /**
  28 + * 编号
  29 + */
  30 + @ApiModelProperty("编号")
  31 + private String code;
  32 +
  33 + /**
  34 + * 分厂
  35 + */
  36 + @ApiModelProperty("分厂")
  37 + private String workshopId;
  38 +
  39 + /**
  40 + * 办事处
  41 + */
  42 + @ApiModelProperty("办事处")
  43 + private String deptId;
  44 +
  45 + /**
  46 + * 购货单位
  47 + */
  48 + @ApiModelProperty("购货单位")
  49 + private String customerId;
  50 +
  51 + /**
  52 + * 原计划发货日期
  53 + */
  54 + @ApiModelProperty("原计划发货日期")
  55 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  56 + private LocalDate originPlanShipDate;
  57 +
  58 + /**
  59 + * 状态
  60 + */
  61 + @ApiModelProperty("状态")
  62 + private String status;
  63 +
  64 + /**
  65 + * 创建时间
  66 + */
  67 + @ApiModelProperty("创建时间")
  68 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  69 + private LocalDateTime createTime;
  70 +
  71 + public QueryReplenishmentOrderBo() {
  72 +
  73 + }
  74 +
  75 + public QueryReplenishmentOrderBo(ReplenishmentOrder dto) {
  76 +
  77 + super(dto);
  78 + }
  79 +
  80 + @Override
  81 + public BaseBo<ReplenishmentOrder> convert(ReplenishmentOrder dto) {
  82 + return super.convert(dto);
  83 + }
  84 +
  85 + @Override
  86 + protected void afterInit(ReplenishmentOrder dto) {
  87 +
  88 + }
  89 +}
  90 +
  1 +package com.lframework.xingyun.sc.bo.purchase;
  2 +
  3 +import com.lframework.starter.web.core.bo.BaseBo;
  4 +import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +
  8 +/**
  9 + * <p>
  10 + * 补货单物料行 QueryBo
  11 + * </p>
  12 + */
  13 +@Data
  14 +public class QueryReplenishmentOrderLineBo extends BaseBo<ReplenishmentOrderLine> {
  15 +
  16 + /**
  17 + * ID
  18 + */
  19 + @ApiModelProperty("ID")
  20 + private String id;
  21 +
  22 + /**
  23 + * 补货单
  24 + */
  25 + @ApiModelProperty("补货单")
  26 + private String replenishmentOrderId;
  27 +
  28 + public QueryReplenishmentOrderLineBo() {
  29 +
  30 + }
  31 +
  32 + public QueryReplenishmentOrderLineBo(ReplenishmentOrderLine dto) {
  33 +
  34 + super(dto);
  35 + }
  36 +
  37 + @Override
  38 + public BaseBo<ReplenishmentOrderLine> convert(ReplenishmentOrderLine dto) {
  39 + return super.convert(dto);
  40 + }
  41 +
  42 + @Override
  43 + protected void afterInit(ReplenishmentOrderLine dto) {
  44 +
  45 + }
  46 +}
  47 +
  1 +package com.lframework.xingyun.sc.controller.purchase;
  2 +
  3 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  4 +import com.lframework.starter.common.utils.CollectionUtil;
  5 +import com.lframework.starter.web.core.annotations.security.HasPermission;
  6 +import com.lframework.starter.web.core.components.resp.InvokeResult;
  7 +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
  8 +import com.lframework.starter.web.core.components.resp.PageResult;
  9 +import com.lframework.starter.web.core.controller.DefaultBaseController;
  10 +import com.lframework.starter.web.core.utils.PageResultUtil;
  11 +import com.lframework.xingyun.sc.bo.purchase.GetReplenishmentOrderBo;
  12 +import com.lframework.xingyun.sc.bo.purchase.QueryReplenishmentOrderBo;
  13 +import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
  14 +import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
  15 +import com.lframework.xingyun.sc.vo.purchase.CreateReplenishmentOrderVo;
  16 +import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderVo;
  17 +import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderVo;
  18 +import io.swagger.annotations.Api;
  19 +import io.swagger.annotations.ApiImplicitParam;
  20 +import io.swagger.annotations.ApiOperation;
  21 +import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.validation.annotation.Validated;
  23 +import org.springframework.web.bind.annotation.*;
  24 +
  25 +import javax.validation.Valid;
  26 +import javax.validation.constraints.NotBlank;
  27 +import java.util.List;
  28 +import java.util.stream.Collectors;
  29 +
  30 +/**
  31 + * 补货单 Controller
  32 + */
  33 +@Api(tags = "补货单")
  34 +@Validated
  35 +@RestController
  36 +@RequestMapping("/purchase/replenishmentorder")
  37 +public class ReplenishmentOrderController extends DefaultBaseController {
  38 +
  39 + @Autowired
  40 + private ReplenishmentOrderService replenishmentOrderService;
  41 +
  42 + /**
  43 + * 查询列表
  44 + */
  45 + @ApiOperation("查询列表")
  46 + @HasPermission({"entity:replenishmentorder:query"})
  47 + @GetMapping("/query")
  48 + public InvokeResult<PageResult<QueryReplenishmentOrderBo>> query(@Valid QueryReplenishmentOrderVo vo) {
  49 +
  50 + PageResult<ReplenishmentOrder> pageResult = replenishmentOrderService.query(getPageIndex(vo), getPageSize(vo), vo);
  51 +
  52 + List<ReplenishmentOrder> datas = pageResult.getDatas();
  53 + List<QueryReplenishmentOrderBo> results = null;
  54 +
  55 + if (!CollectionUtil.isEmpty(datas)) {
  56 + results = datas.stream().map(QueryReplenishmentOrderBo::new).collect(Collectors.toList());
  57 + }
  58 +
  59 + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
  60 + }
  61 +
  62 + /**
  63 + * 根据ID查询
  64 + */
  65 + @ApiOperation("根据ID查询")
  66 + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
  67 + @HasPermission({"entity:replenishmentorder:query"})
  68 + @GetMapping
  69 + public InvokeResult<GetReplenishmentOrderBo> get(@NotBlank(message = "id不能为空!") String id) {
  70 +
  71 + ReplenishmentOrder data = replenishmentOrderService.findById(id);
  72 + if (data == null) {
  73 + throw new DefaultClientException("补货单不存在!");
  74 + }
  75 +
  76 + GetReplenishmentOrderBo result = new GetReplenishmentOrderBo(data);
  77 +
  78 + return InvokeResultBuilder.success(result);
  79 + }
  80 +
  81 + /**
  82 + * 新增
  83 + */
  84 + @ApiOperation("新增")
  85 + @HasPermission({"entity:replenishmentorder:add"})
  86 + @PostMapping
  87 + public InvokeResult<Void> create(@Valid @RequestBody CreateReplenishmentOrderVo vo) {
  88 +
  89 + replenishmentOrderService.create(vo);
  90 +
  91 + return InvokeResultBuilder.success();
  92 + }
  93 +
  94 + /**
  95 + * 修改
  96 + */
  97 + @ApiOperation("修改")
  98 + @HasPermission({"entity:replenishmentorder:modify"})
  99 + @PutMapping
  100 + public InvokeResult<Void> update(@Valid @RequestBody UpdateReplenishmentOrderVo vo) {
  101 +
  102 + replenishmentOrderService.update(vo);
  103 +
  104 + replenishmentOrderService.cleanCacheByKey(vo.getId());
  105 +
  106 + return InvokeResultBuilder.success();
  107 + }
  108 +
  109 + /**
  110 + * 取消
  111 + */
  112 + @ApiOperation("取消")
  113 + @GetMapping("/cancel")
  114 + public InvokeResult<Void> cancel(@NotBlank(message = "id不能为空!") String id) {
  115 +
  116 + replenishmentOrderService.cancel(id);
  117 +
  118 + replenishmentOrderService.cleanCacheByKey(id);
  119 +
  120 + return InvokeResultBuilder.success();
  121 + }
  122 +
  123 + /**
  124 + * 填写补货时间
  125 + */
  126 + @ApiOperation("填写补货时间")
  127 + @PostMapping("/fillRestockTime")
  128 + public InvokeResult<Void> fillRestockTime(@RequestBody UpdateReplenishmentOrderVo vo) {
  129 +
  130 + replenishmentOrderService.fillRestockTime(vo);
  131 +
  132 + replenishmentOrderService.cleanCacheByKey(vo.getId());
  133 +
  134 + return InvokeResultBuilder.success();
  135 + }
  136 +}
  1 +package com.lframework.xingyun.sc.entity;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.FieldFill;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import com.lframework.starter.web.core.dto.BaseDto;
  7 +import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import lombok.Data;
  9 +
  10 +import java.time.LocalDate;
  11 +import java.time.LocalDateTime;
  12 +
  13 +/**
  14 + * <p>
  15 + * 补货单
  16 + * </p>
  17 + */
  18 +@Data
  19 +@TableName("tbl_replenishment_order")
  20 +public class ReplenishmentOrder extends BaseEntity implements BaseDto {
  21 +
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + public static final String CACHE_NAME = "ReplenishmentOrder";
  25 +
  26 + /**
  27 + * ID
  28 + */
  29 + private String id;
  30 +
  31 + /**
  32 + * 编号
  33 + */
  34 + private String code;
  35 +
  36 + /**
  37 + * 分厂
  38 + */
  39 + private String workshopId;
  40 +
  41 + /**
  42 + * 办事处
  43 + */
  44 + private String deptId;
  45 +
  46 + /**
  47 + * 购货单位
  48 + */
  49 + private String customerId;
  50 +
  51 + /**
  52 + * 原计划发货日期
  53 + */
  54 + private LocalDate originPlanShipDate;
  55 +
  56 + /**
  57 + * 订货单
  58 + */
  59 + private String purchaseOrderId;
  60 +
  61 + /**
  62 + * 状态
  63 + */
  64 + private String status;
  65 +
  66 + /**
  67 + * 创建人ID
  68 + */
  69 + @TableField(fill = FieldFill.INSERT)
  70 + private String createById;
  71 +
  72 + /**
  73 + * 创建人
  74 + */
  75 + @TableField(fill = FieldFill.INSERT)
  76 + private String createBy;
  77 +
  78 + /**
  79 + * 更新人ID
  80 + */
  81 + @TableField(fill = FieldFill.INSERT_UPDATE)
  82 + private String updateById;
  83 +
  84 + /**
  85 + * 更新人
  86 + */
  87 + @TableField(fill = FieldFill.INSERT_UPDATE)
  88 + private String updateBy;
  89 +
  90 + /**
  91 + * 创建时间
  92 + */
  93 + @TableField(fill = FieldFill.INSERT)
  94 + private LocalDateTime createTime;
  95 +
  96 + /**
  97 + * 更新时间
  98 + */
  99 + @TableField(fill = FieldFill.INSERT_UPDATE)
  100 + private LocalDateTime updateTime;
  101 +
  102 + /**
  103 + * 是否展示正式合同审核按钮(非持久化字段)
  104 + */
  105 + @TableField(exist = false)
  106 + private Boolean showExamine;
  107 +}
  1 +package com.lframework.xingyun.sc.entity;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.FieldFill;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import com.lframework.starter.web.core.dto.BaseDto;
  7 +import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import lombok.Data;
  9 +
  10 +import java.math.BigDecimal;
  11 +import java.time.LocalDate;
  12 +import java.time.LocalDateTime;
  13 +
  14 +/**
  15 + * <p>
  16 + * 补货单物料行
  17 + * </p>
  18 + */
  19 +@Data
  20 +@TableName("tbl_replenishment_order_line")
  21 +public class ReplenishmentOrderLine extends BaseEntity implements BaseDto {
  22 +
  23 + private static final long serialVersionUID = 1L;
  24 +
  25 + public static final String CACHE_NAME = "ReplenishmentOrderLine";
  26 +
  27 + /**
  28 + * ID
  29 + */
  30 + private String id;
  31 +
  32 + /**
  33 + * 补货单
  34 + */
  35 + private String replenishmentOrderId;
  36 +
  37 + /**
  38 + * 订货单表物料行ID
  39 + */
  40 + private String purchaseOrderLineId;
  41 +
  42 + /**
  43 + * 牌号
  44 + */
  45 + private String brand;
  46 +
  47 + /**
  48 + * 厚度
  49 + */
  50 + private BigDecimal thickness;
  51 +
  52 + /**
  53 + * 宽度
  54 + */
  55 + private BigDecimal width;
  56 +
  57 + /**
  58 + * 长度
  59 + */
  60 + private BigDecimal length;
  61 +
  62 + /**
  63 + * 状态
  64 + */
  65 + private String status;
  66 +
  67 + /**
  68 + * 需发(t)
  69 + */
  70 + private BigDecimal quantity;
  71 +
  72 + /**
  73 + * 实发(t)
  74 + */
  75 + private BigDecimal shippedQuantity;
  76 +
  77 + /**
  78 + * 需求补发(t/件)
  79 + */
  80 + private BigDecimal supplementaryQuantity;
  81 +
  82 + /**
  83 + * 生产科确认交付日期
  84 + */
  85 + private LocalDate confirmedDeliveryDate;
  86 +
  87 + /**
  88 + * 备注
  89 + */
  90 + private String remarks;
  91 +
  92 + /**
  93 + * 排序
  94 + */
  95 + private Integer showOrder;
  96 +
  97 + /**
  98 + * 前端用ID
  99 + */
  100 + private String itemId;
  101 +
  102 + /**
  103 + * 创建人ID
  104 + */
  105 + @TableField(fill = FieldFill.INSERT)
  106 + private String createById;
  107 +
  108 + /**
  109 + * 创建人
  110 + */
  111 + @TableField(fill = FieldFill.INSERT)
  112 + private String createBy;
  113 +
  114 + /**
  115 + * 更新人ID
  116 + */
  117 + @TableField(fill = FieldFill.INSERT_UPDATE)
  118 + private String updateById;
  119 +
  120 + /**
  121 + * 更新人
  122 + */
  123 + @TableField(fill = FieldFill.INSERT_UPDATE)
  124 + private String updateBy;
  125 +
  126 + /**
  127 + * 创建时间
  128 + */
  129 + @TableField(fill = FieldFill.INSERT)
  130 + private LocalDateTime createTime;
  131 +
  132 + /**
  133 + * 更新时间
  134 + */
  135 + @TableField(fill = FieldFill.INSERT_UPDATE)
  136 + private LocalDateTime updateTime;
  137 +
  138 +}
@@ -18,6 +18,8 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService; @@ -18,6 +18,8 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditHistoryService;
18 import com.lframework.xingyun.sc.service.customer.CustomerCreditService; 18 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
19 import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; 19 import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService;
20 import com.lframework.xingyun.sc.service.order.*; 20 import com.lframework.xingyun.sc.service.order.*;
  21 +import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
  22 +import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService;
21 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService; 23 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService;
22 import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo; 24 import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo;
23 import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo; 25 import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo;
@@ -73,6 +75,10 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -73,6 +75,10 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
73 private SpecLockDelayApplicationService specLockDelayApplicationService; 75 private SpecLockDelayApplicationService specLockDelayApplicationService;
74 @Resource 76 @Resource
75 private DraftRequestCarTicketService draftRequestCarTicketService; 77 private DraftRequestCarTicketService draftRequestCarTicketService;
  78 + @Resource
  79 + private RequestCarTicketService requestCarTicketService;
  80 + @Resource
  81 + private ReplenishmentOrderService replenishmentOrderService;
76 82
77 83
78 /** 84 /**
@@ -131,6 +137,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -131,6 +137,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
131 case "DRAFT_REQUEST_CAR": 137 case "DRAFT_REQUEST_CAR":
132 handleDraftRequestCarTicketData(flowStatus, businessId); 138 handleDraftRequestCarTicketData(flowStatus, businessId);
133 break; 139 break;
  140 + case "RESTOCK_APPROVAL":
  141 + handleReplenishmentOrderStatus(flowStatus, businessId);
  142 + break;
134 default: 143 default:
135 break; 144 break;
136 } 145 }
@@ -163,7 +172,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -163,7 +172,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
163 } 172 }
164 } 173 }
165 174
166 - private void handleSpecLockDelayAuditData(String flowStatus, String businessId) { 175 + private void handleReplenishmentOrderStatus(String flowStatus, String businessId) {
167 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) 176 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
168 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { 177 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
169 specLockDelayApplicationService.updateAuditStatus(businessId, "PASS"); 178 specLockDelayApplicationService.updateAuditStatus(businessId, "PASS");
@@ -176,6 +185,19 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -176,6 +185,19 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
176 } 185 }
177 } 186 }
178 187
  188 + private void handleSpecLockDelayAuditData(String flowStatus, String businessId) {
  189 + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
  190 + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
  191 + replenishmentOrderService.updateStatus(businessId, "PASS");
  192 + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
  193 + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)
  194 + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) {
  195 + replenishmentOrderService.updateStatus(businessId, "REFUSE");
  196 + } else if (FlowInstanceStatus.UNDO.getCode().equals(flowStatus)) {
  197 + replenishmentOrderService.updateStatus(businessId, "REFUSE");
  198 + }
  199 + }
  200 +
179 /** 201 /**
180 * 客户开发业务数据处理 202 * 客户开发业务数据处理
181 * 203 *
@@ -8,8 +8,10 @@ import com.lframework.starter.web.core.utils.JsonUtil; @@ -8,8 +8,10 @@ import com.lframework.starter.web.core.utils.JsonUtil;
8 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; 8 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
9 import com.lframework.xingyun.sc.service.customer.CustomerCreditService; 9 import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
10 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; 10 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
  11 +import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
11 import com.lframework.xingyun.sc.vo.customer.credit.*; 12 import com.lframework.xingyun.sc.vo.customer.credit.*;
12 import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderInfoVo; 13 import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderInfoVo;
  14 +import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderVo;
13 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
14 import org.springframework.transaction.annotation.Transactional; 16 import org.springframework.transaction.annotation.Transactional;
15 17
@@ -23,6 +25,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { @@ -23,6 +25,8 @@ public class FlowTaskServiceImpl implements FlowTaskService {
23 private CustomerCreditService customerCreditService; 25 private CustomerCreditService customerCreditService;
24 @Resource 26 @Resource
25 private PurchaseOrderInfoService purchaseOrderInfoService; 27 private PurchaseOrderInfoService purchaseOrderInfoService;
  28 + @Resource
  29 + private ReplenishmentOrderService replenishmentOrderService;
26 30
27 31
28 @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) 32 @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"})
@@ -59,4 +63,20 @@ public class FlowTaskServiceImpl implements FlowTaskService { @@ -59,4 +63,20 @@ public class FlowTaskServiceImpl implements FlowTaskService {
59 e.printStackTrace(); 63 e.printStackTrace();
60 } 64 }
61 } 65 }
  66 +
  67 + @OpLog(type = OtherOpLogType.class, name = "修改补货单,ID:{}", params = {"#id"})
  68 + @Transactional(rollbackFor = Exception.class)
  69 + @Override
  70 + public void updateReplenishmentOrderByMap(Map<String, Object> map) {
  71 + try {
  72 + // 创建 ObjectMapper 实例
  73 + ObjectMapper objectMapper = new ObjectMapper();
  74 + //先将 Map 序列化为 JSON 字符串,再反序列化为目标对象
  75 + String json = objectMapper.writeValueAsString(map);
  76 + UpdateReplenishmentOrderVo updateReplenishmentOrderVo = JsonUtil.parseObject(json, UpdateReplenishmentOrderVo.class);
  77 + replenishmentOrderService.updateFlowInstance(updateReplenishmentOrderVo);
  78 + } catch (JsonProcessingException e) {
  79 + e.printStackTrace();
  80 + }
  81 + }
62 } 82 }
  1 +package com.lframework.xingyun.sc.impl.purchase;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.github.pagehelper.PageInfo;
  6 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  7 +import com.lframework.starter.common.utils.Assert;
  8 +import com.lframework.starter.common.utils.ObjectUtil;
  9 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  10 +import com.lframework.starter.web.core.components.resp.PageResult;
  11 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  12 +import com.lframework.starter.web.core.utils.IdUtil;
  13 +import com.lframework.starter.web.core.utils.OpLogUtil;
  14 +import com.lframework.starter.web.core.utils.PageHelperUtil;
  15 +import com.lframework.starter.web.core.utils.PageResultUtil;
  16 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  17 +import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
  18 +import com.lframework.xingyun.sc.mappers.ReplenishmentOrderLineMapper;
  19 +import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderLineService;
  20 +import com.lframework.xingyun.sc.vo.purchase.CreateReplenishmentOrderLineVo;
  21 +import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderLineVo;
  22 +import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderLineVo;
  23 +import org.springframework.cache.annotation.CacheEvict;
  24 +import org.springframework.cache.annotation.Cacheable;
  25 +import org.springframework.stereotype.Service;
  26 +import org.springframework.transaction.annotation.Transactional;
  27 +
  28 +import java.io.Serializable;
  29 +import java.util.List;
  30 +
  31 +@Service
  32 +public class ReplenishmentOrderLineServiceImpl extends BaseMpServiceImpl<ReplenishmentOrderLineMapper, ReplenishmentOrderLine> implements ReplenishmentOrderLineService {
  33 +
  34 + @Override
  35 + public PageResult<ReplenishmentOrderLine> query(Integer pageIndex, Integer pageSize, QueryReplenishmentOrderLineVo vo) {
  36 +
  37 + Assert.greaterThanZero(pageIndex);
  38 + Assert.greaterThanZero(pageSize);
  39 +
  40 + PageHelperUtil.startPage(pageIndex, pageSize);
  41 + List<ReplenishmentOrderLine> datas = this.query(vo);
  42 +
  43 + return PageResultUtil.convert(new PageInfo<>(datas));
  44 + }
  45 +
  46 + @Override
  47 + public List<ReplenishmentOrderLine> query(QueryReplenishmentOrderLineVo vo) {
  48 +
  49 + return getBaseMapper().query(vo);
  50 + }
  51 +
  52 + @Cacheable(value = ReplenishmentOrderLine.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null")
  53 + @Override
  54 + public ReplenishmentOrderLine findById(String id) {
  55 +
  56 + return getBaseMapper().selectById(id);
  57 + }
  58 +
  59 + @OpLog(type = OtherOpLogType.class, name = "新增补货单物料行,ID:{}", params = {"#id"})
  60 + @Transactional(rollbackFor = Exception.class)
  61 + @Override
  62 + public String create(CreateReplenishmentOrderLineVo vo) {
  63 +
  64 + ReplenishmentOrderLine data = new ReplenishmentOrderLine();
  65 + data.setId(IdUtil.getUUID());
  66 + data.setReplenishmentOrderId(vo.getReplenishmentOrderId());
  67 + data.setPurchaseOrderLineId(vo.getPurchaseOrderLineId());
  68 + data.setBrand(vo.getBrand());
  69 + data.setThickness(vo.getThickness());
  70 + data.setWidth(vo.getWidth());
  71 + data.setLength(vo.getLength());
  72 + data.setStatus(vo.getStatus());
  73 + data.setQuantity(vo.getQuantity());
  74 + data.setShippedQuantity(vo.getShippedQuantity());
  75 + data.setSupplementaryQuantity(vo.getSupplementaryQuantity());
  76 + data.setConfirmedDeliveryDate(vo.getConfirmedDeliveryDate());
  77 + data.setRemarks(vo.getRemarks());
  78 + data.setShowOrder(vo.getShowOrder());
  79 + data.setItemId(vo.getItemId());
  80 +
  81 + getBaseMapper().insert(data);
  82 +
  83 + OpLogUtil.setVariable("id", data.getId());
  84 + OpLogUtil.setExtra(vo);
  85 +
  86 + return data.getId();
  87 + }
  88 +
  89 + @OpLog(type = OtherOpLogType.class, name = "修改补货单物料行,ID:{}", params = {"#id"})
  90 + @Transactional(rollbackFor = Exception.class)
  91 + @Override
  92 + public void update(UpdateReplenishmentOrderLineVo vo) {
  93 +
  94 + ReplenishmentOrderLine data = getBaseMapper().selectById(vo.getId());
  95 + if (ObjectUtil.isNull(data)) {
  96 + throw new DefaultClientException("补货单物料行不存在!");
  97 + }
  98 +
  99 + LambdaUpdateWrapper<ReplenishmentOrderLine> updateWrapper = Wrappers.lambdaUpdate(ReplenishmentOrderLine.class)
  100 + .set(ReplenishmentOrderLine::getReplenishmentOrderId, vo.getReplenishmentOrderId())
  101 + .set(ReplenishmentOrderLine::getPurchaseOrderLineId, vo.getPurchaseOrderLineId())
  102 + .set(ReplenishmentOrderLine::getBrand, vo.getBrand())
  103 + .set(ReplenishmentOrderLine::getThickness, vo.getThickness())
  104 + .set(ReplenishmentOrderLine::getWidth, vo.getWidth())
  105 + .set(ReplenishmentOrderLine::getLength, vo.getLength())
  106 + .set(ReplenishmentOrderLine::getStatus, vo.getStatus())
  107 + .set(ReplenishmentOrderLine::getQuantity, vo.getQuantity())
  108 + .set(ReplenishmentOrderLine::getShippedQuantity, vo.getShippedQuantity())
  109 + .set(ReplenishmentOrderLine::getSupplementaryQuantity, vo.getSupplementaryQuantity())
  110 + .set(ReplenishmentOrderLine::getConfirmedDeliveryDate, vo.getConfirmedDeliveryDate())
  111 + .set(ReplenishmentOrderLine::getRemarks, vo.getRemarks())
  112 + .set(ReplenishmentOrderLine::getShowOrder, vo.getShowOrder())
  113 + .set(ReplenishmentOrderLine::getItemId, vo.getItemId())
  114 + .eq(ReplenishmentOrderLine::getId, vo.getId());
  115 +
  116 + getBaseMapper().update(updateWrapper);
  117 +
  118 + OpLogUtil.setVariable("id", data.getId());
  119 + OpLogUtil.setExtra(vo);
  120 + }
  121 +
  122 + @CacheEvict(value = ReplenishmentOrderLine.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
  123 + @Override
  124 + public void cleanCacheByKey(Serializable key) {
  125 +
  126 + }
  127 +}
  1 +package com.lframework.xingyun.sc.impl.purchase;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.Wrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  5 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  6 +import com.github.pagehelper.PageInfo;
  7 +import com.lframework.starter.bpm.dto.FlowTaskDto;
  8 +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
  9 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  10 +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
  11 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  12 +import com.lframework.starter.common.utils.Assert;
  13 +import com.lframework.starter.common.utils.ObjectUtil;
  14 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  15 +import com.lframework.starter.web.core.components.resp.PageResult;
  16 +import com.lframework.starter.web.core.components.security.SecurityUtil;
  17 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  18 +import com.lframework.starter.web.core.utils.IdUtil;
  19 +import com.lframework.starter.web.core.utils.OpLogUtil;
  20 +import com.lframework.starter.web.core.utils.PageHelperUtil;
  21 +import com.lframework.starter.web.core.utils.PageResultUtil;
  22 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  23 +import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
  24 +import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
  25 +import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
  26 +import com.lframework.xingyun.sc.mappers.ReplenishmentOrderMapper;
  27 +import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderLineService;
  28 +import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
  29 +import com.lframework.xingyun.sc.vo.purchase.*;
  30 +import org.apache.commons.collections4.CollectionUtils;
  31 +import org.apache.commons.lang3.StringUtils;
  32 +import org.springframework.cache.annotation.CacheEvict;
  33 +import org.springframework.cache.annotation.Cacheable;
  34 +import org.springframework.stereotype.Service;
  35 +import org.springframework.transaction.annotation.Transactional;
  36 +
  37 +import javax.annotation.Resource;
  38 +import java.io.Serializable;
  39 +import java.util.ArrayList;
  40 +import java.util.List;
  41 +import java.util.stream.Collectors;
  42 +
  43 +@Service
  44 +public class ReplenishmentOrderServiceImpl extends BaseMpServiceImpl<ReplenishmentOrderMapper, ReplenishmentOrder> implements ReplenishmentOrderService {
  45 +
  46 + private static final String RESTOCK_APPROVAL_FLAG = "RESTOCK_APPROVAL"; // 补货单审批
  47 +
  48 + @Resource
  49 + private ReplenishmentOrderLineService replenishmentOrderLineService;
  50 + @Resource
  51 + private FlowInstanceWrapperService flowInstanceWrapperService;
  52 + @Resource
  53 + private FlowTaskWrapperMapper flowTaskWrapperMapper;
  54 +
  55 + @Override
  56 + public PageResult<ReplenishmentOrder> query(Integer pageIndex, Integer pageSize, QueryReplenishmentOrderVo vo) {
  57 +
  58 + Assert.greaterThanZero(pageIndex);
  59 + Assert.greaterThanZero(pageSize);
  60 +
  61 + PageHelperUtil.startPage(pageIndex, pageSize);
  62 + List<ReplenishmentOrder> datas = this.query(vo);
  63 + if (CollectionUtils.isNotEmpty(datas)) {
  64 + // 获取当前人员的待办任务数据
  65 + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
  66 + if (CollectionUtils.isNotEmpty(flowTaskList)) {
  67 + List<String> businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
  68 + datas.forEach(replenishmentOrder -> {
  69 + replenishmentOrder.setShowExamine(businessIds.contains(replenishmentOrder.getId()));
  70 + });
  71 + }
  72 + }
  73 +
  74 + return PageResultUtil.convert(new PageInfo<>(datas));
  75 + }
  76 +
  77 + @Override
  78 + public List<ReplenishmentOrder> query(QueryReplenishmentOrderVo vo) {
  79 +
  80 + return getBaseMapper().query(vo);
  81 + }
  82 +
  83 + @Cacheable(value = ReplenishmentOrder.CACHE_NAME, key = "@cacheVariables.tenantId() + #id", unless = "#result == null")
  84 + @Override
  85 + public ReplenishmentOrder findById(String id) {
  86 +
  87 + return getBaseMapper().selectById(id);
  88 + }
  89 +
  90 + @OpLog(type = OtherOpLogType.class, name = "新增补货单,ID:{}", params = {"#id"})
  91 + @Transactional(rollbackFor = Exception.class)
  92 + @Override
  93 + public String create(CreateReplenishmentOrderVo vo) {
  94 +
  95 + if (vo == null || CollectionUtils.isEmpty(vo.getReplenishmentOrderLineList())) {
  96 + throw new DefaultClientException("参数错误!");
  97 + }
  98 +
  99 +
  100 + ReplenishmentOrder data = new ReplenishmentOrder();
  101 + data.setId(IdUtil.getUUID());
  102 + data.setCode(vo.getCode());
  103 + data.setWorkshopId(vo.getWorkshopId());
  104 + data.setDeptId(vo.getDeptId());
  105 + data.setCustomerId(vo.getCustomerId());
  106 + data.setOriginPlanShipDate(vo.getOriginPlanShipDate());
  107 + data.setPurchaseOrderId(vo.getPurchaseOrderId());
  108 + data.setStatus("AUDIT");
  109 +
  110 + getBaseMapper().insert(data);
  111 +
  112 + for (int index = 0; index < vo.getReplenishmentOrderLineList().size(); index++) {
  113 + CreateReplenishmentOrderLineVo lineVo = vo.getReplenishmentOrderLineList().get(index);
  114 + lineVo.setShowOrder(index);
  115 + lineVo.setReplenishmentOrderId(data.getId());
  116 + replenishmentOrderLineService.create(lineVo);
  117 + }
  118 +
  119 + OpLogUtil.setVariable("id", data.getId());
  120 + OpLogUtil.setExtra(vo);
  121 +
  122 + // 开启审核
  123 + flowInstanceWrapperService.startInstance(RESTOCK_APPROVAL_FLAG, data.getId(), RESTOCK_APPROVAL_FLAG, data);
  124 +
  125 + return data.getId();
  126 + }
  127 +
  128 + @OpLog(type = OtherOpLogType.class, name = "修改补货单,ID:{}", params = {"#id"})
  129 + @Transactional(rollbackFor = Exception.class)
  130 + @Override
  131 + public void update(UpdateReplenishmentOrderVo vo) {
  132 +
  133 + ReplenishmentOrder data = getBaseMapper().selectById(vo.getId());
  134 + if (ObjectUtil.isNull(data)) {
  135 + throw new DefaultClientException("补货单不存在!");
  136 + }
  137 +
  138 + if (!CustomerDevelopStatus.REFUSE.name().equals(data.getStatus())) {
  139 + throw new DefaultClientException(CustomerDevelopStatus.getDescByNameSafe(data.getStatus()) + "的补货单不允许修改!");
  140 + }
  141 +
  142 + LambdaUpdateWrapper<ReplenishmentOrder> updateWrapper = Wrappers.lambdaUpdate(ReplenishmentOrder.class)
  143 + .set(ReplenishmentOrder::getCode, vo.getCode())
  144 + .set(ReplenishmentOrder::getWorkshopId, vo.getWorkshopId())
  145 + .set(ReplenishmentOrder::getDeptId, vo.getDeptId())
  146 + .set(ReplenishmentOrder::getCustomerId, vo.getCustomerId())
  147 + .set(ReplenishmentOrder::getOriginPlanShipDate, vo.getOriginPlanShipDate())
  148 + .set(ReplenishmentOrder::getPurchaseOrderId, vo.getPurchaseOrderId())
  149 + .eq(ReplenishmentOrder::getId, vo.getId());
  150 +
  151 + getBaseMapper().update(updateWrapper);
  152 +
  153 + Wrapper<ReplenishmentOrderLine> lineWrapper = Wrappers.lambdaQuery(ReplenishmentOrderLine.class)
  154 + .eq(ReplenishmentOrderLine::getReplenishmentOrderId, data.getId());
  155 + List<ReplenishmentOrderLine> oldReplenishmentOrderLineList = replenishmentOrderLineService.list(lineWrapper);
  156 + List<String> oldLineIdList = CollectionUtils.emptyIfNull(oldReplenishmentOrderLineList)
  157 + .stream()
  158 + .map(ReplenishmentOrderLine::getId).collect(Collectors.toList());
  159 + List<String> existIdList = new ArrayList<>(oldLineIdList.size());
  160 + for (int index = 0; index < vo.getReplenishmentOrderLineList().size(); index++) {
  161 + UpdateReplenishmentOrderLineVo updateReplenishmentOrderLineVo = vo.getReplenishmentOrderLineList().get(index);
  162 + updateReplenishmentOrderLineVo.setShowOrder(index);
  163 + if (StringUtils.isNotBlank(updateReplenishmentOrderLineVo.getId())) {
  164 + existIdList.add(updateReplenishmentOrderLineVo.getId());
  165 + replenishmentOrderLineService.update(updateReplenishmentOrderLineVo);
  166 + } else {
  167 + updateReplenishmentOrderLineVo.setReplenishmentOrderId(data.getId());
  168 + CreateReplenishmentOrderLineVo createReplenishmentOrderLineVo = new CreateReplenishmentOrderLineVo();
  169 + createReplenishmentOrderLineVo.setReplenishmentOrderId(updateReplenishmentOrderLineVo.getReplenishmentOrderId());
  170 + createReplenishmentOrderLineVo.setPurchaseOrderLineId(updateReplenishmentOrderLineVo.getPurchaseOrderLineId());
  171 + createReplenishmentOrderLineVo.setBrand(updateReplenishmentOrderLineVo.getBrand());
  172 + createReplenishmentOrderLineVo.setThickness(updateReplenishmentOrderLineVo.getThickness());
  173 + createReplenishmentOrderLineVo.setWidth(updateReplenishmentOrderLineVo.getWidth());
  174 + createReplenishmentOrderLineVo.setLength(updateReplenishmentOrderLineVo.getLength());
  175 + createReplenishmentOrderLineVo.setStatus(updateReplenishmentOrderLineVo.getStatus());
  176 + createReplenishmentOrderLineVo.setQuantity(updateReplenishmentOrderLineVo.getQuantity());
  177 + createReplenishmentOrderLineVo.setShippedQuantity(updateReplenishmentOrderLineVo.getShippedQuantity());
  178 + createReplenishmentOrderLineVo.setSupplementaryQuantity(updateReplenishmentOrderLineVo.getSupplementaryQuantity());
  179 + createReplenishmentOrderLineVo.setRemarks(updateReplenishmentOrderLineVo.getRemarks());
  180 + createReplenishmentOrderLineVo.setItemId(updateReplenishmentOrderLineVo.getItemId());
  181 + createReplenishmentOrderLineVo.setShowOrder(updateReplenishmentOrderLineVo.getShowOrder());
  182 + replenishmentOrderLineService.create(createReplenishmentOrderLineVo);
  183 + }
  184 + }
  185 +
  186 + List<String> needDeleteLineIdList = oldLineIdList.stream()
  187 + .filter(oldLineId -> !existIdList.contains(oldLineId))
  188 + .collect(Collectors.toList());
  189 + if (CollectionUtils.isNotEmpty(needDeleteLineIdList)) {
  190 + replenishmentOrderLineService.removeByIds(needDeleteLineIdList);
  191 + }
  192 +
  193 + OpLogUtil.setVariable("id", data.getId());
  194 + OpLogUtil.setExtra(vo);
  195 +
  196 + // 开启审核
  197 + flowInstanceWrapperService.startInstance(RESTOCK_APPROVAL_FLAG, data.getId(), RESTOCK_APPROVAL_FLAG, data);
  198 + }
  199 +
  200 + @OpLog(type = OtherOpLogType.class, name = "取消补货单,ID:{}", params = {"#id"})
  201 + @Transactional(rollbackFor = Exception.class)
  202 + @Override
  203 + public void cancel(String id) {
  204 + ReplenishmentOrder data = getBaseMapper().selectById(id);
  205 + if (ObjectUtil.isNull(data)) {
  206 + throw new DefaultClientException("补货单不存在!");
  207 + }
  208 +
  209 + if (CustomerDevelopStatus.CANCEL.name().equals(data.getStatus())) {
  210 + throw new DefaultClientException("补货单已取消!");
  211 + }
  212 +
  213 + if (!CustomerDevelopStatus.REFUSE.name().equals(data.getStatus())) {
  214 + throw new DefaultClientException(CustomerDevelopStatus.getDescByNameSafe(data.getStatus()) + "的补货单不允许取消!");
  215 + }
  216 +
  217 + Wrapper<ReplenishmentOrder> wrapper = Wrappers.lambdaUpdate(ReplenishmentOrder.class)
  218 + .set(ReplenishmentOrder::getStatus, CustomerDevelopStatus.CANCEL.name())
  219 + .eq(ReplenishmentOrder::getId, id);
  220 +
  221 + getBaseMapper().update(wrapper);
  222 +
  223 + OpLogUtil.setVariable("id", id);
  224 + OpLogUtil.setExtra(data);
  225 + }
  226 +
  227 + @OpLog(type = OtherOpLogType.class, name = "补货单填写补货时间,ID:{}", params = {"#id"})
  228 + @Transactional(rollbackFor = Exception.class)
  229 + @Override
  230 + public void fillRestockTime(UpdateReplenishmentOrderVo vo) {
  231 +
  232 + ReplenishmentOrder data = getBaseMapper().selectById(vo.getId());
  233 + if (ObjectUtil.isNull(data)) {
  234 + throw new DefaultClientException("补货单不存在!");
  235 + }
  236 +
  237 + if (!CustomerDevelopStatus.PASS.name().equals(data.getStatus())) {
  238 + throw new DefaultClientException("只有审核通过的补货单才能填写补货时间");
  239 + }
  240 +
  241 + vo.getReplenishmentOrderLineList().forEach(updateReplenishmentOrderLineVo -> {
  242 + Wrapper<ReplenishmentOrderLine> updateWrapper = Wrappers.lambdaUpdate(ReplenishmentOrderLine.class)
  243 + .set(ReplenishmentOrderLine::getConfirmedDeliveryDate, updateReplenishmentOrderLineVo.getConfirmedDeliveryDate())
  244 + .eq(ReplenishmentOrderLine::getId, updateReplenishmentOrderLineVo.getId());
  245 +
  246 + replenishmentOrderLineService.update(updateWrapper);
  247 + });
  248 +
  249 + OpLogUtil.setVariable("id", vo.getId());
  250 + OpLogUtil.setExtra(data);
  251 + }
  252 +
  253 + @Override
  254 + @OpLog(type = OtherOpLogType.class, name = "补货单审批完成,ID:{}, 审批状态:{}", params = {"#id", "#status"})
  255 + @Transactional(rollbackFor = Exception.class)
  256 + public void updateStatus(String id, String status) {
  257 + if (StringUtils.isBlank(id) || StringUtils.isBlank(status)) {
  258 + return;
  259 + }
  260 +
  261 + Wrapper<ReplenishmentOrder> wrapper = Wrappers.lambdaUpdate(ReplenishmentOrder.class)
  262 + .set(ReplenishmentOrder::getStatus, status)
  263 + .eq(ReplenishmentOrder::getId, id);
  264 +
  265 + getBaseMapper().update(wrapper);
  266 +
  267 + UpdateReplenishmentOrderVo vo = new UpdateReplenishmentOrderVo();
  268 + vo.setId(id);
  269 + vo.setStatus(status);
  270 +
  271 + OpLogUtil.setVariable("id", vo.getId());
  272 + OpLogUtil.setExtra(vo);
  273 +
  274 + cleanCacheByKey(id);
  275 + }
  276 +
  277 + @Override
  278 + @Transactional(rollbackFor = Exception.class)
  279 + public void updateFlowInstance(UpdateReplenishmentOrderVo vo) {
  280 + ReplenishmentOrder data = getBaseMapper().selectById(vo.getId());
  281 + if (ObjectUtil.isNull(data)) {
  282 + throw new DefaultClientException("补货单不存在!");
  283 + }
  284 +
  285 + vo.getReplenishmentOrderLineList().forEach(updateReplenishmentOrderLineVo -> {
  286 + Wrapper<ReplenishmentOrderLine> lineWrapper = Wrappers.lambdaUpdate(ReplenishmentOrderLine.class)
  287 + .set(ReplenishmentOrderLine::getQuantity, updateReplenishmentOrderLineVo.getQuantity())
  288 + .set(ReplenishmentOrderLine::getShippedQuantity, updateReplenishmentOrderLineVo.getShippedQuantity())
  289 + .set(ReplenishmentOrderLine::getSupplementaryQuantity, updateReplenishmentOrderLineVo.getSupplementaryQuantity())
  290 + .eq(ReplenishmentOrderLine::getId, updateReplenishmentOrderLineVo.getId());
  291 +
  292 + replenishmentOrderLineService.update(lineWrapper);
  293 + });
  294 +
  295 + OpLogUtil.setVariable("id", vo.getId());
  296 + OpLogUtil.setExtra(vo);
  297 +
  298 + cleanCacheByKey(vo.getId());
  299 + }
  300 +
  301 + @CacheEvict(value = ReplenishmentOrder.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
  302 + @Override
  303 + public void cleanCacheByKey(Serializable key) {
  304 +
  305 + }
  306 +}
  1 +package com.lframework.xingyun.sc.mappers;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
  5 +import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderLineVo;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * <p>
  12 + * 补货单物料行 Mapper 接口
  13 + * </p>
  14 + */
  15 +public interface ReplenishmentOrderLineMapper extends BaseMapper<ReplenishmentOrderLine> {
  16 +
  17 + /**
  18 + * 查询列表
  19 + *
  20 + * @param vo
  21 + * @return
  22 + */
  23 + List<ReplenishmentOrderLine> query(@Param("vo") QueryReplenishmentOrderLineVo vo);
  24 +}
  1 +package com.lframework.xingyun.sc.mappers;
  2 +
  3 +import com.lframework.starter.web.core.mapper.BaseMapper;
  4 +import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
  5 +import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderVo;
  6 +import org.apache.ibatis.annotations.Param;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * <p>
  12 + * 补货单 Mapper 接口
  13 + * </p>
  14 + */
  15 +public interface ReplenishmentOrderMapper extends BaseMapper<ReplenishmentOrder> {
  16 +
  17 + /**
  18 + * 查询列表
  19 + *
  20 + * @param vo
  21 + * @return
  22 + */
  23 + List<ReplenishmentOrder> query(@Param("vo") QueryReplenishmentOrderVo vo);
  24 +}
  1 +package com.lframework.xingyun.sc.service.purchase;
  2 +
  3 +import com.lframework.starter.web.core.components.resp.PageResult;
  4 +import com.lframework.starter.web.core.service.BaseMpService;
  5 +import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
  6 +import com.lframework.xingyun.sc.vo.purchase.CreateReplenishmentOrderLineVo;
  7 +import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderLineVo;
  8 +import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderLineVo;
  9 +
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * 补货单物料行 Service
  14 + */
  15 +public interface ReplenishmentOrderLineService extends BaseMpService<ReplenishmentOrderLine> {
  16 +
  17 + /**
  18 + * 查询列表
  19 + *
  20 + * @return
  21 + */
  22 + PageResult<ReplenishmentOrderLine> query(Integer pageIndex, Integer pageSize, QueryReplenishmentOrderLineVo vo);
  23 +
  24 + /**
  25 + * 查询列表
  26 + *
  27 + * @param vo
  28 + * @return
  29 + */
  30 + List<ReplenishmentOrderLine> query(QueryReplenishmentOrderLineVo vo);
  31 +
  32 + /**
  33 + * 根据ID查询
  34 + *
  35 + * @param id
  36 + * @return
  37 + */
  38 + ReplenishmentOrderLine findById(String id);
  39 +
  40 + /**
  41 + * 创建
  42 + *
  43 + * @param vo
  44 + * @return
  45 + */
  46 + String create(CreateReplenishmentOrderLineVo vo);
  47 +
  48 + /**
  49 + * 修改
  50 + *
  51 + * @param vo
  52 + */
  53 + void update(UpdateReplenishmentOrderLineVo vo);
  54 +
  55 +}
  1 +package com.lframework.xingyun.sc.service.purchase;
  2 +
  3 +import com.lframework.starter.web.core.components.resp.PageResult;
  4 +import com.lframework.starter.web.core.service.BaseMpService;
  5 +import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
  6 +import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderInfoVo;
  7 +import com.lframework.xingyun.sc.vo.purchase.CreateReplenishmentOrderVo;
  8 +import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderVo;
  9 +import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderVo;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * 补货单 Service
  15 + */
  16 +public interface ReplenishmentOrderService extends BaseMpService<ReplenishmentOrder> {
  17 +
  18 + /**
  19 + * 查询列表
  20 + *
  21 + * @return
  22 + */
  23 + PageResult<ReplenishmentOrder> query(Integer pageIndex, Integer pageSize, QueryReplenishmentOrderVo vo);
  24 +
  25 + /**
  26 + * 查询列表
  27 + *
  28 + * @param vo
  29 + * @return
  30 + */
  31 + List<ReplenishmentOrder> query(QueryReplenishmentOrderVo vo);
  32 +
  33 + /**
  34 + * 根据ID查询
  35 + *
  36 + * @param id
  37 + * @return
  38 + */
  39 + ReplenishmentOrder findById(String id);
  40 +
  41 + /**
  42 + * 创建
  43 + *
  44 + * @param vo
  45 + * @return
  46 + */
  47 + String create(CreateReplenishmentOrderVo vo);
  48 +
  49 + /**
  50 + * 修改
  51 + *
  52 + * @param vo
  53 + */
  54 + void update(UpdateReplenishmentOrderVo vo);
  55 +
  56 + /**
  57 + * 取消补货单
  58 + *
  59 + * @param id
  60 + */
  61 + void cancel(String id);
  62 +
  63 + /**
  64 + * 填写补货时间
  65 + *
  66 + * @param vo
  67 + */
  68 + void fillRestockTime(UpdateReplenishmentOrderVo vo);
  69 +
  70 + /**
  71 + * 更新审核状态
  72 + *
  73 + * @param id
  74 + * @param status
  75 + */
  76 + void updateStatus(String id, String status);
  77 +
  78 + /**
  79 + * 更新审核数据
  80 + *
  81 + * @param vo 更新数据
  82 + */
  83 + void updateFlowInstance(UpdateReplenishmentOrderVo vo);
  84 +}
  1 +package com.lframework.xingyun.sc.vo.purchase;
  2 +
  3 +import com.lframework.starter.web.core.components.validation.IsNumberPrecision;
  4 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  5 +import com.lframework.starter.web.core.vo.BaseVo;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import lombok.Data;
  8 +import org.hibernate.validator.constraints.Length;
  9 +
  10 +
  11 +import java.io.Serializable;
  12 +import java.math.BigDecimal;
  13 +import java.time.LocalDate;
  14 +
  15 +@Data
  16 +public class CreateReplenishmentOrderLineVo implements BaseVo, Serializable {
  17 +
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /**
  21 + * 补货单
  22 + */
  23 + @ApiModelProperty(value = "补货单")
  24 + @Length(message = "补货单最多允许32个字符!")
  25 + private String replenishmentOrderId;
  26 +
  27 + /**
  28 + * 订货单表物料行ID
  29 + */
  30 + @ApiModelProperty(value = "订货单表物料行ID")
  31 + @Length(message = "订货单表物料行ID最多允许32个字符!")
  32 + private String purchaseOrderLineId;
  33 +
  34 + /**
  35 + * 牌号
  36 + */
  37 + @ApiModelProperty(value = "牌号")
  38 + @Length(message = "牌号最多允许100个字符!")
  39 + private String brand;
  40 +
  41 + /**
  42 + * 厚度
  43 + */
  44 + @ApiModelProperty(value = "厚度")
  45 + @TypeMismatch(message = "厚度格式有误!")
  46 + @IsNumberPrecision(message = "厚度最多允许4位小数!", value = 4)
  47 + private BigDecimal thickness;
  48 +
  49 + /**
  50 + * 宽度
  51 + */
  52 + @ApiModelProperty(value = "宽度")
  53 + @TypeMismatch(message = "宽度格式有误!")
  54 + @IsNumberPrecision(message = "宽度最多允许4位小数!", value = 4)
  55 + private BigDecimal width;
  56 +
  57 + /**
  58 + * 长度
  59 + */
  60 + @ApiModelProperty(value = "长度")
  61 + @TypeMismatch(message = "长度格式有误!")
  62 + @IsNumberPrecision(message = "长度最多允许4位小数!", value = 4)
  63 + private BigDecimal length;
  64 +
  65 + /**
  66 + * 状态
  67 + */
  68 + @ApiModelProperty(value = "状态")
  69 + @Length(message = "状态最多允许50个字符!")
  70 + private String status;
  71 +
  72 + /**
  73 + * 需发(t)
  74 + */
  75 + @ApiModelProperty(value = "需发(t)")
  76 + @TypeMismatch(message = "需发(t)格式有误!")
  77 + @IsNumberPrecision(message = "需发(t)最多允许4位小数!", value = 4)
  78 + private BigDecimal quantity;
  79 +
  80 + /**
  81 + * 实发(t)
  82 + */
  83 + @ApiModelProperty(value = "实发(t)")
  84 + @TypeMismatch(message = "实发(t)格式有误!")
  85 + @IsNumberPrecision(message = "实发(t)最多允许4位小数!", value = 4)
  86 + private BigDecimal shippedQuantity;
  87 +
  88 + /**
  89 + * 需求补发(t/件)
  90 + */
  91 + @ApiModelProperty(value = "需求补发(t/件)")
  92 + @TypeMismatch(message = "需求补发(t/件)格式有误!")
  93 + @IsNumberPrecision(message = "需求补发(t/件)最多允许4位小数!", value = 4)
  94 + private BigDecimal supplementaryQuantity;
  95 +
  96 + /**
  97 + * 生产科确认交付日期
  98 + */
  99 + @ApiModelProperty(value = "生产科确认交付日期")
  100 + @TypeMismatch(message = "生产科确认交付日期格式有误!")
  101 + private LocalDate confirmedDeliveryDate;
  102 +
  103 + /**
  104 + * 备注
  105 + */
  106 + @ApiModelProperty(value = "备注")
  107 + @Length(message = "备注最多允许65,535个字符!")
  108 + private String remarks;
  109 +
  110 + /**
  111 + * 排序
  112 + */
  113 + @ApiModelProperty(value = "排序")
  114 + @TypeMismatch(message = "排序格式有误!")
  115 + private Integer showOrder;
  116 +
  117 + /**
  118 + * 前端用ID
  119 + */
  120 + @ApiModelProperty(value = "前端用ID")
  121 + private String itemId;
  122 +}
  1 +package com.lframework.xingyun.sc.vo.purchase;
  2 +
  3 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  4 +import com.lframework.starter.web.core.vo.BaseVo;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import org.hibernate.validator.constraints.Length;
  8 +
  9 +import javax.validation.constraints.NotBlank;
  10 +import javax.validation.constraints.NotNull;
  11 +import java.io.Serializable;
  12 +import java.time.LocalDate;
  13 +import java.util.List;
  14 +
  15 +@Data
  16 +public class CreateReplenishmentOrderVo implements BaseVo, Serializable {
  17 +
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /**
  21 + * 编号
  22 + */
  23 + @ApiModelProperty(value = "编号", required = true)
  24 + @NotBlank(message = "请输入编号!")
  25 + @Length(message = "编号最多允许50个字符!")
  26 + private String code;
  27 +
  28 + /**
  29 + * 分厂
  30 + */
  31 + @ApiModelProperty(value = "分厂", required = true)
  32 + @NotBlank(message = "请输入分厂!")
  33 + @Length(message = "分厂最多允许32个字符!")
  34 + private String workshopId;
  35 +
  36 + /**
  37 + * 办事处
  38 + */
  39 + @ApiModelProperty(value = "办事处", required = true)
  40 + @NotBlank(message = "请输入办事处!")
  41 + @Length(message = "办事处最多允许32个字符!")
  42 + private String deptId;
  43 +
  44 + /**
  45 + * 购货单位
  46 + */
  47 + @ApiModelProperty(value = "购货单位", required = true)
  48 + @NotBlank(message = "请输入购货单位!")
  49 + @Length(message = "购货单位最多允许32个字符!")
  50 + private String customerId;
  51 +
  52 + /**
  53 + * 原计划发货日期
  54 + */
  55 + @ApiModelProperty(value = "原计划发货日期", required = true)
  56 + @NotNull(message = "请输入原计划发货日期!")
  57 + @TypeMismatch(message = "原计划发货日期格式有误!")
  58 + private LocalDate originPlanShipDate;
  59 +
  60 + /**
  61 + * 订货单
  62 + */
  63 + @ApiModelProperty(value = "订货单", required = true)
  64 + @NotBlank(message = "请输入订货单!")
  65 + @Length(message = "订货单最多允许32个字符!")
  66 + private String purchaseOrderId;
  67 +
  68 + /**
  69 + * 状态
  70 + */
  71 + @ApiModelProperty(value = "状态", required = true)
  72 + @NotBlank(message = "请输入状态!")
  73 + @Length(message = "状态最多允许20个字符!")
  74 + private String status;
  75 +
  76 + /**
  77 + * 补货单物料行
  78 + */
  79 + @ApiModelProperty(value = "补货单物料行")
  80 + private List<CreateReplenishmentOrderLineVo> replenishmentOrderLineList;
  81 +
  82 +}
  1 +package com.lframework.xingyun.sc.vo.purchase;
  2 +
  3 +import com.lframework.starter.web.core.vo.BaseVo;
  4 +import com.lframework.starter.web.core.vo.PageVo;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +
  8 +import java.io.Serializable;
  9 +
  10 +@Data
  11 +public class QueryReplenishmentOrderLineVo extends PageVo implements BaseVo, Serializable {
  12 +
  13 + private static final long serialVersionUID = 1L;
  14 +
  15 + /**
  16 + * 补货单
  17 + */
  18 + @ApiModelProperty("补货单")
  19 + private String replenishmentOrderId;
  20 +
  21 +}
  1 +package com.lframework.xingyun.sc.vo.purchase;
  2 +
  3 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  4 +import com.lframework.starter.web.core.vo.BaseVo;
  5 +import com.lframework.starter.web.core.vo.PageVo;
  6 +import io.swagger.annotations.ApiModelProperty;
  7 +import lombok.Data;
  8 +
  9 +import java.io.Serializable;
  10 +import java.time.LocalDateTime;
  11 +
  12 +@Data
  13 +public class QueryReplenishmentOrderVo extends PageVo implements BaseVo, Serializable {
  14 +
  15 + private static final long serialVersionUID = 1L;
  16 +
  17 + /**
  18 + * 编号
  19 + */
  20 + @ApiModelProperty("编号")
  21 + private String code;
  22 +
  23 + /**
  24 + * 分厂
  25 + */
  26 + @ApiModelProperty("分厂")
  27 + private String workshopId;
  28 +
  29 + /**
  30 + * 购货单位
  31 + */
  32 + @ApiModelProperty("购货单位")
  33 + private String customerId;
  34 +
  35 + /**
  36 + * 创建时间
  37 + */
  38 + @ApiModelProperty("创建时间")
  39 + @TypeMismatch(message = "创建时间格式有误!")
  40 + private LocalDateTime createTime;
  41 +
  42 +}
  1 +package com.lframework.xingyun.sc.vo.purchase;
  2 +
  3 +import com.lframework.starter.web.core.vo.BaseVo;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +import lombok.Data;
  6 +
  7 +import java.io.Serializable;
  8 +import java.math.BigDecimal;
  9 +import java.time.LocalDate;
  10 +
  11 +@Data
  12 +public class UpdateReplenishmentOrderLineVo implements BaseVo, Serializable {
  13 +
  14 + private static final long serialVersionUID = 1L;
  15 +
  16 + /**
  17 + * ID
  18 + */
  19 + @ApiModelProperty(value = "ID")
  20 + private String id;
  21 +
  22 + /**
  23 + * 补货单
  24 + */
  25 + @ApiModelProperty(value = "补货单")
  26 + private String replenishmentOrderId;
  27 +
  28 + /**
  29 + * 订货单表物料行ID
  30 + */
  31 + @ApiModelProperty(value = "订货单表物料行ID")
  32 + private String purchaseOrderLineId;
  33 +
  34 + /**
  35 + * 牌号
  36 + */
  37 + @ApiModelProperty(value = "牌号")
  38 + private String brand;
  39 +
  40 + /**
  41 + * 厚度
  42 + */
  43 + @ApiModelProperty(value = "厚度")
  44 + private BigDecimal thickness;
  45 +
  46 + /**
  47 + * 宽度
  48 + */
  49 + @ApiModelProperty(value = "宽度")
  50 + private BigDecimal width;
  51 +
  52 + /**
  53 + * 长度
  54 + */
  55 + @ApiModelProperty(value = "长度")
  56 + private BigDecimal length;
  57 +
  58 + /**
  59 + * 状态
  60 + */
  61 + @ApiModelProperty(value = "状态")
  62 + private String status;
  63 +
  64 + /**
  65 + * 需发(t)
  66 + */
  67 + @ApiModelProperty(value = "需发(t)")
  68 + private BigDecimal quantity;
  69 +
  70 + /**
  71 + * 实发(t)
  72 + */
  73 + @ApiModelProperty(value = "实发(t)")
  74 + private BigDecimal shippedQuantity;
  75 +
  76 + /**
  77 + * 需求补发(t/件)
  78 + */
  79 + @ApiModelProperty(value = "需求补发(t/件)")
  80 + private BigDecimal supplementaryQuantity;
  81 +
  82 + /**
  83 + * 生产科确认交付日期
  84 + */
  85 + @ApiModelProperty(value = "生产科确认交付日期")
  86 + private LocalDate confirmedDeliveryDate;
  87 +
  88 + /**
  89 + * 备注
  90 + */
  91 + @ApiModelProperty(value = "备注")
  92 + private String remarks;
  93 +
  94 + /**
  95 + * 排序
  96 + */
  97 + @ApiModelProperty(value = "排序")
  98 + private Integer showOrder;
  99 +
  100 + /**
  101 + * 前端用ID
  102 + */
  103 + @ApiModelProperty(value = "前端用ID")
  104 + private String itemId;
  105 +
  106 +}
  1 +package com.lframework.xingyun.sc.vo.purchase;
  2 +
  3 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  4 +import com.lframework.starter.web.core.vo.BaseVo;
  5 +import io.swagger.annotations.ApiModelProperty;
  6 +import lombok.Data;
  7 +import org.hibernate.validator.constraints.Length;
  8 +
  9 +import javax.validation.constraints.NotBlank;
  10 +import javax.validation.constraints.NotNull;
  11 +import java.io.Serializable;
  12 +import java.time.LocalDate;
  13 +import java.util.List;
  14 +
  15 +@Data
  16 +public class UpdateReplenishmentOrderVo implements BaseVo, Serializable {
  17 +
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /**
  21 + * ID
  22 + */
  23 + @ApiModelProperty(value = "ID", required = true)
  24 + @NotBlank(message = "id不能为空!")
  25 + private String id;
  26 +
  27 + /**
  28 + * 编号
  29 + */
  30 + @ApiModelProperty(value = "编号", required = true)
  31 + @NotBlank(message = "请输入编号!")
  32 + @Length(message = "编号最多允许50个字符!")
  33 + private String code;
  34 +
  35 + /**
  36 + * 分厂
  37 + */
  38 + @ApiModelProperty(value = "分厂", required = true)
  39 + @NotBlank(message = "请输入分厂!")
  40 + @Length(message = "分厂最多允许32个字符!")
  41 + private String workshopId;
  42 +
  43 + /**
  44 + * 办事处
  45 + */
  46 + @ApiModelProperty(value = "办事处", required = true)
  47 + @NotBlank(message = "请输入办事处!")
  48 + @Length(message = "办事处最多允许32个字符!")
  49 + private String deptId;
  50 +
  51 + /**
  52 + * 购货单位
  53 + */
  54 + @ApiModelProperty(value = "购货单位", required = true)
  55 + @NotBlank(message = "请输入购货单位!")
  56 + @Length(message = "购货单位最多允许32个字符!")
  57 + private String customerId;
  58 +
  59 + /**
  60 + * 原计划发货日期
  61 + */
  62 + @ApiModelProperty(value = "原计划发货日期", required = true)
  63 + @TypeMismatch(message = "原计划发货日期格式有误!")
  64 + @NotNull(message = "请输入原计划发货日期!")
  65 + private LocalDate originPlanShipDate;
  66 +
  67 + /**
  68 + * 订货单
  69 + */
  70 + @ApiModelProperty(value = "订货单", required = true)
  71 + @NotBlank(message = "请输入订货单!")
  72 + @Length(message = "订货单最多允许32个字符!")
  73 + private String purchaseOrderId;
  74 +
  75 + /**
  76 + * 补货单物料行
  77 + */
  78 + @ApiModelProperty("补货单物料行")
  79 + private List<UpdateReplenishmentOrderLineVo> replenishmentOrderLineList;
  80 +
  81 + /**
  82 + * 审批状态
  83 + */
  84 + @ApiModelProperty("审批状态")
  85 + private String status;
  86 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.lframework.xingyun.sc.mappers.ReplenishmentOrderLineMapper">
  4 +
  5 + <resultMap id="ReplenishmentOrderLine" type="com.lframework.xingyun.sc.entity.ReplenishmentOrderLine">
  6 + <id column="id" property="id"/>
  7 + <result column="replenishment_order_id" property="replenishmentOrderId"/>
  8 + <result column="purchase_order_line_id" property="purchaseOrderLineId"/>
  9 + <result column="brand" property="brand"/>
  10 + <result column="thickness" property="thickness"/>
  11 + <result column="width" property="width"/>
  12 + <result column="length" property="length"/>
  13 + <result column="status" property="status"/>
  14 + <result column="quantity" property="quantity"/>
  15 + <result column="shipped_quantity" property="shippedQuantity"/>
  16 + <result column="supplementary_quantity" property="supplementaryQuantity"/>
  17 + <result column="confirmed_delivery_date" property="confirmedDeliveryDate"/>
  18 + <result column="remarks" property="remarks"/>
  19 + <result column="show_order" property="showOrder"/>
  20 + <result column="create_by_id" property="createById"/>
  21 + <result column="create_by" property="createBy"/>
  22 + <result column="update_by_id" property="updateById"/>
  23 + <result column="update_by" property="updateBy"/>
  24 + <result column="create_time" property="createTime"/>
  25 + <result column="update_time" property="updateTime"/>
  26 + </resultMap>
  27 +
  28 + <sql id="ReplenishmentOrderLine_sql">
  29 + SELECT tb.id,
  30 + tb.replenishment_order_id,
  31 + tb.purchase_order_line_id,
  32 + tb.brand,
  33 + tb.thickness,
  34 + tb.width,
  35 + tb.length,
  36 + tb.status,
  37 + tb.quantity,
  38 + tb.shipped_quantity,
  39 + tb.supplementary_quantity,
  40 + tb.confirmed_delivery_date,
  41 + tb.remarks,
  42 + tb.show_order,
  43 + tb.create_by_id,
  44 + tb.create_by,
  45 + tb.update_by_id,
  46 + tb.update_by,
  47 + tb.create_time,
  48 + tb.update_time
  49 + FROM tbl_replenishment_order_line AS tb
  50 + </sql>
  51 +
  52 + <select id="query" resultMap="ReplenishmentOrderLine">
  53 + <include refid="ReplenishmentOrderLine_sql"/>
  54 + <where>
  55 + <if test="vo.replenishmentOrderId != null and vo.replenishmentOrderId != ''">
  56 + AND tb.replenishment_order_id = #{vo.replenishmentOrderId}
  57 + </if>
  58 + </where>
  59 + </select>
  60 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.lframework.xingyun.sc.mappers.ReplenishmentOrderMapper">
  4 +
  5 + <resultMap id="ReplenishmentOrder" type="com.lframework.xingyun.sc.entity.ReplenishmentOrder">
  6 + <id column="id" property="id"/>
  7 + <result column="code" property="code"/>
  8 + <result column="workshop_id" property="workshopId"/>
  9 + <result column="dept_id" property="deptId"/>
  10 + <result column="customer_id" property="customerId"/>
  11 + <result column="origin_plan_ship_date" property="originPlanShipDate"/>
  12 + <result column="purchase_order_id" property="purchaseOrderId"/>
  13 + <result column="status" property="status"/>
  14 + <result column="create_by_id" property="createById"/>
  15 + <result column="create_by" property="createBy"/>
  16 + <result column="update_by_id" property="updateById"/>
  17 + <result column="update_by" property="updateBy"/>
  18 + <result column="create_time" property="createTime"/>
  19 + <result column="update_time" property="updateTime"/>
  20 + </resultMap>
  21 +
  22 + <sql id="ReplenishmentOrder_sql">
  23 + SELECT tb.id,
  24 + tb.code,
  25 + tb.workshop_id,
  26 + tb.dept_id,
  27 + tb.customer_id,
  28 + tb.origin_plan_ship_date,
  29 + tb.purchase_order_id,
  30 + tb.status,
  31 + tb.create_by_id,
  32 + tb.create_by,
  33 + tb.update_by_id,
  34 + tb.update_by,
  35 + tb.create_time,
  36 + tb.update_time
  37 + FROM tbl_replenishment_order AS tb
  38 + </sql>
  39 +
  40 + <select id="query" resultMap="ReplenishmentOrder">
  41 + <include refid="ReplenishmentOrder_sql"/>
  42 + <where>
  43 + <if test="vo.code != null and vo.code != ''">
  44 + AND tb.code LIKE CONCAT('%', #{vo.code}, '%')
  45 + </if>
  46 + <if test="vo.workshopId != null and vo.workshopId != ''">
  47 + AND tb.workshop_id = #{vo.workshopId}
  48 + </if>
  49 + <if test="vo.customerId != null and vo.customerId != ''">
  50 + AND tb.customer_id = #{vo.customerId}
  51 + </if>
  52 + <if test="vo.createTime != null">
  53 + AND tb.create_time = #{vo.createTime}
  54 + </if>
  55 + </where>
  56 + </select>
  57 +</mapper>