//理货员工作--寄仓--庫存信息 public HttpResponseBase GetStockByItemid() { string json = string.Empty; int totalCount = 0; int islock = 0; _iinvd = new IinvdMgr(mySqlConnectionString); IinvdQuery query = new IinvdQuery() { ista_id = "A" }; try { if (!string.IsNullOrEmpty(Request.Params["item_id"].ToString().Trim())) { query.item_id = Convert.ToUInt32(Request.Params["item_id"].ToString().Trim()); List<IinvdQuery> listIinvdQuery = _iinvd.GetIinvdListByItemid(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 //timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; timeConverter.DateTimeFormat = "yyyy-MM-dd"; if (totalCount > listIinvdQuery.Count) { islock = 1; } //實際能檢的庫存listIinvdQuery.Count if (listIinvdQuery.Count > 0) { json = JsonConvert.SerializeObject(listIinvdQuery, Formatting.Indented, timeConverter) ;//返回json數據 } else { IinvdQuery m = new IinvdQuery(); m.prod_qty = 0; m.made_date = DateTime.Now; m.cde_dt = DateTime.Now; listIinvdQuery.Add(m); json = JsonConvert.SerializeObject(listIinvdQuery, Formatting.Indented, timeConverter);//返回json數據 } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }