| | |
| | | package com.zy.asrs.wms.asrs.controller;
|
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.alibaba.fastjson.parser.Feature;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | |
| | | import com.zy.asrs.wms.asrs.service.LocDetlService;
|
| | | import com.zy.asrs.wms.system.controller.BaseController;
|
| | | import com.zy.asrs.wms.utils.ExcelUtil;
|
| | | import com.zy.asrs.wms.utils.Utils;
|
| | | import org.springframework.beans.BeanUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | |
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')")
|
| | | @PostMapping("/locDetl/page")
|
| | | @CacheData(tableName = {"man_loc_detl"})
|
| | | public R page(@RequestBody Map<String, Object> map) {
|
| | | // String orderType = null;
|
| | | // if (Objects.isNull(map.get("orderType"))) {
|
| | | // orderType = map.get("orderType").toString();
|
| | | // map.remove("orderType");
|
| | | // }
|
| | | Map<String, String> order = new HashMap<>();
|
| | | if (!Objects.isNull(map.get("orderBy"))) {
|
| | | order = JSONObject.parseObject(JSON.toJSONString(map.get("orderBy")), Map.class);
|
| | | }
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class);
|
| | | PageParam<ViewLocDetl, BaseParam> data = locDetlService.getPage(pageParam, pageParam.buildWrapper(true));
|
| | | QueryWrapper<ViewLocDetl> wrapper = pageParam.ignoreWrapper(true);
|
| | | if (!Cools.isEmpty(order)) {
|
| | | String fileds = Utils.toSymbolCase(order.get("field"), '_');
|
| | | if (order.get("order").equals("asc")) {
|
| | | wrapper.orderByAsc(fileds);
|
| | | } else {
|
| | | wrapper.orderByDesc(fileds);
|
| | | }
|
| | | } else {
|
| | | wrapper.orderByDesc("create_time");
|
| | | }
|
| | | PageParam<ViewLocDetl, BaseParam> data = locDetlService.getPage(pageParam, wrapper);
|
| | |
|
| | | return R.ok(data);
|
| | | return R.ok().add(data);
|
| | | }
|
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:locDetl:list')")
|
| | | @PostMapping("/locDetl/outPage")
|
| | | @CacheData(tableName = {"man_loc_detl"})
|
| | | public R outPage(@RequestBody Map<String, Object> map) {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class);
|
| | |
| | | package com.zy.asrs.wms.asrs.controller;
|
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | |
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:order:list')")
|
| | | @PostMapping("/order/in/page")
|
| | | // @CacheData(tableName = {"man_order", "man_order_type"})
|
| | | public R pageIn(@RequestBody Map<String, Object> map) {
|
| | | Map<String, String> order = new HashMap<>();
|
| | | if (!Objects.isNull(map.get("orderBy"))) {
|
| | | order = JSONObject.parseObject(JSON.toJSONString(map.get("orderBy")), Map.class);
|
| | | }
|
| | | String condition = map.getOrDefault("condition", "").toString();
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<Order, BaseParam> pageParam = new PageParam<>(baseParam, Order.class);
|
| | | // QueryWrapper<Order> wrapper = pageParam.buildWrapper(true);
|
| | | QueryWrapper<Order> wrapper = new QueryWrapper<>();
|
| | |
|
| | | QueryWrapper<Order> wrapper = pageParam.ignoreWrapper(true);
|
| | | ArrayList<Long> types = new ArrayList<>();
|
| | | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().in(OrderType::getType, 1))) {
|
| | | types.add(orderType.getId());
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | wrapper.orderByDesc("create_time");
|
| | |
|
| | | if (!Cools.isEmpty(order)) {
|
| | | String fileds = Utils.toSymbolCase(order.get("field"), '_');
|
| | | if (order.get("order").equals("asc")) {
|
| | | wrapper.orderByAsc(fileds);
|
| | | } else {
|
| | | wrapper.orderByDesc(fileds);
|
| | | }
|
| | | } else {
|
| | | wrapper.orderByDesc("create_time");
|
| | | }
|
| | |
|
| | | return R.ok().add(orderService.page(pageParam, wrapper));
|
| | | }
|
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:order:list')")
|
| | | @PostMapping("/order/out/page")
|
| | | // @CacheData(tableName = {"man_order", "man_order_type"})
|
| | | public R pageOut(@RequestBody Map<String, Object> map) {
|
| | | String condition = map.getOrDefault("condition", "").toString();
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<Order, BaseParam> pageParam = new PageParam<>(baseParam, Order.class);
|
| | | // QueryWrapper<Order> wrapper = pageParam.buildWrapper(true);
|
| | | QueryWrapper<Order> wrapper = new QueryWrapper<>();
|
| | |
|
| | | ArrayList<Long> types = new ArrayList<>();
|
| | | for (OrderType orderType : orderTypeService.list(new LambdaQueryWrapper<OrderType>().eq(OrderType::getType, 2))) {
|
| | | types.add(orderType.getId());
|
| | | }
|
| | |
|
| | | wrapper.in("order_type", types);
|
| | |
|
| | | if (map.containsKey("orderOut")) {
|
| | | wrapper.isNull("wave_id");
|
| | | }
|
| | |
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:order:list')")
|
| | | @PostMapping("/order/list")
|
| | | // @CacheData(tableName = {"man_order"})
|
| | | public R list(@RequestBody Map<String, Object> map) {
|
| | | return R.ok().add(orderService.list());
|
| | | }
|
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:order:list')")
|
| | | @GetMapping("/order/{id}")
|
| | | // @CacheData(tableName = {"man_order"})
|
| | | public R get(@PathVariable("id") Long id) {
|
| | | Order order = orderService.getById(id);
|
| | | List<OrderDetl> detls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId()));
|
| | |
| | | @PostMapping("/order/save")
|
| | | @Transactional
|
| | | public R save(@RequestBody CreateOrderParam param) {
|
| | | orderService.createOrder(param);
|
| | | orderService.createOrder(param, getLoginUserId());
|
| | | return R.ok("添加成功");
|
| | | }
|
| | |
|
| | |
| | | public R update(@RequestBody UpdateOrderParam param) {
|
| | | orderService.updateOrder(param);
|
| | | return R.ok("修改成功");
|
| | | }
|
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:order:remove')")
|
| | | @OperationLog("完结订单")
|
| | | @PostMapping("/order/done/{id}")
|
| | | public R orderToDone(@PathVariable Long id) {
|
| | | return R.ok().add(orderService.doneOrder(id));
|
| | | }
|
| | |
|
| | | @PreAuthorize("hasAuthority('asrs:order:remove')")
|
| | |
| | | CreateOrderParam orderParam = (CreateOrderParam) entry.getValue();
|
| | | orderParams.add(orderParam);
|
| | | }
|
| | | orderService.createOrder(orderParams);
|
| | | orderService.createOrder(orderParams, getLoginUserId());
|
| | | return R.ok();
|
| | | }
|
| | |
|
| | |
| | | public R page(@RequestBody Map<String, Object> map) {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewStayTime, BaseParam> pageParam = new PageParam<>(baseParam, ViewStayTime.class);
|
| | | QueryWrapper<ViewStayTime> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("stay_time"));
|
| | | QueryWrapper<ViewStayTime> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("stay_time"), false);
|
| | | PageParam<ViewStayTime, BaseParam> page = viewStayTimeMapper.selectPage(pageParam, queryWrapper);
|
| | | return R.ok().add(page);
|
| | | }
|
| | |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewStayTime, BaseParam> pageParam = new PageParam<>(baseParam, ViewStayTime.class);
|
| | | QueryWrapper<ViewStayTime> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("stay_time"));
|
| | | QueryWrapper<ViewStayTime> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("stay_time"), false);
|
| | | ExcelUtil.build(ExcelUtil.create(viewStayTimeMapper.selectList(queryWrapper), ViewStayTime.class), response);
|
| | | }
|
| | |
|
| | |
| | | public R page(@RequestBody Map<String, Object> map) {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewWorkCountIn, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkCountIn.class);
|
| | | QueryWrapper<ViewWorkCountIn> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"));
|
| | | QueryWrapper<ViewWorkCountIn> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"), false);
|
| | | PageParam<ViewWorkCountIn, BaseParam> page = viewWorkCountInMapper.selectPage(pageParam, queryWrapper);
|
| | | return R.ok().add(page);
|
| | | }
|
| | |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewWorkCountIn, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkCountIn.class);
|
| | | QueryWrapper<ViewWorkCountIn> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"));
|
| | | QueryWrapper<ViewWorkCountIn> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"), false);
|
| | | ExcelUtil.build(ExcelUtil.create(viewWorkCountInMapper.selectList(queryWrapper), ViewWorkCountIn.class), response);
|
| | | }
|
| | |
|
| | |
| | | public R page(@RequestBody Map<String, Object> map) {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewWorkCountOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkCountOut.class);
|
| | | QueryWrapper<ViewWorkCountOut> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"));
|
| | | QueryWrapper<ViewWorkCountOut> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"), false);
|
| | | PageParam<ViewWorkCountOut, BaseParam> page = viewWorkCountOutMapper.selectPage(pageParam, queryWrapper);
|
| | | return R.ok().add(page);
|
| | | }
|
| | |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<ViewWorkCountOut, BaseParam> pageParam = new PageParam<>(baseParam, ViewWorkCountOut.class);
|
| | | QueryWrapper<ViewWorkCountOut> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"));
|
| | | QueryWrapper<ViewWorkCountOut> queryWrapper = pageParam.buildWrapper(true, wrapper -> wrapper.orderByDesc("oneday"), false);
|
| | | ExcelUtil.build(ExcelUtil.create(viewWorkCountOutMapper.selectList(queryWrapper), ViewWorkCountOut.class), response);
|
| | | }
|
| | |
|
| | |
| | | @ApiModelProperty("优先级")
|
| | | private Integer sorted;
|
| | |
|
| | | @ApiModelProperty("仓库类型")
|
| | | private Integer wareType;
|
| | |
|
| | | /**
|
| | | * 商品库存索引
|
| | | */
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public String getWareType$(){
|
| | | if (wareType == null) {return null;}
|
| | | if (wareType == 1) {
|
| | | return "立库";
|
| | | } else if (wareType == 2) {
|
| | | return "平库";
|
| | | } else {
|
| | | return "立库/平库";
|
| | | }
|
| | | }
|
| | |
|
| | | public String getMatId$(){
|
| | | MatService service = SpringUtils.getBean(MatService.class);
|
| | | Mat mat = service.getById(this.matId);
|
| | |
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
| | | import com.mysql.cj.util.StringUtils;
|
| | | import com.zy.asrs.wms.asrs.entity.param.StockOutParam;
|
| | | import com.zy.asrs.framework.exception.CoolException;
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | // List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>()
|
| | | // .eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id).eq(CacheSite::getChannel, task.getTargetSite()));
|
| | | //
|
| | |
| | | if (!locDetlService.updateById(locDetl)) {
|
| | | throw new CoolException("库存加锁失败!!");
|
| | | }
|
| | |
|
| | | orderDetlService.update(new LambdaUpdateWrapper<OrderDetl>()
|
| | | .set(OrderDetl::getWareType, 2)
|
| | | .eq(OrderDetl::getMatId, mat.getId())
|
| | | .eq(StringUtils.isNullOrEmpty(outOder.getBatch()), OrderDetl::getBatch, outOder.getBatch())
|
| | | .in(OrderDetl::getOrderId, outOder.getOrderIds()));
|
| | | });
|
| | |
|
| | | curLoc.setLocStsId(LocStsType.R.val());
|
| | |
| | |
|
| | | public interface OrderService extends IService<Order> {
|
| | |
|
| | | boolean createOrder(CreateOrderParam param);
|
| | | boolean createOrder(CreateOrderParam param, Long userId);
|
| | |
|
| | | boolean createOrder(List<CreateOrderParam> list);
|
| | | boolean createOrder(List<CreateOrderParam> list, Long userId);
|
| | |
|
| | | boolean updateOrder(UpdateOrderParam param);
|
| | |
|
| | |
| | | Order selectByBarcode(String barcode);
|
| | |
|
| | | List<OrderInfoDto> getDetlForOrderId(Long id, String matnr);
|
| | |
|
| | | Order doneOrder(Long id);
|
| | | }
|
| | |
| | | @Override
|
| | | public R getMatsByCode(String matnr) {
|
| | | QueryWrapper<LocDetl> wrapper = new QueryWrapper<>();
|
| | | wrapper.eq("matnr", matnr).select("id, maktx, matnr, SUM(anfme) anfme");
|
| | | wrapper.eq("matnr", matnr).select("matnr, SUM(anfme) anfme");
|
| | | LocDetl detl = locDetlService.getOne(wrapper);
|
| | |
|
| | | Mat one = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, detl.getMatnr()), false);
|
| | |
| | | throw new CoolException("物料不存在!!");
|
| | | }
|
| | | one.setAnfme(detl.getAnfme());
|
| | | return R.ok().add(one);
|
| | | return R.ok().add(Arrays.asList(one));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public boolean createOrder(List<CreateOrderParam> list) {
|
| | | public boolean createOrder(List<CreateOrderParam> list, Long userId) {
|
| | | for (CreateOrderParam orderParam : list) {
|
| | | createOrder(orderParam);
|
| | | createOrder(orderParam, userId);
|
| | | }
|
| | | return true;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public boolean createOrder(CreateOrderParam param) {
|
| | | public boolean createOrder(CreateOrderParam param, Long userId) {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | |
|
| | | List<Order> orderList = this.list(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, param.getOrderNo()));
|
| | |
| | | order.setIoPri(orderUtils.getIoPri());
|
| | | order.setOrderTime(format.format(new Date()));
|
| | | order.setCreateTime(new Date());
|
| | | order.setCreateBy(9527L);
|
| | | order.setCreateBy(userId);
|
| | | order.setUpdateBy(userId);
|
| | | boolean result = this.save(order);
|
| | | if (!result) {
|
| | | throw new CoolException("生成订单失败");
|
| | |
| | | orderDetl.setMatId(mat.getId());
|
| | | orderDetl.setMemo(memo);
|
| | | orderDetl.setCreateTime(new Date());
|
| | | orderDetl.setCreateBy(9527L);
|
| | | orderDetl.setCreateBy(userId);
|
| | | orderDetl.setUpdateBy(userId);
|
| | | boolean save = orderDetlService.save(orderDetl);
|
| | | if (!save) {
|
| | | throw new CoolException("订单明细创建失败");
|
| | |
| | | return this.baseMapper.getDetlForOrderId(id, null);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 提交完结订单
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public Order doneOrder(Long id) {
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | | this.setCondition(String.valueOf(map.get("condition")));
|
| | | map.remove("condition");
|
| | | }
|
| | | if (null != map.get("orderBy")) {
|
| | | map.remove("orderBy");
|
| | | }
|
| | | this.setMap(map);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | public QueryWrapper<T> buildWrapper(Consumer<QueryWrapper<T>> consumer) {
|
| | | return this.buildWrapper(false, consumer);
|
| | | return this.buildWrapper(false, consumer, false);
|
| | | }
|
| | |
|
| | | public QueryWrapper<T> ignoreWrapper(boolean order) {
|
| | | return this.buildWrapper(false, null, order);
|
| | | }
|
| | |
|
| | | public QueryWrapper<T> buildWrapper(boolean like) {
|
| | | return this.buildWrapper(like, null);
|
| | | return this.buildWrapper(like, null, false);
|
| | | }
|
| | |
|
| | | @SuppressWarnings("all")
|
| | | public QueryWrapper<T> buildWrapper(boolean like, Consumer<QueryWrapper<T>> consumer) {
|
| | | public QueryWrapper<T> buildWrapper(boolean like, Consumer<QueryWrapper<T>> consumer, boolean order) {
|
| | | QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
| | | Map<String, Object> map = where.getMap();
|
| | | for (String key : map.keySet()) {
|
| | |
| | | }
|
| | |
|
| | | Field[] fields = null;
|
| | | if (!Cools.isEmpty(cls)) {
|
| | | if (!Cools.isEmpty(cls) && !order) {
|
| | | fields = Cools.getAllFields(cls);
|
| | | for (Field field : fields) {
|
| | | if ("id".equals(field.getName())) {
|
| | |
| | | public R page(@RequestBody Map<String, Object> map) {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<Role, BaseParam> pageParam = new PageParam<>(baseParam, Role.class);
|
| | | return R.ok().add(roleService.page(pageParam, pageParam.buildWrapper(true, (wrapper) -> wrapper.orderByAsc("create_time"))));
|
| | | return R.ok().add(roleService.page(pageParam, pageParam.buildWrapper(true, (wrapper) -> wrapper.orderByAsc("create_time"), false)));
|
| | | }
|
| | |
|
| | | @PreAuthorize("hasAuthority('system:role:list')")
|
| | |
| | | public R page(@RequestBody Map<String, Object> map) {
|
| | | BaseParam baseParam = buildParam(map, BaseParam.class);
|
| | | PageParam<User, BaseParam> pageParam = new PageParam<>(baseParam, User.class);
|
| | | return R.ok().add(userService.page(pageParam, pageParam.buildWrapper(true, wrapper -> wrapper.orderByAsc("create_time"))));
|
| | | return R.ok().add(userService.page(pageParam, pageParam.buildWrapper(true, wrapper -> wrapper.orderByAsc("create_time"), false)));
|
| | | }
|
| | |
|
| | | @PreAuthorize("hasAuthority('system:user:list')")
|