public ActionResult IVS170_GenerateReport(IVS170_doGetStockCheckingList cond)
        {
            List <dtStockCheckingList> list = new List <dtStockCheckingList>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                // Model validation
                if (ModelState.IsValid == false)
                {
                    ValidatorUtil.BuildErrorMessage(res, this);
                    if (res.IsError)
                    {
                        return(Json(res));
                    }
                }

                //Validate #1
                //if (CommonUtil.IsNullAllField(cond))
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                //    return Json(res);
                //}

                //Validate #2
                if ((!CommonUtil.IsNullOrEmpty(cond.ShelfNoFrom)) &&
                    (!CommonUtil.IsNullOrEmpty(cond.ShelfNoTo)) &&
                    (String.Compare(cond.ShelfNoFrom, cond.ShelfNoTo) > 0))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4015, null, new string[] { "ShelfNoFrom", "ShelfNoTo" });
                    return(Json(res));
                }

                IInventoryHandler handler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                list = handler.GetStockCheckingList(cond);

                if (list == null || list.Count <= 0)
                {
                    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001, null, null);
                    return(Json(res));
                }

                IVS170_ScreenParameter    param      = GetScreenObject <IVS170_ScreenParameter>();
                IInventoryDocumentHandler docService = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler;
                param.PendingDownloadFilePath = docService.GenerateIVS170StockTakingResult(list, cond);
                param.PendingDownloadFileName = "StockDifferenceList.xlsx";

                res.ResultData = true;
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }
            return(Json(res));
        }
        /// <summary>
        /// Search stock checking list.
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public ActionResult IVS170_SearchResponse(IVS170_doGetStockCheckingList cond)
        {
            List <dtStockCheckingList> list = new List <dtStockCheckingList>();

            ObjectResultData res = new ObjectResultData();

            res.MessageType = MessageModel.MESSAGE_TYPE.WARNING;

            try
            {
                // Model validation
                if (ModelState.IsValid == false)
                {
                    ValidatorUtil.BuildErrorMessage(res, this);
                    if (res.IsError)
                    {
                        return(Json(res));
                    }
                }

                //Validate #1
                //if (CommonUtil.IsNullAllField(cond))
                //{
                //    res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006);
                //    return Json(res);
                //}

                //Validate #2
                if ((!CommonUtil.IsNullOrEmpty(cond.ShelfNoFrom)) &&
                    (!CommonUtil.IsNullOrEmpty(cond.ShelfNoTo)) &&
                    (String.Compare(cond.ShelfNoFrom, cond.ShelfNoTo) > 0))
                {
                    res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4015, null, new string[] { "ShelfNoFrom", "ShelfNoTo" });
                    return(Json(res));
                }

                IInventoryHandler handler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler;
                list = handler.GetStockCheckingList(cond);
            }
            catch (Exception ex)
            {
                res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
                res.AddErrorMessage(ex);
            }

            res.ResultData = CommonUtil.ConvertToXml <dtStockCheckingList>(list, "Inventory\\IVS170", CommonUtil.GRID_EMPTY_TYPE.VIEW);
            return(Json(res));
        }