Exemplo n.º 1
0
        public IEnumerable <SelectListItem> GetLineStoreList()
        {
            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format(" Type='{0}' AND Status='{1}'"

                                             , Convert.ToInt32(EnumLineStoreType.Material)
                                             , Convert.ToInt32(EnumObjectStatus.Available))
                };
                MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);

                if (result.Code == 0)
                {
                    IEnumerable <SelectListItem> lst = from item in result.Data
                                                       select new SelectListItem()
                    {
                        Text  = item.Key,
                        Value = item.Key
                    };
                    return(lst);
                }
            }
            return(new List <SelectListItem>());
        }
Exemplo n.º 2
0
        public IEnumerable <SelectListItem> GetLineStore()
        {
            //根据物料类型获取物料。
            //IList<WorkOrder> lst = new List<WorkOrder>();
            IList <LineStore> lstMaterial = null;

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                };
                MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstMaterial = result.Data;
                    IEnumerable <SelectListItem> lst = from item in lstMaterial
                                                       select new SelectListItem()
                    {
                        Text  = item.Key,
                        Value = item.Key
                    };
                    return(lst);
                }
            }
            return(new List <SelectListItem>());
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Query(LineStoreQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (LineStoreServiceClient client = new LineStoreServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (model.Type != null)
                            {
                                where.AppendFormat(" Type = '{0}'", Convert.ToInt32(model.Type));
                            }

                            if (!string.IsNullOrEmpty(model.Name))
                            {
                                where.AppendFormat(" {0} Key LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.Name);
                            }

                            if (!string.IsNullOrEmpty(model.LocationName))
                            {
                                where.AppendFormat(" {0} LocationName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.LocationName);
                            }

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

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
Exemplo n.º 4
0
        public ActionResult GetLineStoreNames(string orderNumber)
        {
            string locationName = string.Empty;

            using (WorkOrderServiceClient client = new WorkOrderServiceClient())
            {
                MethodReturnResult <WorkOrder> result = client.Get(orderNumber);
                if (result.Code <= 0 && result.Data != null)
                {
                    locationName = result.Data.LocationName;
                }
            }

            IList <LineStore> lstLineStore = new List <LineStore>();

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("LocationName='{0}' AND Type='{1}' AND Status='{2}'"
                                             , locationName
                                             , Convert.ToInt32(EnumLineStoreType.Material)
                                             , Convert.ToInt32(EnumObjectStatus.Available))
                };

                MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstLineStore = result.Data;
                }
            }

            IList <Resource> lstResource = new List <Resource>();

            using (UserAuthenticateServiceClient client = new UserAuthenticateServiceClient())
            {
                MethodReturnResult <IList <Resource> > result = client.GetResourceList(User.Identity.Name, ResourceType.LineStore);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstResource = result.Data;
                }
            }

            var lnq = from item in lstLineStore
                      where lstResource.Any(m => m.Data == item.Key)
                      select new
            {
                Key = item.Key
            };

            return(Json(lnq, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public IEnumerable <SelectListItem> GetLineStoreNameList()
        {
            //获取用户拥有权限的线边仓名称。
            IList <Resource> lstResource = new List <Resource>();

            using (UserAuthenticateServiceClient client = new UserAuthenticateServiceClient())
            {
                MethodReturnResult <IList <Resource> > result = client.GetResourceList(HttpContext.Current.User.Identity.Name, ResourceType.LineStore);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstResource = result.Data;
                }
            }

            IList <LineStore> lstLineStore = new List <LineStore>();

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Type='{1}' AND Status='{0}'"
                                             , Convert.ToInt32(EnumObjectStatus.Available)
                                             , Convert.ToInt32(EnumLineStoreType.Material))
                };

                MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstLineStore = result.Data;
                }
            }

            var lst = (from item in lstResource
                       where lstLineStore.Any(m => m.Key == item.Data)
                       select new SelectListItem()
            {
                Text = item.Data,
                Value = item.Data
            }).ToList();

            if (lst.Count > 0)
            {
                lst[0].Selected = true;
            }
            return(lst);
        }
