Exemplo n.º 1
0
        public async Task <ActionResult> SaveModify(ProductionLineViewModel model)
        {
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <ProductionLine> result = await client.GetAsync(model.Code);

                if (result.Code == 0)
                {
                    result.Data.Name         = model.Name;
                    result.Data.LocationName = model.LocationName;
                    result.Data.Description  = model.Description;
                    result.Data.Attr1        = model.Attr1;
                    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.ProductionLine_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Exemplo n.º 2
0
        //
        // GET: /FMM/ProductionLine/Detail
        public async Task <ActionResult> Detail(string key)
        {
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <ProductionLine> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    ProductionLineViewModel viewModel = new ProductionLineViewModel()
                    {
                        Code         = result.Data.Key,
                        Name         = result.Data.Name,
                        LocationName = result.Data.LocationName,
                        Attr1        = result.Data.Attr1,
                        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"));
        }
Exemplo n.º 3
0
        public IEnumerable <SelectListItem> GetLineCodeList()
        {
            IList <ProductionLine> lst = new List <ProductionLine>();

            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false
                };
                MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);

                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }
            var lnq = (from item in lst
                       where string.IsNullOrEmpty(item.Attr1) == false
                       select item.Attr1).Distinct();

            return(from item in lnq
                   orderby item
                   select new SelectListItem
            {
                Text = item,
                Value = item
            });
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Save(ProductionLineViewModel model)
        {
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                ProductionLine obj = new ProductionLine()
                {
                    Key          = model.Code,
                    Name         = model.Name,
                    LocationName = model.LocationName,
                    Attr1        = model.Attr1,
                    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.ProductionLine_Save_Success
                                                , model.Code);
                }
                return(Json(rst));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 根据车间取得相应的线别列表
        /// </summary>
        /// <param name="locatioName"></param>
        /// <returns></returns>
        public ActionResult GetLineCodeListByLocation(string locationName)
        {
            IList <ProductionLine> lst = new List <ProductionLine>();

            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)),
                    OrderBy = "Key"
                };

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

                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }

            return(Json(from item in lst
                        select new
            {
                Text = item.Name,
                Value = item.Key
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public IEnumerable <SelectListItem> GetProductionLineList(string RouteStepName)
        {
            //获取生产线。
            IList <Resource>       lstResource = new List <Resource>();
            IList <ProductionLine> lst         = new List <ProductionLine>();
            PagingConfig           cfg         = new PagingConfig()
            {
                IsPaging = false,
                Where    = string.Format(@"LocationName='{0}' ",
                                         RouteStepName)
            };

            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <IList <ProductionLine> > 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 = string.Format("{0}[{1}]", item.Name, item.Key),
                Value = item.Key
            });
        }
Exemplo n.º 7
0
 public ProductionLine GetProductionLine(string lineCode)
 {
     using (ProductionLineServiceClient client = new ProductionLineServiceClient())
     {
         MethodReturnResult <ProductionLine> result = client.Get(lineCode);
         return(result.Data);
     }
 }
Exemplo n.º 8
0
        public ActionResult GetHighchartsResult(WIPMoveForStepDataViewModel model)
        {
            string lineName = "102B-D线";

            //1 进站 2 出站 5 报废 6 不良 7 补料
            DataTable           dtMoveDataForStepData = new DataTable();
            WIPMoveGetParameter Parameter             = new WIPMoveGetParameter()
            {
                StartTime    = model.StartTime,
                EndTime      = model.EndTime,
                MaterialCode = model.MaterialCode,
                StepName     = model.StepName,
                LocationName = model.LocationName,
                ShiftName    = model.ShiftName,
                OrderNumber  = model.OrderNumber
            };

            IList <ProductionLine> lst = new List <ProductionLine>();
            PagingConfig           cfg = new PagingConfig()
            {
                IsPaging = false,
                Where    = string.Format("Name!='{0}'", lineName)
            };

            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }



            using (WIPMoveServiceClient client = new WIPMoveServiceClient())
            {
                MethodReturnResult <DataSet> rst = client.GetWipMoveForStep(Parameter);
                if (rst.Code <= 0 && rst.Data != null && rst.Data.Tables.Count > 0)
                {
                    dtMoveDataForStepData = rst.Data.Tables[0];
                }
            }

            if (dtMoveDataForStepData != null && dtMoveDataForStepData.Rows.Count > 0)
            {
                sl = AssembleSpline(dtMoveDataForStepData, lst);
            }
            return(Json(sl, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        public async Task <ActionResult> Query(ProductionLineQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (ProductionLineServiceClient client = new ProductionLineServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (!string.IsNullOrEmpty(model.Code))
                            {
                                where.AppendFormat(" {0} Key LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.Code);
                            }

                            if (!string.IsNullOrEmpty(model.Name))
                            {
                                where.AppendFormat(" {0} Name 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);
                            }
                        }
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "Key",
                            Where   = where.ToString()
                        };
                        MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
Exemplo n.º 10
0
        public async Task <ActionResult> Delete(string key)
        {
            MethodReturnResult result = new MethodReturnResult();

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

                if (result.Code == 0)
                {
                    result.Message = string.Format(FMMResources.StringResource.ProductionLine_Delete_Success
                                                   , key);
                }
                return(Json(result));
            }
        }
Exemplo n.º 11
0
        public IEnumerable <SelectListItem> GetProductionLineList()
        {
            //获取用户拥有权限的生产线代码。
            IList <Resource> lstResource = new List <Resource>();

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

            //获取生产线。
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false
                };

                MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);
                if (result.Code <= 0)
                {
                    lstProductionLine = result.Data;
                }
            }

            List <SelectListItem> lst = (from item in lstProductionLine
                                         where lstResource.Any(m => m.Data == item.Key)
                                         orderby item.LocationName
                                         select new SelectListItem()
            {
                Text = item.Key,
                Value = item.Key
            }).ToList();

            if (lst.Count > 0)
            {
                lst[0].Selected = true;
            }
            return(lst);
        }
Exemplo n.º 12
0
        //
        // GET: /FMM/ProductionLine/
        public async Task <ActionResult> Index()
        {
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key"
                    };
                    MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new ProductionLineQueryViewModel()));
        }
