You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1209 lines
44 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. package com.ccl.tt.controller;
  2. import com.ccl.tt.dao.BasicDao;
  3. import com.ccl.tt.dao.FinalRollDao;
  4. import com.ccl.tt.data.PartData;
  5. import com.ccl.tt.entity.*;
  6. import com.ccl.tt.repository.*;
  7. import com.ccl.tt.service.MailSendService;
  8. import com.ccl.tt.service.PrepressService;
  9. import com.ccl.tt.utils.*;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.beans.factory.annotation.Value;
  14. import org.springframework.beans.propertyeditors.CustomDateEditor;
  15. import org.springframework.core.io.FileSystemResource;
  16. import org.springframework.dao.DataIntegrityViolationException;
  17. import org.springframework.data.domain.Page;
  18. import org.springframework.data.domain.PageRequest;
  19. import org.springframework.data.domain.Sort;
  20. import org.springframework.data.repository.query.Param;
  21. import org.springframework.jdbc.core.JdbcTemplate;
  22. import org.springframework.security.core.Authentication;
  23. import org.springframework.security.core.context.SecurityContextHolder;
  24. import org.springframework.stereotype.Controller;
  25. import org.springframework.transaction.annotation.Transactional;
  26. import org.springframework.util.StringUtils;
  27. import org.springframework.web.bind.WebDataBinder;
  28. import org.springframework.web.bind.annotation.*;
  29. import javax.persistence.criteria.Predicate;
  30. import javax.servlet.ServletOutputStream;
  31. import javax.servlet.http.HttpServletResponse;
  32. import java.io.*;
  33. import java.sql.Timestamp;
  34. import java.text.SimpleDateFormat;
  35. import java.util.*;
  36. import java.util.regex.Pattern;
  37. import java.util.zip.ZipEntry;
  38. import java.util.zip.ZipOutputStream;
  39. @Controller
  40. @RequestMapping("/prepress")
  41. public class PrePressController {
  42. private static Logger logger = LoggerFactory.getLogger(PrePressController.class);
  43. @Autowired
  44. private FinalRollDao finalRollDao;
  45. @Autowired
  46. private ShipmentRepository shipRepo;
  47. @Autowired
  48. private ProjectCodeRepository pjcRepo;
  49. @Autowired
  50. private MailSendService mailSendService;
  51. @Value("${com.ftp.ftpHost}")
  52. private String ftpHost;
  53. @Value("${com.ftp.ftpPort}")
  54. private Integer ftpPort;
  55. @Value("${com.ftp.ftpUser}")
  56. private String ftpUser;
  57. @Value("${com.ftp.ftpPassword}")
  58. private String ftpPassword;
  59. @Value("${com.ftp.ftpDir}")
  60. private String ftpDir;
  61. @Autowired
  62. private PrepressService prepressService;
  63. @Value("${item.zipPath}")
  64. private String zipPath;
  65. @Autowired
  66. private BasicDao basicDao;
  67. @InitBinder
  68. public void initBinder(WebDataBinder binder) {
  69. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  70. binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
  71. }
  72. @GetMapping("/")
  73. public String prepressHome(){
  74. return "sntracking/prepress";
  75. }
  76. /**
  77. * 返工单页面
  78. * @return
  79. */
  80. @GetMapping("/rework")
  81. public String prepressReworkHome(){
  82. return "sntracking/prepress_rework";
  83. }
  84. @GetMapping("/query")
  85. public String prepressQuery(){
  86. return "sntracking/prepress_query";
  87. }
  88. /**
  89. * IFS入库数量核实
  90. * @return
  91. */
  92. @GetMapping("/receiveQty")
  93. public String receiveQty(){
  94. return "sntracking/receiveQty";
  95. }
  96. /**
  97. *
  98. * @Title: serialInfo
  99. * @Description: 查询信息页面
  100. * @author lirui
  101. * @date 2018年4月20日
  102. * @param @return 参数
  103. * @return String 返回类型
  104. * @throws
  105. */
  106. @GetMapping("/serialInfo")
  107. public String serialInfo(){
  108. return "/sntracking/serial_info";
  109. }
  110. /**
  111. * 按SO的数量自动统计页面
  112. * @return
  113. */
  114. @GetMapping("/soOrderInfo")
  115. public String soOrderInfo(){
  116. return "/sntracking/so_order_info";
  117. }
  118. /**
  119. *
  120. * @Title: getSerialInfo
  121. * @Description: TODO(这里用一句话描述这个方法的作用)
  122. * @author lirui
  123. * @date 2018年4月20日
  124. * @param @param serialNo
  125. * @param @return 参数
  126. * @return Object 返回类型
  127. * @throws
  128. */
  129. @PostMapping("/serialInfo")
  130. @ResponseBody
  131. public Object getSerialInfo(String serialNo){
  132. Map<String, Object> map = new HashMap<>();
  133. List<SerialInfo> rows = finalRollDao.getSerialInfo(serialNo);
  134. map.put("total", rows.size());
  135. map.put("rows", rows);
  136. return map;
  137. }
  138. @PostMapping("/missingReportData")
  139. @ResponseBody
  140. public Object missingReportData(String serialNo){
  141. Map<String, Object> map = new HashMap<>();
  142. List<SerialInfo> rows = finalRollDao.getSerialInfo(serialNo);
  143. map.put("total", rows.size());
  144. map.put("rows", rows);
  145. return map;
  146. }
  147. @GetMapping("/downSerialInfo")
  148. @ResponseBody
  149. public Object downSerialInfo(@RequestParam("serilaNo") String serilaNo,
  150. HttpServletResponse response) throws Exception {
  151. String filename = "Serials Number"+serilaNo+""+DateUtils.getStringDate(new Date(), "yyyyMMddhhmmss")+".xlsx";
  152. File files = new File(filename);
  153. List<Map<String, Object>> serialInfo = finalRollDao.getSerialforExcel(serilaNo);
  154. if(serialInfo==null ||serialInfo.isEmpty()){
  155. return null;
  156. }
  157. OutExcel.converterMapToExcel(serialInfo, files,"Serials Number"+serilaNo+"",20);
  158. byte[] buffer = new byte[1024];
  159. FileInputStream fis = null;
  160. BufferedInputStream bis = null;
  161. response.setContentType("application/force-download;charset=UTF-8");
  162. response.setHeader("Content-disposition", "attachment; filename="
  163. + new String(filename.getBytes(), "iso8859-1"));
  164. try {
  165. fis = new FileInputStream(files);
  166. bis = new BufferedInputStream(fis);
  167. int i = bis.read(buffer);
  168. ServletOutputStream os = response.getOutputStream();
  169. while (i != -1) {
  170. os.write(buffer, 0, i);
  171. i = bis.read(buffer);
  172. }
  173. } catch (Exception e) {
  174. logger.info("Exception handling:"+e.getMessage());
  175. }
  176. //释放资源
  177. finally {
  178. if (bis != null) {
  179. bis.close();
  180. }
  181. if (fis != null) {
  182. fis.close();
  183. }
  184. }
  185. return null;
  186. }
  187. /**
  188. * 按SO的数量自动统计功能
  189. * @param orderNo
  190. * @return
  191. */
  192. @PostMapping("/soOrderInfo")
  193. @ResponseBody
  194. public Object getSoOrderInfo(String orderNo){
  195. Map<String, Object> map = new HashMap<>();
  196. List<SoOutputStatistic> rows = finalRollDao.getSoOutputStatistic(orderNo);
  197. map.put("total", rows.size());
  198. map.put("rows", rows);
  199. return map;
  200. }
  201. @GetMapping("/downSoOrderInfo")
  202. @ResponseBody
  203. public Object downSoOrderInfo(@RequestParam("orderNoSearch") String orderNoSearch,
  204. HttpServletResponse response) throws Exception {
  205. String filename = "Serials Number"+orderNoSearch+""+DateUtils.getStringDate(new Date(), "yyyyMMddhhmmss")+".xlsx";
  206. File files = new File(filename);
  207. List<Map<String, Object>> soOrderInfo = finalRollDao.getSoOrderforExcel(orderNoSearch);
  208. if(soOrderInfo==null ||soOrderInfo.isEmpty()){
  209. return null;
  210. }
  211. OutExcel.converterMapToExcel(soOrderInfo, files,"Serials Number"+orderNoSearch+"",20);
  212. byte[] buffer = new byte[1024];
  213. FileInputStream fis = null;
  214. BufferedInputStream bis = null;
  215. response.setContentType("application/force-download;charset=UTF-8");
  216. response.setHeader("Content-disposition", "attachment; filename="
  217. + new String(filename.getBytes(), "iso8859-1"));
  218. try {
  219. fis = new FileInputStream(files);
  220. bis = new BufferedInputStream(fis);
  221. int i = bis.read(buffer);
  222. ServletOutputStream os = response.getOutputStream();
  223. while (i != -1) {
  224. os.write(buffer, 0, i);
  225. i = bis.read(buffer);
  226. }
  227. } catch (Exception e) {
  228. logger.info("Exception handling:"+e.getMessage());
  229. }
  230. //释放资源
  231. finally {
  232. if (bis != null) {
  233. bis.close();
  234. }
  235. if (fis != null) {
  236. fis.close();
  237. }
  238. }
  239. return null;
  240. }
  241. @Autowired
  242. private SoInfoRepository soInfoRepo;
  243. @Autowired
  244. private SoRollRepository rollRepo;
  245. @GetMapping("/all")
  246. @ResponseBody
  247. public Map soInfoJson(
  248. @RequestParam(value = "orderNo", required = false) String orderNo,
  249. @RequestParam(value = "createdDateFrom", required = false) String createdDateFrom,
  250. @RequestParam(value = "createdDateTo", required = false) String createdDateTo,
  251. @RequestParam(value = "statement", required = false) String statement,
  252. @RequestParam(value = "page", required = false, defaultValue = "1") Integer currPage,
  253. @RequestParam(value = "rows", required = false, defaultValue = "20") Integer rows,
  254. @RequestParam(value = "sort", required = false, defaultValue = "id") String sortField,
  255. @RequestParam(value = "order", required = false, defaultValue = "desc") String orderDirection
  256. ){
  257. SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  258. Sort sort = new Sort("desc".equals(orderDirection)?Sort.Direction.DESC:Sort.Direction.ASC, sortField);
  259. PageRequest pageRequest = new PageRequest(currPage-1, rows, sort);
  260. Page<SoInfo> page = soInfoRepo.findAll((root, query, cb) -> {
  261. List<Predicate> predicateList = new ArrayList<>();
  262. predicateList.add(cb.like(root.get("isrework"), "N"));
  263. if(StringUtils.hasText(orderNo)){
  264. predicateList.add(cb.like(root.get("orderNo"), "%"+orderNo));
  265. }
  266. if(StringUtils.hasText(statement)){
  267. predicateList.add(cb.equal(root.get("statement"), statement));
  268. }
  269. if(StringUtils.hasText(createdDateFrom)){
  270. try {
  271. predicateList.add(cb.greaterThanOrEqualTo(root.get("createdDate"), fmt.parse(createdDateFrom + " 00:00:00")));
  272. } catch (Exception e) {
  273. e.printStackTrace();
  274. }
  275. }
  276. if(StringUtils.hasText(createdDateTo)){
  277. try {
  278. predicateList.add(cb.lessThan(root.get("createdDate"), fmt.parse(createdDateTo + " 23:59:59")));
  279. } catch (Exception e) {
  280. e.printStackTrace();
  281. }
  282. }
  283. query.where(predicateList.toArray(new Predicate[]{}));
  284. return null;
  285. }, pageRequest);
  286. Map map = new HashMap();
  287. map.put("total", page.getTotalElements());
  288. map.put("rows", page.getContent());
  289. return map;
  290. }
  291. @GetMapping("/reworkAll")
  292. @ResponseBody
  293. public Map soInfoReworkJson(
  294. @RequestParam(value = "orderNo", required = false) String orderNo,
  295. @RequestParam(value = "createdDateFrom", required = false) String createdDateFrom,
  296. @RequestParam(value = "createdDateTo", required = false) String createdDateTo,
  297. @RequestParam(value = "statement", required = false) String statement,
  298. @RequestParam(value = "page", required = false, defaultValue = "1") Integer currPage,
  299. @RequestParam(value = "rows", required = false, defaultValue = "20") Integer rows,
  300. @RequestParam(value = "sort", required = false, defaultValue = "id") String sortField,
  301. @RequestParam(value = "order", required = false, defaultValue = "desc") String orderDirection
  302. ){
  303. SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  304. Sort sort = new Sort("desc".equals(orderDirection)?Sort.Direction.DESC:Sort.Direction.ASC, sortField);
  305. PageRequest pageRequest = new PageRequest(currPage-1, rows, sort);
  306. Page<SoInfo> page = soInfoRepo.findAll((root, query, cb) -> {
  307. List<Predicate> predicateList = new ArrayList<>();
  308. predicateList.add(cb.like(root.get("isrework"), "Y"));
  309. if(StringUtils.hasText(orderNo)){
  310. predicateList.add(cb.like(root.get("orderNo"), "%"+orderNo));
  311. }
  312. if(StringUtils.hasText(statement)){
  313. predicateList.add(cb.equal(root.get("statement"), statement));
  314. }
  315. if(StringUtils.hasText(createdDateFrom)){
  316. try {
  317. predicateList.add(cb.greaterThanOrEqualTo(root.get("createdDate"), fmt.parse(createdDateFrom + " 00:00:00")));
  318. } catch (Exception e) {
  319. e.printStackTrace();
  320. }
  321. }
  322. if(StringUtils.hasText(createdDateTo)){
  323. try {
  324. predicateList.add(cb.lessThan(root.get("createdDate"), fmt.parse(createdDateTo + " 23:59:59")));
  325. } catch (Exception e) {
  326. e.printStackTrace();
  327. }
  328. }
  329. query.where(predicateList.toArray(new Predicate[]{}));
  330. return null;
  331. }, pageRequest );
  332. Map map = new HashMap();
  333. map.put("total", page.getTotalElements());
  334. map.put("rows", page.getContent());
  335. return map;
  336. }
  337. @GetMapping("/orderrolls/{orderNo}")
  338. @ResponseBody
  339. public Map orderRolls(
  340. @PathVariable(value = "orderNo") String orderNo,
  341. @RequestParam(value = "page", required = false, defaultValue = "1") Integer currPage,
  342. @RequestParam(value = "rows", required = false, defaultValue = "20") Integer rows,
  343. @RequestParam(value = "sort", required = false, defaultValue = "id") String sortField,
  344. @RequestParam(value = "order", required = false, defaultValue = "asc") String orderDirection
  345. ){
  346. Sort sort = new Sort("desc".equals(orderDirection)?Sort.Direction.DESC:Sort.Direction.ASC, sortField);
  347. PageRequest pageRequest = new PageRequest(currPage-1, rows, sort);
  348. Page<SoRoll> page = rollRepo.findAll((root, query, cb) -> {
  349. List<Predicate> predicateList = new ArrayList<>();
  350. if(StringUtils.hasText(orderNo)){
  351. predicateList.add(cb.equal(root.get("orderNo"), orderNo));
  352. }
  353. query.where(predicateList.toArray(new Predicate[]{}));
  354. return null;
  355. }, pageRequest );
  356. Map map = new HashMap();
  357. map.put("total", page.getTotalElements());
  358. map.put("rows", page.getContent());
  359. return map;
  360. }
  361. /**
  362. * 生产订单导入
  363. * @param soInfo
  364. * @return
  365. */
  366. @PostMapping("/soinfo/add")
  367. @ResponseBody
  368. public Map add(SoInfo soInfo){
  369. Map ret = new HashMap();
  370. //调用方法 进行工单的新增
  371. Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
  372. try{
  373. soInfo.setCreatedBy(authentication.getName());
  374. soInfo.setCreatedDate(new Timestamp(System.currentTimeMillis()));
  375. soInfo.setStatus(SoInfo.CREATED);
  376. soInfo.setIsrework("N");
  377. // soInfo.setFirstRollTime(new Date());
  378. soInfo.validate();
  379. //查询是否经过热覆合
  380. String projectCode = soInfo.getProject();
  381. ProjectCode projectData = pjcRepo.findOneByProjectCode(projectCode);
  382. if(projectData==null){
  383. throw new RuntimeException("项目号不存在请联系系统管理员!");
  384. }
  385. //设置参数
  386. soInfo.setLaminationFlag(projectData.getLaminationFlag());
  387. //查询长度是否符合要求
  388. String apn = soInfo.getApn();
  389. if(apn.length() != 11) {
  390. throw new RuntimeException("Length of apn does not comply with the rules!");
  391. }
  392. String revNo = soInfo.getRevNo();
  393. if(revNo.length() != 1) {
  394. throw new RuntimeException("revNo长度不符规则!");
  395. }
  396. //添加全的客户料号
  397. Map<String, Object> ifsOrder = jdbcTemplate.queryForMap(ifsOrderSql, soInfo.getOrderNo());
  398. //获取字符串内容
  399. String customerPartNoAll = String.valueOf(ifsOrder.get("customer_part_no"));
  400. //设置参数
  401. soInfo.setCustomerPartNoAll(customerPartNoAll);
  402. soInfoRepo.save(soInfo);
  403. ret.put("success", true);
  404. }catch(DataIntegrityViolationException e){
  405. ret.put("errorMsg", "Order No 不能重复");
  406. }catch(Exception e){
  407. ret.put("errorMsg", e.getMessage());
  408. }
  409. return ret;
  410. }
  411. /**
  412. *
  413. * @Title: addSoInfo
  414. * @Description: 工单新增信息
  415. * @author: LR
  416. * @date 2024年6月19日 下午2:24:09
  417. * @return: Object
  418. * @throws
  419. */
  420. @PostMapping("/soinfo/addSoInfo")
  421. @ResponseBody
  422. public Object addSoInfo(SoInfo soInfo){
  423. Map<String, Object> resultMap = new HashMap<String, Object>();
  424. try{
  425. //获取ifs的工单信息
  426. prepressService.addSoInfo(soInfo);
  427. resultMap.put("msg", "Successfully!");
  428. resultMap.put("success", true);
  429. resultMap.put("code", 200);
  430. }catch (Exception e){
  431. resultMap.put("code", 400);
  432. resultMap.put("success", false);
  433. resultMap.put("msg", e.getMessage());
  434. }
  435. return resultMap;
  436. }
  437. /**
  438. * 新增返工订单
  439. * @param soInfo
  440. * @return
  441. */
  442. @PostMapping("/soinfo/addrework")
  443. @ResponseBody
  444. public Map addrework(SoInfo soInfo){
  445. Map ret = new HashMap();
  446. Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
  447. try{
  448. soInfo.setCreatedBy(authentication.getName());
  449. soInfo.setCreatedDate(new Timestamp(System.currentTimeMillis()));
  450. soInfo.setStatus(SoInfo.CREATED);
  451. soInfo.setIsrework("Y");
  452. soInfo.setFirstRollTime(new Date());
  453. soInfo.validate();
  454. //查询是否经过热覆合
  455. //设置参数
  456. soInfo.setLaminationFlag("Y");
  457. //添加全的客户料号
  458. Map<String, Object> ifsOrder = jdbcTemplate.queryForMap(ifsOrderSql, soInfo.getOrderNo());
  459. //获取字符串内容
  460. String customerPartNoAll = String.valueOf(ifsOrder.get("customer_part_no"));
  461. //设置参数
  462. soInfo.setCustomerPartNoAll(customerPartNoAll);
  463. soInfoRepo.save(soInfo);
  464. ret.put("success", true);
  465. }catch(DataIntegrityViolationException e){
  466. ret.put("errorMsg", "Order No 不能重复");
  467. }catch(Exception e){
  468. ret.put("errorMsg", e.getMessage());
  469. }
  470. return ret;
  471. }
  472. @PostMapping("/soinfo/{id}/update")
  473. @ResponseBody
  474. public Map add(@PathVariable("id") Integer id, SoInfo soInfo){
  475. Map ret = new HashMap();
  476. try{
  477. SoInfo dbSoInfo = soInfoRepo.findOne(id);
  478. dbSoInfo.setOrderNo(soInfo.getOrderNo());
  479. dbSoInfo.setPartNo(soInfo.getPartNo());
  480. dbSoInfo.setPartDesc(soInfo.getPartDesc());
  481. dbSoInfo.setLotSize(soInfo.getLotSize());
  482. dbSoInfo.setInputLotSize(soInfo.getInputLotSize());
  483. dbSoInfo.setNeedDate(soInfo.getNeedDate());
  484. dbSoInfo.setNoOfCross(soInfo.getNoOfCross());
  485. dbSoInfo.setSerialsDate(soInfo.getSerialsDate());
  486. dbSoInfo.setApn(soInfo.getApn());
  487. dbSoInfo.setRevNo(soInfo.getRevNo());
  488. dbSoInfo.setCustomerPartNo(soInfo.getCustomerPartNo());
  489. dbSoInfo.setProject(soInfo.getProject());
  490. dbSoInfo.setStandardRollQty(soInfo.getStandardRollQty());
  491. //查询是否经过热覆合
  492. String projectCode = soInfo.getProject();
  493. ProjectCode projectData = pjcRepo.findOneByProjectCode(projectCode);
  494. //设置参数
  495. soInfo.setLaminationFlag(projectData.getLaminationFlag());
  496. dbSoInfo.validate();
  497. soInfoRepo.save(dbSoInfo);
  498. ret.put("success", true);
  499. }catch(DataIntegrityViolationException e){
  500. ret.put("errorMsg", "Order No 不能重复");
  501. }catch(Exception e){
  502. ret.put("errorMsg", e.getMessage());
  503. }
  504. return ret;
  505. }
  506. @PostMapping("/soinfo/{id}/delete")
  507. @ResponseBody
  508. public Map delete(@PathVariable Integer id){
  509. Map ret = new HashMap();
  510. try{
  511. SoInfo dbSoInfo = soInfoRepo.findOne(id);
  512. if (dbSoInfo == null){
  513. throw new RuntimeException("订单未找到");
  514. }
  515. if (!SoInfo.CREATED.equals(dbSoInfo.getStatus())){
  516. throw new RuntimeException("Order number not found");
  517. }
  518. soInfoRepo.delete(id);
  519. ret.put("success", true);
  520. }catch(Exception e){
  521. ret.put("errorMsg", e.getMessage());
  522. }
  523. return ret;
  524. }
  525. @PostMapping("/soinfo/{id}/delsn")
  526. @ResponseBody
  527. @Transactional
  528. public Map deleteSn(@PathVariable Integer id,Authentication authentication){
  529. Map ret = new HashMap();
  530. try{
  531. SoInfo dbSoInfo = soInfoRepo.findOne(id);
  532. if (dbSoInfo == null){
  533. throw new RuntimeException("订单未找到");
  534. }
  535. List list = rollRepo.findByOrderNo(dbSoInfo.getOrderNo());
  536. if (list != null && list.size() > 0){
  537. throw new RuntimeException("已经存在卷信息,不能删除");
  538. }
  539. if (SoInfo.GENERATED.equals(dbSoInfo.getStatus())){
  540. dbSoInfo.setStatus(SoInfo.CREATED);
  541. }
  542. dbSoInfo.setSerialsGenBy(null);
  543. dbSoInfo.setSerialsGenDate(null);
  544. soInfoRepo.save(dbSoInfo);
  545. finalRollDao.deleteSNTemplateCopy(dbSoInfo);
  546. ret.put("success", true);
  547. }catch(Exception e){
  548. ret.put("errorMsg", e.getMessage());
  549. }
  550. return ret;
  551. }
  552. @PostMapping("/soinfo/{id}/refreshSerials")
  553. @ResponseBody
  554. public Map refreshSerials(@PathVariable Integer id,Authentication authentication){
  555. Map ret = new HashMap();
  556. try{
  557. SoInfo dbSoInfo = soInfoRepo.findOne(id);
  558. if (dbSoInfo == null){
  559. throw new RuntimeException("订单未找到");
  560. }
  561. dbSoInfo.setStatus(SoInfo.GENERATED);
  562. List<SoInfo> copyList=finalRollDao.getSNTemplateCopy(dbSoInfo);
  563. if (copyList.size()==0){
  564. throw new RuntimeException("没有码包数据");
  565. }
  566. dbSoInfo.setSerialsGenBy(copyList.get(0).getSerialsGenBy());
  567. dbSoInfo.setSerialsGenDate(copyList.get(0).getSerialsGenDate());
  568. dbSoInfo.setSerialEnd(copyList.get(0).getSerialEnd());
  569. dbSoInfo.setSerialStart(copyList.get(0).getSerialStart());
  570. dbSoInfo.setSerialsTemplate(copyList.get(0).getSerialsTemplate());
  571. soInfoRepo.save(dbSoInfo);
  572. ret.put("success", true);
  573. }catch(Exception e){
  574. ret.put("errorMsg", e.getMessage());
  575. }
  576. return ret;
  577. }
  578. @GetMapping("/download/{filename}")
  579. @ResponseBody
  580. public FileSystemResource downloadFile(@PathVariable("filename") String filename, HttpServletResponse response){
  581. response.setContentType("application/csv");
  582. response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".csv");
  583. File file = new File("snfiles"+File.separator + filename + ".csv");
  584. return new FileSystemResource(file);
  585. }
  586. /**
  587. *
  588. * @Title: downloadFileZip
  589. * @Description: 下载已经生成好的文件
  590. * @author: LR
  591. * @date 2024年7月29日 下午5:46:22
  592. * @return: FileSystemResource
  593. * @throws
  594. */
  595. @GetMapping("/downloadFileZip/{fileName}")
  596. @ResponseBody
  597. public FileSystemResource downloadFileZip(@PathVariable("fileName") String fileName, HttpServletResponse response){
  598. response.setContentType("application/zip");
  599. response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".zip");
  600. File sourceFile = new File(zipPath);
  601. //判断是否存在不存在创建目录
  602. if(!sourceFile.exists()) {
  603. sourceFile.mkdirs();
  604. }
  605. File targetFile = new File(sourceFile, fileName + ".zip");
  606. return new FileSystemResource(targetFile);
  607. }
  608. @GetMapping("/downloadFileZipMulit/{filename}")
  609. @ResponseBody
  610. public FileSystemResource downloadFileZipMulit(@PathVariable("filename") String filename, HttpServletResponse response){
  611. SoInfo soInfo=soInfoRepo.findByOrderNo(filename);
  612. String filenameNew=soInfo.getOrderNo()+"-"+soInfo.getPartNo()+"-"+soInfo.getApn()+"-"+soInfo.getRevNo();
  613. response.setContentType("application/zip");
  614. response.setHeader("Content-Disposition", "attachment; filename=" + filenameNew + ".zip");
  615. File file = new File("snfiles"+File.separator + filenameNew + ".zip");
  616. return new FileSystemResource(file);
  617. }
  618. @PostMapping("/uploadFTP")
  619. @ResponseBody
  620. @Transactional
  621. public Map uploadFTP(@RequestParam("fileName[]") String[] fileName,
  622. @Param("shipNo") String shipNo, HttpServletResponse response){
  623. response.setContentType("application/csv");
  624. response.setHeader("Content-Disposition", "attachment; filename=" + fileName + ".zip");
  625. Shipment shipment = shipRepo.findByShipNo(shipNo);
  626. Map ret = new HashMap();
  627. String flag = shipment.getFtpUploadflag();
  628. ret.put("msg", "");
  629. if("Y".equals(flag)){
  630. ret.put("errorMsg", true);
  631. ret.put("data", "已上传");
  632. logger.info("已上传");
  633. return ret;
  634. }
  635. // Shipment shipment = shipRepo.findByShipNo(shipNo);
  636. List<CustomerFtppath> list = new ArrayList<CustomerFtppath>();
  637. if(shipment.getCustomerNo()!=null&&!"".equals(shipment.getCustomerNo())){
  638. list = finalRollDao.findByNo(shipment.getCustomerNo());
  639. }else{
  640. ret.put("errorMsg", true);
  641. ret.put("data", "用户编号为空");
  642. logger.info("用户编号为空");
  643. return ret;
  644. }
  645. if(null == list || list.size() ==0){
  646. ret.put("errorMsg", true);
  647. ret.put("data", "数据库数据为空");
  648. logger.info("数据库数据为空");
  649. return ret;
  650. }else if(list.get(0).getFtpPath() == null || "".equals(list.get(0).getFtpPath())){
  651. ret.put("errorMsg", true);
  652. ret.put("data", "The data is null");
  653. logger.info("The data is null");
  654. return ret;
  655. }
  656. String path ="";//上传成功后的返回路径
  657. String filePath = "";//上传成功后保存数据库路径
  658. FTPManager mana = FTPManager.getInstance();
  659. String host = ftpHost;//IP地址
  660. Integer port = ftpPort;//端口号
  661. String user = ftpUser; //用户名
  662. String password = ftpPassword;//密码
  663. String dir = ftpDir;//首路径
  664. //设置
  665. mana.setInfo(host, port, user, password, dir);
  666. String bpath = "";
  667. List<CustomerFtppath> findByNo=finalRollDao.findByNo(shipment.getCustomerNo());
  668. if(findByNo.size()==0){
  669. throw new RuntimeException("客户信息customer_ftppath未维护,请联系系统管理员!");
  670. }
  671. String ftpFlag=findByNo.get(0).getFtpFlag();
  672. try {
  673. for(int i = 0;i<fileName.length;i++){
  674. if(!"C".equals(ftpFlag)) {
  675. bpath = "snfiles" + File.separator + fileName[i] + ".csv";
  676. path = mana.upLoad(list.get(0).getFtpPath(),fileName[i], bpath, true);
  677. }else {
  678. bpath = "snfiles" + File.separator + fileName[i] + ".txt";
  679. path = mana.upLoadTXT(list.get(0).getFtpPath(),fileName[i], bpath, true);
  680. }
  681. }
  682. } catch (Exception e) {
  683. logger.info("FTP"+e.getMessage());
  684. }
  685. if(path=="The FTP folder does not exist"){
  686. ret.put("errorMsg", true);
  687. ret.put("data", "路径不存在请联系管理员");
  688. logger.info(path+"501");
  689. return ret;
  690. }else if(path!=null){//成功情况
  691. filePath = "ftp://"+host+":"+port+path;
  692. ret.put("success", true);
  693. ret.put("data", filePath);
  694. shipment.setFtpPath(filePath);
  695. shipment.setFtpUploadflag("Y");
  696. shipRepo.save(shipment);
  697. }else{
  698. ret.put("errorMsg", true);
  699. ret.put("data", "路径有问题请联系管理员");
  700. logger.info(path+"510");
  701. return ret;
  702. }
  703. //上传成功后发邮件
  704. if("Y".equals(list.get(0).getEmailFlag())){
  705. if("".equals(list.get(0).getEmailAddress())||list.get(0).getEmailAddress()==null){
  706. ret.put("msg", "客户未设置邮箱地址!");
  707. }else {
  708. for(int i = 0;i<fileName.length;i++){
  709. if((!"C".equals(ftpFlag)) ) {
  710. bpath = "snfiles" + File.separator + fileName[i] + ".csv";
  711. // path = mana.upLoad(list.get(0).getFtpPath(),fileName[i], bpath, true);
  712. }else {
  713. bpath = "snfiles" + File.separator + fileName[i] + ".txt";
  714. // path = mana.upLoadTXT(list.get(0).getFtpPath(),fileName[i], bpath, true);
  715. }
  716. String titleEnd="";
  717. if(fileName.length>1){
  718. titleEnd+="-"+(i+1);
  719. }
  720. mailSendService.sendCustomerMail(list.get(0), bpath,titleEnd);
  721. }
  722. ret.put("msg", "邮件发送成功!");
  723. }
  724. }
  725. return ret;
  726. }
  727. @Autowired
  728. private SequenceRepository seqRepo;
  729. private static Pattern apnRevPattern = Pattern.compile("Label,([0-9A-Za-z\\-]+)-(\\S{1}),");
  730. //Matcher m = p.matcher("Label,826-02449-A,NA");
  731. @PostMapping("/soinfo/{id}/gensn")
  732. @Transactional
  733. @ResponseBody
  734. public Map genSn(@PathVariable Integer id){
  735. Map ret = new HashMap();
  736. try{
  737. SoInfo dbSoInfo = soInfoRepo.findOne(id);
  738. if (dbSoInfo == null){
  739. ret.put("errorMsg", "Order not found.");
  740. return ret;
  741. }
  742. if (dbSoInfo.getSerialsGenDate() != null){
  743. ret.put("errorMsg", "Already generated");
  744. return ret;
  745. }
  746. String snTemplate = genSerialTemplate(dbSoInfo);
  747. if(snTemplate==null){
  748. ret.put("errorMsg", "eeeecode not found");
  749. return ret;
  750. }
  751. dbSoInfo.setSerialsTemplate(snTemplate);
  752. //find existing
  753. Sequence seq = seqRepo.findByTag(snTemplate);
  754. if (seq == null){
  755. seq = new Sequence();
  756. seq.setTag(snTemplate);
  757. seq.setSeq(0);
  758. }
  759. dbSoInfo.setSerialStart(seq.getSeq() + 1);
  760. dbSoInfo.setSerialEnd(dbSoInfo.getSerialStart() + dbSoInfo.getInputLotSize() - 1);
  761. //多排文件
  762. generateSerialNumbers(dbSoInfo);
  763. //单排文件
  764. generateSerialNumbers_old(dbSoInfo);
  765. Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
  766. dbSoInfo.setRolls(0);
  767. dbSoInfo.setStatus(SoInfo.GENERATED);
  768. dbSoInfo.setSerialsGenBy(authentication.getName());
  769. dbSoInfo.setSerialsGenDate(new Timestamp(System.currentTimeMillis()));
  770. finalRollDao.deleteSNTemplateCopy(dbSoInfo);
  771. finalRollDao.saveSNTemplateCopy(dbSoInfo);
  772. soInfoRepo.save(dbSoInfo);
  773. seq.setSeq(dbSoInfo.getSerialEnd());
  774. seqRepo.save(seq);
  775. ret.put("success", true);
  776. }catch(Exception e){
  777. ret.put("errorMsg", e.getMessage());
  778. }
  779. return ret;
  780. }
  781. /**
  782. *
  783. * @Title: genSerials
  784. * @Description: 产生工单得码包新的方法
  785. * @author: LR
  786. * @date 2024年6月19日 下午2:46:03
  787. * @return: Object
  788. * @throws
  789. */
  790. @PostMapping("/soinfo/{id}/genSerials")
  791. @ResponseBody
  792. public Object genSerials(@PathVariable Integer id){
  793. Map<String, Object> resultMap = new HashMap<String, Object>();
  794. try{
  795. //获取ifs的工单信息
  796. prepressService.genSerials(id);
  797. resultMap.put("msg", "Successfully!");
  798. resultMap.put("success", true);
  799. }catch (Exception e){
  800. resultMap.put("msg", e.getMessage());
  801. }
  802. return resultMap;
  803. }
  804. @Value("${eeeecode}")
  805. private String appleEeeeCode;
  806. private String genSerialTemplate(SoInfo soInfo) {
  807. List<ProjectCode> list = pjcRepo.findByProjectCode(soInfo.getProject());
  808. if(list.size()==0){
  809. return null;
  810. }
  811. //查询生码的类型
  812. String partNo = soInfo.getPartNo();
  813. //查询物料的信息
  814. PartData partData = basicDao.getPartDataByPartNo(partNo);
  815. String codeType = partData.getCodeType();
  816. Calendar cal = Calendar.getInstance();
  817. cal.setTime(soInfo.getSerialsDate());
  818. String platCode3 = "J4K";
  819. String year1 = String.valueOf(cal.get(Calendar.YEAR) % 10);
  820. String week2 = org.apache.commons.lang3.StringUtils.leftPad(String.valueOf(cal.get(Calendar.WEEK_OF_YEAR)), 2, '0');
  821. String day1 = String.valueOf(cal.get(Calendar.DAY_OF_WEEK));
  822. String code4 = "____";
  823. String appleEEEE4 = list.get(0).getEeeecode();
  824. String rev1 = soInfo.getRevNo();
  825. String delimiter1 = "+";
  826. String apn = soInfo.getApn();
  827. String checkSum1 = "_";
  828. String snLeft7 = platCode3 + year1 + week2 + day1;
  829. String snMiddle5 = appleEEEE4 + rev1;
  830. String snRight = delimiter1 + apn;
  831. String snFormat = null;
  832. if ("2024".equals(codeType)) {
  833. snFormat = snLeft7 + code4 + snMiddle5 + checkSum1 + snRight;
  834. }else if("2025".equals(codeType)) {
  835. snFormat = snLeft7 + code4 + snMiddle5 + checkSum1;
  836. }
  837. return snFormat;
  838. }
  839. //20230427 阮琦修改 原版在下面
  840. private void generateSerialNumbers(SoInfo soInfo) throws IOException {
  841. if (soInfo.getSerialEnd() > 1336335) {
  842. throw new RuntimeException("序列号["+soInfo.getSerialStart()+"-"+soInfo.getSerialEnd()+"], 数量超出最大值。");
  843. }
  844. long start = System.currentTimeMillis();
  845. String fileName = soInfo.getOrderNo()+"-"+soInfo.getPartNo()+"-"+soInfo.getApn()+"-"+soInfo.getRevNo();
  846. //start generate
  847. FileOutputStream fos = new FileOutputStream( "snfiles" + File.separator + fileName + ".zip");
  848. BufferedOutputStream bos = new BufferedOutputStream(fos);
  849. ZipOutputStream zos = new ZipOutputStream(bos);
  850. ZipEntry entry = new ZipEntry(fileName + ".csv");
  851. zos.putNextEntry(entry);
  852. //查询当前物料的数据 获取编码的类型
  853. String partNo = soInfo.getPartNo();
  854. PartData part = basicDao.getPartDataByPartNo(partNo);
  855. String codeType = part.getCodeType();
  856. //把所有序列号收集起来放进一个list
  857. List<SNData> allSn=new ArrayList<>();
  858. StringBuilder template2 = new StringBuilder(soInfo.getSerialsTemplate());
  859. int j=1;
  860. for (int snIndex = soInfo.getSerialStart(); snIndex <= soInfo.getSerialEnd(); snIndex++) {
  861. String currentSn = SerialUtil.getSerialNo(template2, snIndex, codeType);
  862. SNData snData=new SNData();
  863. snData.setSn(currentSn);
  864. snData.setNumber(j);
  865. allSn.add(snData);
  866. j++;
  867. }
  868. int batchSize = (int) Math.ceil((double)allSn.size() / 4.0);
  869. //分成四组
  870. List<List<SNData>> groups = new ArrayList<>();
  871. int startNum = 0;
  872. while (startNum < allSn.size()) {
  873. int endNum = Math.min(startNum + batchSize, allSn.size());
  874. List<SNData> group=new ArrayList<>(allSn.subList(startNum, endNum));
  875. //如果最后一列少几个序列号 空字符串补齐 一般不会出现
  876. while (group.size() < batchSize) {
  877. group.add(new SNData());
  878. }
  879. groups.add(group);
  880. startNum = endNum;
  881. }
  882. zos.write(( soInfo.getApn()+"-"+soInfo.getRevNo()+"-1").getBytes("UTF-8"));
  883. zos.write(( ",").getBytes("UTF-8"));
  884. zos.write(( "ID-1").getBytes("UTF-8"));
  885. zos.write(( ",").getBytes("UTF-8"));
  886. zos.write(( soInfo.getApn()+"-"+soInfo.getRevNo()+"-2").getBytes("UTF-8"));
  887. zos.write(( ",").getBytes("UTF-8"));
  888. zos.write(( "ID-2").getBytes("UTF-8"));
  889. zos.write(( ",").getBytes("UTF-8"));
  890. zos.write(( soInfo.getApn()+"-"+soInfo.getRevNo()+"-3").getBytes("UTF-8"));
  891. zos.write(( ",").getBytes("UTF-8"));
  892. zos.write(( "ID-3").getBytes("UTF-8"));
  893. zos.write(( ",").getBytes("UTF-8"));
  894. zos.write(( soInfo.getApn()+"-"+soInfo.getRevNo()+"-4").getBytes("UTF-8"));
  895. zos.write(( ",").getBytes("UTF-8"));
  896. zos.write(( "ID-4" + "\r\n").getBytes("UTF-8"));
  897. for (int i=0; i<batchSize; i++) {
  898. zos.write(( groups.get(0).get(i).getSn()).getBytes("UTF-8"));
  899. zos.write(( ",").getBytes("UTF-8"));
  900. zos.write(( String.valueOf(groups.get(0).get(i).getNumber()) ).getBytes("UTF-8"));
  901. zos.write(( ",").getBytes("UTF-8"));
  902. zos.write(( groups.get(1).get(i).getSn()).getBytes("UTF-8"));
  903. zos.write(( ",").getBytes("UTF-8"));
  904. zos.write(( String.valueOf(groups.get(1).get(i).getNumber()) ).getBytes("UTF-8"));
  905. zos.write(( ",").getBytes("UTF-8"));
  906. zos.write(( groups.get(2).get(i).getSn()).getBytes("UTF-8"));
  907. zos.write(( ",").getBytes("UTF-8"));
  908. zos.write(( String.valueOf(groups.get(2).get(i).getNumber()) ).getBytes("UTF-8"));
  909. zos.write(( ",").getBytes("UTF-8"));
  910. //如果最后一列少几个,那么直接换行 实际业务估计不存在这样的情况
  911. if(groups.get(3).get(i).getSn()==null){
  912. zos.write(( "\r\n").getBytes("UTF-8"));
  913. }else {
  914. zos.write(( groups.get(3).get(i).getSn()).getBytes("UTF-8"));
  915. zos.write(( ",").getBytes("UTF-8"));
  916. zos.write(( String.valueOf(groups.get(3).get(i).getNumber())+ "\r\n").getBytes("UTF-8"));
  917. }
  918. }
  919. zos.flush();
  920. zos.close();
  921. bos.flush();
  922. bos.close();
  923. fos.flush();
  924. fos.close();
  925. long duration = System.currentTimeMillis() - start;
  926. logger.info("Generated SN for order [{}], template={}, size={}, duration={}.",
  927. soInfo.getOrderNo(), soInfo.getSerialsTemplate(), soInfo.getInputLotSize(), duration);
  928. }
  929. private void generateSerialNumbers_old(SoInfo soInfo) throws IOException {
  930. if (soInfo.getSerialEnd() > 1336335) {
  931. throw new RuntimeException("序列号["+soInfo.getSerialStart()+"-"+soInfo.getSerialEnd()+"], 数量超出最大值。");
  932. }
  933. long start = System.currentTimeMillis();
  934. String fileName = soInfo.getOrderNo();
  935. //start generate
  936. FileOutputStream fos = new FileOutputStream( "snfiles" + File.separator + fileName + ".zip");
  937. BufferedOutputStream bos = new BufferedOutputStream(fos);
  938. ZipOutputStream zos = new ZipOutputStream(bos);
  939. ZipEntry entry = new ZipEntry(fileName + ".csv");
  940. zos.putNextEntry(entry);
  941. zos.write(( soInfo.getApn()).getBytes("UTF-8"));
  942. zos.write(( ",").getBytes("UTF-8"));
  943. zos.write(( "ID" + "\r\n").getBytes("UTF-8"));
  944. StringBuilder template = new StringBuilder(soInfo.getSerialsTemplate());
  945. int i =0;
  946. //查询当前物料的数据 获取编码的类型
  947. String partNo = soInfo.getPartNo();
  948. PartData part = basicDao.getPartDataByPartNo(partNo);
  949. String codeType = part.getCodeType();
  950. for (int snIndex = soInfo.getSerialStart(); snIndex <= soInfo.getSerialEnd(); snIndex++) {
  951. i = i+1;
  952. String currentSn = SerialUtil.getSerialNo(template, snIndex, codeType);
  953. zos.write(( currentSn).getBytes("UTF-8"));
  954. zos.write(( ",").getBytes("UTF-8"));
  955. zos.write(( i + "\r\n").getBytes("UTF-8"));
  956. }
  957. zos.flush();
  958. zos.close();
  959. bos.flush();
  960. bos.close();
  961. fos.flush();
  962. fos.close();
  963. long duration = System.currentTimeMillis() - start;
  964. logger.info("Generated SN for order [{}], template={}, size={}, duration={}.",
  965. soInfo.getOrderNo(), soInfo.getSerialsTemplate(), soInfo.getInputLotSize(), duration);
  966. }
  967. @Autowired
  968. SerialsTrackingService snTrackingService;
  969. @PostMapping("/downloadTrace")
  970. @ResponseBody
  971. public Map downloadTrace(@RequestParam("orderNo") String orderNo){
  972. Map ret = new HashMap();
  973. try{
  974. snTrackingService.trace(orderNo);
  975. ret.put("fileName", "tracking"+orderNo);
  976. ret.put("success", true);
  977. }catch (Exception e){
  978. ret.put("errorMsg", e.getMessage());
  979. }
  980. return ret;
  981. }
  982. /**
  983. *
  984. * @Title: downloadSingleTrace
  985. * @Description: 按照单排下载
  986. * @param orderNo
  987. * @return
  988. * @return: Map
  989. * @author LR
  990. * @date: 2021-7-28 10:09:34
  991. * @throws
  992. */
  993. @PostMapping("/downloadSingleTrace")
  994. @ResponseBody
  995. public Map downloadSingleTrace(@RequestParam("orderNo") String orderNo){
  996. Map ret = new HashMap();
  997. try{
  998. snTrackingService.downloadSingleTrace(orderNo);
  999. ret.put("fileName", "tracking-single-"+orderNo);
  1000. ret.put("success", true);
  1001. }catch (Exception e){
  1002. ret.put("errorMsg", e.getMessage());
  1003. }
  1004. return ret;
  1005. }
  1006. /**
  1007. * 仅导出未扫描Trace
  1008. * @param orderNo
  1009. * @return
  1010. */
  1011. @PostMapping("/notScanTrace")
  1012. @ResponseBody
  1013. public Map notScanTrace(@RequestParam("orderNo") String orderNo){
  1014. Map ret = new HashMap();
  1015. try{
  1016. snTrackingService.notScanTrace(orderNo);
  1017. ret.put("fileName", "notScanTrace"+orderNo);
  1018. ret.put("success", true);
  1019. }catch (Exception e){
  1020. ret.put("errorMsg", e.getMessage());
  1021. }
  1022. return ret;
  1023. }
  1024. /**
  1025. * 仅导出未扫描Trace
  1026. * @param orderNo
  1027. * @return
  1028. */
  1029. @PostMapping("/exportMissSn")
  1030. @ResponseBody
  1031. public Map exportMissSn(@RequestParam("startQty") Integer startQty,@RequestParam("endQty") Integer endQty
  1032. ,@RequestParam("orderNo") String orderNo,@RequestParam("serialNo") String serialNo){
  1033. Map ret = new HashMap();
  1034. try{
  1035. snTrackingService.exportMissSn(startQty,endQty,orderNo,serialNo);
  1036. ret.put("fileName", "missingReport"+orderNo);
  1037. ret.put("success", true);
  1038. }catch (Exception e){
  1039. ret.put("errorMsg", e.getMessage());
  1040. }
  1041. return ret;
  1042. }
  1043. // @Autowired
  1044. // IfsService ifsService;
  1045. @Value("${ifs.datasource.sql.order}")
  1046. String ifsOrderSql;
  1047. @Autowired
  1048. JdbcTemplate jdbcTemplate;
  1049. @PostMapping("/ifsOrder")
  1050. @ResponseBody
  1051. public Map getIfsOrder(@RequestParam("orderNo") String orderNo){
  1052. Map<String, Object> resultMap = new HashMap<String, Object>();
  1053. try{
  1054. //获取ifs的工单信息
  1055. Map<String, Object> resultRow = prepressService.getIfsOrder(orderNo);
  1056. resultMap.put("ifsOrder", resultRow);
  1057. resultMap.put("msg", "Successfully!");
  1058. resultMap.put("success", true);
  1059. }catch (Exception e){
  1060. resultMap.put("success", false);
  1061. resultMap.put("msg", e.getMessage());
  1062. }
  1063. return resultMap;
  1064. }
  1065. @GetMapping("/getReceiveQty")
  1066. @ResponseBody
  1067. public Object getReceiveQty(@RequestParam(value = "orderNo", required = false) String orderNo,
  1068. String startTime, String endTime,
  1069. @RequestParam(value = "page", required = false, defaultValue = "1") Integer currPage,
  1070. @RequestParam(value = "rows", required = false, defaultValue = "20") Integer rows,
  1071. @RequestParam(value = "sort", required = false, defaultValue = "id") String sortField,
  1072. @RequestParam(value = "order", required = false, defaultValue = "asc") String orderDirection){
  1073. Map<String, Object> map = new HashMap<>();
  1074. List<IFSReceiveQty> row = finalRollDao.getReceiveQty(orderNo, startTime, endTime);
  1075. map.put("total", row.size());
  1076. map.put("rows", row);
  1077. return map;
  1078. }
  1079. }