Commit f981ba5023bb47dcefcbe9a5b5671d307c294bb7

Authored by 杨鸣坤
1 parent a9c7892d

楚江ERP:补货单接口完善

... ... @@ -103,6 +103,12 @@ public class GetReplenishmentOrderLineBo extends BaseBo<ReplenishmentOrderLine>
103 103 @ApiModelProperty("排序")
104 104 private Integer showOrder;
105 105
  106 + /**
  107 + * 前端用ID
  108 + */
  109 + @ApiModelProperty("前端用ID")
  110 + private String itemId;
  111 +
106 112 public GetReplenishmentOrderLineBo() {
107 113
108 114 }
... ...
... ... @@ -18,6 +18,8 @@ import com.lframework.xingyun.basedata.entity.Customer;
18 18 import com.lframework.xingyun.basedata.entity.Workshop;
19 19 import com.lframework.xingyun.basedata.service.customer.CustomerService;
20 20 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
  21 +import com.lframework.xingyun.basedata.vo.customer.QueryCustomerVo;
  22 +import com.lframework.xingyun.sc.bo.contract.QueryContractDistributorStandardBo;
21 23 import com.lframework.xingyun.sc.bo.purchase.GetReplenishmentOrderBo;
22 24 import com.lframework.xingyun.sc.bo.purchase.GetReplenishmentOrderLineBo;
23 25 import com.lframework.xingyun.sc.bo.purchase.QueryReplenishmentOrderBo;
... ... @@ -78,9 +80,20 @@ public class ReplenishmentOrderController extends DefaultBaseController {
78 80 * 查询列表
79 81 */
80 82 @ApiOperation("查询列表")
81   - @HasPermission({"entity:replenishmentorder:query"})
  83 + @HasPermission({"purchase:replenishmentorder:query"})
82 84 @GetMapping("/query")
83 85 public InvokeResult<PageResult<QueryReplenishmentOrderBo>> query(@Valid QueryReplenishmentOrderVo vo) {
  86 + if (vo != null && StringUtils.isNotBlank(vo.getCustomerName())) {
  87 + QueryCustomerVo queryCustomerVo = new QueryCustomerVo();
  88 + queryCustomerVo.setName(vo.getCustomerName());
  89 + List<Customer> customerList = customerService.query(queryCustomerVo);
  90 + if (CollectionUtils.isEmpty(customerList)) {
  91 + PageResult<QueryReplenishmentOrderBo> boPageResult = new PageResult<>();
  92 + return InvokeResultBuilder.success(boPageResult);
  93 + }
  94 +
  95 + vo.setCustomerIdList(customerList.stream().map(Customer::getId).collect(Collectors.toList()));
  96 + }
84 97
85 98 PageResult<ReplenishmentOrder> pageResult = replenishmentOrderService.query(getPageIndex(vo), getPageSize(vo), vo);
86 99
... ... @@ -147,7 +160,7 @@ public class ReplenishmentOrderController extends DefaultBaseController {
147 160 */
148 161 @ApiOperation("根据ID查询")
149 162 @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
150   - @HasPermission({"entity:replenishmentorder:query"})
  163 + @HasPermission({"purchase:replenishmentorder:query"})
151 164 @GetMapping
152 165 public InvokeResult<GetReplenishmentOrderBo> get(@NotBlank(message = "id不能为空!") String id) {
153 166
... ... @@ -190,7 +203,7 @@ public class ReplenishmentOrderController extends DefaultBaseController {
190 203 * 新增
191 204 */
192 205 @ApiOperation("新增")
193   - @HasPermission({"entity:replenishmentorder:add"})
  206 + @HasPermission({"purchase:replenishmentorder:add"})
194 207 @PostMapping
195 208 public InvokeResult<Void> create(@Valid @RequestBody CreateReplenishmentOrderVo vo) {
196 209
... ... @@ -203,7 +216,7 @@ public class ReplenishmentOrderController extends DefaultBaseController {
203 216 * 修改
204 217 */
205 218 @ApiOperation("修改")
206   - @HasPermission({"entity:replenishmentorder:modify"})
  219 + @HasPermission({"purchase:replenishmentorder:modify"})
207 220 @PutMapping
208 221 public InvokeResult<Void> update(@Valid @RequestBody UpdateReplenishmentOrderVo vo) {
209 222
... ... @@ -218,6 +231,7 @@ public class ReplenishmentOrderController extends DefaultBaseController {
218 231 * 取消
219 232 */
220 233 @ApiOperation("取消")
  234 + @HasPermission({"purchase:replenishmentorder:cancel"})
221 235 @GetMapping("/cancel")
222 236 public InvokeResult<Void> cancel(@NotBlank(message = "id不能为空!") String id) {
223 237
... ... @@ -232,6 +246,7 @@ public class ReplenishmentOrderController extends DefaultBaseController {
232 246 * 填写补货时间
233 247 */
234 248 @ApiOperation("填写补货时间")
  249 + @HasPermission({"purchase:replenishmentorder:fillRestockTime"})
235 250 @PostMapping("/fillRestockTime")
236 251 public InvokeResult<Void> fillRestockTime(@RequestBody UpdateReplenishmentOrderVo vo) {
237 252
... ...
... ... @@ -145,6 +145,7 @@ public class ReplenishmentOrderServiceImpl extends BaseMpServiceImpl<Replenishme
145 145 .set(ReplenishmentOrder::getCustomerId, vo.getCustomerId())
146 146 .set(ReplenishmentOrder::getOriginPlanShipDate, vo.getOriginPlanShipDate())
147 147 .set(ReplenishmentOrder::getPurchaseOrderId, vo.getPurchaseOrderId())
  148 + .set(ReplenishmentOrder::getStatus, "AUDIT")
148 149 .eq(ReplenishmentOrder::getId, vo.getId());
149 150
150 151 getBaseMapper().update(updateWrapper);
... ...
... ... @@ -20,56 +20,49 @@ public class CreateReplenishmentOrderVo implements BaseVo, Serializable {
20 20 /**
21 21 * 编号
22 22 */
23   - @ApiModelProperty(value = "编号", required = true)
24   - @NotBlank(message = "请输入编号!")
  23 + @ApiModelProperty(value = "编号")
25 24 @Length(message = "编号最多允许50个字符!")
26 25 private String code;
27 26
28 27 /**
29 28 * 分厂
30 29 */
31   - @ApiModelProperty(value = "分厂", required = true)
32   - @NotBlank(message = "请输入分厂!")
  30 + @ApiModelProperty(value = "分厂")
33 31 @Length(message = "分厂最多允许32个字符!")
34 32 private String workshopId;
35 33
36 34 /**
37 35 * 办事处
38 36 */
39   - @ApiModelProperty(value = "办事处", required = true)
40   - @NotBlank(message = "请输入办事处!")
  37 + @ApiModelProperty(value = "办事处")
41 38 @Length(message = "办事处最多允许32个字符!")
42 39 private String deptId;
43 40
44 41 /**
45 42 * 购货单位
46 43 */
47   - @ApiModelProperty(value = "购货单位", required = true)
48   - @NotBlank(message = "请输入购货单位!")
  44 + @ApiModelProperty(value = "购货单位")
49 45 @Length(message = "购货单位最多允许32个字符!")
50 46 private String customerId;
51 47
52 48 /**
53 49 * 原计划发货日期
54 50 */
55   - @ApiModelProperty(value = "原计划发货日期", required = true)
56   - @NotNull(message = "请输入原计划发货日期!")
  51 + @ApiModelProperty(value = "原计划发货日期")
57 52 @TypeMismatch(message = "原计划发货日期格式有误!")
58 53 private LocalDate originPlanShipDate;
59 54
60 55 /**
61 56 * 订货单
62 57 */
63   - @ApiModelProperty(value = "订货单", required = true)
64   - @NotBlank(message = "请输入订货单!")
  58 + @ApiModelProperty(value = "订货单")
65 59 @Length(message = "订货单最多允许32个字符!")
66 60 private String purchaseOrderId;
67 61
68 62 /**
69 63 * 状态
70 64 */
71   - @ApiModelProperty(value = "状态", required = true)
72   - @NotBlank(message = "请输入状态!")
  65 + @ApiModelProperty(value = "状态")
73 66 @Length(message = "状态最多允许20个字符!")
74 67 private String status;
75 68
... ...
... ... @@ -7,7 +7,9 @@ import io.swagger.annotations.ApiModelProperty;
7 7 import lombok.Data;
8 8
9 9 import java.io.Serializable;
  10 +import java.time.LocalDate;
10 11 import java.time.LocalDateTime;
  12 +import java.util.List;
11 13
12 14 @Data
13 15 public class QueryReplenishmentOrderVo extends PageVo implements BaseVo, Serializable {
... ... @@ -30,7 +32,13 @@ public class QueryReplenishmentOrderVo extends PageVo implements BaseVo, Seriali
30 32 * 购货单位
31 33 */
32 34 @ApiModelProperty("购货单位")
33   - private String customerId;
  35 + private List<String> customerIdList;
  36 +
  37 + /**
  38 + * 购货单位名称
  39 + */
  40 + @ApiModelProperty("购货单位名称")
  41 + private String customerName;
34 42
35 43 /**
36 44 * 创建时间
... ... @@ -39,4 +47,15 @@ public class QueryReplenishmentOrderVo extends PageVo implements BaseVo, Seriali
39 47 @TypeMismatch(message = "创建时间格式有误!")
40 48 private LocalDateTime createTime;
41 49
  50 + /**
  51 + * 申请时间开始
  52 + */
  53 + @ApiModelProperty("申请时间开始")
  54 + private LocalDate applicationDateStart;
  55 +
  56 + /**
  57 + * 申请时间结束
  58 + */
  59 + @ApiModelProperty("申请时间结束")
  60 + private LocalDate applicationDateEnd;
42 61 }
\ No newline at end of file
... ...
... ... @@ -46,12 +46,22 @@
46 46 <if test="vo.workshopId != null and vo.workshopId != ''">
47 47 AND tb.workshop_id = #{vo.workshopId}
48 48 </if>
49   - <if test="vo.customerId != null and vo.customerId != ''">
50   - AND tb.customer_id = #{vo.customerId}
51   - </if>
52 49 <if test="vo.createTime != null">
53 50 AND tb.create_time = #{vo.createTime}
54 51 </if>
  52 + <if test="vo.customerIdList != null and vo.customerIdList.size() > 0">
  53 + AND tb.customer_id IN
  54 + <foreach collection="vo.customerIdList" open="(" separator="," close=")" item="item">
  55 + #{item}
  56 + </foreach>
  57 + </if>
  58 + <if test="vo.applicationDateStart != null">
  59 + AND tb.create_time &gt;= #{vo.applicationDateStart}
  60 + </if>
  61 + <if test="vo.applicationDateEnd != null">
  62 + AND tb.create_time &lt;= #{vo.applicationDateEnd}
  63 + </if>
55 64 </where>
  65 + order by tb.create_time desc
56 66 </select>
57 67 </mapper>
... ...