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. 259
      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. 31
      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));
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)
{

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();
//插入数据前检验
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)
{
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();

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

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

259
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
{
/// <summary>
///年度
/// </summary>
public string Year { get; protected set; }
/// <summary>
/// 期间
/// </summary>
public string Period { set; get; }
public Guid Id { set; get; }
/// <summary>
/// 版本
/// </summary>
@ -34,10 +25,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
public string Relation { set; get; }
/// <summary>
/// 工厂
/// </summary>
public string Factory { set; get; }
/// <summary>
/// 零件号
/// </summary>
public string MaterialCode { set; get; }
@ -45,40 +32,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
/// 零件类型
/// </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>
@ -89,85 +42,43 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_KanBan
/// <summary>
/// WMS实际发货日期
/// </summary>
public string WMSActualGoodsDate { set; get; }
public DateTime 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 Guid ParentId { get; protected set; }
public void SetValue(Guid guid, Guid branchId, string year, string peroid, string version, Guid parentId)
public void SetValue(Guid guid, string version)
{
Period = peroid;
Year = year;
Id = guid;
Version = version;
BranchId = branchId;
ParentId = parentId;
}
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,
Guid parentId,
//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;
ParentId = parentId;
//CreationTime = creationTime;
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)
{
Period = peroid;
Year = year;
//Period = peroid;
//Year = year;
Id = guid;
Version = version;
BranchId = branchId;
@ -29,187 +29,280 @@ namespace Win.Sfs.SettleAccount.Entities.WMS_SparePart
) : 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>
/// 采购类型
/// SAP物料号
/// </summary>
[Display(Name = "采购类型")]
public string PurchaseType { get; set; }
[Display(Name = "SAP物料号")]
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>
[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; }
[Display(Name = "主机厂")]
public string MainFactory { get; set; }
/// <summary>
/// 科目号
/// 车型
/// </summary>
[Display(Name = "科目号")]
public string AccountNum { get; set; }
[Display(Name = "车型")]
public string MaterialGroup { 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; }
[Display(Name = "发货数量")]
public decimal ReceiptQty { get; set; }
/// <summary>
/// 备注
/// 订单号
/// </summary>
[Display(Name = "备注")]
public string Extend { set; get; }
[Display(Name = "订单号")]
public string PurchaseOrderNo { get; set; }
/// <summary>
/// WMS采购订单号
/// 交货单号
/// </summary>
[Display(Name = "交货单号")]
public string WMSDeliveryNote { set; get; }
/// <summary>
/// WMS发货状态
/// 交货日期
/// </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.ConfigureByConvention();
b.Property(x => x.Year).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Period).HasMaxLength(CommonConsts.MaxCodeLength);
//b.Property(x => x.Year).HasMaxLength(CommonConsts.MaxCodeLength);
//b.Property(x => x.Period).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.LineNumber).HasMaxLength(50);
b.Property(x => x.PurchaseType).HasMaxLength(50);
b.Property(x => x.PurchaseOrderNo).IsRequired().HasMaxLength(50);
b.Property(x => x.PurchaseOrderNoItem).HasMaxLength(50);
b.Property(x => x.PurchaseOrderNoText).HasMaxLength(50);
//b.Property(x => x.LineNumber).HasMaxLength(50);
//b.Property(x => x.PurchaseType).HasMaxLength(50);
//b.Property(x => x.PurchaseOrderNo).IsRequired().HasMaxLength(50);
//b.Property(x => x.PurchaseOrderNoItem).HasMaxLength(50);
//b.Property(x => x.PurchaseOrderNoText).HasMaxLength(50);
b.Property(x => x.ReceiptQty).IsRequired();
b.Property(x => x.InvoicedQty).IsRequired();
b.Property(x => x.AmountNoTax).IsRequired();
b.Property(x => x.PurchasePriceNoTax).IsRequired();
//b.Property(x => x.InvoicedQty).IsRequired();
//b.Property(x => x.AmountNoTax).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.MaterialDesc).HasMaxLength(50);
b.Property(x => x.MaterialDesc).HasMaxLength(500);
b.Property(x => x.SpareDate);
b.Property(x => x.DeliveryOrderNo).IsRequired().HasMaxLength(50);
b.Property(x => x.DeliveryLineNum).HasMaxLength(50);
b.Property(x => x.BatchNo).HasMaxLength(50);
b.Property(x => x.Unit).HasMaxLength(50);
b.Property(x => x.TaxRate);
b.Property(x => x.TaxCode);
b.Property(x => x.GermanInvoiceNo).HasMaxLength(100);
b.Property(x => x.Factory).HasMaxLength(50);
b.Property(x => x.FactoryName).HasMaxLength(50);
b.Property(x => x.Extend).HasMaxLength(250);
//b.Property(x => x.DeliveryOrderNo).IsRequired().HasMaxLength(50);
//b.Property(x => x.DeliveryLineNum).HasMaxLength(50);
//b.Property(x => x.BatchNo).HasMaxLength(50);
//b.Property(x => x.Unit).HasMaxLength(50);
//b.Property(x => x.TaxRate);
//b.Property(x => x.TaxCode);
//b.Property(x => x.GermanInvoiceNo).HasMaxLength(100);
//b.Property(x => x.Factory).HasMaxLength(50);
//b.Property(x => x.FactoryName).HasMaxLength(50);
//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.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.ConfigureByConvention();
//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" +
" row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" +
" c.WMSDeliveryNote,--交货单号\n" +
" c.WMSActualGoodsDate,--实际发货日期\n" +
" CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
" a.Kanban,--条码号\n" +
" b.MaterialCode SapMaterialCode,--厂内物料号\n" +
@ -59,7 +59,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 0 AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
" d.InvoicePrice,--开票单价\n" +
" 0 AS InvoiceMoney,--开票金额\n" +
" c.DeliveryOrderNo --出库单号\n" +
" '' DeliveryOrderNo --出库单号\n" +
" \n" +
" FROM\n" +
" Set_KanBanSettle AS a\n" +
@ -96,6 +96,39 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
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>
@ -189,8 +222,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "交货单号")]
public string WMSDeliveryNote { set; get; }
[ExporterHeader(DisplayName = "实际发货日期")]
public DateTime ActualGoodsDate { set; get; }
[ExporterHeader(DisplayName = "实际发货日期", Format = "yyyy-MM-dd")]
public DateTime WMSActualGoodsDate { set; get; }
[ExporterHeader(DisplayName = "条码号")]
public string Kanban { set; get; }
@ -204,8 +237,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "客户物料")]
public string CustomerPartCode { set; get; }
[ExporterHeader(DisplayName = "厂内物料号")]
public string SapMaterialCode { set; get; }
//[ExporterHeader(DisplayName = "厂内物料号")]
//public string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料组(车型)")]
@ -223,7 +256,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "结算数量")]
public decimal SettleNumber { set; get; }
[ExporterHeader(DisplayName = "结算日期")]
[ExporterHeader(DisplayName = "结算日期", Format = "yyyy-MM-dd")]
public DateTime SettleDate { set; get; }
[ExporterHeader(DisplayName = "结算金额")]

31
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 _list = _dapper.GetSettleKBWithCodeReportList(kanban, version, sapMaterialCode, customerPartCode,materialGroup, beginTime, endTime);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
var _list = _dapper.GetSettleKBWithCodeReportList(kanban, version, sapMaterialCode, customerPartCode, materialGroup, beginTime, endTime);
var diffList = _dapper.GetVWKanBanInvoiceDiff(version);
if (diffList != null)
{
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)
{
_first.InvoiceDiffQty = _first.SettleNumber + itm.DiffQty;//开票数量(结算数量+差异)
@ -70,9 +70,17 @@ namespace SettleAccount.Job.Services.Report
var _groupList = sapMaterialCode.Split(new char[] { '\n' }).Distinct().ToList();
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))
{
@ -85,13 +93,22 @@ namespace SettleAccount.Job.Services.Report
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))
{
_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))
{
var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
@ -104,7 +121,7 @@ namespace SettleAccount.Job.Services.Report
_outputService.Export<SettleKBWithCode>(id,_filename , _list);
_outputService.Export<SettleKBWithCode>(id, _filename, _list);
return id.ToString();
}

Loading…
Cancel
Save