From 7a8a84577894b766a95c6cbfa5ac7b51e54ac242 Mon Sep 17 00:00:00 2001
From: zhai <1528081232@qq.com>
Date: 星期三, 17 九月 2025 09:06:54 +0800
Subject: [PATCH] 1、获取文件大写修改 2、提交jdbc连接地质
---
src/main/java/com/zbooksoft/gdmis/controller/ScanPrintController.java | 123 +++++++++++++++++++++++++++++++++--------
1 files changed, 99 insertions(+), 24 deletions(-)
diff --git a/src/main/java/com/zbooksoft/gdmis/controller/ScanPrintController.java b/src/main/java/com/zbooksoft/gdmis/controller/ScanPrintController.java
index d8055ea..8d15158 100644
--- a/src/main/java/com/zbooksoft/gdmis/controller/ScanPrintController.java
+++ b/src/main/java/com/zbooksoft/gdmis/controller/ScanPrintController.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruili.wcp.common.StringUtil;
import com.ruili.wcp.data.entity.config.View;
import com.ruili.wcp.data.entity.management.User;
import com.ruili.wcp.engine.form.IFormData;
@@ -67,13 +68,27 @@
}
/**
+ * @Description 褰掕繕鎵弿
+ * @Date 2020/12/12
+ **/
+ @RequestMapping(value = "/returnScanPrint")
+ public ModelAndView returnScanPrint(Long viewId) {
+ ModelAndView modelAndView = new ModelAndView();
+ modelAndView.setViewName("scanPrint/returnPrint");
+ modelAndView.addObject("viewId", viewId);
+
+ modelAndView.addObject("printType", 2);
+ return modelAndView;
+ }
+
+ /**
* @Description 鍏ュ簱鎵弿
* @Date 2020/12/12
**/
@RequestMapping(value = "/inScanPrint")
public ModelAndView inScanPrint(Long viewId) {
ModelAndView modelAndView = new ModelAndView();
- modelAndView.setViewName("scanPrint/scanPrint");
+ modelAndView.setViewName("scanPrint/scanInPrint");
modelAndView.addObject("viewId", viewId);
modelAndView.addObject("printType", 0);
return modelAndView;
@@ -89,22 +104,29 @@
@RequestMapping(value = "/saveScanPrintData")
@RequiresUser
@ResponseBody
- public Object saveScanPrintData(@RequestBody List<Map<String, Object>> data, int printType, Long viewId) {
+ public Object saveScanPrintData(@RequestBody List<Map<String, Object>> data, int printType, Long viewId, String boxNum) {
Subject currentUser = SecurityUtils.getSubject();
Session session = currentUser.getSession();
User user = (User) session.getAttribute("user");
- View view = viewService.getViewById(viewId);
- String mainTableName = view.getMainTableName();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- if (data != null && data.size() > 0) {
- if (printType == 0) { //鍏ュ簱鎵弿
- updateWarehousing(mainTableName, data);
+ try {
+ View view = viewService.getViewById(viewId);
+ String mainTableName = view.getMainTableName();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ if (data != null && data.size() > 0) {
+ if (printType == 0) { //鍏ュ簱鎵弿
+ updateWarehousing(data, boxNum);
+ }
+ if (printType == 1) { //鍑哄簱
+ outWarehousing(data);
+ }
+ if (printType == 2) { //褰掕繕
+ returnWarehousing(data);
+ }
}
- if (printType == 1) { //鍑哄簱
- outWarehousing(data);
- }
+ } catch (Exception e) {
+ return new AjaxResponse(false);
}
return new AjaxResponse(true);
}
@@ -124,20 +146,61 @@
* @Description 鍏ュ簱
* @Date 2020/12/13
**/
- private void updateWarehousing(String tableName, List<Map<String, Object>> data) {
+ private void updateWarehousing(List<Map<String, Object>> data, String boxNum) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- StringBuilder sql = new StringBuilder("UPDATE " + tableName + " SET IN_STATUS_CODE=0, IN_STATUS='宸插叆搴�', IN_TIME=TO_DATE('" + sdf.format(new Date()) + "', 'yyyy-mm-dd hh24:mi:ss') WHERE ARCHIVAL_CODE IN (");
+ //鏇存柊鍑哄簱鐘舵��
for (int i = 0; i < data.size(); i++) {
String archivalCode = (String) data.get(i).get("archival_code");
- if (archivalCode != null) {
- sql.append("'" + archivalCode + "'");
- if (i < data.size() - 1) {
- sql.append(",");
- }
+ String sqlSelect = "select * from BUS_PACKING_MANAGE where ITEM_NUM = '" + archivalCode + "'";
+ Map<String, Object> packingMap = jdbcTemplate.queryForMap(sqlSelect);
+
+ long itemId = Long.parseLong(packingMap.get("ITEM_ID").toString());
+ String sql = "select * from BUS_WAREHOUSING where item_id =" + itemId + " and IN_STATUS_CODE =2";
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
+ if (mapList.size() > 0) {
+ Map<String, Object> map = mapList.get(0);
+
+
+ Date date = new Date();
+ String format = sdf.format(date);
+ HashMap<String, Object> mapData = new HashMap<>();
+ mapData.put("IN_STATUS_CODE", 3);
+ mapData.put("OUT_STATUS", "宸插叆搴�");
+ mapData.put("IN_TIME", format);
+ iFormData.update(1972515952908148738L, mapData, Long.parseLong(map.get("ID").toString()));
+
+ String sqlUpdateBox = "update BUS_PACKING_MANAGE SET BOX_NUMBER='" + boxNum + "', ITEM_STATE='宸插叆搴�' WHERE ID=" + packingMap.get("ID");
+ jdbcTemplate.update(sqlUpdateBox);
}
}
- sql.append(")");
- jdbcTemplate.update(sql.toString());
+ }
+
+ /**
+ * @Description 褰掕繕
+ * @Date 2020/12/13
+ **/
+ private void returnWarehousing(List<Map<String, Object>> data) {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ //鏇存柊鍑哄簱鐘舵��
+ for (int i = 0; i < data.size(); i++) {
+ String archivalCode = (String) data.get(i).get("archival_code");
+ String sqlSelect = "select * from BUS_PACKING_MANAGE where ITEM_NUM = '" + archivalCode + "'";
+ Map<String, Object> packingMap = jdbcTemplate.queryForMap(sqlSelect);
+
+ long itemId = Long.parseLong(packingMap.get("ITEM_ID").toString());
+ String sql = "select * from BUS_WAREHOUSING where item_id =" + itemId + " and IN_STATUS_CODE =1";
+ List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
+ if (mapList.size() > 0) {
+ Map<String, Object> map = mapList.get(0);
+ Date date = new Date();
+ String format = sdf.format(date);
+ String sqlUpdate = "update BUS_WAREHOUSING SET IN_STATUS_CODE=2, OUT_STATUS='寰呭叆搴�', IN_TIME='" + format + "' WHERE ID=" + map.get("ID");
+ jdbcTemplate.update(sqlUpdate);
+
+ String sqlUpdateBox = "update BUS_PACKING_MANAGE SET ITEM_STATE='宸插綊杩�' WHERE ID=" + packingMap.get("ID");
+ jdbcTemplate.update(sqlUpdateBox);
+ }
+ }
}
/**
@@ -150,17 +213,29 @@
for (int i = 0; i < data.size(); i++) {
String archivalCode = (String) data.get(i).get("archival_code");
String sqlSelect = "select * from BUS_PACKING_MANAGE where ITEM_NUM = '" + archivalCode + "'";
- Map<String, Object> packingMap = jdbcTemplate.queryForMap(sqlSelect);
+ List<Map<String, Object>> mapList1 = jdbcTemplate.queryForList(sqlSelect);
+ Map<String, Object> packingMap = null;
+ if (mapList1.size() > 0) {
+ packingMap = mapList1.get(0);
+ }
long itemId = Long.parseLong(packingMap.get("ITEM_ID").toString());
String sql = "select * from BUS_WAREHOUSING where item_id =" + itemId + " and IN_STATUS_CODE =0";
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
- if (mapList.size() >= 0) {
+ if (mapList.size() > 0) {
Map<String, Object> map = mapList.get(0);
+
+ String boxNumber = packingMap.get("BOX_NUMBER") == null ? "" : packingMap.get("BOX_NUMBER").toString();
+ String storageLocation = packingMap.get("STORAGE_LOCATION") == null ? "" : packingMap.get("STORAGE_LOCATION").toString();
Date date = new Date();
String format = sdf.format(date);
- String sqlUpdate = "update BUS_WAREHOUSING SET OUT_STATUS_CODE=1, OUT_STATUS='宸插嚭搴�', OUT_TIME='" + format + "' WHERE ID=" + map.get("ID");
- jdbcTemplate.update(sqlUpdate);
+ HashMap<String, Object> mapData = new HashMap<>();
+ mapData.put("IN_STATUS_CODE", 1);
+ mapData.put("OUT_STATUS", "宸插嚭搴�");
+ mapData.put("OUT_TIME", format);
+ mapData.put("BOX_NUM", boxNumber);
+ mapData.put("LOCATION_NUMBER", storageLocation);
+ iFormData.update(1972515952908148738L, mapData, Long.parseLong(map.get("ID").toString()));
String sqlUpdateBox = "update BUS_PACKING_MANAGE SET ITEM_STATE='鍊熷嚭' WHERE ID=" + packingMap.get("ID");
jdbcTemplate.update(sqlUpdateBox);
--
Gitblit v1.9.1