|  |  | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | using System.Data; | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> A = new List<object>(); | 
 |  |  |                 //æ¥çæé | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_WorkDemandPlanBill_Query", 1, false, user)) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select * from  h_v_JIT_Sc_WorkDemandPlanBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_JIT_Sc_WorkDemandPlanBillList"); | 
 |  |  |  | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns)//éådsä¸ç¬¬ä¸ä¸ªè¡¨ï¼Tables[0]ï¼çææåï¼Columnsï¼æ¯æ¬¡å¾ªç¯ä¸ï¼colåé伿æå½ååçå¼ç¨ | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; //è·åå½åæ°æ®ç±»åä¼ å
¥ èªå®ä¹åédatadataType | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //åç¬¦ä¸²æ¼æ¥         // å°åååæ°æ®ç±»åä¿¡æ¯æ¼æ¥æä¸ä¸ªJSONæ ¼å¼çå符串 | 
 |  |  |                     A.Add(JsonConvert.DeserializeObject(ColmString));//è·åå°DataColumnå对象çåå | 
 |  |  |                 } | 
 |  |  |              | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucessï¼"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = A; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  | 
 |  |  |             string user = sArray[3].ToString(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanBill_Edit", 1, false, user)) | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_WorkDemandPlanBill_Edit", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     if (ds.Tables[0].Rows[0]["åæ®ç¶æ"].ToString() == "2") | 
 |  |  |                     if (ds.Tables[0].Rows[0]["åæ®ç¶æ"].ToString() == "3") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "å½ååæ®æ£å¨å®¡æ ¸,ä¸è½å
³éï¼"; | 
 |  |  |                         objJsonResult.Message = "å½å忮已å
³é!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |        | 
 |  |  |  | 
 |  |  |         #region è¦æè®¡åå åå
³é | 
 |  |  |         [Route("Sc_WorkDemandPlanBill/CancelCloseWorkDemandPlanBillList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object CancelCloseWorkDemandPlanBillList(string HInterID, string User) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //å
³éæé | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log_second("Sc_WorkDemandPlanBill_Close", 1, false, User)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "æ æéå
³éï¼"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkDemandPlanBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Sc_WorkDemandPlanBillList"); | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     if (ds.Tables[0].Rows[0]["åæ®ç¶æ"].ToString() != "3") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "å½ååæ®æ²¡æå¤äºå
³éç¶æ!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     oCN.BeginTran();//å¼å¯äºå¡ | 
 |  |  |  | 
 |  |  |                     string HBillStatus = ds.Tables[0].Rows[0]["审核人"].ToString() == "" ? "1" : "2"; | 
 |  |  |                     oCN.RunProc($"update Sc_WorkDemandPlanBillMain set HBillStatus='{HBillStatus}',HCloseMan='',HCloseDate=null   where HInterID={HInterID}"); | 
 |  |  |  | 
 |  |  |                     oCN.Commit();//ç»æäºå¡ | 
 |  |  |  | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "å
³éæåï¼"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "å½ååæ®ä¸åå¨,æ æ³å
³éï¼"; | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 oCN.RollBack();//åæ»äºå¡ | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region è¦æè®¡åå è¦æè®¡åæ¥è¡¨ | 
 |  |  |         public class ReportWorkDemandPlanBill | 
 |  |  |         { | 
 |  |  |             public int? HORGID; | 
 |  |  |             public DateTime HBEGINDATE; | 
 |  |  |             public DateTime HENDDATE; | 
 |  |  |             public int? HMATERIALID; | 
 |  |  |             public int? HDeptID; | 
 |  |  |         } | 
 |  |  |         [Route("Sc_WorkDemandPlanBill/ReportWorkDemandPlanBillList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object ReportWorkDemandPlanBillList(string sWhere, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //æ¥çæé | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_WorkDemandPlanBill_Query", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "æ æ¥çæéï¼"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ReportWorkDemandPlanBill Report = JsonConvert.DeserializeObject<ReportWorkDemandPlanBill>(sWhere); | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn($"exec h_p_JIT_Sc_WorkDemandPlanBill_ReportList {Report.HORGID},'{Report.HBEGINDATE}','{Report.HENDDATE}',{Report.HMATERIALID},{Report.HDeptID} ", "h_p_JIT_Sc_WorkDemandPlanBill_ReportList"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucessï¼"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "Exceptionï¼" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } |