Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
f9d48b9440
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs
  2. 405
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs
  3. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  4. 68
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  5. 1
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/SettleAccountEntityBase.cs
  6. 95
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  7. 40
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  8. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/ErpPartDapperRepository.cs
  9. 6
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoiceSettledDetailDiffDapperRepository.cs
  10. 71
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs

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

@ -358,11 +358,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
decimal _qty = decimal.Parse(_lst[8].Trim()); decimal _qty = decimal.Parse(_lst[8].Trim());
string _settlementID = _lst[9].Trim(); string _settlementID = _lst[9].Trim();
string _settlementSupplier = _lst[10].Trim(); string _settlementSupplier = _lst[10].Trim();
if (_preList.Any(p => p.KENNCode == _kENNCode)) if (_preList.Any(p => p.KENNCode == _kENNCode))
{ {
_precodeList.Add(_kENNCode); _precodeList.Add(_kENNCode);
} }
_setls.Add(new SettleAccount( _setls.Add(new SettleAccount(
GuidGenerator.Create(), GuidGenerator.Create(),

405
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs

@ -0,0 +1,405 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed;
using AutoMapper;
using System.Linq;
using System.Text;
using Volo.Abp.Guids;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.ObjectMapping;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.CacheBase;
using Win.Utils;
using Volo.Abp.Application.Dtos;
using Win.Sfs.BaseData.ImportExcelCommon;
using Volo.Abp.Domain.Repositories;
using EFCore.BulkExtensions;
using System.IO;
using Microsoft.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Entities.SettleAccountVersion;
using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.Shared.Enums.SettleAccount;
using Win.Sfs.Shared.Filter;
using Shouldly;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using System.Data.Common;
using Volo.Abp.Uow;
using Volo.Abp;
using Win.Abp.Snowflakes;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Magicodes.ExporterAndImporter.Core.Models;
using TaskJob.Services;
using TaskJob.EventArgs;
using Win.Sfs.SettleAccount.Entities.WMS;
using Win.Sfs.SettleAccount.Entities.Wms;
using Win.Sfs.SettleAccount.Repository;
using WY.NewJit.Extends.PaiGe.WMS;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace Win.Sfs.SettleAccount.Entities.WMS
{
[Route("api/settleaccount/WmsHQKBOutput")]
[AllowAnonymous]
//[Authorize(SettleAccountPermissions.WMSJIT.Default)]
public class WmsHQKBOutputAppService : SettleAccountApplicationBase<WmsHQWithOutKanbanOutPutDetial>
{
/// <summary>
/// 大众看板-出库
/// </summary>
//private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPutDetial, Guid> _wmsRepository;
//private readonly ISettleAccountBranchEfCoreRepository<WmsKanbanOutPut, Guid> _wmsVersionRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsHQWithOutKanbanOutPutDetial, Guid> _wmsRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsHQWithOutKanbanOutPut, Guid> _wmsVersionRepository;
private readonly KanbanUnSettledDapperRepository _dapper;
private readonly WMSEfCoreRepository<WmsKanbanOutPutDetial> _wmsefRespository;
private readonly WMSEfCoreRepository<TB_BILL> _wmstbRespository;
private readonly ISettleAccountBranchEfCoreRepository<TaskJob, Guid> _job;
private readonly IExcelImportAppService _excelImportService;
private readonly TaskJobService _service;
private readonly WmsDapperRepository _wmsDapper;
/// <summary>
///
/// </summary>
/// <param name="wmsRepository"></param>
/// <param name="job"></param>
/// <param name="wmsVersionRepository"></param>
/// <param name="wmsefRespository"></param>
/// <param name="wmstbRespository"></param>
public WmsHQKBOutputAppService(
IExcelImportAppService excelImportService,
ISettleAccountBranchEfCoreRepository<WmsHQWithOutKanbanOutPutDetial, Guid> wmsRepository,
ISettleAccountBranchEfCoreRepository<TaskJob, Guid> job,
ISettleAccountBranchEfCoreRepository<WmsHQWithOutKanbanOutPut, Guid> wmsVersionRepository,
WMSEfCoreRepository<WmsKanbanOutPutDetial> wmsefRespository,
KanbanUnSettledDapperRepository dapper,
WMSEfCoreRepository<TB_BILL> wmstbRespository,
IDistributedCache<WmsHQWithOutKanbanOutPutDetial> cache,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
WmsDapperRepository wmsDapper
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_job = job;
_wmstbRespository = wmstbRespository;
_wmsRepository = wmsRepository;
_wmsVersionRepository = wmsVersionRepository;
_wmsefRespository = wmsefRespository;
_excelImportService = excelImportService;
_dapper = dapper;
_wmsDapper = wmsDapper;
}
private async Task<long> GetCountAsync(WmsKanbanOutPutDetialRequestDto input)
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum });
return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters);
}
private async Task<long> GetCountAsync(WmsKanbanOutPutRequestDto input)
{
return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters);
}
/// <summary>
/// 准时化出库主表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsKanbanList")]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<PagedResultDto<WmsHQWithOutKanbanOutPut>> GetListAsync(WmsKanbanOutPutRequestDto input)
{
//input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum });
var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
input.SkipCount, true);
var totalCount = await GetCountAsync(input);
return new PagedResultDto<WmsHQWithOutKanbanOutPut>(totalCount, entities);
}
/// <summary>
/// 准时化出库明细
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsKanbanDetailList")]
[UnitOfWork(false)]
//[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
virtual public async Task<PagedResultDto<WmsHQWithOutKanbanOutPutDetial>> GetListAsync(WmsKanbanOutPutDetialRequestDto input)
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum });
var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
input.SkipCount, true);
var totalCount = await GetCountAsync(input);
var stockList = _wmsDapper.GetSalesStock();
var query = from itm in entities
join itm1 in stockList on itm.SapMaterialCode equals itm1.SapCode
into temp1
from tm1 in temp1.DefaultIfEmpty()
select new WmsHQWithOutKanbanOutPutDetial(
GuidGenerator.Create(),
"无看板发货",
itm.SapMaterialCode,
itm.MaterialDesc,
itm.Version,
string.Empty,
string.Empty,
itm.Qty,
tm1 == null ? 0 : tm1.Qty,
itm.OutputQty,
string.Empty,
itm.BillNum,
itm.State,
itm.RealityNumber,
itm.Price,
itm.Amt
);
return new PagedResultDto<WmsHQWithOutKanbanOutPutDetial>(totalCount, entities);
}
/// <summary>
/// 任务明细标记已确认
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[Route("WmsSharePartOutPutModify")]
[DisableRequestSizeLimit]
public async Task<bool> WmsSharePartUpdate(WmsHQWithOutKanbanOutPutDetial detial)
{
var _entityList = _wmsRepository.Where(p => p.Id == detial.BranchId).ToList();
if (_entityList.Count() > 0)
{
foreach (var itm in _entityList)
{
itm.OutputQty = detial.OutputQty;
await _wmsRepository.UpdateAsync(itm);
}
}
return true;
}
/// <summary>
/// 选择任务,生成出库单,只包含已确认的单据
/// </summary>
/// <param name="ids"></param>
/// <param name="version"></param>
/// <returns></returns>
[HttpPost]
[Route("ExcelImport")]
[UnitOfWork(false)]
public async Task<string> WmsKanbanOutPut([FromForm] IFormFileCollection files, string version)
{
var _count1 = _wmsVersionRepository.Count(p => p.Version == version);
if (_count1 > 0)
{
var checkList = new List<ErrorExportDto>();
checkList.Add(new ErrorExportDto() { Message = "有重复期间数据" });
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
}
var _billNum = "HQKB" + DateTime.Now.ToString("yyyyMMddhhmmss");
//var _list = _dapper.GetNoKanbanSettleDetail(input.Version);
ExportImporter _exportImporter = new ExportImporter();
var _list = await _exportImporter.ExtendExcelImport<WmsHQWithOutKanbanOutPutDetial>(files, _excelImportService);
var stockList = _wmsDapper.GetSalesStock();
var query = from itm in _list
join itm1 in stockList on itm.SapMaterialCode equals itm1.SapCode
into temp1
from tm1 in temp1.DefaultIfEmpty()
select new WmsHQWithOutKanbanOutPutDetial(
GuidGenerator.Create(),
"无看板发货",
itm.SapMaterialCode,
itm.MaterialDesc,
itm.Version,
string.Empty,
string.Empty,
itm.Qty,
tm1 == null ? 0 : tm1.Qty,
itm.Qty,
string.Empty,
_billNum,
0,
0,
itm.Price,
itm.Amt
);
await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum);
if (_count == 0)
{
var _version = new WmsHQWithOutKanbanOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email);
await _wmsVersionRepository.InsertAsync(_version, true);
}
return ApplicationConsts.SuccessStr; ;
}
/// <summary>
/// 出库界面功能,核准出库功能
/// </summary>
/// <param name="version"></param>
/// <param name="p_list"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsKanbanOutPut-Pass")]
[UnitOfWork(false)]
public async Task<bool> WmsKanbanOutPutPass(WmsJitRequestDto input)
{
if (input.Guids != null)
{
List<WmsHQWithOutKanbanOutPutDetial> _ls = new List<WmsHQWithOutKanbanOutPutDetial>();
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).ToListAsync();
}
else
{
_ls = await _wmsRepository.Where(p => p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync();
}
_ls = _ls.Where(p => p.SockQty >= p.OutputQty).ToList();
if (_ls.Count() > 0)
{
var sql = "DECLARE @return_value int\n" +
"EXEC @return_value = [dbo].[p_wms_ou" +
"tput]\n" +
" @billnum = N'{0}',\n" +
" @type = 21,\n" +
" @date = N'{1}'\n" +
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString()));
}
}
return true;
}
/// <summary>
///出库界面功能, 撤销核准出库
/// </summary>
/// <param name="ids"></param>
/// <param name="version"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsKanbanOutPut-Cancel")]
public async Task<bool> WmsKanbanOutPutCancel(WmsJitRequestDto input)
{
if (input.Guids != null && input.Guids.Count() > 0)
{
List<string> _ls = new List<string>();
foreach (var itm in input.Guids)
{
_ls.Add(string.Format("{0}", itm));
}
string str = string.Join(",", _ls.ToArray());
var sql = "DECLARE @return_value int\n" +
"EXEC @return_value = [dbo].[p_wms_output_cancel]\n" +
" @Guids ='{0}', \n" +
" @billnum = N'{1}',\n" +
" @type = 21,\n" +
" @accountdate = N'{2}'\n" +
"SELECT 'Return Value' = @return_value";
sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString());
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
sql
);
}
return true;
}
/// <summary>
/// 出库界面功能删除
/// </summary>
/// <param name="version"></param>
/// <param name="p_list"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsOutPutDelete")]
[UnitOfWork(false)]
public async Task<bool> WmsOutPutDelete(WmsJitRequestDto input)
{
var count = _wmsRepository.Count(p => p.BillNum == input.BillNum && p.State != 0);
if (count > 0)
{
return false;
}
var sql = "DECLARE @return_value int\n" +
"EXEC @return_value = [dbo].[p_wms_output_cancel_all]\n" +
" @billnum = N'{0}',\n" +
" @type = 21\n" +
"SELECT 'Return Value' = @return_value";
await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
string.Format(sql, input.BillNum)
);
return true;
}
// 物料 物料组 物料描述 物料号 开始日期 结束日期 单位 出库数量 结算数量 寄售库存数量
}
}

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

@ -171,9 +171,6 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}); });
return _taskid; return _taskid;
} }
#region 大众备件0-90天和90天以上输出 #region 大众备件0-90天和90天以上输出
/// <summary> /// <summary>
@ -568,7 +565,6 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
BaseRequestDto input BaseRequestDto input
) )
{ {
List<CustomCondition> customConditionList = new List<CustomCondition>(); List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version }); customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode }); customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });

68
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -2899,6 +2899,74 @@
<param name="version"></param> <param name="version"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="F:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService._wmsRepository">
<summary>
大众看板-出库
</summary>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.#ctor(Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsHQWithOutKanbanOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsHQWithOutKanbanOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPutDetial},Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.KanbanUnSettledDapperRepository,Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL},Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS.WmsHQWithOutKanbanOutPutDetial},Win.Abp.Snowflakes.ISnowflakeIdGenerator,Win.Sfs.SettleAccount.CommonManagers.ICommonManager,Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.WmsDapperRepository)">
<summary>
</summary>
<param name="wmsRepository"></param>
<param name="job"></param>
<param name="wmsVersionRepository"></param>
<param name="wmsefRespository"></param>
<param name="wmstbRespository"></param>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.GetListAsync(Win.Sfs.SettleAccount.Entities.Wms.WmsKanbanOutPutRequestDto)">
<summary>
准时化出库主表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.GetListAsync(Win.Sfs.SettleAccount.Entities.Wms.WmsKanbanOutPutDetialRequestDto)">
<summary>
准时化出库明细
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.WmsSharePartUpdate(Win.Sfs.SettleAccount.Entities.WMS.WmsHQWithOutKanbanOutPutDetial)">
<summary>
任务明细标记已确认
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.WmsKanbanOutPut(Microsoft.AspNetCore.Http.IFormFileCollection,System.String)">
<summary>
选择任务,生成出库单,只包含已确认的单据
</summary>
<param name="ids"></param>
<param name="version"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.WmsKanbanOutPutPass(Win.Sfs.SettleAccount.Entities.Wms.WmsJitRequestDto)">
<summary>
出库界面功能,核准出库功能
</summary>
<param name="version"></param>
<param name="p_list"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.WmsKanbanOutPutCancel(Win.Sfs.SettleAccount.Entities.Wms.WmsJitRequestDto)">
<summary>
出库界面功能, 撤销核准出库
</summary>
<param name="ids"></param>
<param name="version"></param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.WMS.WmsHQKBOutputAppService.WmsOutPutDelete(Win.Sfs.SettleAccount.Entities.Wms.WmsJitRequestDto)">
<summary>
出库界面功能删除
</summary>
<param name="version"></param>
<param name="p_list"></param>
<returns></returns>
</member>
<member name="T:Win.Sfs.SettleAccount.Entities.WMS.WmsHQMKanbanAppService"> <member name="T:Win.Sfs.SettleAccount.Entities.WMS.WmsHQMKanbanAppService">
<summary> <summary>
wms出库-M平台 wms出库-M平台

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

@ -15,7 +15,6 @@ namespace Win.Sfs.SettleAccount.Entities
public static List<Material> CacheMaterials { set; get; } public static List<Material> CacheMaterials { set; get; }
public static List<ErpPrice> CachePriceList { set; get; } public static List<ErpPrice> CachePriceList { set; get; }
public static List<InvoiceSettledDetailDiff> CacheInvoiceSettledDetailDiff { set; get; } public static List<InvoiceSettledDetailDiff> CacheInvoiceSettledDetailDiff { set; get; }
} }

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

@ -439,6 +439,101 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
public class WmsHQWithOutKanbanOutPut : FullAuditedAggregateRootBase<Guid>
{
public WmsHQWithOutKanbanOutPut()
{
}
public WmsHQWithOutKanbanOutPut(Guid id, string version, string billNum, string creator) : base(id)
{
Id = id;
Version = version;
BillNum = billNum;
Creator = creator;
}
public string Version { set; get; }
public string BillNum { set; get; }
public string Creator { set; get; }
}
/// <summary>
/// 看板明细
/// </summary>
public class WmsHQWithOutKanbanOutPutDetial : FullAuditedAggregateRootBase<Guid>
{
public WmsHQWithOutKanbanOutPutDetial()
{
}
public WmsHQWithOutKanbanOutPutDetial(Guid id, string type, string sapMaterialCode, string materialDesc, string version, string isBack, string remark, decimal qty, decimal sockQty, decimal outputQty, string extend, string billnum, int state, decimal realqty, decimal price, decimal amt) : base(id)
{
Type = type;
SapMaterialCode = sapMaterialCode;
MaterialDesc = materialDesc;
Version = version;
IsBack = isBack;
Remark = remark;
Qty = qty;
SockQty = sockQty;
OutputQty = outputQty;
Extend = extend;
BillNum = billnum;
State = state;
RealityNumber = realqty;
Price = price;
Amt = amt;
}
[ImporterHeader(Name = "单据类型", IsIgnore = true)]
public string Type { set; get; }
[ImporterHeader(Name = "物料号")]
public string SapMaterialCode { set; get; }
[ImporterHeader(Name = "物料描述")]
public string MaterialDesc { set; get; }
[ImporterHeader(Name = "版本号")]
public string Version { set; get; }
[ImporterHeader(Name = "是否备件")]
public string IsBack { set; get; }
[ImporterHeader(Name = "结算数量")]
public decimal Qty { set; get; }
[ImporterHeader(Name = "寄售库存数量", IsIgnore = true)]
public decimal SockQty { set; get; }
[ImporterHeader(Name = "真实数量", IsIgnore = true)]
public decimal RealityNumber { set; get; }
[ImporterHeader(Name = "出库数量", IsIgnore = true)]
public decimal OutputQty { set; get; }
[ImporterHeader(Name = "Extend", IsIgnore = true)]
public string Extend { set; get; }
[ImporterHeader(Name = "BillNum", IsIgnore = true)]
public string BillNum { set; get; }
[ImporterHeader(Name = "状态", IsIgnore = true)]
public int State { set; get; }
[ImporterHeader(Name = "开票单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "开票金额")]
public decimal Amt { set; get; }
}

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

@ -365,6 +365,11 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePriceListVersionBJ(options); builder.ConfigurePriceListVersionBJ(options);
builder.ConfigurePriceListBJ(options); builder.ConfigurePriceListBJ(options);
builder.ConfigureWmsHQWithOutKanbanOutPutVersion(options);
builder.ConfigureWmsHQWithOutKanbanOutPutDetail(options);
#endregion #endregion
} }
@ -1376,12 +1381,40 @@ namespace Win.Sfs.SettleAccount
} }
private static void ConfigureWmsWithOutKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureWmsWithOutKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<WmsHQWithOutKanbanOutPutDetial>(b =>
{
b.ToTable($"{options.TablePrefix}_WmsWithOutKanbanOutPutDetial", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.BillNum });
});
}
private static void ConfigureWmsHQWithOutKanbanOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<WmsHQWithOutKanbanOutPut>(b =>
{
b.ToTable($"{options.TablePrefix}_WmsHQWithOutKanbanOutPut", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.BillNum });
});
}
private static void ConfigureWmsHQWithOutKanbanOutPutDetail(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<WmsWithOutKanbanOutPutDetial>(b => builder.Entity<WmsWithOutKanbanOutPutDetial>(b =>
{ {
//b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetialExtend", options.Schema); //b.ToTable($"{options.TablePrefix}_WmsKanbanOutPutDetialExtend", options.Schema);
b.ToTable($"{options.TablePrefix}_WmsWithOutKanbanOutPutDetial", options.Schema); b.ToTable($"{options.TablePrefix}_WmsHQWithOutKanbanOutPutDetial", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength); b.Property(x => x.BillNum).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
@ -1397,6 +1430,11 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureWmsSharePartOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureWmsSharePartOutPutVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {

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

@ -51,7 +51,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
else else
{ {
_materialList = DbConnection.Query<Material>("select max(Id) Factory,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType ").ToList(); _materialList = DbConnection.Query<Material>("select max(Id) ID,'' Factory,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc,EstimateTypeDesc,EstimateType ").ToList();
} }
if (CacheManager.CachePriceList != null) if (CacheManager.CachePriceList != null)
{ {

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

@ -37,7 +37,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
else else
{ {
string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle1] WITH(SNAPSHOT) where Version = '{0}'", version); string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle_RAM] WITH(SNAPSHOT) where Version = '{0}'", version);
int _count = DbConnection.ExecuteScalar<int>(isExistSql); int _count = DbConnection.ExecuteScalar<int>(isExistSql);
string condition = " where 1=1 "; string condition = " where 1=1 ";
@ -132,6 +132,10 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
else else
{ {
if (CacheManager.CacheInvoiceSettledDetailDiff == null)
{
CacheManager.CacheInvoiceSettledDetailDiff = new List<InvoiceSettledDetailDiff>();
}
CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list); CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list);
} }

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

@ -61,72 +61,7 @@ namespace TaskJob.Services
{ {
var filePath = fileSavePath + itm;//获取到导入的excel var filePath = fileSavePath + itm;//获取到导入的excel
var exten = Path.GetExtension(fileSavePath); var exten = Path.GetExtension(fileSavePath);
//List<string> _errorList = new List<string>();
//var checkList = new List<ErrorExportDto>();
////var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true);
////var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct();
//List<string> _precodeList = new List<string>();//
//if (exten.ToUpper() == ".TXT")
//{
// using (TextReader textReader = new StreamReader(filePath))
// {
// int i = 0;
// while (true)
// {
// string str = textReader.ReadLine();
// if (string.IsNullOrEmpty(str))
// {
// break;
// }
// else
// {
// try
// {
// var _lst = str.Split(new char[] { '|' }).ToList();
// string _settleyear = _lst[1].Trim();
// string _kENNCode = _lst[2].Trim();
// string _chassisNumber = _lst[3].Trim();
// string _model = _lst[4].Trim();
// DateTime _cP5A = DateTime.Parse(_lst[5].Trim());
// DateTime _cP7 = DateTime.Parse(_lst[6].Trim());
// string _materialCode = _lst[7].Trim();
// decimal _qty = decimal.Parse(_lst[8].Trim());
// string _settlementID = _lst[9].Trim();
// string _settlementSupplier = _lst[10].Trim();
// _setls.Add(new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(
// Guid.NewGuid(),
// Guid.NewGuid(),
// _settleyear,
// _kENNCode,
// _chassisNumber,
// _model,
// _cP5A,
// _cP7,
// _materialCode,
// _qty,
// _settlementID,
// _settlementSupplier,
// DateTime.Now.Year.ToString(),
// DateTime.Now.Month.ToString(),
// _id,
// version,
// DateTime.Now,
// Guid.NewGuid()
// ));
// }
// catch
// {
// }
// }
// i++;
// }
// textReader.Close();
// }
//}
//else
//{
// _setls= _inputService.Input<Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount>(filePath);
var errorlist = new List<ErrorExportDto>(); var errorlist = new List<ErrorExportDto>();
var dtoList = _inputService.Input<SettleAccountImportDto>(filePath, null, errorlist); var dtoList = _inputService.Input<SettleAccountImportDto>(filePath, null, errorlist);
foreach (var dto in dtoList) foreach (var dto in dtoList)
@ -139,13 +74,12 @@ namespace TaskJob.Services
dto.ChassisNumber, dto.Model, dto.CP5A, dto.CP7, dto.ChassisNumber, dto.Model, dto.CP5A, dto.CP7,
Regex.Replace(dto.MaterialCode, @"\s", ""), dto.Qty, dto.SettlementID, dto.SettlementSupplier, Regex.Replace(dto.MaterialCode, @"\s", ""), dto.Qty, dto.SettlementID, dto.SettlementSupplier,
DateTime.Now.Month.ToString(), dto.SettleYear, _id, version, DateTime.Now, Guid.NewGuid()); DateTime.Now.Month.ToString(), dto.SettleYear, _id, version, DateTime.Now, Guid.NewGuid());
_setls.Add(_settleaccount); _setls.Add(_settleaccount);
} }
//} //}
#region #region
//var errorFileName = "错误文件.xlsx"; //var errorFileName = "错误文件.xlsx";
//checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty)); //checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty));
//_service.ExportError<ErrorExportDto>(id,errorFileName, checkList); //_service.ExportError<ErrorExportDto>(id,errorFileName, checkList);
#endregion #endregion
} }
@ -158,8 +92,7 @@ namespace TaskJob.Services
_setls = _setls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList(); _setls = _setls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList();
_repository.Insert(_setls); _repository.Insert(_setls);
_versionRepository.Insert(_id, version, customerCode, customerCode); _versionRepository.Insert(_id, version, customerCode, customerCode);
_repository.GetDbContext().Database.ExecuteSqlRaw(
_repository.GetDbContext().Database.ExecuteSqlRaw(
"EXEC sp_settle_fis_update" "EXEC sp_settle_fis_update"
); );

Loading…
Cancel
Save