public IHttpActionResult GetShipOrderInfo([FromUri] int shipOrderId, [FromUri] string operation)
        {
            if (operation == "BOL")
            {
                var pickDetailsInDb = _context.FBAPickDetails
                                      .Include(x => x.FBAShipOrder)
                                      .Include(x => x.FBAPickDetailCartons)
                                      .Include(x => x.FBAPalletLocation.FBAPallet.FBACartonLocations)
                                      .Where(x => x.FBAShipOrder.Id == shipOrderId)
                                      .ToList();

                var bolList = GenerateFBABOLList(pickDetailsInDb);

                var generator = new FBAExcelGenerator(@"D:\Template\BOL-Template.xlsx");

                var fileName = generator.GenerateExcelBol(shipOrderId, bolList);

                return(Ok(fileName));
            }
            else if (operation == "Update")
            {
                return(Ok(Mapper.Map <FBAShipOrder, FBAShipOrderDto>(_context.FBAShipOrders.Find(shipOrderId))));
            }
            else if (operation == "WO")
            {
                var shipOrder = _context.FBAShipOrders
                                .Include(x => x.FBAPickDetails)
                                .Include(x => x.ChargingItemDetails)
                                .SingleOrDefault(x => x.Id == shipOrderId);

                return(Ok(GenerateWorkOrder(shipOrder)));
            }

            return(Ok());
        }
Exemple #2
0
        public IHttpActionResult DownloadPickingList([FromUri] int shipOrderId, [FromUri] string operation)
        {
            var generator = new FBAExcelGenerator(@"D:\Template\PickingList-Template.xlsx");
            var path      = generator.GenerateShippingWOAndPickingList(shipOrderId);

            return(Ok(path));
        }
Exemple #3
0
        private string GenerateUnloadingWOAndPackingList(int masterOrderId)
        {
            var generator = new FBAExcelGenerator(@"D:\Template\UnloadingReport-Template.xlsx");
            var path      = generator.GenerateUnloadingWOAndPackingList(masterOrderId);

            return(path);
        }
        public IHttpActionResult GenerateNewStorageReport([FromUri] int templateId, [FromUri] string customerCode, [FromUri] DateTime lastBillingDate, [FromUri] DateTime currentBillingDate, [FromUri] float p1Discount, [FromUri] float p2Discount, [FromUri] bool isEstimatingCharge)
        {
            var closeDate = new DateTime(currentBillingDate.Year, currentBillingDate.Month, currentBillingDate.Day).AddDays(1);
            var startDate = new DateTime(lastBillingDate.Year, currentBillingDate.Month, currentBillingDate.Day);

            var warehouseLocationsInDb = _context2.WarehouseLocations.Select(x => x.WarehouseCode).ToArray();

            var customerId = _context2.UpperVendors.SingleOrDefault(x => x.CustomerCode == customerCode).Id;
            var generator  = new FBAExcelGenerator(@"D:\Template\StorageFee-Template.xlsx");
            var fullPath   = generator.GenerateStorageReport(customerId, lastBillingDate, closeDate, p1Discount, p2Discount, warehouseLocationsInDb, false);

            var chargeMethodsList = _context.ChargeMethods
                                    .Include(x => x.ChargeTemplate)
                                    .Where(x => x.ChargeTemplate.Id == templateId)
                                    .OrderBy(x => x.From)
                                    .ToList();

            var calculator = new InventoryFeeCalculator(fullPath);

            calculator.RecalculateInventoryFeeInExcel(chargeMethodsList, chargeMethodsList.First().TimeUnit, lastBillingDate.ToString("yyyy-MM-dd"), currentBillingDate.ToString("yyyy-MM-dd"));

            //强行关闭Excel进程
            var killer = new ExcelKiller();

            killer.Dispose();

            return(Ok(fullPath));
        }
        public IHttpActionResult GenerateNewStorageReportThroughPayload([FromBody] StorageChargePayload data)
        {
            var closeDate = new DateTime(data.CurrentBillingDate.Year, data.CurrentBillingDate.Month, data.CurrentBillingDate.Day).AddDays(1);
            var startDate = new DateTime(data.LastBillingDate.Year, data.CurrentBillingDate.Month, data.CurrentBillingDate.Day);

            var warehouseLocationsInDb = _context2.WarehouseLocations.Select(x => x.WarehouseCode).ToArray();
            var warehouseLocations     = data.WarehouseLocation.Length > 0 ? data.WarehouseLocation : warehouseLocationsInDb;

            var customerId = _context2.UpperVendors.SingleOrDefault(x => x.CustomerCode == data.CustomerCode).Id;
            var generator  = new FBAExcelGenerator(@"D:\Template\StorageFee-Template.xlsx");
            var fullPath   = generator.GenerateStorageReport(customerId, data.LastBillingDate, closeDate, data.P1Discount, data.P2Discount, warehouseLocations, data.IncludePrereleasedOrder);

            var chargeMethodsList = _context.ChargeMethods
                                    .Include(x => x.ChargeTemplate)
                                    .Where(x => x.ChargeTemplate.Id == data.TemplateId)
                                    .OrderBy(x => x.From)
                                    .ToList();

            var calculator = new InventoryFeeCalculator(fullPath);

            calculator.RecalculateInventoryFeeInExcel(chargeMethodsList, chargeMethodsList.First().TimeUnit, data.LastBillingDate.ToString("yyyy-MM-dd"), data.CurrentBillingDate.ToString("yyyy-MM-dd"));

            //强行关闭Excel进程
            var killer = new ExcelKiller();

            killer.Dispose();

            return(Ok(fullPath));
        }
Exemple #6
0
        public IHttpActionResult DownloadBOL([FromUri] int masterOrderId, [FromUri] string freightCharge, [FromUri] string operatorName, [FromBody] BOLInfo bolInfo)
        {
            var bolList = GenerateFBABOLList(bolInfo.OrderDetails);

            var generator = new FBAExcelGenerator(@"D:\Template\BOL-Template.xlsx");

            var fileName = generator.GenerateExcelBol(masterOrderId, FBAOrderType.MasterOrder, bolList, freightCharge, bolInfo.BOLDetail);

            return(Ok(fileName));
        }
        public IHttpActionResult GetByOperationById([FromUri] int masterOrderId, [FromUri] string operation)
        {
            if (operation == FBAOperation.Download)
            {
                var generator = new FBAExcelGenerator(@"D:\Template\Receipt-template.xlsx");

                var fullPath = generator.GenerateReceipt(masterOrderId);

                return(Ok(fullPath));
            }

            return(Ok("Invalid operation."));
        }
        public IHttpActionResult GetByOperation([FromUri] string grandNumber, [FromUri] string operation)
        {
            if (operation == FBAOperation.Download)
            {
                var masterOrderId = _context.FBAMasterOrders.SingleOrDefault(x => x.GrandNumber == grandNumber).Id;

                var generator = new FBAExcelGenerator(@"D:\Template\Receipt-template.xlsx");

                var fullPath = generator.GenerateReceipt(masterOrderId);

                return(Ok(fullPath));
            }

            return(Ok("Invalid operation."));
        }