自动化立体仓库 - WMS系统
lsh
2024-06-02 138b5fc883c3ccb25f4bed7114a60f93e78aaa9a
src/main/java/com/zy/asrs/controller/OrderDetlController.java
@@ -1,5 +1,6 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -12,9 +13,7 @@
import com.zy.asrs.entity.DocType;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.DocTypeService;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.OrderService;
import com.zy.asrs.service.*;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -35,6 +34,10 @@
    @Autowired
    private OrderService orderService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private AgvLocDetlService agvLocDetlService;
    @RequestMapping(value = "/orderDetl/{id}/auth")
    @ManagerAuth
@@ -111,16 +114,50 @@
        List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1));
        List<Long> docIds = new ArrayList<>();
        for (DocType pakin : pakins) {
            docIds.add(pakin.getDocId());
            if (pakin.getDocId() != 33 && pakin.getDocId() != 34) {
                docIds.add(pakin.getDocId());
            }
        }
        EntityWrapper<Order> orderEntityWrapper = new EntityWrapper<>();
        List<Order> orders = orderService.selectList(orderEntityWrapper.in("doc_type",docIds));
        List<String> orderNos = new ArrayList<>();
        for (Order order : orders) {
            orderNos.add(order.getOrderNo());
        wrapper.in("source",docIds);
        Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(curr, limit), wrapper);
        for (OrderDetl record : page.getRecords()) {
            Double sumAnfme = agvLocDetlService.getSumAnfme(record.getMatnr(), record.getThreeCode());
            record.setStock(sumAnfme == null ? 0 : sumAnfme);
        }
        wrapper.in("order_no",orderNos);
        return R.ok(orderDetlService.selectPage(new Page<>(curr, limit), wrapper));
        return R.ok(page);
    }
    @RequestMapping(value = "/orderDetl/pakout/list/authV4")
    @ManagerAuth
    public R pakoutList4(@RequestParam(defaultValue = "1")Integer curr,
                         @RequestParam(defaultValue = "10")Integer limit,
                         @RequestParam(required = false)String orderByField,
                         @RequestParam(required = false)String orderByType,
                         @RequestParam Map<String, Object> param){
        EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convertLike(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
            wrapper.orderBy("create_time", false);
        }
        List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1));
        List<Long> docIds = new ArrayList<>();
        for (DocType pakin : pakins) {
            if (pakin.getDocId() == 34) {
                docIds.add(pakin.getDocId());
            }
        }
        wrapper.in("source",docIds);
        Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(curr, limit), wrapper);
        for (OrderDetl record : page.getRecords()) {
            Double sumAnfme = agvLocDetlService.getSumAnfme(record.getMatnr(), record.getThreeCode());
            record.setStock(sumAnfme == null ? 0 : sumAnfme);
        }
        return R.ok(page);
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){