Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
312bc7a1f0
  1. 5
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  2. 5
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  3. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/UnSettleAccounts/UnSettleAccountAppService.cs
  4. 132
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs
  5. 9
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  6. 126
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  7. 47
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  8. 77
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs
  9. 30
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs
  10. 2
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs

5
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -23,8 +23,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <summary> /// <summary>
/// 标准价格单-相关应用服务 /// 标准价格单-相关应用服务
/// </summary> /// </summary>
[Authorize(SettleAccountPermissions.PriceLists.Default)] //[Authorize(SettleAccountPermissions.PriceLists.Default)]
[Route("api/SettleAccount/PriceList")] [Route("api/SettleAccount/PriceList")]
[AllowAnonymous]
public class PriceListAppService : ApplicationService public class PriceListAppService : ApplicationService
/*, IPriceListAppService*/ /*, IPriceListAppService*/
{ {
@ -156,7 +157,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <returns>是否导入成功</returns> /// <returns>是否导入成功</returns>
[HttpPost] [HttpPost]
[Route("ExcelImport-Map")] [Route("ExcelImport-Map")]
[Authorize(SettleAccountPermissions.PriceLists.Create)] //[Authorize(SettleAccountPermissions.PriceLists.Create)]
virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version) virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version)
{ {
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();

5
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -23,7 +23,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <summary> /// <summary>
/// 标准价格单-相关应用服务 /// 标准价格单-相关应用服务
/// </summary> /// </summary>
[Authorize(SettleAccountPermissions.PriceLists.Default)] //[Authorize(SettleAccountPermissions.PriceLists.Default)]
[AllowAnonymous]
[Route("api/SettleAccount/PriceListBJ")] [Route("api/SettleAccount/PriceListBJ")]
public class PriceListAppServiceBJ : ApplicationService public class PriceListAppServiceBJ : ApplicationService
/*, IPriceListAppService*/ /*, IPriceListAppService*/
@ -156,7 +157,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <returns>是否导入成功</returns> /// <returns>是否导入成功</returns>
[HttpPost] [HttpPost]
[Route("ExcelImport-Map")] [Route("ExcelImport-Map")]
[Authorize(SettleAccountPermissions.PriceLists.Create)] //[Authorize(SettleAccountPermissions.PriceLists.Create)]
virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version) virtual public async Task<string> ImportAsync([FromForm] IFormFileCollection files,string version)
{ {
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/UnSettleAccounts/UnSettleAccountAppService.cs

@ -49,8 +49,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
/// <summary> /// <summary>
///大众FIS未结算明细导入功能 ///大众FIS未结算明细导入功能
/// </summary> /// </summary>
[Authorize(SettleAccountPermissions.UnSettleAccount.Default)] [Authorize(SettleAccountPermissions.UnSettleAccount.Default)]
//[AllowAnonymous] //[AllowAnonymous]
[Route("api/settleaccount/UnSettleAccount")] [Route("api/settleaccount/UnSettleAccount")]
public class UnSettleAccountAppService : SettleAccountApplicationBase<UnSettleAccount>, IUnSettleAccountAppService public class UnSettleAccountAppService : SettleAccountApplicationBase<UnSettleAccount>, IUnSettleAccountAppService
{ {

132
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs

@ -64,6 +64,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPutDetial, Guid> _wmsRepository; private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPutDetial, Guid> _wmsRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPut, Guid> _wmsVersionRepository; private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPut, Guid> _wmsVersionRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsWithOutKanbanOutPutDetial, Guid> _wmsRepository1;
private readonly ISettleAccountBranchEfCoreRepository<WmsWithOutKanbanOutPut, Guid> _wmsVersionRepository1;
private readonly WMSEfCoreRepository<WmsKanbanOutPutDetial> _wmsefRespository; private readonly WMSEfCoreRepository<WmsKanbanOutPutDetial> _wmsefRespository;
private readonly WMSEfCoreRepository<TB_BILL> _wmstbRespository; private readonly WMSEfCoreRepository<TB_BILL> _wmstbRespository;
@ -184,13 +189,14 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
[Route("WmsWithOutKanbanOutPut")] [Route("WmsWithOutKanbanOutPut")]
public async Task<string> WmsWithOutKanbanOutPut(WmsJitRequestDto input) public async Task<string> WmsWithOutKanbanOutPut(WmsJitRequestDto input)
{ {
var _billNum = "KA" + DateTime.Now.ToString("yyyyMMddhhmmss"); var _billNum = "KA" + DateTime.Now.ToString("yyyyMMddhhmmss");
var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList(); var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList();
if (_joblist.Count() > 0) if (_joblist.Count() > 0)
{ {
var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); var fileList = _joblist.Select(p => p.RealDownFileName).ToList();
List<WmsKanbanOutPutDetial> _lst = new List<WmsKanbanOutPutDetial>(); List<WmsWithOutKanbanOutPutDetial> _lst = new List<WmsWithOutKanbanOutPutDetial>();
foreach (var filename in fileList) foreach (var filename in fileList)
{ {
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
@ -198,49 +204,61 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var _list = _excelHelper.ExcelToList<SettleKBWithOutCode>(); var _list = _excelHelper.ExcelToList<SettleKBWithOutCode>();
foreach (var itm in _list) foreach (var itm in _list)
{ {
var _entity= new WmsWithOutKanbanOutPutDetial(
var _entity= new WmsKanbanOutPutDetial(GuidGenerator.Create(), string.Empty, string.Empty, itm.MaterialCode, itm.MaterialDesc GuidGenerator.Create(),
, itm.SapMaterialGroup, string.Empty, string.Empty, 0, string.Empty, string.Empty, itm.Version, itm.SapMaterialCode, string.Empty,
_billNum, Guid.Empty, string.Empty, itm.InvoiceQty string.Empty,
itm.MaterialCode,
itm.MaterialDesc,
itm.SapMaterialGroup,
string.Empty,
string.Empty,
0,
string.Empty,
string.Empty,
input.Version,
itm.SapMaterialCode,
_billNum,
Guid.Empty,
string.Empty,
itm.InvoiceQty
); );
_lst.Add(_entity); _lst.Add(_entity);
} }
} }
var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version && p.Kanban==string.Empty).ToListAsync(); var outPutDetail = await _wmsRepository1.Where(p => p.Version == input.Version && p.Kanban==string.Empty).ToListAsync();
//var error = from itm1 in outPutDetail var error = from itm1 in outPutDetail
// join itm2 in _ls1 on join itm2 in _lst on
// new { itm1.MaterialCode, itm1.Kanban } new { itm1.MaterialCode }
// equals equals
// new { itm2.MaterialCode, itm2.Kanban } new { itm2.MaterialCode }
// select itm1; select itm1;
//var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) }); var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) });
//if (errList.Count() == 0) if (errList.Count() == 0)
//{ {
// var query = from itm1 in _ls1 var query = from itm1 in _lst
// join itm2 in outPutDetail on join itm2 in outPutDetail on
// new { itm1.MaterialCode, itm1.Kanban } new { itm1.MaterialCode}
// equals equals
// new { itm2.MaterialCode, itm2.Kanban } into temp1 new { itm2.MaterialCode } into temp1
// from tm1 in temp1.DefaultIfEmpty() from tm1 in temp1.DefaultIfEmpty()
// where tm1 == null where tm1 == null
// select itm1; select itm1;
// var _wmslst = query.ToList(); var _wmslst = query.ToList();
// foreach (var itm in _lst) foreach (var itm in _lst)
// { {
// itm.BillNum = _billNum; itm.BillNum = _billNum;
// } }
await _wmsRepository.GetDbContext().BulkInsertAsync(_lst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); await _wmsRepository1.GetDbContext().BulkInsertAsync(_lst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); int _count = _wmsVersionRepository1.Count(p => p.Version == input.Version && p.BillNum == _billNum);
if (_count == 0) if (_count == 0)
{ {
var _version = new WmsKanbanOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); var _version = new WmsWithOutKanbanOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email);
await _wmsVersionRepository.InsertAsync(_version, true); await _wmsVersionRepository1.InsertAsync(_version, true);
} }
foreach (var job in _joblist) foreach (var job in _joblist)
@ -249,26 +267,26 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
await _job.UpdateAsync(job); await _job.UpdateAsync(job);
} }
} }
//else else
//{ {
// StringBuilder _buffer = new StringBuilder(); StringBuilder _buffer = new StringBuilder();
// foreach (var itm in errList) foreach (var itm in errList)
// { {
// _buffer.AppendFormat("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number); _buffer.AppendFormat("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number);
// } }
// var _errinfo = _buffer.ToString(); var _errinfo = _buffer.ToString();
// foreach (var job in _joblist) foreach (var job in _joblist)
// { {
// job.FileName = _errinfo; job.FileName = _errinfo;
// await _job.UpdateAsync(job); await _job.UpdateAsync(job);
// } }
//} }
//} }
//else else
//{ {
// _billNum = string.Empty; _billNum = string.Empty;
//} }
return ApplicationConsts.SuccessStr; ; return ApplicationConsts.SuccessStr; ;
} }

9
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -32,8 +32,8 @@ using Win.Sfs.SettleAccount.Reports.ReportRequestDto;
namespace Win.Sfs.SettleAccount.Reports.ReportServices namespace Win.Sfs.SettleAccount.Reports.ReportServices
{ {
[Authorize(SettleAccountPermissions.Reports.Default)] //[Authorize(SettleAccountPermissions.Reports.Default)]
//[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/ReportMakeService")] [Route("api/settleaccount/ReportMakeService")]
public class ReportService : ApplicationService public class ReportService : ApplicationService
{ {
@ -360,6 +360,11 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(request.ChassisNumber) ? string.Empty : request.ChassisNumber }); customConditionList.Add(new CustomCondition() { Name = "ChassisNumber", Value = string.IsNullOrEmpty(request.ChassisNumber) ? string.Empty : request.ChassisNumber });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup }); customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup });
customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(request.SapCode) ? string.Empty : request.SapCode }); customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(request.SapCode) ? string.Empty : request.SapCode });
var _taskid = await _service.ExportEnqueueAsync("准时化结算核对明细", ExportExtentsion.Excel,request.Version, string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup, CurrentUser, typeof(InvoiceSettledDetailDiffExportService), customConditionList, (rs) => var _taskid = await _service.ExportEnqueueAsync("准时化结算核对明细", ExportExtentsion.Excel,request.Version, string.IsNullOrEmpty(request.MaterialGroup) ? string.Empty : request.MaterialGroup, CurrentUser, typeof(InvoiceSettledDetailDiffExportService), customConditionList, (rs) =>
{ {
}); });

126
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs

@ -324,6 +324,132 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
public class WmsWithOutKanbanOutPut : FullAuditedAggregateRootBase<Guid>
{
public WmsWithOutKanbanOutPut()
{
}
public WmsWithOutKanbanOutPut(Guid id, string version, string billNum, string creator) : base(id)
{
Id = id;
Version = version;
BillNum = billNum;
Creator = creator;
}
public string Version { set; get; }
public string BillNum { set; get; }
public string Creator { set; get; }
}
/// <summary>
/// 看板明细
/// </summary>
public class WmsWithOutKanbanOutPutDetial : FullAuditedAggregateRootBase<Guid>
{
public WmsWithOutKanbanOutPutDetial()
{
}
public WmsWithOutKanbanOutPutDetial(Guid id, string wmsBillNum, string kanban, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty)
{
Id = id;
WmsBillNum = wmsBillNum;
Kanban = kanban;
MaterialCode = materialCode;
MaterialDesc = materialDesc;
MaterialGroup = materialGroup;
OutPut = outPut;
InPut = inPut;
State = state;
Extend1 = extend1;
Extend2 = extend2;
Version = extend3;
ParentMaterialCode = parentMaterialCode;
BillNum = billNum;
TaskId = taskId;
Remark = remark;
Qty = qty;
}
public void SetData(Guid id, string remark, string wmsbillnum, string version, Guid taskId)
{
Id = id;
Remark = remark;
WmsBillNum = wmsbillnum;
Version = version;
TaskId = taskId;
}
// 交货单号 实际发货日期 KENN号 底盘号 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 定价 金额 结算平台未结数量 大众R3未结数量 差异金额 差异数量 漏结标识 漏结期间 说明
[ImporterHeader(Name = "组件组物料", IsIgnore = true)]
public string ParentMaterialCode { set; get; }
[ImporterHeader(Name = "交货单号")]
public string WmsBillNum { set; get; }
[ImporterHeader(Name = "条码号")]
//KENN号
public string Kanban { set; get; }
[ImporterHeader(Name = "物料号")]
//物料号
public string MaterialCode { set; get; }
[ImporterHeader(Name = "物料描述")]
//物料描述
public string MaterialDesc { set; get; }
[ImporterHeader(Name = "物料组(车型)")]
//物料组(车型)
public string MaterialGroup { set; get; }
[ImporterHeader(Name = "出库库位", IsIgnore = true)]
//出库库位
public string OutPut { set; get; }
[ImporterHeader(Name = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
public int State { get; set; }
[ImporterHeader(Name = "客户物料")]
/// <summary>
/// 扩展字段1
/// </summary>
public string Extend1 { set; get; }
/// <summary>
/// 扩展字段2
/// </summary>
[ImporterHeader(Name = "订单日期")]
public string Extend2 { set; get; }
/// <summary>
/// 扩展字段3
/// </summary>
[ImporterHeader(Name = "版本号", IsIgnore = true)]
public string Version { set; get; }
[ImporterHeader(Name = "结算数量")]
public decimal Qty { set; get; }
[ImporterHeader(Name = "单据", IsIgnore = true)]
public string BillNum { set; get; }
[ImporterHeader(Name = "任务", IsIgnore = true)]
public Guid TaskId { set; get; }
}
#region 红旗M平台出库 #region 红旗M平台出库
/// <summary> /// <summary>

47
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -331,6 +331,10 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureWmsJitOutPutVersion(options); builder.ConfigureWmsJitOutPutVersion(options);
builder.ConfigureWmsKanbanOutPutVersion(options); builder.ConfigureWmsKanbanOutPutVersion(options);
builder.ConfigureWmsKanbanOutPutDetail(options); builder.ConfigureWmsKanbanOutPutDetail(options);
builder.ConfigureWmsWithOutKanbanOutPutVersion(options);
builder.ConfigureWmsWithOutKanbanOutPutDetail(options);
builder.ConfigureWmsSharePartOutPutDetail(options); builder.ConfigureWmsSharePartOutPutDetail(options);
builder.ConfigureWmsSharePartOutPutVersion(options); builder.ConfigureWmsSharePartOutPutVersion(options);
@ -1345,6 +1349,49 @@ namespace Win.Sfs.SettleAccount
} }
private static void ConfigureWmsWithOutKanbanOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<WmsKanbanOutPut>(b =>
{
b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutExtend", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.BillNum });
});
}
private static void ConfigureWmsWithOutKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<WmsKanbanOutPutDetial>(b =>
{
b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetialExtend", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.OutPut).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.InPut).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Kanban).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.ParentMaterialCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Extend1).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Extend2).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.MaterialCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.BillNum });
});
}
private static void ConfigureWmsSharePartOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureWmsSharePartOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {

77
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs

@ -13,7 +13,7 @@ using Win.Sfs.SettleAccount.Reports;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
[ExcelExporter(MaxRowNumberOnASheet = 500000)] [ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class InvoiceSettledDetailDiff public class InvoiceSettledDetailDiff
: ReportDetailBase : ReportDetailBase
{ {
@ -100,11 +100,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//单价差异 //单价差异
[ExporterHeader(DisplayName = "单价差异")] [ExporterHeader(DisplayName = "单价差异")]
public decimal DiffPrice { set; get; } public decimal DiffPrice { set; get; }
[ExporterHeader(DisplayName = "结算实际数量",IsIgnore =true)]
public decimal SettleReadyQty { set; get; }
//总金额差异 //总金额差异
//[ExporterHeader(DisplayName = "总金额差异")] //[ExporterHeader(DisplayName = "总金额差异")]
//public decimal AmtDiffPrice { set; get; } //public decimal AmtDiffPrice { set; get; }
@ -159,6 +162,69 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//{ //{
// condition += string.Format(" B.chassisNumber='{0}' ", materialGroup); // condition += string.Format(" B.chassisNumber='{0}' ", materialGroup);
//} //}
// string str= "SELECT\n" +
//" temp1.*,\n" +
//" TEMP2.Price,(\n" +
//" Isnull( temp2.Price, 0 ) * isnull( temp1.Qty, 0 )) Amt \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" b.YEAR,\n" +
//" isnull( a.OrderBillNum, b.Kenncode ) kennocode,\n" +
//" b.MaterialCode,\n" +
//" b.Model,\n" +
//" isnull( a.ChassisNumber, b.ChassisNumber ) ChassisNumber,\n" +
//" isnull( a.Qty, 0 ) Qty,\n" +
//" isnull( a.BeginTime, b.CP5A ) CP5Time,\n" +
//" a.ChassisNumber2,\n" +
//" B.CP7 CP7Time,\n" +
//" isnull( a.QTY, b.Qty ) SettledQty,\n" +
//" a.ErpMaterialCode ParentSapMaterialCode,\n" +
//" isnull( a.WMSState, '' ) WMSState,\n" +
//" isnull( a.WMSBillNum, '' ) WMSBillNum,\n" +
//" d.MaterialCode SapMaterialCode,\n" +
//" d.MaterialDesc MaterialDesc,\n" +
//" d.EstimateTypeDesc MaterialGroup,\n" +
//" e.MaterialDesc ParentMaterialDesc,\n" +
//" c.InvoicePrice,\n" +
//" Round( c.InvoicePrice * isnull( a.QTY, b.Qty ), 2 ) InvoiceAmt,\n" +
//" Round( c.InvoicePrice * isnull( a.QTY, b.Qty ), 2 ) SettleAmt,\n" +
//" isnull( a.Qty, 0 ) - IsNull( B.Qty, 0 ) DiffSettleFisQty,\n" +
//" 0 DiffSettleInvQty,\n" +
//" isnull( a.QTY, b.Qty ) InvoiceQty \n" +
//" FROM\n" +
//" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" +
//" LEFT JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" +
//" AND b.KENNCode = a.KENNCode \n" +
//" AND b.MaterialCode = a.ItemCode\n" +
//" LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON b.MaterialCode = c.MaterialCode\n" +
//" LEFT JOIN set_material d ON b.MaterialCode = d.CustomerPartCode\n" +
//" LEFT JOIN set_material e ON a.ErpMaterialCode = e.MaterialCode \n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE version = ( SELECT Max( Version ) FROM Set_PriceList ) AND type = 10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode"
string str = string str =
"SELECT\n" + "SELECT\n" +
" temp1.*,\n" + " temp1.*,\n" +
@ -187,9 +253,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" c.InvoicePrice,\n" + " c.InvoicePrice,\n" +
" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" + " Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" +
" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" + " Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" +
" a.Qty - IsNull( B.Qty, 0 ) DiffSettleFisQty,\n" + " 0 DiffSettleFisQty,\n" +
" 0 DiffSettleInvQty, \n" + " 0 DiffSettleInvQty, \n" +
" a.Qty InvoiceQty \n" + " a.Qty InvoiceQty ,\n" +
" IsNull( B.Qty, 0 ) SettleReadyQty \n" +
" FROM\n" + " FROM\n" +
" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" + " ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" +
" INNER JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" + " INNER JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" +
@ -197,7 +264,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND b.MaterialCode = a.ItemCode\n" + " AND b.MaterialCode = a.ItemCode\n" +
" LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON a.ItemCode = c.MaterialCode\n" + " LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON a.ItemCode = c.MaterialCode\n" +
" LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" + " LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" +
" LEFT JOIN set_material e ON a.ErpMaterialCode = e.MaterialCode {1} \n" + " LEFT JOIN (select max(CreationTime) CreateTime,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) e ON a.ErpMaterialCode = e.MaterialCode {1} \n" +
" ) TEMP1\n" + " ) TEMP1\n" +
" LEFT JOIN (\n" + " LEFT JOIN (\n" +
" SELECT\n" + " SELECT\n" +

30
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

@ -95,10 +95,10 @@ namespace SettleAccount.Job.Services
DiffSettleFisQty = 0, DiffSettleFisQty = 0,
DiffSettleInvQty = 0, DiffSettleInvQty = 0,
InvoiceQty = 1, InvoiceQty = 1,
InvoicePrice = tm1.Price, InvoicePrice =itm1==null?0: tm1.Price,
InvocieAmt = tm1.Price, InvocieAmt = itm1 == null ?0: tm1.Price,
SettleAmt = tm1.Price, SettleAmt = itm1 == null ?0: tm1.Price,
DiffPrice = tm1.Price-itm1.Price DiffPrice = itm1 == null ?0-itm1.Price: tm1.Price-itm1.Price
}; };
rangeList = rangList.ToList(); rangeList = rangList.ToList();
@ -106,8 +106,11 @@ namespace SettleAccount.Job.Services
foreach (var itm in diffList) foreach (var itm in diffList)
{ {
var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode); var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoiceQty = _first.SettledQty + itm.DiffQty; if (_first != null)
_first.DiffSettleInvQty = itm.DiffQty; {
_first.InvoiceQty = _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
} }
foreach (var itm in _ls) foreach (var itm in _ls)
@ -117,6 +120,17 @@ namespace SettleAccount.Job.Services
} }
_ls.AddRange(rangeList); _ls.AddRange(rangeList);
//var list1 = _ls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.SettleReadyQty }).Select(p => new { SettleQty = p.Key.SettleReadyQty, MaterialCode = p.Key.MaterialCode, ChassisNumber = p.Key.ChassisNumber, Qty = p.Sum(itm => itm.Qty) }).Where(p => p.Qty > 1).ToList();
//foreach (var itm in list1)
//{
// var _first = _ls.FirstOrDefault(p => p.ChassisNumber == itm.ChassisNumber && p.MaterialCode == itm.MaterialCode && p.SettleReadyQty == itm.SettleQty);
// if (_first != null)
// {
// _first.DiffSettleFisQty = itm.Qty - itm.SettleQty;
// }
//}
if (!string.IsNullOrEmpty(materialGroup)) if (!string.IsNullOrEmpty(materialGroup))
{ {
var _groupList= materialGroup.Split(new char[] { ',' }).Distinct().ToList(); var _groupList= materialGroup.Split(new char[] { ',' }).Distinct().ToList();
@ -157,6 +171,10 @@ namespace SettleAccount.Job.Services
_ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); _ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
} }
} }
//.Select(p => p.FirstOrDefault());
_ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList(); _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
} }

2
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs

@ -164,7 +164,7 @@ namespace SettleAccount.Job.Services
var result = _exporter.Append(_ls, "差异明细表") var result = _exporter.Append(_ls, "差异明细表")

Loading…
Cancel
Save