コード例 #1
0
ファイル: LocationController.cs プロジェクト: 88886/jnmmes
        private void SetParentLocationNameViewData(string viewDataName, LocationLevel level)
        {
            SetViewData();
            if (level != LocationLevel.Factory)
            {
                using (LocationServiceClient client = new LocationServiceClient())
                {
                    LocationLevel parentLevel = LocationLevel.Factory;
                    if (level == LocationLevel.Area)
                    {
                        parentLevel = LocationLevel.Room;
                    }

                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        Where    = string.Format("Level='{0}'", Convert.ToInt32(parentLevel))
                    };

                    MethodReturnResult <IList <Location> > resultParentLocation = client.Get(ref cfg);
                    if (resultParentLocation.Code <= 0)
                    {
                        IEnumerable <SelectListItem> lst = from item in resultParentLocation.Data
                                                           select new SelectListItem()
                        {
                            Text  = item.Key,
                            Value = item.Key
                        };
                        ViewData[viewDataName] = lst;
                    }
                }
            }
        }
コード例 #2
0
ファイル: LocationController.cs プロジェクト: 88886/jnmmes
 public ActionResult GetParentLocations(LocationLevel?level)
 {
     if (level != null && level != LocationLevel.Factory)
     {
         using (LocationServiceClient client = new LocationServiceClient())
         {
             LocationLevel parentLevel = LocationLevel.Factory;
             if (level == LocationLevel.Area)
             {
                 parentLevel = LocationLevel.Room;
             }
             PagingConfig cfg = new PagingConfig()
             {
                 IsPaging = false,
                 Where    = string.Format("Level='{0}'", Convert.ToInt32(parentLevel))
             };
             MethodReturnResult <IList <Location> > result = client.Get(ref cfg);
             if (result.Code <= 0)
             {
                 if (Request.IsAjaxRequest())
                 {
                     return(Json(result.Data, JsonRequestBehavior.AllowGet));
                 }
                 else
                 {
                     return(View(""));
                 }
             }
         }
     }
     return(Json(new List <Location>(), JsonRequestBehavior.AllowGet));
 }
コード例 #3
0
        public IEnumerable <SelectListItem> GetLocation()
        {
            IList <Location> lst = new List <Location>();

            //获取车间名称
            using (LocationServiceClient client = new LocationServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = " Level='2'"
                };

                MethodReturnResult <IList <Location> > result = client.Get(ref cfg);
                if (result.Code <= 0)
                {
                    lst = result.Data;
                }
            }
            return(from item in lst
                   select new SelectListItem()
            {
                Text = item.Key,
                Value = item.Key
            });
        }
コード例 #4
0
ファイル: WorkOrderViewModels.cs プロジェクト: 88886/jnmmes
        /// <summary> 根据ERP车间代码取得MES车间代码 </summary>
        /// <param name="orderType">ERP车间代码</param>
        /// <returns></returns>
        public string GetLocationName(string ERPDeptCode)
        {
            string locationName = "";

            using (LocationServiceClient client = new LocationServiceClient())
            {
                //取得对应的ID号
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format(@"ERPDeptCode = '{0}'
                                           AND Level = '2'"
                                             , ERPDeptCode),
                    OrderBy = "Key"
                };

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

                if (result.Code == 0 && result.Data.Count > 0)
                {
                    locationName = result.Data[0].Key;
                }
            }

            return(locationName);
        }
コード例 #5
0
ファイル: LocationController.cs プロジェクト: 88886/jnmmes
        public async Task <ActionResult> Query(LocationQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (LocationServiceClient client = new LocationServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (model.Level != null)
                            {
                                where.AppendFormat("  Level = '{0}'"
                                                   , Convert.ToInt32(model.Level));
                            }
                            if (!string.IsNullOrEmpty(model.Name))
                            {
                                where.AppendFormat(" {0} Key LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.Name);
                            }

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

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
コード例 #6
0
ファイル: LocationController.cs プロジェクト: 88886/jnmmes
        //
        // GET: /FMM/Location/
        public async Task <ActionResult> Index()
        {
            using (LocationServiceClient client = new LocationServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key,Level"
                    };
                    MethodReturnResult <IList <Location> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            SetViewData();
            return(View(new LocationQueryViewModel()));
        }
コード例 #7
0
ファイル: WorkOrderViewModels.cs プロジェクト: 88886/jnmmes
        public IEnumerable <SelectListItem> GetLocationNameList()
        {
            using (LocationServiceClient client = new LocationServiceClient())
            {
                PagingConfig cfg = new PagingConfig()
                {
                    IsPaging = false,
                    Where    = string.Format("Level='{0}'", Convert.ToInt32(LocationLevel.Room))
                };

                MethodReturnResult <IList <Location> > 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>());
        }
コード例 #8
0
ファイル: LocationController.cs プロジェクト: 88886/jnmmes
        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 (LocationServiceClient client = new LocationServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <Location> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
コード例 #9
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));
        }
コード例 #10
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));
        }
コード例 #11
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));
        }
コード例 #12
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));
        }