From 957b51cfdeb4374d817086a2ca761c75545e206d Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期四, 28 十一月 2024 16:59:56 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs | 735 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 690 insertions(+), 45 deletions(-) diff --git a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs index a866a25..e5a9bec 100644 --- a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs +++ b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs @@ -1,4 +1,6 @@ -锘縰sing DBUtility; +锘縰sing DAL; +using DBUtility; +using DLL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -7,8 +9,11 @@ using System.Linq; using System.Net; using System.Net.Http; +using System.Timers; +using System.Threading.Tasks; using System.Web.Http; using WebAPI.Models; +using System.Threading; namespace WebAPI.Controllers.SCGL { @@ -43,7 +48,7 @@ /// <returns></returns> [Route("Sc_MESTransFerWorkBill/SaveGetMESTransFerWorkFrom")] [HttpPost] - public object SaveGetMESTransFerWorkFrom([FromBody] JObject msg) + public object SaveGetMESTransFerWorkFromAsync([FromBody] JObject msg) { var _value = msg["msg"].ToString(); @@ -151,10 +156,19 @@ objJsonResult.data = 1; return objJsonResult; } - + //string[] arrStr = oItem.HSendMan.Split(','); //鍙戦�佷汉 //arrStr = oItem.HReceiveMan.Split(','); //鎺ユ敹浜� - string[] arrStr = oItem.HCopyMan.Split(','); //鎶勯�佷汉 + string[] arrStr; + + if (string.IsNullOrEmpty(oItem.HCopyMan)) + { + arrStr = new string[0]; // 濡傛灉 oItem.HCopyMan 涓虹┖锛屽垯璧嬪�间负绌烘暟缁� + } + else + { + arrStr = oItem.HCopyMan.Split(','); // 鍚﹀垯锛屼娇鐢� Split(',') 鏂规硶鎷嗗垎瀛楃涓� + } List<string> b = new List<string>(arrStr); b.Add(oItem.HSendMan); b.Add(oItem.HReceiveMan); @@ -165,12 +179,13 @@ Models.ClsOA_ErrMsgBackBillSub2 sb = new Models.ClsOA_ErrMsgBackBillSub2(); sb.HEntryID = i; sb.HReceiveMan = arrStr[i - 1]; - if (arrStr[i-1].ToString() == oItem.HSendMan) + if (arrStr[i - 1].ToString() == oItem.HSendMan) { sb.HReadFlag = true; } oBill.DetailColl2.Add(sb); } + oBill.omodel = oItem; } @@ -180,7 +195,7 @@ bool bResult; if (refSav == "Add") { - bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); if (bResult) { objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D @@ -196,8 +211,8 @@ { objJsonResult.Verify = "N"; } - } - } + } + } } else @@ -396,7 +411,7 @@ if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackBillList order by 鍗曟嵁鍙� desc"; - ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList"); + ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList"); } else { @@ -513,15 +528,24 @@ return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); string sql =string.Format(@"select A.HInterID,b.HEntryID,A.HBillStatus,A.HBillNo,A.HDate,A.HContext,A.HDescription,A.HRemark, - A.HQty,A.HSendType, - A.HDeptID,D.HName HDeptName, A.HSendMan, + A.HQty,A.HSendType,a.HForm,a.HChangeNote,a.HNote,a.HBadProcMan,f1.HName HBadProcManName, + a.HQEMan,f2.HName HQEManName,a.HSourceID,s.HName HSourceName,a.HShiftsID,s1.HName HShiftsName, + A.HDeptID,D.HName HDeptName, A.HSendMan,a.HCenterID HCenterID,wo.HName HCenterName, A.HReceiveMan,A.HCopyMan,A.HHasten, - A.HLevel,A.HMaterName,A.HMaterModel, + A.HLevel,A.HMaterNumber,A.HMaterName,A.HMaterModel, B.HReadFlag, A.HMaker,A.HMakeDate,A.HUpDater,A.HUpDateDate,A.HChecker,A.HCheckDate,A.HCloseMan,A.HCloseDate,A.HDeleteMan,A.HDeleteDate, - A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType + A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType, + A.HHandleEmpID,f.HName HHandleEmpName,A.HErrMsgBackTypeID,g.HName HErrMsgBackTypeName from OA_ErrMsgBackBillMain A inner join OA_ErrMsgBackBillSub2 B on A.HInterID=B.HInterID left join Gy_Department D on A.HDeptID=D.HItemID + left join Gy_Employee f on A.HHandleEmpID=f.HItemID + left join Gy_ErrMsgBackType g on A.HErrMsgBackTypeID=g.HItemID + left join Gy_Employee f1 on a.HBadProcMan=f1.HItemID + left join Gy_Employee f2 on a.HQEMan=f2.HItemID + left join Gy_Source s on a.HSourceID=s.HItemID + left join Gy_Shifts s1 on a.HShiftsID=s1.HItemID + left join Gy_WorkCenter wo on a.HCenterID=wo.HItemID where A.HInterID='" + HID + "' and b.HEntryID='" + HEntryID + "'"); var dataSet = oCN.RunProcReturn(sql, "OA_ErrMsgBackBillMain"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) @@ -1010,6 +1034,7 @@ { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + _ = SendDingDingAsync(oBill.omodel.HSendMan, oBill.omodel.HHandleEmpID,oBill.omodel.HDescription,""); } else if (refSav == "Update") { @@ -1815,7 +1840,7 @@ [Route("OA_ErrMsgBackSignBill_BrushCard/ErrMsgBackReceive")] [HttpGet] - public object ErrMsgBackReceive(string sWhere, string user) + public object ErrMsgBackReceive(string sWhere,string num, string user) { try { @@ -1830,18 +1855,38 @@ objJsonResult.data = null; return objJsonResult; } - - if (sWhere == null || sWhere.Equals("")) + if (num=="2") //鎶ュ伐鍙拌幏鍙栧埛鍗$鍒版暟鎹� { - string sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard order by 鍗曟嵁鍙� desc"; - ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard"); + if (sWhere == null || sWhere.Equals("")) + { + string sql = "select * from h_v_SingOA_ErrMsgBackList_BrushCard order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_SingOA_ErrMsgBackList_BrushCard"); + } + else + { + string sql1 = "select * from h_v_SingOA_ErrMsgBackList_BrushCard where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_SingOA_ErrMsgBackList_BrushCard"); + } } - else + else //鍘熸湁鐨勫埛鍗$鍒拌幏鍙栨暟鎹� { - string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard where 1 = 1 "; - string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; - ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard"); + { + if (sWhere == null || sWhere.Equals("")) + { + string sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard"); + } + else + { + string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillList_BrushCard where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_BrushCard"); + } + } } + + //娣诲姞鍒楀悕 foreach (DataColumn col in ds.Tables[0].Columns) @@ -1984,6 +2029,7 @@ { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + _ = SendDingDingAsync(oBill.omodel.HSendMan, 1, oBill.omodel.HDescription, oBill.omodel.HReceiveMan); } else if (refSav == "Update") { @@ -2900,6 +2946,7 @@ { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + _ = SendDingDingAsync(oBill.omodel.HSendMan, 2, oBill.omodel.HDescription, oBill.omodel.HReceiveMan); } else if (refSav == "Update") { @@ -3813,6 +3860,7 @@ { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + _ = SendDingDingAsync(oBill.omodel.HReceiveMan, 0, oBill.omodel.HDescription, oBill.omodel.HCopyMan); } else if (refSav == "Update") { @@ -4792,8 +4840,8 @@ { List<object> columnNameList = new List<object>(); - string sql = "select * from h_v_OA_AndengFlowRuleBillMainList where hmainid='" + HID + "'"; - ds = oCN.RunProcReturn(sql, "h_v_OA_AndengFlowRuleBillMainList"); + string sql = "select * from h_v_OA_AndengFlowRuleBillMainEdit where hmainid='" + HID + "'"; + ds = oCN.RunProcReturn(sql, "h_v_OA_AndengFlowRuleBillMainEdit"); //娣诲姞鍒楀悕 foreach (DataColumn col in ds.Tables[0].Columns) @@ -5523,16 +5571,16 @@ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� string s = ""; - int sYear = 0; - int sPeriod = 0; - if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = s; - objJsonResult.data = null; - return objJsonResult; - } + //int sYear = 0; + //int sPeriod = 0; + //if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = s; + // objJsonResult.data = null; + // return objJsonResult; + //} ListModels oListModels = new ListModels(); try @@ -6290,7 +6338,7 @@ #region 宸ヤ綔鑱旂郴鍗曞洖澶� /// <summary> - /// 寮傚父鍙嶉鍗� + /// 宸ヤ綔鑱旂郴鍗� /// </summary> /// <param name="msg"></param> /// <returns></returns> @@ -6319,16 +6367,16 @@ //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� string s = ""; - int sYear = 0; - int sPeriod = 0; - if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = s; - objJsonResult.data = null; - return objJsonResult; - } + //int sYear = 0; + //int sPeriod = 0; + //if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = s; + // objJsonResult.data = null; + // return objJsonResult; + //} ListModels oListModels = new ListModels(); try @@ -6466,6 +6514,603 @@ } #endregion + #region 宸ヤ綔鑱旂郴鍗曞偓淇� + [Route("Sc_MESTransFerWorkBill/UpdateOA_WorkLinkBillHHasten")] + [HttpGet] + public object UpdateOA_WorkLinkBillHHasten(Int64 HInterID,string CurUserName) + { + try + { + //鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("OA_WorkLinkBill_Edit", 1, false, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + //HInterID鏁版嵁鍒ゆ柇 + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍌績锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍌績锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + string sql = "update OA_WorkLinkBillMain set HHasten = HHasten + 1 where HInterID = " + HInterID ; + + oCN.RunProc(sql); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 宸ヤ綔鑱旂郴鍗曟牴鎹簮鍗旾D鏌ョ湅鏄惁鏈夊搴旇仈绯诲崟 + [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillListBySourceID")] + [HttpGet] + public object GetOA_WorkLinkBillListBySourceID(string HRelationInterID, string HRelationEntryID) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = string.Format(@"select A.*,D.HName HDeptName,e.HName HEvaluateStatusName + from OA_WorkLinkBillMain A + left join Gy_Department D on A.HDeptID=D.HItemID + left join Gy_EvaluateStatus AS e ON A.HEvaluateStatusID = e.HItemID + where A.HRelationInterID='" + HRelationInterID + "' and A.HRelationEntryID= '"+ HRelationEntryID+"'"); ; + ds = oCN.RunProcReturn(sql, "OA_WorkLinkBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + + } + #endregion + + #endregion + + + #region 寮傚父鍙嶉 鎺ユ敹,澶勭悊,楠屾敹鍗曚繚瀛樺彂閫佹秷鎭� + /// <summary> + /// 寮傚父鍙嶉 鎺ユ敹,澶勭悊,楠屾敹鍗曚繚瀛樺彂閫佹秷鎭� + /// </summary> + /// <param name="HSendMan"></param> + /// <param name="HHandleEmpID"></param> + /// <param name="HDescription"></param> + /// <param name="HCopyMan"></param> + /// <returns></returns> + public async Task<object> SendDingDingAsync(string HSendMan, int HHandleEmpID,string HDescription,string HCopyMan) + { + + string concatenatedNames = ""; + string appKey = ""; + string appSecret = ""; + string sReturn = ""; + string agentIds = ""; + Cls_DDMsg msg = new Cls_DDMsg(); + if (oSystemParameter.ShowBill(ref sReturn) == true) + { + //绯荤粺鍙傛暟鏄惁 N涓烘湰鍦帮紝Y涓烘柉鑾皵 + if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "N") + { + appKey = "dingrsrzhdyn3mlaof95"; + appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq"; + agentIds = "3118119317"; + } + else if (oSystemParameter.omodel.OA_ErrMsgBackBill_SendDingDingMsg == "Y") + { + appKey = "dingkdddbhdcssk7jduw"; + appSecret = "iv07c-GLfJPnzfJaNAAOfJDl3Z-eODvDAhlInMZCZhGorkle5Evbaxx3ImylvdjQ"; + agentIds = "3151454458"; + } + + } + + if (HHandleEmpID==0) // + { + string HReceiveMan = HSendMan; + string[] names = HCopyMan.Split(','); + string sqlNames = ""; + foreach (string name in names) + { + sqlNames += "'" + name.Trim() + "',"; + } + sqlNames = sqlNames.TrimEnd(','); + //鑾峰彇鎸囨淳澶勭悊浜�,鍙戦�佷汉鐨勯拤閽塱d + string sql1 = "select HDingDingUserID 閽夐拤id from Gy_Czygl where Czymc in ('" + HReceiveMan + "'," + sqlNames + ")"; + ds = oCN.RunProcReturn(sql1, "Gy_Czygl"); + List<string> HNames = new List<string>(); + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) + { + string HName = ds.Tables[0].Rows[i]["閽夐拤id"].ToString(); + HNames.Add(HName); + + } + concatenatedNames = string.Join(",", HNames); + HDescription = HDescription + "--宸查獙鏀�"; + } + else if (HHandleEmpID==1)//寮傚父鍙嶉澶勭悊鍗� 灏嗘秷鎭� 鍙戦�佺粰 鍙戦�佷汉锛屾帴鏀朵汉 + { + //鑾峰彇鍙戦�佷汉 鎺ユ敹浜� + string HReceiveMan = HCopyMan; + string sql1 = "select HDingDingUserID 閽夐拤id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HReceiveMan + "')"; + ds = oCN.RunProcReturn(sql1, "Gy_Czygl"); + List<string> HNames = new List<string>(); + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) + { + string HName = ds.Tables[0].Rows[i]["閽夐拤id"].ToString(); + HNames.Add(HName); + + } + concatenatedNames = string.Join(",", HNames); + HDescription = HDescription + "--宸茬鍒�"; + } + else if (HHandleEmpID == 2)//寮傚父鍙嶉澶勭悊鍗� 灏嗘秷鎭� 鍙戦�佺粰 鍙戦�佷汉锛屾帴鏀朵汉 + { + //鑾峰彇鍙戦�佷汉 鎺ユ敹浜� + string HReceiveMan = HCopyMan; + string sql1 = "select HDingDingUserID 閽夐拤id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HReceiveMan + "')"; + ds = oCN.RunProcReturn(sql1, "Gy_Czygl"); + List<string> HNames = new List<string>(); + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) + { + string HName = ds.Tables[0].Rows[i]["閽夐拤id"].ToString(); + HNames.Add(HName); + + } + concatenatedNames = string.Join(",", HNames); + HDescription = HDescription + "--宸插鐞�"; + } + else + { + //鏌ヨ鎸囨淳澶勭悊浜� + string sql = "select HName from Gy_Employee where HItemID='" + HHandleEmpID + "'"; + ds = oCN.RunProcReturn(sql, "Gy_Employee"); + string HHandleEmpName = ds.Tables[0].Rows[0]["HName"].ToString(); + //鑾峰彇鎸囨淳澶勭悊浜�,鍙戦�佷汉鐨勯拤閽塱d + string sql1 = "select HDingDingUserID 閽夐拤id from Gy_Czygl where Czymc in ('" + HSendMan + "','" + HHandleEmpName + "')"; + ds = oCN.RunProcReturn(sql1, "Gy_Czygl"); + List<string> HNames = new List<string>(); + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) + { + string HName = ds.Tables[0].Rows[i]["閽夐拤id"].ToString(); + HNames.Add(HName); + + } + concatenatedNames = string.Join(",", HNames); + HDescription = HDescription + "--宸叉帴鏀�"; + } + + //鑾峰彇浼佷笟鐨刟ccess_token鐨勫�� + string response = msg.GetAccessToken(appKey, appSecret); + JObject responseJson = JObject.Parse(response); + // 鑾峰彇access_token鐨勫�� + string accessToken = responseJson["accessToken"].ToString(); + + //璋冪敤鏂规硶鍙戦�佹秷鎭� + string agentId = agentIds;//閽夐拤鍚庡彴寤虹珛鐨勫皬绋嬪簭id + string userIdList = concatenatedNames;//閽夐拤浜哄憳鐨刬d + string deptIdList = "0"; // 绌哄瓧绗︿覆琛ㄧず涓嶆寚瀹氶儴闂� + string toAllUser = "false"; + string message = HDescription; + response = await msg.SendTextMessage(accessToken, agentId, userIdList, deptIdList, toAllUser, message); + Console.WriteLine(response); + return response; + } + #endregion + + #region 寮傚父鍙嶉鍗曟煡璇紙鎺ユ敹鐨勶紝鍙戦�佺殑锛屾妱閫佺殑锛� + + [Route("Sc_MESTransFerWorkBill/GetSc_MESTransFerWorkBillQuery")] + [HttpGet] + public object GetSc_MESTransFerWorkBillQuery(string sWhere, string user) + { + try + { + Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere); + + + string HStatus = dic["HStatus"].ToString();//鏃堕棿鐘舵�� + string HBeginDate = dic["HBeginDate"].ToString();//寮�濮嬫棩鏈� + string HEndDate = dic["HEndDate"].ToString();//缁撴潫鏃ユ湡 + string HSourceID = dic["HSourceID"].ToString();//鐢熶骇璧勬簮 + + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery '" + HStatus + "','" + HBeginDate + "','" + HEndDate + "','" + HSourceID + "','" + user + "'" , "h_p_OA_ErrMsgBackSelfQuery"); + + if (ds.Tables[0].Rows.Count != 0 || ds != null) + { + //娣诲姞鍒楀悕 + 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; + objJsonResult.list = columnNameList; + 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("Sc_MESTransFerWorkBill/Get_Sc_ICMOBillStatus")] + [HttpGet] + public object Get_Sc_ICMOBillStatus(string HSourceBill) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = "select a.HSourceBillNo 娴佽浆鍗″彿,a.HSourceBillType 娴佽浆鍗$被鍨�,a.HSourceInterID 娴佽浆鍗′富鍐呯爜,a.HSourceEntryID 娴佽浆鍗″瓙鍐呯爜,b.HNumber 鐗╂枡浠g爜,b.HName 鐗╂枡鍚嶇О,b.HModel 瑙勬牸鍨嬪彿,a.HDatePlanQty 璁″垝鏁伴噺,a.HSourceID,c.HName 鐢熶骇璧勬簮 from Sc_ICMOBillStatus_Tmp a " + + "left join Gy_Material b on a.HMaterID=b.HItemID left join Gy_Source c on a.HSourceID=c.HItemID where HSourceBillNo='" + HSourceBill + "'"; + ds = oCN.RunProcReturn(sql, "Sc_ICMOBillStatus_Tmp"); + + //娣诲姞鍒楀悕 + 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 鎶ュ伐鍙拌烦杞紓甯稿弽棣堝崟 寮圭獥鑾峰彇 寮傚父绫诲瀷 + + [Route("Sc_MESTransFerWorkBill/Get_ErrMsgBackType")] + [HttpGet] + public object Get_ErrMsgBackType(string TypeName) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = "select HItemID,HName from Gy_ErrMsgBackType where HName='" + TypeName + "'"; + ds = oCN.RunProcReturn(sql, "Gy_ErrMsgBackType"); + + //娣诲姞鍒楀悕 + 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 鎶ュ伐鍙拌烦杞紓甯稿弽棣堝崟 寮圭獥鑾峰彇 褰撳墠浜虹殑涓婄骇 + + [Route("Sc_MESTransFerWorkBill/Get_UserSuperiors")] + [HttpGet] + public object Get_UserSuperiors(string HName) + { + try + { + //string sReturn = ""; + List<object> columnNameList = new List<object>(); + //鏍规嵁褰撳墠浜鸿幏鍙栬亴鍔� + string sql = "select a.Czymc 鐢ㄦ埛鍚嶇О,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 = '"+HName+"'"; + ds = oCN.RunProcReturn(sql, "Gy_ErrMsgBackType"); + string Job = ds.Tables[0].Rows[0]["鑱屽姟"].ToString(); + + //鏍规嵁鑱屽姟鎵惧埌浠栫殑涓婄骇,缁欏彂閫佷汉榛樿涓哄綋鍓嶇櫥褰曚汉 + string sql1 = "select * from Gy_Duty where HItemID =(select HParentID from Gy_Duty group by HParentID, HName having HName = '" + Job + "' and count(*) = 1))"; + ds = oCN.RunProcReturn(sql1, "Gy_Duty"); + + string Job1= ds.Tables[0].Rows[0]["HName"].ToString(); + + //鐢ㄨ亴鍔℃壘鍒扮敤鎴� + string sql3 = "select a.Czymc 鐢ㄦ埛鍚嶇О,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 c.GroupName = '" + Job1+"'"; + ds = oCN.RunProcReturn(sql3, "Gy_Czygl"); + //娣诲姞鍒楀悕 + 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 鎶ュ伐鍙拌烦杞紓甯稿弽棣堝崟 寮圭獥鑾峰彇 璁惧缂栫爜 + + [Route("Sc_MESTransFerWorkBill/set_EquipFile")] + [HttpGet] + public object set_EquipFile(string HSourceName) + { + try + { + List<object> columnNameList = new List<object>(); + + string sql = "select a.HEquipFileNumber 璁惧缂栫爜 ,a.HName 璁惧鍚嶇О from Gy_EquipFileBillMain a left join Gy_Source b on a.HSourceID = b.HItemID where b.HName ='" + HSourceName + "'"; + ds = oCN.RunProcReturn(sql, "Gy_ErrMsgBackType"); + + //娣诲姞鍒楀悕 + 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 寮傚父鍙嶉鍗� 璺熻釜鏌ヨ + [Route("Sc_MESTransFerWorkBill/GetErrMsgBackResumeList")] + [HttpGet] + public object GetErrMsgBackResumeList(string HInterID, string user) + { + try + { + List<object> columnNameList = new List<object>(); + if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏌ョ湅鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn($@"select a.HInterID,a.HDate '鏃ユ湡',a.HBillType,x.HName 鍗曟嵁绫诲瀷,a.HBillNo as '鍗曟嵁鍙�', + CASE WHEN a.HBillStatus <= 1 THEN '鍒涘缓' WHEN a.HBillStatus = 2 THEN '宸插鏍�' WHEN a.HBillStatus = 3 AND + a.HCloseType = 0 THEN '鑷姩鍏抽棴' WHEN a.HBillStatus = 3 AND + a.HCloseType = 1 THEN '鎵嬪姩鍏抽棴' WHEN a.HBillStatus = 4 THEN '宸蹭綔搴�' ELSE '鍏跺畠鐘舵��' END AS 鍗曟嵁鐘舵��, + a.HSendMan AS 鍙戦�佷汉,a.HReceiveMan AS 鎺ユ敹浜�,a.HCopyMan AS 鎶勯�佷汉,a.HLevel AS 绱ф�ョ▼搴�,a.HContext AS 涓婚,a.HDescription AS 鍐呭,a.HErrMsgBackTypeID,b.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 浣滃簾鏃ユ湡 + from ( + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackBillMain where HInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackReceiveBillMain where HMainSourceInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackSignBillMain where HErrMsgBackInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackHandleBillMain where HErrMsgBackInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackCheckBillMain where HErrMsgBackInterID = {HInterID} + )as a,Xt_BillType as x,Gy_ErrMsgBackType as b + where a.HBillType = x.HNumber and a.HErrMsgBackTypeID = b.HItemID + ORDER BY '鏃ユ湡' ASC;", "OA_ErrMsgBackBillResume"); + + //娣诲姞鍔ㄦ�佸垪淇℃伅 + 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 e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 寮傚父鍙嶉鍗� 璺熻釜鏉′欢鏌ヨ + [Route("Sc_MESTransFerWorkBill/GetErrMsgBackResumeList")] + [HttpGet] + public object GetErrMsgBackResumeList(string HInterID,string sWhere,string user) + { + try + { + List<object> columnNameList = new List<object>(); + if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏌ョ湅鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn($@"select * from + (select a.HInterID,a.HDate '鏃ユ湡',a.HBillType,x.HName 鍗曟嵁绫诲瀷,a.HBillNo as '鍗曟嵁鍙�', + CASE WHEN a.HBillStatus <= 1 THEN '鍒涘缓' WHEN a.HBillStatus = 2 THEN '宸插鏍�' WHEN a.HBillStatus = 3 AND + a.HCloseType = 0 THEN '鑷姩鍏抽棴' WHEN a.HBillStatus = 3 AND + a.HCloseType = 1 THEN '鎵嬪姩鍏抽棴' WHEN a.HBillStatus = 4 THEN '宸蹭綔搴�' ELSE '鍏跺畠鐘舵��' END AS 鍗曟嵁鐘舵��, + a.HSendMan AS 鍙戦�佷汉,a.HReceiveMan AS 鎺ユ敹浜�,a.HCopyMan AS 鎶勯�佷汉,a.HLevel AS 绱ф�ョ▼搴�,a.HContext AS 涓婚,a.HDescription AS 鍐呭,a.HErrMsgBackTypeID,b.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 浣滃簾鏃ユ湡 + from ( + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackBillMain where HInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackReceiveBillMain where HMainSourceInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackSignBillMain where HErrMsgBackInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackHandleBillMain where HErrMsgBackInterID = {HInterID} UNION ALL + select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType,HSendMan,HReceiveMan,HCopyMan,HLevel,HContext,HDescription,HErrMsgBackTypeID from OA_ErrMsgBackCheckBillMain where HErrMsgBackInterID = {HInterID} + )as a,Xt_BillType as x,Gy_ErrMsgBackType as b + where a.HBillType = x.HNumber and a.HErrMsgBackTypeID = b.HItemID ) AS a where 1=1 " + sWhere + + @" ORDER BY 鏃ユ湡 ASC;", "OA_ErrMsgBackBillResume"); + + //娣诲姞鍔ㄦ�佸垪淇℃伅 + 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 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