Exemplo n.º 1
0
        public async Task <ActionResult> SaveModify(CheckSettingViewModel model)
        {
            using (CheckSettingServiceClient client = new CheckSettingServiceClient())
            {
                MethodReturnResult <CheckSetting> result = await client.GetAsync(model.Key);

                if (result.Code == 0)
                {
                    result.Data.ActionName          = model.ActionName;
                    result.Data.EquipmentCode       = model.EquipmentCode;
                    result.Data.MaterialCode        = model.MaterialCode;
                    result.Data.MaterialType        = model.MaterialType;
                    result.Data.ProductionLineCode  = model.ProductionLineCode;
                    result.Data.RouteEnterpriseName = model.RouteEnterpriseName;
                    result.Data.RouteName           = model.RouteName;
                    result.Data.RouteStepName       = model.RouteStepName;
                    result.Data.RouteOperationName  = model.RouteOperationName;
                    result.Data.Status      = model.Status;
                    result.Data.Description = model.Description;
                    result.Data.Editor      = User.Identity.Name;
                    result.Data.EditTime    = DateTime.Now;
                    MethodReturnResult rst = await client.ModifyAsync(result.Data);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(QAMResources.StringResource.CheckSetting_SaveModify_Success
                                                    , model.GroupName);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Save(CheckSettingViewModel model)
        {
            using (CheckSettingServiceClient client = new CheckSettingServiceClient())
            {
                CheckSetting obj = new CheckSetting()
                {
                    Key                 = Convert.ToString(Guid.NewGuid()),
                    GroupName           = model.GroupName.ToUpper(),
                    ActionName          = model.ActionName,
                    EquipmentCode       = model.EquipmentCode,
                    MaterialCode        = model.MaterialCode,
                    MaterialType        = model.MaterialType,
                    ProductionLineCode  = model.ProductionLineCode,
                    RouteEnterpriseName = model.RouteEnterpriseName,
                    RouteName           = model.RouteName,
                    RouteOperationName  = model.RouteOperationName,
                    RouteStepName       = model.RouteStepName,
                    Status              = model.Status,
                    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(QAMResources.StringResource.CheckSetting_Save_Success
                                                , model.GroupName);
                }
                return(Json(rst));
            }
        }
        //
        // GET: /QAM/CheckSettingPointDetail/
        public async Task <ActionResult> Index(string checksettingKey, int itemNo)
        {
            string groupName = string.Empty;

            using (CheckSettingServiceClient client = new CheckSettingServiceClient())
            {
                MethodReturnResult <CheckSetting> result = await client.GetAsync(checksettingKey ?? string.Empty);

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

            using (CheckSettingPointServiceClient client = new CheckSettingPointServiceClient())
            {
                MethodReturnResult <CheckSettingPoint> result = await client.GetAsync(new CheckSettingPointKey()
                {
                    CheckSettingKey = checksettingKey,
                    ItemNo          = itemNo
                });

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

            using (CheckSettingPointDetailServiceClient client = new CheckSettingPointDetailServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "Key.ItemNo",
                        Where   = string.Format(" Key.CheckSettingKey = '{0}' AND Key.ItemNo='{1}'"
                                                , checksettingKey
                                                , itemNo)
                    };
                    MethodReturnResult <IList <CheckSettingPointDetail> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new CheckSettingPointDetailQueryViewModel()
            {
                CheckSettingKey = checksettingKey, GroupName = groupName, ItemNo = itemNo
            }));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Delete(string key)
        {
            MethodReturnResult result = new MethodReturnResult();

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

                if (result.Code == 0)
                {
                    result.Message = string.Format(QAMResources.StringResource.CheckSetting_Delete_Success, key);
                }
                return(Json(result));
            }
        }
Exemplo n.º 5
0
 public ActionResult GetCheckSetting(string groupName)
 {
     using (CheckSettingServiceClient client = new CheckSettingServiceClient())
     {
         PagingConfig cfg = new PagingConfig()
         {
             PageNo   = 0,
             PageSize = 1,
             Where    = string.Format("GroupName='{0}'", groupName)
         };
         MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);
         if (result.Code <= 0 && result.Data != null && result.Data.Count > 0)
         {
             return(Json(new
             {
                 ActionName = result.Data[0].ActionName.ToString()
             }, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(null, JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 6
0
        //
        // GET: /QAM/CheckSetting/
        public async Task <ActionResult> Index()
        {
            using (CheckSettingServiceClient client = new CheckSettingServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        OrderBy = "GroupName"
                    };
                    MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new CheckSettingQueryViewModel()));
        }
Exemplo n.º 7
0
        //
        // GET: /QAM/CheckSetting/Modify
        public async Task <ActionResult> Modify(string key)
        {
            CheckSettingViewModel viewModel = new CheckSettingViewModel();

            using (CheckSettingServiceClient client = new CheckSettingServiceClient())
            {
                MethodReturnResult <CheckSetting> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    viewModel = new CheckSettingViewModel()
                    {
                        Key                 = result.Data.Key,
                        ActionName          = result.Data.ActionName,
                        GroupName           = result.Data.GroupName,
                        RouteStepName       = result.Data.RouteStepName,
                        RouteOperationName  = result.Data.RouteOperationName,
                        RouteName           = result.Data.RouteName,
                        RouteEnterpriseName = result.Data.RouteEnterpriseName,
                        ProductionLineCode  = result.Data.ProductionLineCode,
                        MaterialType        = result.Data.MaterialType,
                        MaterialCode        = result.Data.MaterialCode,
                        EquipmentCode       = result.Data.EquipmentCode,
                        Status              = result.Data.Status,
                        CreateTime          = result.Data.CreateTime,
                        Creator             = result.Data.Creator,
                        Description         = result.Data.Description,
                        Editor              = result.Data.Editor,
                        EditTime            = result.Data.EditTime
                    };
                    return(PartialView("_ModifyPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_ModifyPartial"));
        }
Exemplo n.º 8
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 (CheckSettingServiceClient client = new CheckSettingServiceClient())
                {
                    await Task.Run(() =>
                    {
                        PagingConfig cfg = new PagingConfig()
                        {
                            PageNo   = pageNo,
                            PageSize = pageSize,
                            Where    = where ?? string.Empty,
                            OrderBy  = orderBy ?? string.Empty
                        };
                        MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);
                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }
Exemplo n.º 9
0
        public async Task <ActionResult> Query(CheckSettingQueryViewModel model)
        {
            if (ModelState.IsValid)
            {
                using (CheckSettingServiceClient client = new CheckSettingServiceClient())
                {
                    await Task.Run(() =>
                    {
                        StringBuilder where = new StringBuilder();
                        if (model != null)
                        {
                            if (!string.IsNullOrEmpty(model.GroupName))
                            {
                                where.AppendFormat(" {0} GroupName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.GroupName);
                            }
                            if (!string.IsNullOrEmpty(model.MaterialType))
                            {
                                where.AppendFormat(" {0} MaterialType LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.MaterialType);
                            }
                            if (!string.IsNullOrEmpty(model.MaterialCode))
                            {
                                where.AppendFormat(" {0} MaterialCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.MaterialCode);
                            }
                            if (!string.IsNullOrEmpty(model.RouteEnterpriseName))
                            {
                                where.AppendFormat(" {0} RouteEnterpriseName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteEnterpriseName);
                            }
                            if (!string.IsNullOrEmpty(model.RouteName))
                            {
                                where.AppendFormat(" {0} RouteName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteName);
                            }
                            if (!string.IsNullOrEmpty(model.RouteStepName))
                            {
                                where.AppendFormat(" {0} RouteStepName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteStepName);
                            }
                            if (!string.IsNullOrEmpty(model.RouteOperationName))
                            {
                                where.AppendFormat(" {0} RouteOperationName LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.RouteOperationName);
                            }
                            if (!string.IsNullOrEmpty(model.ProductionLineCode))
                            {
                                where.AppendFormat(" {0} ProductionLineCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.ProductionLineCode);
                            }
                            if (!string.IsNullOrEmpty(model.EquipmentCode))
                            {
                                where.AppendFormat(" {0} EquipmentCode LIKE '{1}%'"
                                                   , where.Length > 0 ? "AND" : string.Empty
                                                   , model.EquipmentCode);
                            }
                        }
                        PagingConfig cfg = new PagingConfig()
                        {
                            OrderBy = "GroupName",
                            Where   = where.ToString()
                        };
                        MethodReturnResult <IList <CheckSetting> > result = client.Get(ref cfg);

                        if (result.Code == 0)
                        {
                            ViewBag.PagingConfig = cfg;
                            ViewBag.List         = result.Data;
                        }
                    });
                }
            }
            return(PartialView("_ListPartial"));
        }