/// <summary> /// 已经登记,但是收货未完成的数据 /// </summary> /// <returns></returns> public List <JsonVehiclesEntity> GetVehicles(int?billID, string billNO, string cardNO, string cardState) { List <JsonVehiclesEntity> jb = new List <JsonVehiclesEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("cardState=").Append(cardState); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetVehicles); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(jb); } #endregion #region 正常错误处理 JsonVehicles bill = JsonConvert.DeserializeObject <JsonVehicles>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(jb); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(jb); } #endregion #region 赋值 foreach (JsonVehiclesResult tm in bill.result) { JsonVehiclesEntity ve = new JsonVehiclesEntity(); ve.BILL_NO = tm.billNo; ve.BILL_STATE_DESC = tm.billStateDesc; ve.CARD_NO = tm.cardNo; ve.cardState = tm.cardState; ve.CARD_STATE_DESC = tm.cardStateDesc; ve.C_NAME = tm.cName; ve.CONTACT = tm.contact; ve.CREATE_DATE = tm.createDate; ve.CREATOR = tm.creator; ve.DRIVER = tm.driver; ve.VEHICLE_NO = tm.vehicleNo; jb.Add(ve); } return(jb); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(jb); }
/// <summary> /// 已经登记,但是收货未完成的数据 /// </summary> /// <returns></returns> /// public DataTable GetVehicles(int?billID, string billNO, string cardNO, string cardState) { #region DataTable tblDatas = new DataTable("Datas"); tblDatas.Columns.Add("BILL_NO", Type.GetType("System.String")); tblDatas.Columns.Add("BILL_STATE_DESC", Type.GetType("System.String")); tblDatas.Columns.Add("CARD_NO", Type.GetType("System.String")); tblDatas.Columns.Add("CARD_STATE_DESC", Type.GetType("System.String")); tblDatas.Columns.Add("C_NAME", Type.GetType("System.String")); tblDatas.Columns.Add("CONTACT", Type.GetType("System.String")); tblDatas.Columns.Add("CREATE_DATE", Type.GetType("System.String")); tblDatas.Columns.Add("CREATOR", Type.GetType("System.String")); tblDatas.Columns.Add("DRIVER", Type.GetType("System.String")); tblDatas.Columns.Add("VEHICLE_NO", Type.GetType("System.String")); tblDatas.Columns.Add("cardState", Type.GetType("System.String")); #endregion try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("cardState=").Append(cardState); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetVehicles); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(tblDatas); } #endregion #region 正常错误处理 JsonVehicles bill = JsonConvert.DeserializeObject <JsonVehicles>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(tblDatas); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(tblDatas); } #endregion List <JsonVehiclesEntity> jb = new List <JsonVehiclesEntity>(); #region 赋值 foreach (JsonVehiclesResult tm in bill.result) { DataRow newRow; newRow = tblDatas.NewRow(); newRow["BILL_NO"] = tm.billNo; newRow["BILL_STATE_DESC"] = tm.billStateDesc; newRow["CARD_NO"] = tm.cardNo; newRow["CARD_STATE_DESC"] = tm.cardStateDesc; newRow["C_NAME"] = tm.cName; newRow["CONTACT"] = tm.contact; newRow["CREATE_DATE"] = tm.createDate; newRow["CREATOR"] = tm.creator; newRow["DRIVER"] = tm.driver; newRow["VEHICLE_NO"] = tm.vehicleNo; newRow["cardState"] = tm.cardState; tblDatas.Rows.Add(newRow); } return(tblDatas); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(tblDatas); }