|  |  |  | 
|---|
|  |  |  | using DBUtility; | 
|---|
|  |  |  | using DAL; | 
|---|
|  |  |  | using DBUtility; | 
|---|
|  |  |  | using DLL; | 
|---|
|  |  |  | using Newtonsoft.Json; | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_MESTransFerWorkBill/SaveGetMESTransFerWorkFrom")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveGetMESTransFerWorkFrom([FromBody] JObject msg) | 
|---|
|  |  |  | public object SaveGetMESTransFerWorkFromAsync([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; //返回主ID | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.Verify = "N"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | _ = SendDingDingAsync(oBill.omodel.HSendMan, oBill.omodel.HHandleEmpID,oBill.omodel.HDescription,""); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (refSav == "Update") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [Route("OA_ErrMsgBackSignBill_BrushCard/ErrMsgBackReceive")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object ErrMsgBackReceive(string sWhere, string user) | 
|---|
|  |  |  | public object ErrMsgBackReceive(string sWhere,string num, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | _ = SendDingDingAsync(oBill.omodel.HSendMan, 1, oBill.omodel.HDescription, oBill.omodel.HReceiveMan); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (refSav == "Update") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | _ = SendDingDingAsync(oBill.omodel.HSendMan, 2, oBill.omodel.HDescription, oBill.omodel.HReceiveMan); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (refSav == "Update") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | _ = SendDingDingAsync(oBill.omodel.HReceiveMan, 0, oBill.omodel.HDescription, oBill.omodel.HCopyMan); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (refSav == "Update") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断会计期是否合理 | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | //string[] arrStr = oItem.HSendMan.Split(','); //发送人 | 
|---|
|  |  |  | //arrStr = oItem.HReceiveMan.Split(',');  //接收人 | 
|---|
|  |  |  | string[] arrStr = oItem.HCopyMan.Split(',');  //抄送人 | 
|---|
|  |  |  | List<string> b = new List<string>(arrStr); | 
|---|
|  |  |  | b.Add(oItem.HReceiveMan); | 
|---|
|  |  |  | arrStr = b.ToArray(); | 
|---|
|  |  |  | if (!string.IsNullOrEmpty(oItem.HCopyMan)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | arrStr = oItem.HCopyMan.Split(',');  // 抄送人 | 
|---|
|  |  |  | List<string> b = new List<string>(arrStr); | 
|---|
|  |  |  | b.Add(oItem.HReceiveMan); | 
|---|
|  |  |  | arrStr = b.ToArray(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | arrStr = oItem.HReceiveMan.Split(',');//接收人 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //抄送人表体数据 | 
|---|
|  |  |  | for (int i = 1; i <= arrStr.Length; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | #region 工作联系单编辑获取数据 | 
|---|
|  |  |  | [Route("Sc_MESTransFerWorkBill/GetOA_WorkLinkBillListCheckDetai")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object GetOA_WorkLinkBillListCheckDetai(string HID, string HEntryID) | 
|---|
|  |  |  | public object GetOA_WorkLinkBillListCheckDetai(string HID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<object> columnNameList = new List<object>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string sql = string.Format(@"select A.*,B.HEntryID,B.HReadFlag,D.HName HDeptName,e.HName HEvaluateStatusName | 
|---|
|  |  |  | string sql = string.Format(@"select A.*,D.HName HDeptName,e.HName HEvaluateStatusName | 
|---|
|  |  |  | from OA_WorkLinkBillMain A | 
|---|
|  |  |  | inner join  OA_WorkLinkBillSub2 B on A.HInterID=B.HInterID | 
|---|
|  |  |  | left join Gy_Department D on A.HDeptID=D.HItemID | 
|---|
|  |  |  | left join Gy_EvaluateStatus AS e ON A.HEvaluateStatusID = e.HItemID | 
|---|
|  |  |  | where A.HInterID='" + HID + "' and b.HEntryID='" + HEntryID + "'"); ; | 
|---|
|  |  |  | where A.HInterID='" + HID + "'" ); ; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "OA_WorkLinkBillMain"); | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工作联系单回复 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 异常反馈单 | 
|---|
|  |  |  | /// 工作联系单 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断会计期是否合理 | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #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 工作联系单根据源单ID查看是否有对应联系单 | 
|---|
|  |  |  | [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(','); | 
|---|
|  |  |  | //获取指派处理人,发送人的钉钉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); | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | //获取指派处理人,发送人的钉钉id | 
|---|
|  |  |  | 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 + "--已接收"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取企业的access_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;//钉钉人员的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  异常反馈单查询(接收的,发送的,抄送的) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [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_QC_ErrManagerLedgerReport_Source"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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 物料代码,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));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|