|  |  | 
 |  |  | 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> | 
 |  |  | 
 |  |  |                 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"); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  | 
 |  |  |         [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; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             DataSet ds; | 
 |  |  |             //string ModRightNameCheck = "Sc_ProcessReport_check"; | 
 |  |  |             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 (string.IsNullOrWhiteSpace(HInterID)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "HInterID为空!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 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) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     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) | 
 |  |  |                 { | 
 |  |  |                     oCN.RollBack();//回滚事务 | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     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.data = null; | 
 |  |  |                 return objJsonResult; ; | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "删除失败!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             }            | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //审核单据 | 
 |  |  |                     if (!oBill.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
 |  |  |                     //审核前控制=========================================       | 
 |  |  |                     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; ; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //反审核单据 | 
 |  |  |                         if (!oBill.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
 |  |  |                         //反审核前控制=========================================         | 
 |  |  |                         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; ; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #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; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 来料检验 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 保存来料检验单 |