Browse Source

看板和备件修改的相关代码

FoShanPG
44673626 3 years ago
parent
commit
c833b94c6d
  1. 3
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs
  2. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs
  3. 10
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  4. 261
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS-KanBan/WMSKanBanSettle.cs
  5. 371
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS-SparePart/WMSSparePart.cs
  6. 62
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  7. 47
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  8. 35
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithCodeExportService.cs

3
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-KanBan/WMSKanBanAppService.cs

@ -104,7 +104,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
_bomList.Add(new WMSKanBanVersion(_id, branchId, year, period, version, customerCode)); _bomList.Add(new WMSKanBanVersion(_id, branchId, year, period, version, customerCode));
foreach (var itm in entityList) foreach (var itm in entityList)
{ {
itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id); //itm.SetValue(GuidGenerator.Create(), year, period, version);
itm.SetValue(GuidGenerator.Create(), version);
} }
if (checkList.Count > 0) if (checkList.Count > 0)
{ {

4
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS-SparePart/WMSSparePartAppService.cs

@ -91,12 +91,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
await _query.BatchDeleteAsync(); await _query.BatchDeleteAsync();
//插入数据前检验 //插入数据前检验
var checkList = new List<ErrorExportDto>(); var checkList = new List<ErrorExportDto>();
var _group = entityList.GroupBy(x => new { x.LineNumber, x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), LineNumber = p.Key.LineNumber, MaterialCode = p.Key.MaterialCode }); var _group = entityList.GroupBy(x => new { x.MaterialCode, x.Version }).Select(p => new { Count = p.Count(), MaterialCode = p.Key.MaterialCode });
foreach (var itm in _group) foreach (var itm in _group)
{ {
if (string.IsNullOrEmpty(itm.MaterialCode)) if (string.IsNullOrEmpty(itm.MaterialCode))
{ {
checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的行号为{0}的物料代码为空,请检查!", itm.LineNumber), string.Empty)); checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的行号为{0}的物料代码为空,请检查!", itm.MaterialCode), string.Empty));
} }
} }
var _id = GuidGenerator.Create(); var _id = GuidGenerator.Create();

10
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -385,11 +385,11 @@ namespace Win.Sfs.SettleAccount
{ {
CreateMap<WMSKanBanSettle, WMSVWKanBanDto>().ReverseMap(); CreateMap<WMSKanBanSettle, WMSVWKanBanDto>().ReverseMap();
CreateMap<WMSKanBanSettle, WMSVWKanBanRequestDto>().ReverseMap(); CreateMap<WMSKanBanSettle, WMSVWKanBanRequestDto>().ReverseMap();
CreateMap<WMSVWKanBanImportDto, WMSKanBanSettle>() //CreateMap<WMSVWKanBanImportDto, WMSKanBanSettle>()
.ForMember(dest => dest.SettleInputDate, // .ForMember(dest => dest.SettleInputDate,
opt => opt.MapFrom(src => DateTime.ParseExact(src.SettleInputDate, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture))) // opt => opt.MapFrom(src => DateTime.ParseExact(src.SettleInputDate, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture)))
.ForMember(dest => dest.SettleDate, // .ForMember(dest => dest.SettleDate,
opt => opt.MapFrom(src => DateTime.ParseExact(src.SettleDate, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture))); // opt => opt.MapFrom(src => DateTime.ParseExact(src.SettleDate, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture)));
CreateMap<WMSKanBanSettle, WMSVWKanBanExportDto>().ReverseMap(); CreateMap<WMSKanBanSettle, WMSVWKanBanExportDto>().ReverseMap();
} }

261
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS-KanBan/WMSKanBanSettle.cs

