Пример #1
0
        //根據工作代號、細項編號 獲取商品數據
        public HttpResponseBase GetAseldListByItemid()
        {//判斷寄倉或者調度
            string json = String.Empty;

            Aseld m = new Aseld();
            List<AseldQuery> list = new List<AseldQuery>();
            _iasdMgr = new AseldMgr(mySqlConnectionString);
            try
            {
                m.assg_id = Request.Params["assg_id"].ToString().Trim();
                if (!string.IsNullOrEmpty(Request.Params["item_id"]))
                {
                    m.item_id = Convert.ToUInt32(Request.Params["item_id"].ToString().Trim());
                }
                if (_iasdMgr.GetCountByItem(m) == 0)
                {
                    json = "{success:true,totalCount:" + 0 + ",msg:1,data:" + JsonConvert.SerializeObject(list, Formatting.Indented) + "}";//返回json數據     
                }
                else
                {
                    list = _iasdMgr.GetAseldListByItemid(m);
                    foreach (var item in list)
                    {
                        m.seld_id = item.seld_id;
                    }
                    m.wust_id = "BSY";
                    m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id;
                    _iasdMgr.Updwust(m);
                    json = "{success:true,totalCount:" + list.Count + ",msg:0,data:" + JsonConvert.SerializeObject(list, Formatting.Indented) + "}";//返回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,msg:0}";
            }
            this.Response.Clear();
            this.Response.Write(json.ToString());
            this.Response.End();
            return this.Response;
        }