Example #1
0
        //

        // GET: /ZPVM/WorkOrderPowersetDetail/
        public async Task <ActionResult> Index(string OrderNumber, string MaterialCode, string code, int?itemNo)
        {
            if (string.IsNullOrEmpty(code) || itemNo == null)
            {
                return(RedirectToAction("Index", "WorkOrderPowerset"));
            }

            using (WorkOrderPowersetServiceClient client = new WorkOrderPowersetServiceClient())
            {
                WorkOrderPowersetKey key = new WorkOrderPowersetKey()
                {
                    MaterialCode = MaterialCode,
                    OrderNumber  = OrderNumber,
                    Code         = code,
                    ItemNo       = itemNo.Value
                };
                MethodReturnResult <WorkOrderPowerset> result = await client.GetAsync(key);

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

            using (WorkOrderPowersetDetailServiceClient client = new WorkOrderPowersetDetailServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        Where = string.Format(" Key.Code = '{0}' AND Key.ItemNo='{1}' AND Key.MaterialCode='{2}' AND Key.OrderNumber='{3}'"
                                              , code
                                              , itemNo
                                              , MaterialCode
                                              , OrderNumber),
                        OrderBy = "Key.ItemNo"
                    };
                    MethodReturnResult <IList <WorkOrderPowersetDetail> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }
            return(View(new WorkOrderPowersetDetailQueryViewModel()
            {
                OrderNumber = OrderNumber, MaterialCode = MaterialCode, Code = code, ItemNo = itemNo.Value
            }));
        }
Example #2
0
        //
        // GET: /ZPVM/WorkOrderPowerset/Detail
        public async Task <ActionResult> Detail(string orderNumber, string materialCode, string code, int itemNo)
        {
            using (WorkOrderPowersetServiceClient client = new WorkOrderPowersetServiceClient())
            {
                WorkOrderPowersetKey key = new WorkOrderPowersetKey()
                {
                    OrderNumber  = orderNumber,
                    MaterialCode = materialCode,
                    Code         = code,
                    ItemNo       = itemNo
                };
                MethodReturnResult <WorkOrderPowerset> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    WorkOrderPowersetViewModel viewModel = new WorkOrderPowersetViewModel()
                    {
                        OrderNumber     = result.Data.Key.OrderNumber,
                        MaterialCode    = result.Data.Key.MaterialCode,
                        Code            = result.Data.Key.Code,
                        ArticleNo       = result.Data.ArticleNo,
                        ItemNo          = result.Data.Key.ItemNo,
                        PowerName       = result.Data.PowerName,
                        SubWay          = result.Data.SubWay,
                        StandardVPM     = result.Data.StandardVPM,
                        StandardVoc     = result.Data.StandardVoc,
                        StandardPower   = result.Data.StandardPower,
                        StandardIsc     = result.Data.StandardIsc,
                        StandardIPM     = result.Data.StandardIPM,
                        StandardFuse    = result.Data.StandardFuse,
                        PowerDifference = result.Data.PowerDifference,
                        MaxValue        = result.Data.MaxValue,
                        MinValue        = result.Data.MinValue,
                        Name            = result.Data.Name,
                        Description     = result.Data.Description,
                        MixColor        = result.Data.MixColor,
                        IsUsed          = result.Data.IsUsed,
                        CreateTime      = result.Data.CreateTime,
                        Creator         = result.Data.Creator,
                        Editor          = result.Data.Editor,
                        EditTime        = result.Data.EditTime
                    };
                    return(PartialView("_InfoPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_InfoPartial", new WorkOrderPowersetViewModel()));
        }
Example #3
0
        public async Task <ActionResult> Delete(string orderNumber, string materialCode, string code, int itemNo)
        {
            MethodReturnResult   result = new MethodReturnResult();
            WorkOrderPowersetKey key    = new WorkOrderPowersetKey()
            {
                OrderNumber  = orderNumber,
                MaterialCode = materialCode,
                Code         = code,
                ItemNo       = itemNo
            };

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

                if (result.Code == 0)
                {
                    result.Message = string.Format(ZPVMResources.StringResource.WorkOrderPowerset_Delete_Success
                                                   , key);
                }
                return(Json(result));
            }
        }
Example #4
0
        public async Task <ActionResult> SaveModify(WorkOrderPowersetViewModel model)
        {
            using (WorkOrderPowersetServiceClient client = new WorkOrderPowersetServiceClient())
            {
                WorkOrderPowersetKey key = new WorkOrderPowersetKey()
                {
                    OrderNumber  = model.OrderNumber,
                    MaterialCode = model.MaterialCode,
                    Code         = model.Code,
                    ItemNo       = model.ItemNo ?? 0
                };
                MethodReturnResult <WorkOrderPowerset> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    result.Data.ArticleNo       = model.ArticleNo;
                    result.Data.MaxValue        = model.MaxValue;
                    result.Data.MinValue        = model.MinValue;
                    result.Data.Name            = model.Name;
                    result.Data.PowerDifference = model.PowerDifference;
                    result.Data.PowerName       = model.PowerName;
                    result.Data.StandardFuse    = model.StandardFuse;
                    result.Data.StandardIPM     = model.StandardIPM;
                    result.Data.StandardIsc     = model.StandardIsc;
                    result.Data.StandardPower   = model.StandardPower;
                    result.Data.StandardVoc     = model.StandardVoc;
                    result.Data.StandardVPM     = model.StandardVPM;
                    result.Data.SubWay          = model.SubWay;
                    result.Data.Description     = model.Description;
                    result.Data.MixColor        = model.MixColor;
                    result.Data.IsUsed          = model.IsUsed;
                    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(ZPVMResources.StringResource.WorkOrderPowerset_SaveModify_Success
                                                    , model.Code);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }


            //using (WorkOrderPowersetServiceClient client = new WorkOrderPowersetServiceClient())
            //{
            //    WorkOrderPowerset orderPowerset = new WorkOrderPowerset();

            //    orderPowerset.ArticleNo = model.ArticleNo;
            //    orderPowerset.MaxValue = model.MaxValue;
            //    orderPowerset.MinValue = model.MinValue;
            //    orderPowerset.Name = model.Name;
            //    orderPowerset.PowerDifference = model.PowerDifference;
            //    orderPowerset.PowerName = model.PowerName;
            //    orderPowerset.StandardFuse = model.StandardFuse;
            //    orderPowerset.StandardIPM = model.StandardIPM;
            //    orderPowerset.StandardIsc = model.StandardIsc;
            //    orderPowerset.StandardPower = model.StandardPower;
            //    orderPowerset.StandardVoc = model.StandardVoc;
            //    orderPowerset.StandardVPM = model.StandardVPM;
            //    orderPowerset.SubWay = model.SubWay;
            //    orderPowerset.Description = model.Description;
            //    orderPowerset.MixColor = model.MixColor;
            //    orderPowerset.IsUsed = model.IsUsed;
            //    orderPowerset.Editor = User.Identity.Name;
            //    orderPowerset.EditTime = DateTime.Now;

            //    MethodReturnResult rst = await client.ModifyAsync(orderPowerset);

            //    if (rst.Code == 0)
            //    {
            //        rst.Message = string.Format(ZPVMResources.StringResource.WorkOrderPowerset_SaveModify_Success
            //                                    , model.Code);
            //    }

            //    return Json(rst);
            //}
        }