@ -9,16 +9,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
{ {
public class WMSKanBanSettle : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase public class WMSKanBanSettle : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase
{ {
/// <summary> public Guid Id { set; get; }
///年度
/// </summary>
public string Year { get; protected set; }
/// <summary>
/// 期间
/// </summary>
public string Period { set; get; }
/// <summary> /// <summary>
/// 版本 /// 版本
/// </summary> /// </summary>
@ -34,10 +25,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
public string Relation { set; get; } public string Relation { set; get; }
/// <summary> /// <summary>
/// 工厂
/// </summary>
public string Factory { set; get; }
/// <summary>
/// 零件号 /// 零件号
/// </summary> /// </summary>
public string MaterialCode { set; get; } public string MaterialCode { set; get; }
@ -45,41 +32,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
/// 零件类型 /// 零件类型
/// </summary> /// </summary>
public string PartType { set; get; } public string PartType { set; get; }
/// <summary>
/// 供应商编码
/// </summary>
public string SupplierCode { set; get; }
/// <summary>
/// R3入库时间
/// </summary>
public DateTime SettleInputDate { set; get; }
/// <summary>
/// 批次
/// </summary>
public string Batch { set; get; }
/// <summary>
/// 入库结算标识
/// </summary>
public string Flag { set; get; }
/// <summary>
/// 数量
/// </summary>
public decimal Qty { set; get; }
/// <summary>
/// R3结算时间
/// </summary>
public DateTime SettleDate { set; get; }
/// <summary>
/// 结算状态
/// </summary>
public string State { set; get; }
/// <summary> /// <summary>
/// WMS交货单 /// WMS交货单
@ -89,85 +42,43 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
/// <summary> /// <summary>
/// WMS实际发货日期 /// WMS实际发货日期
/// </summary> /// </summary>
public string WMSActualGoodsDate { set; get; } public DateTime WMSActualGoodsDate { set; get; }
/// <summary> /// <summary>
/// WMS交货数量 /// WMS交货数量
/// </summary> /// </summary>
public decimal WMSDeliveryQty { set; get; } public decimal WMSDeliveryQty { set; get; }
/// <summary>
/// WMS发货状态
/// </summary>
public string WMSDeliverGoodsState { set; get; }
/// <summary>
/// 看板结算状态
/// </summary>
public string WMSKanBanState { set; get; }
/// <summary> /// <summary>
/// 出库单号 /// 出库单号
/// </summary> /// </summary>
public string DeliveryOrderNo { set; get; } public string DeliveryOrderNo { set; get; }
/// <summary>
/// 备注
/// </summary>
public string Extend { set; get; }
public Guid ParentId { get; protected set; } public void SetValue(Guid guid, string version)
public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version, Guid parentId)
{ {
Period = peroid;
Year = year;
Id = guid; Id = guid;
Version = version; Version = version;
BranchId = branchId;
ParentId = parentId;
} }
public WMSKanBanSettle() public WMSKanBanSettle()
{ } { }
public WMSKanBanSettle( public WMSKanBanSettle(
Guid id, Guid id,
Guid branchId, Guid branchId,
string year,
string version, string version,
string kanban, string kanban,
string relation, string relation,
string factory,
string materialCode, string materialCode,
string partType, string partType,
DateTime settleInputDate,
string supplierCode,
decimal qty,
string batch,
string flag,
DateTime settleDate,
string state,
Guid parentId,
//DateTime creationTime,
Guid guid) : base(id) Guid guid) : base(id)
{ {
BranchId = branchId; BranchId = branchId;
Year = year;
Version = version; Version = version;
Kanban = kanban; Kanban = kanban;
Relation = relation; Relation = relation;
Factory = factory;
MaterialCode = materialCode; MaterialCode = materialCode;
PartType = partType; PartType = partType;
SettleInputDate = settleInputDate;
SupplierCode = supplierCode;
Qty = qty;
Batch = batch;
Flag = flag;
SettleDate = settleDate;
State = state;
ParentId = parentId;
//CreationTime = creationTime;
CreatorId = guid; CreatorId = guid;
} }
@ -176,4 +87,168 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
} }
//public class WMSKanBanSettle : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase
//{
// /// <summary>
// ///年度
// /// </summary>
// public string Year { get; protected set; }
// /// <summary>
// /// 期间
// /// </summary>
// public string Period { set; get; }
// /// <summary>
// /// 版本
// /// </summary>
// public string Version { set; get; }
// /// <summary>
// /// 看板条码号
// /// </summary>
// public string Kanban { set; get; }
// /// <summary>
// /// 入库关联号
// /// </summary>
// public string Relation { set; get; }
// /// <summary>
// /// 工厂
// /// </summary>
// public string Factory { set; get; }
// /// <summary>
// /// 零件号
// /// </summary>
// public string MaterialCode { set; get; }
// /// <summary>
// /// 零件类型
// /// </summary>
// public string PartType { set; get; }
// /// <summary>
// /// 供应商编码
// /// </summary>
// public string SupplierCode { set; get; }
// /// <summary>
// /// R3入库时间
// /// </summary>
// public DateTime SettleInputDate { set; get; }
// /// <summary>
// /// 批次
// /// </summary>
// public string Batch { set; get; }
// /// <summary>
// /// 入库结算标识
// /// </summary>
// public string Flag { set; get; }
// /// <summary>
// /// 数量
// /// </summary>
// public decimal Qty { set; get; }
// /// <summary>
// /// R3结算时间
// /// </summary>
// public DateTime SettleDate { set; get; }
// /// <summary>
// /// 结算状态
// /// </summary>
// public string State { set; get; }
// /// <summary>
// /// WMS交货单
// /// </summary>
// public string WMSDeliveryNote { set; get; }
// /// <summary>
// /// WMS实际发货日期
// /// </summary>
// public string WMSActualGoodsDate { set; get; }
// /// <summary>
// /// WMS交货数量
// /// </summary>
// public decimal WMSDeliveryQty { set; get; }
// /// <summary>
// /// WMS发货状态
// /// </summary>
// public string WMSDeliverGoodsState { set; get; }
// /// <summary>
// /// 看板结算状态
// /// </summary>
// public string WMSKanBanState { set; get; }
// /// <summary>
// /// 出库单号
// /// </summary>
// public string DeliveryOrderNo { set; get; }
// /// <summary>
// /// 备注
// /// </summary>
// public string Extend { set; get; }
// public void SetValue(Guid guid, string year, string peroid, string version)
// {
// Period = peroid;
// Year = year;
// Id = guid;
// Version = version;
// }
// public WMSKanBanSettle()
// { }
// public WMSKanBanSettle(
// Guid id,
// Guid branchId,
// string year,
// string version,
// string kanban,
// string relation,
// string factory,
// string materialCode,
// string partType,
// DateTime settleInputDate,
// string supplierCode,
// decimal qty,
// string batch,
// string flag,
// DateTime settleDate,
// string state,
// //DateTime creationTime,
// Guid guid) : base(id)
// {
// BranchId = branchId;
// Year = year;
// Version = version;
// Kanban = kanban;
// Relation = relation;
// Factory = factory;
// MaterialCode = materialCode;
// PartType = partType;
// SettleInputDate = settleInputDate;
// SupplierCode = supplierCode;
// Qty = qty;
// Batch = batch;
// Flag = flag;
// SettleDate = settleDate;
// State = state;
// //CreationTime = creationTime;
// CreatorId = guid;
// }
//}
} }

