自动化立体仓库 - WMS系统
#
zjj
2024-09-23 539d9ffc477d28a23a923b41fdeabc8c37c99ce6
src/main/java/com/zy/asrs/controller/OrderDetlController.java
@@ -9,8 +9,10 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.OrderService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -25,6 +27,8 @@
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private OrderService orderService;
    @RequestMapping(value = "/orderDetl/{id}/auth")
    @ManagerAuth
@@ -45,8 +49,75 @@
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
            wrapper.orderBy("create_time", false);
        }
        wrapper.eq("status", 0);
        wrapper.eq("status", 1);
        return R.ok(orderDetlService.selectPage(new Page<>(curr, limit), wrapper));
    }
    @RequestMapping(value = "/orderDetl/out/list")
    @ManagerAuth
    public R out(@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);
        convert(param, wrapper);
        List<Order> orders = orderService.selectInOrOutOrders(false);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
            wrapper.orderBy("create_time", false);
        }
        if (Cools.isEmpty(orders)) {
            return R.ok(new  Page<OrderDetl>());
        }else {
            for (Order order : orders) {
                wrapper.or();
                wrapper.eq("order_no",order.getOrderNo());
            }
        }
        wrapper.eq("status", 1);
        return R.ok(orderDetlService.selectPage(new Page<>(curr, limit), wrapper));
    }
    @RequestMapping(value = "/orderDetl/in/list")
    @ManagerAuth
    public R in(@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);
        convert(param, wrapper);
        List<Order> orders = orderService.selectInOrOutOrders(true);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
            wrapper.orderBy("create_time", false);
        }
        if (Cools.isEmpty(orders)) {
            return R.ok(new  Page<OrderDetl>());
        }else {
            for (Order order : orders) {
                wrapper.or();
                wrapper.eq("order_no",order.getOrderNo());
            }
        }
        wrapper.eq("status", 1);
        Page<OrderDetl> orderDetlPage = orderDetlService.selectPage(new Page<>(curr, limit), wrapper);
        return R.ok(orderDetlPage);
    }
    @RequestMapping(value = "/orderDetl/pakout/list/auth")
    @ManagerAuth
    public R pakoutList(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam Map<String, Object> param){
        return R.ok(orderDetlService.getPakoutPage(toPage(curr, limit, param, OrderDetl.class)));
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
@@ -57,7 +128,7 @@
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            } else {
                wrapper.like(entry.getKey(), val);
                wrapper.eq(entry.getKey(), val);
            }
        }
    }
@@ -102,14 +173,25 @@
    @RequestMapping(value = "/orderDetlQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        if(condition.split(",").length < 2){
            return R.ok();
        }
        String maktxCondition = condition.split(",")[0];
        Long orderId = Long.parseLong(condition.split(",")[1]);
        EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>();
        wrapper.like("id", condition);
        wrapper.eq("order_id",orderId);
        wrapper.like("maktx", maktxCondition);
        Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (OrderDetl orderDetl : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", orderDetl.getId());
            map.put("value", orderDetl.getId());
            map.put("value", orderDetl.getMaktx());
            map.put("weight",orderDetl.getAnfme() - orderDetl.getWorkQty());
            map.put("type","orderDetl");
            result.add(map);
        }
        return R.ok(result);