|
|
@@ -26,6 +26,7 @@ using ShwasherSys.Invoice.Dto;
|
|
|
using ShwasherSys.Lambda;
|
|
|
using ShwasherSys.OrderSendInfo;
|
|
|
using ShwasherSys.OrderSendInfo.Dto;
|
|
|
+using ShwasherSys.ProductInfo;
|
|
|
|
|
|
namespace ShwasherSys.Invoice
|
|
|
{
|
|
|
@@ -41,7 +42,9 @@ namespace ShwasherSys.Invoice
|
|
|
protected IRepository<BusinessLog> BusinessLogRepository { get; }
|
|
|
protected IRepository<ViewStickBill,string> ViewStickBillRepository { get; }
|
|
|
protected IRepository<ViewStatementBill> ViewStatementBillRepository { get; }
|
|
|
- public OrderStickBillAppService(IRepository<OrderStickBill, string> repository, IRepository<ViewCustomerStick> viewCustomerStickRepository, ISqlExecuter sqlExecute, IRepository<Customer, string> customerRepository, IRepository<OrderSend> orderSendRepository, IRepository<BusinessLog> businessLogRepository, IRepository<ViewStickBill, string> viewStickBillRepository,IRepository<ViewOrderSendStickBill> viewOrderSendStickBillRepository, IRepository<OrderSendBill, string> orderSendBillRepository, IRepository<ViewStatementBill> viewStatementBillRepository) : base(repository)
|
|
|
+
|
|
|
+ protected IQueryAppService QueryAppService { get; }
|
|
|
+ public OrderStickBillAppService(IRepository<OrderStickBill, string> repository, IRepository<ViewCustomerStick> viewCustomerStickRepository, ISqlExecuter sqlExecute, IRepository<Customer, string> customerRepository, IRepository<OrderSend> orderSendRepository, IRepository<BusinessLog> businessLogRepository, IRepository<ViewStickBill, string> viewStickBillRepository,IRepository<ViewOrderSendStickBill> viewOrderSendStickBillRepository, IRepository<OrderSendBill, string> orderSendBillRepository, IRepository<ViewStatementBill> viewStatementBillRepository,IQueryAppService queryAppService) : base(repository)
|
|
|
{
|
|
|
ViewCustomerStickRepository = viewCustomerStickRepository;
|
|
|
SqlExecute = sqlExecute;
|
|
|
@@ -53,6 +56,7 @@ namespace ShwasherSys.Invoice
|
|
|
OrderSendBillRepository = orderSendBillRepository;
|
|
|
ViewStatementBillRepository = viewStatementBillRepository;
|
|
|
KeyIsAuto = false;
|
|
|
+ QueryAppService = queryAppService;
|
|
|
}
|
|
|
|
|
|
protected override string GetPermissionName { get; set; } = PermissionNames.PagesInvoiceInfoInvoiceMg;
|
|
|
@@ -419,6 +423,10 @@ namespace ShwasherSys.Invoice
|
|
|
var bill = ObjectMapper.Map<OrderSendBillDto>(
|
|
|
OrderSendBillRepository.Get(orderSends.First().OrderSendBillNo));
|
|
|
var customerInfo = await CustomerRepository.FirstOrDefaultAsync(bill.CustomerId);
|
|
|
+
|
|
|
+ var customerDefaultProducts = await QueryAppService.GetCustomerDefaultProductByCustomerId(customerInfo.Id);
|
|
|
+ var productProperties = await QueryAppService.GetProductProperty(ProductProperty.ProductMaterial + "");
|
|
|
+
|
|
|
string path = AppDomain.CurrentDomain.BaseDirectory + "Resources/InvoiceTemplate/对账单导出模板.xlsx";
|
|
|
var savePath = "Download/Excel/InvoiceBill";
|
|
|
var work = ExcelHelper.CreateWorkBook07(path);
|
|
|
@@ -450,34 +458,40 @@ namespace ShwasherSys.Invoice
|
|
|
var totalNoTaxprice = $"{(send.SendQuantity ?? 0) * send.AfterTaxPrice:N3}";
|
|
|
var sendDate = $"{send.SendDate:yyyy-MM-dd}";
|
|
|
currencyId = send.CurrencyId;
|
|
|
+ string productHsCode =
|
|
|
+ CommonQueryService.GetProductHsCode(send.CustomerId, send.ProductNo, customerDefaultProducts);
|
|
|
+ string materialHsCode =
|
|
|
+ CommonQueryService.GetMaterialHsCode(send.ProductNo, productProperties);
|
|
|
sheet1.GenerateCell(8 + index, 1).SetValue<int>(index + 1);
|
|
|
sheet1.GenerateCell(8 + index, 2).SetValue(send.StockNo ?? send.OrderNo);
|
|
|
sheet1.GenerateCell(8 + index, 3).SetValue(send.OrderSendBillNo ?? "");
|
|
|
sheet1.GenerateCell(8 + index, 4).SetValue(sendDate);
|
|
|
sheet1.GenerateCell(8 + index, 5).SetValue(send.PartNo ?? "");
|
|
|
- sheet1.GenerateCell(8 + index, 6).SetValue(send.Model ?? "");
|
|
|
- sheet1.GenerateCell(8 + index, 7).SetValue(send.Material ?? "");
|
|
|
- sheet1.GenerateCell(8 + index, 8).SetValue(send.ProductName ?? "");
|
|
|
- sheet1.GenerateCell(8 + index, 9).SetValue(send.Rigidity ?? "");
|
|
|
- sheet1.GenerateCell(8 + index, 10).SetValue(send.SurfaceColor ?? "");
|
|
|
- sheet1.GenerateCell(8 + index, 11).SetValue<decimal>(sendQuantity);
|
|
|
- sheet1.GenerateCell(8 + index, 12).SetValue(send.OrderUnitName??"");
|
|
|
+ sheet1.GenerateCell(8 + index, 6).SetValue(productHsCode);
|
|
|
+ sheet1.GenerateCell(8 + index, 7).SetValue(send.Model ?? "");
|
|
|
+ sheet1.GenerateCell(8 + index, 8).SetValue(send.Material ?? "");
|
|
|
+ sheet1.GenerateCell(8 + index, 9).SetValue(materialHsCode);
|
|
|
+ sheet1.GenerateCell(8 + index, 10).SetValue(send.ProductName ?? "");
|
|
|
+ sheet1.GenerateCell(8 + index, 11).SetValue(send.Rigidity ?? "");
|
|
|
+ sheet1.GenerateCell(8 + index, 12).SetValue(send.SurfaceColor ?? "");
|
|
|
+ sheet1.GenerateCell(8 + index, 13).SetValue<decimal>(sendQuantity);
|
|
|
+ sheet1.GenerateCell(8 + index, 14).SetValue(send.OrderUnitName??"");
|
|
|
if (isCanViewPrice)
|
|
|
{
|
|
|
- sheet1.GenerateCell(8 + index, 13).SetValue<decimal>(price);
|
|
|
- sheet1.GenerateCell(8 + index, 14).SetValue<decimal>(noTaxprice);
|
|
|
- sheet1.GenerateCell(8 + index, 15).SetValue<decimal>(logisticsFee);
|
|
|
- sheet1.GenerateCell(8 + index, 16).SetValue<decimal>(moldFee);
|
|
|
- sheet1.GenerateCell(8 + index, 17).SetValue<decimal>(totalprice);
|
|
|
- sheet1.GenerateCell(8 + index, 18).SetValue<decimal>(totalNoTaxprice);
|
|
|
+ sheet1.GenerateCell(8 + index, 15).SetValue<decimal>(price);
|
|
|
+ sheet1.GenerateCell(8 + index, 16).SetValue<decimal>(noTaxprice);
|
|
|
+ sheet1.GenerateCell(8 + index, 17).SetValue<decimal>(logisticsFee);
|
|
|
+ sheet1.GenerateCell(8 + index, 18).SetValue<decimal>(moldFee);
|
|
|
+ sheet1.GenerateCell(8 + index, 19).SetValue<decimal>(totalprice);
|
|
|
+ sheet1.GenerateCell(8 + index, 20).SetValue<decimal>(totalNoTaxprice);
|
|
|
}
|
|
|
ldAccontTotal += send.totalprice;
|
|
|
ldNoTaxTotal += (send.SendQuantity ?? 0) * send.AfterTaxPrice;
|
|
|
index++;
|
|
|
}
|
|
|
- sheet1.GenerateCell(8 + index, 16).SetValue($"总金额({currencyId})");
|
|
|
- sheet1.GenerateCell(8 + index, 17).SetValue<decimal>(ldAccontTotal);
|
|
|
- sheet1.GenerateCell(8 + index, 18).SetValue<decimal>(ldNoTaxTotal);
|
|
|
+ sheet1.GenerateCell(8 + index, 18).SetValue($"总金额({currencyId})");
|
|
|
+ sheet1.GenerateCell(8 + index, 19).SetValue<decimal>(ldAccontTotal);
|
|
|
+ sheet1.GenerateCell(8 + index, 20).SetValue<decimal>(ldNoTaxTotal);
|
|
|
var fileName = $"对账单-{Clock.Now:yyMMddHHmmss}.xlsx";
|
|
|
var result = work?.SaveWorkBook($"{AppDomain.CurrentDomain.BaseDirectory}{savePath}", fileName);
|
|
|
if (!result.IsNullOrEmpty())
|