Exemplo n.º 6
0
        public ActionResult GetMaterialCode(string q, string orderNumber, string lineStoreName)
        {
            string routeOperationName = string.Empty;

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                MethodReturnResult <LineStore> result = client.Get(lineStoreName);
                if (result.Code <= 0 && result.Data != null)
                {
                    routeOperationName = result.Data.RouteOperationName;
                }
            }

            IList <WorkOrderBOM> lstBOM = new List <WorkOrderBOM>();

            using (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format(@"MaterialCode LIKE '{0}%' AND Key.OrderNumber='{1}'"
                                             , q
                                             , orderNumber),
                    OrderBy = "Key.ItemNo"
                };
                //工作中心为空的可以领到任何线边仓。
                //线边仓对应工序为空的可以领任何料。
                if (!string.IsNullOrEmpty(routeOperationName))
                {
                    cfg.Where += string.Format(" AND (WorkCenter='' OR WorkCenter IS NULL Or WorkCenter='{0}')", routeOperationName);
                }

                MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstBOM = result.Data;
                }
            }

            return(Json(from item in lstBOM
                        select new
            {
                @label = string.Format("{0}[{1}]", item.MaterialCode, item.Description),
                @value = item.MaterialCode,
                @desc = item.Description
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public ActionResult Detail(string ReceiptNo)
        {
            MaterialReceiptViewModel model = null;

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    OrderBy = "Key"
                };
                MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);
                List <SelectListItem> LineStoreList            = new List <SelectListItem>();
                //LineStoreList.Add(new SelectListItem() { Text = "--Select--", Value = "select" });
                foreach (LineStore item in result.Data)
                {
                    LineStoreList.Add(new SelectListItem()
                    {
                        Text = item.Key, Value = item.Key
                    });
                }
                ViewBag.LineStore = LineStoreList;
            }

            using (ERPClient client = new ERPClient())
            {
                //根据材料出库单单据号查询ERP中是否存在该出库单
                MethodReturnResult <DataSet> result = client.GetERPMaterialReceiptStore(ReceiptNo);
                DataTable dtERP = new DataTable();
                DataTable dtMES = new DataTable();
                dtERP = result.Data.Tables["dtERP"];
                dtMES = result.Data.Tables["dtMES"];
                if (result.Data.Tables[0].Rows.Count > 0)
                {
                    model = new MaterialReceiptViewModel()
                    {
                        ReceiptNo     = dtERP.Rows[0]["VBILLCODE"].ToString(),
                        OrderNumber   = dtERP.Rows[0]["VPRODUCTBATCH"].ToString(),
                        ReceiptDate   = DateTime.Parse(dtERP.Rows[0]["DBILLDATE"].ToString()),
                        LineStoreName = dtMES.Rows[0]["STORE_NAME"].ToString()
                    };
                }
                ViewBag.MaterialReceipt = model;

                return(View(model));
            }
        }
        public ActionResult GetProductionLines(string lineStoreName)
        {
            IList <ProductionLine> lst = new List <ProductionLine>();
            //获取车间名称
            string locationName = string.Empty;

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                MethodReturnResult <LineStore> result = client.Get(lineStoreName);
                if (result.Code <= 0 && result.Data != null)
                {
                    locationName = result.Data.LocationName;
                }
            }

            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format(@"EXISTS (FROM Location as p
                                                    WHERE p.Key=self.LocationName
                                                    AND p.ParentLocationName='{0}'
                                                    AND p.Level='{1}')"
                                             , locationName
                                             , Convert.ToInt32(LocationLevel.Area))
                };

                MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);
                if (result.Code <= 0)
                {
                    lst = result.Data;
                }
            }
            return(Json(from item in lst
                        select new
            {
                Text = item.Key,
                Value = item.Key
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        //
        // GET: /FMM/LineStore/
        public async Task <ActionResult> Index()
        {
            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key"
                    };
                    MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new LineStoreQueryViewModel()));
        }
Exemplo n.º 10
0
        public IEnumerable <SelectListItem> GetLineStoreNameList()
        {
            //获取用户拥有权限的线边仓名称。
            IList <Resource> lstResource = new List <Resource>();

            using (UserAuthenticateServiceClient client = new UserAuthenticateServiceClient())
            {
                MethodReturnResult <IList <Resource> > result = client.GetResourceList(HttpContext.Current.User.Identity.Name, ResourceType.LineStore);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstResource = result.Data;
                }
            }
            IList <LineStore> lst = new List <LineStore>();
            PagingConfig      cfg = new PagingConfig()
            {
                IsPaging = false,
                Where    = "Status=1",
                OrderBy  = "Type,Key"
            };

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }
            return(from item in lst
                   where lstResource.Any(m => m.Data.ToUpper() == item.Key.ToUpper())
                   select new SelectListItem()
            {
                Text = item.Key,
                Value = item.Key
            });
        }
Exemplo n.º 11
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 (LineStoreServiceClient client = new LineStoreServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
Exemplo n.º 12
0
        public ActionResult GetLineStoreNames(string routeOperationName, string productionLineCode)
        {
            string locationName = string.Empty;

            //获取生产线所在区域
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <ProductionLine> result = client.Get(productionLineCode);
                if (result.Code <= 0 && result.Data != null)
                {
                    locationName = result.Data.LocationName;
                }
            }
            //获取区域所在车间。
            using (LocationServiceClient client = new LocationServiceClient())
            {
                MethodReturnResult <Location> result = client.Get(locationName);
                if (result.Code <= 0 && result.Data != null)
                {
                    locationName = result.Data.ParentLocationName;
                }
            }
            IList <LineStore> lstLineStore = new List <LineStore>();

            //根据车间和工序获取线边仓。
            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format(@"LocationName='{0}' 
                                            AND (RouteOperationName IS NULL OR RouteOperationName='' OR RouteOperationName='{1}')
                                            AND Type='{2}'
                                            AND Status='{3}'"
                                             , locationName
                                             , routeOperationName
                                             , Convert.ToInt32(EnumLineStoreType.Material)
                                             , Convert.ToInt32(EnumObjectStatus.Available))
                };

                MethodReturnResult <IList <LineStore> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstLineStore = result.Data;
                }
            }
            //根据用户获取拥有权限的线边仓。
            IList <Resource> lstResource = new List <Resource>();

            using (UserAuthenticateServiceClient client = new UserAuthenticateServiceClient())
            {
                MethodReturnResult <IList <Resource> > result = client.GetResourceList(User.Identity.Name, ResourceType.LineStore);
                if (result.Code <= 0 && result.Data != null)
                {
                    lstResource = result.Data;
                }
            }

            var lnq = from item in lstLineStore
                      where lstResource.Any(m => m.Data == item.Key)
                      select new
            {
                Key = item.Key
            };

            return(Json(lnq, JsonRequestBehavior.AllowGet));
        }