|  |  | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using Pub_Class; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairWorkBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = Sb_EquipRepairWorkBill_s(sWhere); | 
 |  |  |                 | 
 |  |  |                     | 
 |  |  |                | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "返回记录成功!"; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 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 = "返回记录成功!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  | 
 |  |  |         { | 
 |  |  |             if (sWhere == null || sWhere.Equals("")) | 
 |  |  |             { | 
 |  |  |                 return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipRepairWorkBillList "+sWhere+ "order by hmainid desc", "h_v_Sb_EquipRepairWorkBillList"); | 
 |  |  |                 return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipRepairWorkBillList "+sWhere+ " order by hmainid desc", "h_v_Sb_EquipRepairWorkBillList"); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 string sql1 = "select * from h_v_Sb_EquipRepairWorkBillList where 1 = 1 "; | 
 |  |  |                 string sql = sql1 + sWhere+ "order by hmainid desc"; | 
 |  |  |                 string sql = sql1 + sWhere+ " order by hmainid desc"; | 
 |  |  |                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipRepairWorkBillList"); | 
 |  |  |             } | 
 |  |  |              | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = Sb_EquipRepairCheckWorkBill_s(sWhere); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "返回记录成功!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  |             { | 
 |  |  | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 string sql1 = "select * from h_v_Sb_EquipRepairCheckBillList where 1 = 1 "; | 
 |  |  |                 string sql = sql1 + sWhere+ "order by hmainid desc"; | 
 |  |  |                 string sql = sql1 + sWhere+ " order by hmainid desc"; | 
 |  |  |                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipRepairCheckBillList"); | 
 |  |  |             } | 
 |  |  |              | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBillList", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = Sb_EqpConkBookBillList_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 = "返回记录成功!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |  | 
 |  |  |             } | 
 |  |  | 
 |  |  |         { | 
 |  |  |             if (sWhere == null || sWhere.Equals("")) | 
 |  |  |             { | 
 |  |  |                 return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipConkBookBillList order by hmainid desc" + sWhere, "h_v_Sb_EquipConkBookBillList"); | 
 |  |  |                 return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipConkBookBillList order by hmainid desc" , "h_v_Sb_EquipConkBookBillList"); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 string sql1 = "select * from h_v_Sb_EquipConkBookBillList where 1 = 1 "; | 
 |  |  |                 string sql = sql1 + sWhere+ "order by hmainid desc"; | 
 |  |  |                 string sql = sql1 + sWhere+ " order by hmainid desc"; | 
 |  |  |                 return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipConkBookBillList"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |             string msg2 = sArray[0].ToString(); | 
 |  |  |             string msg3 = sArray[1].ToString(); | 
 |  |  |             string msg4 = sArray[2].ToString(); | 
 |  |  |             string msg5 = sArray[3].ToString(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             //string UserName = ""; | 
 |  |  | 
 |  |  |                     oBill.DetailColl.Add(oItemSub); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //配件表体数据 | 
 |  |  |                 //按 },{来拆分数组 //去掉【和】 | 
 |  |  |                 //msg5 = msg5.Substring(1, msg5.Length - 2); | 
 |  |  |                 msg5 = msg5.Replace("\\", ""); | 
 |  |  |                 msg5 = msg5.Replace("\n", "");  //\n | 
 |  |  |                                                 //msg2 = msg2.Replace("'", "’"); | 
 |  |  |                 List<Model.ClsSb_EquipRepairWorkBillSub_Mater> ls1 = new List<Model.ClsSb_EquipRepairWorkBillSub_Mater>(); | 
 |  |  |                 ls1 = JsonConvert.DeserializeObject<List<Model.ClsSb_EquipRepairWorkBillSub_Mater>>(msg5); | 
 |  |  |                 int j = 0; | 
 |  |  |                 foreach (Model.ClsSb_EquipRepairWorkBillSub_Mater oItemSub in ls1) | 
 |  |  |                 { | 
 |  |  |  | 
 |  |  |                     j++; | 
 |  |  |                     oItemSub.HEntryID = i; | 
 |  |  |                     oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
 |  |  |                     oItemSub.HCloseType = false;   //关闭类型                    | 
 |  |  |                     oItemSub.HSourceInterID = 0;     // 源单主内码 | 
 |  |  |                     oItemSub.HSourceEntryID = 0;   //源单子内码     | 
 |  |  |                     oItemSub.HRelationQty = 0;     //关联数量 | 
 |  |  |                     oBill.DetailColl_Mater.Add(oItemSub); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //保存 | 
 |  |  |                 //保存完毕后处理 | 
 |  |  |                 bool bResult; | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region[设备维修列表编辑时获取表体数据] | 
 |  |  |         #region[设备维修列表编辑时获取表体数据(维修列表、配件列表)] | 
 |  |  |         [Route("Sb_EqpRepairWorkBill/Sb_EqpRepairWorkBillListProjectDetai")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Sb_EqpRepairWorkBillListProjectDetai(string sqlWhere) | 
 |  |  |         public object Sb_EqpRepairWorkBillListProjectDetai(string HInterID) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             DataSet ds, ds1; | 
 |  |  |             List<object> list = new List<object>(); | 
 |  |  |             string sqlWhere = ""; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 if (sqlWhere == null || sqlWhere.Equals("")) | 
 |  |  |                 if (HInterID != "" || HInterID != null) | 
 |  |  |                 { | 
 |  |  |                     //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark   from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); | 
 |  |  |                     ds = oCN.RunProcReturn("select HRepairID,维修项目代码 HRepairCode,维修项目 HRepairName,HManagerID1 HManagerID,表体负责人代码 HManagerCode,表体负责人 HManagerName,HRepairID1 HRepairID, 表体维修项目代码 HRepairCode,表体维修项目 HRepairName,表体维修要求 HRepairExplanation,表体备注 HRemark,源单主内码 HSourceInterID,源单子内码 HSourceEntryID,源单单号 HSourceBillNo,源单类型 HSourceBillType  from h_v_Sc_EquipRepairWorkBillList_Edit", "h_v_Sc_EquipRepairWorkBillList_Edit"); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "获取信息成功!"; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     sqlWhere = " and hmainid='" + HInterID + "'"; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark  from Sc_MouldRepairWorkBillSub where 1 = 1 "; | 
 |  |  |                     string sql1 = "select HRepairID,维修项目代码 HRepairCode,维修项目 HRepairName,HManagerID1 HManagerID,表体负责人代码 HManagerCode,表体负责人 HManagerName,HRepairID1 HRepairID, 表体维修项目代码 HRepairCode,表体维修项目 HRepairName,表体维修要求 HRepairExplanation,表体备注 HRemark ,源单主内码 HSourceInterID,源单子内码 HSourceEntryID,源单单号 HSourceBillNo,源单类型 HSourceBillType from h_v_Sc_EquipRepairWorkBillList_Edit where 1 = 1 "; | 
 |  |  |                     string sql = sql1 + sqlWhere; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Sc_EquipRepairWorkBillList_Edit"); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "获取信息成功!"; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     sqlWhere = HInterID; | 
 |  |  |                 } | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                | 
 |  |  |                 ds = oCN.RunProcReturn("select HRepairID,维修项目代码 HRepairCode,维修项目 HRepairName,HManagerID1 HManagerID,表体负责人代码 HManagerCode,表体负责人 HManagerName,HRepairID1 HRepairID, 表体维修项目代码 HRepairCode,表体维修项目 HRepairName,表体维修要求 HRepairExplanation,表体备注 HRemark,源单主内码 HSourceInterID,源单子内码 HSourceEntryID,源单单号 HSourceBillNo,源单类型 HSourceBillType  from h_v_Sc_EquipRepairWorkBillList_Edit where 1 = 1 " + sqlWhere , "h_v_Sc_EquipRepairWorkBillList_Edit"); | 
 |  |  |                 string sql1 = "select * from h_v_Sb_EquipRepairWorkBillSub_Mater where 1 = 1 " + sqlWhere; | 
 |  |  |                 ds1 = oCN.RunProcReturn(sql1, "h_v_Sb_EquipRepairWorkBillSub_Mater"); | 
 |  |  |                 list.Add(ds.Tables[0]); | 
 |  |  |                 list.Add(ds1.Tables[0]); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "获取信息成功!"; | 
 |  |  |                 objJsonResult.list = list; | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { |