| | |
| | | package com.zbooksoft.gdmis.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruili.wcp.common.CustomConfigUtil; |
| | | import com.ruili.wcp.common.LogUtils; |
| | | import com.ruili.wcp.common.StringUtil; |
| | | import com.ruili.wcp.common.excel.PoiUtil; |
| | | import com.ruili.wcp.configsettting.SystemConfig; |
| | |
| | | import com.ruili.wcp.service.config.ViewService; |
| | | import com.ruili.wcp.web.model.AjaxResponse; |
| | | import com.ruili.wcp.web.model.ErrorInfo; |
| | | import com.zbooksoft.gdmis.common.*; |
| | | import com.zbooksoft.gdmis.common.PdfUtil; |
| | | import com.zbooksoft.gdmis.common.UsbSyncExampleWindows; |
| | | import com.zbooksoft.gdmis.common.UsbSyncExampleWindowsItem; |
| | | import com.zbooksoft.gdmis.common.UsbSyncExampleWindowsItemCg; |
| | | import com.zbooksoft.gdmis.data.entity.CatYswjxx; |
| | | import com.zbooksoft.gdmis.data.entity.PackingManage; |
| | | import com.zbooksoft.gdmis.service.CatCheckService; |
| | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.text.DecimalFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | import static com.zbooksoft.gdmis.common.ZipUtil.copyFile; |
| | | import static com.zbooksoft.gdmis.common.ZipUtil.zipFile; |
| | |
| | | cddzwjlj = newCddzwjlj; |
| | | } |
| | | copyFile(cddzwjlj, newSavePath + File.separator + name); |
| | | //添加导出日志 |
| | | LogUtils.insertLog("合格资料", "导出", "导出合格资料", "导出资料名称:" + wjm, "", request); |
| | | } |
| | | |
| | | } |
| | | } |
| | | // 压缩文件 |
| | | generatePath = zipFile(new File(filePath), "rar"); |
| | | |
| | | } catch (Exception ex) { |
| | | logger.error(ex.getMessage(), ex); |
| | | } |
| | |
| | | */ |
| | | @RequestMapping({"/updateFileTypeIndex"}) |
| | | @RequiresUser |
| | | public ModelAndView importIndex(Integer type,String moduleId) { |
| | | public ModelAndView importIndex(Integer type, String moduleId) { |
| | | ModelAndView mv = new ModelAndView("gh/catAjjxx/updateFileTypeIndex"); |
| | | mv.addObject("type", type); |
| | | mv.addObject("moduleId", moduleId); |
| | | return mv; |
| | | } |
| | | |
| | | /** |
| | | * 装盒管理 |
| | | * |
| | | * @param type 0:从转孔基本信息进入 1:从钻孔图幅进入 |
| | | */ |
| | | @RequestMapping({"/boxIndex"}) |
| | | @RequiresUser |
| | | public ModelAndView boxIndex() { |
| | | String box = "0001"; |
| | | String maxBoxSql = "select max(box_number) from BUS_PACKING_MANAGE WHERE TYPE = 1"; |
| | | String boxNum = jdbcTemplate.queryForObject(maxBoxSql, String.class); |
| | | if (boxNum != null || "".equals(boxNum)) { |
| | | int num = Integer.parseInt(boxNum); |
| | | num += 1; |
| | | DecimalFormat df = new DecimalFormat("0000"); |
| | | box = df.format(num); |
| | | } |
| | | ModelAndView mv = new ModelAndView("gh/catAjjxx/boxIndex"); |
| | | mv.addObject("boxNum", box); |
| | | return mv; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取盒内文件数量 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/getBoxPageNum") |
| | | @ResponseBody |
| | | @RequiresUser |
| | | public Object getBoxPageNum(String boxNum) { |
| | | try { |
| | | String pageNum = "0"; |
| | | String selectSql = "select max(PAGE_NMU) as nmu from BUS_PACKING_MANAGE WHERE box_number = '" + boxNum + "'"; |
| | | List<Map<String, Object>> mapList = jdbcTemplate.queryForList(selectSql); |
| | | if (mapList.size() > 0) { |
| | | pageNum = mapList.get(0).get("nmu") == null ? "0" : mapList.get(0).get("nmu").toString(); |
| | | } |
| | | return new AjaxResponse(pageNum); |
| | | } catch (Exception e) { |
| | | logger.error(e.getMessage(), e); |
| | | return new AjaxResponse(new ErrorInfo(e.getMessage()), false); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 原始文件装盒 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/packagingBoxYs") |
| | | @ResponseBody |
| | | @RequiresUser |
| | | public Object packagingBoxYs(String boxNum, @RequestBody ArrayList<Long> idList) { |
| | | try { |
| | | String box = boxNum; |
| | | String pageNum = "0"; |
| | | String selectSqlPage = "select max(PAGE_NMU) as nmu from BUS_PACKING_MANAGE WHERE box_number = '" + boxNum + "'"; |
| | | List<Map<String, Object>> mapList = jdbcTemplate.queryForList(selectSqlPage); |
| | | if (mapList.size() > 0) { |
| | | pageNum = mapList.get(0).get("nmu") == null ? "0" : mapList.get(0).get("nmu").toString(); |
| | | } |
| | | int newPage = Integer.parseInt(pageNum); |
| | | for (int i = 0; i < idList.size(); i++) { |
| | | String selectSql = "select * from CAT_ITEM_YSWJXX where id = " + idList.get(i); |
| | | Map<String, Object> map = jdbcTemplate.queryForMap(selectSql); |
| | | String itemNum = StringUtil.nullToEmpty(map.get("DH")).trim(); |
| | | String id = StringUtil.nullToEmpty(map.get("ID")).trim(); |
| | | String ajId = StringUtil.nullToEmpty(map.get("AJ_ID")).trim(); |
| | | QueryWrapper<PackingManage> packingManageQueryWrapper = new QueryWrapper<>(); |
| | | packingManageQueryWrapper.eq("item_id", idList.get(i)); |
| | | PackingManage packingManage = new PackingManage(); |
| | | List<PackingManage> packingManageList = packingManageService.list(packingManageQueryWrapper); |
| | | if (packingManageList.size() > 0) { |
| | | packingManage = packingManageList.get(0); |
| | | } |
| | | packingManage.setItemId(id); |
| | | packingManage.setAjId(ajId); |
| | | packingManage.setCreateTime(new java.util.Date()); |
| | | packingManage.setType(1); |
| | | String zzys = map.get("ZZYS") == null ? "0" : map.get("ZZYS").toString(); |
| | | if (newPage + Integer.parseInt(zzys) > 500) { |
| | | int num = Integer.parseInt(box); |
| | | num += 1; |
| | | DecimalFormat df = new DecimalFormat("0000"); |
| | | String newBox = df.format(num); |
| | | box = newBox; |
| | | newPage = Integer.parseInt(zzys); |
| | | } else { |
| | | newPage = newPage + Integer.parseInt(zzys); |
| | | } |
| | | packingManage.setPageNmu(newPage); |
| | | packingManage.setItemNum(itemNum + "-" + box); |
| | | packingManage.setBoxNumber(box); |
| | | packingManageService.saveOrUpdate(packingManage); |
| | | String updateSql = "update CAT_ITEM_YSWJXX set HH = '" + box + "' where id = " + idList.get(i); |
| | | jdbcTemplate.update(updateSql); |
| | | } |
| | | return new AjaxResponse(true); |
| | | } catch (Exception e) { |
| | | logger.error(e.getMessage(), e); |
| | | return new AjaxResponse(new ErrorInfo(e.getMessage()), false); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequiresUser |
| | | public List<Map<String, Object>> getFileType(Integer type) { |
| | | String sql = "SELECT param_name , param_value FROM sys_keyword_param where keyword_id = 1830441538759495681"; |
| | | if (type==1){ |
| | | if (type == 1) { |
| | | sql = "SELECT param_name , param_value FROM sys_keyword_param where keyword_id = 1830439705299193857"; |
| | | } |
| | | List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql); |