|  |  |  | 
|---|
|  |  |  | using DBUtility; | 
|---|
|  |  |  | using Newtonsoft.Json; | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | 
|---|
|  |  |  | string UserName = sArray[1].ToString(); | 
|---|
|  |  |  | string refSav = sArray[2].ToString(); | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = UserName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, true, DBUtility.ClsPub.CurUserName)) | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, false, DBUtility.ClsPub.CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断会计期是否合理 | 
|---|
|  |  |  | string s = ""; | 
|---|
|  |  |  | int sYear = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = oItem.HMaker; | 
|---|
|  |  |  | oItem.HBillType = "3787"; | 
|---|
|  |  |  | oItem.HBillSubType = "3787"; | 
|---|
|  |  |  | oItem.HBillType = "4502"; | 
|---|
|  |  |  | oItem.HBillSubType = "4502"; | 
|---|
|  |  |  | oItem.HBillStatus = 1;   //单据状态(1未审,2审核通过,3关闭,4作废,5审核退回,6审核中,7已阅,8已回复,9结案,10验证,11下达,12开工,13申请审批,15申请检验,16 判定合格,17判定不合格) | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); | 
|---|
|  |  |  | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | string[] arrStr = oItem.HCopyMan.Split(','); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //接收人表体数据 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //string[] arrStr = oItem.HSendMan.Split(','); //发送人 | 
|---|
|  |  |  | //arrStr = oItem.HReceiveMan.Split(',');  //接收人 | 
|---|
|  |  |  | string[] arrStr = oItem.HCopyMan.Split(',');  //抄送人 | 
|---|
|  |  |  | List<string> b = new List<string>(arrStr); | 
|---|
|  |  |  | b.Add(oItem.HSendMan); | 
|---|
|  |  |  | b.Add(oItem.HReceiveMan); | 
|---|
|  |  |  | arrStr = b.ToArray(); | 
|---|
|  |  |  | //抄送人表体数据 | 
|---|
|  |  |  | for (int i = 1; i <= arrStr.Length; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Models.ClsOA_ErrMsgBackBillSub2 sb = new Models.ClsOA_ErrMsgBackBillSub2(); | 
|---|
|  |  |  | sb.HEntryID = i; | 
|---|
|  |  |  | sb.HReceiveMan = arrStr[i - 1]; | 
|---|
|  |  |  | if (arrStr[i-1].ToString() == oItem.HSendMan) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sb.HReadFlag = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oBill.DetailColl2.Add(sb); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oBill.omodel = oItem; | 
|---|
|  |  |  | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //审核权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, true, CurUserName)) | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = Get_TransFerBillList(sWhere); | 
|---|
|  |  |  | if (ds == null) | 
|---|
|  |  |  | 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 = ds.Tables[0]; | 
|---|
|  |  |  | objJsonResult.Message = "无查看权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql = "select * from h_v_OA_ErrMsgBackBillList order by 单据号 desc"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "返回记录成功!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | string sql1 = "select * from h_v_OA_ErrMsgBackBillList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere + " order by 单据号 desc"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //添加列名 | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType | 
|---|
|  |  |  | from OA_ErrMsgBackBillMain A | 
|---|
|  |  |  | inner join  OA_ErrMsgBackBillSub2 B on A.HInterID=B.HInterID | 
|---|
|  |  |  | left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere + ""); | 
|---|
|  |  |  | left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere + "   order by HItemID desc "); | 
|---|
|  |  |  | return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_ErrMsgBackBillMain"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public object Get_DeleteTransFerBill(string HInterID,string HEntryID, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //编辑权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Delete", 1, true, user)) | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Delete", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 报工平台异常反馈单回复 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 异常反馈单 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_MESTransFerWorkBill/ReplyMESTransFerWorkFrom")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object ReplyMESTransFerWorkFrom([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string UserName = sArray[1].ToString(); | 
|---|
|  |  |  | string refSav = sArray[2].ToString(); | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = UserName; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, false, DBUtility.ClsPub.CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无保存权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断会计期是否合理 | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill(); | 
|---|
|  |  |  | List<Models.ClsOA_ErrMsgBackBillSub> lsmain = new List<Models.ClsOA_ErrMsgBackBillSub>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | msg2 = msg2.Replace("\n", "");  //\n | 
|---|
|  |  |  | lsmain = oListModels.getObjectByJson_Gy_MESTransFerWorkBillSub(msg2); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (Models.ClsOA_ErrMsgBackBillSub DetailReply in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oBill.DetailReply = DetailReply; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (oBill.DetailReply.HInterID != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bResult = oBill.ReplyBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bResult = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (bResult) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "回复成功!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "回复失败!" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = e.Message; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 异常反馈列表回复获取数据 | 
|---|
|  |  |  | [Route("Sc_MESTransFerWorkBill/Get_TransFerReplyBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Get_TransFerReplyBill(string sWhere, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string sql1 = "select * from h_v_OA_ErrMsgBackBillSubList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere + " order by HInterID desc"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillSubList"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 异常反馈列表回复更改状态 | 
|---|
|  |  |  | [Route("Sc_MESTransFerWorkBill/Update_TransFerReplyBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Update_TransFerReplyBill(Int64 HInterID, string HEntryID,Int64 Type) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql = ""; | 
|---|
|  |  |  | switch (Type) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | case 9: | 
|---|
|  |  |  | sql = "update OA_ErrMsgBackBillSub set HSendStatus = 9 where HInterID = " + HInterID + " and HEntryID in (" + HEntryID + ")"; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 10: | 
|---|
|  |  |  | sql = "update OA_ErrMsgBackBillSub set HSendStatus = 10 where HInterID = " + HInterID + " and HEntryID in (" + HEntryID + ")"; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|