371
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS-SparePart/WMSSparePart.cs

@ -15,8 +15,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version) public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version)
{ {
Period = peroid; //Period = peroid;
Year = year; //Year = year;
Id = guid; Id = guid;
Version = version; Version = version;
BranchId = branchId; BranchId = branchId;
@ -29,187 +29,280 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
) : base(Id) ) : base(Id)
{ {
Year = year;
Period = period;
Version = version; Version = version;
LineNumber = lineNumber;
PurchaseType = purchaseType;
PurchaseOrderNo = purchaseOrderNo;
PurchaseOrderNoItem = purchaseOrderNoItem;
PurchaseOrderNoText = purchaseOrderNoText;
ReceiptQty = receiptQty; ReceiptQty = receiptQty;
InvoicedQty = invoicedQty;
AmountNoTax = amountNoTax;
PurchasePriceNoTax = purchasePriceNoTax;
AccountNum = accountNum;
MaterialCode = materialCode; MaterialCode = materialCode;
MaterialDesc = materialDesc; MaterialDesc = materialDesc;
SpareDate = spareDate; SpareDate = spareDate;
DeliveryOrderNo = deliveryOrderNo;
DeliveryLineNum = deliveryLineNum;
BatchNo = batchNo;
Unit = unit;
TaxRate = taxRate;
TaxCode = taxCode;
Factory = factory;
} }
//行号 采购类型 采购订单号 采购订单行项目 采购订单文本 收货数量 开票数量 不含税金额 采购价格不含税
//科目号 物料代码 物料描述 日期 交货单号 交货行号 批次号 单位 税率 税码
//德国发票号 AP_REQUISITION_MIMRS.GERMANY_INVOCE_AMOUNT 借贷 PO币种 工厂 工厂名称 BM 单号
/// <summary>
///年
/// </summary>
[Display(Name = "年")]
public string Year { get; set; }
/// <summary>
/// 期间
/// </summary>
[Display(Name = "交货日期")]
public string Period { set; get; }
/// <summary> /// <summary>
/// 版本号 /// 版本号
/// </summary> /// </summary>
[Display(Name = "版本号")] [Display(Name = "版本号")]
public string Version { set; get; } public string Version { set; get; }
/// <summary>
/// 行号
/// </summary>
[Display(Name = "行号")]
public string LineNumber { set; get; }
/// <summary> /// <summary>
/// 采购类型 /// SAP物料号
/// </summary> /// </summary>
[Display(Name = "采购类型")] [Display(Name = "SAP物料号")]
public string PurchaseType { get; set; } public string SapCode { get; set; }
/// <summary>
/// 采购订单号
/// </summary>
[Display(Name = "采购订单号")]
public string PurchaseOrderNo { get; set; }
/// <summary>
/// 采购订单行项目
/// </summary>
[Display(Name = "采购订单行项目")]
public string PurchaseOrderNoItem { get; set; }
/// <summary>
/// 采购订单文本
/// </summary>
[Display(Name = "采购订单文本")]
public string PurchaseOrderNoText { get; set; }
/// <summary>
/// 收货数量
/// </summary>
[Display(Name = "发货数量")]
public decimal ReceiptQty { get; set; }
/// <summary> /// <summary>
/// 开票数量 /// 主机厂
/// </summary> /// </summary>
[Display(Name = "开票数量")] [Display(Name = "主机厂")]
public decimal InvoicedQty { get; set; } public string MainFactory { get; set; }
/// <summary>
/// 不含税金额
/// </summary>
[Display(Name = "不含税金额")]
public decimal AmountNoTax { get; set; }
/// <summary>
/// 采购价格不含税
/// </summary>
[Display(Name = "采购价格不含税")]
public decimal PurchasePriceNoTax { get; set; }
/// <summary> /// <summary>
/// 科目号 /// 车型
/// </summary> /// </summary>
[Display(Name = "科目号")] [Display(Name = "车型")]
public string AccountNum { get; set; } public string MaterialGroup { get; set; }
/// <summary> /// <summary>
/// 物料代码 /// 物料代码-零件号
/// </summary> /// </summary>
[Display(Name = "物料代码")] [Display(Name = "物料代码")]
public string MaterialCode { get; set; } public string MaterialCode { get; set; }
/// <summary> /// <summary>
/// 物料描述 /// 物料描述-存货名称
/// </summary> /// </summary>
[Display(Name = "物料描述")] [Display(Name = "物料描述")]
public string MaterialDesc { get; set; } public string MaterialDesc { get; set; }
/// <summary> /// <summary>
/// 日期 /// 发货数量
/// </summary>
[Display(Name = "订单日期")]
public DateTime SpareDate { get; set; }
/// <summary>
/// 交货单号
/// </summary>
[Display(Name = "交货单号")]
public string DeliveryOrderNo { get; set; }
/// <summary>
/// 交货行号
/// </summary>
[Display(Name = "交货行号")]
public string DeliveryLineNum { get; set; }
/// <summary>
/// 批次号
/// </summary>
[Display(Name = "批次号")]
public string BatchNo { get; set; }
/// <summary>
/// 单位
/// </summary>
[Display(Name = "单位")]
public string Unit { get; set; }
/// <summary>
/// 税率
/// </summary>
[Display(Name = "税率")]
public decimal TaxRate { get; set; }
/// <summary>
/// 税码
/// </summary>
[Display(Name = "税码")]
public string TaxCode { get; set; }
/// <summary>
/// 德国发票号
/// </summary>
[Display(Name = "德国发票号")]
public string GermanInvoiceNo { get; set; }
/// <summary>
/// 工厂
/// </summary>
[Display(Name = "工厂")]
public string Factory { get; set; }
/// <summary>
/// 工厂名称
/// </summary> /// </summary>
[Display(Name = "工厂名称")] [Display(Name = "发货数量")]
public string FactoryName { get; set; } public decimal ReceiptQty { get; set; }
/// <summary> /// <summary>
/// 备注 /// 订单号
/// </summary> /// </summary>
[Display(Name = "备注")] [Display(Name = "订单号")]
public string Extend { set; get; } public string PurchaseOrderNo { get; set; }
/// <summary> /// <summary>
/// WMS采购订单号 /// 交货单号
/// </summary> /// </summary>
[Display(Name = "交货单号")]
public string WMSDeliveryNote { set; get; } public string WMSDeliveryNote { set; get; }
/// <summary> /// <summary>
/// WMS发货状态 /// 交货日期
/// </summary> /// </summary>
public string WMSDeliverGoodsState { set; get; } [Display(Name = "交货日期")]
public DateTime SpareDate { get; set; }
/// <summary>
/// 看板结算状态
/// </summary>
public string WMSSparePartState { set; get; }
}
//public class WMSSparePart : FullAuditedAggregateRootBase<Guid>, ISettleAccountEntityBase
//{
// public WMSSparePart()
// { }
// public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version)
// {
// Period = peroid;
// Year = year;
// Id = guid;
// Version = version;
// BranchId = branchId;
// }
// public WMSSparePart(Guid Id, string year, string period, string version, string lineNumber,
// string purchaseType, string purchaseOrderNo, string purchaseOrderNoItem, string purchaseOrderNoText,
// decimal receiptQty, decimal invoicedQty, decimal amountNoTax, decimal purchasePriceNoTax,
// string accountNum, string materialCode, string materialDesc, DateTime spareDate, string deliveryOrderNo,
// string deliveryLineNum, string batchNo, string unit, decimal taxRate, string taxCode, string factory
} // ) : base(Id)
// {
// Year = year;
// Period = period;
// Version = version;
// LineNumber = lineNumber;
// PurchaseType = purchaseType;
// PurchaseOrderNo = purchaseOrderNo;
// PurchaseOrderNoItem = purchaseOrderNoItem;
// PurchaseOrderNoText = purchaseOrderNoText;
// ReceiptQty = receiptQty;
// InvoicedQty = invoicedQty;
// AmountNoTax = amountNoTax;
// PurchasePriceNoTax = purchasePriceNoTax;
// AccountNum = accountNum;
// MaterialCode = materialCode;
// MaterialDesc = materialDesc;
// SpareDate = spareDate;
// DeliveryOrderNo = deliveryOrderNo;
// DeliveryLineNum = deliveryLineNum;
// BatchNo = batchNo;
// Unit = unit;
// TaxRate = taxRate;
// TaxCode = taxCode;
// Factory = factory;
// }
// //行号 采购类型 采购订单号 采购订单行项目 采购订单文本 收货数量 开票数量 不含税金额 采购价格不含税
// //科目号 物料代码 物料描述 日期 交货单号 交货行号 批次号 单位 税率 税码
// //德国发票号 AP_REQUISITION_MIMRS.GERMANY_INVOCE_AMOUNT 借贷 PO币种 工厂 工厂名称 BM 单号
// /// <summary>
// ///年
// /// </summary>
// [Display(Name = "年")]
// public string Year { get; set; }
// /// <summary>
// /// 期间
// /// </summary>
// [Display(Name = "交货日期")]
// public string Period { set; get; }
// /// <summary>
// /// 版本号
// /// </summary>
// [Display(Name = "版本号")]
// public string Version { set; get; }
// /// <summary>
// /// 行号
// /// </summary>
// [Display(Name = "行号")]
// public string LineNumber { set; get; }
// /// <summary>
// /// 采购类型
// /// </summary>
// [Display(Name = "采购类型")]
// public string PurchaseType { get; set; }
// /// <summary>
// /// 采购订单号
// /// </summary>
// [Display(Name = "采购订单号")]
// public string PurchaseOrderNo { get; set; }
// /// <summary>
// /// 采购订单行项目
// /// </summary>
// [Display(Name = "采购订单行项目")]
// public string PurchaseOrderNoItem { get; set; }
// /// <summary>
// /// 采购订单文本
// /// </summary>
// [Display(Name = "采购订单文本")]
// public string PurchaseOrderNoText { get; set; }
// /// <summary>
// /// 收货数量
// /// </summary>
// [Display(Name = "发货数量")]
// public decimal ReceiptQty { get; set; }
// /// <summary>
// /// 开票数量
// /// </summary>
// [Display(Name = "开票数量")]
// public decimal InvoicedQty { get; set; }
// /// <summary>
// /// 不含税金额
// /// </summary>
// [Display(Name = "不含税金额")]
// public decimal AmountNoTax { get; set; }
// /// <summary>
// /// 采购价格不含税
// /// </summary>
// [Display(Name = "采购价格不含税")]
// public decimal PurchasePriceNoTax { get; set; }
// /// <summary>
// /// 科目号
// /// </summary>
// [Display(Name = "科目号")]
// public string AccountNum { get; set; }
// /// <summary>
// /// 物料代码
// /// </summary>
// [Display(Name = "物料代码")]
// public string MaterialCode { get; set; }
// /// <summary>
// /// 物料描述
// /// </summary>
// [Display(Name = "物料描述")]
// public string MaterialDesc { get; set; }
// /// <summary>
// /// 日期
// /// </summary>
// [Display(Name = "订单日期")]
// public DateTime SpareDate { get; set; }
// /// <summary>
// /// 交货单号
// /// </summary>
// [Display(Name = "交货单号")]
// public string DeliveryOrderNo { get; set; }
// /// <summary>
// /// 交货行号
// /// </summary>
// [Display(Name = "交货行号")]
// public string DeliveryLineNum { get; set; }
// /// <summary>
// /// 批次号
// /// </summary>
// [Display(Name = "批次号")]
// public string BatchNo { get; set; }
// /// <summary>
// /// 单位
// /// </summary>
// [Display(Name = "单位")]
// public string Unit { get; set; }
// /// <summary>
// /// 税率
// /// </summary>
// [Display(Name = "税率")]
// public decimal TaxRate { get; set; }
// /// <summary>
// /// 税码
// /// </summary>
// [Display(Name = "税码")]
// public string TaxCode { get; set; }
// /// <summary>
// /// 德国发票号
// /// </summary>
// [Display(Name = "德国发票号")]
// public string GermanInvoiceNo { get; set; }
// /// <summary>
// /// 工厂
// /// </summary>
// [Display(Name = "工厂")]
// public string Factory { get; set; }
// /// <summary>
// /// 工厂名称
// /// </summary>
// [Display(Name = "工厂名称")]
// public string FactoryName { get; set; }
// /// <summary>
// /// 备注
// /// </summary>
// [Display(Name = "备注")]
// public string Extend { set; get; }
// /// <summary>
// /// WMS采购订单号
// /// </summary>
// public string WMSDeliveryNote { set; get; }
// /// <summary>
// /// WMS发货状态
// /// </summary>
// public string WMSDeliverGoodsState { set; get; }
// /// <summary>
// /// 看板结算状态
// /// </summary>
// public string WMSSparePartState { set; get; }
//}
} }

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

@ -862,37 +862,37 @@ namespace Win.Sfs.SettleAccount
b.ToTable($"{options.TablePrefix}_WMSSparePart", options.Schema); b.ToTable($"{options.TablePrefix}_WMSSparePart", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Year).HasMaxLength(CommonConsts.MaxCodeLength); //b.Property(x => x.Year).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Period).HasMaxLength(CommonConsts.MaxCodeLength); //b.Property(x => x.Period).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.Version).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.LineNumber).HasMaxLength(50); //b.Property(x => x.LineNumber).HasMaxLength(50);
b.Property(x => x.PurchaseType).HasMaxLength(50); //b.Property(x => x.PurchaseType).HasMaxLength(50);
b.Property(x => x.PurchaseOrderNo).IsRequired().HasMaxLength(50); //b.Property(x => x.PurchaseOrderNo).IsRequired().HasMaxLength(50);
b.Property(x => x.PurchaseOrderNoItem).HasMaxLength(50); //b.Property(x => x.PurchaseOrderNoItem).HasMaxLength(50);
b.Property(x => x.PurchaseOrderNoText).HasMaxLength(50); //b.Property(x => x.PurchaseOrderNoText).HasMaxLength(50);
b.Property(x => x.ReceiptQty).IsRequired(); b.Property(x => x.ReceiptQty).IsRequired();
b.Property(x => x.InvoicedQty).IsRequired(); //b.Property(x => x.InvoicedQty).IsRequired();
b.Property(x => x.AmountNoTax).IsRequired(); //b.Property(x => x.AmountNoTax).IsRequired();
b.Property(x => x.PurchasePriceNoTax).IsRequired(); //b.Property(x => x.PurchasePriceNoTax).IsRequired();
b.Property(x => x.AccountNum).HasMaxLength(50); //b.Property(x => x.AccountNum).HasMaxLength(50);
b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150);
b.Property(x => x.MaterialDesc).HasMaxLength(50); b.Property(x => x.MaterialDesc).HasMaxLength(500);
b.Property(x => x.SpareDate); b.Property(x => x.SpareDate);
b.Property(x => x.DeliveryOrderNo).IsRequired().HasMaxLength(50); //b.Property(x => x.DeliveryOrderNo).IsRequired().HasMaxLength(50);
b.Property(x => x.DeliveryLineNum).HasMaxLength(50); //b.Property(x => x.DeliveryLineNum).HasMaxLength(50);
b.Property(x => x.BatchNo).HasMaxLength(50); //b.Property(x => x.BatchNo).HasMaxLength(50);
b.Property(x => x.Unit).HasMaxLength(50); //b.Property(x => x.Unit).HasMaxLength(50);
b.Property(x => x.TaxRate); //b.Property(x => x.TaxRate);
b.Property(x => x.TaxCode); //b.Property(x => x.TaxCode);
b.Property(x => x.GermanInvoiceNo).HasMaxLength(100); //b.Property(x => x.GermanInvoiceNo).HasMaxLength(100);
b.Property(x => x.Factory).HasMaxLength(50); //b.Property(x => x.Factory).HasMaxLength(50);
b.Property(x => x.FactoryName).HasMaxLength(50); //b.Property(x => x.FactoryName).HasMaxLength(50);
b.Property(x => x.Extend).HasMaxLength(250); //b.Property(x => x.Extend).HasMaxLength(250);
//创建索引(没有版本一说) //创建索引(没有版本一说)
b.HasIndex(x => new { x.Version,x.PurchaseOrderNo, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); //b.HasIndex(x => new { x.Version,x.PurchaseOrderNo, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter);
}); });
} }
@ -933,14 +933,20 @@ namespace Win.Sfs.SettleAccount
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.Kanban).IsRequired().HasMaxLength(150);//必填项 b.Property(x => x.Kanban).IsRequired().HasMaxLength(150);//必填项
b.Property(x => x.Relation).HasMaxLength(100); b.Property(x => x.Relation).HasMaxLength(100);
b.Property(x => x.Factory).HasMaxLength(50);
b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150); b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150);
b.Property(x => x.PartType).HasMaxLength(50); b.Property(x => x.PartType).HasMaxLength(50);
b.Property(x => x.SupplierCode).HasMaxLength(50);
b.Property(x => x.Batch).HasMaxLength(50); //b.ConfigureByConvention();
b.Property(x => x.Flag).HasMaxLength(50); //b.Property(x => x.Kanban).IsRequired().HasMaxLength(150);//必填项
//b.Property(x => x.Relation).HasMaxLength(100);
//b.Property(x => x.Factory).HasMaxLength(50);
//b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(150);
//b.Property(x => x.PartType).HasMaxLength(50);
//b.Property(x => x.SupplierCode).HasMaxLength(50);
//b.Property(x => x.Batch).HasMaxLength(50);
//b.Property(x => x.Flag).HasMaxLength(50);
//创建组合索引 //创建组合索引
b.HasIndex(x => new { x.Version,x.Kanban, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter); //b.HasIndex(x => new { x.Version,x.Kanban, x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter);
}); });
} }

47
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs

@ -43,7 +43,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" SELECT\n" + " SELECT\n" +
" row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" + " row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" +
" c.WMSDeliveryNote,--交货单号\n" + " c.WMSDeliveryNote,--交货单号\n" +
" c.WMSActualGoodsDate,--实际发货日期\n" + " CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
" a.Kanban,--条码号\n" + " a.Kanban,--条码号\n" +
" b.MaterialCode SapMaterialCode,--厂内物料号\n" + " b.MaterialCode SapMaterialCode,--厂内物料号\n" +
@ -59,7 +59,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 0 AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" + " 0 AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
" d.InvoicePrice,--开票单价\n" + " d.InvoicePrice,--开票单价\n" +
" 0 AS InvoiceMoney,--开票金额\n" + " 0 AS InvoiceMoney,--开票金额\n" +
" c.DeliveryOrderNo --出库单号\n" + " '' DeliveryOrderNo --出库单号\n" +
" \n" + " \n" +
" FROM\n" + " FROM\n" +
" Set_KanBanSettle AS a\n" + " Set_KanBanSettle AS a\n" +
@ -96,6 +96,39 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _query.ToList(); return _query.ToList();
} }
public virtual List<InvoiceSettleDiff> GetVWKanBanInvoiceDiff(string version)
{
var str = "SELECT\n" +
" * \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" b.MaterialCode,\n" +
" InvocieQty-SettleQty DiffQty \n" +
" FROM\n" +
" ( SELECT sum( Qty ) SettleQty, MaterialCode FROM Set_KanBanSettle a WHERE version = '{0}' GROUP BY MaterialCode ) a\n" +
" INNER JOIN ( SELECT SUM( QTY ) InvocieQty, MaterialCode FROM Set_Invoice WHERE version = '{0}' GROUP BY MaterialCode ) b ON a.MaterialCode = b.MaterialCode \n" +
" ) temp \n" +
" WHERE\n" +
" temp.DiffQty <>0";
var _list = DbConnection.Query<InvoiceSettleDiff>(string.Format(str, version));
return _list.ToList();
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -189,8 +222,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "交货单号")] [ExporterHeader(DisplayName = "交货单号")]
public string WMSDeliveryNote { set; get; } public string WMSDeliveryNote { set; get; }
[ExporterHeader(DisplayName = "实际发货日期")] [ExporterHeader(DisplayName = "实际发货日期", Format = "yyyy-MM-dd")]
public DateTime ActualGoodsDate { set; get; } public DateTime WMSActualGoodsDate { set; get; }
[ExporterHeader(DisplayName = "条码号")] [ExporterHeader(DisplayName = "条码号")]
public string Kanban { set; get; } public string Kanban { set; get; }
@ -204,8 +237,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "客户物料")] [ExporterHeader(DisplayName = "客户物料")]
public string CustomerPartCode { set; get; } public string CustomerPartCode { set; get; }
[ExporterHeader(DisplayName = "厂内物料号")] //[ExporterHeader(DisplayName = "厂内物料号")]
public string SapMaterialCode { set; get; } //public string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料组(车型)")] [ExporterHeader(DisplayName = "物料组(车型)")]
@ -223,7 +256,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算数量")] [ExporterHeader(DisplayName = "结算数量")]
public decimal SettleNumber { set; get; } public decimal SettleNumber { set; get; }
[ExporterHeader(DisplayName = "结算日期")] [ExporterHeader(DisplayName = "结算日期", Format = "yyyy-MM-dd")]
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
[ExporterHeader(DisplayName = "结算金额")] [ExporterHeader(DisplayName = "结算金额")]

35
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithCodeExportService.cs

@ -41,13 +41,13 @@ namespace SettleAccount.Job.Services.Report
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value; var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _list = _dapper.GetSettleKBWithCodeReportList(kanban, version, sapMaterialCode, customerPartCode,materialGroup, beginTime, endTime); var _list = _dapper.GetSettleKBWithCodeReportList(kanban, version, sapMaterialCode, customerPartCode, materialGroup, beginTime, endTime);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version); var diffList = _dapper.GetVWKanBanInvoiceDiff(version);
if (diffList != null) if (diffList != null)
{ {
foreach (var itm in diffList) foreach (var itm in diffList)
{ {
var _first = _list.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode); var _first = _list.FirstOrDefault(p => p.CustomerPartCode == itm.MaterialCode);//结算物料号去匹配发票汇总中的物料号
if (_first != null) if (_first != null)
{ {
_first.InvoiceDiffQty = _first.SettleNumber + itm.DiffQty;//开票数量(结算数量+差异) _first.InvoiceDiffQty = _first.SettleNumber + itm.DiffQty;//开票数量(结算数量+差异)
@ -64,15 +64,23 @@ namespace SettleAccount.Job.Services.Report
_list = _list.Where(p => _groupList.Contains(p.EstimateTypeDesc)).ToList(); _list = _list.Where(p => _groupList.Contains(p.EstimateTypeDesc)).ToList();
} }
} }
if (!string.IsNullOrEmpty(sapMaterialCode)) if (!string.IsNullOrEmpty(sapMaterialCode))
{ {
var _groupList = sapMaterialCode.Split(new char[] { '\n' }).Distinct().ToList(); var _groupList = sapMaterialCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0) if (_groupList.Count() > 0)
{ {
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); _list = _list.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
} }
} }
//if (!string.IsNullOrEmpty(sapMaterialCode))
//{
// var _groupList = sapMaterialCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
// }
//}
if (!string.IsNullOrEmpty(customerPartCode)) if (!string.IsNullOrEmpty(customerPartCode))
{ {
@ -85,13 +93,22 @@ namespace SettleAccount.Job.Services.Report
if (!string.IsNullOrEmpty(beginTime)) if (!string.IsNullOrEmpty(beginTime))
{ {
_list = _list.Where(p => DateTime.Parse(beginTime)<=p.ActualGoodsDate).ToList(); _list = _list.Where(p => DateTime.Parse(beginTime) <= p.WMSActualGoodsDate).ToList();
} }
if (!string.IsNullOrEmpty(endTime)) if (!string.IsNullOrEmpty(endTime))
{ {
_list = _list.Where(p => DateTime.Parse(endTime) >= p.ActualGoodsDate).ToList(); _list = _list.Where(p => DateTime.Parse(endTime) >= p.WMSActualGoodsDate).ToList();
} }
//if (!string.IsNullOrEmpty(beginTime))
//{
// _list = _list.Where(p => DateTime.Parse(beginTime)<=p.ActualGoodsDate).ToList();
//}
//if (!string.IsNullOrEmpty(endTime))
//{
// _list = _list.Where(p => DateTime.Parse(endTime) >= p.ActualGoodsDate).ToList();
//}
if (!string.IsNullOrEmpty(kanban)) if (!string.IsNullOrEmpty(kanban))
{ {
var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList(); var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
@ -101,10 +118,10 @@ namespace SettleAccount.Job.Services.Report
} }
} }
_outputService.Export<SettleKBWithCode>(id,_filename , _list);
_outputService.Export<SettleKBWithCode>(id, _filename, _list);
return id.ToString(); return id.ToString();
} }

Loading…
Cancel
Save