Exemplo n.º 13
0
        public IEnumerable <SelectListItem> GetProductionLineCodeList()
        {
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false
                };

                MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);
                if (result.Code <= 0)
                {
                    return(from item in result.Data
                           select new SelectListItem()
                    {
                        Text = item.Key,
                        Value = item.Key
                    });
                }
            }
            return(new List <SelectListItem>());
        }
Exemplo n.º 14
0
        public IEnumerable <SelectListItem> GetLineCodeList()
        {
            IList <ProductionLine> lst = new List <ProductionLine>();
            PagingConfig           cfg = new PagingConfig()
            {
                IsPaging = false
            };

            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }
            return(from item in lst
                   select new SelectListItem()
            {
                Text = item.Key,
                Value = item.Key
            });
        }
Exemplo n.º 15
0
        /// <summary>
        /// 取得线别代码
        /// </summary>
        /// <returns></returns>
        public IEnumerable <SelectListItem> GetLineList()
        {
            //获取用户拥有权限的生产线。
            IList <Resource> lstResource = new List <Resource>();

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

            IList <ProductionLine> lst = new List <ProductionLine>();
            PagingConfig           cfg = new PagingConfig()
            {
                IsPaging = false
            };

            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                MethodReturnResult <IList <ProductionLine> > 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 = string.Format("{0}[{1}]", item.Name, item.Key),
                Value = item.Key
            });
        }
Exemplo n.º 16
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 (ProductionLineServiceClient client = new ProductionLineServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
Exemplo n.º 17
0
        public ActionResult Save(LotPackageViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                //获取批次数据。
                string lotNumber = model.LotNumber.ToUpper();
                result = GetLot(lotNumber);
                if (result.Code > 0)
                {
                    return(Json(result));
                }
                MethodReturnResult <Lot> rst = result as MethodReturnResult <Lot>;
                Lot obj = rst.Data;

                //如果包装号为空。生成包装号。
                if (string.IsNullOrEmpty(model.PackageNo))
                {
                    using (LotPackageServiceClient client = new LotPackageServiceClient())
                    {
                        MethodReturnResult <string> rst1 = client.Generate(model.LotNumber, model.IsLastestPackage);
                        if (rst1.Code > 0)
                        {
                            return(Json(rst1));
                        }
                        else
                        {
                            model.PackageNo = rst1.Data;
                        }
                    }
                }
                //重新获取当前数量。
                using (PackageQueryServiceClient client = new PackageQueryServiceClient())
                {
                    MethodReturnResult <Package> rst2 = client.Get(model.PackageNo);
                    if (rst2.Code == 1000)
                    {
                        return(Json(rst2));
                    }
                    //检查包装状态
                    if (rst2.Data != null && rst2.Data.PackageState != EnumPackageState.Packaging)
                    {
                        result.Code    = 1001;
                        result.Message = string.Format("包 {0} 非 [{1}] 状态,不能包装。"
                                                       , model.PackageNo.ToUpper()
                                                       , EnumPackageState.Packaging.GetDisplayName());
                        return(Json(result));
                    }
                    //设置当前数量。
                    if (rst2.Code <= 0 && rst2.Data != null)
                    {
                        model.CurrentQuantity = rst2.Data.Quantity;
                    }
                }
                //如果满包数量为空,获取满包数量
                if (model.FullQuantity == 0)
                {
                    using (WorkOrderAttributeServiceClient client = new WorkOrderAttributeServiceClient())
                    {
                        MethodReturnResult <WorkOrderAttribute> rst1 = client.Get(new WorkOrderAttributeKey()
                        {
                            OrderNumber   = obj.OrderNumber,
                            AttributeName = "FullPackageQuantity"
                        });
                        double fullQuantity = 25;
                        if (rst1.Code == 1000)
                        {
                            return(Json(rst1));
                        }

                        if (rst1.Data != null &&
                            !string.IsNullOrEmpty(rst1.Data.AttributeValue))
                        {
                            double.TryParse(rst1.Data.AttributeValue, out fullQuantity);
                        }
                        model.FullQuantity = fullQuantity;
                    }
                }


                double newCurrentQuantity = model.CurrentQuantity + obj.Quantity;
                //当前数量超过满包数量,不能继续包装。
                if (newCurrentQuantity > model.FullQuantity)
                {
                    result.Code    = 1;
                    result.Message = string.Format("包({0}) 当前数量({1})加上批次({2})数量({3}),超过满包数量。"
                                                   , model.PackageNo.ToUpper()
                                                   , model.CurrentQuantity
                                                   , obj.Key
                                                   , obj.Quantity);
                    return(Json(result));
                }
                model.CurrentQuantity = newCurrentQuantity;

                //判断批次工序是否在当前工序。
                if (obj.RouteStepName != model.RouteOperationName)
                {
                    result.Code    = 2;
                    result.Message = string.Format("批次({0})当前所在工序({1}),不能在({2})工序上操作。"
                                                   , obj.Key
                                                   , obj.RouteStepName
                                                   , model.RouteOperationName);
                    return(Json(result));
                }
                //判断批次所在车间和当前线所在车间是否匹配。
                //获取线别车间。
                string locationName = string.Empty;
                using (ProductionLineServiceClient client = new ProductionLineServiceClient())
                {
                    MethodReturnResult <ProductionLine> r = client.Get(model.LineCode);
                    if (r.Code <= 0)
                    {
                        locationName = r.Data.LocationName;
                    }
                }
                if (!string.IsNullOrEmpty(locationName))
                {
                    using (LocationServiceClient client = new LocationServiceClient())
                    {
                        MethodReturnResult <Location> r = client.Get(locationName);
                        if (r.Code <= 0)
                        {
                            locationName = r.Data.ParentLocationName;
                        }
                    }
                }
                //检查批次车间和线别车间是否匹配。
                if (obj.LocationName != locationName)
                {
                    result.Code    = 3;
                    result.Message = string.Format("批次({0})属于({1})车间,不能在({2})车间线别上操作。"
                                                   , lotNumber.ToUpper()
                                                   , obj.LocationName
                                                   , locationName);
                    return(Json(result));
                }
                result = Package(model);
                //返回包装结果。
                if (result.Code <= 0)
                {
                    MethodReturnResult <LotPackageViewModel> rstFinal = new MethodReturnResult <LotPackageViewModel>()
                    {
                        Code     = result.Code,
                        Data     = model,
                        Detail   = result.Detail,
                        HelpLink = result.HelpLink,
                        Message  = result.Message
                    };
                    return(Json(rstFinal));
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }
Exemplo n.º 18
0
        public ActionResult Finish(LotPackageViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                //如果包装号为空。
                if (string.IsNullOrEmpty(model.PackageNo))
                {
                    result.Code    = 1001;
                    result.Message = string.Format("包装号不能为空。");
                    return(Json(result));
                }
                Package obj = null;
                //如果当前数量为空,获取当前数量
                using (PackageQueryServiceClient client = new PackageQueryServiceClient())
                {
                    MethodReturnResult <Package> rst2 = client.Get(model.PackageNo);
                    if (rst2.Code > 0)
                    {
                        return(Json(rst2));
                    }
                    //检查包装状态
                    if (rst2.Data.PackageState != EnumPackageState.Packaging)
                    {
                        result.Code    = 1001;
                        result.Message = string.Format("包 {0} 非{1}状态,不能操作。"
                                                       , model.PackageNo.ToUpper()
                                                       , EnumPackageState.Packaging.GetDisplayName());
                        return(Json(result));
                    }
                    //设置当前数量。
                    if (rst2.Code <= 0 && rst2.Data != null)
                    {
                        obj = rst2.Data;
                        model.CurrentQuantity = rst2.Data.Quantity;
                    }
                }
                //如果满包数量为空,获取满包数量
                if (model.FullQuantity == 0)
                {
                    using (WorkOrderAttributeServiceClient client = new WorkOrderAttributeServiceClient())
                    {
                        MethodReturnResult <WorkOrderAttribute> rst1 = client.Get(new WorkOrderAttributeKey()
                        {
                            OrderNumber   = obj.OrderNumber,
                            AttributeName = "FullPackageQuantity"
                        });
                        double fullQuantity = 25;
                        if (rst1.Code == 1000)
                        {
                            return(Json(rst1));
                        }

                        if (rst1.Data != null &&
                            !string.IsNullOrEmpty(rst1.Data.AttributeValue))
                        {
                            double.TryParse(rst1.Data.AttributeValue, out fullQuantity);
                        }
                        model.FullQuantity = fullQuantity;
                    }
                }
                //非尾包,不能完成包装并过站
                if (model.IsFinishPackage == true &&
                    model.IsLastestPackage == false &&
                    model.CurrentQuantity != model.FullQuantity)
                {
                    result.Code    = 1;
                    result.Message = string.Format("包({0})非尾包,包装数量未达到满包数量,不能完成包装。"
                                                   , model.PackageNo);
                    return(Json(result));
                }
                //判断批次所在车间和当前线所在车间是否匹配。
                //获取线别车间。
                string locationName = string.Empty;
                using (ProductionLineServiceClient client = new ProductionLineServiceClient())
                {
                    MethodReturnResult <ProductionLine> r = client.Get(model.LineCode);
                    if (r.Code <= 0)
                    {
                        locationName = r.Data.LocationName;
                    }
                }
                if (!string.IsNullOrEmpty(locationName))
                {
                    using (LocationServiceClient client = new LocationServiceClient())
                    {
                        MethodReturnResult <Location> r = client.Get(locationName);
                        if (r.Code <= 0)
                        {
                            locationName = r.Data.ParentLocationName;
                        }
                    }
                }
                //获取包装号所在车间。
                string currentLocationName = string.Empty;
                using (WorkOrderServiceClient client = new WorkOrderServiceClient())
                {
                    MethodReturnResult <WorkOrder> rst1 = client.Get(obj.OrderNumber);
                    if (rst1.Code <= 0 && rst1.Data != null)
                    {
                        currentLocationName = rst1.Data.LocationName;
                    }
                }
                //检查包所在车间和线别车间是否匹配。
                if (currentLocationName != locationName)
                {
                    result.Code    = 3;
                    result.Message = string.Format("包({0})属于({1})车间,不能在({2})车间线别上操作。"
                                                   , obj.Key
                                                   , currentLocationName
                                                   , locationName);
                    return(Json(result));
                }
                result = Package(model);
                //返回包装结果。
                if (result.Code <= 0)
                {
                    MethodReturnResult <LotPackageViewModel> rstFinal = new MethodReturnResult <LotPackageViewModel>()
                    {
                        Code     = result.Code,
                        Data     = model,
                        Detail   = result.Detail,
                        HelpLink = result.HelpLink,
                        Message  = result.Message
                    };
                    return(Json(rstFinal));
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }
Exemplo n.º 19
0
        public ActionResult GetCode(string q, string group, string lineCode, bool isChange)
        {
            string packageNo = string.Empty;

            //生成包装号。
            if (isChange)
            {
                string line = string.Empty;
                using (ProductionLineServiceClient client = new ProductionLineServiceClient())
                {
                    MethodReturnResult <ProductionLine> result = client.Get(lineCode);
                    if (result.Code <= 0)
                    {
                        line = result.Data.Attr1;
                    }
                }
                if (!string.IsNullOrEmpty(line))
                {
                    string prefix = string.Format("C{0:yyMMdd}{1}", DateTime.Now, line);
                    int    itemNo = 0;
                    using (PackageInfoServiceClient client = new PackageInfoServiceClient())
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = 0,
                            PageSize = 1,
                            Where    = string.Format("Key LIKE '{0}%'"
                                                     , prefix),
                            OrderBy = "Key Desc"
                        };
                        MethodReturnResult <IList <PackageInfo> > result = client.Get(ref cfg);
                        if (result.Code <= 0 && result.Data.Count > 0)
                        {
                            string maxPackageNo = result.Data[0].Key.Replace(prefix, "");
                            int.TryParse(maxPackageNo, out itemNo);
                        }
                        itemNo++;
                    }
                    packageNo = prefix + itemNo.ToString("0000");
                }
            }
            //获取配置信息。
            using (EfficiencyConfigurationServiceClient client = new EfficiencyConfigurationServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Key.Code LIKE '{0}%' AND Key.Group='{1}'"
                                             , q
                                             , group)
                };
                MethodReturnResult <IList <EfficiencyConfiguration> > result = client.Get(ref cfg);
                if (result.Code <= 0)
                {
                    return(Json(from item in result.Data
                                select new
                    {
                        @label = item.Key.Code,
                        @value = item.Key.Code,
                        @Name = item.Name,
                        @Lower = item.Lower,
                        @Upper = item.Upper,
                        @Grade = item.Grade,
                        @Color = item.Color,
                        @PackageNo = packageNo,
                        @MaterialCode = item.MaterialCode ?? string.Empty
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 20
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));
        }
Exemplo n.º 21
0
        public ActionResult Query(OEEDailyDataViewModel model)
        {
            DataTable dtWIPDailyData = new DataTable();



            using (OEEDataServiceClient client = new OEEDataServiceClient())
            {
                MethodReturnResult <DataSet> rst = client.GetOEEDailyData(new OEEDataGetParameter()
                {
                    StartDate = model.StartDate,
                    EndDate   = model.EndDate,
                    StepName  = model.EquipmentName,
                    //LocationName = model.LocationName
                    LocationName = model.LocationName
                });
                if (rst.Code <= 0 && rst.Data != null && rst.Data.Tables.Count > 0)
                {
                    dtWIPDailyData = rst.Data.Tables["dtQTY"];
                }
            }
            DataTable dt = new DataTable();
            //增加状态列
            DataColumn dcStatus = new DataColumn("项目");

            dt.Columns.Add(dcStatus);
            dcStatus = new DataColumn("LINK");
            dt.Columns.Add(dcStatus);
            #region 创建动态列
            DateTime dCurDateTime = System.DateTime.Now;
            if (DateTime.TryParse(model.EndDate, out dCurDateTime) == false)
            {
                //日期格式不正确
                return(View());
            }
            System.Collections.Hashtable hsDrawLinesX = new System.Collections.Hashtable();
            List <string> lstColums = new List <string>();
            var           query     = from t in dtWIPDailyData.AsEnumerable()
                                      //where (t.Field<string>("DataType") == "D")
                                      group t by new { t1 = t.Field <string>("RPT_DATE") }
            into m
                          select new
            {
                RPT_DATE = m.First().Field <string>("RPT_DATE")
            } into r
            orderby r.RPT_DATE
            select r;


            int icount = 0;
            foreach (var data in query)
            {
                if (data.RPT_DATE.Contains("累计"))
                {
                    //string s = data.RPT_DATE.Substring(5, data.RPT_DATE.Length - 7);
                    //string date = string.Format("{0:M}", Convert.ToDateTime(data.RPT_DATE.Substring(5, data.RPT_DATE.Length - 7).ToString()));
                    lstColums.Add("期间累计");
                }
                else
                {
                    lstColums.Add(Convert.ToDateTime(data.RPT_DATE).GetDateTimeFormats('M')[0].ToString());
                }
            }

            DataColumn col;
            string     strColumns = string.Empty;
            foreach (string s in lstColums)
            {
                if (dt.Columns.Contains(s) == false)
                {
                    if (s.Contains("累计"))
                    {
                        dt.Columns.Add(s).SetOrdinal(icount + 2);
                    }
                    else
                    {
                        col = new DataColumn(s);
                        dt.Columns.Add(col);
                    }
                }
            }

            #endregion

            #region //定义行
            DataRow dr = dt.NewRow();

            #region 根据用户选项,得到对应线别
            using (ProductionLineServiceClient client = new ProductionLineServiceClient())
            {
                model.LocationName  = "102A";
                StringBuilder where = new StringBuilder();
                if (model != null)
                {
                    if (!string.IsNullOrEmpty(model.LocationName))
                    {
                        where.AppendFormat(" {0} Key LIKE '{1}%'"
                                           , where.Length > 0 ? "AND" : string.Empty
                                           , model.LocationName);
                    }
                }
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = where.ToString()
                };

                MethodReturnResult <IList <ProductionLine> > result = client.Get(ref cfg);
                if (result.Code == 0)
                {
                    ViewBag.List = result.Data;
                }
            }
            #endregion

            #region 得到相应原因代码
            IList <EquipmentReasonCodeCategory> lst = null;
            MethodReturnResult <IList <EquipmentReasonCodeCategory> > resultReason = null;
            using (EquipmentReasonCodeCategoryServiceClient client = new EquipmentReasonCodeCategoryServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    //Where = "Key.Type='0'"
                };
                resultReason = client.Get(ref cfg);
                if (resultReason.Code <= 0 && resultReason.Data != null)
                {
                    lst = resultReason.Data;
                }
            }

            #endregion


            dr    = dt.NewRow();
            dr[0] = "OEE";
            dr[1] = "###";
            dt.Rows.Add(dr);

            dr    = dt.NewRow();
            dr[0] = "稼动率";
            dr[1] = "/RPT/OEEDailyData/ActRate";
            dt.Rows.Add(dr);

            dr    = dt.NewRow();
            dr[0] = "良率";
            dr[1] = "###";
            dt.Rows.Add(dr);


            #region 一整天数据
            for (int i = 0; i < resultReason.Data.Count; i++)
            {
                EquipmentReasonCodeCategory obj = lst[i];
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;" + obj.Key;
                dr[1] = "####";
                dt.Rows.Add(dr);
                //obj.Key
            }

            #endregion

            #region 白班数据
            for (int i = 0; i < resultReason.Data.Count; i++)
            {
                EquipmentReasonCodeCategory obj = lst[i];
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;白班" + obj.Key;
                dr[1] = "####";
                dt.Rows.Add(dr);
                //obj.Key
            }

            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;白班合计";
            dr[1] = "###";
            dt.Rows.Add(dr);

            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;白班可用总时间";
            dr[1] = "###";
            dt.Rows.Add(dr);

            for (int i = 0; i < resultReason.Data.Count; i++)
            {
                EquipmentReasonCodeCategory obj = lst[i];
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;白班" + obj.Key + "%";
                dr[1] = "####";
                dt.Rows.Add(dr);
                //obj.Key
            }
            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;白班时间稼动率";
            dr[1] = "###";
            dt.Rows.Add(dr);

            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;白班性能稼动率";
            dr[1] = "###";
            dt.Rows.Add(dr);

            #endregion

            #region 夜班数据
            for (int i = 0; i < resultReason.Data.Count; i++)
            {
                EquipmentReasonCodeCategory obj = lst[i];
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;夜班" + obj.Key;
                dr[1] = "####";
                dt.Rows.Add(dr);
                //obj.Key
            }

            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;夜班合计";
            dr[1] = "###";
            dt.Rows.Add(dr);

            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;夜班可用总时间";
            dr[1] = "###";
            dt.Rows.Add(dr);

            for (int i = 0; i < resultReason.Data.Count; i++)
            {
                EquipmentReasonCodeCategory obj = lst[i];
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;夜班" + obj.Key + "%";
                dr[1] = "####";
                dt.Rows.Add(dr);
                //obj.Key
            }
            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;夜班时间稼动率";
            dr[1] = "###";
            dt.Rows.Add(dr);

            dr    = dt.NewRow();
            dr[0] = "&nbsp;&nbsp;夜班性能稼动率";
            dr[1] = "###";
            dt.Rows.Add(dr);

            #endregion

            #region 白班分线别数据
            for (int i = 0; i < ViewBag.List.Length; i++)
            {
                ProductionLine obj = ViewBag.List[i];
                for (int j = 0; j < resultReason.Data.Count; j++)
                {
                    EquipmentReasonCodeCategory objReason = lst[j];
                    dr    = dt.NewRow();
                    dr[0] = "&nbsp;&nbsp;白班" + obj.Key + objReason.Key;
                    dr[1] = "####";
                    dt.Rows.Add(dr);
                }
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;白班" + obj.Key + "合计";
                dr[1] = "###";
                dt.Rows.Add(dr);

                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;白班可用总时间";
                dr[1] = "###";
                dt.Rows.Add(dr);
                for (int j = 0; j < resultReason.Data.Count; j++)
                {
                    EquipmentReasonCodeCategory objReason = lst[j];
                    dr    = dt.NewRow();
                    dr[0] = "&nbsp;&nbsp;白班" + obj.Key + objReason.Key + "%";
                    dr[1] = "####";
                    dt.Rows.Add(dr);
                }
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;白班" + obj.Key + "时间稼动率";
                dr[1] = "###";
                dt.Rows.Add(dr);

                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;白班" + obj.Key + "性能稼动率";
                dr[1] = "###";
                dt.Rows.Add(dr);
            }


            #endregion

            #region 夜班分线别数据
            for (int i = 0; i < ViewBag.List.Length; i++)
            {
                ProductionLine obj = ViewBag.List[i];
                for (int j = 0; j < resultReason.Data.Count; j++)
                {
                    EquipmentReasonCodeCategory objReason = lst[j];
                    dr    = dt.NewRow();
                    dr[0] = "&nbsp;&nbsp;夜班" + obj.Key + objReason.Key;
                    dr[1] = "####";
                    dt.Rows.Add(dr);
                }
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;夜班" + obj.Key + "合计";
                dr[1] = "###";
                dt.Rows.Add(dr);

                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;夜班" + obj.Key + "可用总时间";
                dr[1] = "###";
                dt.Rows.Add(dr);
                for (int j = 0; j < resultReason.Data.Count; j++)
                {
                    EquipmentReasonCodeCategory objReason = lst[j];
                    dr    = dt.NewRow();
                    dr[0] = "&nbsp;&nbsp;夜班" + obj.Key + objReason.Key + "%";
                    dr[1] = "####";
                    dt.Rows.Add(dr);
                }
                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;夜班" + obj.Key + "时间稼动率";
                dr[1] = "###";
                dt.Rows.Add(dr);

                dr    = dt.NewRow();
                dr[0] = "&nbsp;&nbsp;夜班" + obj.Key + "性能稼动率";
                dr[1] = "###";
                dt.Rows.Add(dr);
            }


            #endregion
            #endregion

            string strColName = "";
            string strIType   = "";
            string strFlag    = "";
            int    indexOfCol = 0;
            int    selOfCol   = -1;
            int    selOfRow   = -1;
            string nValue     = "0";
            string a          = "1";
            string b          = "KPcs";
            try
            {
                for (int i = 0; i < dtWIPDailyData.Rows.Count; i++)
                {
                    strColName = dtWIPDailyData.Rows[i]["RPT_DATE"].ToString();    //获取日期
                    //获取数据类型字段
                    strFlag = dtWIPDailyData.Rows[i]["QTY_FLAG"].ToString();       //获取数据类型信息

                    strIType = dtWIPDailyData.Rows[i]["BUSINESS_TYPE"].ToString(); //获取字段信息
                    if (strColName.Contains("累计"))
                    {
                        string s    = strColName.Substring(5, strColName.Length - 7);
                        string date = string.Format("{0:M}", Convert.ToDateTime(strColName.Substring(5, strColName.Length - 7).ToString()));
                        //strColName = date + "累计";
                        strColName = "期间累计";
                    }
                    //天数据
                    else
                    {
                        strColName = Convert.ToDateTime(strColName).GetDateTimeFormats('M')[0].ToString();
                    }
                    selOfCol = -1;

                    //查询结果赋给每一列
                    for (indexOfCol = 0; indexOfCol < dt.Columns.Count; indexOfCol++)
                    {
                        if (dt.Columns[indexOfCol].ColumnName == strColName)
                        {
                            selOfCol = indexOfCol;
                            break;
                        }
                    }
                    if (selOfCol == -1)
                    {
                        continue;
                    }

                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        string strTType = "";
                        //strTType = dt.Rows[j]["项目"].ToString();
                        strTType = dt.Rows[j]["项目"].ToString().Trim("&.nbsp;".ToCharArray());

                        if (strTType.Equals(strIType))
                        {
                            try
                            {
                                //如果为比例,则在数据后边加%
                                if (strFlag.Equals(a))
                                {
                                    //nValue = Convert.ToString(dtWIPDailyData.Rows[i]["QTY"] + "%");
                                    nValue = Math.Round((Convert.ToDecimal(dtWIPDailyData.Rows[i]["QTY"])), 2).ToString() + "%";
                                }
                                else
                                {
                                    //nValue = Convert.ToString(dtWIPDailyData.Rows[i]["QTY"]);
                                    nValue = Math.Round((Convert.ToDecimal(dtWIPDailyData.Rows[i]["QTY"])), 2).ToString();
                                }
                            }
                            catch
                            {
                                nValue = "0";
                            }
                            dt.Rows[j][selOfCol] = nValue;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            ViewBag.ListData      = dt;
            ViewBag.StartDateTime = model.StartDate;
            ViewBag.EndDateTime   = model.EndDate;
            ViewBag.StepName      = model.EquipmentName;
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_ListPartial", model));
            }
            else
            {
                return(View(model));
            }
        }
Exemplo n.º 22
0
        public ActionResult Save(LotTrackViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            Response.StatusDescription = "JSON";
            try
            {
                string lotNumber = model.LotNumber.ToUpper();
                result = GetLot(lotNumber);
                if (result.Code > 0)
                {
                    return(Json(result));
                }

                MethodReturnResult <Lot> rst = result as MethodReturnResult <Lot>;
                Lot obj = rst.Data;
                //等待进站批次,设备代码必须选择。
                if (obj.StateFlag == EnumLotState.WaitTrackIn &&
                    string.IsNullOrEmpty(model.EquipmentCode))
                {
                    result.Code    = 1;
                    result.Message = string.Format("设备代码不能为空。");
                    return(Json(result));
                }
                //判断批次工序是否在当前工序。
                if (obj.RouteStepName != model.RouteOperationName)
                {
                    result.Code    = 2;
                    result.Message = string.Format("批次({0})当前所在工序({1}),不能在({2})工序上操作。"
                                                   , obj.Key
                                                   , obj.RouteStepName
                                                   , model.RouteOperationName);
                    return(Json(result));
                }
                //判断批次所在车间和当前线边所在车间是否匹配。
                //获取线别车间。
                string locationName = string.Empty;
                using (ProductionLineServiceClient client = new ProductionLineServiceClient())
                {
                    MethodReturnResult <ProductionLine> r = client.Get(model.LineCode);
                    if (r.Code <= 0)
                    {
                        locationName = r.Data.LocationName;
                    }
                }
                if (!string.IsNullOrEmpty(locationName))
                {
                    using (LocationServiceClient client = new LocationServiceClient())
                    {
                        MethodReturnResult <Location> r = client.Get(locationName);
                        if (r.Code <= 0)
                        {
                            locationName = r.Data.ParentLocationName;
                        }
                    }
                }
                //检查批次车间和线别车间是否匹配。
                if (obj.LocationName != locationName)
                {
                    result.Code    = 3;
                    result.Message = string.Format("批次({0})属于({1})车间,不能在({2})车间线别上操作。"
                                                   , lotNumber
                                                   , obj.LocationName
                                                   , locationName);
                    return(Json(result));
                }
                bool isShowModal = false;
                //获取工序参数列表。
                IList <RouteStepParameter> lstRouteStepParameter = GetParameterList(obj.RouteName, obj.RouteStepName, obj.StateFlag);
                if (lstRouteStepParameter != null && lstRouteStepParameter.Count > 0) //需要显示工序参数录入表单。
                {
                    isShowModal = true;
                }
                //出站,判断是否显示不良和报废录入对话框。
                if (obj.StateFlag == EnumLotState.WaitTrackOut)
                {
                    IList <RouteStepAttribute> lstRouteStepAttribute = new List <RouteStepAttribute>();
                    using (RouteStepAttributeServiceClient client = new RouteStepAttributeServiceClient())
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            IsPaging = false,
                            Where    = string.Format("Key.RouteName='{0}' AND Key.RouteStepName='{1}'"
                                                     , obj.RouteName
                                                     , obj.RouteStepName)
                        };
                        MethodReturnResult <IList <RouteStepAttribute> > r = client.Get(ref cfg);
                        if (r.Code <= 0 && r.Data != null)
                        {
                            lstRouteStepAttribute = r.Data;
                        }
                    }

                    //是否输入等级。
                    bool isInputGrade = false;
                    var  lnq          = from item in lstRouteStepAttribute
                                        where item.Key.AttributeName == "IsInputGrade"
                                        select item;
                    RouteStepAttribute rsaTmp = lnq.FirstOrDefault();
                    if (rsaTmp != null)
                    {
                        bool.TryParse(rsaTmp.Value, out isInputGrade);
                    }
                    //是否输入花色。
                    bool isInputColor = false;
                    lnq = from item in lstRouteStepAttribute
                          where item.Key.AttributeName == "IsInputColor"
                          select item;
                    rsaTmp = lnq.FirstOrDefault();
                    if (rsaTmp != null)
                    {
                        bool.TryParse(rsaTmp.Value, out isInputColor);
                    }

                    //获取是否显示不良原因录入对话框。
                    bool isShowDefectModal = false;
                    lnq = from item in lstRouteStepAttribute
                          where item.Key.AttributeName == "IsShowDefectModal"
                          select item;
                    rsaTmp = lnq.FirstOrDefault();
                    if (rsaTmp != null)
                    {
                        bool.TryParse(rsaTmp.Value, out isShowDefectModal);
                    }
                    //获取是否显示报废原因录入对话框。
                    bool isShowScrapModal = false;
                    lnq = from item in lstRouteStepAttribute
                          where item.Key.AttributeName == "IsShowScrapModal"
                          select item;
                    rsaTmp = lnq.FirstOrDefault();
                    if (rsaTmp != null)
                    {
                        bool.TryParse(rsaTmp.Value, out isShowScrapModal);
                    }
                    //是否输入等级
                    if (isInputGrade)
                    {
                        ViewBag.IsInputGrade = isInputGrade;
                        isShowModal          = true;
                    }
                    //是否输入花色
                    if (isInputColor)
                    {
                        ViewBag.IsInputColor = isInputColor;
                        isShowModal          = true;
                    }
                    //是否显示不良原因录入对话框。
                    if (isShowDefectModal)
                    {
                        IList <ReasonCodeCategoryDetail> lstDefectReasonCodes = GetDefectReasonCodes(obj.RouteName, obj.RouteStepName);
                        if (lstDefectReasonCodes != null && lstDefectReasonCodes.Count > 0)
                        {
                            isShowModal = true;
                        }
                    }
                    //是否显示报废原因录入对话框。
                    if (isShowScrapModal)
                    {
                        IList <ReasonCodeCategoryDetail> lstScrapReasonCodes = GetScrapReasonCodes(obj.RouteName, obj.RouteStepName);
                        if (lstScrapReasonCodes != null && lstScrapReasonCodes.Count > 0)
                        {
                            isShowModal = true;
                        }
                    }
                }
                //显示附加对话框。
                if (isShowModal)
                {
                    Response.StatusDescription = "Partial";
                    ViewBag.Lot = obj;
                    return(PartialView("_ModalContentPartial", new LotTrackViewModel()));
                }
                result = Track(obj, model);
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(Json(result));
        }
Exemplo n.º 23
0
 public IEnumerable <SelectListItem> GetScanCodeList()
 {
     if (localName == "K01")
     {
         MethodReturnResult <IList <Equipment> > result = new MethodReturnResult <IList <Equipment> >();
         IList <Equipment> lst = new List <Equipment>();
         using (EquipmentServiceClient client = new EquipmentServiceClient())
         {
             StringBuilder where = new StringBuilder();
             where.AppendFormat(" {0} Name LIKE 'Reader%'"
                                , where.Length > 0 ? "AND" : string.Empty);
             PagingConfig cfg = new PagingConfig()
             {
                 IsPaging = false,
                 OrderBy  = "Key",
                 Where    = where.ToString()
             };
             result = client.Get(ref cfg);
         }
         if (result.Code <= 0 && result.Data != null)
         {
             lst = result.Data;
         }
         return(from item in lst
                select new SelectListItem()
         {
             Value = item.Key,
             Text = item.LineCode
         });
     }
     else if (localName == "G01")
     {
         MethodReturnResult <IList <ProductionLine> > result = new MethodReturnResult <IList <ProductionLine> >();
         IList <ProductionLine> lst = new List <ProductionLine>();
         using (ProductionLineServiceClient client = new ProductionLineServiceClient())
         {
             StringBuilder where = new StringBuilder();
             //where.AppendFormat(" {0} Name LIKE 'Reader%'"
             //                            , where.Length > 0 ? "AND" : string.Empty);
             PagingConfig cfg = new PagingConfig()
             {
                 IsPaging = false,
                 OrderBy  = "Key"
             };
             result = client.Get(ref cfg);
         }
         if (result.Code <= 0 && result.Data != null)
         {
             lst = result.Data;
         }
         return(from item in lst
                select new SelectListItem()
         {
             Value = item.Key,
             Text = item.Key
         });
     }
     else
     {
         return(null);
     }
 }