using DAL; using DBUtility; using DLL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; 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 { public class Sc_MESTransFerWorkBillController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更 private json objJsonResult = new json(); public DataSet ds = new DataSet(); public WebServer webserver = new WebServer(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); private WebS.WebService1 oWebs = new WebS.WebService1(); //获取系统参数 Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public DLL.ClsOA_ErrMsgBackBill BillNew = new DLL.ClsOA_ErrMsgBackBill(); //对应单据类 public DLL.ClsOA_ErrMsgBackBill BillOld = new DLL.ClsOA_ErrMsgBackBill(); //对应单据类 public DAL.ClsOA_AndengFlowRuleBill BillOld1 = new DAL.ClsOA_AndengFlowRuleBill(); //对应单据类 安灯逐级呼叫规则 public DAL.ClsOA_AndengFlowRuleBill BillNew1 = new DAL.ClsOA_AndengFlowRuleBill(); //对应单据类 安灯逐级呼叫规则 public DAL.ClsOA_WorkLinkBill BillOld2 = new DAL.ClsOA_WorkLinkBill(); //对应单据类 工作联系单 public DAL.ClsOA_WorkLinkBill BillNew2 = new DAL.ClsOA_WorkLinkBill(); //对应单据类 工作联系单 #region 报工平台异常反馈单保存/编辑 /// /// 异常反馈单 /// /// /// [Route("Sc_MESTransFerWorkBill/SaveGetMESTransFerWorkFrom")] [HttpPost] public object SaveGetMESTransFerWorkFromAsync([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 lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_MESTransFerWorkFrom(msg2); foreach (Models.ClsOA_ErrMsgBackBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (BillOld.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (BillOld.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } DBUtility.ClsPub.CurUserName = oItem.HMaker; 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.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } //string[] arrStr = oItem.HSendMan.Split(','); //发送人 //arrStr = oItem.HReceiveMan.Split(','); //接收人 string[] arrStr; if (string.IsNullOrEmpty(oItem.HCopyMan)) { arrStr = new string[0]; // 如果 oItem.HCopyMan 为空,则赋值为空数组 } else { arrStr = oItem.HCopyMan.Split(','); // 否则,使用 Split(',') 方法拆分字符串 } List b = new List(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; } //保存 //保存完毕后处理 bool bResult; if (refSav == "Add") { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); if (bResult) { objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //返回主ID //系统参数 自动审核 string sReturn = ""; if (oSystemParameter.ShowBill(ref sReturn) == true) { if (oSystemParameter.omodel.OA_ErrMsgBackBill_AutoCheck== "Y") //系统参数 自动审核 { objJsonResult.Verify = "Y"; } else { objJsonResult.Verify = "N"; } } } } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); objJsonResult.Verify = "N"; } 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 [报工台异常反馈单审核、反审核] /// /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MESTransFerWorkBill/AuditTransFerReportList")] [HttpGet] public object AuditTransFerReportList(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackBill_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } 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); DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill(); //查看是否已审核,关闭,作废 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { 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; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.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; } if (IsAudit == 0) //审核提交 { //审核提交 if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核提交AbandonCheck if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈列表 [Route("Sc_MESTransFerWorkBill/Get_TransFerBillList")] [HttpGet] public object Get_TransFerBillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 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, "h_v_OA_ErrMsgBackBillList"); } else { 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) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } public static DataSet Get_TransFerBillList(string sWhere) { //var sql = "select A.HInterID,b.HEntryID,A.HBillNo,A.HContext,A.HDeptID,D.HName HDeptName, A.HSendMan, B.HReceiveMan,A.HLevel,A.HDescription,case when B.HReadFlag=0 then '未阅' when B.HReadFlag=1 then '已阅' end HReadFlag, A.HMaker,A.HMakeDate,A.HUpDater,A.HUpDateDate" + // " from OA_InformBillMain A inner join OA_InformBillSub B on A.HInterID=B.HInterID left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere; var sql = string.Format(@"select A.HInterID,b.HEntryID,A.HBillStatus,A.HBillNo,A.HDate,A.HContext,A.HDescription,A.HRemark,A.HQty,case when A.HSendType=0 then '公共' when B.HReadFlag=1 then '个人' end HSendType, A.HDeptID,D.HName HDeptName, A.HSendMan, A.HReceiveMan,B.HReceiveMan HCopyMan,A.HHasten, case when A.HLevel=0 then '普通' when B.HReadFlag=1 then '紧急' end HLevel,A.HMaterName,A.HMaterModel, case when B.HReadFlag=0 then '未阅' when B.HReadFlag=1 then '已阅' end HReadFlag, A.HMaker,A.HMakeDate,A.HUpDater,A.HUpDateDate,A.HChecker,A.HCheckDate, 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 + " order by HItemID desc "); return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_ErrMsgBackBillMain"); } #endregion #region 异常反馈列表PDA [Route("Sc_MESTransFerWorkBill/Get_TransFerBillList_PDA")] [HttpGet] public object Get_TransFerBillList_PDA(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackBillList_PDA order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList_PDA"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackBillList_PDA where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList_PDA"); } //添加列名 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_TransFerBillListCheckDetai")] [HttpGet] public ApiResult Get_TransFerBillListCheckDetai(string HID, string HEntryID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { 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.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.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.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) return new ApiResult { code = -1, msg = "不存在单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } #endregion #region[更改异常反馈单阅读状态] [Route("Sc_MESTransFerWorkBill/Get_UpdateTransFerMessage")] [HttpGet] public object Get_UpdateTransFerMessage(string HInterID, string HEntryID) { oCN.BeginTran(); oCN.RunProc("Update OA_ErrMsgBackBillSub2 set HReadFlag=1 where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'", ref ClsPub.sExeReturnInfo); oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; ; } #endregion #region [模具改制申请单删除功能] /// /// 模具改制申请单删除功能 /// /// [Route("Sc_MESTransFerWorkBill/Get_DeleteTransFerBill")] [HttpGet] public object Get_DeleteTransFerBill(string HInterID,string HEntryID, string user) { //编辑权限 if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无删除权限!"; objJsonResult.data = null; return objJsonResult; } string s = ""; Int64 lngBillKey = 0; try { lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据ID为空!"; objJsonResult.data = null; return objJsonResult; } DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据当前处于不能删除状态,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已经审核,不能删除!"; objJsonResult.data = null; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowDeleteBill(oBill, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s; objJsonResult.data = null; return objJsonResult; } bool IsDete = oBill.DeleteBill(lngBillKey, HEntryID, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; 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 = e.Message; objJsonResult.data = null; return objJsonResult; } } #endregion #region 报工平台异常反馈单回复 /// /// 异常反馈单 /// /// /// [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 lsmain = new List(); 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 #region 异常反馈 接收/签到/处理 单列表 根据异常 反馈/接收/签到/处理 单下推获取数据 [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackList")] [HttpGet] public object Get_OA_ErrMsgBackList(string HInterID,string HEntryID, string user,Int64 num) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql = ""; string HViewName = ""; switch (num) { case 1: //异常反馈单 sql = "select * from h_v_OA_ErrMsgBackBillList where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'"; HViewName = "h_v_OA_ErrMsgBackBillList"; break; case 2://异常反馈接收单 sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList where hmainid = '" + HInterID + "'"; HViewName = "h_v_OA_ErrMsgBackReceiveBillMainList"; break; case 3://异常反馈处理单 sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList where hmainid = '" + HInterID + "'"; HViewName = "h_v_OA_ErrMsgBackHandleBillMainList"; break; case 10: //异常反馈单PDA sql = "select * from h_v_OA_ErrMsgBackBillList_PDA where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'"; HViewName = "h_v_OA_ErrMsgBackBillList_PDA"; break; case 11://异常反馈接收单PDA sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA where hmainid = '" + HInterID + "'"; HViewName = "h_v_OA_ErrMsgBackReceiveBillList_PDA"; break; case 12://异常反馈处理单PDA sql = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA where hmainid = '" + HInterID + "'"; HViewName = "h_v_OA_ErrMsgBackHandleBillList_PDA"; break; } if(sql == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "查询数据异常,递入源单类型num不正确!"; objJsonResult.data = null; return objJsonResult; } ds = oCN.RunProcReturn(sql, HViewName); //添加列名 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 异常反馈接收单 #region 异常反馈接收单 新增/编辑 [Route("Sc_MESTransFerWorkBill/SaveOA_ErrMsgBackReceiveBill")] [HttpPost] public object SaveOA_ErrMsgBackReceiveBill([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 msg3 = sArray[1].ToString(); //子表 string refSav = sArray[1].ToString();//操作方式数据类型 1添加 3修改 2 复制 string msg4 = sArray[2].ToString();//用户名 DBUtility.ClsPub.CurUserName = msg4; string UserName = ""; string s = ""; ListModels oListModels = new ListModels(); try { //编辑权限 if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackReceiveBillMain_Edit", 1, false, msg4)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无保存权限!"; objJsonResult.data = null; return objJsonResult; } // OA_ErrMsgBackReceiveBill DAL.ClsOA_ErrMsgBackReceiveBill oBill = new DAL.ClsOA_ErrMsgBackReceiveBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_OA_ErrMsgBackReceiveBill(msg2); foreach (Model.ClsOA_ErrMsgBackReceiveBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (oBill.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } UserName = oItem.HMaker; //制单人 oItem.HBillType = "4529"; oItem.HBillSubType = "4529"; 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.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //保存 //保存完毕后处理 bool bResult; if (refSav == "Add") { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); _ = SendDingDingAsync(oBill.omodel.HSendMan, oBill.omodel.HHandleEmpID,oBill.omodel.HDescription,""); } else if (refSav == "Update") { bResult = oBill.ModifyBill(oBill.omodel.HInterID, 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.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region 异常反馈接收单 编辑回显列表 [Route("Sc_MESTransFerWorkBill/Edit_OA_ErrMsgBackReceiveBill")] [HttpGet] public object Edit_OA_ErrMsgBackReceiveBill(string HID) { try { List columnNameList = new List(); string sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList where hmainid='"+HID+"'"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList"); //添加列名 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_OA_ErrMsgBackReceiveBillList")] [HttpGet] public object Get_OA_ErrMsgBackReceiveBillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackReceiveBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillMainList where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList"); } //添加列名 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 异常反馈接收单列表PDA [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackReceiveBillList_PDA")] [HttpGet] public object Get_OA_ErrMsgBackReceiveBillList_PDA(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackReceiveBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_PDA"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_PDA"); } //添加列名 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 异常反馈接收单 删除 /// ///参数:string HInterID。 ///返回值:object。 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackReceiveBill")] [HttpGet] public object DeleteOA_ErrMsgBackReceiveBill(string HInterID, string user) { try { string s = ""; DAL.ClsOA_ErrMsgBackReceiveBill BillOld = new DAL.ClsOA_ErrMsgBackReceiveBill(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackReceiveBillMain_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无删除权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID不能为空!"; objJsonResult.data = null; return objJsonResult; } if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可删除 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许删除!"; objJsonResult.data = 1; return objJsonResult; } //删除前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackReceiveBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackReceiveBill_BeforeDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //================================================================================== oCN.BeginTran(); oCN.RunProc("delete from OA_ErrMsgBackReceiveBillMain where HInterID = " + HInterID); oCN.RunProc("delete from OA_ErrMsgBackReceiveBillSub where HInterID= " + HInterID); //删除后控制================================================================================== string sql2 = "exec h_p_OA_ErrMsgBackReceiveBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql2, "h_p_OA_ErrMsgBackReceiveBill_AfterDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { s = "删除后判断失败,请与网络管理人员联系"; objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { s = ds.Tables[0].Rows[0]["HRemark"].ToString(); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //============================================================================================== oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "删除成功"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈接收单 审核/反审核 /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MESTransFerWorkBill/AuditOA_ErrMsgBackReceiveBill")] [HttpGet] public object AuditOA_ErrMsgBackReceiveBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackReceiveBillMain_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackReceiveBill oBill = new DAL.ClsOA_ErrMsgBackReceiveBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 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; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.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; } //进行需要进行的审核/反审核操作 if (IsAudit == 0) //审核提交 { oCN.BeginTran(); //记录返回信息 string msg = ""; //审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackReceiveBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackReceiveBill_BeforeCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //================================================================================== //审核提交 if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackReceiveBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功!" + msg; objJsonResult.data = null; return objJsonResult; } else { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackReceiveBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackReceiveBill_BeforeUnCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //=========================================================== //反审核提交AbandonCheck if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackReceiveBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈接收单 关闭/反关闭 /// /// /// 单据ID /// 关闭(0),反关闭(1) /// 关闭人 /// [Route("Sc_MESTransFerWorkBill/CloseOA_ErrMsgBackReceiveBill")] [HttpGet] public object CloseOA_ErrMsgBackReceiveBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackReceiveBillMain_Close"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackReceiveBill oBill = new DAL.ClsOA_ErrMsgBackReceiveBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //关闭判断 { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次关闭!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭判断 { if (oBill.omodel.HCloseMan.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; } //进行需要进行的关闭/反关闭操作 if (IsAudit == 0) //关闭提交 { //关闭提交 if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈接收单 作废/反作废 /// /// /// 单据ID /// 作废(0),反作废(1) /// 作废人 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackReceiveBill")] [HttpGet] public object DeleteOA_ErrMsgBackReceiveBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackReceiveBillMain_Drop"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackReceiveBill oBill = new DAL.ClsOA_ErrMsgBackReceiveBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能进行作废!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //作废判断 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再作废!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反作废判断 { 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; } //进行需要进行的作废/反作废操作 if (IsAudit == 0) //作废提交 { //作废提交 if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈接收单列表(异常反馈刷卡签到) [Route("OA_ErrMsgBackSignBill_BrushCard/ErrMsgBackReceive")] [HttpGet] public object ErrMsgBackReceive(string sWhere,string num, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackReceiveBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (num=="2") //报工台获取刷卡签到数据 { 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 //原有的刷卡签到获取数据 { { 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) { 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 #endregion #region 异常反馈签到单 #region 异常反馈签到单 新增/编辑 [Route("Sc_MESTransFerWorkBill/SaveOA_ErrMsgBackSignBill")] [HttpPost] public object SaveOA_ErrMsgBackSignBill([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 msg3 = sArray[1].ToString(); //子表 string refSav = sArray[1].ToString();//操作方式数据类型 1添加 3修改 2 复制 string msg4 = sArray[2].ToString();//用户名 DBUtility.ClsPub.CurUserName = msg4; string UserName = ""; string s = ""; ListModels oListModels = new ListModels(); try { //编辑权限 if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackSignBillMain_Edit", 1, false, msg4)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无保存权限!"; objJsonResult.data = null; return objJsonResult; } // OA_ErrMsgBackSignBill DAL.ClsOA_ErrMsgBackSignBill oBill = new DAL.ClsOA_ErrMsgBackSignBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_OA_ErrMsgBackSignBill(msg2); foreach (Model.ClsOA_ErrMsgBackSignBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (oBill.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } UserName = oItem.HMaker; //制单人 oItem.HBillType = "4530"; oItem.HBillSubType = "4530"; 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.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //保存 //保存完毕后处理 bool bResult; if (refSav == "Add") { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); _ = SendDingDingAsync(oBill.omodel.HSendMan, 1, oBill.omodel.HDescription, oBill.omodel.HReceiveMan); } else if (refSav == "Update") { bResult = oBill.ModifyBill(oBill.omodel.HInterID, 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.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region 异常反馈签到单 编辑回显列表 [Route("Sc_MESTransFerWorkBill/Edit_OA_ErrMsgBackSignBill")] [HttpGet] public object Edit_OA_ErrMsgBackSignBill(string HID) { try { List columnNameList = new List(); string sql = "select * from h_v_OA_ErrMsgBackSignBillMainList where hmainid='" + HID + "'"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillMainList"); //添加列名 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_OA_ErrMsgBackSignBillList")] [HttpGet] public object Get_OA_ErrMsgBackSignBillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackSignBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackSignBillMainList order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillMainList"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackSignBillMainList where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillMainList"); } //添加列名 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 异常反馈签到单列表PDA [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackSignBillList_PDA")] [HttpGet] public object Get_OA_ErrMsgBackSignBillList_PDA(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackSignBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackSignBillList_PDA order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillList_PDA"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackSignBillList_PDA where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillList_PDA"); } //添加列名 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 异常反馈签到单 删除 /// ///参数:string HInterID。 ///返回值:object。 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackSignBill")] [HttpGet] public object DeleteOA_ErrMsgBackSignBill(string HInterID, string user) { try { string s = ""; DAL.ClsOA_ErrMsgBackSignBill BillOld = new DAL.ClsOA_ErrMsgBackSignBill(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackSignBillMain_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无删除权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID不能为空!"; objJsonResult.data = null; return objJsonResult; } if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可删除 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许删除!"; objJsonResult.data = 1; return objJsonResult; } //删除前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackSignBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackSignBill_BeforeDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //================================================================================== oCN.BeginTran(); oCN.RunProc("delete from OA_ErrMsgBackSignBillMain where HInterID = " + HInterID); oCN.RunProc("delete from OA_ErrMsgBackSignBillSub where HInterID= " + HInterID); //删除后控制================================================================================== string sql2 = "exec h_p_OA_ErrMsgBackSignBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql2, "h_p_OA_ErrMsgBackSignBill_AfterDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { s = "删除后判断失败,请与网络管理人员联系"; objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { s = ds.Tables[0].Rows[0]["HRemark"].ToString(); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //============================================================================================== oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "删除成功"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈签到单 审核/反审核 /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MESTransFerWorkBill/AuditOA_ErrMsgBackSignBill")] [HttpGet] public object AuditOA_ErrMsgBackSignBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackSignBillMain_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackSignBill oBill = new DAL.ClsOA_ErrMsgBackSignBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 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; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.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; } //进行需要进行的审核/反审核操作 if (IsAudit == 0) //审核提交 { oCN.BeginTran(); //记录返回信息 string msg = ""; //审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackSignBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackSignBill_BeforeCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //================================================================================== //审核提交 if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackSignBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功!" + msg; objJsonResult.data = null; return objJsonResult; } else { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackSignBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackSignBill_BeforeUnCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //=========================================================== //反审核提交AbandonCheck if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackSignBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈签到单 关闭/反关闭 /// /// /// 单据ID /// 关闭(0),反关闭(1) /// 关闭人 /// [Route("Sc_MESTransFerWorkBill/CloseOA_ErrMsgBackSignBill")] [HttpGet] public object CloseOA_ErrMsgBackSignBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackSignBillMain_Close"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackSignBill oBill = new DAL.ClsOA_ErrMsgBackSignBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //关闭判断 { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次关闭!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭判断 { if (oBill.omodel.HCloseMan.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; } //进行需要进行的关闭/反关闭操作 if (IsAudit == 0) //关闭提交 { //关闭提交 if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈签到单 作废/反作废 /// /// /// 单据ID /// 作废(0),反作废(1) /// 作废人 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackSignBill")] [HttpGet] public object DeleteOA_ErrMsgBackSignBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackSignBillMain_Drop"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackSignBill oBill = new DAL.ClsOA_ErrMsgBackSignBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能进行作废!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //作废判断 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再作废!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反作废判断 { 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; } //进行需要进行的作废/反作废操作 if (IsAudit == 0) //作废提交 { //作废提交 if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 异常反馈处理单 #region 异常反馈处理单 新增/编辑 [Route("Sc_MESTransFerWorkBill/SaveOA_ErrMsgBackHandleBill")] [HttpPost] public object SaveOA_ErrMsgBackHandleBill([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 msg3 = sArray[1].ToString(); //子表 string refSav = sArray[1].ToString();//操作方式数据类型 1添加 3修改 2 复制 string msg4 = sArray[2].ToString();//用户名 DBUtility.ClsPub.CurUserName = msg4; string UserName = ""; string s = ""; ListModels oListModels = new ListModels(); try { //编辑权限 if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackHandleBillMain_Edit", 1, false, msg4)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无保存权限!"; objJsonResult.data = null; return objJsonResult; } // OA_ErrMsgBackHandleBill DAL.ClsOA_ErrMsgBackHandleBill oBill = new DAL.ClsOA_ErrMsgBackHandleBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_OA_ErrMsgBackHandleBill(msg2); foreach (Model.ClsOA_ErrMsgBackHandleBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (oBill.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } UserName = oItem.HMaker; //制单人 oItem.HBillType = "4531"; oItem.HBillSubType = "4531"; 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.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //保存 //保存完毕后处理 bool bResult; if (refSav == "Add") { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); _ = SendDingDingAsync(oBill.omodel.HSendMan, 2, oBill.omodel.HDescription, oBill.omodel.HReceiveMan); } else if (refSav == "Update") { bResult = oBill.ModifyBill(oBill.omodel.HInterID, 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.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region 异常反馈处理单 编辑回显列表 [Route("Sc_MESTransFerWorkBill/Edit_OA_ErrMsgBackHandleBill")] [HttpGet] public object Edit_OA_ErrMsgBackHandleBill(string HID) { try { List columnNameList = new List(); string sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList where hmainid='" + HID + "'"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillMainList"); //添加列名 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_OA_ErrMsgBackHandleBillList")] [HttpGet] public object Get_OA_ErrMsgBackHandleBillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackHandleBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillMainList"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackHandleBillMainList where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillMainList"); } //添加列名 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 异常反馈处理单列表PDA [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackHandleBillList_PDA")] [HttpGet] public object Get_OA_ErrMsgBackHandleBillList_PDA(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackHandleBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillList_PDA"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillList_PDA"); } //添加列名 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/DeleteOA_ErrMsgBackHandleBill")] [HttpGet] public object DeleteOA_ErrMsgBackHandleBill(string HInterID, string user) { try { string s = ""; DAL.ClsOA_ErrMsgBackHandleBill BillOld = new DAL.ClsOA_ErrMsgBackHandleBill(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackHandleBillMain_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无删除权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID不能为空!"; objJsonResult.data = null; return objJsonResult; } if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可删除 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许删除!"; objJsonResult.data = 1; return objJsonResult; } //删除前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackHandleBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackHandleBill_BeforeDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //================================================================================== oCN.BeginTran(); oCN.RunProc("delete from OA_ErrMsgBackHandleBillMain where HInterID = " + HInterID); oCN.RunProc("delete from OA_ErrMsgBackHandleBillSub where HInterID= " + HInterID); //删除后控制================================================================================== string sql2 = "exec h_p_OA_ErrMsgBackHandleBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql2, "h_p_OA_ErrMsgBackHandleBill_AfterDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { s = "删除后判断失败,请与网络管理人员联系"; objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { s = ds.Tables[0].Rows[0]["HRemark"].ToString(); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //============================================================================================== oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "删除成功"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈处理单 审核/反审核 /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MESTransFerWorkBill/AuditOA_ErrMsgBackHandleBill")] [HttpGet] public object AuditOA_ErrMsgBackHandleBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackHandleBillMain_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackHandleBill oBill = new DAL.ClsOA_ErrMsgBackHandleBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 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; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.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; } //进行需要进行的审核/反审核操作 if (IsAudit == 0) //审核提交 { oCN.BeginTran(); //记录返回信息 string msg = ""; //审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackHandleBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackHandleBill_BeforeCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //================================================================================== //审核提交 if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackHandleBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功!" + msg; objJsonResult.data = null; return objJsonResult; } else { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackHandleBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackHandleBill_BeforeUnCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //=========================================================== //反审核提交AbandonCheck if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackHandleBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈处理单 关闭/反关闭 /// /// /// 单据ID /// 关闭(0),反关闭(1) /// 关闭人 /// [Route("Sc_MESTransFerWorkBill/CloseOA_ErrMsgBackHandleBill")] [HttpGet] public object CloseOA_ErrMsgBackHandleBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackHandleBillMain_Close"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackHandleBill oBill = new DAL.ClsOA_ErrMsgBackHandleBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //关闭判断 { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次关闭!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭判断 { if (oBill.omodel.HCloseMan.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; } //进行需要进行的关闭/反关闭操作 if (IsAudit == 0) //关闭提交 { //关闭提交 if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈处理单 作废/反作废 /// /// /// 单据ID /// 作废(0),反作废(1) /// 作废人 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackHandleBill")] [HttpGet] public object DeleteOA_ErrMsgBackHandleBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackHandleBillMain_Drop"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackHandleBill oBill = new DAL.ClsOA_ErrMsgBackHandleBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能进行作废!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //作废判断 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再作废!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反作废判断 { 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; } //进行需要进行的作废/反作废操作 if (IsAudit == 0) //作废提交 { //作废提交 if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 异常反馈验收单 #region 异常反馈验收单 新增/编辑 [Route("Sc_MESTransFerWorkBill/SaveOA_ErrMsgBackCheckBill")] [HttpPost] public object SaveOA_ErrMsgBackCheckBill([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 msg3 = sArray[1].ToString(); //子表 string refSav = sArray[1].ToString();//操作方式数据类型 1添加 3修改 2 复制 string msg4 = sArray[2].ToString();//用户名 DBUtility.ClsPub.CurUserName = msg4; string UserName = ""; string s = ""; ListModels oListModels = new ListModels(); try { //编辑权限 if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackCheckBillMain_Edit", 1, false, msg4)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无保存权限!"; objJsonResult.data = null; return objJsonResult; } // OA_ErrMsgBackCheckBill DAL.ClsOA_ErrMsgBackCheckBill oBill = new DAL.ClsOA_ErrMsgBackCheckBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_OA_ErrMsgBackCheckBill(msg2); foreach (Model.ClsOA_ErrMsgBackCheckBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (oBill.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (oBill.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } UserName = oItem.HMaker; //制单人 oItem.HBillType = "4532"; oItem.HBillSubType = "4532"; 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.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //保存 //保存完毕后验收 bool bResult; if (refSav == "Add") { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); _ = SendDingDingAsync(oBill.omodel.HReceiveMan, 0, oBill.omodel.HDescription, oBill.omodel.HCopyMan); } else if (refSav == "Update") { bResult = oBill.ModifyBill(oBill.omodel.HInterID, 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.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region 异常反馈验收单 编辑回显列表 [Route("Sc_MESTransFerWorkBill/Edit_OA_ErrMsgBackCheckBill")] [HttpGet] public object Edit_OA_ErrMsgBackCheckBill(string HID) { try { List columnNameList = new List(); string sql = "select * from h_v_OA_ErrMsgBackCheckBillMainList where hmainid='" + HID + "'"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillMainList"); //添加列名 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_OA_ErrMsgBackCheckBillList")] [HttpGet] public object Get_OA_ErrMsgBackCheckBillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackCheckBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackCheckBillMainList order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillMainList"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackCheckBillMainList where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillMainList"); } //添加列名 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 异常反馈验收单列表PDA [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackCheckBillList_PDA")] [HttpGet] public object Get_OA_ErrMsgBackCheckBillList_PDA(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackCheckBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_ErrMsgBackCheckBillList_PDA order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillList_PDA"); } else { string sql1 = "select * from h_v_OA_ErrMsgBackCheckBillList_PDA where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillList_PDA"); } //添加列名 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/DeleteOA_ErrMsgBackCheckBill")] [HttpGet] public object DeleteOA_ErrMsgBackCheckBill(string HInterID, string user) { try { string s = ""; DAL.ClsOA_ErrMsgBackCheckBill BillOld = new DAL.ClsOA_ErrMsgBackCheckBill(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackCheckBillMain_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无删除权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID不能为空!"; objJsonResult.data = null; return objJsonResult; } if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可删除 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许删除!"; objJsonResult.data = 1; return objJsonResult; } //删除前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackCheckBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackCheckBill_BeforeDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //================================================================================== oCN.BeginTran(); oCN.RunProc("delete from OA_ErrMsgBackCheckBillMain where HInterID = " + HInterID); oCN.RunProc("delete from OA_ErrMsgBackCheckBillSub where HInterID= " + HInterID); //删除后控制================================================================================== string sql2 = "exec h_p_OA_ErrMsgBackCheckBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql2, "h_p_OA_ErrMsgBackCheckBill_AfterDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { s = "删除后判断失败,请与网络管理人员联系"; objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { s = ds.Tables[0].Rows[0]["HRemark"].ToString(); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //============================================================================================== oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "删除成功"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈验收单 审核/反审核 /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MESTransFerWorkBill/AuditOA_ErrMsgBackCheckBill")] [HttpGet] public object AuditOA_ErrMsgBackCheckBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackCheckBillMain_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackCheckBill oBill = new DAL.ClsOA_ErrMsgBackCheckBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 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; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.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; } //进行需要进行的审核/反审核操作 if (IsAudit == 0) //审核提交 { oCN.BeginTran(); //记录返回信息 string msg = ""; //审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackCheckBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackCheckBill_BeforeCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //================================================================================== //审核提交 if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackCheckBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功!" + msg; objJsonResult.data = null; return objJsonResult; } else { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核前控制========================================= string sql1 = "exec h_p_OA_ErrMsgBackCheckBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_ErrMsgBackCheckBill_BeforeUnCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //=========================================================== //反审核提交AbandonCheck if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_ErrMsgBackCheckBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈验收单 关闭/反关闭 /// /// /// 单据ID /// 关闭(0),反关闭(1) /// 关闭人 /// [Route("Sc_MESTransFerWorkBill/CloseOA_ErrMsgBackCheckBill")] [HttpGet] public object CloseOA_ErrMsgBackCheckBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackCheckBillMain_Close"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackCheckBill oBill = new DAL.ClsOA_ErrMsgBackCheckBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //关闭判断 { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次关闭!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭判断 { if (oBill.omodel.HCloseMan.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; } //进行需要进行的关闭/反关闭操作 if (IsAudit == 0) //关闭提交 { //关闭提交 if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常反馈验收单 作废/反作废 /// /// /// 单据ID /// 作废(0),反作废(1) /// 作废人 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackCheckBill")] [HttpGet] public object DeleteOA_ErrMsgBackCheckBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_ErrMsgBackCheckBillMain_Drop"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_ErrMsgBackCheckBill oBill = new DAL.ClsOA_ErrMsgBackCheckBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能进行作废!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //作废判断 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再作废!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反作废判断 { 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; } //进行需要进行的作废/反作废操作 if (IsAudit == 0) //作废提交 { //作废提交 if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 安灯逐级呼叫规则 #region 安灯逐级呼叫规则 新增/编辑 [Route("Sc_MESTransFerWorkBill/SaveOA_AndengFlowRuleBill")] [HttpPost] public object SaveOA_AndengFlowRuleBill([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 msg3 = sArray[1].ToString(); //子表 string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 复制 string msg4 = sArray[3].ToString();//用户名 DBUtility.ClsPub.CurUserName = msg4; string UserName = ""; string s = ""; ListModels oListModels = new ListModels(); try { //编辑权限 if (!DBUtility.ClsPub.Security_Log_second("OA_AndengFlowRuleBillMain_Edit", 1, false, msg4)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无保存权限!"; objJsonResult.data = null; return objJsonResult; } // OA_AndengFlowRuleBill DAL.ClsOA_AndengFlowRuleBill oBill = new DAL.ClsOA_AndengFlowRuleBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_OA_AndengFlowRuleBill(msg2); foreach (Model.ClsOA_AndengFlowRuleBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld1.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (BillOld1.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (BillOld1.omodel.HChecker != "" && oBill.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (BillOld1.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } UserName = oItem.HMaker; //制单人 oItem.HBillType = "4533"; oItem.HBillSubType = "4533"; 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.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } // 表体数据 //按 },{来拆分数组 //去掉【和】 msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n List ls = new List(); ls = oListModels.getObjectByJson_OA_AndengFlowRuleBillSub(msg3); int i = 0; foreach (Model.ClsOA_AndengFlowRuleBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //关闭类型 oBill.DetailColl.Add(oItemSub); } //保存 //保存完毕后处理 bool bResult; if (refSav == "Add") { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else if (refSav == "Update") { bResult = oBill.ModifyBill(oBill.omodel.HInterID, 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.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion #region 安灯逐级呼叫规则 编辑回显列表 [Route("Sc_MESTransFerWorkBill/Edit_OA_AndengFlowRuleBill")] [HttpGet] public object Edit_OA_AndengFlowRuleBill(string HID) { try { List columnNameList = new List(); 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) { 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_OA_AndengFlowRuleBillList")] [HttpGet] public object Get_OA_AndengFlowRuleBillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_AndengFlowRuleBillMain_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_AndengFlowRuleBillMainList order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_AndengFlowRuleBillMainList"); } else { string sql1 = "select * from h_v_OA_AndengFlowRuleBillMainList where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_AndengFlowRuleBillMainList"); } //添加列名 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 安灯逐级呼叫规则 删除 /// ///参数:string HInterID。 ///返回值:object。 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_AndengFlowRuleBill")] [HttpGet] public object DeleteOA_AndengFlowRuleBill(string HInterID, string user) { try { string s = ""; DAL.ClsOA_AndengFlowRuleBill BillOld = new DAL.ClsOA_AndengFlowRuleBill(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_AndengFlowRuleBillMain_Drop", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无删除权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID不能为空!"; objJsonResult.data = null; return objJsonResult; } if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可删除 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许删除!"; objJsonResult.data = 1; return objJsonResult; } //删除前控制========================================= string sql1 = "exec h_p_OA_AndengFlowRuleBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_AndengFlowRuleBill_BeforeDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //================================================================================== oCN.BeginTran(); oCN.RunProc("delete from OA_AndengFlowRuleBillMain where HInterID = " + HInterID); oCN.RunProc("delete from OA_AndengFlowRuleBillSub where HInterID= " + HInterID); //删除后控制================================================================================== string sql2 = "exec h_p_OA_AndengFlowRuleBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql2, "h_p_OA_AndengFlowRuleBill_AfterDelCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { s = "删除后判断失败,请与网络管理人员联系"; objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { s = ds.Tables[0].Rows[0]["HRemark"].ToString(); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除失败!原因:" + s; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //============================================================================================== oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "删除成功"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 安灯逐级呼叫规则 审核/反审核 /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MESTransFerWorkBill/AuditOA_AndengFlowRuleBill")] [HttpGet] public object AuditOA_AndengFlowRuleBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_AndengFlowRuleBillMain_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_AndengFlowRuleBill oBill = new DAL.ClsOA_AndengFlowRuleBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 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; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.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; } //进行需要进行的审核/反审核操作 if (IsAudit == 0) //审核提交 { oCN.BeginTran(); //记录返回信息 string msg = ""; //审核前控制========================================= string sql1 = "exec h_p_OA_AndengFlowRuleBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_AndengFlowRuleBill_BeforeCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; oCN.RollBack(); return objJsonResult; } //================================================================================== //审核提交 if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_AndengFlowRuleBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功!" + msg; objJsonResult.data = null; return objJsonResult; } else { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核前控制========================================= string sql1 = "exec h_p_OA_AndengFlowRuleBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; ds = oCN.RunProcReturn(sql1, "h_p_OA_AndengFlowRuleBill_BeforeUnCheckCtrl"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //=========================================================== //反审核提交AbandonCheck if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_OA_AndengFlowRuleBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 安灯逐级呼叫规则 关闭/反关闭 /// /// /// 单据ID /// 关闭(0),反关闭(1) /// 关闭人 /// [Route("Sc_MESTransFerWorkBill/CloseOA_AndengFlowRuleBill")] [HttpGet] public object CloseOA_AndengFlowRuleBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_AndengFlowRuleBillMain_Close"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_AndengFlowRuleBill oBill = new DAL.ClsOA_AndengFlowRuleBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //关闭判断 { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次关闭!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭判断 { if (oBill.omodel.HCloseMan.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; } //进行需要进行的关闭/反关闭操作 if (IsAudit == 0) //关闭提交 { //关闭提交 if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 安灯逐级呼叫规则 作废/反作废 /// /// /// 单据ID /// 作废(0),反作废(1) /// 作废人 /// [Route("Sc_MESTransFerWorkBill/DeleteOA_AndengFlowRuleBill")] [HttpGet] public object DeleteOA_AndengFlowRuleBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_AndengFlowRuleBillMain_Drop"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_AndengFlowRuleBill oBill = new DAL.ClsOA_AndengFlowRuleBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能进行作废!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //作废判断 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再作废!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反作废判断 { 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; } //进行需要进行的作废/反作废操作 if (IsAudit == 0) //作废提交 { //作废提交 if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #endregion #region 工作联系单 #region 工作联系单保存/编辑 /// /// 工作联系单 /// /// /// [Route("Sc_MESTransFerWorkBill/SaveOA_WorkLinkBill")] [HttpPost] public object SaveOA_WorkLinkBill([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_WorkLinkBill_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 { DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n var jsonString = "[" + msg2.ToString() + "]"; lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject>(jsonString); foreach (Model.ClsOA_WorkLinkBillMain oItem in lsmain) { if (refSav == "Add") { //单据号是否重复 if (BillNew2.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = 1; return objJsonResult; } } if (refSav == "Update") { if (BillOld2.ShowBill(oItem.HInterID, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可编辑 if (BillOld2.omodel.HChecker != "" && BillOld2.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (BillOld2.omodel.HBillStatus > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; objJsonResult.data = 1; return objJsonResult; } if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld2, ref s)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s + ",不允许修改"; objJsonResult.data = 1; return objJsonResult; } } DBUtility.ClsPub.CurUserName = oItem.HMaker; oItem.HBillType = "4501"; oItem.HBillSubType = "4501"; 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.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; objJsonResult.data = 1; return objJsonResult; } //string[] arrStr = oItem.HSendMan.Split(','); //发送人 //arrStr = oItem.HReceiveMan.Split(','); //接收人 string[] arrStr = oItem.HCopyMan.Split(','); //抄送人 if (!string.IsNullOrEmpty(oItem.HCopyMan)) { arrStr = oItem.HCopyMan.Split(','); // 抄送人 List b = new List(arrStr); b.Add(oItem.HReceiveMan); arrStr = b.ToArray(); } else { arrStr = oItem.HReceiveMan.Split(',');//接收人 } //抄送人表体数据 for (int i = 1; i <= arrStr.Length; i++) { Model.ClsOA_WorkLinkBillSub2 sb = new Model.ClsOA_WorkLinkBillSub2(); 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; } //保存 //保存完毕后处理 bool bResult; if (refSav == "Add") { bResult = oBill.AddBillNew(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBillNew(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } 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/GetOA_WorkLinkBillList")] [HttpGet] public object GetOA_WorkLinkBillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_WorkLinkBillList", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { string sql = "select * from h_v_OA_WorkLinkBillAllList order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList"); } else { string sql1 = "select * from h_v_OA_WorkLinkBillAllList where 1 = 1 "; string sql = sql1 + sWhere + " order by 单据号 desc"; ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList"); } //添加列名 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/GetOA_WorkLinkBillListCheckDetai")] [HttpGet] public object GetOA_WorkLinkBillListCheckDetai(string HID) { try { List columnNameList = new List(); 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.HInterID='" + HID + "'" ); ; 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 #region[更改工作联系单阅读状态] [Route("Sc_MESTransFerWorkBill/UpdateOA_WorkLinkBillFlagMessage")] [HttpGet] public object UpdateOA_WorkLinkBillFlagMessage(string HInterID, string HEntryID) { oCN.BeginTran(); oCN.RunProc("Update OA_WorkLinkBillSub2 set HReadFlag=1 where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'", ref ClsPub.sExeReturnInfo); oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; ; } #endregion #region 工作联系单删除 /// ///删除功能 /// /// [Route("Sc_MESTransFerWorkBill/DeltetOA_WorkLinkBill")] [HttpGet] public object DeltetOA_WorkLinkBill(string HInterID, string user) { try { string s = ""; DAL.ClsOA_WorkLinkBill BillOld = new DAL.ClsOA_WorkLinkBill(); //查看权限 if (!DBUtility.ClsPub.Security_Log("OA_WorkLinkBill_Delete", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无删除权限!"; objJsonResult.data = null; return objJsonResult; } if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "HInterID不能为空!"; objJsonResult.data = null; return objJsonResult; } if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据有误!"; objJsonResult.data = 1; return objJsonResult; } //判断是否可删除 if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "此单据已经被审核,不允许删除!"; objJsonResult.data = 1; return objJsonResult; } oCN.BeginTran(); oCN.RunProc("Delete From OA_WorkLinkBillMain where HInterID = " + HInterID); oCN.RunProc("Delete From OA_WorkLinkBillSub2 where HInterID = " + HInterID); oCN.RunProc("Delete From OA_WorkLinkBillSub where HInterID = " + HInterID); oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "删除成功!"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 工作联系单 审核/反审核 /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Sc_MESTransFerWorkBill/AuditOA_WorkLinkBill")] [HttpGet] public object AuditOA_WorkLinkBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_WorkLinkBill_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对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; } if (IsAudit == 0) //审核判断 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (oBill.omodel.HChecker.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; } oCN.BeginTran(); //进行需要进行的审核/反审核操作 if (IsAudit == 0) //审核提交 { //审核单据 if (!oBill.CheckBill(HInterID, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核提交 { //反审核单据 if (!oBill.AbandonCheck(HInterID, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } oCN.Commit();//提交事务 objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "执行成功!"; objJsonResult.data = null; return objJsonResult; ; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 工作联系单 关闭/反关闭 /// /// /// 单据ID /// 关闭(0),反关闭(1) /// 关闭人 /// [Route("Sc_MESTransFerWorkBill/CloseOA_WorkLinkBill")] [HttpGet] public object CloseOA_WorkLinkBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_WorkLinkBill_Close"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不能进行关闭!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //关闭判断 { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭!不能再次关闭!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭判断 { if (oBill.omodel.HCloseMan.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; } //进行需要进行的关闭/反关闭操作 if (IsAudit == 0) //关闭提交 { //关闭提交 if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反关闭成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 工作联系单 作废/反作废 /// /// /// 单据ID /// 作废(0),反作废(1) /// 作废人 /// [Route("Sc_MESTransFerWorkBill/DropOA_WorkLinkBill")] [HttpGet] public object DropOA_WorkLinkBill(int HInterID, int IsAudit, string CurUserName) { string ModRightNameCheck = "OA_WorkLinkBill_Delete"; DBUtility.ClsPub.CurUserName = CurUserName; try { //检查权限 if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 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); //对HInterID进行类型的转换 DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); //实例化单据操作类,用于进行相关操作 //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能进行作废!"; objJsonResult.data = null; return objJsonResult; } if (IsAudit == 0) //作废判断 { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废!不能再作废!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反作废判断 { 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; } //进行需要进行的作废/反作废操作 if (IsAudit == 0) //作废提交 { //作废提交 if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反关闭提交 { //反关闭提交 if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反作废成功"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 工作联系单回复 /// /// 工作联系单 /// /// /// [Route("Sc_MESTransFerWorkBill/ReplyOA_WorkLinkBill")] [HttpPost] public object ReplyOA_WorkLinkBill([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_WorkLinkBill_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 { DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill(); List lsmain = new List(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n var jsonString = "[" + msg2.ToString() + "]"; lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject>(jsonString); //保存 //保存完毕后处理 if (lsmain[0].HInterID != 0) { oCN.BeginTran(); DataSet Ds = oCN.RunProcReturn("select count(HInterID) as num from OA_WorkLinkBillSub where HInterID = " + lsmain[0].HInterID + " group by HInterID ", "OA_WorkLinkBillSub"); Int64 num = 0; if (Ds.Tables[0].Rows.Count == 0) { num = 1; } else { num = Convert.ToInt64(Ds.Tables[0].Rows[0]["num"]) + 1; } //主表 oCN.RunProc("Insert Into OA_WorkLinkBillSub " + "(HInterID,HEntryID,HRemark,HSendStatus,HSendMan" + ",HDescription,HDate" + ",HCloseMan,HEntryCloseDate,HCloseType,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ") " + " values(" + lsmain[0].HInterID + "," + num + ",'" + lsmain[0].HRemark + "'," + 1 + ",'" + lsmain[0].HSendMan + "'" + ",'" + lsmain[0].HDescription + "','" + lsmain[0].HDate + "','" + lsmain[0].HCloseMan + "','" + "" + "'" + "," + 0 + "," + lsmain[0].HSourceInterID + "," + lsmain[0].HSourceEntryID + ",'" + lsmain[0].HSourceBillNo + "'" + ",'" + lsmain[0].HSourceBillType + "'," + lsmain[0].HRelationQty + "," + lsmain[0].HRelationMoney + ") "); oCN.Commit(); 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/GetOA_WorkLinkBillSub")] [HttpGet] public object GetOA_WorkLinkBillSub(string HInterID, string user) { try { string sql = "select * from OA_WorkLinkBillSub where HInterID = '" + HInterID + "'order by HDate desc"; ds = oCN.RunProcReturn(sql, "OA_WorkLinkBillSub"); 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/UpdateOA_WorkLinkBillSubStatus")] [HttpGet] public object UpdateOA_WorkLinkBillSubStatus(Int64 HInterID, string HEntryID, Int64 Type) { try { string sql = ""; switch (Type) { case 9: sql = "update OA_WorkLinkBillSub set HSendStatus = 9 where HInterID = " + HInterID + " and HEntryID in (" + HEntryID + ")"; break; case 10: sql = "update OA_WorkLinkBillSub 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 #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 columnNameList = new List(); 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 异常反馈 接收,处理,验收单保存发送消息 /// /// 异常反馈 接收,处理,验收单保存发送消息 /// /// /// /// /// /// public async Task 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 HNames = new List(); 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 HNames = new List(); 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 HNames = new List(); 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 HNames = new List(); 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 user) { try { List columnNameList = new List(); ds = oCN.RunProcReturn("exec h_p_OA_ErrMsgBackSelfQuery " + 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));//获取到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 columnNameList = new List(); 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 columnNameList = new List(); 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 columnNameList = new List(); //根据当前人获取职务 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 columnNameList = new List(); 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 columnNameList = new List(); 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 columnNameList = new List(); 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 } }