Browse Source

2022.10.17最新代码更新提交

master
44673626 2 years ago
parent
commit
9d1933a07e
  1. 75
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanIn/VWKanBanInDto.cs
  2. 93
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanOut/VWKanBanOutDto.cs
  3. 42
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs
  4. 3
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  5. 6
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs
  6. 9
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  7. 88
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanIn/VWKanBanInEntity.cs
  8. 89
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanOut/VWKanBanOutEntity.cs
  9. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs
  10. 67
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  11. 26
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs
  12. 213
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  13. 12
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs

75
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanIn/VWKanBanInDto.cs

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.VWKanBanIn
{
public class VWKanBanInDto : Entity<Guid>
{
/// <summary>
/// 交货单号
/// </summary>
public string WmsBillNum { set; get; }
/// <summary>
/// 订单号/看板号
/// </summary>
public string BillNum { set; get; }
/// <summary>
/// 零件号
/// </summary>
public string ItemCode { set; get; }
/// <summary>
/// 发货时间
/// </summary>
public DateTime InputTime { set; get; }
/// <summary>
/// 出库时间
/// </summary>
public DateTime OutputTime { set; get; }
/// <summary>
/// 库存数量
/// </summary>
public decimal InputQty { set; get; }
/// <summary>
/// 出库数量
/// </summary>
public decimal OutputQty { set; get; }
/// <summary>
/// /退货数量
/// </summary>
public decimal ReturnQty { set; get; }
/// <summary>
/// 出库单据号
/// </summary>
public string SettleBillNumber { set; get; }
/// <summary>
/// 发货状态
/// </summary>
public string State { set; get; }
/// <summary>
/// 客户代码
/// </summary>
public string ClientCode { set; get; }
/// <summary>
/// 备注
/// </summary>
public string Remark { set; get; }
}
}

93
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/VWKanBanOut/VWKanBanOutDto.cs

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.VWKanBanOut
{
public class VWKanBanOutDto : Entity<Guid>
{
/// <summary>
/// 关联库存ID
/// </summary>
public string KanBanInOfID { set; get; }
/// <summary>
/// 交货单号
/// </summary>
public string WmsBillNum { set; get; }
/// <summary>
/// 订单号/看板号
/// </summary>
public string BillNum { set; get; }
/// <summary>
///零件号
/// </summary>
public string ItemCode { set; get; }
/// <summary>
/// 发货时间
/// </summary>
public DateTime InputTime { set; get; }
/// <summary>
/// 出库时间
/// </summary>
public DateTime OutputTime { set; get; }
/// <summary>
/// 库存数量
/// </summary>
public decimal InputQty { set; get; }
/// <summary>
/// 出库数量
/// </summary>
public decimal OutputQty { set; get; }
/// <summary>
/// 退货数量
/// </summary>
public decimal ReturnQty { set; get; }
/// <summary>
/// 出库单据号
/// </summary>
public string SettleBillNumber { set; get; }
/// <summary>
/// 发货状态
/// </summary>
public string State { set; get; }
/// <summary>
/// 客户代码
/// </summary>
public string ClientCode { set; get; }
/// <summary>
/// 备注
/// </summary>
public string Remark { set; get; }
/// <summary>
/// 扩展1
/// </summary>
public string Extend1 { set; get; }
/// <summary>
/// 扩展2
/// </summary>
public string Extend2 { set; get; }
/// <summary>
/// 扩展3
/// </summary>
public string Extend3 { set; get; }
}
}

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

@ -48,6 +48,7 @@ using Win.Sfs.SettleAccount.Entities.Wms;
using Win.Sfs.SettleAccount.Repository; using Win.Sfs.SettleAccount.Repository;
using WY.NewJit.Extends.PaiGe.WMS; using WY.NewJit.Extends.PaiGe.WMS;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
using Win.Sfs.SettleAccount.Entities.VWKanBanIn;
namespace Win.Sfs.SettleAccount.Entities.SettleAccounts namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
{ {
@ -63,6 +64,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
{ {
private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPutDetial, Guid> _wmsRepository; private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPutDetial, Guid> _wmsRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPut, Guid> _wmsVersionRepository; private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPut, Guid> _wmsVersionRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsWithOutKanbanOutPutDetial, Guid> _wmsRepository1; private readonly ISettleAccountBranchEfCoreRepository<WmsWithOutKanbanOutPutDetial, Guid> _wmsRepository1;
@ -79,7 +81,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
private readonly TaskJobService _service; private readonly TaskJobService _service;
private readonly WmsDapperRepository _wmsDapper; private readonly WmsDapperRepository _wmsDapper;
// private readonly ErpPartDapperRepository _erpdapperRepository; private readonly IRepository<VWKanBanInEntity,Guid> _vwkanbanInRepository;
private readonly IRepository<WmsKanbanOutPutDetial, Guid> _vwkanbanOutRepository;
// private readonly ErpPartDapperRepository _erpdapperRepository;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -102,6 +108,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
IDistributedCache<WmsKanbanOutPutDetial> cache, IDistributedCache<WmsKanbanOutPutDetial> cache,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
// ErpPartDapperRepository erpdapperRepository, // ErpPartDapperRepository erpdapperRepository,
IRepository<WmsKanbanOutPutDetial, Guid> vwkanbanOutRepository,
IRepository<VWKanBanInEntity, Guid> vwkanbanInRepository,
ICommonManager commonManager, ICommonManager commonManager,
WmsDapperRepository wmsDapper WmsDapperRepository wmsDapper
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
@ -115,6 +123,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
_dapper = dapper; _dapper = dapper;
// _erpdapperRepository = erpdapperRepository; // _erpdapperRepository = erpdapperRepository;
_wmsDapper = wmsDapper; _wmsDapper = wmsDapper;
_vwkanbanInRepository = vwkanbanInRepository;
_vwkanbanOutRepository = vwkanbanOutRepository;
} }
private async Task<long> GetCountAsync(WmsKanbanOutPutDetialRequestDto input) private async Task<long> GetCountAsync(WmsKanbanOutPutDetialRequestDto input)
@ -430,6 +440,36 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
} }
return true; return true;
} }
/// <summary>
/// 大众看板有单号,库存表、出库表和出库详表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsKanbanOutPut-Pass/In")]
[UnitOfWork(false)]
public async Task<bool> WmsKanbanOutPutPassIN(WmsJitRequestDto input)
{
if (input.Guids != null)
{
List<WmsKanbanOutPutDetial> _ls = new List<WmsKanbanOutPutDetial>();
if (input.Guids.Count() > 0)
{
_ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2 && p.State != 4).ToListAsync();
}
else
{
_ls = await _wmsRepository.Where(p => p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2 && p.State != 4).ToListAsync();
}
if (_ls.Count() > 0)
{
//调用存储过程
}
}
return true;
}
/// <summary> /// <summary>
///出库界面功能, 撤销核准出库 ///出库界面功能, 撤销核准出库
/// </summary> /// </summary>

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

@ -442,7 +442,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
_wmslstBill = _wmslstBill.Select(p => new _wmslstBill = _wmslstBill.Select(p => new
WmsSharePart90OutPutDetial( WmsSharePart90OutPutDetial(
GuidGenerator.Create(), GuidGenerator.Create(),
p.WmsBillNum, //p.WmsBillNum,
!string.IsNullOrEmpty(p.WmsBillNum) ? (p.WmsBillNum.Length > 36 ? "PF" : p.WmsBillNum) : string.Empty,
p.OrderBillNum, p.OrderBillNum,
p.MaterialCode, p.MaterialCode,
p.MaterialDesc, p.MaterialDesc,

6
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsOneTimeSaleOutputAppService.cs

@ -284,6 +284,12 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
// } // }
//} //}
//删除版本
var _versionQuery = _wmsVersionRepository.Where(p => p.Version == version);
await _versionQuery.BatchDeleteAsync();
//删除明细
var _query = _wmsRepository.Where(p => p.Version == version);
await _query.BatchDeleteAsync();
var stockList = _wmsDapper.GetSalesStock(); var stockList = _wmsDapper.GetSalesStock();
var query = from itm in _list var query = from itm in _list

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

@ -93,6 +93,8 @@ using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts;
using Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput; using Win.Sfs.SettleAccount.Entities.Wms.WmsSumOutput;
using Win.Sfs.SettleAccount.Errors; using Win.Sfs.SettleAccount.Errors;
using Win.Sfs.SettleAccount.Entities.Errors; using Win.Sfs.SettleAccount.Entities.Errors;
using Win.Sfs.SettleAccount.Entities.VWKanBanIn;
using Win.Sfs.SettleAccount.Entities.VWKanBanOut;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
@ -268,12 +270,19 @@ namespace Win.Sfs.SettleAccount
CreateMapWMSDiffOutputSum(); CreateMapWMSDiffOutputSum();
CreateMapWMSWithCodeOutputSum(); CreateMapWMSWithCodeOutputSum();
CreateMapWMSCacelOutputSum(); CreateMapWMSCacelOutputSum();
CreateMapVWInOutKanBan();
CreateMapWMSErrorBill(); CreateMapWMSErrorBill();
#endregion #endregion
} }
#region 派格出库单 #region 派格出库单
private void CreateMapVWInOutKanBan()
{
CreateMap<VWKanBanInEntity, VWKanBanInDto>().ReverseMap();
CreateMap<VWKanBanOutEntity, VWKanBanOutDto>().ReverseMap();
}
private void CreateMapCustomerKanban() private void CreateMapCustomerKanban()
{ {
CreateMap<WmsCustomerKanbanOutPutDetial, WmsCustomerKanbanOutPutDetialDTO>().ReverseMap(); CreateMap<WmsCustomerKanbanOutPutDetial, WmsCustomerKanbanOutPutDetialDTO>().ReverseMap();

88
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanIn/VWKanBanInEntity.cs

@ -0,0 +1,88 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.VWKanBanIn
{
public class VWKanBanInEntity : Entity<Guid>
{
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "订单号/看板号")]
public string BillNum { set; get; }
[ExporterHeader(DisplayName = "零件号")]
public string ItemCode { set; get; }
[ExporterHeader(DisplayName = "发货时间")]
public DateTime InputTime { set; get; }
[ExporterHeader(DisplayName = "出库时间")]
public DateTime OutputTime { set; get; }
[ExporterHeader(DisplayName = "库存数量")]
public decimal InputQty { set; get; }
[ExporterHeader(DisplayName = "出库数量")]
public decimal OutputQty { set; get; }
[ExporterHeader(DisplayName = "退货数量")]
public decimal ReturnQty { set; get; }
[ExporterHeader(DisplayName = "出库单据号")]
public string SettleBillNumber { set; get; }
[ExporterHeader(DisplayName = "发货状态")]
public string State { set; get; }
[ExporterHeader(DisplayName = "客户代码")]
public string ClientCode { set; get; }
[ExporterHeader(DisplayName = "备注",IsIgnore =true)]
public string Remark { set; get; }
[ExporterHeader(DisplayName = "扩展1", IsIgnore = true)]
public string Extend1 { set; get; }
[ExporterHeader(DisplayName = "扩展2", IsIgnore = true)]
public string Extend2 { set; get; }
[ExporterHeader(DisplayName = "扩展3", IsIgnore = true)]
public string Extend3 { set; get; }
public void SetValue(Guid guid, string remark)
{
Id = guid;
Remark = remark;
}
public VWKanBanInEntity(Guid id, string wmsBillNum, string billNum, string itemCode,
DateTime inputTime, DateTime outputTime, decimal inputQty, decimal outputQty, decimal returnQty,
string state, string clientCode, string remark, string extend1, string extend2, string extend3) : base(id)
{
Id = id;
WmsBillNum = wmsBillNum;
BillNum = billNum;
ItemCode = itemCode;
InputTime = inputTime;
OutputTime = outputTime;
InputQty = inputQty;
OutputQty = outputQty;
ReturnQty = returnQty;
State = state;
ClientCode = clientCode;
Remark = remark;
Extend2 = extend2;
Extend1 = extend1;
Extend3 = extend3;
}
}
}

89
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/VWKanBanOut/VWKanBanOutEntity.cs

@ -0,0 +1,89 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.VWKanBanOut
{
public class VWKanBanOutEntity : Entity<Guid>
{
[ExporterHeader(DisplayName = "关联库存ID",IsIgnore =true)]
public string KanBanInOfID { set; get; }
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "订单号/看板号")]
public string BillNum { set; get; }
[ExporterHeader(DisplayName = "零件号")]
public string ItemCode { set; get; }
[ExporterHeader(DisplayName = "发货时间")]
public DateTime InputTime { set; get; }
[ExporterHeader(DisplayName = "出库时间")]
public DateTime OutputTime { set; get; }
[ExporterHeader(DisplayName = "库存数量")]
public decimal InputQty { set; get; }
[ExporterHeader(DisplayName = "出库数量")]
public decimal OutputQty { set; get; }
[ExporterHeader(DisplayName = "退货数量")]
public decimal ReturnQty { set; get; }
[ExporterHeader(DisplayName = "出库单据号")]
public string SettleBillNumber { set; get; }
[ExporterHeader(DisplayName = "发货状态")]
public string State { set; get; }
[ExporterHeader(DisplayName = "客户代码")]
public string ClientCode { set; get; }
[ExporterHeader(DisplayName = "备注", IsIgnore = true)]
public string Remark { set; get; }
[ExporterHeader(DisplayName = "扩展1", IsIgnore = true)]
public string Extend1 { set; get; }
[ExporterHeader(DisplayName = "扩展2", IsIgnore = true)]
public string Extend2 { set; get; }
[ExporterHeader(DisplayName = "扩展3", IsIgnore = true)]
public string Extend3 { set; get; }
public VWKanBanOutEntity(Guid id, string kanBanInOfID, string wmsBillNum, string billNum, string itemCode,
DateTime inputTime, DateTime outputTime, decimal inputQty, decimal outputQty, decimal returnQty,
string state, string clientCode, string remark, string extend1, string extend2, string extend3) : base(id)
{
Id = id;
KanBanInOfID = kanBanInOfID;
WmsBillNum = wmsBillNum;
BillNum = billNum;
ItemCode = itemCode;
InputTime = inputTime;
OutputTime = outputTime;
InputQty = inputQty;
OutputQty = outputQty;
ReturnQty = returnQty;
State = state;
ClientCode = clientCode;
Remark = remark;
Extend2 = extend2;
Extend1 = extend1;
Extend3 = extend3;
}
}
}

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs

@ -18,7 +18,7 @@ namespace Win.Sfs.SettleAccount
public SettleAccountDbContext(DbContextOptions<SettleAccountDbContext> options) public SettleAccountDbContext(DbContextOptions<SettleAccountDbContext> options)
: base(options) : base(options)
{ {
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(30)); this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(120));
} }
protected override void OnModelCreating(ModelBuilder builder) protected override void OnModelCreating(ModelBuilder builder)

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

@ -74,6 +74,8 @@ using Win.Sfs.SettleAccount.Entities.WMS;
using Win.Sfs.SettleAccount.Entities.HQ_F; using Win.Sfs.SettleAccount.Entities.HQ_F;
using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts; using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts;
using Win.Sfs.SettleAccount.Errors; using Win.Sfs.SettleAccount.Errors;
using Win.Sfs.SettleAccount.Entities.VWKanBanIn;
using Win.Sfs.SettleAccount.Entities.VWKanBanOut;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
{ {
@ -384,6 +386,16 @@ namespace Win.Sfs.SettleAccount
#endregion #endregion
#region 派格库存改造
//大众看板有单号库存
builder.ConfigureVWINKanban(options);
builder.ConfigureVWOUTKanban(options);
#endregion
} }
@ -552,8 +564,61 @@ namespace Win.Sfs.SettleAccount
#region PG-派格 #region PG-派格
/// <summary>
/// 大众看板有单号出库单
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
private static void ConfigureVWOUTKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<VWKanBanOutEntity>(b =>
{
b.ToTable($"{options.TablePrefix}_VW_OUT_Kanban", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(50);//必填项
b.Property(x => x.BillNum).IsRequired().HasMaxLength(50);
b.Property(x => x.ItemCode).IsRequired().HasMaxLength(50);
b.Property(x => x.InputTime).IsRequired();
b.Property(x => x.SettleBillNumber).HasMaxLength(50);
//b.Property(x => x.InputQty).IsRequired();
b.Property(x => x.ClientCode).HasMaxLength(50);
b.Property(x => x.State).IsRequired();
//创建组合索引
b.HasIndex(x => new { x.BillNum, x.ItemCode });
});
}
/// <summary>
/// 大众看板有单号库存表
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
private static void ConfigureVWINKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<VWKanBanInEntity>(b =>
{
b.ToTable($"{options.TablePrefix}_VW_IN_Kanban", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.WmsBillNum).IsRequired().HasMaxLength(50);//必填项
b.Property(x => x.BillNum).IsRequired().HasMaxLength(50);
b.Property(x => x.ItemCode).IsRequired().HasMaxLength(50);
b.Property(x => x.InputTime).IsRequired();
b.Property(x => x.SettleBillNumber).HasMaxLength(50);
b.Property(x => x.InputQty).IsRequired();
b.Property(x => x.ClientCode).HasMaxLength(50);
b.Property(x => x.State).IsRequired();
//创建组合索引
b.HasIndex(x => new { x.BillNum, x.ItemCode });
});
}
private static void ConfigureHQFKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHQFKanban(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)

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

@ -122,19 +122,19 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
_list = _query.ToList(); _list = _query.ToList();
if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0) //if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0)
{ //{
_list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList(); // _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(); // _list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
} //}
else //else
{ //{
if (CacheManager.CacheInvoiceSettledDetailDiff == null) // if (CacheManager.CacheInvoiceSettledDetailDiff == null)
{ // {
CacheManager.CacheInvoiceSettledDetailDiff = new List<InvoiceSettledDetailDiff>(); // CacheManager.CacheInvoiceSettledDetailDiff = new List<InvoiceSettledDetailDiff>();
} // }
CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list); // CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list);
} //}

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

@ -267,219 +267,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AND UNION2.[客户零件号] IS NULL \n" + " AND UNION2.[客户零件号] IS NULL \n" +
" ) UNION2"; " ) UNION2";
//更改方案一
//string sql = "SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" * \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" TEMP1.*,\n" +
//" TEMP2.Price,\n" +
//" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' WmsBillNum,\n" +
//" NULL BeginDate,\n" +
//" a.Kanban,\n" +
//" C.MaterialCode SapCode,\n" +
//" C.MaterialDesc,\n" +
//" C.CustomerPartCode,\n" +
//" C.EstimateTypeDesc MaterialGroup,\n" +
//" ISNULL( B.Qty, 0 ) SettleQty,\n" +
//" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
//" isnull( tt.qty, 0 ) BackQty,\n" +
//" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
//" FROM\n" +
//" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
//" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, Extend1 AS MaterialCode FROM Set_WmsKanbanOutPutDetial {0} GROUP BY Kanban, Extend1 ) B ON A.Kanban = B.Kanban \n" +
//" AND A.MaterialCode = B.MaterialCode\n" +
//" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
//" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
//" AND c.MaterialCode = tt.MaterialCode \n" +
//" WHERE\n" +
//" B.Kanban IS NULL \n" +
//" AND B.MaterialCode IS NULL \n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
//" ) UNION1\n" +
//" LEFT JOIN temp_vwkanban UNION2 ON UNION1.Kanban= UNION2.[看板号] \n" +
//" AND UNION1.CustomerPartCode= UNION2.[客户零件号] \n" +
//" WHERE\n" +
//" UNION2.[看板号] IS NULL \n" +
//" AND UNION2.[客户零件号] IS NULL \n" +
//" ) aaa \n" +
//" WHERE 1=1";
#region 原定规则,又改了!
//string sql = "SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" TEMP1.*,\n" +
//" TEMP2.Price,\n" +
//" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' WmsBillNum,\n" +
//" NULL BeginDate,\n" +
//" a.Kanban,\n" +
//" C.MaterialCode SapCode,\n" +
//" C.MaterialDesc,\n" +
//" C.CustomerPartCode,\n" +
//" C.EstimateTypeDesc MaterialGroup,\n" +
//" ISNULL( B.Qty, 0 ) SettleQty,\n" +
//" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
//" isnull( tt.qty, 0 ) BackQty,\n" +
//" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
//" FROM\n" +
//" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1=1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
//" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
//" AND A.MaterialCode = B.MaterialCode\n" +
//" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
//" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
//" AND c.MaterialCode = tt.MaterialCode \n" +
//" WHERE\n" +
//" B.Kanban IS NULL \n" +
//" AND B.MaterialCode IS NULL \n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
//" ) UNION1 UNION ALL\n" +
//"SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" TEMP1.*,\n" +
//" TEMP2.Price,\n" +
//" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' WmsBillNum,\n" +
//" NULL BeginDate,\n" +
//" a.Kanban,\n" +
//" C.MaterialCode SapCode,\n" +
//" C.MaterialDesc,\n" +
//" C.CustomerPartCode,\n" +
//" C.EstimateTypeDesc MaterialGroup,\n" +
//" ISNULL( B.Qty, 0 ) SettleQty,\n" +
//" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
//" isnull( tt.qty, 0 ) BackQty,\n" +
//" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
//" FROM\n" +
//" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1=1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
//" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
//" AND A.MaterialCode = B.MaterialCode\n" +
//" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
//" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
//" AND c.MaterialCode = tt.MaterialCode \n" +
//" WHERE\n" +
//" a.WMSDeliveryQty> B.Qty AND (a.WMSDeliveryQty-tt.Qty)!=B.Qty \n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
//" ) UNION2";
//20220424-财务要求:大众看板待设置不出现在未结数据里-更新
//string sql = "SELECT\n" +
//" * \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" * \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" * \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" TEMP1.*,\n" +
//" TEMP2.Price,\n" +
//" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' WmsBillNum,\n" +
//" NULL BeginDate,\n" +
//" a.Kanban,\n" +
//" C.MaterialCode SapCode,\n" +
//" C.MaterialDesc,\n" +
//" C.CustomerPartCode,\n" +
//" C.EstimateTypeDesc MaterialGroup,\n" +
//" ISNULL( B.Qty, 0 ) SettleQty,\n" +
//" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
//" isnull( tt.qty, 0 ) BackQty,\n" +
//" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
//" FROM\n" +
//" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
//" LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
//" AND A.MaterialCode = B.MaterialCode\n" +
//" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
//" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
//" AND c.MaterialCode = tt.MaterialCode \n" +
//" WHERE\n" +
//" B.Kanban IS NULL \n" +
//" AND B.MaterialCode IS NULL \n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
//" ) UNION1 UNION ALL\n" +
//" SELECT\n" +
//" * \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" TEMP1.*,\n" +
//" TEMP2.Price,\n" +
//" ROUND( TEMP2.Price * TEMP1.DiffQty, 2 ) AS DiffAMT \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" '' WmsBillNum,\n" +
//" NULL BeginDate,\n" +
//" a.Kanban,\n" +
//" C.MaterialCode SapCode,\n" +
//" C.MaterialDesc,\n" +
//" C.CustomerPartCode,\n" +
//" C.EstimateTypeDesc MaterialGroup,\n" +
//" ISNULL( B.Qty, 0 ) SettleQty,\n" +
//" ISNULL( a.WMSDeliveryQty, 0 ) WMSDeliveryQty,\n" +
//" isnull( tt.qty, 0 ) BackQty,\n" +
//" ( ISNULL( a.WMSDeliveryQty, 0 ) - ISNULL( b.Qty, 0 ) - isnull( tt.qty, 0 ) ) AS DiffQty \n" +
//" FROM\n" +
//" ( SELECT SUM ( WMSDeliveryQty ) WMSDeliveryQty, MaterialCode, Kanban FROM Set_WMSKanBanSettle WHERE 1 = 1 {1} GROUP BY MaterialCode, Kanban ) A\n" +
//" INNER JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_KanBanSettle {0} GROUP BY Kanban, MaterialCode ) B ON A.Kanban = B.Kanban \n" +
//" AND A.MaterialCode = B.MaterialCode\n" +
//" LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" +
//" LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" +
//" AND c.MaterialCode = tt.MaterialCode \n" +
//" WHERE\n" +
//" a.WMSDeliveryQty> B.Qty \n" +
//" AND ( a.WMSDeliveryQty- tt.Qty ) != B.Qty \n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" +
//" ) UNION2 \n" +
//" ) UNION12\n" +
//" LEFT JOIN temp_vwkanban UNION3 ON UNION12.Kanban= UNION3.[看板号] \n" +
//" AND UNION12.CustomerPartCode= UNION3.[客户零件号] \n" +
//" WHERE\n" +
//" UNION3.[看板号] IS NULL \n" +
//" AND UNION3.[客户零件号] IS NULL \n" +
//" ) aaa \n" +
//"WHERE\n" +
//" aaa.CustomerPartCode NOT IN ( '30G839904A041', '80D867172KJ7' ) ";
//财务香凝要求:交货数量-退货数量=结算数量 这样的不体现在未结中
#endregion
sql = string.Format(sql,contion,strDate); sql = string.Format(sql,contion,strDate);

12
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/WmsDapperRepository.cs

@ -65,8 +65,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SalesStock> GetSalesStock() public virtual List<SalesStock> GetSalesStock()
{ {
string str = " select SUM(Qty) Qty,PartCode SapCode from TS_STOCK_DETAIL where AreaCode='SALE' group by PartCode "; //string str = " select SUM(Qty) Qty,PartCode SapCode from TS_STOCK_DETAIL where AreaCode='SALE' group by PartCode ";
string str = " EXEC [dbo].[GetSalesList] @locCode = N'' ";
var _list = DbConnection.Query<SalesStock>(str); var _list = DbConnection.Query<SalesStock>(str);
return _list.ToList(); return _list.ToList();
@ -74,10 +74,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
/// <summary>
/// 因为运行期间,直接SQL查询报超时,现在改为调用存储过程
/// </summary>
/// <param name="locCode"></param>
/// <returns></returns>
public virtual List<SalesStock> GetSalesStock(string locCode) public virtual List<SalesStock> GetSalesStock(string locCode)
{ {
string str = " select SUM(Qty) Qty,PartCode SapCode from TS_STOCK_DETAIL where AreaCode='SALE' and LocCode='{0}' group by PartCode "; string str = " EXEC [dbo].[GetSalesList] @locCode = N'{0}' ";
str=string.Format(str, locCode); str=string.Format(str, locCode);
var _list = DbConnection.Query<SalesStock>(str); var _list = DbConnection.Query<SalesStock>(str);

Loading…
Cancel
Save