Esempio n. 1
0
        public ActionResult GetOrderNumber(string orderNumber)
        {
            IList <WorkOrderProduct> lstWorkOrderProduct = new List <WorkOrderProduct>();

            using (WorkOrderProductServiceClient client = new WorkOrderProductServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Key.OrderNumber='{0}'", orderNumber),
                    OrderBy  = "ItemNo"
                };
                MethodReturnResult <IList <WorkOrderProduct> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
                {
                    lstWorkOrderProduct = result.Data;
                }
            }
            return(Json(from item in lstWorkOrderProduct
                        select new
            {
                Text = item.Key.MaterialCode,
                Value = item.Key.MaterialCode
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public async Task <ActionResult> Query(WorkOrderRuleQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (WorkOrderProductServiceClient client = new WorkOrderProductServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            where.AppendFormat(" {0} Key.OrderNumber LIKE '{1}%'"
                                               , where.Length > 0 ? "AND" : string.Empty
                                               , model.OrderNumber);

                            if (!string.IsNullOrEmpty(model.MaterialCode))
                            {
                                where.AppendFormat(" {0} Key.MaterialCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.MaterialCode);
                            }
                        }
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "EditTime DESC",
                            Where   = where.ToString()
                        };
                        MethodReturnResult <IList <WorkOrderProduct> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial", new WorkOrderRuleViewModel()));
            }
            else
            {
                return(View("Index", model));
            }
        }
Esempio n. 3
0
 public ActionResult GetMaxItemNo(string orderNumber)
 {
     using (WorkOrderProductServiceClient client = new WorkOrderProductServiceClient())
     {
         PagingConfig cfg = new PagingConfig()
         {
             PageNo   = 0,
             PageSize = 1,
             Where    = string.Format("Key.OrderNumber='{0}'", orderNumber),
             OrderBy  = "ItemNo Desc"
         };
         MethodReturnResult <IList <WorkOrderProduct> > result = client.Get(ref cfg);
         if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
         {
             return(Json(result.Data[0].ItemNo + 1, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(1, JsonRequestBehavior.AllowGet));
 }
Esempio n. 4
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 (WorkOrderProductServiceClient client = new WorkOrderProductServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <WorkOrderProduct> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial", new WorkOrderRuleViewModel()));
        }
Esempio n. 5
0
        //
        // GET: /PPM/WorkOrderProduct/
        public async Task <ActionResult> Index(string orderNumber)
        {
            using (WorkOrderServiceClient client = new WorkOrderServiceClient())
            {
                MethodReturnResult <WorkOrder> result = await client.GetAsync(orderNumber ?? string.Empty);

                if (result.Code > 0 || result.Data == null)
                {
                    return(RedirectToAction("Index", "WorkOrder"));
                }
                ViewBag.WorkOrder = result.Data;
            }

            using (WorkOrderProductServiceClient client = new WorkOrderProductServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        Where = string.Format(" Key.OrderNumber = '{0}'"
                                              , orderNumber),
                        OrderBy = "ItemNo"
                    };
                    MethodReturnResult <IList <WorkOrderProduct> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new WorkOrderProductQueryViewModel()
            {
                OrderNumber = orderNumber
            }));
        }