|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.enums.SqlLike; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.Wrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import lombok.Synchronized; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.util.StopWatch; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false) String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false) String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | //StopWatch stopWatch = new StopWatch(); | 
|---|
|  |  |  | //stopWatch.start(); | 
|---|
|  |  |  | EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convertLike(param, wrapper); | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.orderBy("create_time", false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1)); | 
|---|
|  |  |  | //        List<Long> docIds = new ArrayList<>(); | 
|---|
|  |  |  | //        for (DocType pakin : pakins) { | 
|---|
|  |  |  | //            if (pakin.getDocId() != 17 && pakin.getDocId() != 33 && pakin.getDocId() != 34 && pakin.getDocId() != 35) { | 
|---|
|  |  |  | //                docIds.add(pakin.getDocId()); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | Object o = param.get("orderType"); | 
|---|
|  |  |  | if (o != null) { | 
|---|
|  |  |  | wrapper.in("source", o); | 
|---|
|  |  |  | List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1)); | 
|---|
|  |  |  | List<Long> docIds = new ArrayList<>(); | 
|---|
|  |  |  | for (DocType pakin : pakins) { | 
|---|
|  |  |  | if (pakin.getDocId() != 17 && pakin.getDocId() != 33 && pakin.getDocId() != 34 && pakin.getDocId() != 35) { | 
|---|
|  |  |  | docIds.add(pakin.getDocId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wrapper.in("source", docIds); | 
|---|
|  |  |  | Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(curr, limit), wrapper); | 
|---|
|  |  |  | for (OrderDetl record : page.getRecords()) { | 
|---|
|  |  |  | Double sumAnfme = agvLocDetlService.getSumAnfme(record.getMatnr(), record.getThreeCode()); | 
|---|
|  |  |  | record.setStock(sumAnfme == null ? 0 : sumAnfme); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //stopWatch.stop(); | 
|---|
|  |  |  | //System.out.println(stopWatch.getTotalTimeSeconds()); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | Object o = param.get("orderType"); | 
|---|
|  |  |  | if (o != null) { | 
|---|
|  |  |  | String[] split = o.toString().split(","); | 
|---|
|  |  |  | wrapper.in("source", split); | 
|---|
|  |  |  | //-1说明是半成品箱壳出库单 | 
|---|
|  |  |  | if (split[0].equals("-1")) { | 
|---|
|  |  |  | wrapper.like("order_no", "EB", SqlLike.RIGHT); | 
|---|
|  |  |  | wrapper.in("source", split); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.in("source", split); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | param.remove("orderType"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | convertLike(param, wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)) { | 
|---|
|  |  |  | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/orderDetl/pakout/list/authV8") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R pakoutList8(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false) String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false) String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convertLike(param, wrapper); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)) { | 
|---|
|  |  |  | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.orderBy("create_time", false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1)); | 
|---|
|  |  |  | List<Long> docIds = new ArrayList<>(); | 
|---|
|  |  |  | for (DocType pakin : pakins) { | 
|---|
|  |  |  | if (pakin.getDocId() == 34) { | 
|---|
|  |  |  | docIds.add(pakin.getDocId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | wrapper.in("source", docIds); | 
|---|
|  |  |  | Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(curr, limit), wrapper); | 
|---|
|  |  |  | for (OrderDetl record : page.getRecords()) { | 
|---|
|  |  |  | Double sumAnfme = agvLocDetlService.getSumAnfmeProcessed2(record.getMatnr(), record.getThreeCode()); | 
|---|
|  |  |  | record.setStock(sumAnfme == null ? 0 : sumAnfme); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/orderDetl/pakout/list/authV6") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R pakoutList6(@RequestParam(defaultValue = "1") Integer curr, | 
|---|