diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj index 47366b8f..c09813b6 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj +++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj @@ -54,7 +54,6 @@ - diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json index 8bcc29a5..b25a73a2 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json +++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json @@ -7,11 +7,11 @@ // "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;" //}, "ConnectionStrings": { - //"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", - //"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;" - "Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", - "SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", - "Wms": "Server=192.168.0.140;Database=CPAT_WMS_TEST;user id=sa;password=Microsoft2008;" + "Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", + "SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;" + //"Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", + //"SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", + //"Wms": "Server=192.168.0.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;" }, "Logging": { "LogLevel": { diff --git a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json index 4f6dcfdb..1b7f4fcc 100644 --- a/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json +++ b/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json @@ -7,11 +7,11 @@ // "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;" //}, "ConnectionStrings": { - //"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", - //"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;", - "Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", - "SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", - "Wms": "Server=192.168.0.140;Database=CPAT_WMS_TEST;user id=sa;password=Microsoft2008;" + "Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1", + "SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;", + //"Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;", + //"SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;", + //"Wms": "Server=192.168.0.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;" }, "Logging": { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Kanban.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Kanban.cs new file mode 100644 index 00000000..8cd1c69c --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_F/HQ_F_Kanban.cs @@ -0,0 +1,63 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DomainBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + + //行号 + //零件号 + //零件中文名称 + //需求数 + //已接收数 + //订货看板编号 + //手工或自动 + //收货仓库 + //收货仓库描述 + //交货时间 + //发货状态 + //供应商 + + public class HQ_F_Kanban:FullAuditedAggregateRootBase + { + [ExporterHeader(DisplayName = "行号")] + public string PoLine { set; get; } + [ExporterHeader(DisplayName = "零件号")] + public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "零件中文名称 ")] + public string MaterialDesc { set; get; } + [ExporterHeader(DisplayName = "发货数量")] + public decimal Qty { get; set; } + [ExporterHeader(DisplayName = "订货看板编号")] + public string Kanban { set; get; } + [ExporterHeader(DisplayName = "手工或自动")] + public string IsAuto { set; get; } + [ExporterHeader(DisplayName = "收货仓库")] + public string Warehouse { set; get; } + [ExporterHeader(DisplayName = "收货仓库描述 ")] + public string WarehouseDesc { set; get; } + [ExporterHeader(DisplayName = "供应商")] + public string Supplier { set; get; } + [ExporterHeader(DisplayName = "发货状态")] + public string State { set; get; } + + public HQ_F_Kanban(Guid id,string poLine, string materialCode, string materialDesc, decimal qty, string kanban, string isAuto, string warehouse, string warehouseDesc, string supplier, string state):base(id) + { + Id = id; + PoLine = poLine; + MaterialCode = materialCode; + MaterialDesc = materialDesc; + Qty = qty; + Kanban = kanban; + IsAuto = isAuto; + Warehouse = warehouse; + WarehouseDesc = warehouseDesc; + Supplier = supplier; + State = state; + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Kanban.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Kanban.cs new file mode 100644 index 00000000..5fd264c4 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Kanban.cs @@ -0,0 +1,63 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DomainBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + + //行号 + //零件号 + //零件中文名称 + //需求数 + //已接收数 + //订货看板编号 + //手工或自动 + //收货仓库 + //收货仓库描述 + //交货时间 + //发货状态 + //供应商 + + public class HQ_H_Kanban:FullAuditedAggregateRootBase + { + [ExporterHeader(DisplayName = "行号")] + public string PoLine { set; get; } + [ExporterHeader(DisplayName = "零件号")] + public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "零件中文名称 ")] + public string MaterialDesc { set; get; } + [ExporterHeader(DisplayName = "发货数量")] + public decimal Qty { get; set; } + [ExporterHeader(DisplayName = "订货看板编号")] + public string Kanban { set; get; } + [ExporterHeader(DisplayName = "手工或自动")] + public string IsAuto { set; get; } + [ExporterHeader(DisplayName = "收货仓库")] + public string Warehouse { set; get; } + [ExporterHeader(DisplayName = "收货仓库描述 ")] + public string WarehouseDesc { set; get; } + [ExporterHeader(DisplayName = "供应商")] + public string Supplier { set; get; } + [ExporterHeader(DisplayName = "发货状态")] + public string State { set; get; } + + public HQ_H_Kanban(Guid id,string poLine, string materialCode, string materialDesc, decimal qty, string kanban, string isAuto, string warehouse, string warehouseDesc, string supplier, string state):base(id) + { + Id = id; + PoLine = poLine; + MaterialCode = materialCode; + MaterialDesc = materialDesc; + Qty = qty; + Kanban = kanban; + IsAuto = isAuto; + Warehouse = warehouse; + WarehouseDesc = warehouseDesc; + Supplier = supplier; + State = state; + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs index 1cbc0aab..c34f59d0 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_H/HQ_H_Platform.cs @@ -24,7 +24,7 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H public HQ_H_Platform(Guid Id,string materialVoucherNo,string externalKanbanNumber, string kanbanNumber, string year,string factory,DateTime acceptanceDate, string period, string version,string kanBan,string supplier,string storageLocation,string storageLocationDesc, - string materialCode) : base(Id) + string materialCode,string acceptanceNo, decimal qty, decimal price, decimal amt) : base(Id) { MaterialVoucherNo = materialVoucherNo; KanbanNumber = kanbanNumber; @@ -39,8 +39,13 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H Supplier = supplier; StorageLocation = storageLocation; StorageLocationDesc = storageLocationDesc; + AcceptanceNo = acceptanceNo; + Qty = qty; + Price = price; + Amt = amt; } + //验收单号 外部单号 物料凭证号 物料凭证日期 物料凭证记账日期 看板编号 外部看板编号 物料号 物料描述 数量 单价 金额 //工厂 备注 创建者 创建时间 修改人 修改时间 公司 验收单号 外部单号 发票号 会计年度 金额 计划员 存储地点 //存储地点描述 状态 验收单日期 供应商 录入人 录入人描述 看板号 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Kanban.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Kanban.cs new file mode 100644 index 00000000..13033f56 --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/HQ_M/HQ_M_Kanban.cs @@ -0,0 +1,63 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Win.Sfs.Shared.DomainBase; + +namespace Win.Sfs.SettleAccount.Entities.HQ_F +{ + + //行号 + //零件号 + //零件中文名称 + //需求数 + //已接收数 + //订货看板编号 + //手工或自动 + //收货仓库 + //收货仓库描述 + //交货时间 + //发货状态 + //供应商 + + public class HQ_M_Kanban:FullAuditedAggregateRootBase + { + [ExporterHeader(DisplayName = "行号")] + public string PoLine { set; get; } + [ExporterHeader(DisplayName = "零件号")] + public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "零件中文名称 ")] + public string MaterialDesc { set; get; } + [ExporterHeader(DisplayName = "发货数量")] + public decimal Qty { get; set; } + [ExporterHeader(DisplayName = "订货看板编号")] + public string Kanban { set; get; } + [ExporterHeader(DisplayName = "手工或自动")] + public string IsAuto { set; get; } + [ExporterHeader(DisplayName = "收货仓库")] + public string Warehouse { set; get; } + [ExporterHeader(DisplayName = "收货仓库描述 ")] + public string WarehouseDesc { set; get; } + [ExporterHeader(DisplayName = "供应商")] + public string Supplier { set; get; } + [ExporterHeader(DisplayName = "发货状态")] + public string State { set; get; } + + public HQ_M_Kanban(Guid id,string poLine, string materialCode, string materialDesc, decimal qty, string kanban, string isAuto, string warehouse, string warehouseDesc, string supplier, string state):base(id) + { + Id = id; + PoLine = poLine; + MaterialCode = materialCode; + MaterialDesc = materialDesc; + Qty = qty; + Kanban = kanban; + IsAuto = isAuto; + Warehouse = warehouse; + WarehouseDesc = warehouseDesc; + Supplier = supplier; + State = state; + } + } +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs index e33503e3..088ee487 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -55,7 +55,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } - + /// + /// 准时化出库主表 + /// public class WmsJitOutPut : FullAuditedAggregateRootBase { public WmsJitOutPut() @@ -82,7 +84,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS /// - /// + /// 准时化出库明细 /// public class WmsJitOutPutDetial : FullAuditedAggregateRootBase { @@ -229,7 +231,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS /// - /// + /// 看板明细 /// public class WmsKanbanOutPutDetial : FullAuditedAggregateRootBase { @@ -331,7 +333,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS - + /// + /// 备件出库 + /// public class WmsSharePartOutPut : FullAuditedAggregateRootBase { public WmsSharePartOutPut() @@ -358,7 +362,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS /// - /// + /// 备件出库明细 /// public class WmsSharePartOutPutDetial : FullAuditedAggregateRootBase { @@ -452,7 +456,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS - + /// + /// 备件无订单号出库 + /// public class WmsSharePartOutPutDetial2: FullAuditedAggregateRootBase { diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs index 647dfd8c..f522e1b2 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs @@ -73,6 +73,7 @@ using Win.Sfs.SettleAccount.Entities.BT_Car; using Win.Sfs.SettleAccount.Entities.WMS; using Win.Sfs.SettleAccount.Entities.HQ_F; + namespace Win.Sfs.SettleAccount { public static class SettleAccountDbContextModelCreatingExtensions @@ -332,13 +333,147 @@ namespace Win.Sfs.SettleAccount builder.ConfigureWmsKanbanOutPutDetail(options); builder.ConfigureWmsSharePartOutPutDetail(options); builder.ConfigureWmsSharePartOutPutVersion(options); + builder.ConfigureHQFKanban(options); + builder.ConfigureHQMKanban(options); + builder.ConfigureHQHKanban(options); #endregion } + + + + + #region PG-派格 + private static void ConfigureHQFKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + + b.ToTable($"{options.TablePrefix}_HQ_F_Kanban", options.Schema); + + b.ConfigureByConvention(); + b.Property(x => x.Kanban).IsRequired().HasMaxLength(50);//必填项 + b.Property(x => x.MaterialCode).HasMaxLength(50); + b.Property(x => x.MaterialDesc).HasMaxLength(100); + b.Property(x => x.PoLine).IsRequired().HasMaxLength(50); + b.Property(x => x.Supplier).HasMaxLength(50); + b.Property(x => x.Warehouse).HasMaxLength(50); + b.Property(x => x.WarehouseDesc).HasMaxLength(150); + b.Property(x => x.State).HasMaxLength(50); + + //创建组合索引 + b.HasIndex(x => new { x.Kanban, x.PoLine, x.MaterialCode }); + + }); + } + private static void ConfigureHQMKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + + b.ToTable($"{options.TablePrefix}_HQ_M_Kanban", options.Schema); + + b.ConfigureByConvention(); + b.Property(x => x.Kanban).IsRequired().HasMaxLength(50);//必填项 + b.Property(x => x.MaterialCode).HasMaxLength(50); + b.Property(x => x.MaterialDesc).HasMaxLength(100); + b.Property(x => x.PoLine).IsRequired().HasMaxLength(50); + b.Property(x => x.Supplier).HasMaxLength(50); + b.Property(x => x.Warehouse).HasMaxLength(50); + b.Property(x => x.WarehouseDesc).HasMaxLength(150); + b.Property(x => x.State).HasMaxLength(50); + + + //创建组合索引 + b.HasIndex(x => new { x.Kanban, x.PoLine, x.MaterialCode }); + + }); + } + private static void ConfigureHQHKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + + b.ToTable($"{options.TablePrefix}_HQ_H_Kanban", options.Schema); + + b.ConfigureByConvention(); + b.Property(x => x.Kanban).IsRequired().HasMaxLength(50);//必填项 + b.Property(x => x.MaterialCode).HasMaxLength(50); + b.Property(x => x.MaterialDesc).HasMaxLength(100); + b.Property(x => x.PoLine).IsRequired().HasMaxLength(50); + b.Property(x => x.Supplier).HasMaxLength(50); + b.Property(x => x.Warehouse).HasMaxLength(50); + b.Property(x => x.WarehouseDesc).HasMaxLength(150); + b.Property(x => x.State).HasMaxLength(50); + + + //创建组合索引 + b.HasIndex(x => new { x.Kanban, x.PoLine, x.MaterialCode }); + + }); + } + + + + + + + /// + /// 一汽轿车平台验收结算明细-导入 + /// + /// + /// + private static void ConfigureHQCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + + b.ToTable($"{options.TablePrefix}_HQ_Car_Platform", options.Schema); + + b.ConfigureByConvention(); + b.Property(x => x.HQCarKanBan).HasMaxLength(150);//看板号(一汽轿车没有看板号) + b.Property(x => x.MaterialVoucherNo).HasMaxLength(150); + b.Property(x => x.Factory).HasMaxLength(50); + b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); + b.Property(x => x.ExternalKanbanNumber).HasMaxLength(50); + b.Property(x => x.KanbanNumber).HasMaxLength(150);//看板编号 + b.Property(x => x.Period).HasMaxLength(50); + b.Property(x => x.Year).HasMaxLength(50); + b.Property(x => x.Version).HasMaxLength(50); + b.Property(x => x.Supplier).HasMaxLength(50); + b.Property(x => x.StorageLocation).HasMaxLength(50); + b.Property(x => x.StorageLocationDesc).HasMaxLength(150); + //创建组合索引 + b.HasIndex(x => new { x.Version, x.KanbanNumber, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); + + }); + } + + private static void ConfigureHQCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) + { + + builder.Entity(b => + { + b.ToTable($"{options.TablePrefix}_HQ_Car_PlatformVersion", options.Schema); + b.ConfigureByConvention(); + b.Property(x => x.Year).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Period).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); + b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength); + b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter); + }); + + } + + /// /// 红旗工厂F平台验收结算明细-导入 /// diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartExtendDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartExtendDapperReportRepository.cs index 56aa3814..61bc7f3f 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartExtendDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartExtendDapperReportRepository.cs @@ -80,42 +80,44 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } - public virtual List GetSettleSparePartNoOrderList(string purchaseOrderNo, string version, string sapCode, string matialCode, + public virtual List GetSettleSparePartNoOrderList(string purchaseOrderNo, string version, string sapCode, string matialCode, string begintime, string endtime) { - string sqlString = " SELECT \n" + - " * , \n" + - " (Price-InvoicePrice) as InvoiceDiffPrice, --单价差异 \n" + - " ISNULL( Price * ReceiptQty-InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异 \n" + - " FROM \n" + - " ( \n" + - " SELECT \n" + - " c.Period as WMSDeliveryDate,--交货日期 \n" + - " c.WMSDeliveryNote,--交货单号 \n" + - " c.SpareDate as OrderDate,--订单日期 \n" + - " a.PurchaseOrderNo,--采购订单号 \n" + - " b.MaterialCode as SAPCode,--SAP编码,即厂内物料号 \n" + - " a.MaterialCode,--物料代码 \n" + - " b.MaterialDesc,--物料描述 \n" + - " a.PurchaseOrderNoText,--采购订单文本 \n" + - " c.ReceiptQty,-- 发货数量 \n" + - " a.InvoicedQty as InvoicedQty,--开票数量 \n" + - " (c.ReceiptQty-d.Amt) as SettleInvoiceDiffQty,--发货与开票差异 \n" + - " d.InvoicePrice,--开票单价 \n" + - " 0 as InvoiceMoney --开票金额 \n" + - " \n" + - " FROM \n" + - " Set_SparePart AS a \n" + - " LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode \n" + - " LEFT JOIN Set_WMSSparePart c ON a.PurchaseOrderNo= c.WMSDeliveryNote \n" + - " AND a.MaterialCode= c.MaterialCode \n" + - " LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode,Amt FROM set_invoice WHERE version = '{0}' GROUP BY materialcode,Amt ) d ON a.MaterialCode= d.MaterialCode \n" + - " ) TEMP1 \n" + - " LEFT JOIN ( SELECT Price, --定价 \n" + - " MaterialCode --厂内物料号 \n" + - " FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode= TEMP2.MaterialCode "; + + + var sql = "SELECT\n" + + " temp1.*,\n" + + " Isnull( TEMP2.Price, 0 ) Price,\n" + + " Round( Isnull( TEMP2.Price, 0 )* InvoicedQty, 2 ) Amt \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " a.*,\n" + + " b.EstimateTypeDesc MaterialGroup,\n" + + " b.EstimateType MaterialGroupCode,\n" + + " b.MaterialCode SapCode,\n" + + " 0 SockQty \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " sum( ReceiptQty ) ReceiptQty,\n" + + " SUM( InvoicedQty ) InvoicedQty,\n" + + " SUM( AmountNoTax ) AmountNoTax,\n" + + " SUM( PurchasePriceNoTax ) PurchasePriceNoTax,\n" + + " MaterialCode \n" + + " FROM\n" + + " Set_SparePart \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " GROUP BY\n" + + " MaterialCode \n" + + " ) A\n" + + " LEFT JOIN Set_material B ON A.MaterialCode = B.CustomerPartCode \n" + + " ) temp1\n" + + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT MAX( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SAPCode = TEMP2.MaterialCode"; + string addwhere = string.Empty; - string addSqlStr = string.Format(sqlString, version); + string addSqlStr = string.Format(sql, version); //if (!string.IsNullOrEmpty(purchaseOrderNo)) //{ // addwhere += string.Format(" AND PurchaseOrderNo LIKE '{0}%' ", purchaseOrderNo); @@ -135,7 +137,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report string _sql = string.Format(addSqlStr, addwhere); //string _sql = string.Format(sqlString, version); - var _query = DbConnection.Query(_sql, null, null, true, 1200, null); + var _query = DbConnection.Query(_sql, null, null, true, 1200, null); return _query.ToList(); } @@ -144,6 +146,27 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } + public class SettleSpareExtendPartExport + { + + + //交货日期 交货单号 订单日期 采购订单号 SAP编码 物料代码 物料描述 采购订单文本 发货数量 开票数量 发货与开票差异 开票单价 开票金额 定价 单价差异 差异总金额 + [ExporterHeader("收货数量数量")] + public decimal ReceiptQty { set; get; } + [ExporterHeader("开票数量")] + public decimal InvoicedQty { set; get; } + [ExporterHeader("金额")] + public decimal AmountNoTax { set; get; } + [ExporterHeader("金额")] + public decimal PurchasePriceNoTax { set; get; } + public string MaterialCode { set; get; } + public string MaterialGroup { set; get; } + public string MaterialGroupCode { set; get; } + public string SapCode { set; get; } + public string SockQty { set; get; } + } + + // ReceiptQty InvoicedQty AmountNoTax PurchasePriceNoTax MaterialCode MaterialGroup MaterialGroupCode SapCode ///// ///// 大众看板有条码报表