|  |  |  | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.*; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.Mat; | 
|---|
|  |  |  | import com.zy.asrs.entity.MatPrint; | 
|---|
|  |  |  | import com.zy.asrs.entity.OrderDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.LocOutAnfmePrintPara; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.KeyValueVo; | 
|---|
|  |  |  | import com.zy.asrs.service.LocInPrintMatService; | 
|---|
|  |  |  | import com.zy.asrs.service.LocOutPrintMatService; | 
|---|
|  |  |  | import com.zy.asrs.service.MatService; | 
|---|
|  |  |  | import com.zy.asrs.service.PakoutService; | 
|---|
|  |  |  | import com.zy.asrs.utils.MatExcelListener; | 
|---|
|  |  |  | import com.zy.common.CodeRes; | 
|---|
|  |  |  | import com.zy.common.config.AdminInterceptor; | 
|---|
|  |  |  | 
|---|
|  |  |  | private MatService matService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SnowflakeIdWorker snowflakeIdWorker; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PakoutService pakoutService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocInPrintMatService locInPrintMatService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocOutPrintMatService locOutPrintMatService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/mat/auto/matnr/auth") | 
|---|
|  |  |  | public R autoMatnr(){ | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/mat/list/pda/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R pdaList(@RequestParam(required = true)Long tagId){ | 
|---|
|  |  |  | public R pdaList(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "20")Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param, | 
|---|
|  |  |  | @RequestParam(required = true) Long tagId){ | 
|---|
|  |  |  | EntityWrapper<Mat> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | wrapper.eq("tag_id", tagId); | 
|---|
|  |  |  | wrapper.orderBy("create_time", false); | 
|---|
|  |  |  | List<Mat> mats = matService.selectList(wrapper); | 
|---|
|  |  |  | return R.ok().add(mats); | 
|---|
|  |  |  | //        wrapper.eq("tag_id", tagId); | 
|---|
|  |  |  | //        wrapper.orderBy("create_time", false); | 
|---|
|  |  |  | Page<Mat> matPage = toPage(curr, limit, param, Mat.class); | 
|---|
|  |  |  | Page<Mat> page = matService.selectAllPage(matPage); | 
|---|
|  |  |  | // List<Mat> mats = matService.selectList(wrapper); | 
|---|
|  |  |  | return R.ok().add(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/mat/search/pda/auth") | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(matService.selectById(String.valueOf(id))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/matCode/auth0") | 
|---|
|  |  |  | @RequestMapping(value = "/mat/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R find(@RequestParam("matnr") String matnr) { | 
|---|
|  |  |  | return R.ok(matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr))); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | OrderDetl orderDetl = new OrderDetl(); | 
|---|
|  |  |  | orderDetl.sync(orderDetl); | 
|---|
|  |  |  | orderDetl.sync(mat); | 
|---|
|  |  |  | orderDetl.setAnfme(0.0D); | 
|---|
|  |  |  | return R.ok().add(orderDetl); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/pakOut/show") | 
|---|
|  |  |  | public R showQR(){ | 
|---|
|  |  |  | List<Pakout> manPakOuts = pakoutService.selectList(null); | 
|---|
|  |  |  | return R.ok(manPakOuts); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /*************************************** 打印相关 ***********************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok().add(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 打印 | 
|---|
|  |  |  | @RequestMapping(value = "/loc/in/mat/print/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "商品编码打印") | 
|---|
|  |  |  | public R locInMatCodePrint(@RequestParam(value = "param[]") Long[] ids) { | 
|---|
|  |  |  | if(Cools.isEmpty(ids)) { | 
|---|
|  |  |  | return R.parse(CodeRes.EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<MatPrint> res = new ArrayList<>(); | 
|---|
|  |  |  | for (Long id : ids){ | 
|---|
|  |  |  | LocInPrintMat locInPrintMat = locInPrintMatService.selectById(id); | 
|---|
|  |  |  | // 打印数据注入 | 
|---|
|  |  |  | MatPrint print = new MatPrint(); | 
|---|
|  |  |  | print.setMatnr(locInPrintMat.getMatnr()); | 
|---|
|  |  |  | print.setMaktx(locInPrintMat.getMaktx()); | 
|---|
|  |  |  | print.setBatch(locInPrintMat.getBatch()); | 
|---|
|  |  |  | print.setAnfme(locInPrintMat.getAnfme()); | 
|---|
|  |  |  | print.setLocNo(locInPrintMat.getLocNo()); | 
|---|
|  |  |  | print.setOwnerId(locInPrintMat.getOwnerId()); | 
|---|
|  |  |  | print.setOwner(locInPrintMat.getOwner$()); | 
|---|
|  |  |  | print.setId(locInPrintMat.getId()); | 
|---|
|  |  |  | res.add(print); | 
|---|
|  |  |  | locInPrintMat.setUpdateTime(new Date()); | 
|---|
|  |  |  | locInPrintMat.setUpdateBy(getUserId()); | 
|---|
|  |  |  | locInPrintMat.setStatus(2); | 
|---|
|  |  |  | locInPrintMatService.updateById(locInPrintMat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 打印 | 
|---|
|  |  |  | @RequestMapping(value = "/loc/out/mat/print/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "商品编码打印") | 
|---|
|  |  |  | public R locOutMatCodePrint(@RequestParam(value = "param[]") Long[] ids) { | 
|---|
|  |  |  | if(Cools.isEmpty(ids)) { | 
|---|
|  |  |  | return R.parse(CodeRes.EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<MatPrint> res = new ArrayList<>(); | 
|---|
|  |  |  | List<String> memoList = new ArrayList<>(); | 
|---|
|  |  |  | for (Long id : ids){ | 
|---|
|  |  |  | LocOutPrintMat locOutPrintMat = locOutPrintMatService.selectById(id); | 
|---|
|  |  |  | // 打印数据注入 | 
|---|
|  |  |  | MatPrint print = new MatPrint(); | 
|---|
|  |  |  | print.setMatnr(locOutPrintMat.getMatnr()); | 
|---|
|  |  |  | print.setMaktx(locOutPrintMat.getMaktx()); | 
|---|
|  |  |  | print.setBatch(locOutPrintMat.getBatch()); | 
|---|
|  |  |  | print.setAnfme(locOutPrintMat.getAnfme()); | 
|---|
|  |  |  | print.setOwnerId(locOutPrintMat.getOwnerId()); | 
|---|
|  |  |  | print.setOwner(locOutPrintMat.getOwner$()); | 
|---|
|  |  |  | print.setId(locOutPrintMat.getId()); | 
|---|
|  |  |  | res.add(print); | 
|---|
|  |  |  | print.setMemo(print.getMatnr()+";"+print.getBatch()+";"+print.getOwnerId()); | 
|---|
|  |  |  | if (!memoList.contains(print.getMemo())){ | 
|---|
|  |  |  | memoList.add(print.getMemo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | locOutPrintMat.setUpdateTime(new Date()); | 
|---|
|  |  |  | locOutPrintMat.setUpdateBy(getUserId()); | 
|---|
|  |  |  | locOutPrintMat.setStatus(2); | 
|---|
|  |  |  | locOutPrintMatService.updateById(locOutPrintMat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<LocOutAnfmePrintPara> locOutAnfmePrintParaList = new ArrayList<>(); | 
|---|
|  |  |  | for (String memo : memoList){ | 
|---|
|  |  |  | LocOutAnfmePrintPara locOutAnfmePrintPara = new LocOutAnfmePrintPara(); | 
|---|
|  |  |  | int signInt = 0; | 
|---|
|  |  |  | Double[] anfme = new Double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; | 
|---|
|  |  |  | for (MatPrint matPrint:res){ | 
|---|
|  |  |  | if (!memo.equals(matPrint.getMemo())){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (signInt==0){ | 
|---|
|  |  |  | locOutAnfmePrintPara.setMatnr(matPrint.getMatnr()); | 
|---|
|  |  |  | locOutAnfmePrintPara.setBatch(matPrint.getBatch()); | 
|---|
|  |  |  | locOutAnfmePrintPara.setOwner(matPrint.getOwner()); | 
|---|
|  |  |  | locOutAnfmePrintPara.setOwnerId(matPrint.getOwnerId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (signInt<17){ | 
|---|
|  |  |  | anfme[signInt] = matPrint.getAnfme(); | 
|---|
|  |  |  | signInt++; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | locOutAnfmePrintPara.setAnfme(anfme); | 
|---|
|  |  |  | locOutAnfmePrintParaList.add(locOutAnfmePrintPara); | 
|---|
|  |  |  | locOutAnfmePrintPara = new LocOutAnfmePrintPara(); | 
|---|
|  |  |  | locOutAnfmePrintPara.setMatnr(matPrint.getMatnr()); | 
|---|
|  |  |  | locOutAnfmePrintPara.setBatch(matPrint.getBatch()); | 
|---|
|  |  |  | locOutAnfmePrintPara.setOwner(matPrint.getOwner()); | 
|---|
|  |  |  | locOutAnfmePrintPara.setOwnerId(matPrint.getOwnerId()); | 
|---|
|  |  |  | signInt = 0; | 
|---|
|  |  |  | anfme = new Double[]{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; | 
|---|
|  |  |  | anfme[signInt] = matPrint.getAnfme(); | 
|---|
|  |  |  | signInt++; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | locOutAnfmePrintPara.setAnfme(anfme); | 
|---|
|  |  |  | locOutAnfmePrintParaList.add(locOutAnfmePrintPara); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(locOutAnfmePrintParaList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /*************************************** 数据相关 ***********************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | for (Mat mat : mats) { | 
|---|
|  |  |  | KeyValueVo vo = new KeyValueVo(); | 
|---|
|  |  |  | vo.setName(mat.getMatnr() + " - " + mat.getMaktx()); | 
|---|
|  |  |  | vo.setValue(mat.getId()); | 
|---|
|  |  |  | vo.setValue(mat.getMatnr()); | 
|---|
|  |  |  | valueVos.add(vo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(valueVos); | 
|---|