Example #1
0
        public ActionResult Modify(string key)
        {
            MaterialReceiptExViewModel model = new MaterialReceiptExViewModel();

            using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
            {
                MethodReturnResult <MaterialReceipt> result = client.Get(key);
                if (result.Code == 0)
                {
                    model = new MaterialReceiptExViewModel()
                    {
                        ReceiptNo   = result.Data.Key,
                        ReceiptDate = result.Data.ReceiptDate,
                        OrderNumber = result.Data.OrderNumber,
                        LineStore   = result.Data.LineStore,
                        Creator     = result.Data.Creator,
                        Editor      = User.Identity.Name
                    };
                    return(PartialView("_ModifyPartial", model));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }

            return(PartialView("_ModifyPartial"));
        }
Example #2
0
        public ActionResult Query(MaterialReceiptExQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
                {
                    StringBuilder where = new StringBuilder();
                    if (model != null)
                    {
                        if (!string.IsNullOrEmpty(model.ReceiptNo))
                        {
                            where.AppendFormat(" {0} Key LIKE '{1}%'"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , model.ReceiptNo);
                        }
                    }
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "CreateTime desc",
                        Where   = where.ToString()
                    };

                    MethodReturnResult <IList <MaterialReceipt> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                }
            }
            return(PartialView("_ListPartial"));
        }
 public MaterialReceipt GetMaterialReceipt(string key)
 {
     using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
     {
         MethodReturnResult <MaterialReceipt> rst = client.Get(key);
         if (rst.Code <= 0)
         {
             return(rst.Data);
         }
     }
     return(null);
 }
Example #4
0
        //
        // GET: /LSM/MaterialReceiptExDetail/
        public ActionResult Index(string ReceiptNo)
        {
            MaterialReceiptExDetailQueryViewModel model = new MaterialReceiptExDetailQueryViewModel();


            PagingConfig cfg = new PagingConfig()
            {
                IsPaging = false,
                OrderBy  = "Key.ItemNo",
                Where    = string.Format(" Key.ReceiptNo = '{0}'"
                                         , ReceiptNo)
            };

            using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
            {
                MethodReturnResult <IList <MaterialReceiptDetail> > result = client.GetDetail(ref cfg);

                if (result.Code == 0)
                {
                    ViewBag.PagingConfig = cfg;
                    ViewBag.List         = result.Data;
                }
                MethodReturnResult <MaterialReceipt> res = client.Get(ReceiptNo);
                if (res.Code == 0)
                {
                    model.ReceiptNo     = res.Data.Key;
                    model.OrderNumber   = res.Data.OrderNumber;
                    model.LineStoreName = res.Data.LineStore;
                    model.ReceiptDate   = res.Data.ReceiptDate.ToString("yyyy-MM-dd");
                    ViewBag.State       = res.Data.State;
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial", new MaterialReceiptExDetailViewModel()
                {
                    ReceiptNo = ReceiptNo
                }));
            }
            return(View("Index", model));
        }
Example #5
0
        public ActionResult GetReceiptNo()
        {
            string prefix = string.Format("LMK{0:yyMMdd}", DateTime.Now);
            int    itemNo = 0;

            using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    PageNo   = 0,
                    PageSize = 1,
                    Where    = string.Format("Key LIKE '{0}%'", prefix),
                    OrderBy  = "Key Desc"
                };
                MethodReturnResult <IList <MaterialReceipt> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
                {
                    string sItemNo = result.Data[0].Key.Replace(prefix, "");
                    int.TryParse(sItemNo, out itemNo);
                }
            }
            return(Json(prefix + (itemNo + 1).ToString("0000"), JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public async Task <ActionResult> PagingQuery(string where, string orderBy, int?currentPageNo, int?currentPageSize)
        {
            if (ModelState.IsValid)
            {
                int pageNo   = currentPageNo ?? 0;
                int pageSize = currentPageSize ?? 20;
                if (Request["PageNo"] != null)
                {
                    pageNo = Convert.ToInt32(Request["PageNo"]);
                }
                if (Request["PageSize"] != null)
                {
                    pageSize = Convert.ToInt32(Request["PageSize"]);
                }

                using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <MaterialReceipt> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
Example #7
0
        public async Task <ActionResult> Query(MaterialReceiptQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (!string.IsNullOrEmpty(model.ReceiptNo))
                            {
                                where.AppendFormat(" {0} Key = '{1}'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.ReceiptNo);
                            }
                            if (!string.IsNullOrEmpty(model.OrderNumber))
                            {
                                where.AppendFormat(" {0} OrderNumber = '{1}'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.OrderNumber);
                            }

                            if (model.StartReceiptDate != null)
                            {
                                where.AppendFormat(" {0} ReceiptDate >= '{1}'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.StartReceiptDate);
                            }

                            if (model.EndReceiptDate != null)
                            {
                                where.AppendFormat(" {0} ReceiptDate <= '{1}'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.EndReceiptDate);
                            }
                        }

                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "CreateTime Desc",
                            Where   = where.ToString()
                        };

                        MethodReturnResult <IList <MaterialReceipt> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial"));
            }
            else
            {
                return(View("Index"));
            }
        }