From 63211c7592b9c7b814de2756d338ffd33ac0c58f Mon Sep 17 00:00:00 2001
From: zhai <1528081232@qq.com>
Date: 星期一, 19 一月 2026 16:37:38 +0800
Subject: [PATCH] 1、提交验收按钮新增判断是否关联附件 2、借阅暂存添加不可外借新增提醒 3、成果表单借阅管理修改为借阅记录 4、合格资料模块,导出文件按钮需要添加日志 5、装盒按钮调整:需要一个确认按钮并且可以更改盒号,调整盒号时能同步展示盒号容量 6、对接斑马打印机 7、利用用户修改

---
 src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java |  230 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 202 insertions(+), 28 deletions(-)

diff --git a/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java b/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java
index 7b0c754..9d027d3 100644
--- a/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java
+++ b/src/main/java/com/zbooksoft/gdmis/controller/CatYswjxxController.java
@@ -1,7 +1,9 @@
 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;
@@ -13,6 +15,9 @@
 import com.ruili.wcp.web.model.AjaxResponse;
 import com.ruili.wcp.web.model.ErrorInfo;
 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;
@@ -37,6 +42,7 @@
 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;
@@ -123,8 +129,8 @@
                 String cgSql = "select NVL(max(BGBH), 0) BGBH FROM CAT_ITEM_CGWJXX";
                 Map<String, Object> stringMap = jdbcTemplate.queryForMap(cgSql);
                 int maxDH = Integer.parseInt(stringMap.get("BGBH").toString());
