自动化立体仓库 - WMS系统
lty
1 天以前 f08dd93e49e8461f362c8f45f17fe10e0fbdebec
src/main/java/com/zy/asrs/controller/OrderDetlPakinController.java
@@ -9,16 +9,16 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.OrderDetlPakin;
import com.zy.asrs.entity.param.ReportOrderBatchDetlParam;
import com.zy.asrs.service.MatService;
import com.zy.asrs.service.OrderDetlPakinService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@RestController
@RequestMapping("order/pakin")
@@ -26,6 +26,9 @@
    @Autowired
    private OrderDetlPakinService orderDetlService;
    @Autowired
    private MatService matService;
    @RequestMapping(value = "/orderDetl/{id}/auth")
    @ManagerAuth
@@ -72,6 +75,75 @@
        }
    }
    @RequestMapping(value = "/orderDetl/batch/report/auth")
    @ManagerAuth(memo = "修改下发项")
    public R reportBatch(ReportOrderBatchDetlParam param) {
        if (param.getAnfme() < 1 && param.getInspect() == 1) {
            return R.error("下发数量不能小于1");
        }
        List<String> errorMessages = new ArrayList<>();
        List<OrderDetlPakin> list = orderDetlService.selectList(
                new EntityWrapper<OrderDetlPakin>()
                        .eq("order_no", param.getOrderNo())
                        .eq("id", param.getId())
        );
        if (list.isEmpty()) {
            return R.error("未找到对应的下发记录");
        }
        final double LENGTH_MIN = 315, LENGTH_MAX = 1150;
        final double WIDTH_MIN = 160, WIDTH_MAX = 730;
        final double HEIGHT_MIN = 140, HEIGHT_MAX = 810;
        for (OrderDetlPakin detl : list) {
            Mat mat = matService.selectOne(
                    new EntityWrapper<Mat>().eq("matnr", detl.getMatnr())
            );
            if (mat == null) {
                errorMessages.add("物料编号 " + detl.getMatnr() + " 不存在");
                continue;
            }
            Double len = mat.getManLength();
            Double wid = mat.getWidth();
            Double hei = mat.getHeight();
            if (len == null || len < LENGTH_MIN || len > LENGTH_MAX) {
                errorMessages.add(String.format("物料 %s 长度异常:必须 %.0f~%.0f mm,当前 %s",
                        detl.getMatnr(), LENGTH_MIN, LENGTH_MAX, len));
            }
            if (wid == null || wid < WIDTH_MIN || wid > WIDTH_MAX) {
                errorMessages.add(String.format("物料 %s 宽度异常:必须 %.0f~%.0f mm,当前 %s",
                        detl.getMatnr(), WIDTH_MIN, WIDTH_MAX, wid));
            }
            if (hei == null || hei < HEIGHT_MIN || hei > HEIGHT_MAX) {
                errorMessages.add(String.format("物料 %s 高度异常:必须 %.0f~%.0f mm,当前 %s",
                        detl.getMatnr(), HEIGHT_MIN, HEIGHT_MAX, hei));
            }
        }
        if (!errorMessages.isEmpty()) {
            // Choose one style:
            return R.error(String.join(";\n", errorMessages));
            // or
            // R r = R.error("尺寸校验失败,请检查以下问题:");
            // r.put("errors", errorMessages);
            // return r;
        }
        // all good → update
        for (OrderDetlPakin detl : list) {
            detl.setInspect(param.getInspect());
            detl.setSortingAnfme(param.getAnfme());
            orderDetlService.updateById(detl);
        }
        return R.ok("修改成功");
    }
    @RequestMapping(value = "/orderDetl/add/auth")
    @ManagerAuth
    public R add(OrderDetlPakin orderDetl) {