From 55b36b1279fd11feafde05a65ec835f55aa89850 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期一, 27 十二月 2021 13:23:25 +0800
Subject: [PATCH] #

---
 src/main/java/com/slcf/service/impl/WaitPakOutServiceImpl.java |  133 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 113 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/slcf/service/impl/WaitPakOutServiceImpl.java b/src/main/java/com/slcf/service/impl/WaitPakOutServiceImpl.java
index b4cce8d..2c7e77b 100644
--- a/src/main/java/com/slcf/service/impl/WaitPakOutServiceImpl.java
+++ b/src/main/java/com/slcf/service/impl/WaitPakOutServiceImpl.java
@@ -1,11 +1,19 @@
 package com.slcf.service.impl;
 
+import java.io.IOException;
+import java.io.OutputStream;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.slcf.bean.WaitPakOutLogCondition;
 import com.slcf.controller.param.SetEmsParam;
+import com.slcf.pojo.WaitPakOutLogBean;
+import com.slcf.util.DateTimeUtil;
 import org.apache.ibatis.annotations.Param;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -18,6 +26,8 @@
 import com.slcf.pojo.WorkMastBean;
 import com.slcf.service.WaitPakOutService;
 
+import javax.servlet.http.HttpServletResponse;
+
 /**
  * 鍏ュ簱閫氱煡妗f帴鍙e疄鐜�
  * @author admin
@@ -27,7 +37,7 @@
 public class WaitPakOutServiceImpl implements WaitPakOutService {
 
 	@Autowired
-	WaitPakOutDao WaitPakOutDao;
+	WaitPakOutDao waitPakOutDao;
 	
 	@Autowired
 	WorkFileDao workFileDao;
@@ -37,7 +47,7 @@
 	public int insertWaitPakOut(WaitPakOutBean waitPakOut) {
 		int result=0;
 		try {
-			result=WaitPakOutDao.insertWaitPakOut(waitPakOut);
+			result=waitPakOutDao.insertWaitPakOut(waitPakOut);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 		}
@@ -63,8 +73,8 @@
 	public Map<String,Object> queryWaitPakOutList(WaitPakOutCondition waitPakOutCon) {
 		try {
 			Map<String,Object> map=new HashMap<String, Object>();
-			List<WaitPakOutBean> list=WaitPakOutDao.queryWaitPakOutList(waitPakOutCon);
-			int count =WaitPakOutDao.getWaitPakOutCount(waitPakOutCon);
+			List<WaitPakOutBean> list=waitPakOutDao.queryWaitPakOutList(waitPakOutCon);
+			int count =waitPakOutDao.getWaitPakOutCount(waitPakOutCon);
 			map.put("rows", list);
 			map.put("total", count);
 			return map;
@@ -83,15 +93,15 @@
 //	}
 
 	public Integer waitPakOutSetEms(SetEmsParam setEmsParam) {
-		return WaitPakOutDao.waitPakOutSetEms(setEmsParam.getLgnum(), setEmsParam.getTanum(), setEmsParam.getTapos());
+		return waitPakOutDao.waitPakOutSetEms(setEmsParam.getLgnum(), setEmsParam.getTanum(), setEmsParam.getTapos());
 	}
 
 	public Integer countEmsNum() {
-		return WaitPakOutDao.countEmsNum();
+		return waitPakOutDao.countEmsNum();
 	}
 
 	public List<WaitPakOutBean> queryWaitOutPak(String vlpla, String matnr) {
-		return WaitPakOutDao.queryWaitOutPak(vlpla, matnr);
+		return waitPakOutDao.queryWaitOutPak(vlpla, matnr);
 	}
 
 	/**
@@ -99,7 +109,7 @@
 	 */
 	public WaitPakOutBean queryWaitPakOutById(String sheet_no,String mat_no) {
 		try {
-			return WaitPakOutDao.getWaitPakOutById(sheet_no,mat_no);
+			return waitPakOutDao.getWaitPakOutById(sheet_no,mat_no);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
@@ -111,7 +121,7 @@
 	 */
 	public WaitPakOutBean queryWaitPakOutByLocNo(String loc_no) {
 		try {
-			return WaitPakOutDao.getWaitPakOutByLocNo(loc_no);
+			return waitPakOutDao.getWaitPakOutByLocNo(loc_no);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
@@ -123,7 +133,7 @@
 	 */
 	public WaitPakOutBean queryWaitPakOutByMatNo(String mat_no) {
 		try {
-			return WaitPakOutDao.getWaitPakOutByMatNo(mat_no);
+			return waitPakOutDao.getWaitPakOutByMatNo(mat_no);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
@@ -134,7 +144,7 @@
 	public int upWaitPakOut(WaitPakOutBean WaitPakOut, int type) {
 		int result=0;
 		try {
-			result=WaitPakOutDao.upWaitPakOut(WaitPakOut);
+			result=waitPakOutDao.upWaitPakOut(WaitPakOut);
 //			if(type==2) {
 //				//濡傛灉宸ヤ綔妗f湁鏁版嵁锛岃皟鏁村伐浣滄。浼樺厛绾�
 //				WorkDetailBean workDetail = workFileDao.getWorkDetlByMatNo(WaitPakOut.getMat_no());
@@ -158,7 +168,7 @@
 	public int upWaitPakOutByLocNo(WaitPakOutBean WaitPakOut) {
 		int result=0;
 		try {
-			result=WaitPakOutDao.upWaitPakOutByLocNo(WaitPakOut);
+			result=waitPakOutDao.upWaitPakOutByLocNo(WaitPakOut);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 		}
@@ -171,7 +181,7 @@
 	public int delWaitPakOut(WaitPakOutBean WaitPakOut) {
 		int result=0;
 		try {
-			result=WaitPakOutDao.delWaitPakOutById(WaitPakOut);
+			result=waitPakOutDao.delWaitPakOutById(WaitPakOut);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 		}
@@ -184,7 +194,7 @@
 	 */
 	public List<WaitPakOutBean> getWaitPakOutList() {
 		try {
-			return WaitPakOutDao.getWaitPakOutList();
+			return waitPakOutDao.getWaitPakOutList();
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
@@ -199,8 +209,8 @@
 	public int moveToLog(WaitPakOutBean WaitPakOut) {
 		int result=0;
 		try {
-			result=WaitPakOutDao.insertLog(WaitPakOut);
-			result=WaitPakOutDao.delWaitPakOutById(WaitPakOut);
+			result=waitPakOutDao.insertLog(WaitPakOut);
+			result=waitPakOutDao.delWaitPakOutById(WaitPakOut);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 		}
@@ -213,7 +223,7 @@
 	 */
 	public List<WaitPakOutBean> getSheetNoList() {
 		try {
-			return WaitPakOutDao.getSheetNoList();
+			return waitPakOutDao.getSheetNoList();
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
@@ -225,7 +235,7 @@
 	 */
 	public WaitPakOutBean queryWaitPakOutByNum(WaitPakOutBean waitPakOutBean) {
 		try {
-			return WaitPakOutDao.getWaitPakOutByNum(waitPakOutBean);
+			return waitPakOutDao.getWaitPakOutByNum(waitPakOutBean);
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
@@ -237,7 +247,7 @@
 	 */
 	public WaitPakOutBean queryWaitPakOutFnh() {
 		try {
-			return WaitPakOutDao.getWaitPakOutFnh();
+			return waitPakOutDao.getWaitPakOutFnh();
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
@@ -249,10 +259,93 @@
 	 */
 	public WaitPakOutBean getWaitPakOutPrint() {
 		try {
-			return WaitPakOutDao.getWaitPakOutPrint();
+			return waitPakOutDao.getWaitPakOutPrint();
 		}catch(Exception e) {
 			System.out.println(e.getMessage());
 			return null;
 		}
 	}
+
+	public void ExportWaitPakOutList(WaitPakOutCondition condition, HttpServletResponse response) {
+		//杈撳嚭Excel鏂囦欢
+		try {
+			//HSSFWorkbook瀵硅薄(excel鐨勬枃妗e璞�)
+			HSSFWorkbook workBook=new HSSFWorkbook();
+
+			//sheet瀵硅薄锛坋xcel鐨勮〃鍗曪級
+			HSSFSheet sheet=workBook.createSheet("鍑哄簱閫氱煡鍘嗗彶妗�");
+
+			//琛屾暟锛屽弬鏁颁负琛岀储寮�(excel鐨勮)
+//				HSSFRow rowHead=sheet.createRow(0);//绗竴琛�  鍙互鏄�0锝�65535涔嬮棿鐨勪换浣曚竴涓�
+
+//				//鍒涘缓excel鐨勫崟鍏冩牸锛屽弬鏁颁负鍒楃储寮曪紝鍙互鏄�0锝�255涔嬮棿鐨勪换浣曚竴涓�
+//				HSSFCell cellOne=rowHead.createCell(0);
+//				cellOne.setCellValue("鐢ㄦ埛淇℃伅");//琛ㄥご
+
+			//鍚堝苟鍗曞厓鏍糃ellRangeAddress鏋勯�犲弬鏁颁緷娆¤〃绀鸿捣濮嬭锛屾埅鑷宠锛岃捣濮嬪垪锛� 鎴嚦鍒�
+//				sheet.addMergedRegion(new CellRangeAddress(0,0,0,5));
+
+			sheet.setColumnWidth(0, (int)((10 + 0.72) * 256));
+			sheet.setColumnWidth(1, (int)((20 + 0.72) * 256));
+			sheet.setColumnWidth(2, (int)((15 + 0.72) * 256));
+			sheet.setColumnWidth(3, (int)((15 + 0.72) * 256));
+			sheet.setColumnWidth(4, (int)((15 + 0.72) * 256));
+			sheet.setColumnWidth(5, (int)((25 + 0.72) * 256));
+			sheet.setColumnWidth(6, (int)((10 + 0.72) * 256));
+			sheet.setColumnWidth(7, (int)((8 + 0.72) * 256));
+			sheet.setColumnWidth(8, (int)((10 + 0.72) * 256));
+			sheet.setColumnWidth(9, (int)((10 + 0.72) * 256));
+			sheet.setColumnWidth(10, (int)((10 + 0.72) * 256));
+			sheet.setColumnWidth(11, (int)((25 + 0.72) * 256));
+			sheet.setColumnWidth(12, (int)((25 + 0.72) * 256));
+			sheet.setColumnWidth(13, (int)((25 + 0.72) * 256));
+
+			HSSFRow rows=sheet.createRow(0);//绗簩琛�
+			//鍒涘缓鍗曞厓鏍煎苟璁剧疆鍗曞厓鏍煎唴瀹�
+			rows.createCell(0).setCellValue("浠撳簱鍙�");
+			rows.createCell(1).setCellValue("杞偍缂栧彿");
+			rows.createCell(2).setCellValue("琛岄」鐩�");
+			rows.createCell(3).setCellValue("鐗╂枡");
+			rows.createCell(4).setCellValue("鐗╂枡鎻忚堪");
+			rows.createCell(5).setCellValue("宸ュ巶");
+			rows.createCell(6).setCellValue("鏁伴噺");
+			rows.createCell(7).setCellValue("鍗曚綅");
+			rows.createCell(8).setCellValue("婧愬彂鍦扮被鍨�");
+			rows.createCell(9).setCellValue("婧愬彂鍦颁粨浣�");
+			rows.createCell(10).setCellValue("鐩殑鍦扮被鍨�");
+			rows.createCell(11).setCellValue("鐩殑鍦颁粨浣�");
+			rows.createCell(12).setCellValue("鐢ㄦ埛ID");
+			rows.createCell(13).setCellValue("淇敼鏃堕棿");
+
+			List<WaitPakOutBean> list=waitPakOutDao.getWaitPakOutAll(condition);
+			for(int i=0;i<list.size();i++){
+				HSSFRow row=sheet.createRow(i+1);//浠庣涓夎寮�濮�
+				//鍒涘缓鍗曞厓鏍煎苟璁剧疆鍗曞厓鏍煎唴瀹�
+				row.createCell(0).setCellValue(list.get(i).getLgnum());
+				row.createCell(1).setCellValue(list.get(i).getTanum());
+				row.createCell(2).setCellValue(list.get(i).getTapos());
+				row.createCell(3).setCellValue(list.get(i).getMatnr());
+				row.createCell(4).setCellValue(list.get(i).getMaktx());
+				row.createCell(5).setCellValue(list.get(i).getWerks());
+				row.createCell(6).setCellValue(list.get(i).getVsolm());
+				row.createCell(7).setCellValue(list.get(i).getMeins());
+				row.createCell(8).setCellValue(list.get(i).getVltyp());
+				row.createCell(9).setCellValue(list.get(i).getVlpla());
+				row.createCell(10).setCellValue(list.get(i).getNltyp());
+				row.createCell(11).setCellValue(list.get(i).getNlpla());
+				row.createCell(12).setCellValue(list.get(i).getBname());
+				row.createCell(13).setCellValue(list.get(i).getModi_time());
+			}
+//			//杈撳嚭Excel鏂囦欢
+//		    try {
+			OutputStream output=response.getOutputStream();
+			response.reset();
+			response.setHeader("Content-disposition", "attachment; filename=WaitPakOut"+ DateTimeUtil.getStringDateTime(14)+".xls");
+			response.setContentType("application/msexcel");
+			workBook.write(output);
+			output.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.1