//判斷某個料位的商品是否被鎖定 public HttpResponseBase GetSearchStock() { string json = string.Empty; int islock = 0; _iinvd = new IinvdMgr(mySqlConnectionString); IinvdQuery query = new IinvdQuery(); if (!string.IsNullOrEmpty(Request.Params["loc_id"])) { query.plas_loc_id = Request.Params["loc_id"]; } if (!string.IsNullOrEmpty(Request.Params["item_id"])) { query.item_id = uint.Parse(Request.Params["item_id"]); } if (!string.IsNullOrEmpty(Request.Params["cde_date"]) && Request.Params["cde_date"] != "null") { query.cde_dt = DateTime.Parse(Request.Params["cde_date"]); } if (!string.IsNullOrEmpty(Request.Params["made_date"]) && Request.Params["made_date"] != "null") { query.made_date = DateTime.Parse(Request.Params["made_date"]); } query.ista_id = "H"; //{ // plas_loc_id = Request.Params["plas_loc_id"], // item_id = uint.Parse(Request.Params["item_id"]), // ista_id = "H", // made_date = string.IsNullOrEmpty(Request.Params["made_date"]) ? DateTime.MinValue : DateTime.Parse(Request.Params["made_date"]), // cde_dt = string.IsNullOrEmpty(Request.Params["cde_dt"]) ? DateTime.MinValue : DateTime.Parse(Request.Params["cde_dt"]) //}; try { if (!string.IsNullOrEmpty(query.plas_loc_id)) { if (query.made_date == query.cde_dt) { query.cde_dt = query.made_date = DateTime.Now; } List<IinvdQuery> listIinvdQuery = _iinvd.GetSearchIinvd(query); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 //timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; timeConverter.DateTimeFormat = "yyyy-MM-dd"; if (listIinvdQuery.Count > 0) { islock = 1; } //實際能檢的庫存listIinvdQuery.Count json = "{success:true,msg:\"" + islock + "\"}"; } } 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; }