|  |  | 
 |  |  | import com.core.common.DateUtils; | 
 |  |  | import com.core.common.R; | 
 |  |  | import com.zy.asrs.entity.LocDetl; | 
 |  |  | import com.zy.asrs.entity.ManLocDetl; | 
 |  |  | import com.zy.asrs.entity.Mat; | 
 |  |  | import com.zy.asrs.entity.param.ProductCalibrationExcelParam; | 
 |  |  | import com.zy.asrs.importexcle.LocMat; | 
 |  |  | import com.zy.asrs.importexcle.LocMatListener; | 
 |  |  | import com.zy.asrs.importexcle.ProductCalibrationImportListener; | 
 |  |  | import com.zy.asrs.mapper.LocDetlMapper; | 
 |  |  | import com.zy.asrs.service.LocDetlService; | 
 |  |  | import com.zy.asrs.service.ManLocDetlService; | 
 |  |  | import com.zy.asrs.service.LocMastService; | 
 |  |  | import com.zy.asrs.service.MatService; | 
 |  |  | import com.zy.common.web.BaseController; | 
 |  |  | import org.apache.ibatis.session.SqlSessionFactory; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  | import org.springframework.web.multipart.MultipartFile; | 
 |  |  |  | 
 |  |  | import javax.annotation.Resource; | 
 |  |  | import javax.servlet.http.HttpServletResponse; | 
 |  |  | import java.io.IOException; | 
 |  |  | import java.net.URLEncoder; | 
 |  |  | 
 |  |  |     private LocDetlMapper locDetlMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private MatService matService; | 
 |  |  |  | 
 |  |  |     @Resource | 
 |  |  |     private LocMastService locMastService; | 
 |  |  |  | 
 |  |  |     @Resource | 
 |  |  |     private SqlSessionFactory sqlSessionFactory; | 
 |  |  |  | 
 |  |  |     @PostMapping("/importLocData") | 
 |  |  |     @ManagerAuth(memo = "导入立库已有库存") | 
 |  |  |     public R importLocData(@RequestParam("file") MultipartFile multipartFile) { | 
 |  |  |         try { | 
 |  |  |             importLocData1(multipartFile); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |             return R.error(e.getMessage()); | 
 |  |  |         } | 
 |  |  |         return R.ok("导入成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/productCalibration") | 
 |  |  |     @ManagerAuth(memo = "产品校验导入excel方式") | 
 |  |  |     public R productCalibration(@RequestParam("file") MultipartFile multipartFile) { | 
 |  |  |         try { | 
 |  |  |             productCalibrationExcel(multipartFile); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |             return R.error(e.getMessage()); | 
 |  |  |         } | 
 |  |  |         return R.ok("导入成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/getLocDateByLocNo") | 
 |  |  |     @ManagerAuth(memo = "根据包装组号提取一整箱库存") | 
 |  |  |     public R getLocDateByLocNo(@RequestBody List<String> packageNoList) { | 
 |  |  |  | 
 |  |  |         List<LocDetl> locDetls = locDetlMapper.selectList(new EntityWrapper<LocDetl>().in("brand", packageNoList)); | 
 |  |  |  | 
 |  |  |         return R.ok(locDetls); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/getBoxLocDateByLocNo") | 
 |  |  |     @ManagerAuth(memo = "根据包装组号提取一整箱库存") | 
 |  |  |     public R getBoxLocDateByLocNo(@RequestBody List<String> packageNoList) { | 
 |  |  |  | 
 |  |  |         List<LocDetl> locDetls = locDetlMapper.selectList(new EntityWrapper<LocDetl>().in("loc_no", packageNoList)); | 
 |  |  |  | 
 |  |  |         return R.ok(locDetls); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public void importLocData1(MultipartFile multipartFile) throws IOException { | 
 |  |  |         EasyExcel.read(multipartFile.getInputStream(), LocMat.class, | 
 |  |  |                 new LocMatListener(locMastService,locDetlMapper,getUserId())).sheet().doReadSync(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public void productCalibrationExcel(MultipartFile multipartFile) throws IOException { | 
 |  |  |         EasyExcel.read(multipartFile.getInputStream(), ProductCalibrationExcelParam.class, | 
 |  |  |                 new ProductCalibrationImportListener(sqlSessionFactory)).sheet().doReadSync(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/locDetl/update") | 
 |  |  |     public R update1() { | 
 |  |  | 
 |  |  |         return R.ok(stockOut); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/stock/boxOut/list/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R boxOut(@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.put("matnr","空箱"); | 
 |  |  |         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")// /locDetl/list/auth 接口问题 | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R list(@RequestParam(defaultValue = "1")Integer curr, |