| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private OrderDetlPakinService orderDetlService; |
| | | |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @RequestMapping(value = "/orderDetl/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestMapping(value = "/orderDetl/batch/report/auth") |
| | | @ManagerAuth(memo = "修改下发项") |
| | | public R reportBatch(ReportOrderBatchDetlParam param) { |
| | | if (param.getAnfme()<1 && param.getInspect()==1){ |
| | | return R.error("下发数量不能小于1").add("下发数量不能小于1"); |
| | | if (param.getAnfme() < 1 && param.getInspect() == 1) { |
| | | return R.error("下发数量不能小于1"); |
| | | } |
| | | List<OrderDetlPakin> orderDetlPakinList = orderDetlService.selectList(new EntityWrapper<OrderDetlPakin>() |
| | | .eq("order_no", param.getOrderNo()).eq("id", param.getId()) |
| | | |
| | | List<String> errorMessages = new ArrayList<>(); |
| | | |
| | | List<OrderDetlPakin> list = orderDetlService.selectList( |
| | | new EntityWrapper<OrderDetlPakin>() |
| | | .eq("order_no", param.getOrderNo()) |
| | | .eq("id", param.getId()) |
| | | ); |
| | | for (OrderDetlPakin orderDetl : orderDetlPakinList){ |
| | | orderDetl.setInspect(param.getInspect()); |
| | | orderDetl.setSortingAnfme(param.getAnfme()); |
| | | orderDetlService.updateById(orderDetl); |
| | | |
| | | if (list.isEmpty()) { |
| | | return R.error("未找到对应的下发记录"); |
| | | } |
| | | return R.ok(); |
| | | |
| | | 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") |