From 4c03d71d42db66b6c08828ce76bfcfe3e3a4e4fb Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期三, 18 三月 2026 16:48:21 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/WebAPIController.cs | 885 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 879 insertions(+), 6 deletions(-)
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index c2b4a06..ab61d72 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -1150,7 +1150,52 @@
}
}
+ /// <summary>
+ /// 鑾峰彇浠撳簱鍒楄〃 --娣诲姞妯″叿浠撳簱鏉′欢 鐢ㄤ簬鍙煡璇㈡ā鍏蜂粨搴�
+ /// </summary>
+ /// <returns></returns>
+ [Route("Web/GetWarehouseList_Json_MJ")]
+ [HttpGet]
+ public object GetWarehouseList_Json_MJ(string Warehouse, Int64 HOrgID)
+ {
+ sWhere = " Where HStopFlag=0 and HEndFlag=1 and HWarehouseType='妯″叿浠撳簱' and HUSEORGID =" + HOrgID + "";
+ //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
+ if (Warehouse != "")
+ {
+ sWhere = sWhere + " and ( HNumber like '%" + Warehouse + "%' or HName like '%" + Warehouse + "%' or HUSEORGID like '%" + Warehouse + "%' ) ";
+ }
+ try
+ {
+ WebS.WebService1 oWeb = new WebS.WebService1();
+ ds = oWeb.GetWarehouseList(sWhere, ref DBUtility.ClsPub.sErrInfo);
+ if (ds == null || ds.Tables[0].Rows.Count <= 0)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+ objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ objjson.code = "0";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = ds.Tables[0];
+ return objjson;
+ }
+ }
+ catch (Exception ex)
+ {
+
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
/// <summary>
/// 鑾峰彇浠撲綅鍒楄〃
@@ -1466,14 +1511,68 @@
}
}
+ #region 鑾峰彇鑱屽憳鍒楄〃 (娣诲姞杞﹂棿绛涢��)
+ [Route("Web/GetEmployeeList_Json")]
+ [HttpGet]
+ public object GetEmployeeList_Json3(string Employee, Int64 HGroupID, Int64 HDeptID = -1)
+ {
+ // 缁欓儴闂�(杞﹂棿)ID璁剧疆榛樿鍊硷紝褰撴病鏈変紶鍏ュ�兼垨鑰呭�间负0鐨勬椂鍊欙紝璧版棫鏈夌殑鍑芥暟锛屽惁鍒欒蛋鏂扮殑閫昏緫
+ if(HDeptID == -1 || HDeptID == 0)
+ {
+ return GetEmployeeList_Json2(Employee, HGroupID);
+ }else
+ {
+ sWhere = $" Where HStopFlag=0 and HEndFlag=1 and HDeptID=${HDeptID}";
+
+ if(Employee != "")
+ {
+ sWhere += " and ( HNumber like '%" + Employee + "%' or HName like '%" + Employee + "%' )";
+ }
+ if(HGroupID != 0)
+ {
+ sWhere += " and HGroupID=" + HGroupID.ToString();
+ }
+
+ try
+ {
+ string sql = $"Select * from h_v_IF_Emp {sWhere} Order by HNumber";
+ ds = oCN.RunProcReturn(sql, "h_v_IF_Emp");
+ if (ds == null || ds.Tables[0].Rows.Count <= 0)
+ {
+ // 濡傛灉 閫掑叆 閮ㄩ棬娌℃湁缁存姢浜哄憳鍒楄〃 鍒欓檷绾т娇鐢ㄨ�佹柟妗�
+ return GetEmployeeList_Json2(Employee, HGroupID);
+ }
+ else
+ {
+ objjson.code = "0";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = ds.Tables[0];
+ return objjson;
+ }
+ }
+ catch (Exception ex)
+ {
+
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+
+ }
+ }
+ #endregion
+
/// <summary>
/// 鑾峰彇鑱屽憳鍒楄〃
/// </summary>
/// <returns></returns>
- [Route("Web/GetEmployeeList_Json")]
- [HttpGet]
- public object GetEmployeeList_Json(string Employee, Int64 HGroupID)
+ // [Route("Web/GetEmployeeList_Json")]
+ // [HttpGet]
+ public object GetEmployeeList_Json2(string Employee, Int64 HGroupID)
{
sWhere = " Where HStopFlag=0 and HEndFlag=1";
//sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
@@ -1492,11 +1591,11 @@
{
if (Employee != "")
{
- sWhere = " Where HStopFlag=0 and HWHID=" + HGroupID.ToString() + " and ( HNumber like '%" + Employee + "%' or HName like '%" + Employee + "%' ) ";
+ sWhere = " Where HStopFlag=0 and HGroupID=" + HGroupID.ToString() + " and ( HNumber like '%" + Employee + "%' or HName like '%" + Employee + "%' ) ";
}
else
{
- sWhere = " Where HStopFlag=0 and HWHID=" + HGroupID.ToString();
+ sWhere = " Where HStopFlag=0 and HGroupID=" + HGroupID.ToString();
}
}
try
@@ -1531,6 +1630,7 @@
}
}
+
/// <summary>
/// 鑾峰彇鐝鍒楄〃
@@ -20333,6 +20433,7 @@
try
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
string sql = "exec h_p_Gy_GetQCCheckItemByProject_Sec " + CheckProjectID + "," + HBatchQty + "," + HMaterID + ",'" + HBillType + "'";
ds = oCN.RunProcReturn(sql, "h_p_Gy_GetQCCheckItemByProject_Sec");
if (ds == null || ds.Tables[0].Rows.Count <= 0)
@@ -20930,6 +21031,80 @@
}
}
+ #region
+ [Route("Web/GetMouldBillsList")]
+ [HttpGet]
+ public object GetMouldBillsList(string sWhere, string Type, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ string HView = "";
+ switch (Type)
+ {
+ case "RC": // 妯″叿缁翠慨妫�楠屽崟
+ HView = "h_v_Sc_MouldRepairCheckBillList";
+ break;
+ case "PG": // 妯″叿缁翠慨娲惧伐鍗�
+ HView = "h_v_Sc_MouldRepairSendWorkBill";
+ break;
+ default:
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "璁惧妯″潡绫诲瀷閿欒锛�";
+ objjson.data = null;
+ return objjson;
+ }
+
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+ ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
+ if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //鏄惁绠$悊鍛�
+ {
+ //涓嶆槸绠$悊鍛�
+ sWhere += " and 鍒跺崟浜� = '" + user + "'";
+ }
+
+
+ string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 鏃ユ湡 desc, hmainid desc");
+ ds = oCN.RunProcReturn(sql, HView);
+ //娣诲姞鍒楀悕
+ 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 == null || ds.Tables[0].Rows.Count <= 0)
+ {
+ objjson.code = "1";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇澶辫触,鏌ユ棤鏁版嵁";
+ objjson.data = null;
+ objjson.list = columnNameList;
+ return objjson;
+ }
+ else
+ {
+ objjson.code = "1";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = ds.Tables[0];
+ objjson.list = columnNameList;
+ return objjson;
+ }
+ }
+ catch (Exception ex)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+ #endregion
+
/// <summary>
/// 鏌ヨ鍚勭被璁惧鍗曟嵁鍒楄〃锛堣澶囩偣妫�锛岃澶囩淮淇紝璁惧淇濆吇......锛�
/// </summary>
@@ -20965,6 +21140,9 @@
case "XJ":
HView = "h_v_Sb_EquipPatrolCheckBillList";
break;
+ case "PG": // 璁惧缁翠慨娲惧伐鍗�
+ HView = "h_v_Sb_EquipRepairSendWorkBillList";
+ break;
default:
objjson.code = "0";
objjson.count = 0;
@@ -20983,7 +21161,7 @@
}
- string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere);
+ string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 鏃ユ湡 desc, hmainid desc");
ds = oCN.RunProcReturn(sql, HView);
//娣诲姞鍒楀悕
foreach (DataColumn col in ds.Tables[0].Columns)
@@ -21587,6 +21765,8 @@
public string HTranslationText_English { get; set; }
public string HTranslationText_Spain { get; set; }
public List<MenuLoad> childMenus { get; set; }
+ public DateTime HMakeDate { get; set; }
+ public string HMaker { get; set; }
}
[Route("Web/MenuList")]
@@ -21693,6 +21873,163 @@
}
#endregion
+
+ #region 鏋勫缓璺敱宓屽瀵硅薄
+ [Route("Web/MenuList_1")]
+ [HttpGet]
+ public object MenuList_1(string HMakeName, string HType)
+ {
+ try
+ {
+ string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json");
+ string directory = Path.GetDirectoryName(filePath);
+ if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+ DateTime lastWriteTime = File.GetLastWriteTime(filePath);
+ lastWriteTime = new DateTime(lastWriteTime.Year, lastWriteTime.Month, lastWriteTime.Day, lastWriteTime.Hour, 0, 0);
+ DataSet ds = oCN.RunProcReturn($"select top 1 HMakeDate from Gy_Menu_1_build ORDER BY HMakeDate desc ", "Gy_Menu_1_build");
+
+ DateTime dbTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["HMakeDate"]);
+ dbTime = new DateTime(dbTime.Year, dbTime.Month, dbTime.Day, dbTime.Hour, 0, 0);
+
+ if (dbTime> lastWriteTime)
+ {
+ List<MenuLoad> mu = new List<MenuLoad>(); //浠ョ埗瀛愮骇缁撴瀯瀛樻斁鑿滃崟娓呭崟淇℃伅
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //鏁版嵁搴撴搷浣滃伐鍏�
+ string sql = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' order by HPosition";
+ ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet"); //鏌ヨ褰撳墠鐢ㄦ埛鐨勮嚜瀹氫箟鑿滃崟鏁版嵁
+ if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夎缃繃鑷畾涔変俊鎭紝鑻ヨ褰曟暟涓�0锛屽垯娌℃湁璁剧疆杩囷紝鍔犺浇鎵�鏈夌殑鑿滃崟淇℃伅
+ {
+ string sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName=" +
+ "(select top 1 c.GroupName from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId " +
+ "left join System_UserGroup c on b.GroupId = c.GroupID where a.Czymc ='" + HMakeName + "' order by len(c.GroupName ))";
+ ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet"); //鏌ヨ鐢ㄦ埛缁戝畾鐨勮鑹� 鏄惁璁剧疆鑿滃崟淇℃伅 鍙栬鑹插悕绉版渶鐭殑涓�涓�
+ if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+ {
+ sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Gy_MenuDefineSet where HMakeName = 'admin' and HType = '" + HType + "' order by HPosition";
+ ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet"); //鏌ヨadmin 鏄惁璁剧疆鑿滃崟淇℃伅
+ if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0))
+ {
+ sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1_build where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID ";
+ ds = oCn.RunProcReturn(sql, "Gy_Menu_1_build");
+ }
+
+ }
+ }
+
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++) //灏嗚彍鍗曠殑鏍硅妭鐐逛繚瀛樺埌鍒楄〃menu涓�
+ {
+ if (ds.Tables[0].Rows[i]["HPartentID"].ToString() == "0" || ds.Tables[0].Rows[i]["HitemID"].ToString() == ds.Tables[0].Rows[i]["HPartentID"].ToString()) //鍒ゆ柇鏄惁鏈�澶栧眰鏍硅妭鐐�
+ {
+ MenuLoad tbj = new MenuLoad();
+ tbj.HitemID = ds.Tables[0].Rows[i]["HitemID"].ToString();
+ tbj.HNumber = ds.Tables[0].Rows[i]["HNumber"].ToString();
+ tbj.HName = ds.Tables[0].Rows[i]["HName"].ToString();
+ tbj.HPartentID = ds.Tables[0].Rows[i]["HPartentID"].ToString();
+ tbj.HLevel = int.Parse(ds.Tables[0].Rows[i]["HLevel"].ToString());
+ tbj.Hurl = ds.Tables[0].Rows[i]["Hurl"].ToString();
+ tbj.HShowMode = ds.Tables[0].Rows[i]["HShowMode"].ToString();
+ tbj.HTranslationText_English = ds.Tables[0].Rows[i]["HTranslationText_English"].ToString();
+ tbj.HTranslationText_Spain = ds.Tables[0].Rows[i]["HTranslationText_Spain"].ToString();
+ if (ds.Tables[0].Rows[i]["HPicNum"] != null)
+ {
+ tbj.HPicNum = ds.Tables[0].Rows[i]["HPicNum"].ToString();
+ }
+ mu.Add(tbj);
+ }
+ }
+ diguiLoad(ds.Tables[0], mu); //浣跨敤閫掑綊锛屽皢闇�瑕佸姞杞界殑鏁版嵁浠ョ埗瀛愮骇鐨勭粨鏋勫瓨鏀惧湪mu涓�
+
+
+ objJsonResult.code = "1";//淇″彿鍙傛暟
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+ objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(mu);
+ return objJsonResult;
+ }
+ else
+ {
+ string josncontext = File.ReadAllText(filePath);
+ objJsonResult.code = "2";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+ objJsonResult.data = josncontext;
+ return objJsonResult;
+ }
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ澶辫触锛�";
+ objJsonResult.data = e.ToString();
+ return objJsonResult;
+ }
+ }
+
+ public class RequestDto
+ {
+ public string content { get; set; }
+ }
+ [Route("Web/buildRouteObj")]
+ [HttpPost]
+ public object buildRouteObj([FromBody] RequestDto request)
+ {
+ string filePath = HttpContext.Current.Server.MapPath($"~/RouterDisplay/DisplayConfig.json");
+ try
+ {
+ string jsonContent = request.content;
+ if (string.IsNullOrEmpty(jsonContent))
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "JSON 鍐呭涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(filePath))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏂囦欢璺緞涓嶈兘涓虹┖銆傦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string directory = Path.GetDirectoryName(filePath);
+ if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
+ {
+ Directory.CreateDirectory(directory);
+ }
+ string contentToWrite = jsonContent;
+
+ File.WriteAllText(filePath, contentToWrite);
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏂囦欢淇濆瓨鎴愬姛锛岃矾寰勪负"+filePath;
+ objJsonResult.data = null;
+ LogService.Write($"璺緞涓簕filePath}");
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+
+ LogService.Write("Exception锛�" + e.ToString());
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+
#region [鑿滃崟鐩綍鑷畾涔塢
@@ -23098,5 +23435,541 @@
}
}
#endregion
+
+ #region 鐢ㄤ簬杩炴帴鐨勫仴搴峰害妫�楠岋紝鍙鑳借闂�氳繖涓帴鍙o紝鍒欒〃鏄庤繛鎺ュ彲鐢�
+ [Route("Health")]
+ [HttpGet]
+ public IHttpActionResult CheckHealth()
+ {
+ // 杩斿洖 200 鐘舵�佺爜 纭鍋ュ悍鐘舵��
+ return Ok();
+ }
+ #endregion
+
+ #region 鐧诲綍鐢ㄦ埛涓庤澶嘋lientID 鐨勫叧绯� 鍐欏叆鏁版嵁搴�
+ [Route("Web/SetGy_UserClientIdConnection")]
+ [HttpPost]
+ public object SetGy_UserClientIdConnection([FromBody] JObject msg)
+ {
+ DataSet ds;
+ oCN.BeginTran();
+ try
+ {
+ ds = oCN.RunProcReturn($@"exec h_p_SetGy_UserClientIdRelation
+ @HUserbm=N'{msg["HUserbm"].ToString()}',
+ @HUserName=N'{msg["HUserName"].ToString()}',
+ @HClientID=N'{msg["HClientID"].ToString()}',
+ @HOnline={msg["HOnline"].ToString()}
+ ", "h_p_SetGy_UserClientIdRelation");
+
+ if(ds.Tables[0].Rows[0]["HStatus"].ToString() == "1")
+ {
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨璁惧淇℃伅鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨璁惧淇℃伅澶辫触锛�" + ds.Tables[0].Rows[0]["msg"];
+ 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 APP 鏍规嵁妯″潡鑾峰彇璇ユā鍧椾笅闇�瑕佹樉绀烘秷鎭爣璇嗙殑瀛愭ā鍧�
+ [Route("Web/getMessageIdentified")]
+ [HttpGet]
+ public object getMessageIdentified(string user, string moduleName)
+ {
+ DataSet oDs = oCN.RunProcReturn($"exec h_p_getMessageIdentifier_APP '{user}', '{moduleName}'", "h_p_getMessageIdentifier_APP");
+ if(oDs == null || oDs.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鑾峰彇娑堟伅鏍囪瘑澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鑾峰彇娑堟伅鏍囪瘑鎴愬姛锛�";
+ objJsonResult.data = oDs.Tables[0];
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 妯″叿寰呬笂妯℃煡璇� 鑾峰彇
+ [Route("Web/getSc_MouldUpperAwaitQuery")]
+ [HttpGet]
+ public object getSc_MouldUpperAwaitQuery(string user, string HBeginDate = "", string HEndDate = "")
+ {
+ if(HBeginDate == "") // 榛樿7澶╅棿璺�
+ {
+ HBeginDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
+ }
+
+ if(HEndDate == "")
+ {
+ HEndDate = DateTime.Today.ToString("yyyy-MM-dd");
+ }
+ List<object> columnNameList = new List<object>();
+ try
+ {
+ DataSet oDs = oCN.RunProcReturn($" exec h_p_Sc_MouldUpperAwaitQuery '{user}', '{HBeginDate}', '{HEndDate}'", "h_p_Sc_MouldUpperAwaitQuery");
+ if(oDs == null || oDs.Tables[0].Rows.Count == 0)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触, 鍗曟嵁鏃犺繑鍥炲��!";
+ objjson.data = null;
+ return objjson;
+ }else
+ {
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in oDs.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objjson.code = "1";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = oDs.Tables[0];
+ objjson.list = columnNameList;
+ return objjson;
+ }
+
+ }catch(Exception ex)
+ {
+ LogService.Write(ex.ToString());
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + ex.Message.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+ #endregion
+
+ #region 寰呭紑宸ュ垪琛� 鑾峰彇
+ [Route("Web/getCj_StationInBillAwaitQuery")]
+ [HttpGet]
+ public object getCj_StationInBillAwaitQuery(string user, string HBeginDate = "", string HEndDate = "")
+ {
+ if (HBeginDate == "") // 榛樿7澶╅棿璺�
+ {
+ HBeginDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
+ }
+
+ if (HEndDate == "")
+ {
+ HEndDate = DateTime.Today.ToString("yyyy-MM-dd");
+ }
+ List<object> columnNameList = new List<object>();
+ try
+ {
+ DataSet oDs = oCN.RunProcReturn($" exec h_p_Cj_StationInBillAwaitQuery '{user}', '{HBeginDate}', '{HEndDate}'", "h_p_Cj_StationInBillAwaitQuery");
+ if (oDs == null || oDs.Tables[0].Rows.Count == 0)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触, 鍗曟嵁鏃犺繑鍥炲��!";
+ objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in oDs.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objjson.code = "1";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = oDs.Tables[0];
+ objjson.list = columnNameList;
+ return objjson;
+ }
+
+ }
+ catch (Exception ex)
+ {
+ LogService.Write(ex.ToString());
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + ex.Message.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+ #endregion
+
+ #region 妯″叿寰呬笅妯℃煡璇� 鑾峰彇
+ [Route("Web/getSc_MouldLowerBillAwaitQuery")]
+ [HttpGet]
+ public object getSc_MouldLowerBillAwaitQuery(string user, string HBeginDate = "", string HEndDate = "")
+ {
+ if (HBeginDate == "") // 榛樿7澶╅棿璺�
+ {
+ HBeginDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
+ }
+
+ if (HEndDate == "")
+ {
+ HEndDate = DateTime.Today.ToString("yyyy-MM-dd");
+ }
+ List<object> columnNameList = new List<object>();
+ try
+ {
+ DataSet oDs = oCN.RunProcReturn($" exec h_p_Sc_MouldLowerBillAwaitQuery '{user}', '{HBeginDate}', '{HEndDate}'", "h_p_Sc_MouldLowerBillAwaitQuery");
+ if (oDs == null || oDs.Tables[0].Rows.Count == 0)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触, 鍗曟嵁鏃犺繑鍥炲��!";
+ objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in oDs.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objjson.code = "1";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = oDs.Tables[0];
+ objjson.list = columnNameList;
+ return objjson;
+ }
+
+ }
+ catch (Exception ex)
+ {
+ LogService.Write(ex.ToString());
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + ex.Message.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+ #endregion
+
+ #region 鑾峰彇 璁惧缁戝畾鑱屽憳淇℃伅(甯﹀嚭妯″叿鑱屽憳淇℃伅) 鍗庤垷
+ [Route("Web/getEquipBindingEmp")]
+ [HttpGet]
+ public object getEquipBindingEmp(string HEquipNumber)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ ds = oCN.RunProcReturn($"exec h_p_getEquipBindingEmp_huazhou {HEquipNumber}", "h_p_getEquipBindingEmp_huazhou");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠璁惧娌℃湁涓婃ā淇℃伅";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //娣诲姞鍒楀悕
+ 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鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region APP 鑾峰彇寮傚父鍙嶉鍗� 鑾峰彇 妫�楠屽崟鍐呭 閫氱敤鏂规硶
+ [Route("Web/getCheckBillStatus")]
+ [HttpGet]
+ public object getCheckBillStatus(Int64 HInterID, string HBillType)
+ {
+ try {
+ string sql = "";
+ List<object> columnNameList = new List<object>();
+ if(HBillType == "7505")
+ {
+ // 棣栨
+ sql = $@"SELECT
+ a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 鏃ユ湡, a.HBillNo AS 鍗曟嵁鍙�,
+ a.HRemark AS 琛ㄥご澶囨敞,s.HName 鐢熶骇璧勬簮鍚嶇О,s.HNumber 鐢熶骇璧勬簮浠g爜, m.HNumber AS 浜у搧鍐呯爜, m.HName AS 浜у搧鍚嶇О, m.HModel AS 浜у搧鍨嬪彿,e.HNumber as 妫�楠屽憳浠g爜, e.HName as 妫�楠屽憳鍚嶇О,
+ a.HMaker AS 鍒跺崟浜�, a.HMakeDate AS 鍒跺崟鏃ユ湡, a.HChecker AS 瀹℃牳浜�, a.HCheckDate AS 瀹℃牳鏃ユ湡, a.HUpDater AS 淇敼浜�,
+ a.HUpDateDate AS 淇敼鏃ユ湡, a.HCloseMan AS 鍏抽棴浜�, a.HCloseDate AS 鍏抽棴鏃ユ湡, a.HDeleteMan AS 浣滃簾浜�, a.HDeleteDate AS 浣滃簾鏃ユ湡,
+ a.HBillType AS 鍗曟嵁绫诲瀷,b.HEntryID hsubid, a.HCheckQty 妫�楠屾暟閲�, a.HSourceID HSourceID,
+ a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 宸ュ簭娴佽浆鍗″彿,
+ a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 鐢熶骇璁㈠崟鍙�
+ FROM
+ dbo.QC_FirstPieceCheckBillMain AS a INNER JOIN
+ dbo.QC_FirstPieceCheckBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN
+ dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN
+ dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN
+ dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID ";
+ sql += $" where a.HInterID = {HInterID}";
+
+ ds = oCN.RunProcReturn(sql, "QC_FirstPieceCheckBillMain");
+
+ }
+ else if (HBillType == "7520")
+ {
+ // 宸℃
+ sql = $@"SELECT
+ a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 鏃ユ湡, a.HBillNo AS 鍗曟嵁鍙�,
+ a.HRemark AS 琛ㄥご澶囨敞,s.HName 鐢熶骇璧勬簮鍚嶇О,s.HNumber 鐢熶骇璧勬簮浠g爜, m.HNumber AS 浜у搧鍐呯爜, m.HName AS 浜у搧鍚嶇О, m.HModel AS 浜у搧鍨嬪彿,e.HNumber as 妫�楠屽憳浠g爜, e.HName as 妫�楠屽憳鍚嶇О,
+ a.HMaker AS 鍒跺崟浜�, a.HMakeDate AS 鍒跺崟鏃ユ湡, a.HChecker AS 瀹℃牳浜�, a.HCheckDate AS 瀹℃牳鏃ユ湡, a.HUpDater AS 淇敼浜�,
+ a.HUpDateDate AS 淇敼鏃ユ湡, a.HCloseMan AS 鍏抽棴浜�, a.HCloseDate AS 鍏抽棴鏃ユ湡, a.HDeleteMan AS 浣滃簾浜�, a.HDeleteDate AS 浣滃簾鏃ユ湡,
+ a.HBillType AS 鍗曟嵁绫诲瀷,b.HEntryID hsubid, a.HCheckQty 妫�楠屾暟閲�, a.HSourceID HSourceID,
+ a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 宸ュ簭娴佽浆鍗″彿,
+ a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 鐢熶骇璁㈠崟鍙�
+ FROM
+ dbo.QC_PatrolProcCheckOtherBillMain AS a INNER JOIN
+ dbo.QC_PatrolProcCheckOtherBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN
+ dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN
+ dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN
+ dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID ";
+ sql += $" where a.HInterID = {HInterID}";
+
+ ds = oCN.RunProcReturn(sql, "QC_PatrolProcCheckOtherBillMain");
+ }
+ else if(HBillType == "7507")
+ {
+ // 鏈
+ sql = $@"SELECT
+ a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 鏃ユ湡, a.HBillNo AS 鍗曟嵁鍙�,
+ a.HRemark AS 琛ㄥご澶囨敞,s.HName 鐢熶骇璧勬簮鍚嶇О,s.HNumber 鐢熶骇璧勬簮浠g爜, m.HNumber AS 浜у搧鍐呯爜, m.HName AS 浜у搧鍚嶇О, m.HModel AS 浜у搧鍨嬪彿,e.HNumber as 妫�楠屽憳浠g爜, e.HName as 妫�楠屽憳鍚嶇О,
+ a.HMaker AS 鍒跺崟浜�, a.HMakeDate AS 鍒跺崟鏃ユ湡, a.HChecker AS 瀹℃牳浜�, a.HCheckDate AS 瀹℃牳鏃ユ湡, a.HUpDater AS 淇敼浜�,
+ a.HUpDateDate AS 淇敼鏃ユ湡, a.HCloseMan AS 鍏抽棴浜�, a.HCloseDate AS 鍏抽棴鏃ユ湡, a.HDeleteMan AS 浣滃簾浜�, a.HDeleteDate AS 浣滃簾鏃ユ湡,
+ a.HBillType AS 鍗曟嵁绫诲瀷,b.HEntryID hsubid, a.HCheckQty 妫�楠屾暟閲�, a.HSourceID HSourceID,
+ a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 宸ュ簭娴佽浆鍗″彿,
+ a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 鐢熶骇璁㈠崟鍙�
+ , HRemarkSN 鏉$爜
+ FROM
+ dbo.QC_ProcessCheckBillMain AS a INNER JOIN
+ dbo.QC_ProcessCheckBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN
+ dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN
+ dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN
+ dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID ";
+ sql += $" where a.HInterID = {HInterID}";
+
+ ds = oCN.RunProcReturn(sql, "QC_ProcessCheckBillMain");
+ }
+ if(ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛屾棤妫�楠屽崟锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //娣诲姞鍒楀悕
+ 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鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鏍规嵁璁惧id鑾峰彇璁惧鏁伴噰鏁版嵁
+ private class EquipTechParam
+ {
+ public string TechParamName { get; set; }
+ public DateTime CreateTime { get; set; }
+ public string Result { get; set; }
+ }
+
+ [Route("Web/getSB_EquipTechParamBillListByEquipID")]
+ [HttpGet]
+ public object getSB_EquipTechParamBillListByEquipID(Int64 HEquipID)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ // 宸ヨ壓鍙傛暟鍒嗙被鍒楄〃
+ List<string> categoryNames = new List<string>();
+ ds = oCN.RunProcReturn($"exec h_p_SB_EquipTechParamBillListByEquipID {HEquipID}", "h_p_SB_EquipTechParamBillListByEquipID");
+ var ds1 = oCN.RunProcReturn($"select * from h_v_Gy_Technology", "h_v_Gy_Technology");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠璁惧娌℃湁鏁伴噰淇℃伅";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ // 閬嶅巻鑾峰彇宸ヨ壓鍙傛暟鍒嗙被鍒楄〃
+ if (ds1.Tables[0].Rows.Count > 0)
+ {
+ foreach (DataRow row in ds1.Tables[0].Rows)
+ {
+ string categoryName = row["宸ヨ壓鍙傛暟鍒嗙被鍚嶇О"].ToString().Trim();
+ if (!string.IsNullOrEmpty(categoryName))
+ {
+ categoryNames.Add(categoryName);
+ }
+ }
+ }
+ // 鎻愬彇鍘熷鏁版嵁鍒版ā鍨嬪垪琛�
+ var rawParams = new List<EquipTechParam>();
+ foreach (DataRow row in ds.Tables[0].Rows)
+ {
+ rawParams.Add(new EquipTechParam
+ {
+ TechParamName = row["HTechParamName"].ToString().Trim(),
+ CreateTime = Convert.ToDateTime(row["HCreateTime"]),
+ Result = row["HResult"].ToString()
+ });
+ }
+
+ // 鎸夊伐鑹哄垎绫诲悕绉板垎缁�
+ Dictionary<string, List<EquipTechParam>> groupedParams = new Dictionary<string, List<EquipTechParam>>();
+ // 鍒濆鍖栨墍鏈夊伐鑹哄垎绫诲垎缁�
+ foreach (string category in categoryNames)
+ {
+ groupedParams[category] = new List<EquipTechParam>();
+ }
+ // 鏂板鈥滃叾浠栧弬鏁扳�濆厹搴曞垎缁�
+ groupedParams["鍏朵粬鍙傛暟"] = new List<EquipTechParam>();
+
+ // 鍖归厤鍙傛暟鍒板搴斿垎缁勶紙鎸夊弬鏁板悕鍖呭惈鍒嗙被鍚嶇О瀛愪覆锛�
+ foreach (var param in rawParams)
+ {
+ bool isMatched = false;
+ // 閬嶅巻鎵�鏈夊伐鑹哄垎绫伙紝鍒ゆ柇鍙傛暟鍚嶆槸鍚﹀寘鍚鍒嗙被鍚嶇О
+ foreach (string category in categoryNames)
+ {
+ if (param.TechParamName.Contains(category))
+ {
+ groupedParams[category].Add(param);
+ isMatched = true;
+ break; // 鍖归厤鍒扮涓�涓垎绫诲悗鍋滄锛堥伩鍏嶉噸澶嶅尮閰嶏級
+ }
+ }
+ // 鏃犲尮閰嶅垎绫诲垯褰掍负鈥滃叾浠栧弬鏁扳��
+ if (!isMatched)
+ {
+ groupedParams["鍏朵粬鍙傛暟"].Add(param);
+ }
+ }
+
+ // 杞崲涓篔Array鏍煎紡锛堝墠绔彲鐩存帴瑙f瀽锛�
+ JArray resultJArray = new JArray();
+ foreach (var group in groupedParams)
+ {
+ // 杩囨护绌哄垎缁勶紙鏃犳暟鎹殑鍒嗙被涓嶈繑鍥烇級
+ if (group.Value.Count == 0) continue;
+
+ JObject groupJObj = new JObject();
+ groupJObj.Add("鍒嗙粍鍚嶇О", group.Key); // 宸ヨ壓鍙傛暟鍒嗙被鍚嶇О锛堝涓瓙銆佷繚鍘嬶級
+
+ JArray paramsJArray = new JArray();
+ foreach (var param in group.Value.OrderBy(p => p.TechParamName))
+ {
+ JObject paramJObj = new JObject();
+ paramJObj.Add("HTechParamName", param.TechParamName);
+ paramJObj.Add("HCreateTime", param.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
+ paramJObj.Add("HResult", param.Result);
+ paramsJArray.Add(paramJObj);
+ }
+ groupJObj.Add("鍙傛暟鍒楄〃", paramsJArray);
+ resultJArray.Add(groupJObj);
+ }
+
+ // 淇濈暀鍘熸湁鍒楀悕閫昏緫锛堝吋瀹瑰墠绔級
+ 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));
+ }
+
+ // 缁勮杩斿洖缁撴灉
+ objJsonResult.code = "1";
+ objJsonResult.count = resultJArray.Count; // 鏈夋晥鍒嗙粍鏁伴噺
+ objJsonResult.Message = "Success锛�";
+ objJsonResult.data = resultJArray;
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
}
}
--
Gitblit v1.9.1