示例#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>());
        }
示例#2
0
        //
        // GET: /FMM/LineStore/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                MethodReturnResult <LineStore> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    LineStoreViewModel viewModel = new LineStoreViewModel()
                    {
                        Name = result.Data.Key,
                        RouteOperationName = result.Data.RouteOperationName,
                        LocationName       = result.Data.LocationName,
                        Type        = result.Data.Type,
                        CreateTime  = result.Data.CreateTime,
                        Creator     = result.Data.Creator,
                        Description = result.Data.Description,
                        Editor      = result.Data.Editor,
                        EditTime    = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial"));
        }
示例#3
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>());
        }
示例#4
0
        public async Task <ActionResult> SaveModify(LineStoreViewModel model)
        {
            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                MethodReturnResult <LineStore> result = await client.GetAsync(model.Name);

                if (result.Code == 0)
                {
                    result.Data.Type = model.Type;
                    result.Data.RouteOperationName = model.RouteOperationName;
                    result.Data.LocationName       = model.LocationName;
                    result.Data.Description        = model.Description;
                    result.Data.Editor             = User.Identity.Name;
                    result.Data.EditTime           = DateTime.Now;
                    MethodReturnResult rst = await client.ModifyAsync(result.Data);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(FMMResources.StringResource.LineStore_SaveModify_Success
                                                    , model.Name);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
示例#5
0
        public async Task <ActionResult> Save(LineStoreViewModel model)
        {
            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                LineStore obj = new LineStore()
                {
                    Key = model.Name,
                    RouteOperationName = model.RouteOperationName,
                    Type         = model.Type,
                    LocationName = model.LocationName,
                    Description  = model.Description,
                    Editor       = User.Identity.Name,
                    EditTime     = DateTime.Now,
                    CreateTime   = DateTime.Now,
                    Creator      = User.Identity.Name
                };
                MethodReturnResult rst = await client.AddAsync(obj);

                if (rst.Code == 0)
                {
                    rst.Message = string.Format(FMMResources.StringResource.LineStore_Save_Success
                                                , model.Name);
                }
                return(Json(rst));
            }
        }
示例#6
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"));
        }
示例#7
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));
        }
示例#8
0
        public async Task <ActionResult> Delete(string key)
        {
            MethodReturnResult result = new MethodReturnResult();

            using (LineStoreServiceClient client = new LineStoreServiceClient())
            {
                result = await client.DeleteAsync(key);

                if (result.Code == 0)
                {
                    result.Message = string.Format(FMMResources.StringResource.LineStore_Delete_Success
                                                   , key);
                }
                return(Json(result));
            }
        }
示例#9
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);
        }
示例#10
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));
        }
示例#11
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));
        }
示例#13
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()));
        }
示例#14
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
            });
        }
示例#15
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"));
        }
示例#16
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));
        }