| | |
| | | using System.Web.Http; |
| | | using System.Windows.Forms; |
| | | using WebAPI.Models; |
| | | using System.Threading.Tasks; |
| | | using DLL; |
| | | using SyntacticSugar.constant; |
| | | |
| | | namespace WebAPI.Controllers.项ç®ç®¡ç.å·¥ä½ä»»å¡ |
| | | { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region å·¥ä½ä»»å¡å表å页å表 |
| | | [Route("PM_WorkTaskBill/page")] |
| | | [HttpGet] |
| | | public object PM_WorkTaskBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //夿æé |
| | | //if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user)) |
| | | //{ |
| | | // objJsonResult.code = CodeConstant.FAIL; |
| | | // objJsonResult.count = CountConstant.FAIL; |
| | | // objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åæé,请ä¸ç®¡çåèç³»ï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_PM_WorkTaskBillList " + page + "," + size + ",''", "h_p_PM_WorkTaskBillList"); |
| | | } |
| | | else |
| | | { |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | ds = oCN.RunProcReturn("exec h_p_PM_WorkTaskBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_PM_WorkTaskBillList"); |
| | | } |
| | | |
| | | //æ·»å åå |
| | | 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));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | objJsonResult.code = CodeConstant.SUCCEED; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region å·¥ä½ä»»å¡å表 䏿¨æ°æ®æ¥è¯¢ |
| | | /// <summary> |
| | |
| | | |
| | | #region 任塿±æ¥ æ°å¢/ç¼è¾-ä¿å |
| | | #region 任塿±æ¥ è¡¨å¤´æ°æ® |
| | | string reportMan; |
| | | public class PM_WorkTaskReportBill_Main |
| | | { |
| | | public int HInterID; |
| | |
| | | string HReportEmpName = mainList[0].HReportEmpName; |
| | | string HUpdater = mainList[0].HUpdater; |
| | | string HUpdaterDate = mainList[0].HUpdaterDate; |
| | | |
| | | reportMan = HReportEmpName;//è·åæ±æ¥äººåç§° |
| | | //ä¿ååæ§å¶ |
| | | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_PM_WorkTaskReportBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_PM_WorkTaskReportBill_BeforeSaveCtrl"); |
| | | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) |
| | |
| | | public json AddBillSub_WorkTaskReportBill(string msg3, long HInterID, string HBillNo, int OperationType) |
| | | { |
| | | List<PM_WorkTaskReportBill_Sub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM_WorkTaskReportBill_Sub>>(msg3); |
| | | int i = 0; //ä½ä¸ºå表å
ç |
| | | int i = 0; //ä½ä¸ºå表å
ç |
| | | foreach (PM_WorkTaskReportBill_Sub oSub in DetailColl) |
| | | { |
| | | i++; //åä¸ä¸ªä¸»è¡¨ä¸çå表çå
ç èªå¢ |
| | |
| | | oCN.RunProc(sql2); |
| | | } |
| | | } |
| | | |
| | | //æ¥æ¾å·¥ä½ä»»å¡è·åæ´¾å人åæé人 |
| | | string sqlz = "select * from h_v_PM_WorkTaskBillList where HInterID = " + HSourceInterID; |
| | | ds = oCN.RunProcReturn(sqlz, "h_v_PM_WorkTaskBillList"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | string HSendEmp = ds.Tables[0].Rows[0]["æ´¾å人"].ToString();//æ´¾å人 |
| | | string HCopyEmp = ds.Tables[0].Rows[0]["æé人"].ToString();//æé人 |
| | | string HWorkTaskDate = DateTime.Parse(ds.Tables[0].Rows[0]["æ¥æ"].ToString()).ToString("yyyy-MM-dd");//å·¥ä½ä»»å¡åæ®æ¶é´ |
| | | string HSelfTimes = ds.Tables[0].Rows[0]["èªè¯å·¥æ¶"].ToString();//èªè¯å·¥æ¶ |
| | | string HProjectName = ds.Tables[0].Rows[0]["项ç®åç§°"].ToString();//项ç®åç§° |
| | | string HTaskDescription = ds.Tables[0].Rows[0]["ä»»å¡æè¿°"].ToString(); |
| | | //æå
¥å表sql |
| | | string sql = "insert into PM_WorkTaskReportBillSub" + |
| | | "(HInterID,HBillNo_bak,HEntryID,HRemark,HProjectID,HProNumber,HProjectStageID,HName,HTaskNote,HType,HRelTimes,HReportNote,HAdv,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HFinishFlag) " + |
| | | "values(" + |
| | |
| | | "','" + HSourceBillNo + |
| | | "'," + DBUtility.ClsPub.BoolToString(HFinishFlag) + |
| | | ")"; |
| | | |
| | | oCN.RunProc(sql); |
| | | string messageContext = "åæ®æ¥æ= " + HWorkTaskDate + ",æ±æ¥äºº=" + reportMan + ",æ±æ¥å
容=" + HReportNote +",ä»»å¡æè¿° ="+ HTaskDescription +",宿æ è®°="+ (HFinishFlag?"æ¯":"å¦") + ",èªè¯å·¥æ¶=" + HSelfTimes + "å°æ¶,èç¨å·¥æ¶=" + HRelTimes + "å°æ¶,ä»»å¡åç§°=" + HName + ",项ç®åç§°=" + HProjectName; ; |
| | | _ = SendDingDingAsync(HSendEmp, messageContext, HCopyEmp); |
| | | } |
| | | |
| | | //ä¿ååæ§å¶ |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 任塿±æ¥å页å表 |
| | | [Route("PM_WorkTaskReportBill/page")] |
| | | [HttpGet] |
| | | public object PM_WorkTaskReportBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //夿æé |
| | | //if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user)) |
| | | //{ |
| | | // objJsonResult.code = CodeConstant.FAIL; |
| | | // objJsonResult.count = CountConstant.FAIL; |
| | | // objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åæé,请ä¸ç®¡çåèç³»ï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_PM_WorkTaskReportBillList " + page + "," + size + ",''", "h_p_PM_WorkTaskReportBillList"); |
| | | } |
| | | else |
| | | { |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | ds = oCN.RunProcReturn("exec h_p_PM_WorkTaskReportBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_PM_WorkTaskReportBillList"); |
| | | } |
| | | |
| | | //æ·»å åå |
| | | 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));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | objJsonResult.code = CodeConstant.SUCCEED; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 任塿±æ¥ ç¼è¾-页é¢èµå¼ |
| | | /// <summary> |
| | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 任塿±æ¥åä¿ååéééæ¶æ¯ |
| | | /// <summary> |
| | | /// 任塿±æ¥åä¿ååéééæ¶æ¯ |
| | | /// </summary> |
| | | /// <param name="HSendMan"></param> |
| | | /// <param name="HDescription">æ¥æ+æ±æ¥äºº+æ±æ¥å
容+å·¥æ¶+ 项ç®åç§°</param> |
| | | /// <param name="HCopyMan">æé人</param> |
| | | /// <returns></returns> |
| | | public async Task<object> SendDingDingAsync(string HSendMan, string HDescription, string HCopyMan) |
| | | { |
| | | string concatenatedNames = ""; |
| | | Cls_DDMsg msg = new Cls_DDMsg(); |
| | | string appKey = "dingrsrzhdyn3mlaof95"; |
| | | string appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq"; |
| | | //任塿±æ¥åä¿ååéééæ¶æ¯ä¿å å°æ¶æ¯ åéç» æ¥æ¶äºº |
| | | //è·åæ¥é人çééid |
| | | string HReceiveMan = HSendMan; |
| | | string[] names = HCopyMan.Split(','); |
| | | string sqlNames = ""; |
| | | foreach (string name in names) |
| | | { |
| | | sqlNames += "'" + name.Trim() + "',"; |
| | | } |
| | | sqlNames = sqlNames.TrimEnd(','); |
| | | //è·åææ´¾å¤ç人,åé人çééid |
| | | 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);//éé人åçidå表 |
| | | //è·åä¼ä¸çaccess_tokençå¼ |
| | | string response = msg.GetAccessToken(appKey, appSecret); |
| | | JObject responseJson = JObject.Parse(response); |
| | | // è·åaccess_tokençå¼ |
| | | string accessToken = responseJson["accessToken"].ToString(); |
| | | |
| | | //è°ç¨æ¹æ³åéæ¶æ¯ |
| | | string agentId = "3118119317";//ééåå°å»ºç«çå°ç¨åºid |
| | | string userIdList = concatenatedNames;//éé人åçid |
| | | 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 èªå¨å 载页é¢è¡¨å¤´ |
| | | ///// <summary> |
| | | ///// è¿å项ç®é¶æ®µå表 |
| | | /////åæ°ï¼string sqlã |
| | | /////è¿åå¼ï¼objectã |
| | | ///// </summary> |
| | | //[Route("Xt_DefineBillMainSet/getDefineBillMainSet")] |
| | | //[HttpGet] |
| | | //public object getDefineBillMainSet(string HModName, string user) |
| | | //{ |
| | | // try |
| | | // { |
| | | // string sql = "select * from h_v_Xt_DefineBillMainSet_AutoLoadList where HModName ='" + HModName + "' and HUser ='" + user + "' order by HArrangeOrder,HArrangeOrderSub"; |
| | | // ds = oCN.RunProcReturn(sql, "Xt_DefineBillMainSet"); |
| | | |
| | | // if(ds!=null && ds.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // sql = "select * from h_v_Xt_DefineBillMainSet_AutoLoadList where HModName ='" + HModName + "' and HUser ='admin' order by HArrangeOrder,HArrangeOrderSub"; |
| | | // ds = oCN.RunProcReturn(sql, "h_v_Xt_DefineBillMainSet_AutoLoadList"); |
| | | // } |
| | | |
| | | // 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; |
| | | // } |
| | | //} |
| | | //#endregion |
| | | } |
| | | } |