44673626 3 years ago
parent
commit
e7b864de99
  1. 10
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json
  2. 10
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  3. 3
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs
  4. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs
  5. 8
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs
  6. 8
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs
  7. 16
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs
  8. 14
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  9. 4
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs
  10. 56
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  11. 106
      src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/InvoiceSettledDiffs/InvoiceSettledDiff.cs
  12. 5
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  13. 350
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs
  14. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  15. 1
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs
  16. 1
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs
  17. 1
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs
  18. 7
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs

10
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=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;"
"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.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;"
},
"Logging": {
"LogLevel": {

10
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -7,11 +7,11 @@
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService1;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=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;"
"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.63;Database=CPAT_WMS;user id=sa;password=Microsoft2008;"
},
"Logging": {

3
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs

@ -276,6 +276,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
[Route("ExcelImport-PG")]
[DisableRequestSizeLimit]
[Authorize(SettleAccountPermissions.SettleAccounts.Create)]
[UnitOfWork(false)]
public async Task<string> SettleAccountUploadExcelImportTH([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode, string factory)
{
@ -302,6 +303,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
});
return _taskid;
}
/// <summary>

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs

@ -128,6 +128,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
GuidGenerator.Create()
, string.Empty
, itm.Qty
,itm.Price
,itm.Amt
);
_lsCopy.Add(_detail);
}
@ -382,6 +384,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
GuidGenerator.Create()
,string.Empty
, itm.Qty
,itm.Price
,itm.Amt
);
_lsCopy.Add(_detail);
}

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

@ -533,7 +533,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
string.Empty,
_billNum,
0,
0
0,
itm.InvoicePrice
,itm.InvoiceAmt
);
@ -686,7 +688,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
itm.BillNum,
GuidGenerator.Create()
, string.Empty
, itm.Qty
, itm.Qty,
itm.Price,
itm.Amt
);
_lsCopy.Add(_detail);
}

8
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs

@ -184,7 +184,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
string.Empty,
itm.BillNum,
itm.State,
itm.RealityNumber
itm.RealityNumber,
itm.Price,
itm.Amt
);
return new PagedResultDto<WmsWithOutKanbanOutPutDetial>(totalCount, entities);
@ -265,7 +267,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
string.Empty,
_billNum,
0,
0
0,
itm.InvoicePrice,
itm.InvoiceAmt
);

16
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs

@ -175,7 +175,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
itm.Remark,
itm.Qty,
tm1 == null ? 0 : tm1.Qty,
itm.OutPutQty != 0 ? itm.OutPutQty : itm.Qty
itm.OutPutQty != 0 ? itm.OutPutQty : itm.Qty,
itm.Price,
itm.Amt
);
@ -244,7 +246,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
string.Empty,
p.Qty,
p.StockQty,
p.Qty
p.Qty,
p.Price,
p.Amt
));
_lst.AddRange(_list.ToArray());
}
@ -291,7 +295,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
string.Empty,
p.Qty,
p.StockQty,
p.Qty
p.Qty,
p.Price,
p.Amt
)).ToList();
await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum);
@ -469,7 +475,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
, string.Empty
, itm.Qty
, 0
, itm.Qty
, itm.Qty,
itm.Price,
itm.Amt
);
_lsCopy.Add(_detail);
}

14
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs

@ -170,7 +170,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
itm.Remark,
itm.Qty,
tm1 == null ? 0 : tm1.Qty,
itm.OutPutQty
itm.OutPutQty,
itm.Price,
itm.Amt
);
@ -240,7 +242,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
string.Empty,
p.Qty,
p.StockQty,
p.Qty
p.Qty,
p.Price,
p.Amt
));
_lst.AddRange(_list.ToArray());
}
@ -287,7 +291,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
string.Empty,
p.Qty,
p.StockQty,
p.Qty
p.Qty,
p.Price,
p.Amt
)).ToList();
await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum);
@ -485,6 +491,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
, itm.Qty
, 0
, itm.Qty
,itm.Price
,itm.Amt
);
_lsCopy.Add(_detail);
}

4
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
namespace Win.Sfs.SettleAccount.Entities
{
@ -13,6 +14,9 @@ namespace Win.Sfs.SettleAccount.Entities
{
public static List<Material> CacheMaterials { set; get; }
public static List<ErpPrice> CachePriceList { set; get; }
public static List<InvoiceSettledDetailDiff> CacheInvoiceSettledDetailDiff { set; get; }
}
public interface ISettleAccountEntityBase

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

@ -97,7 +97,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public WmsJitOutPutDetial(Guid id, string wmsBillNum, string kennCode, string chassisNumber, 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):base(id)
public WmsJitOutPutDetial(Guid id, string wmsBillNum, string kennCode, string chassisNumber, 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, decimal price, decimal amt) :base(id)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -117,6 +117,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
TaskId = taskId;
Remark = remark;
Qty = qty;
Amt = amt;
Price = price;
}
@ -142,7 +144,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string InPut { set; get; }
[ImporterHeader(Name = "状态")]
public int State { get; set; }
[ImporterHeader(Name = "开票单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "开票金额")]
public decimal Amt { set; get; }
[ImporterHeader(Name = "开票单价",IsIgnore =true)]
/// <summary>
/// 扩展字段1
/// </summary>
@ -242,7 +250,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
{
}
public WmsKanbanOutPutDetial(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)
public WmsKanbanOutPutDetial(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, decimal price, decimal amt)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -261,8 +269,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
TaskId = taskId;
Remark = remark;
Qty = qty;
Price = price;
Amt = amt;
}
public void SetData(Guid id,string remark,string wmsbillnum,string version,Guid taskId)
{
Id = id;
@ -271,8 +284,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Version = version;
TaskId = taskId;
}
// 交货单号 实际发货日期 KENN号 底盘号 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 定价 金额 结算平台未结数量 大众R3未结数量 差异金额 差异数量 漏结标识 漏结期间 说明
[ImporterHeader(Name = "组件组物料",IsIgnore =true)]
@ -323,6 +334,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[ImporterHeader(Name = "任务", IsIgnore = true)]
public Guid TaskId { set; get; }
[ImporterHeader(Name = "开票单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "开票金额")]
public decimal Amt { set; get; }
}
@ -364,7 +381,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public WmsWithOutKanbanOutPutDetial(Guid id ,string type, string sapMaterialCode, string materialDesc, string version, string isBack, string remark, decimal qty, decimal sockQty, decimal outputQty, string extend,string billnum,int state,decimal realqty):base(id)
public WmsWithOutKanbanOutPutDetial(Guid id ,string type, string sapMaterialCode, string materialDesc, string version, string isBack, string remark, decimal qty, decimal sockQty, decimal outputQty, string extend,string billnum,int state,decimal realqty, decimal price, decimal amt) :base(id)
{
Type = type;
SapMaterialCode = sapMaterialCode;
@ -381,8 +398,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
BillNum = billnum;
State = state;
RealityNumber = realqty;
Price = price;
Amt = amt;
}
[ImporterHeader(Name = "单据类型")]
public string Type { set; get; }
[ImporterHeader(Name = "物料号")]
@ -409,6 +430,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string BillNum { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
public int State { set; get; }
[ImporterHeader(Name = "开票单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "开票金额")]
public decimal Amt { set; get; }
}
@ -1389,7 +1415,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
{
}
public WmsSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, 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, decimal stockQty, decimal outputQty)
public WmsSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, 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, decimal stockQty, decimal outputQty, decimal price, decimal amt)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -1410,9 +1436,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Qty = qty;
StockQty = stockQty;
OutPutQty = outputQty;
Price = price;
Amt = amt;
}
public void SetId(Guid id)
{
Id = id;
@ -1476,6 +1505,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[ImporterHeader(Name = "出库数量", IsIgnore = true)]
public decimal OutPutQty { set; get; }
[ImporterHeader(Name = "开票单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "开票金额")]
public decimal Amt { set; get; }
}
@ -1652,7 +1686,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
{
}
public WmsSharePart90OutPutDetial(Guid id, string wmsBillNum, string orderBillNum, 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, decimal stockQty, decimal outputQty)
public WmsSharePart90OutPutDetial(Guid id, string wmsBillNum, string orderBillNum, 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, decimal stockQty, decimal outputQty, decimal price, decimal amt)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -1673,9 +1707,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Qty = qty;
StockQty = stockQty;
OutPutQty = outputQty;
Price = price;
Amt = amt;
}
public void SetId(Guid id)
{
Id = id;
@ -1740,6 +1777,11 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[ImporterHeader(Name = "任务代码", IsIgnore = true)]
public Guid TaskId { set; get; }
[ImporterHeader(Name = "开票单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "开票金额")]
public decimal Amt { set; get; }
}

106
src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/InvoiceSettledDiffs/InvoiceSettledDiff.cs

@ -1,4 +1,5 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
@ -8,6 +9,111 @@ using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs
{
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class InvoiceSettledDetailDiff
: ReportDetailBase
{
//public InvoiceSettledDetailDiff(string wmsBillNum, DateTime cP5Time, string kENNCode, string chassisNumber, string wmsState, string sapMaterialCode, string materialDesc, string materialCode, string parentSapMaterialCode, string parentMaterialDesc, string materialGroup, decimal price, decimal amt, decimal qty, decimal settledQty, DateTime cP7Time, decimal diffSettleFisQty, decimal diffSettleInvQty, decimal invoiceQty, decimal invoicePrice, decimal invocieAmt, decimal settleAmt, decimal diffPrice)
//{
// WmsBillNum = wmsBillNum;
// CP5Time = cP5Time;
// KENNCode = kENNCode;
// ChassisNumber = chassisNumber;
// WmsState = wmsState;
// SapMaterialCode = sapMaterialCode;
// MaterialDesc = materialDesc;
// MaterialCode = materialCode;
// ParentSapMaterialCode = parentSapMaterialCode;
// ParentMaterialDesc = parentMaterialDesc;
// MaterialGroup = materialGroup;
// Price = price;
// Amt = amt;
// Qty = qty;
// SettledQty = settledQty;
// CP7Time = cP7Time;
// DiffSettleFisQty = diffSettleFisQty;
// DiffSettleInvQty = diffSettleInvQty;
// InvoiceQty = invoiceQty;
// InvoicePrice = invoicePrice;
// InvocieAmt = invocieAmt;
// SettleAmt = settleAmt;
// DiffPrice = diffPrice;
//}
[ExporterHeader(DisplayName = "交货单号")]
public override string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "实际发货日期", Format = "yyyy-MM-dd")]
public override DateTime CP5Time { set; get; }
[ExporterHeader(DisplayName = "KENN号")]
public override string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")]
public override string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "交货状态")]
public override string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public override string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述")]
public override string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "客户物料")]
public override string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料")]
public override string ParentSapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料描述")]
public override string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型)")]
public override string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "定价")]
public override decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额")]
public override decimal Amt { set; get; }
//发运数量
[ExporterHeader(DisplayName = "M100数量")]
public decimal Qty { set; get; }
//结算数量
[ExporterHeader(DisplayName = "结算数量")]
public decimal SettledQty { set; get; }
//结算日期
[ExporterHeader(DisplayName = "结算日期", Format = "yyyy-MM-dd")]
public override DateTime CP7Time { set; get; }
//结算与发货差异
[ExporterHeader(DisplayName = "结算与发货差异")]
public decimal DiffSettleFisQty { set; get; }
//结算与开票差异
[ExporterHeader(DisplayName = "结算与开票差异")]
public decimal DiffSettleInvQty { set; get; }
//开票数量
[ExporterHeader(DisplayName = "开票数量")]
public decimal InvoiceQty { set; get; }
//开票单价
[ExporterHeader(DisplayName = "开票单价")]
public override decimal InvoicePrice { set; get; }
//开票金额
[ExporterHeader(DisplayName = "开票金额")]
public decimal InvoiceAmt { set; get; }
//结算金额
[ExporterHeader(DisplayName = "结算金额")]
public decimal SettleAmt { set; get; }
//单价差异
[ExporterHeader(DisplayName = "单价差异")]
public decimal DiffPrice { set; get; }
[ExporterHeader(DisplayName = "结算实际数量", IsIgnore = true)]
public decimal SettleReadyQty { set; get; }
[ExporterHeader(DisplayName = "版本", IsIgnore = true)]
public string Version { set; get; }
//总金额差异
//[ExporterHeader(DisplayName = "总金额差异")]
//public decimal AmtDiffPrice { set; get; }
}
public class InvoiceSettledDiff: FullAuditedAggregateRootBase<Guid>
{
public InvoiceSettledDiff()

5
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs

@ -47,14 +47,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
if (CacheManager.CacheMaterials != null)
{
_materialList = CacheManager.CacheMaterials;
_materialList= CacheManager.CacheMaterials.GroupBy(p => new { p.MaterialCode }).Select(p => p.FirstOrDefault()).ToList();
}
else
{
_materialList = DbConnection.Query<Material>("select * from set_material").ToList();
_materialList = DbConnection.Query<Material>("select max(Id) Factory,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType ").ToList();
}
if (CacheManager.CachePriceList != null)
{
_priceList = CacheManager.CachePriceList;
_priceList = CacheManager.CachePriceList.GroupBy(p => new { p.SapErpPartCode }).Select(p => p.FirstOrDefault()).ToList();
}
else
{

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

@ -9,109 +9,13 @@ using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class InvoiceSettledDetailDiff
: ReportDetailBase
{
//public InvoiceSettledDetailDiff(string wmsBillNum, DateTime cP5Time, string kENNCode, string chassisNumber, string wmsState, string sapMaterialCode, string materialDesc, string materialCode, string parentSapMaterialCode, string parentMaterialDesc, string materialGroup, decimal price, decimal amt, decimal qty, decimal settledQty, DateTime cP7Time, decimal diffSettleFisQty, decimal diffSettleInvQty, decimal invoiceQty, decimal invoicePrice, decimal invocieAmt, decimal settleAmt, decimal diffPrice)
//{
// WmsBillNum = wmsBillNum;
// CP5Time = cP5Time;
// KENNCode = kENNCode;
// ChassisNumber = chassisNumber;
// WmsState = wmsState;
// SapMaterialCode = sapMaterialCode;
// MaterialDesc = materialDesc;
// MaterialCode = materialCode;
// ParentSapMaterialCode = parentSapMaterialCode;
// ParentMaterialDesc = parentMaterialDesc;
// MaterialGroup = materialGroup;
// Price = price;
// Amt = amt;
// Qty = qty;
// SettledQty = settledQty;
// CP7Time = cP7Time;
// DiffSettleFisQty = diffSettleFisQty;
// DiffSettleInvQty = diffSettleInvQty;
// InvoiceQty = invoiceQty;
// InvoicePrice = invoicePrice;
// InvocieAmt = invocieAmt;
// SettleAmt = settleAmt;
// DiffPrice = diffPrice;
//}
[ExporterHeader(DisplayName = "交货单号")]
public override string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "实际发货日期", Format = "yyyy-MM-dd")]
public override DateTime CP5Time { set; get; }
[ExporterHeader(DisplayName = "KENN号")]
public override string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")]
public override string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "交货状态")]
public override string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public override string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述")]
public override string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "客户物料")]
public override string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料")]
public override string ParentSapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料描述")]
public override string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型)")]
public override string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "定价")]
public override decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额") ]
public override decimal Amt { set; get; }
//发运数量
[ExporterHeader(DisplayName = "M100数量")]
public decimal Qty { set; get; }
//结算数量
[ExporterHeader(DisplayName = "结算数量")]
public decimal SettledQty { set; get; }
//结算日期
[ExporterHeader(DisplayName = "结算日期", Format = "yyyy-MM-dd")]
public override DateTime CP7Time { set; get; }
//结算与发货差异
[ExporterHeader(DisplayName = "结算与发货差异")]
public decimal DiffSettleFisQty{ set; get; }
//结算与开票差异
[ExporterHeader(DisplayName = "结算与开票差异")]
public decimal DiffSettleInvQty { set; get; }
//开票数量
[ExporterHeader(DisplayName = "开票数量")]
public decimal InvoiceQty { set; get; }
//开票单价
[ExporterHeader(DisplayName = "开票单价")]
public override decimal InvoicePrice { set; get; }
//开票金额
[ExporterHeader(DisplayName = "开票金额")]
public decimal InvoiceAmt { set; get; }
//结算金额
[ExporterHeader(DisplayName = "结算金额")]
public decimal SettleAmt { set; get; }
//单价差异
[ExporterHeader(DisplayName = "单价差异")]
public decimal DiffPrice { set; get; }
[ExporterHeader(DisplayName = "结算实际数量",IsIgnore =true)]
public decimal SettleReadyQty { set; get; }
//总金额差异
//[ExporterHeader(DisplayName = "总金额差异")]
//public decimal AmtDiffPrice { set; get; }
}
/// <summary>
/// 2.大众发票与结算核对明细表-准时化
/// </summary>
@ -123,163 +27,117 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
public virtual List<InvoiceSettledDetailDiff> GetInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end ,string cp7begin,string cp7end,string kennCode,string chassisNumber,string materialGroup)
{
List<InvoiceSettledDetailDiff> _list = new List<InvoiceSettledDetailDiff>();
string condition = " where 1=1 ";
//if (!string.IsNullOrEmpty(materialCode))
//{
// condition += string.Format(" and d.MaterialCode in ({0}) ", materialCode);
//}
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" and a.BeginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" and a.BeginTime<='{0}' ", end);
}
if (!string.IsNullOrEmpty(cp7begin))
if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version)>0)
{
condition += string.Format(" and B.cp7>='{0}' ", cp7begin);
_list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p=>p.Version==version).ToList();
_list= _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
}
if (!string.IsNullOrEmpty(cp7end))
else
{
condition += string.Format(" and B.cp7<='{0}' ", cp7end);
}
//if (!string.IsNullOrEmpty(kennCode))
//{
// condition += string.Format(" and B.kenncode='{0}' ", kennCode);
//}
//if (!string.IsNullOrEmpty(chassisNumber))
//{
// condition += string.Format(" and B.chassisNumber='{0}' ", chassisNumber);
//}
//if (!string.IsNullOrEmpty(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 isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle1] WITH(SNAPSHOT) where Version = '{0}'", version);
int _count = DbConnection.ExecuteScalar<int>(isExistSql);
string condition = " where 1=1 ";
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" and a.BeginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" and a.BeginTime<='{0}' ", end);
}
if (!string.IsNullOrEmpty(cp7begin))
{
condition += string.Format(" and B.cp7>='{0}' ", cp7begin);
}
if (!string.IsNullOrEmpty(cp7end))
{
condition += string.Format(" and B.cp7<='{0}' ", cp7end);
}
string tablestr = (_count == 0) ?
" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" :
" (SELECT count(1) lincount FROM [Set_Settle1] WITH(SNAPSHOT) where Version = '{0}') b \n";
string str =
"SELECT\n" +
string.Format(" '{0}' version ,\n",version)+
" temp1.*,\n" +
" TEMP2.Price,(\n" +
" Isnull( temp2.Price, 0 ) * isnull( temp1.Qty, 0 )) Amt \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" b.YEAR,\n" +
" a.OrderBillNum Kenncode,\n" +
" b.MaterialCode,\n" +
" b.Model,\n" +
" a.ChassisNumber,\n" +
" a.Qty,\n" +
" a.BeginTime CP5Time,\n" +
" a.ChassisNumber2,\n" +
" B.CP7 CP7Time,\n" +
" a.QTY SettledQty,\n" +
" a.ErpMaterialCode ParentSapMaterialCode,\n" +
" a.WMSState,\n" +
" a.WMSBillNum,\n" +
" d.MaterialCode SapMaterialCode,\n" +
" d.MaterialDesc MaterialDesc,\n" +
" d.EstimateTypeDesc MaterialGroup,\n" +
" e.MaterialDesc ParentMaterialDesc,\n" +
" c.InvoicePrice,\n" +
" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" +
" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" +
" 0 DiffSettleFisQty,\n" +
" 0 DiffSettleInvQty, \n" +
" a.Qty InvoiceQty ,\n" +
" IsNull( B.Qty, 0 ) SettleReadyQty \n" +
" FROM\n" +
tablestr +
" INNER 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 a.ItemCode = c.MaterialCode\n" +
" LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" +
" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) e ON a.ErpMaterialCode = e.MaterialCode {1} \n" +
" ) TEMP1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode";
var _sql = string.Format(str, version, condition);
var _query = DbConnection.Query<InvoiceSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0)
{
_list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList();
_list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
}
else
{
CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list);
}
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" +
" a.OrderBillNum Kenncode,\n" +
" b.MaterialCode,\n" +
" b.Model,\n" +
" a.ChassisNumber,\n" +
" a.Qty,\n" +
" a.BeginTime CP5Time,\n" +
" a.ChassisNumber2,\n" +
" B.CP7 CP7Time,\n" +
" a.QTY SettledQty,\n" +
" a.ErpMaterialCode ParentSapMaterialCode,\n" +
" a.WMSState,\n" +
" a.WMSBillNum,\n" +
" d.MaterialCode SapMaterialCode,\n" +
" d.MaterialDesc MaterialDesc,\n" +
" d.EstimateTypeDesc MaterialGroup,\n" +
" e.MaterialDesc ParentMaterialDesc,\n" +
" c.InvoicePrice,\n" +
" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" +
" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" +
" 0 DiffSettleFisQty,\n" +
" 0 DiffSettleInvQty, \n" +
" a.Qty InvoiceQty ,\n" +
" IsNull( B.Qty, 0 ) SettleReadyQty \n" +
" FROM\n" +
" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" +
" INNER 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 a.ItemCode = c.MaterialCode\n" +
" LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" +
" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) e ON a.ErpMaterialCode = e.MaterialCode {1} \n" +
" ) TEMP1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode";
var _sql = string.Format(str, version,condition);
var _query = DbConnection.Query<InvoiceSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list=_query.ToList();
}
return _list;
}

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs

@ -36,7 +36,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public decimal InvoiceQty { get; set; }
[ExporterHeader(DisplayName ="发货数量")]
public decimal Qty { get; set; }
[ExporterHeader(DisplayName = "金额")]
[ExporterHeader(DisplayName = "开票金额")]
public decimal InvoiceAmt { get; set; }
[ExporterHeader(DisplayName = "开票单价")]
public decimal InvoicePrice { get; set; }

1
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnInvoiceSettledDetailDiffDapperRepository.cs

@ -10,6 +10,7 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{

1
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/SettleAccounts/SettleAccountRepository.cs

@ -86,6 +86,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccount
{
}
public virtual bool Delete(string version)
{
try

1
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleDoorPanelExportService.cs

@ -10,6 +10,7 @@ using TaskJob.Interfaces;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report

7
src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs

@ -1,5 +1,6 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Job.Services;
using System;
using System.Collections.Generic;
@ -11,6 +12,7 @@ using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Emailing;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.SettleAccounts;
@ -156,6 +158,11 @@ namespace TaskJob.Services
_setls = _setls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList();
_repository.Insert(_setls);
_versionRepository.Insert(_id, version, customerCode, customerCode);
_repository.GetDbContext().Database.ExecuteSqlRaw(
"EXEC sp_settle_fis_update"
);
return id.ToString();
}
}

Loading…
Cancel
Save