示例#1
0
        //寄倉-庫存-輸入撿貨量
        public HttpResponseBase GetSum()
        {
            string json = string.Empty;
            _iinvd = new IinvdMgr(mySqlConnectionString);
            Iinvd i = new Iinvd();
            int S = 0;//主料位庫存
            int R = 0;//輔料位庫存
            uint item;
            try
            {
                if (Request.Params["lcat_id"].ToString() == "S")
                {
                    if (uint.TryParse(Request.Params["item_id"].ToString(), out item))
                    {
                        i.item_id = item;
                        S = _iinvd.sum(i, "S");
                        R = _iinvd.sum(i, "R");
                        json = "{success:true,S:'" + S + "',R:'" + R + "'}";//返回json數據
                    }
                }
                else if (Request.Params["lcat_id"].ToString() == "R")
                {//查詢輔料位該日期的庫存
                    if (uint.TryParse(Request.Params["item_id"].ToString(), out item))
                    {
                        i.item_id = item;
                        i.made_date = DateTime.Parse(Request.Params["made_date"].ToString());
                        R = _iinvd.sum(i, "R");
                        json = "{success:true,S:'" + S + "',R:'" + R + "'}";//返回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;
        }