| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderAndItemsParams; |
| | | import com.vincent.rsf.server.manager.controller.params.OrderOutTaskParam; |
| | | import com.vincent.rsf.server.common.utils.OptimisticLockUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.*; |
| | | import com.vincent.rsf.server.manager.entity.WkOrder; |
| | | import com.vincent.rsf.server.manager.entity.WkOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.excel.CheckOrderTemplate; |
| | | import com.vincent.rsf.server.manager.enums.CheckExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.service.CheckOrderService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.manager.utils.buildPageRowsUtils; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | PageParam<WkOrder, BaseParam> pageParam = new PageParam<>(baseParam, WkOrder.class); |
| | | QueryWrapper<WkOrder> wrapper = pageParam.buildWrapper(true); |
| | | wrapper.eq("type", OrderType.ORDER_CHECK.type); |
| | | return R.ok().add(checkOrderService.page(pageParam, wrapper)); |
| | | PageParam<WkOrder, BaseParam> page = checkOrderService.page(pageParam, wrapper); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:list')") |
| | | @PostMapping("/check/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(checkOrderService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(checkOrderService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:list')") |
| | | @PostMapping({"/check/many/{ids}", "/check/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(checkOrderService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(checkOrderService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:list')") |
| | | @GetMapping("/check/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(checkOrderService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(checkOrderService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:save')") |
| | |
| | | if (!checkOrderService.save(order)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(order); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(order)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:update')") |
| | | @OperationLog("Update 字典数据集") |
| | | @PostMapping("/check/update") |
| | | public R update(@RequestBody WkOrder order) { |
| | | OptimisticLockUtils.requireVersion("盘点单", order.getVersion()); |
| | | order.setUpdateTime(null); |
| | | order.setUpdateBy(getLoginUserId()); |
| | | if (!checkOrderService.updateById(order)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(order); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(order)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:remove')") |
| | |
| | | if (!checkOrderService.removeByIds(orderIds)) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | return R.ok("Delete Success").add(buildPageRowsUtils.rowsMap(ids)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:outStock:update')") |
| | |
| | | checkOrderService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getCode())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(vos)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:check:list')") |
| | |
| | | } else { |
| | | orders = checkOrderService.list(); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orders, WkOrder.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(orders), WkOrder.class), response); |
| | | } |
| | | |
| | | @PostMapping("/check/items/save") |
| | |
| | | return checkOrderService.saveCheckOrder(params, getLoginUserId()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("盘点单信息修改") |
| | | @PostMapping("/check/items/update") |
| | | @PreAuthorize("hasAuthority('manager:check:update')") |
| | |
| | | return checkOrderService.updateOrderItem(params, getLoginUserId()); |
| | | } |
| | | |
| | | @PostMapping("/outStock/order/getOutTaskItems") |
| | | @PostMapping("/check/order/items") |
| | | @ApiOperation("盘点出库预览") |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | @PreAuthorize("hasAuthority('manager:check:list')") |
| | | public R getOrderOutTaskItem(@RequestBody OrderOutTaskParam param) { |
| | | if (Cools.isEmpty(param)) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | |
| | | return checkOrderService.genCheckPreview(param); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 盘点单生成出库任务 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @PostMapping("/check/generate/tasks") |
| | | @ApiOperation("生成盘点出库任务") |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | public R genCheckOutTask( @RequestBody List<CheckOrderParams> params) { |
| | | if (Cools.isEmpty()) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | |
| | | return checkOrderService.genCheckOutTask(params, getLoginUserId()); |
| | | } |
| | | |
| | | /** |
| | | * 获取出库站点 |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation("获取在库物料列表") |
| | | @PostMapping("/check/locs") |
| | | @PreAuthorize("hasAuthority('manager:check:list')") |
| | | public R getAllLocByMatnr(@RequestBody CheckLocQueryParams params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return checkOrderService.getAllLocByMatnr(params); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |