public IHttpActionResult DownloadInventoryReport([FromUri] string customerCode, [FromUri] DateTime startDate, [FromUri] DateTime closeDate, [FromUri] string operation)
        {
            startDate = new DateTime(startDate.Year, startDate.Month, startDate.Day);
            closeDate = new DateTime(closeDate.Year, closeDate.Month, closeDate.Day).AddDays(1);

            var templatePath = @"D:\Template\FBA-Inventory-Template.xls";

            var helper = new FBAInventoryHelper(templatePath);

            var customerInventoryList = helper.GetFBAInventoryResidualInfo(customerCode, startDate, closeDate);

            if (operation == FBAOperation.Download)
            {
                helper.GenerateFBAInventoryReport(customerInventoryList);

                return(Ok());
            }
            else if (operation == "DownloadFile")
            {
                return(Ok(helper.GenerateAndReturnFBAInventoryReportPath(customerInventoryList)));
            }

            return(Ok(customerInventoryList.FBACtnInventories));

            //阻塞线程,等待生成EXCEL方法执行完毕返回路径字符串后才执行下面的步骤

            //var handler = new GenerateFBAInventoryReportHandler(helper.GenerateFBAInventoryReport);
            //var downloadSourcePath = handler.Invoke(customerInventoryList);
            //var downloadHandler = new DownloadGeneralFileFromServer(downloader.DownloadGeneralFileFromServer);
            //downloadHandler.Invoke(downloadSourcePath, customerCode + " Inventory Report", ".xls");
        }
コード例 #2
0
        public IHttpActionResult GetRemainCustomerList([FromUri] string closeDate)
        {
            var helper = new FBAInventoryHelper();

            var customerInventoryList = helper.ReturnNonZeroCBMInventoryInfo(closeDate);

            return(Ok(customerInventoryList));
        }
        public IHttpActionResult GetRemainCustomerList([FromUri] string customerCode, [FromUri] DateTime startDate, [FromUri] DateTime closeDate)
        {
            startDate = new DateTime(startDate.Year, startDate.Month, startDate.Day);
            closeDate = new DateTime(closeDate.Year, closeDate.Month, closeDate.Day).AddDays(1);

            var helper = new FBAInventoryHelper();

            if (customerCode == "ALL")
            {
                var customerInventoryList = helper.ReturnNonZeroCBMInventoryInfo(startDate, closeDate);

                return(Ok(customerInventoryList));
            }
            else
            {
                var list = new List <FBAInventoryInfo>();
                //var result = helper.ReturnInventoryInfoByCustomerCode(customerCode, closeDate);
                var result = helper.GetFBAInventoryResidualInfo(customerCode, startDate, closeDate);
                list.Add(result);

                return(Ok(list));
            }
        }
 public FBAInventoryAPIController()
 {
     _context         = new ApplicationDbContext();
     _validator       = new FBAexAPIValidator();
     _inventoryHelper = new FBAInventoryHelper();
 }