Browse Source

更新版本

branch_ccpg_220107
Administrator 3 years ago
parent
commit
5eaa5d1998
  1. 10
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json
  2. 8
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  3. 156
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs
  4. 36
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  5. 24
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  6. 14
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  7. 19
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  8. 145
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs
  9. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  10. 9
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithCodeExportService.cs
  11. 111
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithOutCodeExportService.cs
  12. 11
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs
  13. 7
      src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

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

@ -7,11 +7,11 @@
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;"
//},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;"
//"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
//"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;",
//"Wms": "Server=192.168.0.140;Database=CPAT_WMS_TEST;user id=sa;password=Microsoft2008;"
//"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
//"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;"
"Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;",
"SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;",
"Wms": "Server=192.168.0.140;Database=CPAT_WMS_TEST;user id=sa;password=Microsoft2008;"
},
"Logging": {
"LogLevel": {

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

@ -7,10 +7,10 @@
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;"
//},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;",
//"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
//"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;",
//"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
//"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;",
"Default": "Server=192.168.0.67;Database=ABP;User ID=sa;Password=Microsoft2008;",
"SettleAccountService": "Server=192.168.0.67;Database=SettleAccountService;user id=sa;password=Microsoft2008;",
"Wms": "Server=192.168.0.140;Database=CPAT_WMS_TEST;user id=sa;password=Microsoft2008;"
},

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

@ -47,6 +47,7 @@ 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.SettleAccounts
{
@ -162,24 +163,117 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
foreach (var itm in _joblist)
{
itm.FileName = "已确认";
}
foreach (var itm in _joblist)
{
await _job.UpdateAsync(itm);
}
var _count=await _job.BatchUpdateAsync(_joblist.ToList());
if (_count > 0)
return true;
}
/// <summary>
/// 选择任务,生成出库单,只包含已确认的单据
/// </summary>
/// <param name="ids"></param>
/// <param name="version"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsWithOutKanbanOutPut")]
public async Task<string> WmsWithOutKanbanOutPut(WmsJitRequestDto input)
{
var _billNum = "KA" + DateTime.Now.ToString("yyyyMMddhhmmss");
var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList();
if (_joblist.Count() > 0)
{
return true;
}
return false;
var fileList = _joblist.Select(p => p.RealDownFileName).ToList();
List<WmsKanbanOutPutDetial> _lst = new List<WmsKanbanOutPutDetial>();
foreach (var filename in fileList)
{
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
ExcelHelper _excelHelper = new ExcelHelper(fileSavePath);
var _list = _excelHelper.ExcelToList<SettleKBWithOutCode>();
foreach (var itm in _list)
{
var _entity= new WmsKanbanOutPutDetial(GuidGenerator.Create(), string.Empty, string.Empty, itm.MaterialCode, itm.MaterialDesc
, itm.SapMaterialGroup, string.Empty, string.Empty, 0, string.Empty, string.Empty, itm.Version, itm.SapMaterialCode,
_billNum, Guid.Empty, string.Empty, itm.InvoiceQty
);
_lst.Add(_entity);
}
}
var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version && p.Kanban==string.Empty).ToListAsync();
//var error = from itm1 in outPutDetail
// join itm2 in _ls1 on
// new { itm1.MaterialCode, itm1.Kanban }
// equals
// new { itm2.MaterialCode, itm2.Kanban }
// select itm1;
//var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) });
//if (errList.Count() == 0)
//{
// var query = from itm1 in _ls1
// join itm2 in outPutDetail on
// new { itm1.MaterialCode, itm1.Kanban }
// equals
// new { itm2.MaterialCode, itm2.Kanban } into temp1
// from tm1 in temp1.DefaultIfEmpty()
// where tm1 == null
// select itm1;
// var _wmslst = query.ToList();
// foreach (var itm in _lst)
// {
// itm.BillNum = _billNum;
// }
await _wmsRepository.GetDbContext().BulkInsertAsync(_lst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum);
if (_count == 0)
{
var _version = new WmsKanbanOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email);
await _wmsVersionRepository.InsertAsync(_version, true);
}
foreach (var job in _joblist)
{
job.FileName = _billNum;
await _job.UpdateAsync(job);
}
}
//else
//{
// StringBuilder _buffer = new StringBuilder();
// foreach (var itm in errList)
// {
// _buffer.AppendFormat("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number);
// }
// var _errinfo = _buffer.ToString();
// foreach (var job in _joblist)
// {
// job.FileName = _errinfo;
// await _job.UpdateAsync(job);
// }
//}
//}
//else
//{
// _billNum = string.Empty;
//}
return ApplicationConsts.SuccessStr; ;
}
/// <summary>
/// 选择任务,生成出库单,只包含已确认的单据
/// </summary>
/// <param name="ids"></param>
/// <param name="version"></param>
/// <returns></returns>
/// <summary>
/// 选择任务,生成出库单,只包含已确认的单据
/// </summary>
/// <param name="ids"></param>
/// <param name="version"></param>
/// <returns></returns>
[HttpPost]
[Route("WmsKanbanOutPut")]
public async Task<string> WmsKanbanOutPut(WmsJitRequestDto input)
@ -198,7 +292,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var _list = _excelHelper.ExcelToList<WmsKanbanOutPutDetial>();
foreach (var itm in _list)
{
itm.SetId(GuidGenerator.Create());
itm.SetId(GuidGenerator.Create(),string.Empty);
}
_lst.AddRange(_list.ToArray());
}
@ -390,6 +484,38 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList();
var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync();
var error = from itm1 in outPutDetail
join itm2 in _ls1 on
new { itm1.MaterialCode, itm1.Kanban }
equals
new { itm2.MaterialCode, itm2.Kanban }
select itm1;
var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) });
var checkList = new List<ErrorExportDto>();
foreach (var itm in errList)
{
checkList.Add(new ErrorExportDto() { Message = string.Format("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number) });
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
var query = from itm1 in _ls1
join itm2 in outPutDetail on
new { itm1.MaterialCode, itm1.Kanban }

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

@ -57,7 +57,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
[AllowAnonymous]
[Route("api/settleaccount/wmsSharePartoutput")]
public class WMSSharePartAppService :
ApplicationService
SettleAccountApplicationBase<WmsSharePartOutPutDetial>
{
private readonly ISettleAccountBranchEfCoreRepository<WmsSharePartOutPutDetial, Guid> _wmsRepository;
@ -84,8 +84,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
ISettleAccountBranchEfCoreRepository<WmsSharePartOutPut, Guid> wmsVersionRepository,
WMSEfCoreRepository<WmsSharePartOutPutDetial> wmsefRespository,
WMSEfCoreRepository<TB_BILL> wmstbRespository,
IExcelImportAppService excelImportService
)
IExcelImportAppService excelImportService,
IDistributedCache<WmsSharePartOutPutDetial> cache,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_excelImportService = excelImportService;
_job = job;
@ -388,6 +391,33 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList();
var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync();
var error = from itm1 in outPutDetail
join itm2 in _ls1 on
new { itm1.MaterialCode, itm1.OrderBillNum }
equals
new { itm2.MaterialCode, itm2.OrderBillNum }
select itm1;
var errList = error.GroupBy(p => new { p.BillNum }).Select(p => new { BillNum = p.Key.BillNum, Number = p.Sum(itm => itm.Qty) });
var checkList = new List<ErrorExportDto>();
foreach (var itm in errList)
{
checkList.Add(new ErrorExportDto() { Message = string.Format("出库单号:{0}重复记录数:{1}条", itm.BillNum, itm.Number) });
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
var query = from itm1 in _ls1
join itm2 in outPutDetail on
new { itm1.MaterialCode, itm1.OrderBillNum }

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

@ -149,6 +149,30 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid;
}
[HttpPost]
[Route("SettleKanBan-WithOutCode")]
[DisableRequestSizeLimit]
public async Task<string> SettledKanBanWithOutCode(BaseKanbanReqestDto input)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = input.CustomerCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "CustomerPartCode", Value = input.CustomerPartCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "State", Value = input.State ?? "0" });
customConditionList.Add(new CustomCondition() { Name = "EstimateTypeDesc", Value = input.EstimateTypeDesc ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "有条码看板结算核对" });
customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.KanBan ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "SapMaterialCode", Value = input.SapMaterialCode ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = input.Begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End.ToString() });
var _taskid = await _service.ExportEnqueueAsync("大众无看板号库存核对明细表", ExportExtentsion.Excel, input.Version, string.Empty, CurrentUser, typeof(SettleKBWithOutCodeExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
/// <summary>
/// 大众备件结算核对明细表
/// </summary>

14
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -1672,7 +1672,7 @@
wms出库
</summary>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSJitAppService.#ctor(Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL})">
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSJitAppService.#ctor(Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL},Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial},Win.Abp.Snowflakes.ISnowflakeIdGenerator,Win.Sfs.SettleAccount.CommonManagers.ICommonManager)">
<summary>
</summary>
@ -1739,7 +1739,7 @@
wms出库
</summary>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSKanbanAppService.#ctor(Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL})">
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSKanbanAppService.#ctor(Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL},Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS.WmsKanbanOutPutDetial},Win.Abp.Snowflakes.ISnowflakeIdGenerator,Win.Sfs.SettleAccount.CommonManagers.ICommonManager)">
<summary>
</summary>
@ -1770,6 +1770,14 @@
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSKanbanAppService.WmsWithOutKanbanOutPut(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.SettleAccounts.WMSKanbanAppService.WmsKanbanOutPut(Win.Sfs.SettleAccount.Entities.Wms.WmsJitRequestDto)">
<summary>
选择任务,生成出库单,只包含已确认的单据
@ -1799,7 +1807,7 @@
wms出库
</summary>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSSharePartAppService.#ctor(Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL},Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService)">
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.WMSSharePartAppService.#ctor(Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.TaskJob,System.Guid},Win.Sfs.SettleAccount.ISettleAccountBranchEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPut,System.Guid},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial},Win.Sfs.SettleAccount.Repository.WMSEfCoreRepository{WY.NewJit.Extends.PaiGe.WMS.TB_BILL},Win.Sfs.BaseData.ImportExcelCommon.IExcelImportAppService,Volo.Abp.Caching.IDistributedCache{Win.Sfs.SettleAccount.Entities.WMS.WmsSharePartOutPutDetial},Win.Abp.Snowflakes.ISnowflakeIdGenerator,Win.Sfs.SettleAccount.CommonManagers.ICommonManager)">
<summary>
</summary>

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

@ -257,9 +257,10 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Remark = remark;
Qty = qty;
}
public void SetId(Guid id)
public void SetId(Guid id,string remark)
{
Id = id;
Remark = remark;
}
@ -272,7 +273,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string ParentMaterialCode { set; get; }
[ImporterHeader(Name = "交货单号")]
public string WmsBillNum { set; get; }
[ImporterHeader(Name = "看板号")]
[ImporterHeader(Name = "条码号")]
//KENN号
public string Kanban { set; get; }
@ -285,15 +286,15 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[ImporterHeader(Name = "物料组(车型)")]
//物料组(车型)
public string MaterialGroup { set; get; }
[ImporterHeader(Name = "出库库位")]
[ImporterHeader(Name = "出库库位",IsIgnore =true)]
//出库库位
public string OutPut { set; get; }
[ImporterHeader(Name = "入库库位")]
[ImporterHeader(Name = "入库库位", IsIgnore = true)]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态")]
public int State { get; set; }
[ImporterHeader(Name = "扩展字段1")]
[ImporterHeader(Name = "扩展字段1", IsIgnore = true)]
/// <summary>
/// 扩展字段1
/// </summary>
@ -301,17 +302,17 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
/// <summary>
/// 扩展字段2
/// </summary>
[ImporterHeader(Name = "扩展字段2")]
[ImporterHeader(Name = "扩展字段2", IsIgnore = true)]
public string Extend2 { set; get; }
/// <summary>
/// 扩展字段3
/// </summary>
[ImporterHeader(Name = "版本号")]
[ImporterHeader(Name = "版本号", IsIgnore = true)]
public string Version { set; get; }
[ImporterHeader(Name = "数量")]
[ImporterHeader(Name = "结算数量",IsIgnore =true)]
public decimal? Qty { set; get; }
[ImporterHeader(Name = "数量", IsIgnore = true)]
[ImporterHeader(Name = "单据", IsIgnore = true)]
public string BillNum { set; get; }

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

@ -15,6 +15,50 @@ using Win.Sfs.SettleAccount.FISes;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
public class SettleKBWithOutCode
{
// Factory MaterialCode InvoiceQty InvoiceAmt InvoicePrice SapMaterialCode MaterialDesc SapMaterialGroup DiffPrice SalePrice SocketQty
[ExporterHeader(DisplayName = "期间")]
public string Version { get; set; }
[ExporterHeader(DisplayName = "物料组")]
public string SapMaterialGroup { get; set; }
[ExporterHeader(DisplayName = "SAP编号")]
public string SapMaterialCode { get; set; }
[ExporterHeader(DisplayName = "工厂")]
public string Factory { get; set; }
[ExporterHeader(DisplayName = "零件编号")]
public string MaterialCode { get; set; }
[ExporterHeader(DisplayName = "零件名称")]
public string MaterialDesc { get; set; }
[ExporterHeader(DisplayName = "开票数量")]
public decimal InvoiceQty { get; set; }
[ExporterHeader(DisplayName = "金额")]
public decimal InvoiceAmt { get; set; }
[ExporterHeader(DisplayName = "开票单价")]
public decimal InvoicePrice { get; set; }
[ExporterHeader(DisplayName = "库存数量")]
public decimal SocketQty { get; set; }
//[ExporterHeader(DisplayName = "数量差")]
//public decimal DiffQty { get; set; }
//[ExporterHeader(DisplayName = "CP7报废")]
//public decimal CP7ScrapQty { get; set; }
//[ExporterHeader(DisplayName = "索赔/退货")]
//public decimal ClaimQty { get; set; }
[ExporterHeader(DisplayName = "定价")]
public decimal SalePrice { get; set; }
[ExporterHeader(DisplayName = "价格差异")]
public decimal DiffPrice { get; set; }
}
public class KanbanUnSettled
{
[ExporterHeader(DisplayName = "交货单号")]
@ -81,7 +125,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
}
public virtual List<KanbanUnSettled> GetKanbanReportList( string version, string begintime, string endtime)
public virtual List<KanbanUnSettled> GetKanbanReportList(string version, string begintime, string endtime)
{
string sql = " SELECT\n" +
@ -115,7 +159,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _list = _query.ToList();
return _list;
}
public virtual List<KanbanUnSettledExtend> GetNoKanbanReportList( string version, string begintime, string endtime)
public virtual List<KanbanUnSettledExtend> GetNoKanbanReportList(string version, string begintime, string endtime)
{
var sql = "SELECT\n" +
" TEMP1.*,\n" +
@ -144,6 +188,103 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _list = _query.ToList();
return _list;
}
public virtual List<SettleKBWithOutCode> GetNoKanbanSettleDetail(string version, string begintime, string endtime)
{
var sql =
" SELECT\n" +
" '{0}' Version ,"+
" temp1.Factory,\n" +
" temp1.MaterialCode,\n" +
" temp1.InvoiceQty,\n" +
" temp1.InvoiceAmt,\n" +
" temp1.InvoicePrice,\n" +
" temp1.SapMaterialCode,\n" +
" temp1.MaterialDesc,\n" +
" temp1.SapMaterialGroup,\n" +
" temp1.InvoicePrice - ISNULL( temp2.Price, 0 ) AS DiffPrice,\n" +
" temp2.Price AS SalePrice \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" b.Factory,\n" +
" b.MaterialCode,\n" +
" b.InvoiceQty,\n" +
" b.InvoiceAmt,\n" +
" b.InvoicePrice,\n" +
" g.MaterialCode AS SapMaterialCode,\n" +
" g.MaterialDesc,\n" +
" g.EstimateTypeDesc AS SapMaterialGroup \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" Factory,\n" +
" MaterialCode,\n" +
" SUM( Qty ) AS InvoiceQty,\n" +
" SUM( Amt ) AS InvoiceAmt,\n" +
" SUM( Amt ) / SUM( Qty ) AS InvoicePrice \n" +
" FROM\n" +
" Set_Invoice \n" +
" WHERE\n" +
" ( Version = '{0}' ) \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" Factory \n" +
" ) AS b\n" +
" LEFT OUTER JOIN ( SELECT SUM( Qty ) AS Qty, MaterialCode FROM Set_Settle WHERE ( Version = '{0}' ) GROUP BY MaterialCode ) AS c ON b.MaterialCode = c.MaterialCode\n" +
" LEFT OUTER JOIN (\n" +
" SELECT\n" +
" Id,\n" +
" YEAR,\n" +
" Period,\n" +
" Version,\n" +
" Type,\n" +
" MaterialCode,\n" +
" MaterialDesc,\n" +
" Qty,\n" +
" Amt,\n" +
" Extend,\n" +
" ExtraProperties,\n" +
" ConcurrencyStamp,\n" +
" CreationTime,\n" +
" CreatorId,\n" +
" LastModificationTime,\n" +
" LastModifierId,\n" +
" IsDeleted,\n" +
" DeleterId,\n" +
" DeletionTime,\n" +
" BranchId,\n" +
" Enabled,\n" +
" Remark \n" +
" FROM\n" +
" Set_ScrapClaims \n" +
" WHERE\n" +
" ( Version = '{0}' )) AS e ON b.MaterialCode = e.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS g ON b.MaterialCode = g.CustomerPartCode \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" (\n" +
" Version = ( SELECT MAX( Version ) AS Expr1 FROM Set_PriceListVersion ))) AS temp2 ON temp1.SapMaterialCode = temp2.MaterialCode \n" +
"WHERE\n" +
" (\n" +
" temp1.SapMaterialGroup IN ( '柱护板成品-NCS', '高光盖板成品-BORA', '高光盖板成品-A SUV', '高光盖板成品-B9 ACC', '成品-NCS NF装饰条', '成品-Q3 HG' ))";
string str = string.Empty;
str += " where 1=1 ";
sql = string.Format(sql, version);
var _query = DbConnection.Query<SettleKBWithOutCode>(sql, null, null, true, 1200, null);
var _list = _query.ToList();
return _list;
}
}
}

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

@ -71,7 +71,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" LEFT JOIN ( SELECT Price, --定价\n" +
" MaterialCode --厂内物料号\n" +
" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
"WHERE 1=1 {1}";
"WHERE 1=1 ";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
//if (!string.IsNullOrEmpty(kanBan))

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

@ -48,9 +48,12 @@ namespace SettleAccount.Job.Services.Report
foreach (var itm in diffList)
{
var _first = _list.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoiceDiffQty = _first.SettleNumber + itm.DiffQty;//开票数量(结算数量+差异)
_first.InvoiceMoney = _first.InvoiceDiffQty * _first.InvoicePrice;//开票总金额(开票数量*开票单价)
_first.SumDiffMoney = (_first.SettleNumber * _first.Price) - _first.InvoiceMoney;//总金额差异(结算金额-开票金额)
if (_first != null)
{
_first.InvoiceDiffQty = _first.SettleNumber + itm.DiffQty;//开票数量(结算数量+差异)
_first.InvoiceMoney = _first.InvoiceDiffQty * _first.InvoicePrice;//开票总金额(开票数量*开票单价)
_first.SumDiffMoney = (_first.SettleNumber * _first.Price) - _first.InvoiceMoney;//总金额差异(结算金额-开票金额)
}
}
}
if (!string.IsNullOrEmpty(materialGroup))

111
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleKBWithOutCodeExportService.cs

@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
public class SettleKBWithOutCodeExportService : ITransientDependency, IExportJob
{
private readonly KanbanUnSettledDapperRepository _dapper;
private readonly OutputService _outputService;
private readonly ErpPartDapperRepository _erpdapperRepository;
public SettleKBWithOutCodeExportService(KanbanUnSettledDapperRepository dapper,
OutputService outputService,
ErpPartDapperRepository erpdapperRepository)
{
_dapper = dapper;
_outputService = outputService;
_erpdapperRepository = erpdapperRepository;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var _filename = exportName.FirstOrDefault();
var sapMaterialCode = p_list.Where(p => p.Name == "SapMaterialCode").FirstOrDefault().Value;
var customerPartCode = p_list.Where(p => p.Name == "CustomerPartCode").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var materialGroup = p_list.Where(p => p.Name == "EstimateTypeDesc").FirstOrDefault().Value;
var kanban = p_list.Where(p => p.Name == "Kanban").FirstOrDefault().Value;
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _list = _dapper.GetNoKanbanSettleDetail(version, beginTime, endTime);
//var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
//if (diffList != null)
//{
// foreach (var itm in diffList)
// {
// var _first = _list.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
// _first.InvoiceDiffQty = _first.SettleNumber + itm.DiffQty;//开票数量(结算数量+差异)
// _first.InvoiceMoney = _first.InvoiceDiffQty * _first.InvoicePrice;//开票总金额(开票数量*开票单价)
// _first.SumDiffMoney = (_first.SettleNumber * _first.Price) - _first.InvoiceMoney;//总金额差异(结算金额-开票金额)
// }
//}
if (!string.IsNullOrEmpty(materialGroup))
{
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_list = _list.Where(p => _groupList.Contains(p.SapMaterialGroup)).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))
{
var _groupList = customerPartCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0)
{
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).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();
// if (_groupList.Count() > 0)
// {
// _list = _list.Where(p => _groupList.Contains(p.Kanban)).ToList();
// }
//}
_outputService.Export<SettleKBWithOutCode>(id,_filename , _list);
return id.ToString();
}
}
}

11
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

@ -26,7 +26,7 @@ namespace SettleAccount.Job.Services.Report
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{
var year = p_list.Where(p => p.Name == "Year").FirstOrDefault().Value;
var purchaseOrderNo = p_list.Where(p => p.Name == "PurchaseOrderNo").FirstOrDefault().Value;
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SAPCode").FirstOrDefault().Value;
@ -40,9 +40,12 @@ namespace SettleAccount.Job.Services.Report
foreach (var itm in diffList)
{
var _first = _list.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
_first.InvoicedQty = _first.InvoicedQty + itm.DiffQty;//开票数量(结算数量+差异)
_first.InvoiceMoney =Math.Round(_first.InvoicedQty * _first.InvoicePrice,2);//开票总金额(开票数量*开票单价)
_first.SumDiffMoney = (_first.ReceiptQty * _first.Price) - _first.InvoiceMoney;//总金额差异(结算金额-开票金额)
if (_first != null)
{
_first.InvoicedQty = _first.InvoicedQty + itm.DiffQty;//开票数量(结算数量+差异)
_first.InvoiceMoney = Math.Round(_first.InvoicedQty * _first.InvoicePrice, 2);//开票总金额(开票数量*开票单价)
_first.SumDiffMoney = (_first.ReceiptQty * _first.Price) - _first.InvoiceMoney;//总金额差异(结算金额-开票金额)
}
}
}

7
src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -140,6 +140,13 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<UnsettledDetailReportService>();
}
if (key.Equals(typeof(SettleKBWithOutCodeExportService).FullName))
{
return implementationFactory.GetService<SettleKBWithOutCodeExportService>();
}
else
{

Loading…
Cancel
Save