|  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 模具点检记录表分页列表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Sc_MouldDotCheckBill/GetMouldDotCheckBillListPage")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMouldDotCheckBillListPage(string sWhere, string user, int page, int size) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查看权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheckBillList " + page + "," + size + ",''", "h_p_Sc_MouldDotCheckBillList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     sWhere = sWhere.Replace("'", "''"); | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheckBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldDotCheckBillList"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = CodeConstant.SUCCEED; | 
 |  |  |                 objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = CodeConstant.FAIL; | 
 |  |  |                 objJsonResult.count = CountConstant.FAIL; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         | 
 |  |  |         #region sql语句 | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 模具保养计划表列表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Sc_MouldMaintainPlanBill/GetMouldMaintainPlanBillList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMouldMaintainPlanBillList(string sWhere,string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查看权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = Sc_MouldMaintainPlanBillList_s(sWhere); | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //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 = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 //else | 
 |  |  |                 //{ | 
 |  |  |                 //objJsonResult.code = "0"; | 
 |  |  |                 //objJsonResult.count = 0; | 
 |  |  |                 //objJsonResult.Message = "无数据"; | 
 |  |  |                 //objJsonResult.data = null; | 
 |  |  |                 //return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         #region sql语句 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         public static DataSet Sc_MouldMaintainPlanBillList_s(string sWhere) | 
 |  |  |         { | 
 |  |  |             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldMaintainPlanBillList where 1=1 "+sWhere+ " order by hmainid desc", "h_v_Sc_MouldMaintainPlanBillList"); | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 模具保养计划分页列表 | 
 |  |  |         [Route("Sc_MouldMaintainPlanBill/page")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Sc_MouldMaintainPlanBillPage(string sWhere, string user, int page, int size) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查看权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 sWhere = sWhere.Replace("'", "''"); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintainPlanBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldMaintainPlanBillList_Query"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintainPlanBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldMaintainPlanBillList_Query"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = CodeConstant.SUCCEED; | 
 |  |  |                 objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = CodeConstant.FAIL; | 
 |  |  |                 objJsonResult.count = CountConstant.FAIL; | 
 |  |  |                 objJsonResult.Message = "Exception!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 模具故障登记表列表 | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 样品销售出库单列表-分页 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 销售出库单列表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Kf_SellOutBill/GetSellOutBillList_byPage_YP")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetSellOutBillList_byPage_YP(string sWhere, string user, string Organization, int page, int size) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>();  //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 | 
 |  |  |                 //判断是否有查询权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBill_YP_Query", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "没有查询权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 sWhere = sWhere.Replace("'", "''"); | 
 |  |  |  | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_IF_SellOutBillList " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_IF_SellOutBillList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_IF_SellOutBillList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_IF_SellOutBillList"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         ///销售出库单删除功能 | 
 |  |  |         /// </summary> | 
 |  |  | 
 |  |  |  | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_Kf_OtherOutBillList where 1=1 order by hmainid desc", "h_v_Kf_OtherOutBillList"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_Kf_OtherOutBillList where 1=1 order by 制单日期 desc", "h_v_Kf_OtherOutBillList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  | 
 |  |  |  | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_Kf_OtherInBillList where 1=1  order by hmainid desc", "h_v_Kf_OtherInBillList"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from h_v_Kf_OtherInBillList where 1=1  order by 制单日期 desc", "h_v_Kf_OtherInBillList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         #region 模具保养计划单 | 
 |  |  |  | 
 |  |  |         #region 模具保养计划表列表 | 
 |  |  |         [Route("Sc_MouldMaintainPlanBill/GetMouldMaintainPlanBillList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMouldMaintainPlanBillList(string sWhere, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查看权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = Sc_MouldMaintainPlanBillList_s(sWhere); | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         #region sql语句 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         public static DataSet Sc_MouldMaintainPlanBillList_s(string sWhere) | 
 |  |  |         { | 
 |  |  |             return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldMaintainPlanBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_Sc_MouldMaintainPlanBillList"); | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 模具保养计划分页列表 | 
 |  |  |         [Route("Sc_MouldMaintainPlanBill/page")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Sc_MouldMaintainPlanBillPage(string sWhere, string user, int page, int size) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查看权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 sWhere = sWhere.Replace("'", "''"); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintainPlanBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldMaintainPlanBillList_Query"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintainPlanBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldMaintainPlanBillList_Query"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = CodeConstant.SUCCEED; | 
 |  |  |                 objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = CodeConstant.FAIL; | 
 |  |  |                 objJsonResult.count = CountConstant.FAIL; | 
 |  |  |                 objJsonResult.Message = "Exception!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 模具保养计划单 保存/编辑 | 
 |  |  |         /// <summary> | 
 |  |  | 
 |  |  |  | 
 |  |  |                     //oItem.HInterID =0; | 
 |  |  |                     //oItem.HBillNo = ""; | 
 |  |  |                     oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --日期 | 
 |  |  |                     //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --日期 | 
 |  |  |                     oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
 |  |  |                     oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); | 
 |  |  |                     //oItem.HMakeDate = ""; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region[模具保养计划单编辑时获取表头数据] | 
 |  |  |         [Route("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBillListCheckDetai")] | 
 |  |  |         [HttpGet] | 
 |  |  | 
 |  |  |             return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region[模具保养计划单编辑时获取表题数据] | 
 |  |  |         [Route("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBillListProjectDetai")] | 
 |  |  |         [HttpGet] | 
 |  |  | 
 |  |  |  | 
 |  |  |         #region 模具点检记录表 | 
 |  |  |  | 
 |  |  |         #region 模具点检记录表分页列表     | 
 |  |  |         [Route("Sc_MouldDotCheckBill/GetMouldDotCheckBillListPage")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMouldDotCheckBillListPage(string sWhere, string user, int page, int size) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查看权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheckBillList " + page + "," + size + ",''", "h_p_Sc_MouldDotCheckBillList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     sWhere = sWhere.Replace("'", "''"); | 
 |  |  |                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheckBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldDotCheckBillList"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = CodeConstant.SUCCEED; | 
 |  |  |                 objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = CodeConstant.FAIL; | 
 |  |  |                 objJsonResult.count = CountConstant.FAIL; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 模具点检记录表 保存/编辑 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 保存模具维修单 | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         #region[模具点检记录表编辑时获取表头数据] | 
 |  |  |         [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListCheckDetai")] | 
 |  |  |         [HttpGet] | 
 |  |  | 
 |  |  |             return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region[模具点检记录表编辑时获取表题数据] | 
 |  |  |         [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListProjectDetai")] | 
 |  |  |         [HttpGet] | 
 |  |  | 
 |  |  |             return objJsonResult; | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region[模具点检记录表选择点检计划带出表格数据] | 
 |  |  |         [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckSubBillListByPlan")] | 
 |  |  |         [HttpGet] | 
 |  |  | 
 |  |  |             return objJsonResult; | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region [模具点检记录表删除功能] | 
 |  |  |         /// <summary> | 
 |  |  |         /// 模具点检记录删除功能 | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 器具点检计划单 关闭/反关闭 | 
 |  |  |         #region 器具点检记录单 关闭/反关闭 | 
 |  |  |         /// <summary> | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="HInterID">单据ID</param> | 
 |  |  | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region[模具点检记录表点击主表查看子表信息] | 
 |  |  |         [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckBillList_sub")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Sc_MouldDotCheckBillList_sub(string HInterID) | 
 |  |  |         { | 
 |  |  |  | 
 |  |  |             DataSet ds; | 
 |  |  |             List<object> list = new List<object>(); | 
 |  |  |             string Swhere = ""; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (HInterID != "" || HInterID != null) | 
 |  |  |                 { | 
 |  |  |                     Swhere = " and hmainid='" + HInterID + "'"; | 
 |  |  |                 }                | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 //获取点检项目数据 | 
 |  |  |                 string sql = "select  点检项目代码 HDotCheckItemNumber, 点检项目 HDotCheckItem,点检方法名称 HDotCheckItemMethodName,点检部位 HDotCheckPart,具体要求 HClaim,负责人代码 HManagerNumber,负责人名称 HManagerName,点检结果 HDotCheckResult,子备注2 HRemark from h_v_Sc_MouldDotCheckBill_Edit where 1 = 1 " + Swhere + ""; | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckBill_Edit"); | 
 |  |  |               | 
 |  |  |                 list.Add(ds.Tables[0]); | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "获取信息成功!"; | 
 |  |  |                 objJsonResult.list = list; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |             } | 
 |  |  |             return objJsonResult; | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 sWhere = sWhere.Replace("'", "''"); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 sWhere = sWhere?.Replace("'", "''") ?? ""; | 
 |  |  |                 if (string.IsNullOrEmpty(sWhere)) | 
 |  |  |                 { | 
 |  |  |                     ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldLifeChangeBillList_Query"); | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldLifeChangeBillList_Query"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 // 添加空值检查 | 
 |  |  |                 if (ds == null || ds.Tables.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                     objJsonResult.code = CodeConstant.SUCCEED; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "查询成功,但无数据!"; | 
 |  |  |                     objJsonResult.list = columnNameList; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 // 检查第一个表 | 
 |  |  |                 if (ds.Tables[0] != null) | 
 |  |  |                 { | 
 |  |  |                     //添加列名 | 
 |  |  |                     foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                     { | 
 |  |  |                         Type dataType = col.DataType; | 
 |  |  |                         string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                         columnNameList.Add(JsonConvert.DeserializeObject(ColmString)); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 // 检查第二个表和行数据 | 
 |  |  |                 int totalCount = 0; | 
 |  |  |                 if (ds.Tables.Count > 1 && ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     var countRow = ds.Tables[1].Rows[0]["count"]; | 
 |  |  |                     if (countRow != null && countRow != DBNull.Value) | 
 |  |  |                     { | 
 |  |  |                         totalCount = int.Parse(countRow.ToString()); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = CodeConstant.SUCCEED; | 
 |  |  |                 objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.count = totalCount; | 
 |  |  |                 objJsonResult.Message = "Success!"; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.data = ds.Tables[0] ?? new DataTable(); // 确保不为null | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |          | 
 |  |  |  | 
 |  |  |         #region[app根据模具 保养规程或点检规程自动获取子表信息] | 
 |  |  |         [Route("Sc_MouldMaintainRuleBill/GetMouldRuleSubList-Detail")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetMouldMaintainRuleSubList(string HInterID,string HBillType) | 
 |  |  |         { | 
 |  |  |  | 
 |  |  |             DataSet ds, ds1; | 
 |  |  |             List<object> list = new List<object>(); | 
 |  |  |             string Swhere = ""; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (HInterID != "" || HInterID != null) | 
 |  |  |                 { | 
 |  |  |                     Swhere = " and HInterID='" + HInterID + "'"; | 
 |  |  |                 }                | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 //保养记录调用 | 
 |  |  |                 if (HBillType== "3819") | 
 |  |  |                 { | 
 |  |  |                     //获取保养项目编辑数据 | 
 |  |  |                     string sql = "select HMaintainItemID,HManagerID,HMaintainItem,HMaintainPart,HClaim,HRemark,'true' HMaintainResult from Sc_MouldMaintainRuleBillSub_Item where 1 = 1 " + Swhere + ""; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainRuleBillSub_Item"); | 
 |  |  |                     //获取配件项目编辑数据 | 
 |  |  |                     string sql1 = "select HMaterID, HUnitID, HQty, HQtyMust, HRemark from Sc_MouldMaintainRuleBillSub where 1 = 1 " + Swhere + ""; | 
 |  |  |                     ds1 = oCN.RunProcReturn(sql1, "Sc_MouldMaintainRuleBillSub"); | 
 |  |  |                     list.Add(ds.Tables[0]); | 
 |  |  |                     list.Add(ds1.Tables[0]); | 
 |  |  |                 } | 
 |  |  |                 //点检记录调用 | 
 |  |  |                 else if (HBillType== "3821") | 
 |  |  |                 { | 
 |  |  |                     //获取点检项目编辑数据 | 
 |  |  |                     string sql = "select HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID,HDotCheckItemClassID,HDotCheckItemMethodID,HRemark from Sc_MouldDotCheckRuleBillSub where 1 = 1 " + Swhere + ""; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "Sc_MouldDotCheckRuleBillSub");      | 
 |  |  |                     list.Add(ds.Tables[0]);                    | 
 |  |  |                 } | 
 |  |  |                 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "获取信息成功!"; | 
 |  |  |                 objJsonResult.list = list; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |             } | 
 |  |  |             return objJsonResult; | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } |