From 49dfa451ed700fe0d845be9f36d2b4302aff92be Mon Sep 17 00:00:00 2001 From: zc <zc@123> Date: 星期六, 19 四月 2025 17:57:16 +0800 Subject: [PATCH] qw --- src/main/java/com/zy/asrs/controller/LocDetlController.java | 72 +++++++++++++++++++++++++++++------- 1 files changed, 58 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java index eaa6577..0769dab 100644 --- a/src/main/java/com/zy/asrs/controller/LocDetlController.java +++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java @@ -17,6 +17,7 @@ import com.zy.asrs.mapper.LocDetlMapper; import com.zy.asrs.service.LocDetlService; import com.zy.asrs.service.MatService; +import com.zy.common.utils.RoleUtils; import com.zy.common.web.BaseController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -31,6 +32,7 @@ @Autowired private LocDetlService locDetlService; + @Autowired private LocDetlMapper locDetlMapper; @Autowired @@ -80,25 +82,48 @@ param.remove("modi_time"); } } - return R.ok(locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class))); + Page<LocDetl> stockOut = locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class)); + if (stockOut.getRecords().size()==0){ + stockOut = locDetlService.getStockOut(toPage(1, limit, param, LocDetl.class)); + } + return R.ok(stockOut); } - @RequestMapping(value = "/locDetl/list/auth") + @RequestMapping(value = "/stock/out/crn/list/auth") + @ManagerAuth + public R crnStockOutList(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @RequestParam Map<String, Object> param){ + if (!Cools.isEmpty(param.get("modi_time"))){ + String val = String.valueOf(param.get("modi_time")); + if (val.contains(RANGE_TIME_LINK)) { + String[] dates = val.split(RANGE_TIME_LINK); + param.put("startTime", DateUtils.convert(dates[0])); + param.put("endTime", DateUtils.convert(dates[1])); + param.remove("modi_time"); + } + } + param.remove("curr"); + param.remove("limit"); + EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); + convert(param, wrapper); + wrapper.addFilter("LEFT(loc_no,2)>=1 and LEFT(loc_no,2)<=16"); +// Page<LocDetl> stockOut = locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class)); + Page<LocDetl> locDetlPage = locDetlService.selectPage(new Page<>(curr, limit), wrapper); + if (locDetlPage.getRecords().size()==0){ + locDetlPage = locDetlService.selectPage(new Page<>(1, limit), wrapper); + } + return R.ok(locDetlPage); + } + + @RequestMapping(value = "/locDetl/list/auth")// /locDetl/list/auth 鎺ュ彛闂 @ManagerAuth public R list(@RequestParam(defaultValue = "1")Integer curr, @RequestParam(defaultValue = "10")Integer limit, @RequestParam(required = false)String orderByField, @RequestParam(required = false)String orderByType, @RequestParam(required = false)String condition, - @RequestParam Map<String, Object> param, - @RequestParam(required = false)Boolean unreason){ - if (unreason) { - - return R.ok(locDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<LocDetl>() - .where(" DATALENGTH( batch ) != 11 or\n" + - " batch LIKE '%[a-z]%'"))); - } - param.remove("unreason"); + @RequestParam Map<String, Object> param){ // String row = ""; EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); // if (param.get("row") != null) { @@ -114,14 +139,16 @@ excludeTrash(param); convert(param, wrapper); allLike(LocDetl.class, param.keySet(), wrapper, condition); + // 涓嶅悓缁ф壙瑙掕壊鏄剧ず涓嶅悓搴撲俊鎭� + RoleUtils.addRoleWrapperByLocNo(getUserId(),wrapper); if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} // if (!row.equals("")){ // wrapper.and() // .where("loc_no like '" +row +"%'"); // } - return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); } + private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ for (Map.Entry<String, Object> entry : map.entrySet()){ @@ -271,8 +298,25 @@ * @return */ @RequestMapping("/locDetl/count") - public R getAllCount(){ - Integer sum = locDetlService.sum(); + public R getAllCount() { + Double sum = locDetlService.sum(); + return R.ok(sum); + } + + /** + * 鑾峰彇搴撳瓨鎬绘暟 + * @return + */ + @RequestMapping("/locDetl/matnr/count") + public R getCount(@RequestBody Map<String, String> param){ + String matnr = param.get("matnr"); + Double sum = 0.0; + if (Cools.isEmpty(matnr)){ + sum = locDetlService.sum(); + }else { + sum = locDetlService.getSumAnfme(matnr); + } + return R.ok(sum); } -- Gitblit v1.9.1