|  |  |  | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | using System.Data; | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using Pub_Class; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | namespace WebAPI.Controllers | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public class QC_ManagementController : ApiController | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | public DAL.ClsQC_PatrolProcCheckBill BillOld = new DAL.ClsQC_PatrolProcCheckBill(); | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 错误返回方法 | 
|---|
|  |  |  | // GET: QC_Management | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "获取信息成功!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //if (ds.Tables[0].Rows.Count != 0 || ds != null) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //objJsonResult.code = "0"; | 
|---|
|  |  |  | //objJsonResult.count = 0; | 
|---|
|  |  |  | //objJsonResult.Message = "无数据"; | 
|---|
|  |  |  | //objJsonResult.data = null; | 
|---|
|  |  |  | //return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("QC_Management/MES_QC_CheckProjectList_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_QC_CheckProjectList_Json(string sqlWhere) | 
|---|
|  |  |  | public object MES_QC_CheckProjectList_Json(string sWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sqlWhere == null || sqlWhere.Equals("")) | 
|---|
|  |  |  | //判断权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_Gy_QCCheckProjectList where HBillStatus>-1 ", "h_v_Gy_QCCheckProjectList"); | 
|---|
|  |  |  | 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 order by 日期 desc ", "h_v_Gy_QCCheckProjectList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_Gy_QCCheckProjectList where HBillStatus>-1 "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere; | 
|---|
|  |  |  | string sql1 = "select * from h_v_Gy_QCCheckProjectList where 1=1"; | 
|---|
|  |  |  | string sql = sql1 + sWhere+ " order by 日期 desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_QC_POStockInCheckBillList where 1 = 1 "; | 
|---|
|  |  |  | string sql1 = "select * from h_v_QC_POStockInCheckBillList where 关闭人='' "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_QC_POStockInCheckBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("QC_Management/MES_QC_FirstPieceCheckBillList_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_QC_FirstPieceCheckBillList_Json(string sqlWhere) | 
|---|
|  |  |  | public object MES_QC_FirstPieceCheckBillList_Json(string sqlWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //查看权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无查看权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sqlWhere == null || sqlWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_QC_FirstPieceCheckBillList ", "h_v_QC_FirstPieceCheckBillList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_QC_FirstPieceCheckBillList  where  关闭人='' order by hmainid desc ", "h_v_QC_FirstPieceCheckBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_QC_FirstPieceCheckBillList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere; | 
|---|
|  |  |  | string sql1 = "select * from h_v_QC_FirstPieceCheckBillList where 关闭人='' "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere+ " order by hmainid desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("QC_Management/MES_QC_PatrolProcCheckBillList_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_QC_PatrolProcCheckBillList_Json(string sqlWhere) | 
|---|
|  |  |  | public object MES_QC_PatrolProcCheckBillList_Json(string sqlWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //查看权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_PatrolProcCheckBill_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无查看权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sqlWhere == null || sqlWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_QC_PatrolProcCheckBillList ", "h_v_QC_PatrolProcCheckBillList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_QC_PatrolProcCheckBillList where  关闭人='' order by hmainid desc ", "h_v_QC_PatrolProcCheckBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere; | 
|---|
|  |  |  | string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 关闭人='' "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere+ " order by hmainid desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_QC_PatrolProcCheckBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return GetObjectJson(ds); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 巡检记录单 审核 反审核 关闭 反关闭 作废 反作废 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 巡检记录单 审核、反审核 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="HInterID">单据ID</param> | 
|---|
|  |  |  | /// <param name="IsAudit">审核(0),反审核(1)</param> | 
|---|
|  |  |  | /// <param name="CurUserName">审核人</param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("QC_Management/QC_PatrolProcCheckBillMainValue")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object QC_PatrolProcCheckBillMainValue(int HInterID, int IsAudit, string CurUserName) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //审核权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log_second("QC_PatrolProcCheckBill_Check", 1, false, CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!无权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var ds = oCN.RunProcReturn("select * from QC_PatrolProcCheckBillMain where HInterID=" + HInterID, "QC_PatrolProcCheckBillMain"); | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (IsAudit == 0)  //审核判断 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已审核!不能再次审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (IsAudit == 1) //反审核判断 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据未审核!不需要反审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据不存在!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (IsAudit == 0)  //审核判断 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //审核前控制 | 
|---|
|  |  |  | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_QC_PatrolProcCheckBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + CurUserName + "'", "h_p_QC_PatrolProcCheckBill_BeforeCheckCtrl "); | 
|---|
|  |  |  | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核前判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("update QC_PatrolProcCheckBillMain set HChecker='" + CurUserName + "',HCheckDate=getdate() where HInterID=" + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //审核后控制 | 
|---|
|  |  |  | DataSet EndDs = oCN.RunProcReturn("Exec h_p_QC_PatrolProcCheckBill_AfterCheckCtrl  " + HInterID.ToString() + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + CurUserName + "'", "h_p_QC_PatrolProcCheckBill_AfterCheckCtrl"); | 
|---|
|  |  |  | if (EndDs == null || EndDs.Tables.Count == 0 || EndDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核后判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(EndDs.Tables[0].Rows[0]["HBack"]) == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(EndDs.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "审核成功"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (IsAudit == 1) //反审核判断 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //反审核前控制 | 
|---|
|  |  |  | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_QC_PatrolProcCheckBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + CurUserName + "'", "h_p_QC_PatrolProcCheckBill_BeforeUnCheckCtrl"); | 
|---|
|  |  |  | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "反审核前判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "反审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("update QC_PatrolProcCheckBillMain set HChecker='',HCheckDate=null where HInterID=" + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //反审核后控制 | 
|---|
|  |  |  | DataSet EndDs = oCN.RunProcReturn("Exec  h_p_QC_PatrolProcCheckBill_AfterUnCheckCtrl  " + HInterID.ToString() + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + CurUserName + "'", " h_p_QC_PatrolProcCheckBill_AfterUnCheckCtrl"); | 
|---|
|  |  |  | if (EndDs == null || EndDs.Tables.Count == 0 || EndDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "反审核后判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(EndDs.Tables[0].Rows[0]["HBack"]) == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "反审核失败!" + DBUtility.ClsPub.isStrNull(EndDs.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "反审核成功"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 巡检记录单 关闭 反关闭 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="HInterID"></param> | 
|---|
|  |  |  | /// <param name="Type"></param> | 
|---|
|  |  |  | /// <param name="user"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("QC_Management/CloseQC_PatrolProcCheckBillMain")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object CloseQC_PatrolProcCheckBillMain(string HInterID, int Type, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有删除权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_PatrolProcCheckBill_Close", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限关闭!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (string.IsNullOrWhiteSpace(HInterID)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "HInterID为空!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ClsPub.CurUserName = user; | 
|---|
|  |  |  | BillOld.MvarItemKey = "QC_PatrolProcCheckBillMain"; | 
|---|
|  |  |  | oCN.BeginTran();//开始事务 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //Type 1 关闭  2  反关闭 | 
|---|
|  |  |  | if (Type == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断单据是否已经关闭 | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据不存在!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已作废!不能进行关闭!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已关闭!不能再次关闭!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //关闭单据 | 
|---|
|  |  |  | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断单据是否已经反关闭 | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); | 
|---|
|  |  |  | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已作废!不能进行关闭!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据未关闭!不需要再反关闭!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //反关闭单据 | 
|---|
|  |  |  | if (!BillOld.CancelClose(Int64.Parse(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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 巡检记录单 作废 反作废 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="HInterID"></param> | 
|---|
|  |  |  | /// <param name="Type"></param> | 
|---|
|  |  |  | /// <param name="user"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("QC_Management/DropQC_PatrolProcCheckBillMain")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DropQC_PatrolProcCheckBillMain(string HInterID, int Type, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有作废权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_PatrolProcCheckBill_Drop", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限作废!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (string.IsNullOrWhiteSpace(HInterID)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "HInterID为空!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ClsPub.CurUserName = user; | 
|---|
|  |  |  | BillOld.MvarItemKey = "QC_PatrolProcCheckBillMain"; | 
|---|
|  |  |  | oCN.BeginTran();//开始事务 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //Type 1 作废  2  反作废 | 
|---|
|  |  |  | if (Type == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断单据是否已经作废 | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据不存在!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已作废!不需要再作废!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //作废单据 | 
|---|
|  |  |  | if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断单据是否已经反作废 | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, BillOld.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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据未作废!不需要再反作废!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //反作废单据 | 
|---|
|  |  |  | if (!BillOld.AbandonCancelltion(Int64.Parse(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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 保存/编辑/删除方法 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region  检验方案编辑时获取表头数据 | 
|---|
|  |  |  | [Route("QC_Management/MES_QC_CheckProjectListCheckDetai")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public ApiResult<DataSet> MES_QC_CheckProjectListCheckDetai(string HID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (string.IsNullOrEmpty(HID)) | 
|---|
|  |  |  | 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_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 = "查询成功", data = dataSet }; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 检验方案编辑时获取表体数据 | 
|---|
|  |  |  | [Route("QC_Management/MES_QC_CheckProjectListProjectDetai")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_QC_CheckProjectListProjectDetai(string HInterID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | 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]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 检验方案保存 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 保存检验方案 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveQCCheckProjectList")] | 
|---|
|  |  |  | [Route("QC_Management/SaveQCCheckProjectList")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveQCCheckProjectList([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString(); | 
|---|
|  |  |  | string user = sArray[2].ToString();//用户名 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无编辑权限"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string UserName = ""; | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //oItem.HMaker = ""; | 
|---|
|  |  |  | UserName = oItem.HMaker; | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = UserName; | 
|---|
|  |  |  | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | oItem.HBillType = "3302"; | 
|---|
|  |  |  | oItem.HBillSubType = "3302"; | 
|---|
|  |  |  | oItem.HBillType = "3320"; | 
|---|
|  |  |  | oItem.HBillSubType = "3320"; | 
|---|
|  |  |  | oItem.HBillStatus = 0; | 
|---|
|  |  |  | oItem.HPeriod = 0; | 
|---|
|  |  |  | oItem.HMaker = ""; | 
|---|
|  |  |  | oItem.HStandard = false; | 
|---|
|  |  |  | oItem.HMainSourceInterID = oItem.HInterID; | 
|---|
|  |  |  | oItem.HMaterTypeID = 0; | 
|---|
|  |  |  | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | oItemSub.HSourceEntryID =0; | 
|---|
|  |  |  | oItemSub.HSourceInterID =0; | 
|---|
|  |  |  | oItemSub.HEntryID = i; | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = Convert.ToDateTime(""); | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HCloseType = false; | 
|---|
|  |  |  | oItemSub.HSourceBillNo = ""; | 
|---|
|  |  |  | oItemSub.HSourceBillType = ""; | 
|---|
|  |  |  | oItemSub.HRelationQty = 0; | 
|---|
|  |  |  | oItemSub.HRelationMoney = 0; | 
|---|
|  |  |  | oItemSub.HCloseMan = ""; | 
|---|
|  |  |  | oItemSub.HRemark = ""; | 
|---|
|  |  |  | oItemSub.HDestructInspect = Convert.ToInt32(oItemSub.HDestructInspect); | 
|---|
|  |  |  | oItemSub.HKeyInspect = Convert.ToInt32(oItemSub.HKeyInspect); | 
|---|
|  |  |  | oBill.DetailColl.Add(oItemSub); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | if (oBill.omodel.HInterID == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region  检验方案逻辑删除功能 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 检验方案逻辑删除功能 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("DeltetQCCheckProject")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeltetQCCheckProject(string HInterID) | 
|---|
|  |  |  | public object DeltetQCCheckProject(string HInterID,string UserName) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = UserName; | 
|---|
|  |  |  | //编辑权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Delete", 1, false, DBUtility.ClsPub.CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无删除权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Int64 lngBillKey = 0; | 
|---|
|  |  |  | lngBillKey = DBUtility.ClsPub.isLong(HInterID); | 
|---|
|  |  |  | if (lngBillKey == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据ID为空!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DAL.ClsGy_QCCheckProjectMain oBill = new DAL.ClsGy_QCCheckProjectMain(); | 
|---|
|  |  |  | 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 != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 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.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据未找到"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | //string ModRightNameCheck = "Sc_ProcessReport_check"; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //删除权限 | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 检验方案审核/反审核 | 
|---|
|  |  |  | [Route("Gy_QCCheckProject/AuditGy_QCCheckProject")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object AuditGy_QCCheckProject(string HInterID, int Type, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有审核权限 | 
|---|
|  |  |  | 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.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "HInterID为空!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DAL.ClsGy_QCCheckProjectMain oBill = new DAL.ClsGy_QCCheckProjectMain(); | 
|---|
|  |  |  | ClsPub.CurUserName = user; | 
|---|
|  |  |  | oCN.BeginTran();//开始事务 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //Type 1 审核  2  反审核 | 
|---|
|  |  |  | if (Type == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断单据是否已经审核 | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //审核单据 | 
|---|
|  |  |  | if (!oBill.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断单据是否已经反审核 | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //反审核单据 | 
|---|
|  |  |  | if (!oBill.AbandonCheck(Int64.Parse(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 来料检验 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 保存来料检验单 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | 
|---|
|  |  |  | oItemSub.HSourceInterID = 0; | 
|---|
|  |  |  | oItemSub.HEntryID = i; | 
|---|
|  |  |  | // DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = Convert.ToDateTime(""); | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HCloseType = false; | 
|---|
|  |  |  | oItemSub.HSourceBillNo = ""; | 
|---|
|  |  |  | oItemSub.HSourceBillType = ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //删除权限 | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 首件检验 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 保存首件检验单 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | 
|---|
|  |  |  | oItemSub.HSourceInterID = 0; | 
|---|
|  |  |  | oItemSub.HEntryID = i; | 
|---|
|  |  |  | // DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = Convert.ToDateTime(""); | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HCloseType = false; | 
|---|
|  |  |  | oItemSub.HSourceBillNo = ""; | 
|---|
|  |  |  | oItemSub.HSourceBillType = ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #region [伪删除模式] | 
|---|
|  |  |  | ///// <summary> | 
|---|
|  |  |  | ///// 首件检验逻辑删除功能 | 
|---|
|  |  |  | ///// </summary> | 
|---|
|  |  |  | ///// <returns></returns> | 
|---|
|  |  |  | //[Route("DeltetQC_FirstPieceCheck")] | 
|---|
|  |  |  | //[HttpGet] | 
|---|
|  |  |  | //public object DeltetQC_FirstPieceCheck(string HInterID,string user) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    DataSet ds; | 
|---|
|  |  |  | //    string ModRightNameCheck = "QC_FirstPieceCheckBill_Delete"; | 
|---|
|  |  |  | //    try | 
|---|
|  |  |  | //    { | 
|---|
|  |  |  | //        //删除权限 | 
|---|
|  |  |  | //        if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user)) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            objJsonResult.code = "0"; | 
|---|
|  |  |  | //            objJsonResult.count = 0; | 
|---|
|  |  |  | //            objJsonResult.Message = "审核失败!无权限!"; | 
|---|
|  |  |  | //            objJsonResult.data = null; | 
|---|
|  |  |  | //            return objJsonResult; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 首件检验逻辑删除功能 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("DeltetQC_FirstPieceCheck")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeltetQC_FirstPieceCheck(string HInterID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | //string ModRightNameCheck = "Sc_ProcessReport_check"; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //删除权限 | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, 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 QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain"); | 
|---|
|  |  |  | //        DataSet ds2 = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub where HInterID=" + HInterID, "QC_FirstPieceCheckBillSub"); | 
|---|
|  |  |  | //        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; ; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | //        var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | //        if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2)) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            oCN.RollBack();//回滚事务 | 
|---|
|  |  |  | //            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 QC_POStockInCheckBillMain where HInterID=" + HInterID, "QC_POStockInCheckBillMain"); | 
|---|
|  |  |  | DataSet ds2 = oCN.RunProcReturn("select * from QC_POStockInCheckBillSub where HInterID=" + HInterID, "QC_POStockInCheckBillSub"); | 
|---|
|  |  |  | 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; ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack();//回滚事务 | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已删除无法再次删除!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        oCN.RunProc("update QC_FirstPieceCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | //        oCN.RunProc("update QC_FirstPieceCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | //        oCN.Commit();//提交事务 | 
|---|
|  |  |  | //        objJsonResult.code = "0"; | 
|---|
|  |  |  | //        objJsonResult.count = 1; | 
|---|
|  |  |  | //        objJsonResult.Message = "* 单据删除成功!"; | 
|---|
|  |  |  | //        objJsonResult.data = null; | 
|---|
|  |  |  | //        return objJsonResult; ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("update QC_POStockInCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.RunProc("update QC_POStockInCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 巡检 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 保存巡检单 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | 
|---|
|  |  |  | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString(); | 
|---|
|  |  |  | string user = sArray[2].ToString(); | 
|---|
|  |  |  | string badmsg = sArray[3].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string UserName = ""; | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DAL.ClsQC_PatrolProcCheckBill oBill = new DAL.ClsQC_PatrolProcCheckBill(); | 
|---|
|  |  |  | //判断权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_PatrolProcCheckBill_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无保存权限"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WebAPI.DLL.ClsQC_PatrolProcCheckBill oBill = new WebAPI.DLL.ClsQC_PatrolProcCheckBill(); | 
|---|
|  |  |  | List<Model.ClsQC_PatrolProcCheckBillMain> lsmain = new List<Model.ClsQC_PatrolProcCheckBillMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | msg2 = msg2.Replace("\n", "");  //\n | 
|---|
|  |  |  | 
|---|
|  |  |  | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | oItem.HBillType = "7503"; | 
|---|
|  |  |  | oItem.HBillSubType = "7503"; | 
|---|
|  |  |  | oItem.HBillType = "7506"; | 
|---|
|  |  |  | oItem.HBillSubType = "7506"; | 
|---|
|  |  |  | oItem.HBillStatus = 0; | 
|---|
|  |  |  | oItem.HPeriod = 0; | 
|---|
|  |  |  | oItem.HMaker = ""; | 
|---|
|  |  |  | oItem.HMaker = user; | 
|---|
|  |  |  | oItem.HMainSourceInterID = oItem.HInterID; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | 
|---|
|  |  |  | oItemSub.HSourceInterID = 0; | 
|---|
|  |  |  | oItemSub.HEntryID = i; | 
|---|
|  |  |  | // DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = Convert.ToDateTime(""); | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HCloseType = false; | 
|---|
|  |  |  | oItemSub.HSourceBillNo = ""; | 
|---|
|  |  |  | oItemSub.HSourceBillType = ""; | 
|---|
|  |  |  | oItemSub.HRelationQty = 0; | 
|---|
|  |  |  | oItemSub.HRelationMoney = 0; | 
|---|
|  |  |  | oItemSub.HCloseMan = ""; | 
|---|
|  |  |  | oItemSub.HRemark = ""; | 
|---|
|  |  |  | //oItemSub.HRemark = ""; | 
|---|
|  |  |  | oBill.DetailColl.Add(oItemSub); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | badmsg = badmsg.Substring(1, badmsg.Length - 2); | 
|---|
|  |  |  | badmsg = badmsg.Replace("\\", ""); | 
|---|
|  |  |  | badmsg = badmsg.Replace("\n", "");  //\n | 
|---|
|  |  |  | List<Model.ClsQC_PatrolProcCheckBillSub_BadReason> bs = new List<Model.ClsQC_PatrolProcCheckBillSub_BadReason>(); | 
|---|
|  |  |  | bs = oListModels.getObjectByJson_ClsQC_PatrolProcCheckBillSub_BadReason(badmsg); | 
|---|
|  |  |  | int j = 0; | 
|---|
|  |  |  | foreach (Model.ClsQC_PatrolProcCheckBillSub_BadReason badSub in bs) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | badSub.HBillNo_bak = oBill.omodel.HBillNo;//单据号(备份,以免内码丢失,找不到对应主表) | 
|---|
|  |  |  | j++; | 
|---|
|  |  |  | if (string.IsNullOrWhiteSpace(badSub.HBillNo_bak)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!没备份单据号,无法保存!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | badSub.HInterID = oBill.omodel.HInterID; | 
|---|
|  |  |  | badSub.HEntryID = j; | 
|---|
|  |  |  | badSub.HSEQ = j; | 
|---|
|  |  |  | oBill.DetailColl_Bad.Add(badSub); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("DeltetQC_PatrolProcCheck")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeltetQC_PatrolProcCheck(string HInterID) | 
|---|
|  |  |  | public object DeltetQC_PatrolProcCheck(string HInterID,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | //string ModRightNameCheck = "Sc_ProcessReport_check"; | 
|---|
|  |  |  | string ModRightNameCheck = "QC_PatrolProcCheckBill_Delete"; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //删除权限 | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "审核失败!无权限!"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!无权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (string.IsNullOrWhiteSpace(HInterID)) | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCN.BeginTran();//开始事务 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from QC_POStockInCheckBillMain where HInterID=" + HInterID, "QC_POStockInCheckBillMain"); | 
|---|
|  |  |  | DataSet ds2 = oCN.RunProcReturn("select * from QC_POStockInCheckBillSub where HInterID=" + HInterID, "QC_POStockInCheckBillSub"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from QC_PatrolProcCheckBillMain where HInterID=" + HInterID, "QC_PatrolProcCheckBillMain"); | 
|---|
|  |  |  | DataSet ds2 = oCN.RunProcReturn("select * from QC_PatrolProcCheckBillSub where HInterID=" + HInterID, "QC_PatrolProcCheckBillSub"); | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("update QC_POStockInCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.RunProc("update QC_POStockInCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | //删除前控制 | 
|---|
|  |  |  | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_QC_PatrolProcCheckBill_BeforeDelCtrl   " + HInterID.ToString() + ",'" + user + "'", "h_p_QC_PatrolProcCheckBill_BeforeDelCtrl"); | 
|---|
|  |  |  | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除前判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("update QC_PatrolProcCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.RunProc("update QC_PatrolProcCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除后控制 | 
|---|
|  |  |  | DataSet EndDs = oCN.RunProcReturn("Exec  h_p_QC_PatrolProcCheckBill_AfterDelCtrl " + HInterID.ToString() + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'", "h_p_QC_PatrolProcCheckBill_AfterDelCtrl"); | 
|---|
|  |  |  | if (EndDs == null || EndDs.Tables.Count == 0 || EndDs.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除后判断失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (DBUtility.ClsPub.isLong(EndDs.Tables[0].Rows[0]["HBack"]) == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(EndDs.Tables[0].Rows[0]["HRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.Commit();//提交事务 | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|