From 1a94e0e270668ef1cfbcd5043b72bc6591a50706 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期四, 07 八月 2025 15:18:46 +0800
Subject: [PATCH] 价目表新增审核按钮无效修理bug
---
WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillController.cs | 410 ++++++++++++++++++++++++++++++++--------------------------
1 files changed, 224 insertions(+), 186 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"
index 4f59850..dc2d10c 100644
--- "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"
@@ -1,17 +1,14 @@
-锘縰sing NPOI.HSSF.UserModel;
-using NPOI.SS.UserModel;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
+using System.Collections;
+using System.Collections.Generic;
using System.Data;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Runtime.InteropServices;
+using System.Data.SqlClient;
using System.Web.Http;
-using System.Windows.Forms;
using WebAPI.Models;
-//using Excel = Microsoft.Office.Interop.Excel;
-
+using WebAPI.Service;
namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡
{
@@ -22,54 +19,29 @@
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
- DAL.ClsGy_SOPBill oBill = new DAL.ClsGy_SOPBill();
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
- public DataGridView grdMain = new System.Windows.Forms.DataGridView();
-
- #region 浣滀笟鎸囧涔﹀垪琛�
- [Route("Gy_SOPBill/list")]
+ /// <summary>
+ /// 杩斿洖鐢熶骇璧勬簮鐢熶骇鐘舵�佸伐鍗曞垪琛�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Sc_ICMOBillStatus_Tmp/list")]
[HttpGet]
- public object getSOPBillList(string sWhere, string user)
+ public object list(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;
- //}
+ string sql1 = string.Format(@"select * from h_v_Sc_WorkOrderList where 寮�宸ユ爣璁� = 1 and HMainID='" + sWhere + "'");
+
+ ds = oCN.RunProcReturn(sql1, "h_v_Sc_WorkOrderList");
+
- 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)
{
@@ -80,165 +52,231 @@
return objJsonResult;
}
}
- #endregion
- #region 寮曞嚭
- [Route("Gy_SOPBill/SetExcel")]
+
+ /// <summary>
+ /// 杩斿洖鏂囦欢娓呭崟鍒楄〃
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Sc_ICMOBillStatus_Tmp/Filelist")]
[HttpGet]
- public HttpResponseMessage Sc_StationInBillSetExcel(string sWhere)
+ public object Filelist(int 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++)
+ try
{
- 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());
+ //缂栬緫鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log_second("Gy_Material", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ string sql1 = string.Format(@"select * from h_v_Sc_GetFileList where 鏂囦欢ID = " + sWhere);
+ ds = oCN.RunProcReturn(sql1, "h_v_Sc_GetFileList");
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
}
- 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")
+ catch (Exception e)
{
- FileName = System.Web.HttpUtility.UrlEncode(fileName)
- };
- return response;
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
- #endregion
-
- //
- private Int32 Fun_GetCol(string sCol)
- {
- return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
- }
- #region 浣跨敤
- [Route("Gy_SOPBill/BatchUse")]
+ /// <summary>
+ /// 杩斿洖褰撳墠鐢熶骇璧勬簮鐢熶骇鐘舵�佷笅鐨勫伐鍗曞垪琛�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Sc_ICMOBill/list2")]
[HttpGet]
- public object sy_Click()
+ public object list2(string HSourceID, string user,string HMainID)
{
- long sOldInterID = 0;
- for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
+ try
{
- long HInterID = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMainID")].Value);
- if (HInterID == 0 || HInterID == sOldInterID)
+ var sWhere = "";
+ if (Convert.ToInt32(HMainID) != 0 && HMainID.ToString() != "")
{
- continue;
+ sWhere += " and HMainID = " + HMainID;
+ }
+ string sql1 = string.Format(@"select * from h_v_Sc_ICMOBillList_ToSop where 鐘舵�� = '寮�宸�' and HSourceID='" + HSourceID + "'" + sWhere);
+
+ ds = oCN.RunProcReturn(sql1, "h_v_Sc_ICMOBillList_ToSop");
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
+ /// 杩斿洖鐢熶骇宸ヤ綅鍒楄〃淇℃伅
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Gy_SourceWorkStationSet_ToSop/Soplist")]
+ [HttpGet]
+ public object Soplist(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ string sql1 = string.Format(@"select * from h_v_Gy_SourceWorkStationSetList where 1 = 1");
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn(sql1 + sWhere + " order by HItemID ", "h_v_Gy_SourceWorkStationSetList");
}
else
{
- sOldInterID = HInterID;
+ string sql = sql1 + sWhere + " order by HItemID ";
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_SourceWorkStationSetList");
}
- if (!oBill.Sub_RoutingCheckAndUsed(HInterID))
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
{
- continue;
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
}
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
}
- objJsonResult.count = 1;
- objJsonResult.Message = "鎵归噺浣跨敤瀹屾瘯锛�";
- return objJsonResult;
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
- #endregion
+
+ /// <summary>
+ /// 鏍规嵁鐗╂枡锛屽伐鍗曟煡鎵句綔涓氭寚瀵间功
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Gy_SopBill/getListByMaterID")]
+ [HttpGet]
+ public object getListByMaterID(Int64 HMaterID, string HSourceNo)
+ {
+ try
+ {
+ var sWhere = "";
+ if (Convert.ToInt32(HMaterID) != 0 && HMaterID.ToString() != "" && HSourceNo != null && HSourceNo.ToString() != "" )
+ {
+ sWhere += " and HMaterID = " + HMaterID + " and HSourceNo = '" + HSourceNo + "'";
+ }
+ string sql1 = string.Format(@"select * from h_v_Sc_ICMOBillList_ToSop where 1 = 1 " + sWhere);
+
+ ds = oCN.RunProcReturn(sql1, "h_v_Sc_ICMOBillList_ToSop");
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
+ /// 鏍规嵁鐗╂枡+宸ュ簭鏌ユ壘浣滀笟鎸囧涔�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Gy_SopBill/getListByMaterProc")]
+ [HttpGet]
+ public object getListByMaterProc(Int64 HMaterID, Int64 HProcID,string HType)
+ {
+ try
+ {
+ var sWhere = "";
+ if (HType != "")
+ {
+ if (Convert.ToInt32(HMaterID) != 0 && HMaterID.ToString() != "" && Convert.ToInt32(HProcID) != 0 && HProcID.ToString() != "")
+ {
+ sWhere += " and HMaterID = " + HMaterID + " and HProcID = " + HProcID + " and HProcID2 = " + HProcID + " and 鎸囧涔︾被鍨� = '"+ HType + "'";
+ }
+ }
+ else
+ {
+ if (Convert.ToInt32(HMaterID) != 0 && HMaterID.ToString() != "" && Convert.ToInt32(HProcID) != 0 && HProcID.ToString() != "")
+ {
+ sWhere += " and HMaterID = " + HMaterID + " and HProcID = " + HProcID + " and HProcID2 = " + HProcID + " ";
+ }
+ }
+ //if (Convert.ToInt32(HMaterID) != 0 && HMaterID.ToString() != "" && Convert.ToInt32(HProcID) != 0 && HProcID.ToString() != "")
+ //{
+ // sWhere += " and HMaterID = " + HMaterID + " and HProcID = " + HProcID + " and HProcID2 = " + HProcID ;
+ //}
+ string sql1 = string.Format(@"select * from h_v_Sc_ICMOBillStatus_Tmp_SOP where 1 = 1 " + sWhere);
+
+ //鑾峰彇鏄剧ず绯荤粺鍙傛暟
+ string sReturn = "";
+ oSystemParameter.ShowBill(ref sReturn);
+
+ if (oSystemParameter.omodel.WMS_CampanyName == "涔濊彵") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤
+ {
+ ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOBillStatus_Tmp_SOP where HMaterID = " + HMaterID, "h_v_Sc_ICMOBillStatus_Tmp_SOP");
+ }
+ else
+ {
+ ds = oCN.RunProcReturn(sql1, "h_v_Sc_ICMOBillStatus_Tmp_SOP");
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1