From ef206394571d1a731af6ab7c26a4832be8771542 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 03 十一月 2022 10:53:53 +0800
Subject: [PATCH] 作业指导书维护
---
WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillController.cs | 244 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 244 insertions(+), 0 deletions(-)
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillController.cs"
new file mode 100644
index 0000000..4f59850
--- /dev/null
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillController.cs"
@@ -0,0 +1,244 @@
+锘縰sing NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using Pub_Class;
+using System;
+using System.Data;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Runtime.InteropServices;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+//using Excel = Microsoft.Office.Interop.Excel;
+
+
+namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡
+{
+ public class Gy_SOPBillController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+ private json objJsonResult = new json();
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ DataSet ds;
+ DAL.ClsGy_SOPBill oBill = new DAL.ClsGy_SOPBill();
+
+ public DataGridView grdMain = new System.Windows.Forms.DataGridView();
+
+ #region 浣滀笟鎸囧涔﹀垪琛�
+ [Route("Gy_SOPBill/list")]
+ [HttpGet]
+ public object getSOPBillList(string sWhere, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("Gy_SOPBillMain", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn("select * from h_v_Gy_SOPBillList order by hmainid ", "h_v_Gy_SOPBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Gy_SOPBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by hmainid ";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_SOPBillList");
+ }
+
+ //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+ //{
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ //}
+ //else
+ //{
+ //objJsonResult.code = "0";
+ //objJsonResult.count = 0;
+ //objJsonResult.Message = "鏃犳暟鎹�";
+ //objJsonResult.data = null;
+ //return objJsonResult;
+ //}
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 寮曞嚭
+ [Route("Gy_SOPBill/SetExcel")]
+ [HttpGet]
+ public HttpResponseMessage Sc_StationInBillSetExcel(string sWhere)
+ {
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ ISheet sheet = workbook.CreateSheet("sheet1");
+ IRow row = sheet.CreateRow(0);
+
+
+ row.CreateCell(0).SetCellValue("鍗曟嵁鍙�");
+ row.CreateCell(1).SetCellValue("鍗曟嵁绫诲瀷");
+ row.CreateCell(2).SetCellValue("宸ヨ壓鍚嶇О");
+ row.CreateCell(3).SetCellValue("鐗╂枡浠g爜");
+ row.CreateCell(4).SetCellValue("鐗╂枡鍚嶇О");
+ row.CreateCell(5).SetCellValue("瑙勬牸鍨嬪彿");
+ row.CreateCell(6).SetCellValue("璁¢噺鍗曚綅浠g爜");
+ row.CreateCell(7).SetCellValue("璁¢噺鍗曚綅");
+ row.CreateCell(8).SetCellValue("榛樿鎸囧涔�");
+ row.CreateCell(9).SetCellValue("琛ㄥご澶囨敞");
+ row.CreateCell(10).SetCellValue("宸ュ簭鍙�");
+ row.CreateCell(11).SetCellValue("宸ュ簭浠g爜");
+ row.CreateCell(12).SetCellValue("宸ュ簭");
+ row.CreateCell(13).SetCellValue("宸ヤ綔涓績浠g爜");
+ row.CreateCell(14).SetCellValue("宸ヤ綔涓績鍚嶇О");
+ row.CreateCell(15).SetCellValue("宸ヤ綅浠g爜");
+ row.CreateCell(16).SetCellValue("宸ヤ綅");
+ row.CreateCell(17).SetCellValue("琛ㄤ綋澶囨敞");
+ row.CreateCell(18).SetCellValue("浣跨敤鏍囪");
+ row.CreateCell(19).SetCellValue("鍚敤浜�");
+ row.CreateCell(20).SetCellValue("鍚敤鏃ユ湡");
+ row.CreateCell(21).SetCellValue("鍒跺崟浜�");
+ row.CreateCell(22).SetCellValue("鍒跺崟鏃ユ湡");
+ row.CreateCell(23).SetCellValue("瀹℃牳浜�");
+ row.CreateCell(24).SetCellValue("瀹℃牳鏃ユ湡");
+ row.CreateCell(25).SetCellValue("淇敼浜�");
+ row.CreateCell(26).SetCellValue("淇敼鏃ユ湡");
+ row.CreateCell(27).SetCellValue("浣滃簾浜�");
+ row.CreateCell(28).SetCellValue("浣滃簾鏃ユ湡");
+
+
+ //绮剧‘鎺у埗鍒楀
+ sheet.SetColumnWidth(1, 5000);
+ sheet.SetColumnWidth(2, 5000);
+ sheet.SetColumnWidth(3, 5000);
+ sheet.SetColumnWidth(4, 5000);
+ sheet.SetColumnWidth(5, 5000);
+ sheet.SetColumnWidth(6, 5000);
+ sheet.SetColumnWidth(7, 5000);
+ sheet.SetColumnWidth(8, 5000);
+ sheet.SetColumnWidth(9, 5000);
+ sheet.SetColumnWidth(10, 5000);
+ sheet.SetColumnWidth(11, 5000);
+ sheet.SetColumnWidth(12, 5000);
+ sheet.SetColumnWidth(13, 5000);
+ sheet.SetColumnWidth(14, 5000);
+ sheet.SetColumnWidth(15, 5000);
+ sheet.SetColumnWidth(16, 5000);
+ sheet.SetColumnWidth(17, 5000);
+ sheet.SetColumnWidth(18, 5000);
+ sheet.SetColumnWidth(19, 5000);
+ sheet.SetColumnWidth(20, 5000);
+ sheet.SetColumnWidth(21, 5000);
+ sheet.SetColumnWidth(22, 5000);
+ sheet.SetColumnWidth(23, 5000);
+ sheet.SetColumnWidth(24, 5000);
+ sheet.SetColumnWidth(25, 5000);
+ sheet.SetColumnWidth(26, 5000);
+ sheet.SetColumnWidth(27, 5000);
+ sheet.SetColumnWidth(28, 5000);
+ sheet.SetColumnWidth(29, 5000);
+
+
+ DataSet ds = oCN.RunProcReturn("select * from h_v_Gy_SOPBillList" + sWhere + " order by hmainid desc", "h_v_Gy_SOPBillList");
+ for (var i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ IRow row1 = sheet.CreateRow(i + 1);
+ row1.CreateCell(0).SetCellValue(ds.Tables[0].Rows[i]["鍗曟嵁鍙�"].ToString());
+ row1.CreateCell(1).SetCellValue(ds.Tables[0].Rows[i]["鍗曟嵁绫诲瀷"].ToString());
+ row1.CreateCell(2).SetCellValue(ds.Tables[0].Rows[i]["宸ヨ壓鍚嶇О"].ToString());
+ row1.CreateCell(3).SetCellValue(ds.Tables[0].Rows[i]["鐗╂枡浠g爜"].ToString());
+ row1.CreateCell(4).SetCellValue(ds.Tables[0].Rows[i]["鐗╂枡鍚嶇О"].ToString());
+ row1.CreateCell(5).SetCellValue(ds.Tables[0].Rows[i]["瑙勬牸鍨嬪彿"].ToString());
+ row1.CreateCell(6).SetCellValue(ds.Tables[0].Rows[i]["璁¢噺鍗曚綅浠g爜"].ToString());
+ row1.CreateCell(7).SetCellValue(ds.Tables[0].Rows[i]["璁¢噺鍗曚綅"].ToString());
+ row1.CreateCell(8).SetCellValue(ds.Tables[0].Rows[i]["榛樿鎸囧涔�"].ToString());
+ row1.CreateCell(9).SetCellValue(ds.Tables[0].Rows[i]["琛ㄥご澶囨敞"].ToString());
+ row1.CreateCell(10).SetCellValue(ds.Tables[0].Rows[i]["宸ュ簭鍙�"].ToString());
+ row1.CreateCell(11).SetCellValue(ds.Tables[0].Rows[i]["宸ュ簭浠g爜"].ToString());
+ row1.CreateCell(12).SetCellValue(ds.Tables[0].Rows[i]["宸ュ簭"].ToString());
+ row1.CreateCell(13).SetCellValue(ds.Tables[0].Rows[i]["宸ヤ綔涓績浠g爜"].ToString());
+ row1.CreateCell(14).SetCellValue(ds.Tables[0].Rows[i]["宸ヤ綔涓績鍚嶇О"].ToString());
+ row1.CreateCell(15).SetCellValue(ds.Tables[0].Rows[i]["宸ヤ綅浠g爜"].ToString());
+ row1.CreateCell(16).SetCellValue(ds.Tables[0].Rows[i]["宸ヤ綅"].ToString());
+ row1.CreateCell(17).SetCellValue(ds.Tables[0].Rows[i]["琛ㄤ綋澶囨敞"].ToString());
+ row1.CreateCell(18).SetCellValue(ds.Tables[0].Rows[i]["浣跨敤鏍囪"].ToString());
+ row1.CreateCell(19).SetCellValue(ds.Tables[0].Rows[i]["鍚敤浜�"].ToString());
+ row1.CreateCell(20).SetCellValue(ds.Tables[0].Rows[i]["鍚敤鏃ユ湡"].ToString());
+ row1.CreateCell(21).SetCellValue(ds.Tables[0].Rows[i]["鍒跺崟浜�"].ToString());
+ row1.CreateCell(22).SetCellValue(ds.Tables[0].Rows[i]["鍒跺崟鏃ユ湡"].ToString());
+ row1.CreateCell(23).SetCellValue(ds.Tables[0].Rows[i]["瀹℃牳浜�"].ToString());
+ row1.CreateCell(24).SetCellValue(ds.Tables[0].Rows[i]["瀹℃牳鏃ユ湡"].ToString());
+ row1.CreateCell(25).SetCellValue(ds.Tables[0].Rows[i]["淇敼浜�"].ToString());
+ row1.CreateCell(26).SetCellValue(ds.Tables[0].Rows[i]["淇敼鏃ユ湡"].ToString());
+ row1.CreateCell(27).SetCellValue(ds.Tables[0].Rows[i]["浣滃簾浜�"].ToString());
+ row1.CreateCell(28).SetCellValue(ds.Tables[0].Rows[i]["浣滃簾鏃ユ湡"].ToString());
+
+ }
+ System.IO.MemoryStream ms = new System.IO.MemoryStream();
+ workbook.Write(ms);
+ ms.Position = 0;
+
+ var response = new HttpResponseMessage(HttpStatusCode.OK);
+ response.Content = new StreamContent(ms);
+
+ response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
+ var fileName = "浣滀笟鎸囧涔﹀垪琛�.xls";
+
+ response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
+ {
+ FileName = System.Web.HttpUtility.UrlEncode(fileName)
+ };
+ return response;
+ }
+ #endregion
+
+
+ //
+ private Int32 Fun_GetCol(string sCol)
+ {
+ return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
+ }
+ #region 浣跨敤
+ [Route("Gy_SOPBill/BatchUse")]
+ [HttpGet]
+ public object sy_Click()
+ {
+ long sOldInterID = 0;
+ for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
+ {
+ long HInterID = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMainID")].Value);
+ if (HInterID == 0 || HInterID == sOldInterID)
+ {
+ continue;
+ }
+ else
+ {
+ sOldInterID = HInterID;
+ }
+ if (!oBill.Sub_RoutingCheckAndUsed(HInterID))
+ {
+ continue;
+ }
+ }
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎵归噺浣跨敤瀹屾瘯锛�";
+ return objJsonResult;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1