Administrator
3 years ago
8 changed files with 266 additions and 205 deletions
@ -0,0 +1,180 @@ |
|||||
|
using Dapper; |
||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Domain.Repositories.Dapper; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report |
||||
|
{ |
||||
|
|
||||
|
public class WmsOutputSum |
||||
|
{ |
||||
|
[ExporterHeader(DisplayName = "物料号" )] |
||||
|
//物料号
|
||||
|
public string MaterialCode { set; get; } |
||||
|
[ExporterHeader(DisplayName = "物料描述")] |
||||
|
//物料描述
|
||||
|
public string MaterialDesc { set; get; } |
||||
|
[ExporterHeader(DisplayName = "物料组(车型)")] |
||||
|
//物料组(车型)
|
||||
|
public string MaterialGroup { set; get; } |
||||
|
[ExporterHeader(DisplayName = "结算数量")] |
||||
|
public decimal Qty { set; get; } |
||||
|
[ExporterHeader(DisplayName = "单价")] |
||||
|
public decimal Price { set; get; } |
||||
|
[ExporterHeader(DisplayName = "金额")] |
||||
|
public decimal Amt { set; get; } |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public class WmsOutputSumDapperRepository: DapperRepository<SettleAccountDbContext>, ITransientDependency |
||||
|
{ |
||||
|
public WmsOutputSumDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) |
||||
|
: base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
public virtual List<WmsOutputSum> GetWmsSumReportList(string version,string state) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
|
||||
|
var str = "SELECT\n" + |
||||
|
" temp.MaterialCode,\n" + |
||||
|
" temp2.MaterialDesc,\n" + |
||||
|
" temp.Qty,\n" + |
||||
|
" temp.Price,\n" + |
||||
|
" Round( temp.Qty * temp.Price, 2 ) Amt,\n" + |
||||
|
" EstimateTypeDesc MaterialGroup ,\n" + |
||||
|
" EstimateType \n" + |
||||
|
"FROM\n" + |
||||
|
" (\n" + |
||||
|
" SELECT\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsJitOutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = {1} \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" Price UNION ALL\n" + |
||||
|
" SELECT\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsKanbanOutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = {1} \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" Price UNION ALL\n" + |
||||
|
" SELECT\n" + |
||||
|
" SapMaterialCode MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsWithOutKanbanOutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = 2 \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" SapMaterialCode,\n" + |
||||
|
" Price UNION ALL\n" + |
||||
|
" SELECT\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsSharePartOutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = {1} \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" Price UNION ALL\n" + |
||||
|
" SELECT\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsSharePart90OutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = {1} \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" Price UNION ALL\n" + |
||||
|
" SELECT\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsHQHKanbanOutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = {1} \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" Price UNION ALL\n" + |
||||
|
" SELECT\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsHQFKanbanOutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = {1} \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" Price UNION ALL\n" + |
||||
|
" SELECT\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" SUM( Qty ) Qty,\n" + |
||||
|
" Price \n" + |
||||
|
" FROM\n" + |
||||
|
" Set_WmsHQMKanbanOutPutDetial \n" + |
||||
|
" WHERE\n" + |
||||
|
" State = {1} \n" + |
||||
|
" AND VERSION = '{0}' \n" + |
||||
|
" GROUP BY\n" + |
||||
|
" MaterialCode,\n" + |
||||
|
" Price \n" + |
||||
|
" ) temp\n" + |
||||
|
" LEFT JOIN ( SELECT max( Id ) Id, MaterialCode, MaterialDesc, EstimateType, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, EstimateType ) temp2 ON temp.MaterialCode = temp2.MaterialCode \n" + |
||||
|
"ORDER BY\n" + |
||||
|
" MaterialCode"; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
string _sql = string.Format(str, version,state); |
||||
|
|
||||
|
var _query = DbConnection.Query<WmsOutputSum>(_sql,null,null,true,1200,null); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
return _query.ToList(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
Loading…
Reference in new issue