| | |
| | | private LocOwnerService locOwnerService; |
| | | @Autowired |
| | | private OrderDetlPakinService orderDetlPakinService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @RequestMapping(value = "/order/nav/list/auth") |
| | | @ManagerAuth |
| | |
| | | if (Cools.isEmpty(orderNo)) { |
| | | return R.error("订单号不能为空"); |
| | | } |
| | | List<OrderDetlPakin> detls = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>() |
| | | .eq("order_no", orderNo) |
| | | .eq("status", 1)); |
| | | if (detls == null || detls.isEmpty()) { |
| | | return R.error("未找到对应明细"); |
| | | } |
| | | List<String> errorMessages = new ArrayList<>(); |
| | | final double LENGTH_MIN = 315, LENGTH_MAX = 1150; |
| | | final double WIDTH_MIN = 160, WIDTH_MAX = 730; |
| | | final double HEIGHT_MIN = 140, HEIGHT_MAX = 810; |
| | | final double WIEGHT_MIN = 0, WIEGHT_MAX = 23; |
| | | for (OrderDetlPakin detl : detls) { |
| | | 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(); |
| | | Double wet = mat.getWeight(); |
| | | 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 (wet == null || wet < WIEGHT_MIN || wet > WIEGHT_MAX) { |
| | | errorMessages.add(String.format("物料 %s 毛重异常:必须 %.0f~%.0f kg,当前 %s", |
| | | detl.getMatnr(), WIEGHT_MIN, WIEGHT_MAX, wet)); |
| | | } |
| | | } |
| | | if (!errorMessages.isEmpty()) { |
| | | return R.error(String.join(";\n", errorMessages)); |
| | | } |
| | | if (!orderDetlPakinService.issueAll(orderNo)) { |
| | | return R.error("下发明细更新失败"); |
| | | } |
| | | orderService.updateOrderStatus(orderNo); |
| | | if (!orderService.updateOrderStatus(orderNo)) { |
| | | throw new CoolException("订单状态更新失败"); |
| | | } |
| | | return R.ok("成功").add("成功"); |
| | | } |
| | | |