Пример #1
0
        public async Task <ActionResult> Delete(string year, string month, string day, string locationname, string productcode)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                using (PlanDayServiceClient client = new PlanDayServiceClient())
                {
                    PlanDayKey key = new PlanDayKey()
                    {
                        Year         = year,
                        Month        = month,
                        Day          = day,
                        LocationName = locationname == null ? "" : locationname,
                        ProductCode  = productcode == null ? "" : productcode
                    };

                    result = await client.DeleteAsync(key);

                    if (result.Code == 0)
                    {
                        result.Message = string.Format(PPMResources.StringResource.PlanDay_Delete_Success, key);
                    }
                    else
                    {
                        //数据错误
                        result.Code    = result.Code;       //错误代码
                        result.Message = result.Message;    //错误信息
                        result.Detail  = result.Message;    //错误明细

                        return(Json(result));
                    }

                    return(Json(result));
                }
            }
            catch (Exception e)
            {
                result.Code    = 1002;
                result.Message = e.Message;
                result.Detail  = e.ToString();

                return(Json(result));
            }
        }
Пример #2
0
        /// <summary>
        /// 浏览信息
        /// </summary>
        /// <param name="year">年</param>
        /// <param name="month">月</param>
        /// <param name="day">日</param>
        /// <param name="locationname">车间</param>
        /// <param name="productcode">产品</param>
        /// <returns></returns>
        public async Task <ActionResult> Detail(string year, string month, string day, string locationname, string productcode)
        {
            MethodReturnResult <PlanDay> result = new MethodReturnResult <PlanDay>();

            try
            {
                PlanDayViewModel viewModel = new PlanDayViewModel();

                using (PlanDayServiceClient client = new PlanDayServiceClient())
                {
                    PlanDayKey key = new PlanDayKey()
                    {
                        Year         = year,
                        Month        = month,
                        Day          = day,
                        LocationName = locationname == null ? "" : locationname,
                        ProductCode  = productcode == null ? "" : productcode
                    };

                    //取得数据
                    result = await client.GetAsync(key);

                    if (result.Code == 0)
                    {
                        viewModel = new PlanDayViewModel()
                        {
                            Year                = result.Data.Key.Year,
                            Month               = result.Data.Key.Month,
                            Day                 = result.Data.Key.Day,
                            LocationName        = result.Data.Key.LocationName,
                            ProductCode         = result.Data.Key.ProductCode,
                            PlanQty             = (int)float.Parse(result.Data.PlanQty),
                            PlanWatt            = result.Data.PlanWatt,
                            PlanInQty           = result.Data.PlanInQty,
                            TargetDebrisRate    = result.Data.TargetDebrisRate,
                            PerCapitaEfficiency = result.Data.PerCapitaEfficiency,
                            BeforePressQRate    = result.Data.BeforePressQRate,
                            HProductARate       = result.Data.HProductARate,
                            ProductARate        = result.Data.ProductARate,
                            CreateTime          = result.Data.CreateTime,
                            Creator             = result.Data.Creator,
                            Editor              = result.Data.Editor,
                            EditTime            = result.Data.EditTime
                        };

                        return(PartialView("_InfoPartial", viewModel));
                    }
                    else
                    {
                        //数据错误
                        result.Code    = result.Code;       //错误代码
                        result.Message = result.Message;    //错误信息
                        result.Detail  = result.Message;    //错误明细

                        return(Json(result));
                    }
                }
            }
            catch (Exception e)
            {
                result.Code    = 1002;
                result.Message = e.Message;
                result.Detail  = e.ToString();

                return(Json(result));
            }
        }