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

            try
            {
                using (DefectServiceClient client = new DefectServiceClient())
                {
                    DefectKey key = new DefectKey()
                    {
                        Year                   = year,
                        Month                  = month,
                        Day                    = day,
                        LocationName           = locationname == null ? "" : locationname,
                        ShiftName              = shiftname,
                        ReasonCodeCategoryName = reasoncodecategoryname,
                        ReasonCodeName         = reasoncodename
                    };

                    result = await client.DeleteAsync(key);

                    if (result.Code == 0)
                    {
                        result.Message = string.Format(PPMResources.StringResource.Defect_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="shiftname">班别</param>
        /// <param name="reasoncodecategoryname">不良组</param>
        /// <param name="reasoncodename">不良原因</param>
        /// <returns></returns>
        public async Task <ActionResult> Detail(string year, string month, string day, string locationname, string shiftname, string reasoncodecategoryname, string reasoncodename)
        {
            MethodReturnResult <Defect> result = new MethodReturnResult <Defect>();

            try
            {
                DefectViewModel viewModel = new DefectViewModel();

                using (DefectServiceClient client = new DefectServiceClient())
                {
                    DefectKey key = new DefectKey()
                    {
                        Year                   = year,
                        Month                  = month,
                        Day                    = day,
                        LocationName           = locationname == null ? "" : locationname,
                        ShiftName              = shiftname,
                        ReasonCodeCategoryName = reasoncodecategoryname,
                        ReasonCodeName         = reasoncodename
                    };

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

                    if (result.Code == 0)
                    {
                        viewModel = new DefectViewModel()
                        {
                            Year         = result.Data.Key.Year,
                            Month        = result.Data.Key.Month,
                            Day          = result.Data.Key.Day,
                            LocationName = result.Data.Key.LocationName,
                            ShiftName    = result.Data.Key.ShiftName,
                            Qty          = result.Data.Qty,
                            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));
            }
        }