| | |
| | | using System.Data; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using Newtonsoft.Json; |
| | | |
| | | namespace WebAPI.Controllers |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> a = new List<object>(); |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | a.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = a; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | #endregion |
| | | |
| | | #region 查询列表方法 |
| | | |
| | | /// <summary> |
| | | /// 返回检验方案单列表 仅包含主表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("QC_Management/MES_QC_CheckProjectList_Json_Main")] |
| | | [HttpGet] |
| | | public object MES_QC_CheckProjectList_Json_Main(string sWhere, string user) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | //判断权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查询权限"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_QCCheckProjectList_Main order by 日期 desc ", "h_v_Gy_QCCheckProjectList_Main"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Gy_QCCheckProjectList_Main where 1=1"; |
| | | string sql = sql1 + sWhere + " order by 日期 desc "; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList_Main"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 返回检验方案单列表 |
| | | /// </summary> |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_QCCheckProjectList order by hmainid desc ", "h_v_Gy_QCCheckProjectList"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_QCCheckProjectList order by 日期 desc ", "h_v_Gy_QCCheckProjectList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Gy_QCCheckProjectList where 1=1"; |
| | | string sql = sql1 + sWhere+ " order by hmainid desc "; |
| | | string sql = sql1 + sWhere+ " order by 日期 desc "; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList"); |
| | | } |
| | | } |
| | |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 关闭人='' "; |
| | | string sql = sql1 + sqlWhere+ " order by hmainid desc "; |
| | | string sql = sql1 + sqlWhere+ " order by 制单日期 desc "; |
| | | ds = oCN.RunProcReturn(sql, "h_v_QC_PatrolProcCheckBillList"); |
| | | } |
| | | } |
| | |
| | | return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" }; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_QCCheckProjectList_NEW where hmainid= " + HID + " ", "h_v_Gy_QCCheckProjectList_NEW"); |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_QCCheckProjectList_Edit where hmainid= " + HID + " ", "h_v_Gy_QCCheckProjectList_Edit"); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "不存在生产汇报单号" }; |
| | | return new ApiResult<DataSet> { code = -1, msg = "不存在检验方案" }; |
| | | |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | #endregion |
| | | |
| | | #region 检验方案查询 |
| | | [Route("QC_Management/MES_QC_CheckProjectListProjectDetaiList")] |
| | | [HttpGet] |
| | | public object MES_QC_CheckProjectListProjectDetaiList(string sWhere,string user) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn(string.Format(@"select * from h_v_Gy_QCCheckProjectList_Edit where 1=1 " + sWhere), "h_v_Gy_QCCheckProjectList_Edit"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn(string.Format(@"select 次序号 HPrjNo,检验项目ID HQCCheckItemID,检验项目代码 HQCCheckItemNumber,检验项目 HQCCheckItemName, |
| | | 检验标准 HQCStd,最大检验标准 HQCStdMax,检验单位 HQCUnit,表体备注 HRemark from h_v_Gy_QCCheckProjectList_NEW |
| | | where hinterid='"+HInterID+"'"), "h_v_Gy_QCCheckProjectList_NEW"); |
| | | ds = oCN.RunProcReturn(string.Format(@"select * from h_v_Gy_QCCheckProjectList_Edit where hinterid='" + HInterID+"'"), "h_v_Gy_QCCheckProjectList_Edit"); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | oItem.HBillStatus = 0; |
| | | oItem.HPeriod = 0; |
| | | oItem.HMaker = ""; |
| | | oItem.HStandard = false; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | |
| | | oItemSub.HRelationQty = 0; |
| | | oItemSub.HRelationMoney = 0; |
| | | oItemSub.HCloseMan = ""; |
| | | oItemSub.HDestructInspect = Convert.ToInt32(oItemSub.HDestructInspect); |
| | | oItemSub.HKeyInspect = Convert.ToInt32(oItemSub.HKeyInspect); |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | |
| | | [HttpGet] |
| | | public object DeltetQCCheckProject(string HInterID,string UserName) |
| | | { |
| | | |
| | | DataSet ds; |
| | | DBUtility.ClsPub.CurUserName = UserName; |
| | | //编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Delete", 1, false, DBUtility.ClsPub.CurUserName)) |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Gy_QCCheckProject_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + UserName + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_QCCheckProject_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | | 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; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //删除单据(包含删除后控制、写入日志) |
| | | if (!oBill.DeleteBill(BillOld.omodel.HInterID, BillOld.omodel.HBillNo, "h_p_Gy_QCCheckProject_AfterDelCtrl", UserName, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //if (IsDete) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // 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.Message = "单据未找到"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | DataSet ds; |
| | | //string ModRightNameCheck = "Sc_ProcessReport_check"; |
| | | #region 检验方案审核/反审核 |
| | | [Route("Gy_QCCheckProject/AuditGy_QCCheckProject")] |
| | | [HttpGet] |
| | | public object AuditGy_QCCheckProject(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //删除权限 |
| | | //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "审核失败!无权限!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DAL.ClsGy_QCCheckProjectMain oBill = new DAL.ClsGy_QCCheckProjectMain(); |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | ds = oCN.RunProcReturn("select * from Gy_QCCheckProjectMain where HInterID=" + HInterID, "Gy_QCCheckProjectMain"); |
| | | DataSet ds2 = oCN.RunProcReturn("select * from Gy_QCCheckProjectSub where HInterID=" + HInterID, "Gy_QCCheckProjectSub"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2==null || ds2.Tables[0].Rows.Count == 0) |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有这个单据,无法删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | string sql = "select * from Gy_QCCheckProjectMain where HInterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, oBill.MvarItemKey); |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Gy_QCCheckProject_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_QCCheckProject_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_Gy_QCCheckProject_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = " 审核成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | int HBillStatus = Convert.ToInt32(ds.Tables[0].Rows[0]["HBillStatus"]); |
| | | int HPrjNo= Convert.ToInt32(ds2.Tables[0].Rows[0]["HPrjNo"]); |
| | | if (HBillStatus < 0 || HPrjNo<0) |
| | | |
| | | else |
| | | { |
| | | oCN.RollBack();//回滚事务 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已删除无法再次删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from Gy_QCCheckProjectMain where HInterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, oBill.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Gy_QCCheckProject_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_QCCheckProject_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_Gy_QCCheckProject_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = " 反审核成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.RunProc("update Gy_QCCheckProjectMain set HBillStatus=-1 where HInterID="+HInterID); |
| | | oCN.RunProc("update Gy_QCCheckProjectSub set HPrjNo=-1 where HInterID=" + HInterID); |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "* 单据删除成功!"; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!" + e.ToString(); |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 检验方案 作废/反作废 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">作废(0),反作废(1)</param> |
| | | /// <param name="CurUserName">作废人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MESTransFerWorkBill/DeleteGy_QCCheckProject")] |
| | | [HttpGet] |
| | | public object DeleteGy_QCCheckProject(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Gy_QCCheckProject_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.ClsGy_QCCheckProjectMain oBill = new DAL.ClsGy_QCCheckProjectMain(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | 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) //作废提交 |
| | | { |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Gy_QCCheckProject_BeforeDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_QCCheckProject_BeforeDropCtrl"); |
| | | 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.Cancelltion(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Gy_QCCheckProject_AfterDropCtrl", 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; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反作废提交 |
| | | { |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Gy_QCCheckProject_BeforeUnDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_QCCheckProject_BeforeUnDropCtrl"); |
| | | 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; |
| | | } |
| | | //=========================================================== |
| | | |
| | | //反作废提交 |
| | | if (oBill.AbandonCancelltion(lngBillKey, oBill.omodel.HBillNo, "h_p_Gy_QCCheckProject_AfterUnDropCtrl", 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) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |