diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMKanbanAppService.cs
new file mode 100644
index 00000000..64b2d4fa
--- /dev/null
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMKanbanAppService.cs
@@ -0,0 +1,387 @@
+using EFCore.BulkExtensions;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Caching;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Uow;
+using Win.Abp.Snowflakes;
+using Win.Sfs.BaseData.ImportExcelCommon;
+using Win.Sfs.SettleAccount.CommonManagers;
+using Win.Sfs.SettleAccount.Constant;
+using Win.Sfs.SettleAccount.Entities.TaskJobs;
+using Win.Sfs.SettleAccount.Entities.Wms;
+using Win.Sfs.SettleAccount.ExcelImporter;
+using Win.Sfs.SettleAccount.ExportReports;
+using Win.Sfs.SettleAccount.Repository;
+using WY.NewJit.Extends.PaiGe.WMS;
+
+namespace Win.Sfs.SettleAccount.Entities.WMS
+{
+ ///
+ /// wms出库-M平台
+ ///
+
+ [AllowAnonymous]
+ [Route("api/settleaccount/WMSHQMKanbanoutput")]
+ public class WmsHQMKanbanAppService :
+ SettleAccountApplicationBase
+ {
+
+ private readonly ISettleAccountBranchEfCoreRepository _wmsRepository;
+ private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository;
+ private readonly WMSEfCoreRepository _wmsefRespository;
+
+ private readonly WMSEfCoreRepository _wmstbRespository;
+ private readonly ISettleAccountBranchEfCoreRepository _job;
+ private readonly IExcelImportAppService _excelImportService;
+
+
+ private readonly TaskJobService _service;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public WmsHQMKanbanAppService(
+
+
+ IExcelImportAppService excelImportService,
+
+ ISettleAccountBranchEfCoreRepository wmsRepository,
+ ISettleAccountBranchEfCoreRepository job,
+ ISettleAccountBranchEfCoreRepository wmsVersionRepository,
+ WMSEfCoreRepository wmsefRespository,
+ WMSEfCoreRepository wmstbRespository,
+ IDistributedCache cache,
+ ISnowflakeIdGenerator snowflakeIdGenerator,
+ ICommonManager commonManager
+ ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
+ {
+ _job = job;
+ _wmstbRespository = wmstbRespository;
+ _wmsRepository = wmsRepository;
+ _wmsVersionRepository = wmsVersionRepository;
+ _wmsefRespository = wmsefRespository;
+ _excelImportService = excelImportService;
+ }
+
+ private async Task GetCountAsync(WmsKanbanOutPutDetialRequestDto input)
+ {
+ return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters);
+ }
+
+ private async Task GetCountAsync(WmsKanbanOutPutRequestDto input)
+ {
+ return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters);
+ }
+
+ ///
+ /// 准时化出库主表
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsHQMKanbanList")]
+ //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
+ virtual public async Task> GetListAsync(WmsKanbanOutPutRequestDto input)
+ {
+
+ var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
+ input.SkipCount, true);
+
+ var totalCount = await GetCountAsync(input);
+
+
+ return new PagedResultDto(totalCount, entities);
+ }
+
+ ///
+ /// 准时化出库明细
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsHQMKanbanDetailList")]
+ //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
+ virtual public async Task> GetListAsync(WmsKanbanOutPutDetialRequestDto input)
+ {
+ var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
+ input.SkipCount, true);
+
+ var totalCount = await GetCountAsync(input);
+ return new PagedResultDto(totalCount, entities);
+ }
+ ///
+ /// 任务明细标记已确认
+ ///
+ /// 上传的文件(前端已经限制只能上传一个附件)
+ ///
+ [HttpPost]
+ [Route("WmsHQMKanbanOutPutAudit")]
+ [DisableRequestSizeLimit]
+
+ public async Task WmsHQMKanbanAudit(List ids)
+ {
+ var _joblist = await _job.Where(p => ids.Contains(p.Id)).ToListAsync();
+ foreach (var itm in _joblist)
+ {
+ itm.FileName = "已确认";
+ await _job.UpdateAsync(itm);
+ }
+
+ return true;
+ }
+
+
+ ///
+ /// 选择任务,生成出库单,只包含已确认的单据
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsHQMKanbanOutPut")]
+ public async Task WmsHQMKanbanOutPut(WmsJitRequestDto input)
+ {
+ var _billNum = "HQKB" + DateTime.Now.ToString("yyyyMMddhhmmss");
+
+ var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList();
+ if (_joblist.Count() > 0)
+ {
+ var fileList = _joblist.Select(p => p.RealDownFileName).ToList();
+ List _lst = new List();
+ 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();
+ foreach (var itm in _list)
+ {
+ itm.SetData(GuidGenerator.Create(), string.Empty, !string.IsNullOrEmpty(itm.WmsBillNum) ? itm.WmsBillNum : string.Empty, input.Version, GuidGenerator.Create());
+ }
+ _lst.AddRange(_list.ToArray());
+ }
+
+ var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version).ToListAsync();
+
+ var error = from itm1 in outPutDetail
+ join itm2 in _lst on
+ new { itm1.MaterialCode, itm1.Kanban, itm1.PoLine }
+ equals
+ new { itm2.MaterialCode, itm2.Kanban, itm2.PoLine }
+ 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 _lst
+ 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 _wmslst)
+ {
+ itm.BillNum = _billNum;
+ }
+ await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
+ int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum);
+ if (_count == 0)
+ {
+ var _version = new WmsHQMKanbanOutPut(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; ;
+ }
+ ///
+ /// 出库界面功能,核准出库功能
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsHQMKanbanOutPut-Pass")]
+ [UnitOfWork(false)]
+ public async Task WmsHQMKanbanOutPutPass(WmsJitRequestDto input)
+ {
+ var sql = "DECLARE @return_value int\n" +
+ "EXEC @return_value = [dbo].[p_wms_output]\n" +
+ " @billnum = N'{0}',\n" +
+ " @type = 3,\n" +
+ " @date = N'{1}'\n" +
+ "SELECT 'Return Value' = @return_value";
+ await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
+ string.Format(sql, input.BillNum, input.AccountDate)
+ );
+
+
+
+ return true;
+
+ }
+ ///
+ ///出库界面功能, 撤销核准出库
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsHQMKanbanOutPut-Cancel")]
+ public async Task WmsHQMKanbanOutPutCancel(WmsJitRequestDto input)
+ {
+ if (input.Guids != null && input.Guids.Count() > 0)
+ {
+ List _ls = new List();
+ 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 = 3,\n" +
+ " @accountdate = N'{2}'\n" +
+ "SELECT 'Return Value' = @return_value";
+
+ sql = string.Format(sql, str, input.BillNum, input.AccountDate);
+
+ await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
+ sql
+ );
+
+ }
+
+ return true;
+ }
+ [HttpPost]
+ [Route("ExcelImport")]
+ [DisableRequestSizeLimit]
+ //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
+ public async Task ExcelImport([FromForm] IFormFileCollection files, string version)
+ {
+ var _billNum = "HQKB" + DateTime.Now.ToString("yyyyMMddhhmmss");
+ ExportImporter _exportImporter = new ExportImporter();
+ var result = await _exportImporter.ExtendExcelImport(files, _excelImportService);
+ List _lst = new List();
+ var _lsCopy = new List();
+ foreach (var itm in result)
+ {
+ WmsHQMKanbanOutPutDetial _detail = new WmsHQMKanbanOutPutDetial(
+ GuidGenerator.Create(),
+ itm.WmsBillNum,
+ itm.Kanban,
+ itm.MaterialCode,
+ itm.MaterialDesc,
+ itm.MaterialGroup,
+ string.Empty,
+ string.Empty,
+ 0,
+ string.Empty,
+ string.Empty,
+ version,
+ itm.ParentMaterialCode,
+ itm.BillNum,
+ GuidGenerator.Create()
+ , string.Empty
+ , itm.Qty,
+ itm.PoLine
+ );
+ _lsCopy.Add(_detail);
+ }
+ _lst.AddRange(_lsCopy.ToArray());
+
+
+ var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync();
+
+
+ var error = from itm1 in outPutDetail
+ join itm2 in _lst on
+ new { itm1.MaterialCode, itm1.Kanban, itm1.PoLine }
+ equals
+ new { itm2.MaterialCode, itm2.Kanban, itm2.PoLine }
+ 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();
+ 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 _lst
+ join itm2 in outPutDetail on
+ new { itm1.MaterialCode, itm1.Kanban, itm1.PoLine }
+ equals
+ new { itm2.MaterialCode, itm2.Kanban, itm2.PoLine } into temp1
+ from tm1 in temp1.DefaultIfEmpty()
+ where tm1 == null
+ select itm1;
+ var _wmslst = query.ToList();
+ foreach (var itm in _wmslst)
+ {
+ itm.BillNum = _billNum;
+ }
+ await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
+ int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum);
+ if (_count == 0)
+ {
+ var _version = new WmsHQMKanbanOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email);
+ await _wmsVersionRepository.InsertAsync(_version, true);
+ }
+ return _billNum;
+ }
+
+
+ }
+}
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMSharePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMSharePartAppService.cs
new file mode 100644
index 00000000..94cfd1d7
--- /dev/null
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQMSharePartAppService.cs
@@ -0,0 +1,425 @@
+using EFCore.BulkExtensions;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Caching;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Uow;
+using Win.Abp.Snowflakes;
+using Win.Sfs.BaseData.ImportExcelCommon;
+using Win.Sfs.SettleAccount.CommonManagers;
+using Win.Sfs.SettleAccount.Constant;
+using Win.Sfs.SettleAccount.Entities.TaskJobs;
+using Win.Sfs.SettleAccount.Entities.Wms;
+using Win.Sfs.SettleAccount.ExcelImporter;
+using Win.Sfs.SettleAccount.ExportReports;
+using Win.Sfs.SettleAccount.Repository;
+using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
+using WY.NewJit.Extends.PaiGe.WMS;
+
+namespace Win.Sfs.SettleAccount.Entities.WMS
+{
+ ///
+ /// wms出库
+ ///
+
+ [AllowAnonymous]
+ [Route("api/settleaccount/WmsHQMSharePartoutput")]
+ public class WmsHQMSharePartAppService :
+ SettleAccountApplicationBase
+ {
+ private readonly ISettleAccountBranchEfCoreRepository _wmsRepository;
+ private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository;
+ private readonly WMSEfCoreRepository _wmsefRespository;
+ private readonly WmsDapperRepository _wmsDapper;
+ private readonly WMSEfCoreRepository _wmstbRespository;
+ private readonly ISettleAccountBranchEfCoreRepository _job;
+ private readonly IExcelImportAppService _excelImportService;
+
+ private readonly TaskJobService _service;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public WmsHQMSharePartAppService(
+
+ ISettleAccountBranchEfCoreRepository wmsRepository,
+ ISettleAccountBranchEfCoreRepository job,
+ ISettleAccountBranchEfCoreRepository wmsVersionRepository,
+ WMSEfCoreRepository wmsefRespository,
+ WMSEfCoreRepository wmstbRespository,
+ IExcelImportAppService excelImportService,
+ IDistributedCache cache,
+ ISnowflakeIdGenerator snowflakeIdGenerator,
+ ICommonManager commonManager,
+ WmsDapperRepository wmsDapper
+ ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
+ {
+ _excelImportService = excelImportService;
+ _job = job;
+ _wmstbRespository = wmstbRespository;
+ _wmsRepository = wmsRepository;
+ _wmsVersionRepository = wmsVersionRepository;
+ _wmsefRespository = wmsefRespository;
+ _wmsDapper = wmsDapper;
+ }
+
+ private async Task GetCountAsync(WmsSharePartOutPutDetialRequestDto input)
+ {
+ return await _wmsRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters);
+ }
+
+ private async Task GetCountAsync(WmsSharePartOutPutRequestDto input)
+ {
+ return await _wmsVersionRepository.GetCountByFilterAsync(GuidGenerator.Create(), input.Filters);
+ }
+
+ ///
+ /// 准时化出库主表
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsSharePartList")]
+ //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
+ virtual public async Task> GetListAsync(WmsSharePartOutPutRequestDto input)
+ {
+
+ var entities = await _wmsVersionRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount,
+ input.SkipCount, true);
+
+ var totalCount = await GetCountAsync(input);
+
+
+ return new PagedResultDto(totalCount, entities);
+ }
+
+ ///
+ /// 准时化出库明细
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsSharePartDetailList")]
+ //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
+ virtual public async Task> GetListAsync(WmsSharePartOutPutDetialRequestDto input)
+ {
+ 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.MaterialCode equals itm1.SapCode
+ into temp1
+ from tm1 in temp1.DefaultIfEmpty()
+ select new WmsHQMSharePartOutPutDetial(
+ itm.Id,
+ itm.WmsBillNum,
+ itm.OrderBillNum,
+ itm.MaterialCode,
+ itm.MaterialDesc,
+ itm.MaterialGroup,
+ itm.OutPut,
+ itm.InPut,
+ itm.State,
+ itm.Extend1,
+ itm.Extend2,
+ itm.Version,
+ itm.ParentMaterialCode,
+ itm.BillNum,
+ itm.TaskId,
+ itm.Remark,
+ itm.Qty,
+ tm1.Qty
+ );
+
+
+
+
+ return new PagedResultDto(totalCount, query.ToList());
+ }
+ ///
+ /// 任务明细标记已确认
+ ///
+ /// 上传的文件(前端已经限制只能上传一个附件)
+ ///
+ [HttpPost]
+ [Route("WmsSharePartOutPutAudit")]
+ [DisableRequestSizeLimit]
+
+ public async Task WmsSharePartAudit(List ids)
+ {
+ var _joblist = await _job.Where(p => ids.Contains(p.Id)).ToListAsync();
+ 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;
+ }
+ return false;
+ }
+ ///
+ /// 选择任务,生成出库单,只包含已确认的单据
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsSharePartOutPut")]
+ public async Task WmsSharePartOutPut(WmsJitRequestDto input)
+ {
+ var _billNum = "BHQ" + DateTime.Now.ToString("yyyyMMddhhmmss");
+ var _joblist = _job.Where(p => input.Guids.Contains(p.Id) && p.FileName == "已确认").ToList();
+ if (_joblist.Count() > 0)
+ {
+ var fileList = _joblist.Select(p => p.RealDownFileName).ToList();
+ List _lst = new List();
+ 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();
+ if (_list.Count() > 0)
+ {
+ var _lsAry = _list.Select(p => new
+ WmsHQMSharePartOutPutDetial(
+ GuidGenerator.Create(),
+ "",
+ string.Empty,
+ p.结算物料号,
+ p.物料描述,
+ p.物料组,
+ string.Empty,
+ string.Empty,
+ 0,
+ string.Empty,
+ string.Empty,
+ input.Version,
+ p.Sap编码,
+ _billNum,
+ GuidGenerator.Create(),
+ string.Empty,
+ p.结算数量,
+ 0
+ ));
+ _lst.AddRange(_lsAry.ToArray());
+ }
+ }
+ 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 WmsHQMSharePartOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email);
+
+ await _wmsVersionRepository.InsertAsync(_version, true);
+
+ }
+
+ foreach (var job in _joblist)
+ {
+ job.FileName = _billNum;
+ await _job.UpdateAsync(job);
+ }
+ }
+ //return _billNum;
+ //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;
+ }
+ ///
+ /// 出库界面功能,核准出库功能
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsSharePartOutPut-Pass")]
+ [UnitOfWork(false)]
+ public async Task WmsSharePartOutPutPass(WmsJitRequestDto input)
+ {
+ if (input.Guids != null)
+ {
+ List _ls = new List();
+ 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();
+ }
+ if (_ls.Count() > 0)
+ {
+ var sql = "DECLARE @return_value int\n" +
+ "EXEC @return_value = [dbo].[p_wms_output]\n" +
+ " @billnum = N'{0}',\n" +
+ " @type = 4\n" +
+ "SELECT 'Return Value' = @return_value";
+ await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
+ string.Format(sql, input.BillNum));
+
+ }
+ }
+ return true;
+ }
+ ///
+ ///出库界面功能, 撤销核准出库
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("WmsSharePartOutPut-Cancel")]
+ public async Task WmsSharePartOutPutCancel(WmsJitRequestDto input)
+ {
+ if (input.Guids != null && input.Guids.Count() > 0)
+ {
+ List _ls = new List();
+ 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 = 4,\n" +
+ " @accountdate = N'{2}'\n" +
+ "SELECT 'Return Value' = @return_value";
+
+ sql = string.Format(sql, str, input.BillNum, input.AccountDate);
+
+ await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
+ sql
+ );
+ }
+ return true;
+ }
+ [HttpPost]
+ [Route("ExcelImport")]
+ [DisableRequestSizeLimit]
+ //[Authorize(SettleAccountPermissions.SettleAccounts.Default)]
+ public async Task ExcelImport([FromForm] IFormFileCollection files, string version)
+ {
+ var _billNum = "BHQ" + DateTime.Now.ToString("yyyyMMddhhmmss");
+ ExportImporter _exportImporter = new ExportImporter();
+ var result = await _exportImporter.ExtendExcelImport(files, _excelImportService);
+ List _lst = new List();
+
+ var _lsCopy = new List();
+ foreach (var itm in result)
+ {
+ WmsHQMSharePartOutPutDetial _detail = new WmsHQMSharePartOutPutDetial(
+ GuidGenerator.Create(),
+ itm.WmsBillNum,
+ itm.OrderBillNum,
+ itm.MaterialCode,
+ itm.MaterialDesc,
+ itm.MaterialGroup,
+ string.Empty,
+ string.Empty,
+ 0,
+ string.Empty,
+ string.Empty,
+ version,
+ itm.ParentMaterialCode,
+ itm.BillNum,
+ GuidGenerator.Create()
+ , string.Empty
+ , itm.Qty
+ , 0
+ );
+ _lsCopy.Add(_detail);
+ }
+ _lst.AddRange(_lsCopy.ToArray());
+
+
+ var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync();
+
+ var error = from itm1 in outPutDetail
+ join itm2 in _lst on
+ new { itm1.MaterialCode }
+ equals
+ new { itm2.MaterialCode }
+ 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();
+ 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 _lst
+ join itm2 in outPutDetail on
+ new { itm1.MaterialCode }
+ equals
+ new { itm2.MaterialCode } into temp1
+ from tm1 in temp1.DefaultIfEmpty()
+ where tm1 == null
+ select itm1;
+ var _wmslst = query.ToList();
+ foreach (var itm in _wmslst)
+ {
+ itm.BillNum = _billNum;
+ }
+ await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 });
+ int _count = _wmsVersionRepository.Count(p => p.Version == version && p.BillNum == _billNum);
+ if (_count == 0)
+ {
+ var _version = new WmsHQMSharePartOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email);
+ await _wmsVersionRepository.InsertAsync(_version, true);
+ }
+ return _billNum;
+ }
+ }
+}
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
index d8692cef..0b631c4a 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
@@ -527,6 +527,35 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
#region 红旗、一汽轿车的输出报表
+ ///
+ /// 一汽轿车
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("HQCarSettledDetailDiffExportService")]
+ [DisableRequestSizeLimit]
+ public async Task HQCarSettledDetailDiffExportServiceMake(
+ HQKanbanRequestDto input
+ )
+ {
+ List customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
+
+ customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin });
+ customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
+ customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo });
+ customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc });
+ customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
+ customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
+ var _taskid = await _service.ExportEnqueueAsync("一汽轿车核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQCarSettledDetailDiffExportService), customConditionList, (rs) =>
+ {
+ });
+ return _taskid;
+ }
+
///
///红旗H平台核对明细
///
@@ -557,6 +586,35 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
return _taskid;
}
+ ///
+ /// 红旗H平台备件结算出库
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("HQHSharePartSettledDetailDiffExportService")]
+ [DisableRequestSizeLimit]
+ public async Task HQHSharePartSettledDetailDiffExportServiceMake(
+ HQKanbanRequestDto input
+ )
+ {
+ List customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
+
+ customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin });
+ customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
+ customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo });
+ customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc });
+ customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
+ customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
+ var _taskid = await _service.ExportEnqueueAsync("H平台备件核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQHSharePartSettledDetailDiffExportService), customConditionList, (rs) =>
+ {
+ });
+ return _taskid;
+ }
+
///
///红旗F平台核对明细
///
@@ -609,12 +667,75 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
- var _taskid = await _service.ExportEnqueueAsync("F平台核备件核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQFSharePartSettledDetailDiffExportService), customConditionList, (rs) =>
+ var _taskid = await _service.ExportEnqueueAsync("F平台备件核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQFSharePartSettledDetailDiffExportService), customConditionList, (rs) =>
{
});
return _taskid;
}
+ ///
+ ///红旗M平台核对明细
+ ///
+ /// 上传的文件(前端已经限制只能上传一个附件)
+ ///
+ [HttpPost]
+ [Route("HQMSettledDetailDiffExportService")]
+ [DisableRequestSizeLimit]
+ public async Task HQMSettledDetailDiffExportServiceMake(
+ HQKanbanRequestDto input
+ )
+ {
+
+ List customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
+ customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin });
+ customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
+ customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo });
+ customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc });
+ customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
+ customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
+ var _taskid = await _service.ExportEnqueueAsync("M平台核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQMSettledDetailDiffExportService), customConditionList, (rs) =>
+ {
+ });
+ return _taskid;
+ }
+
+ ///
+ /// 红旗M平台备件结算出库
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("HQMSharePartSettledDetailDiffExportService")]
+ [DisableRequestSizeLimit]
+ public async Task HQMSharePartSettledDetailDiffExportServiceMake(
+ HQKanbanRequestDto input
+ )
+ {
+ List customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "Version", Value = input.Version });
+
+ customConditionList.Add(new CustomCondition() { Name = "BeginTime", Value = input.Begin });
+ customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = input.End });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialCode", Value = input.MaterialCode });
+ customConditionList.Add(new CustomCondition() { Name = "AcceptNo", Value = input.AcceptNo });
+ customConditionList.Add(new CustomCondition() { Name = "WarehouseDesc", Value = input.WarehouseDesc });
+ customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
+ customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
+ customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
+ var _taskid = await _service.ExportEnqueueAsync("M平台备件核对明细", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQMSharePartSettledDetailDiffExportService), customConditionList, (rs) =>
+ {
+ });
+ return _taskid;
+ }
+
+
+
+
+
///
/// H平台未结明细
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
index 4dadc755..a2283ac8 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
+++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
@@ -1732,7 +1732,7 @@
wms出库
-
+
@@ -1852,7 +1852,7 @@
wms出库
-
+
@@ -2661,6 +2661,126 @@
+
+
+ wms出库-M平台
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 准时化出库主表
+
+
+
+
+
+
+ 准时化出库明细
+
+
+
+
+
+
+ 任务明细标记已确认
+
+ 上传的文件(前端已经限制只能上传一个附件)
+
+
+
+
+ 选择任务,生成出库单,只包含已确认的单据
+
+
+
+
+
+
+
+ 出库界面功能,核准出库功能
+
+
+
+
+
+
+
+ 出库界面功能, 撤销核准出库
+
+
+
+
+
+
+
+ wms出库
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 准时化出库主表
+
+
+
+
+
+
+ 准时化出库明细
+
+
+
+
+
+
+ 任务明细标记已确认
+
+ 上传的文件(前端已经限制只能上传一个附件)
+
+
+
+
+ 选择任务,生成出库单,只包含已确认的单据
+
+
+
+
+
+
+
+ 出库界面功能,核准出库功能
+
+
+
+
+
+
+
+ 出库界面功能, 撤销核准出库
+
+
+
+
+
区域相关应用服务
@@ -3270,6 +3390,13 @@
上传的文件(前端已经限制只能上传一个附件)
+
+
+ 一汽轿车
+
+
+
+
红旗H平台核对明细
@@ -3277,6 +3404,13 @@
上传的文件(前端已经限制只能上传一个附件)
+
+
+ 红旗H平台备件结算出库
+
+
+
+
红旗F平台核对明细
@@ -3291,23 +3425,37 @@
+
+
+ 红旗M平台核对明细
+
+ 上传的文件(前端已经限制只能上传一个附件)
+
+
+
+
+ 红旗M平台备件结算出库
+
+
+
+
- H平台发运核对输出
+ H平台未结明细
- F平台发运核对输出
+ F平台未结明细
- M平台发运核对输出
+ M平台未明细
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
index ab738021..bb2f1557 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
@@ -324,6 +324,235 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
}
+ #region 红旗M平台出库
+
+ ///
+ /// 看板M平台明细
+ ///
+ public class WmsHQMKanbanOutPutDetial : FullAuditedAggregateRootBase
+ {
+ public WmsHQMKanbanOutPutDetial()
+ {
+ }
+
+ public WmsHQMKanbanOutPutDetial(Guid id, string wmsBillNum, string kanban, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, string poline)
+ {
+ Id = id;
+ WmsBillNum = wmsBillNum;
+ Kanban = kanban;
+ MaterialCode = materialCode;
+ MaterialDesc = materialDesc;
+ MaterialGroup = materialGroup;
+ OutPut = outPut;
+ InPut = inPut;
+ State = state;
+ Extend1 = extend1;
+ Extend2 = extend2;
+ Version = extend3;
+ ParentMaterialCode = parentMaterialCode;
+ BillNum = billNum;
+ TaskId = taskId;
+ Remark = remark;
+ Qty = qty;
+ PoLine = poline;
+ }
+ public void SetData(Guid id, string remark, string wmsbillnum, string version, Guid taskId)
+ {
+ Id = id;
+ Remark = remark;
+ WmsBillNum = wmsbillnum;
+ Version = version;
+ TaskId = taskId;
+ }
+ // 交货单号 实际发货日期 KENN号 底盘号 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 定价 金额 结算平台未结数量 大众R3未结数量 差异金额 差异数量 漏结标识 漏结期间 说明
+ [ImporterHeader(Name = "行号")]
+ public string PoLine { set; get; }
+
+ [ImporterHeader(Name = "订货看板编号")]
+ //KENN号
+ public string Kanban { set; get; }
+
+ [ImporterHeader(Name = "组件组物料", IsIgnore = true)]
+ public string ParentMaterialCode { set; get; }
+ [ImporterHeader(Name = "交货单号")]
+ public string WmsBillNum { set; get; }
+ //[ImporterHeader(Name = "订货看板编号")]
+ ////KENN号
+ //public string OrderBillNum { set; get; }
+ [ImporterHeader(Name = "Sap编码")]
+ //物料号
+ public string MaterialCode { set; get; }
+ [ImporterHeader(Name = "零件中文名称")]
+ //物料描述
+ public string MaterialDesc { set; get; }
+ [ImporterHeader(Name = "物料组(车型)")]
+ //物料组(车型)
+ public string MaterialGroup { set; get; }
+ [ImporterHeader(Name = "出库库位", IsIgnore = true)]
+ //出库库位
+ public string OutPut { set; get; }
+ [ImporterHeader(Name = "入库库位", IsIgnore = true)]
+ //入库库位
+ public string InPut { set; get; }
+ [ImporterHeader(Name = "状态", IsIgnore = true)]
+ public int State { get; set; }
+ [ImporterHeader(Name = "发货零件号")]
+ ///
+ /// 扩展字段1
+ ///
+ public string Extend1 { set; get; }
+ ///
+ /// 扩展字段2
+ ///
+ [ImporterHeader(Name = "收货仓库")]
+ public string Extend2 { set; get; }
+ ///
+ /// 扩展字段3
+ ///
+ [ImporterHeader(Name = "版本号", IsIgnore = true)]
+ public string Version { set; get; }
+ [ImporterHeader(Name = "结算数量")]
+ public decimal Qty { set; get; }
+ [ImporterHeader(Name = "数量", IsIgnore = true)]
+ public string BillNum { set; get; }
+ [ImporterHeader(Name = "任务描述", IsIgnore = true)]
+ public Guid TaskId { set; get; }
+
+ }
+
+ public class WmsHQMKanbanOutPut : FullAuditedAggregateRootBase
+ {
+ public WmsHQMKanbanOutPut()
+ {
+ }
+
+ public WmsHQMKanbanOutPut(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; }
+ }
+
+ ///
+ /// 备件出库
+ ///
+ public class WmsHQMSharePartOutPut : FullAuditedAggregateRootBase
+ {
+ public WmsHQMSharePartOutPut()
+ {
+ }
+ public WmsHQMSharePartOutPut(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; }
+
+ }
+
+
+ ///
+ /// 备件出库明细
+ ///
+ public class WmsHQMSharePartOutPutDetial : FullAuditedAggregateRootBase
+ {
+
+
+
+
+ public WmsHQMSharePartOutPutDetial()
+ {
+ }
+ public WmsHQMSharePartOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty)
+ {
+ Id = id;
+ WmsBillNum = wmsBillNum;
+ OrderBillNum = orderBillNum;
+ MaterialCode = materialCode;
+ MaterialDesc = materialDesc;
+ MaterialGroup = materialGroup;
+ OutPut = outPut;
+ InPut = inPut;
+ State = state;
+ Extend1 = extend1;
+ Extend2 = extend2;
+ Version = extend3;
+ ParentMaterialCode = parentMaterialCode;
+ BillNum = billNum;
+ TaskId = taskId;
+ Remark = remark;
+ Qty = qty;
+ StockQty = stockQty;
+ }
+ public void SetId(Guid id)
+ {
+ Id = id;
+ }
+ //交货单号
+
+ [ImporterHeader(Name = "寄销库数量", IsIgnore = true)]
+ public decimal StockQty { set; get; }
+
+ [ImporterHeader(Name = "组件组物料", IsIgnore = true)]
+ public string ParentMaterialCode { set; get; }
+ [ImporterHeader(Name = "交货单号", IsIgnore = true)]
+ public string WmsBillNum { set; get; }
+ [ImporterHeader(Name = "看板号", IsIgnore = true)]
+ //KENN号
+ public string OrderBillNum { set; get; }
+ [ImporterHeader(Name = "Sap编码")]
+ //物料号
+ public string MaterialCode { set; get; }
+ [ImporterHeader(Name = "物料描述")]
+ //物料描述
+ public string MaterialDesc { set; get; }
+ [ImporterHeader(Name = "物料组(车型)")]
+ //物料组(车型)
+ public string MaterialGroup { set; get; }
+ [ImporterHeader(Name = "出库库位", IsIgnore = true)]
+ //出库库位
+ public string OutPut { set; get; }
+ [ImporterHeader(Name = "入库库位", IsIgnore = true)]
+ //入库库位
+ public string InPut { set; get; }
+ [ImporterHeader(Name = "状态", IsIgnore = true)]
+ public int State { get; set; }
+ [ImporterHeader(Name = "结算物料号")]
+ ///
+ /// 扩展字段1
+ ///
+ public string Extend1 { set; get; }
+ ///
+ /// 扩展字段2
+ ///
+ [ImporterHeader(Name = "收货仓库")]
+ public string Extend2 { set; get; }
+ ///
+ /// 扩展字段3
+ ///
+ [ImporterHeader(Name = "版本号", IsIgnore = true)]
+ public string Version { set; get; }
+ [ImporterHeader(Name = "结算数量")]
+ public decimal Qty { set; get; }
+ [ImporterHeader(Name = "单据号", IsIgnore = true)]
+ public string BillNum { set; get; }
+ [ImporterHeader(Name = "任务ID", IsIgnore = true)]
+ public Guid TaskId { set; get; }
+ }
+
+
+ #endregion
+
#region 红旗看板
public class WmsHQFKanbanOutPut : FullAuditedAggregateRootBase
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
new file mode 100644
index 00000000..c9256a02
--- /dev/null
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
@@ -0,0 +1,155 @@
+using Dapper;
+using Magicodes.ExporterAndImporter.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Repositories.Dapper;
+using Volo.Abp.EntityFrameworkCore;
+
+namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
+{
+ ///
+ /// 红旗M平台输出报表
+ ///
+ public class HQCarSettledDetailDapperRepository : DapperRepository, ITransientDependency
+ {
+ public HQCarSettledDetailDapperRepository(IDbContextProvider dbContextProvider)
+ : base(dbContextProvider)
+ {
+ }
+
+ public virtual List GetDiffQtyList(string version)
+ {
+ List _list = new List();
+ var str =
+ "SELECT\n" +
+ " temp1.MaterialCode 客户物料号,\n" +
+ " temp1.HQMKanBan 看板号 ,\n" +
+ " temp1.SettleQty 结算数量,\n" +
+ " temp2.Qty 发货数量,\n" +
+ " ( temp1.SettleQty - temp2.Qty ) 差异数量 \n" +
+ "FROM\n" +
+ " ( SELECT SUM ( Qty ) SettleQty, HQMKanBan, MaterialCode FROM Set_HQ_M_Platform WHERE version = '{0}' GROUP BY HQMKanBan, MaterialCode ) temp1\n" +
+ " LEFT JOIN ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_M_Kanban GROUP BY Kanban, MaterialCode ) temp2 ON temp1.HQMKanBan = temp2.Kanban \n" +
+ " AND temp1.MaterialCode = temp2.MaterialCode \n" +
+ "WHERE\n" +
+ " temp1.SettleQty!= temp2.Qty";
+ str = string.Format(str, version);
+
+ var _query = DbConnection.Query(str, null, null, true, 1200, null);
+ _list = _query.ToList();
+
+
+ return _list;
+
+ }
+ public virtual List GetHQCarSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
+ {
+
+ List _list = new List();
+
+ string condition = " ";
+
+
+
+ if (!string.IsNullOrEmpty(begin))
+ {
+ condition += string.Format(" and a.LastModificationTime>='{0}' ", begin);
+ }
+ if (!string.IsNullOrEmpty(end))
+ {
+ condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
+ }
+
+ string str =
+ "SELECT\n" +
+ " temp1.*,\n" +
+ " isnull( temp2.Price, 0 ) 销售单价,\n" +
+ " ( isnull( temp1.结算单价, 0 ) - isnull( temp2.Price, 0 ) ) 价格差异 \n" +
+ "FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " A.Price 结算单价,\n" +
+ " A.Qty 结算数量,\n" +
+ " A.MaterialCode 结算物料号,\n" +
+ " A.StorageLocation 收货仓库,\n" +
+ " A.StorageLocationDesc 收货仓库描述,\n" +
+ " C.EstimateTypeDesc 物料组,\n" +
+ " C.MaterialCode Sap编码,\n" +
+ " C.MaterialDesc 物料描述,\n" +
+ " 0 寄销库数量 \n" +
+ " FROM\n" +
+ " (\n" +
+ " SELECT\n" +
+ " Price,\n" +
+ " SUM ( Qty ) Qty,\n" +
+ " MaterialCode,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc \n" +
+ " FROM\n" +
+ " Set_BT_Car_Platform \n" +
+ " WHERE\n" +
+ " version = '{0}' \n" +
+ " {1} \n" +
+ " GROUP BY\n" +
+ " MaterialCode,\n" +
+ " StorageLocation,\n" +
+ " StorageLocationDesc,\n" +
+ " price \n" +
+ " ) A\n" +
+ " LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
+ " ) temp1\n" +
+ " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode";
+ var _sql = string.Format(str, version, condition);
+
+ var _query = DbConnection.Query(_sql, null, null, true, 1200, null);
+ _list = _query.ToList();
+ return _list;
+
+ }
+
+
+
+
+ }
+
+ public class HQCarSettledDetailDiff
+ {
+ [ExporterHeader(DisplayName = "收货仓库")]
+ public string 收货仓库 { set; get; }
+ [ExporterHeader(DisplayName = "收货仓库描述")]
+ public string 收货仓库描述 { set; get; }
+ [ExporterHeader(DisplayName = "结算物料号")]
+ public string 结算物料号 { set; get; }
+
+ [ExporterHeader(DisplayName = "结算物料描述")]
+ public string 物料描述 { set; get; }
+
+ [ExporterHeader(DisplayName = "结算数量")]
+ public decimal 结算数量 { set; get; }
+ [ExporterHeader(DisplayName = "结算单价")]
+ public decimal 结算单价 { set; get; }
+ [ExporterHeader(DisplayName = "结算金额")]
+ public decimal 结算金额 { set; get; }
+ [ExporterHeader(DisplayName = "Sap编码")]
+ public string Sap编码 { set; get; }
+ [ExporterHeader(DisplayName = "物料组(车型)")]
+ public string 物料组 { set; get; }
+
+ [ExporterHeader(DisplayName = "寄销库数量")]
+ public decimal 寄销库数量 { set; get; }
+
+
+ }
+ public class HQCarSettleQtyDiff
+ {
+ public string 客户物料号 { set; get; }
+ public decimal 结算数量 { set; get; }
+ public decimal 发货数量 { set; get; }
+ public decimal 差异数量 { set; get; }
+ public string 看板号 { set; get; }
+ }
+}
diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs
index ac559d34..de5156ca 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQMSettledDetailDapperRepository.cs
@@ -112,7 +112,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" ( a.HQMKanBan <> 'BJ' ) \n" +
- " AND a.Version= '{0}' { 1 } \n" +
+ " AND a.Version= '{0}' {1} \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode";
var _sql = string.Format(str, version, condition);
@@ -197,7 +197,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" Set_HQ_M_Platform \n" +
" WHERE\n" +
" version = '{0}' \n" +
- " AND HQHKanBan = 'BJ' { 1 } \n" +
+ " AND HQHKanBan = 'BJ' {1} \n" +
" GROUP BY\n" +
" MaterialCode,\n" +
" StorageLocation,\n" +
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs
new file mode 100644
index 00000000..ad48c67d
--- /dev/null
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs
@@ -0,0 +1,103 @@
+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 HQCarSettledDetailDiffExportService : ITransientDependency, IExportJob
+ {
+
+ private readonly HQCarSettledDetailDapperRepository _dapperRepository;
+ private readonly ErpPartDapperRepository _erpdapperRepository;
+
+ private readonly OutputService _outputService;
+ private readonly InputService _inputService;
+
+ public HQCarSettledDetailDiffExportService(
+
+ ErpPartDapperRepository erpdapperRepository,
+ HQCarSettledDetailDapperRepository dapperRepository,
+ OutputService outputService,
+ InputService inputService
+ )
+ {
+ _inputService = inputService;
+ _outputService = outputService;
+ _erpdapperRepository = erpdapperRepository;
+
+ _dapperRepository = dapperRepository;
+ }
+
+ public string ExportFile(Guid id, List exportName, List p_list)
+ {
+ var _filename = exportName.FirstOrDefault();
+ var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
+ var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value;
+ var kanban = p_list.Where(p => p.Name == "Kanban").FirstOrDefault().Value;
+ var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value;
+ var end = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
+ var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value;
+ var acceptNo = p_list.Where(p => p.Name == "AcceptNo").FirstOrDefault().Value;
+ var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
+ var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
+ var _ls = _dapperRepository.GetHQCarSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
+
+ if (!string.IsNullOrEmpty(kanban))
+ {
+ var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.结算物料号)).ToList();
+ }
+ }
+
+
+ if (!string.IsNullOrEmpty(warehouseDesc))
+ {
+ var _groupList = warehouseDesc.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.收货仓库描述)).ToList();
+ }
+ }
+
+ if (!string.IsNullOrEmpty(materialGroup))
+ {
+ var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.物料组)).ToList();
+ }
+ }
+ if (!string.IsNullOrEmpty(materialCode))
+ {
+ var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.结算物料号)).ToList();
+ }
+ }
+ if (!string.IsNullOrEmpty(sapCode))
+ {
+ var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
+ if (_groupList.Count() > 0)
+ {
+ _ls = _ls.Where(p => _groupList.Contains(p.Sap编码)).ToList();
+ }
+ }
+ _outputService.Export(id, _filename, _ls);
+ return id.ToString();
+ }
+
+ }
+}
+
diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQMSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQMSettledDetailDiffExportService.cs
index a3f102ca..e2267048 100644
--- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQMSettledDetailDiffExportService.cs
+++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQMSettledDetailDiffExportService.cs
@@ -11,7 +11,7 @@ using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report
{
///
- /// 红旗H平台
+ /// 红旗M平台
///
public class HQMSettledDetailDiffExportService : ITransientDependency, IExportJob
{