+                int newDH = maxDH + 1;
                 for (int i = 0; i < ids.size(); i++) {
-                    int newDH = maxDH + 1 + i;
                     String newDhString = String.format("%04d", newDH);
                     String sql = "select * from CAT_ITEM_YSWJXX where id = " + ids.get(i);
                     Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(sql);
@@ -144,6 +150,7 @@
                     String jnxh = stringObjectMap.get("JNXH") == null ? "" : stringObjectMap.get("JNXH").toString();
                     String newDh = newDhString + "-" + jnxh;
                     stringObjectMap.put("DH", newDh);
+                    stringObjectMap.put("WJLX", jsonData.get("wjlx"));
                     iform.insert(1823017354756390913L, stringObjectMap);
 
                     String updateSql = "update CAT_ITEM_YSWJXX set SL = '" + slInt + "' where ID = " + ids.get(i);
@@ -260,32 +267,39 @@
             String timestamp = Long.toString(System.currentTimeMillis());
 
             try {
+                //1193266555786362880,1193266555916386304,1193266556004466688,1193266556105129984,1193266556193210368,1193266556277096448,1193266556377759744,1193266556474228736,1193266556545531904 鍙樻垚list
+                String[] idList = ids.split(",");
+
                 // 璇诲彇鏂囦欢瀛樻斁璺緞
                 SystemConfig config = SystemConfig.getInstance();
                 filePath = config.getAttachUploadPath() + "dataPack" + File.separator + userName + "_" + timestamp + File.separator;
 //                for (int i = 0; i < idList.length; i++) {
-                String wjljSql = "SELECT WJLJ FROM CAT_ITEM_YSWJXX WHERE  ID  = " + ids;
-                List<Map<String, Object>> wjljList = jdbcTemplate.queryForList(wjljSql);
-                if (wjljList.size() > 0) {
-                    String newSavePath = filePath;
-                    if (wjljList.get(0).get("WJLJ") != null) {
-                        String cddzwjlj = wjljList.get(0).get("WJLJ").toString();
-                        File file = new File(cddzwjlj);
-                        String name = file.getName();
-                        if (name.contains(".pdf") || name.contains(".PDF")) {
-                            String parent = file.getParent();
-                            String newName = "tmp_" + name;
-                            String newCddzwjlj = parent + File.separator + newName;
-                            PdfUtil.addBlankPageAtBeginning(cddzwjlj, newCddzwjlj);
-                            cddzwjlj = newCddzwjlj;
+                for (int i = 0; i < idList.length; i++) {
+                    String wjljSql = "SELECT WJLJ,WJTM FROM CAT_ITEM_YSWJXX WHERE  ID  = " + idList[i];
+                    List<Map<String, Object>> wjljList = jdbcTemplate.queryForList(wjljSql);
+                    if (wjljList.size() > 0) {
+                        String newSavePath = filePath;
+                        if (wjljList.get(0).get("WJLJ") != null) {
+                            String cddzwjlj = wjljList.get(0).get("WJLJ").toString();
+                            String wjm = wjljList.get(0).get("WJTM").toString();
+                            File file = new File(cddzwjlj);
+                            String name = file.getName();
+                            if (name.contains(".pdf") || name.contains(".PDF")) {
+                                String parent = file.getParent();
+                                String newName = "tmp_" + name;
+                                String newCddzwjlj = parent + File.separator + newName;
+                                PdfUtil.addBlankPageAtBeginning(cddzwjlj, newCddzwjlj, wjm);
+                                cddzwjlj = newCddzwjlj;
+                            }
+                            copyFile(cddzwjlj, newSavePath + File.separator + name);
+                            //娣诲姞瀵煎嚭鏃ュ織
+                            LogUtils.insertLog("鍚堟牸璧勬枡", "瀵煎嚭", "瀵煎嚭鍚堟牸璧勬枡", "瀵煎嚭璧勬枡鍚嶇О锛�" + wjm, "", request);
                         }
-                        copyFile(cddzwjlj, newSavePath + File.separator + name);
                     }
-
                 }
-//                }
                 // 鍘嬬缉鏂囦欢
                 generatePath = zipFile(new File(filePath), "rar");
+
             } catch (Exception ex) {
                 logger.error(ex.getMessage(), ex);
             }
@@ -304,8 +318,7 @@
                 // 寰幆鍙栧嚭娴佷腑鐨勬暟鎹�
                 byte[] b = new byte[100];
                 int len;
-                while ((len = inStream.read(b)) > 0)
-                    response.getOutputStream().write(b, 0, len);
+                while ((len = inStream.read(b)) > 0) response.getOutputStream().write(b, 0, len);
                 inStream.close();
             } catch (Exception e) {
                 e.printStackTrace();
@@ -350,14 +363,176 @@
      * 瀵煎叆椤甸潰
      *
      * @param type 0:浠庤浆瀛斿熀鏈俊鎭繘鍏� 1:浠庨捇瀛斿浘骞呰繘鍏�
-     * @return
      */
     @RequestMapping({"/updateFileTypeIndex"})
     @RequiresUser
-    public ModelAndView importIndex(Integer type) {
+    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);
+        }
+    }
+
+    /**
+     * @param type 0 鏄垚鏋� 1 鏄師濮�
+     * @return
+     */
+    @RequestMapping({"/printLabelIndex"})
+    @RequiresUser
+    public ModelAndView printLabelIndex(Integer type) {
+        ModelAndView mv = new ModelAndView("gh/catAjjxx/printLabelIndex");
+        mv.addObject("type", type);
+        return mv;
+    }
+
+    /**
+     * @param fileType 鎵撳嵃绫诲瀷 0鏄洅瀛� 1鏄枃浠�
+     * @param type     璧勬枡绫诲瀷 0鎴愭灉鎶ュ憡 1鍘熷璧勬枡
+     * @param idList
+     * @return
+     */
+    @RequestMapping(value = "/printLabel")
+    @ResponseBody
+    @RequiresUser
+    public Object printLabel(String fileType, Integer type, @RequestBody List<Long> idList) {
+        try {
+            //鎵撳嵃鐩掑瓙
+            if ("鐩掑瓙".equals(fileType)) {
+                if (type == 0) {
+
+                }
+                if (type == 1) {
+
+                    UsbSyncExampleWindows usbSyncExampleWindows = new UsbSyncExampleWindows();
+                    usbSyncExampleWindows.printFileLabel(idList);
+//                    ZT411RFIDPrintService zt411RFIDPrintService = new ZT411RFIDPrintService();
+//                    zt411RFIDPrintService.printRFIDLabel(idList);
+                }
+            }
+            //鎵撳嵃鏂囦欢
+            if ("鏂囦欢".equals(fileType)) {
+                if (type == 0) {
+                    UsbSyncExampleWindowsItemCg usbSyncExampleWindowsItemCg = new UsbSyncExampleWindowsItemCg();
+                    usbSyncExampleWindowsItemCg.printItemLabelCg(idList);
+                }
+                if (type == 1) {
+                    UsbSyncExampleWindowsItem usbSyncExampleWindowsItem = new UsbSyncExampleWindowsItem();
+                    usbSyncExampleWindowsItem.printItemLabel(idList);
+                }
+            }
+            return new AjaxResponse(true);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
+        }
+    }
+
 
     /**
      * 鑾峰彇鏂囦欢绫诲瀷
@@ -367,8 +542,11 @@
     @RequestMapping(value = "/getFileType")
     @ResponseBody
     @RequiresUser
-    public List<Map<String, Object>> getFileType() {
+    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) {
+            sql = "SELECT param_name , param_value  FROM sys_keyword_param where  keyword_id = 1830439705299193857";
+        }
         List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
         return mapList;
     }
@@ -408,10 +586,6 @@
         }
     }
 
-    public static void main(String[] args) {
-        String fileType = "瑙�/G";
-        String substring = fileType.substring(fileType.indexOf("/") + 1);
-        System.out.println(substring);
-    }
+
 }
 

--
Gitblit v1.9.1