From e69d3f70d1c82fdbf5cc0b39f55882a10361c0d6 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期日, 29 六月 2025 18:43:59 +0800 Subject: [PATCH] 小车锁定;排时根据产品器具清单获取模具; --- WebAPI/Controllers/SBGL/SB_EquipICMOTechParamBillController.cs | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 292 insertions(+), 3 deletions(-) diff --git a/WebAPI/Controllers/SBGL/SB_EquipICMOTechParamBillController.cs b/WebAPI/Controllers/SBGL/SB_EquipICMOTechParamBillController.cs index 0c848c5..f2030dd 100644 --- a/WebAPI/Controllers/SBGL/SB_EquipICMOTechParamBillController.cs +++ b/WebAPI/Controllers/SBGL/SB_EquipICMOTechParamBillController.cs @@ -1,4 +1,5 @@ -锘縰sing Newtonsoft.Json; +锘縰sing DLL; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; @@ -7,6 +8,7 @@ using System.Data; using System.Data.SqlClient; using System.IO; +using System.Threading.Tasks; using System.Web; using System.Web.Http; using WebAPI.Models; @@ -332,7 +334,7 @@ return objJsonResult; } else - { + { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鍗曟嵁鍙凤細"+ oBill.omodel.HBillNo+ " 瀹℃牳鎴愬姛锛�"; @@ -746,6 +748,179 @@ } #endregion + #region 璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄦā鍧� 浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤 + /// <summary> + /// 璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄦā鍧� 浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤 + /// </summary> + /// <param name="HInterID">涓婚敭ID</param> + /// <param name="HMaker">鍒跺崟浜�</param> + /// <param name="sWhere">绛涢�夋潯浠�</param> + /// <returns>杩斿洖绗﹀悎鏉′欢鐨勬潯鐩暟鍜屽綋鍓嶄富閿搴旂殑鏉$洰鍦ㄨ〃涓殑浣嶇疆</returns> + [Route("SB_EquipICMOTechParamBillController/GetSB_EquipICMOTechParamBill_Position")] + [HttpGet] + public object GetSB_EquipICMOTechParamBill_Position(Int64 HInterID, string HMaker, string sWhere) + { + try + { + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql = "exec h_p_SB_EquipCMOTechParamBillListEdit_GetCurrRecord @HInterID = N'" + HInterID + + "', @sWhere = N'" + sWhere + "'"; + + //杩斿洖鍒楄〃淇℃伅 + ds = oCn.RunProcReturn(sql, "h_p_SB_EquipCMOTechParamBillListEdit_GetCurrRecord"); + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "杩斿洖璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄤ俊鎭け璐ワ紒" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄦā鍧� 浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤 + /// <summary> + /// + /// </summary> + /// <param name="HMaker">鍒跺崟浜�</param> + /// <param name="sWhere">绛涢�夋潯浠�</param> + /// <param name="current">鏉$洰鍦ㄦ暟鎹〃涓殑浣嶇疆</param> + /// <returns>鍗曟嵁淇℃伅鍜屼綅缃�</returns> + [Route("SB_EquipICMOTechParamBillController/GetSB_EquipICMOTechParamBill_ByPosition")] + [HttpGet] + public object GetSB_EquipICMOTechParamBill_ByPosition(string HMaker, string sWhere, int current) + { + try + { + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql = "EXEC [dbo].[h_p_SB_EquipICMOTechParamBill_Edit_WithPosition]" + + " @Postition = N'"+ current +"'" + + " ,@sWhere = N'"+ sWhere +"'"; + //杩斿洖鍒楄〃淇℃伅 + ds = oCn.RunProcReturn(sql, "h_p_SB_EquipICMOTechParamBill_Edit_WithPosition"); + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌璇ヨ澶囧伐鑹哄弬鏁拌鍗曠偣妫�琛紝璇峰埛鏂版暟鎹悗閲嶆柊閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "杩斿洖璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄤ俊鎭け璐ワ紒" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄦā鍧� 浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤 + /// <summary> + /// 璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄧ紪杈戞椂锛屾牴鎹崟鎹甀D鑾峰彇鍗曟嵁淇℃伅 + /// </summary> + /// <returns></returns> + [Route("SB_EquipICMOTechParamBillController/GetSB_EquipICMOTechParamBill_QueryHistoryRecord")] + [HttpGet] + public object GetSB_EquipICMOTechParamBill_QueryHistoryRecord(Int64 HInterID, string HMaker, string HProcID, String HSourceID) + { + try + { + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + string sql = "exec h_p_SB_EquipICMOTechParamBill_Edit_QueryHistoryRecord " + + "@HInterID = N'" + HInterID + "'" + + ", @HProcID = N'" + HProcID + "'" + + ", @HSourceID = N'" + HSourceID + "'"; + LogService.Write(sql); + //杩斿洖鍒楄〃淇℃伅 + ds = oCn.RunProcReturn(sql + , "h_p_SB_EquipICMOTechParamBill_Edit_QueryHistoryRecord"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌璇ヨ澶囧伐鑹哄弬鏁拌鍗曠偣妫�琛紝璇峰埛鏂版暟鎹悗閲嶆柊閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "杩斿洖璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄤ俊鎭け璐ワ紒" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #region 璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄤ繚瀛� /// <summary> /// 璁惧宸ヨ壓鍙傛暟璁㈠崟鐐规琛ㄤ繚瀛� @@ -874,6 +1049,31 @@ if (bResult) { + + //鑷姩瀹℃牳璁剧疆 + if (OperationType == "1") + { + objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //杩斿洖涓籌D + //绯荤粺鍙傛暟 鑷姩瀹℃牳 + string sReturn = ""; + if (oSystemParameter.ShowBill(ref sReturn) == true) + { + if (oSystemParameter.omodel.SB_EquipICMOTechParamBill_Check == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + objJsonResult.Verify = "Y"; + } + else + { + objJsonResult.Verify = "N"; + } + } + } + else + { + objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //杩斿洖涓籌D + objJsonResult.Verify = "N"; + } + objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //鎴愬姛锛� @@ -1128,9 +1328,98 @@ return objJsonResult; } } - #endregion + #endregion + + # region 鎵嬪伐鐐规琛ㄥ嚭鐜癗G鍙戦�佷俊鎭� + [Route("SB_EquipICMOTechParamBillController/HSendDDMeg")] + [HttpGet] + + public async Task<object> HSendDDMeg(string HInterID) + { + try + { + //鏌ヨ瀛愯〃鏄惁鏈塏G鍊� + ds = oCn.RunProcReturn("select * from SB_EquipICMOTechParamBillMain a inner join SB_EquipICMOTechParamBillSub b on a.HInterID=b.HInterID where b.HResult='NG' and a.HInterID=" + HInterID, "SB_EquipICMOTechParamBillMain"); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count != 0) + { + //鏌ヨ骞跺悎骞跺紓甯稿伐鑹哄弬鏁板�� + string sql = @"SELECT 鐢熶骇杞﹂棿, STUFF((SELECT ', ' + CAST(hsubid AS VARCHAR(10)) FROM h_v_SB_EquipICMOTechParamBillList_Detail AS InnerTable WHERE InnerTable.鐢熶骇杞﹂棿 = OuterTable.鐢熶骇杞﹂棿 AND InnerTable.妫�娴嬬粨鏋� = 'NG' AND InnerTable.hmainid ='"+HInterID+"' FOR XML PATH('')), 1, 2, '') AS hsubid,STUFF(( SELECT '; ' + 璁惧缂栫爜 + ' - ' + 宸ヨ壓鍙傛暟 + ' - 宸ヨ壓鍙傛暟鍊�: ' + CAST(宸ヨ壓鍙傛暟鍊� AS VARCHAR(10)) + ' - 鏍囧噯鍊�: ' + CAST(鏍囧噯鍊� AS VARCHAR(10)) + ' - 涓婇檺: ' + CAST(涓婇檺 AS VARCHAR(10)) + ' - 涓嬮檺: ' + CAST(涓嬮檺 AS VARCHAR(10)) FROM h_v_SB_EquipICMOTechParamBillList_Detail AS InnerTable WHERE InnerTable.鐢熶骇杞﹂棿 = OuterTable.鐢熶骇杞﹂棿 AND InnerTable.妫�娴嬬粨鏋� = 'NG' FOR XML PATH('') ), 1, 2, '') AS 鍐呭 FROM h_v_SB_EquipICMOTechParamBillList_Detail AS OuterTable where OuterTable.hmainid = '" + HInterID + "' GROUP BY 鐢熶骇杞﹂棿"; + ds = oCn.RunProcReturn(sql, "h_v_SB_EquipICMOTechParamBillList_Detail"); + var HDeptName = ds.Tables[0].Rows[0]["鐢熶骇杞﹂棿"].ToString(); + var HDescription = ds.Tables[0].Rows[0]["鍐呭"].ToString(); + var HSubID = ds.Tables[0].Rows[0]["hsubid"].ToString(); + //鏌ヨ鎺ユ敹浜� + string newSql1 = @"select a.HDingDingUserID 閽夐拤id,a.Czymc 鎺ユ敹浜� 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 = '" + HDeptName + "宸ヨ壓寮傚父棰勮鎺ユ敹浜�'"; + DataSet dt = oCn.RunProcReturn(newSql1, "Gy_Czygl"); + if (dt.Tables[0].Rows.Count > 0) + { + + 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"; + } + + } + + //鑾峰彇浼佷笟鐨刟ccess_token鐨勫�� + string response = msg.GetAccessToken(appKey, appSecret); + JObject responseJson = JObject.Parse(response); + // 鑾峰彇access_token鐨勫�� + string accessToken = responseJson["accessToken"].ToString(); + string HName = ""; // 鐢ㄤ簬瀛樺偍鎷兼帴鍚庣殑閽夐拤ID + List<string> dingDingIds = new List<string>(); // 鐢ㄦ潵瀛樺偍閽夐拤ID鐨勯泦鍚� + // 鎷兼帴閽夐拤ID + for (int i = 0; i < dt.Tables[0].Rows.Count; i++) + { + dingDingIds.Add(dt.Tables[0].Rows[i]["閽夐拤id"].ToString()); // 灏嗘瘡涓拤閽塈D娣诲姞鍒板垪琛ㄤ腑 + } + + // 浣跨敤閫楀彿灏嗛拤閽塈D鎷兼帴鎴愪竴涓瓧绗︿覆 + HName = string.Join(",", dingDingIds); + //鏇存柊涓篘G鐨勫瓙琛ㄥ瓧娈� 鏈� 宸插彂閫� 1 + oCn.RunProc("update SB_EquipICMOTechParamBillSub set HSendFlag =1 where HInterID='" + HInterID + "' and HEntryID in(" + HSubID + ")"); + response = await msg.SendTextMessage(accessToken, agentIds, HName, "0", "false", HDescription); + return response; + } + } + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鏃燦G宸ヨ壓鍙傛暟锛�"; + objJsonResult.data = null; + return objJsonResult; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙戦�佸け璐ワ紒" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1