| | |
| | | |
| | | private void auth(String appkey, Object obj, HttpServletRequest request) { |
| | | log.info("{}接口被访问;appkey:{};请求数据:{}", "open/sensorType/list/auth/v1", appkey, JSON.toJSONString(obj)); |
| | | log.info("[auth] cache: {}", obj == null ? "null" : JSON.toJSONString(obj)); |
| | | request.setAttribute("cache", obj); |
| | | if (!auth) { |
| | | return; |
| | |
| | | |
| | | @PostMapping("/order/matSync/default/v2") |
| | | // @AppAuth(memo = "商品信息同步接口") |
| | | public synchronized R syncMatInfoV2(@RequestBody(required = false) List<MatSyncParam.MatParam> param){ |
| | | |
| | | public synchronized R syncMatInfoV2(@RequestBody(required = false) List<MatSyncParam.MatParam> param, |
| | | HttpServletRequest request) { |
| | | if (request != null) { |
| | | log.info("[syncMatInfoV2] cache: {}", param == null ? "null" : JSON.toJSONString(param)); |
| | | request.setAttribute("cache", param); |
| | | } |
| | | System.out.println(param); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | |
| | | * return |
| | | */ |
| | | @PostMapping("/station/all") |
| | | public synchronized R stationAll(){ |
| | | public synchronized R stationAll(HttpServletRequest request) { |
| | | if (request != null) { |
| | | String cachePayload = JSON.toJSONString(Collections.singletonMap("op", "stationAll")); |
| | | log.info("[stationAll] cache: {}", cachePayload); |
| | | request.setAttribute("cache", cachePayload); |
| | | } |
| | | return openService.stationAll(); |
| | | } |
| | | |
| | |
| | | * return |
| | | */ |
| | | @PostMapping("/comb/auth") |
| | | public synchronized R comb(@RequestBody ArrayList<MesToCombParam> param){ |
| | | public synchronized R comb(@RequestBody ArrayList<MesToCombParam> param, HttpServletRequest request) { |
| | | if (request != null) { |
| | | log.info("[comb] cache: {}", param == null ? "null" : JSON.toJSONString(param)); |
| | | request.setAttribute("cache", param); |
| | | } |
| | | List<MesToCombParam> errorComb = Lists.newArrayList(); |
| | | List<MesToCombParam> validComb = Lists.newArrayList(); |
| | | for (MesToCombParam mesToCombParam : param) { |
| | |
| | | if (Cools.isEmpty(params)) { |
| | | return R.error("请求参数不能为空"); |
| | | } |
| | | log.info("[outOrder] cache: {}", JSON.toJSONString(params)); |
| | | request.setAttribute("cache", params); |
| | | Set<String> orderIds = new LinkedHashSet<>(); |
| | | for (OutTaskParam outTaskParam : params) { |
| | |
| | | // } |
| | | // } |
| | | |
| | | List<OutTaskParam> errorOutOrders = Lists.newArrayList(); |
| | | List<OutTaskParam> validOutOrders = Lists.newArrayList(); |
| | | List<OutTaskParam> missingStock = Lists.newArrayList(); |
| | | List<OutTaskParam> missingLoc = Lists.newArrayList(); |
| | | for (OutTaskParam outTaskParam : params) { |
| | | // TODO:待測試,校驗庫存信息,不存在則返回 |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", outTaskParam.getPalletId())); |
| | | if (countLoc == 0){ |
| | | errorOutOrders.add(outTaskParam); |
| | | if (countLoc == 0) { |
| | | missingStock.add(outTaskParam); |
| | | continue; |
| | | } |
| | | validOutOrders.add(outTaskParam); |
| | | } |
| | | for (OutTaskParam outTaskParam : validOutOrders) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F").eq("barcode", outTaskParam.getPalletId())); |
| | | if (locMast == null) { |
| | | throw new CoolException("没有找到托盘码=" + outTaskParam.getPalletId() + "对应的库位"); |
| | | missingLoc.add(outTaskParam); |
| | | } |
| | | } |
| | | |
| | | for (OutTaskParam outTaskParam : validOutOrders) { |
| | | R r = openService.outOrder(outTaskParam,validOutOrders.size()); |
| | | if (!r.get("code").equals(200)){ |
| | | return r; |
| | | if (!missingStock.isEmpty()) { |
| | | List<String> missingPalletIds = new ArrayList<>(missingStock.size()); |
| | | for (OutTaskParam p : missingStock) { |
| | | String pid = p.getPalletId(); |
| | | missingPalletIds.add(Cools.isEmpty(pid) ? "(空)" : pid); |
| | | } |
| | | return R.error("库存中不存在该托盘:" + String.join(",", missingPalletIds)).add(missingStock); |
| | | } |
| | | if(errorOutOrders.size() > 0) { |
| | | return R.error("库存中不存在该托盘").add(errorOutOrders); |
| | | if (!missingLoc.isEmpty()) { |
| | | List<String> badPalletIds = new ArrayList<>(missingLoc.size()); |
| | | for (OutTaskParam p : missingLoc) { |
| | | String pid = p.getPalletId(); |
| | | badPalletIds.add(Cools.isEmpty(pid) ? "(空)" : pid); |
| | | } |
| | | return R.error("没有找到托盘码对应库位:" + String.join(",", badPalletIds)).add(missingLoc); |
| | | } |
| | | |
| | | return R.ok(); |
| | | return openService.outOrderBatch(params); |
| | | } |
| | | |
| | | /** |
| | | * pause out order |
| | | */ |
| | | @PostMapping("/order/pakout/pause/default/v1") |
| | | public synchronized R pakoutOrderPause(@RequestBody OpenOrderPakoutPauseParam param){ |
| | | public synchronized R pakoutOrderPause(@RequestBody OpenOrderPakoutPauseParam param, HttpServletRequest request) { |
| | | if (request != null) { |
| | | log.info("[pakoutOrderPause] cache: {}", param == null ? "null" : JSON.toJSONString(param)); |
| | | request.setAttribute("cache", param); |
| | | } |
| | | if (Cools.isEmpty(param) || Cools.isEmpty(param.getOrderId())) { |
| | | return R.error("orderNo is empty"); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 近24小时入出库折线(横轴小时),与按日 {@link #locIoLineCharts()} 数据口径不同,供电视机「作业效率」使用 |
| | | */ |
| | | @GetMapping("/line/charts/hourly") |
| | | public R locIoLineChartsHourly() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<AxisBean> list = new ArrayList<>(); |
| | | |
| | | List<WorkChartAxis> listChart = reportQueryMapper.getChartAxisHourly(); |
| | | if (listChart == null) { |
| | | listChart = Collections.emptyList(); |
| | | } |
| | | |
| | | ArrayList<Integer> data1 = new ArrayList<>(); |
| | | ArrayList<Integer> data2 = new ArrayList<>(); |
| | | List<String> categories = new ArrayList<>(); |
| | | |
| | | SimpleDateFormat sfKey = new SimpleDateFormat("yyyy-MM-dd HH"); |
| | | SimpleDateFormat sfLabel = new SimpleDateFormat("HH:00"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.add(Calendar.HOUR_OF_DAY, -23); |
| | | |
| | | for (int i = 0; i < 24; i++) { |
| | | String key = sfKey.format(calendar.getTime()); |
| | | categories.add(sfLabel.format(calendar.getTime())); |
| | | |
| | | int inV = 0; |
| | | int outV = 0; |
| | | for (WorkChartAxis w : listChart) { |
| | | if (w.getYmd() != null && key.equals(w.getYmd().trim())) { |
| | | inV = w.getInqty(); |
| | | outV = w.getOutqty(); |
| | | break; |
| | | } |
| | | } |
| | | data1.add(inV); |
| | | data2.add(outV); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 1); |
| | | } |
| | | |
| | | AxisBean inqty = new AxisBean(); |
| | | inqty.setName("入库数量"); |
| | | Integer[] array1 = new Integer[data1.size()]; |
| | | inqty.setData(data1.toArray(array1)); |
| | | list.add(inqty); |
| | | |
| | | AxisBean outqty = new AxisBean(); |
| | | outqty.setName("出库数量"); |
| | | Integer[] array2 = new Integer[data2.size()]; |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | |
| | | map.put("categories", categories); |
| | | map.put("rows", list); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 库存信息查询接口 |
| | | */ |
| | | @GetMapping("/queryLoc") |
| | |
| | | * 任务查询接口 |
| | | */ |
| | | @PostMapping("/queryTask") |
| | | public synchronized R queryTask(@RequestBody QueryTaskParam param) { |
| | | public synchronized R queryTask(@RequestBody QueryTaskParam param, HttpServletRequest request) { |
| | | if (request != null) { |
| | | log.info("[queryTask] cache: {}", param == null ? "null" : JSON.toJSONString(param)); |
| | | request.setAttribute("cache", param); |
| | | } |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |