From 639ea7256f10697d19c19cc878e999bcb7b1e6a1 Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期一, 09 三月 2026 22:53:49 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/LMESController.cs | 623 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 576 insertions(+), 47 deletions(-)
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index fbe5764..1d1d394 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -10,6 +10,10 @@
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
+using System.Web;
+using System.IO;
+using WebAPI.Controllers.SCGL;
+
namespace WebAPI.Controllers
{
public class LMESController : ApiController
@@ -22,14 +26,9 @@
public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
//鑷畾涔�34杩涘埗鏁扮粍
private static char[] lNCode = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
+ string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
-
-
- /// <summary>
- /// 杩斿洖杩涚珯鎵弿鍒楄〃|宸ュ簭杩涚珯鎺ユ敹鍗曞垪琛�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 杩斿洖杩涚珯鎵弿鍒楄〃|宸ュ簭杩涚珯鎺ユ敹鍗曞垪琛�
[Route("LEMS/MES_StationInBillList_Json")]
[HttpGet]
public object MES_StationInBillList_Json(string sWhere)
@@ -56,15 +55,12 @@
}
return GetObjectJson(ds);
}
+ #endregion
- /// <summary>
- /// 杩斿洖宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ富琛�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 杩斿洖宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ富琛�
[Route("LEMS/MES_Sc_ProcessExchangeBillQuery_Json")]
[HttpGet]
- public object MES_Sc_ProcessExchangeBillList_Json(string sWhere, string user,string HBillSubType)
+ public object MES_Sc_ProcessExchangeBillList_Json(string sWhere, string user, string HBillSubType)
{
DataSet ds;
try
@@ -82,7 +78,8 @@
return objJsonResult;
}
}
- else {
+ else
+ {
//鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
@@ -105,7 +102,7 @@
//鑾峰彇闇�瑕佹嫾鎺ョ殑瀛楃涓�
string sql_splice = DBUtility.ClsPub.SpliceSQL(user, "宸ュ簭娲惧伐鍗曞垪琛�");
- sWhere += sql_splice;
+ sWhere += sql_splice;
}
}
@@ -122,7 +119,7 @@
string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
}
-
+
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess锛�";
@@ -139,6 +136,8 @@
return objJsonResult;
}
}
+ #endregion
+
#region 宸ュ簭娴佽浆鍗$淮鎶�-鏌ヨ
/// <summary>
@@ -497,15 +496,10 @@
#endregion
- /// <summary>
- /// 宸ュ簭娴佽浆鍗″彧鏄剧ず宸ュ簭鏌撳巶鐨勬暟鎹�
- /// </summary>
- /// <param name="sWhere"></param>
- /// <param name="user"></param>
- /// <returns></returns>
+ #region 宸ュ簭娴佽浆鍗″彧鏄剧ず宸ュ簭鏌撳巶鐨勬暟鎹�
[Route("LEMS/MES_ProcessExchangeBillList_Json")]
[HttpGet]
- public object MES_ProcessExchangeBillList_Json(string sWhere, string user,int OperationType)
+ public object MES_ProcessExchangeBillList_Json(string sWhere, string user, int OperationType)
{
DataSet ds;
try
@@ -521,7 +515,8 @@
return objJsonResult;
}
- if (OperationType == 1) {
+ if (OperationType == 1)
+ {
//鑾峰彇绯荤粺鍙傛暟
string Ret = "";
if (oSystemParameter.ShowBill(ref Ret))
@@ -532,7 +527,8 @@
sWhere += " and 宸ュ簭='鏌撳巶' ";
}
- else {
+ else
+ {
sWhere += " and 宸ュ簭='绮楃(' ";
}
}
@@ -540,7 +536,7 @@
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
ds = oCN.RunProcReturn("select top 1000 * from h_v_Sc_ProcessExchangeBillList where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList");
}
- else
+ else
{
//鑾峰彇绯荤粺鍙傛暟
string Ret = "";
@@ -549,13 +545,13 @@
//鍒ゆ柇瀹㈡埛涓洪緳灞辨苯閰�
if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴")
{
-
+
}
}
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeArrangementList where 1 = 1 " + sWhere , "h_v_Sc_ProcessExch_v_Sc_ProcessExchangeArrangementListhangeBillList");
+ ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeArrangementList where 1 = 1 " + sWhere, "h_v_Sc_ProcessExch_v_Sc_ProcessExchangeArrangementListhangeBillList");
}
//娣诲姞鍒楀悕
@@ -582,6 +578,7 @@
return objJsonResult;
}
}
+ #endregion
#region 宸ュ簭娴佽浆鍗″彧鏄剧ず宸ュ簭鏁版嵁
[Route("LEMS/MES_ProcessExchangeBillList_PG")]
@@ -727,7 +724,17 @@
oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + HSourceID + " where HInterID=" + HInterID + " and HEntryID=" + HEntryID);
oCN.RunProc("exec h_p_Sc_ICMOBillStatus_Tmp_PG " + HInterID + "," + HEntryID);
-
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn) == true)
+ {
+ if (oSystemParameter.omodel.WMS_CampanyName == "鍗庤垷")
+ {
+ oCN.RunProc("update Sc_ProcessExchangeBillMain set HMakeDate = GETDATE(),HMaker='"+ user + "' where HInterID = " + HInterID );
+
+ //鑷姩鐢熸垚宸ヤ綔鑱旂郴鍗�
+ oCN.RunProc("exec h_p_OA_WorkLinkBill_Create " + HInterID + "," + 3772);
+ }
+ }
oCN.Commit();
}
@@ -831,6 +838,180 @@
}
}
#endregion
+
+ #region 宸ュ簭娴佽浆鍗℃壒閲忔淳宸ワ紙鍗庤垷锛�
+ [Route("LEMS/ProcessExchangeArrangement_Add_PGPL")]
+ [HttpPost]
+ public object ProcessExchangeArrangement_Add_PGPL([FromBody] JObject msg)
+ {
+ var _value = msg["msg"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString(); //瀛愯〃
+ string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+ string msg4 = sArray[3].ToString();//鐢ㄦ埛鍚�
+
+ try
+ {
+ // 鍙嶅簭鍒楀寲瀛愯〃鏁版嵁
+ var detailList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(msg3);
+
+ foreach (var row in detailList)
+ {
+ // 3. 寮�濮嬩簨鍔�
+ oCN.BeginTran();
+ DataSet ds2 = null;
+ // 鑾峰彇瀛愯〃瀛楁鍊�
+ string hSourceID = row.ContainsKey("HSourceID") ? row["HSourceID"] : "0";
+ string hMoldID = row.ContainsKey("HMoldID") ? row["HMoldID"] : "0";
+ string hSourceInterID = row.ContainsKey("HSourceInterID") ? row["HSourceInterID"] : "0";
+ string hSourceEntryID = row.ContainsKey("HSourceEntryID") ? row["HSourceEntryID"] : "0";
+
+ if (hSourceID == "0" || hMoldID == "0")
+ {
+ continue;
+ }
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn) == true)
+ {
+ if (oSystemParameter.omodel.WMS_CampanyName == "鍗庤垷")
+ {
+ oCN.RunProc("update Sc_ProcessExchangeBillMain set HMakeDate = GETDATE(),HRemark3='宸叉淳宸�',HMaker='" + msg4 + "' where HInterID = " + hSourceInterID);
+ LogService.Write("鑷姩鐢熸垚宸ヤ綔鑱旂郴鍗�...");
+
+ //鑷姩鐢熸垚宸ヤ綔鑱旂郴鍗�
+ ds2 = oCN.RunProcReturn("exec h_p_OA_WorkLinkBill_Create " + hSourceInterID + "," + 3772, "h_p_OA_WorkLinkBill_Create");
+ }
+ }
+ oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + hSourceID + " where HInterID=" + hSourceInterID + " and HEntryID=" + hSourceEntryID);
+ // 鎻掑叆鐢熶骇鐘舵�佷复鏃惰〃
+ string SQL = $"exec h_p_Sc_ICMOBillStatus_Tmp_PGPL {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
+ oCN.RunProc(SQL);
+ //鎻掑叆宸ュ簭娴佽浆鍗℃淳宸ュ崟
+ string SQL1 = $"exec h_p_Sc_ProcExchSendWorkBill_PG {hSourceInterID},{hSourceEntryID},{hSourceID},{hMoldID}";
+ oCN.RunProc(SQL1);
+
+ // 7. 鎻愪氦浜嬪姟
+ oCN.Commit();
+ if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
+ {
+ int HInterID = int.Parse(ds2.Tables[0].Rows[0]["NewHInterID"].ToString());
+ LogService.Write("鎵ц娑堟伅鎺ㄩ��..." + HInterID);
+
+ // 瑙﹀彂娑堟伅鎺ㄩ��
+ Service.GeTuiService.PubishSingle(HInterID);
+ }
+ }
+
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "娲惧伐淇℃伅淇濆瓨鎴愬姛锛�";
+
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+ }
+
+ return objJsonResult;
+ }
+ #endregion
+
+ #region 鍙栨秷娲惧伐鍔熻兘(鍗庤垷)
+ [Route("LEMS/ProcessExchangeArrangementDel_PGHZ")]
+ [HttpGet]
+ public object ProcessExchangeArrangementDel_PGHZ(string HInterID_S, string user)
+ {
+ DataSet ds;
+ DataSet ds1;
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娴佽浆鍗℃棤缂栬緫鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ var HNum = HInterID_S.Split(',');
+
+ oCN.BeginTran();
+
+ for (int j = 0; j < HNum.Length; j++)
+ {
+
+ long HInterID = long.Parse(HNum[j].Split('|')[0]);
+ long HEntryID = long.Parse(HNum[j].Split('|')[1]);
+ long HSourceID = long.Parse(HNum[j].Split('|')[2]);
+ ds = oCN.RunProcReturn(@"select a.HMaterID,b.HProcID,a.HBillNo from Sc_ProcessExchangeBillMain a inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID where a.HInterID=" + HInterID + " and b.HEntryID=" + HEntryID, "Sc_ProcessExchangeBillMain");
+ LogService.Write(1);
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ユ棤姝ゅ伐搴忔祦杞崱锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鏍规嵁涓诲瓙ID+浜х嚎鏌ヨ鏄惁娲惧伐
+ ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + " and HSourceID=" + HSourceID , "Sc_ICMOBillStatus_Tmp");
+ LogService.Write(2);
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎶ュ伐鏌ユ棤鏁版嵁锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ LogService.Write(3);
+ oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=0 where HInterID=" + HInterID + " and HEntryID=" + HEntryID);
+ LogService.Write(4);
+ //鏇存柊鎺夊凡娲惧伐瀛楁
+ oCN.RunProc("update Sc_ProcessExchangeBillMain set HRemark3='' where HInterID=" + HInterID);
+ LogService.Write(5);
+ oCN.RunProc("delete from Sc_ICMOBillStatus_Tmp where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + " and HSourceID=" + HSourceID);
+ LogService.Write(6);
+ //鏌ヨ鏄惁鏈夊嚭绔欏崟杩欎釜宸ュ崟杩欎釜浜х嚎
+ ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HProcExchInterID=" + HInterID + " and HProcExchEntryID=" + HEntryID + " and HSourceID=" + HSourceID + "", "Sc_StationOutBillMain");
+ LogService.Write(7);
+ if (ds!=null && ds.Tables[0].Rows.Count == 0)
+ {
+ //娌℃湁鍑虹珯鍗曠殑杩涜鍒犻櫎宸ュ簭娴佽浆鍗℃淳宸ュ崟
+ oCN.RunProc("delete from Sc_ProcExchSendWorkBillMain where HInterID=(select HInterID from Sc_ProcExchSendWorkBillSub where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + " and HSourceID=" + HSourceID + " )");
+ LogService.Write(8);
+ oCN.RunProc("delete from Sc_ProcExchSendWorkBillSub where HSourceInterID=" + HInterID + " and HSourceEntryID=" + HEntryID + " and HSourceID=" + HSourceID);
+ LogService.Write(9);
+ }
+ }
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "宸插彇娑堟淳宸ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "寮傚父锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鎺掔几鍔熻兘
[Route("LEMS/ProcessExchangeArrangement_Add")]
@@ -1044,11 +1225,8 @@
}
#endregion
- /// <summary>
- /// 杩斿洖宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ粠琛�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ粠琛�
+
[Route("LEMS/MES_Sc_ProcessExchangeBillQuerySub_Json")]
[HttpGet]
public object MES_Sc_ProcessExchangeBillSub_Json(string sWhere)
@@ -1071,12 +1249,10 @@
return objJsonResult;
}
}
+ #endregion
- /// <summary>
- /// 杩斿洖宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ粠琛�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+
+ #region 杩斿洖宸ュ簭娴佽浆鍗$淮鎶ゅ垪琛ㄤ粠琛�
[Route("LEMS/MES_Sc_ProcessExchangeBillQueryCheckRecordSub_Json")]
[HttpGet]
public object MES_Sc_ProcessExchangeBillQueryCheckRecordSub_Json(string sWhere, int selected)
@@ -1086,7 +1262,7 @@
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
string sql = "exec h_p_ProcessExchangeBillCheckRecordList_GetSubBillList " +
- "@sWhere = N'" + sWhere + "'" +
+ "@sWhere = N'" + sWhere + "'" +
", @selected = N'" + selected + "'";
ds = oCN.RunProcReturn(sql, "h_p_ProcessExchangeBillCheckRecordList_GetSubBillList");
return GetObjectJson(ds);
@@ -1100,6 +1276,8 @@
return objJsonResult;
}
}
+ #endregion
+
#region 宸ュ簭娴佽浆鍗★紙涓嬭揪锛�
@@ -2070,6 +2248,74 @@
return GetObjectJson(ds);
}
+ /// <summary>
+ /// 杩斿洖宸ュ簭娴佽浆鍗″垪琛�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("LEMS/MES_Sc_ProcessExchangeBillList_Json")]
+ [HttpGet]
+ public object MES_Sc_ProcessExchangeBillList_Json(string sWhere, string user)
+ {
+ DataSet ds;
+ try
+ {
+ List<object> columnNameList = new List<object>()
+; //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBillQuery", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愭煡璇�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鑾峰彇绯荤粺鍙傛暟
+ string Ret = "";
+ if (oSystemParameter.ShowBill(ref Ret))
+ {
+ //鍒ゆ柇瀹㈡埛涓洪緳灞辨苯閰�
+ if (oSystemParameter.omodel.WMS_CampanyName == "榫欏北姹介厤")
+ {
+ //鑾峰彇闇�瑕佹嫾鎺ョ殑瀛楃涓�
+ string sql_splice = DBUtility.ClsPub.SpliceSQL(user, "鐢熶骇璁㈠崟鍒楄〃");
+
+ sWhere += sql_splice;
+ }
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere + " order by 鍒跺崟鏃ユ湡 desc,鍗曟嵁鍙� desc", "h_v_Sc_ProcessExchangeBillQuery");
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+ //{
+ //objJsonResult.code = "1";
+ //objJsonResult.count = 1;
+ //objJsonResult.Message = "Sucess锛�";
+ //objJsonResult.data = ds.Tables[0];
+ //objJsonResult.list = a;
+ //return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ return GetObjectJson(ds);
+ }
+
+
+
#region 鐢熶骇璁㈠崟鍒楄〃-鍒嗛〉
[Route("LEMS/MES_IF_ICMOBillList_Json_byPage")]
@@ -3039,7 +3285,6 @@
ds = null;
}
return CustomCorrect(ds);
- //return ds.Tables[0].Rows;
}
//澧ㄨタ鍝ョ櫧鏍囩敓鎴�
@@ -3193,7 +3438,6 @@
ds = null;
}
return CustomCorrect(ds);
- //return ds.Tables[0].Rows;
}
#endregion
@@ -3252,9 +3496,7 @@
ds = null;
}
return CustomCorrect(ds);
- //return ds.Tables[0].Rows;
}
-
#endregion
@@ -3305,7 +3547,7 @@
[Route("LEMS/SaveToSc_PackUnionBillMain_MXG")]
[HttpGet]
- public object SaveToSc_PackUnionBillMain(string HBillNo, string HRemark, string HProjectNum, string zxQty, string BBM, string LDM, string HMaterNumber, string HBarCode_White,string HOrgID,string NBXMH)
+ public object SaveToSc_PackUnionBillMain_MXG(string HBillNo, string HRemark, string HProjectNum, string zxQty, string BBM, string LDM, string HMaterNumber, string HBarCode_White,string HOrgID,string NBXMH)
{
DataSet ds;
DataSet dsHSNum;
@@ -3547,7 +3789,6 @@
ds = null;
}
return CustomCorrect(ds);
- //return ds.Tables[0].Rows;
}
#endregion
@@ -3952,7 +4193,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "[0000-1-051]" + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "锛�";
+ objJsonResult.Message = ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "锛�";
objJsonResult.data = null;
return objJsonResult;
}
@@ -5064,5 +5305,293 @@
}
}
#endregion
+
+ #region 澶氱骇瀹℃牳瀹℃牳鍒楄〃
+ [Route("LEMS/CheckFlowList")]
+ [HttpGet]
+ public json CheckFlowList(string sWhere, string billType, int type, string userid)
+ {
+ DataSet ds;
+ json res = new json();
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn($"exec h_p_Xt_CheckFlowList '','{billType}',{type},'{userid}'", "h_p_Xt_CheckFlowList");
+ }
+ else
+ {
+ sWhere = sWhere.Replace("'", "''");
+ ds = oCN.RunProcReturn($"exec h_p_Xt_CheckFlowList '{sWhere}','{billType}',{type},'{userid}'", "h_p_Xt_CheckFlowList");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ res.code = CodeConstant.SUCCEED;
+ res.count = 1;
+ res.Message = "Sucess锛�";
+ res.list = columnNameList;
+ res.data = ds.Tables[0];
+ return res;
+ }
+ catch (Exception e)
+ {
+ res.code = CodeConstant.FAIL;
+ res.count = CountConstant.FAIL;
+ res.Message = "Exception锛�" + e.ToString();
+ res.data = null;
+ return res;
+ }
+ }
+ #endregion
+
+ #region 鍙嶅鏍告剰瑙佹彁浜�
+ [Route("LMES/AuditFlowOpinion")]
+ [HttpGet]
+ public json AuditFlowOpinion(string sWhere,string billType,int HInterID, int type, string user)
+ {
+ DataSet ds;
+ json res = new json();
+ try
+ {
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn($"exec h_p_Xt_AuditFlowOpinion '','{billType}',{HInterID},{type},'{user}'", "h_p_Xt_AuditFlowOpinion");
+ }
+ else
+ {
+ sWhere = sWhere.Replace("'", "''");
+ ds = oCN.RunProcReturn($"exec h_p_Xt_AuditFlowOpinion '{sWhere}','{billType}',{HInterID},{type},'{user}'", "h_p_Xt_AuditFlowOpinion");
+ }
+
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍告剰瑙佹彁浜ゅけ璐�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍告剰瑙佹彁浜ゅけ璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ res.code = CodeConstant.SUCCEED;
+ res.count = 1;
+ res.Message = "Sucess锛�";
+ res.data = ds.Tables[0].Rows[0]["HRemark"];
+ return res;
+ }
+ catch (Exception e)
+ {
+ res.code = CodeConstant.FAIL;
+ res.count = CountConstant.FAIL;
+ res.Message = "Exception锛�" + e.ToString();
+ res.data = null;
+ return res;
+ }
+ }
+ #endregion
+
+ #region app鏂囦欢涓婁紶閫氱敤鎺ュ彛
+ [Route("LMES/UploadFile")]
+ [HttpPost]
+ public object UploadFile()
+ {
+
+ string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //鍗曟嵁鍙�
+ string HRemark = HttpContext.Current.Request.Params["HRemark"]; //澶囨敞
+ string HUserName = HttpContext.Current.Request.Params["HUserName"]; //鍒涘缓浜�
+ HttpPostedFile files = HttpContext.Current.Request.Files["file"];
+ string path = HttpContext.Current.Server.MapPath("~/../Files/APPFolder/" + HBillNo);
+ //string path = @"D:\\Files\\"+ HBillNo;
+ dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName);
+ if (dyResult != null && dyResult.result == 1)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "涓婁紶鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = dyResult.returnval;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+
+ public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName)
+ {
+ dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" };
+ string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞
+ string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚�
+ string filename = files.FileName;//鏂囦欢鍚�
+ string fileSavePath = path;// 涓婁紶淇濆瓨璺緞
+ int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte
+ int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M
+ DataSet ds = new DataSet();
+ try
+ {
+ if (files == null || files.ContentLength <= 0)
+ {
+ Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" };
+ return Result_Ob;
+ }
+ if (filesize >= Maxsize)
+ {
+ Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" };
+ return Result_Ob;
+ }
+
+ string fileurl = Path.Combine(fileSavePath, filename);
+ if (Directory.Exists(fileurl) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀�
+ {
+ Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" };
+ return Result_Ob;
+ }
+ //鍒犻櫎鏁版嵁琛ㄦ暟鎹�
+ ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList");
+ if (Directory.Exists(path))
+ {
+ File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢
+ files.SaveAs(fileurl);
+ string StrPath = "/files/APPFolder/" + HBillNo + "/" + filename;
+ if (File.Exists(fileurl))
+ {
+ //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
+ //鍐欏叆鏁版嵁琛�
+ oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" +
+ ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" +
+ ",HFileClsID,HSourceBillNo" +
+ ") values('"
+ + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" +
+ ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize +
+ "','" + 0 + "','" + HBillNo +
+ "') ");
+ }
+ else
+ {
+ Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
+ }
+ }
+ else
+ {
+ Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶�
+ files.SaveAs(fileurl);
+ string StrPath = "/files/APPFolder/" + HBillNo + "/" + filename;
+ if (File.Exists(fileurl))
+ {
+ //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
+ //鍐欏叆鏁版嵁琛�
+ oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" +
+ ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" +
+ ",HFileClsID,HSourceBillNo" +
+ ") values('"
+ + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" +
+ ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize +
+ "','" + 0 + "','" + HBillNo +
+ "') ");
+ }
+ else
+ {
+ Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ Result_Ob = new { result = 0, returnval = e.Message };
+ }
+ return Result_Ob;
+ }
+
+ /// <summary>
+ /// 鏍规嵁鍗曟嵁鍙锋煡鎵句笂浼犳枃浠跺垪琛�
+ /// </summary>
+ /// <param name="sWhere"></param>
+ /// <returns></returns>
+ [Route("LMES/Filelist")]
+ [HttpGet]
+ public object Filelist(string HBillNo)
+ {
+ DataSet ds = new DataSet();
+ var url = fileip + "/files/APPFolder/" + HBillNo + "/";
+ //@"C:\\files\\"
+ try
+ {
+ ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList");
+ 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>
+ /// 鏍规嵁ID,鍗曟嵁鍙�,鏂囦欢鍚� 鍒犻櫎鏂囦欢
+ /// </summary>
+ /// <param name="sWhere"></param>
+ /// <returns></returns>
+ [Route("LMES/DeleteFilelist")]
+ [HttpGet]
+ public object DeleteFilelist(string HItemID, string HSourceBillNo, string HFileName)
+ {
+ try
+ {
+
+ oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID);
+ string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/EquipFolder/" + HSourceBillNo), HFileName);
+ File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ 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
+
+
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1