From 68e4d0da647a8c89d6d23537646ca7bbdf95d77f Mon Sep 17 00:00:00 2001 From: 44673626 <44673626@qq.com> Date: Sat, 19 Feb 2022 15:13:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=80=E6=9C=89=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E7=9A=84=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E5=B7=B2=E7=BB=8F=E5=AE=8C=E6=88=90=EF=BC=9B=20?= =?UTF-8?q?=E5=A4=87=E4=BB=B6=E7=9B=B8=E5=85=B3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/TaskListDto.cs | 526 +++++++++++++++ .../Entities/HQ_H/HQ_H_PlatformAppService.cs | 111 ++- .../Entities/WMS/WMSJitAppService.cs | 6 +- .../Entities/WMS/WMSKanbanAppService.cs | 6 +- .../Entities/WMS/WMSKanbanExtendAppService.cs | 4 +- .../Entities/WMS/WMSSharePart90AppService.cs | 6 +- .../Entities/WMS/WMSSharePartAppService.cs | 637 ++++-------------- .../Entities/WMS/WmsHQCarAppService.cs | 4 +- .../Entities/WMS/WmsHQKBOutputAppService.cs | 6 +- .../SettleAccount.Application.xml | 42 +- ...ttleAccountApplicationAutoMapperProfile.cs | 59 ++ .../Entities/WMS/TaskList.cs | 175 ++--- .../HQHSettledDetailDapperRepository.cs | 113 ++-- .../SettleSparePartDapperReportRepository.cs | 24 +- .../Report/SettleSparePartExportService.cs | 25 +- 15 files changed, 996 insertions(+), 748 deletions(-) create mode 100644 src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs new file mode 100644 index 00000000..1d2991de --- /dev/null +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/TaskListDto.cs @@ -0,0 +1,526 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Win.Sfs.SettleAccount.Entities +{ + + /// + /// 大众准时化出库单 + /// + public class WmsJitOutPutDetialDto + { + + [ExporterHeader(DisplayName = "出库库位")] + [ImporterHeader(Name = "出库库位", IsIgnore = true)] + //出库库位 + public string OutPut { set; get; } + [ImporterHeader(Name = "入库库位", IsIgnore = true)] + [ExporterHeader(DisplayName = "入库库位")] + //入库库位 + public string InPut { set; get; } + [ImporterHeader(Name = "状态")] + [ExporterHeader(DisplayName = "状态")] + public int State { get; set; } + + [ImporterHeader(Name = "开票单价")] + [ExporterHeader(DisplayName = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + [ExporterHeader(DisplayName = "开票金额")] + public decimal Amt { set; get; } + + /// + /// 扩展字段3 + /// + [ExporterHeader(DisplayName = "版本号")] + [ImporterHeader(Name = "版本号", IsIgnore = true)] + public string Version { set; get; } + + [ExporterHeader(DisplayName = "单号")] + [ImporterHeader(Name = "单号", IsIgnore = true)] + public string BillNum { set; get; } + [ExporterHeader(DisplayName = "任务号", IsIgnore = true)] + [ImporterHeader(Name = "任务号", IsIgnore = true)] + public Guid TaskId { set; get; } + + [ExporterHeader(DisplayName = "交货单号")] + [ImporterHeader(Name = "交货单号", AutoTrim = true)] + public string WmsBillNum { set; get; } + [ExporterHeader(DisplayName = "KENN号")] + [ImporterHeader(Name = "KENN号")] + //KENN号 + public string KennCode { set; get; } + [ExporterHeader(DisplayName = "底盘号")] + [ImporterHeader(Name = "底盘号", AutoTrim = true)] + //底盘号 + public string ChassisNumber { set; get; } + [ExporterHeader(DisplayName = "物料号")] + [ImporterHeader(Name = "物料号", AutoTrim = true)] + //物料号 + public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "组件组物料")] + [ImporterHeader(Name = "组件组物料", AutoTrim = true)] + //物料号 + public string ParentMaterialCode { set; get; } + [ExporterHeader(DisplayName = "物料描述")] + [ImporterHeader(Name = "物料描述", AutoTrim = true)] + //物料描述 + public string MaterialDesc { set; get; } + [ExporterHeader(DisplayName = "物料组(车型)")] + [ImporterHeader(Name = "物料组(车型)", AutoTrim = true)] + //物料组(车型) + public string MaterialGroup { set; get; } + [ExporterHeader(DisplayName = "结算数量")] + [ImporterHeader(Name = "结算数量")] + public decimal Qty { set; get; } + + + + } + + + /// + /// 大众看板出库单 + /// + public class WmsKanbanOutPutDetialDto + { + [ExporterHeader(DisplayName = "组件组物料", IsIgnore = true)] + + [ImporterHeader(Name = "组件组物料", IsIgnore = true)] + public string ParentMaterialCode { set; get; } + [ExporterHeader(DisplayName = "交货单号")] + [ImporterHeader(Name = "交货单号")] + public string WmsBillNum { set; get; } + [ExporterHeader(DisplayName = "条码号")] + [ImporterHeader(Name = "条码号")] + //KENN号 + public string Kanban { set; get; } + [ExporterHeader(DisplayName = "物料号")] + [ImporterHeader(Name = "物料号")] + //物料号 + public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "物料描述")] + [ImporterHeader(Name = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + [ExporterHeader(DisplayName = "物料组(车型)")] + [ImporterHeader(Name = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + [ExporterHeader(DisplayName = "出库库位")] + [ImporterHeader(Name = "出库库位", IsIgnore = true)] + //出库库位 + public string OutPut { set; get; } + [ExporterHeader(DisplayName = "入库库位")] + [ImporterHeader(Name = "入库库位", IsIgnore = true)] + //入库库位 + public string InPut { set; get; } + [ExporterHeader(DisplayName = "状态")] + [ImporterHeader(Name = "状态", IsIgnore = true)] + public int State { get; set; } + [ExporterHeader(DisplayName = "客户物料")] + [ImporterHeader(Name = "客户物料")] + /// + /// 扩展字段1 + /// + public string Extend1 { set; get; } + /// + /// 扩展字段2 + /// + [ExporterHeader(DisplayName = "订单日期")] + [ImporterHeader(Name = "订单日期")] + public string Extend2 { set; get; } + /// + /// 扩展字段3 + /// + [ImporterHeader(Name = "版本号", IsIgnore = true)] + public string Version { set; get; } + [ExporterHeader(DisplayName = "结算数量")] + [ImporterHeader(Name = "结算数量")] + public decimal Qty { set; get; } + [ExporterHeader(DisplayName = "单据")] + [ImporterHeader(Name = "单据", IsIgnore = true)] + public string BillNum { set; get; } + [ExporterHeader(DisplayName = "任务", IsIgnore = true)] + [ImporterHeader(Name = "任务", IsIgnore = true)] + public Guid TaskId { set; get; } + [ExporterHeader(DisplayName = "开票单价")] + [ImporterHeader(Name = "开票单价")] + + public decimal Price { set; get; } + [ExporterHeader(DisplayName = "开票金额")] + [ImporterHeader(Name = "开票金额")] + public decimal Amt { set; get; } + + + + } + + /// + /// 大众无条码看板出库单 + /// + public class WmsWithOutKanbanOutPutDetialDto + { + [ImporterHeader(Name = "单据类型")] + [ExporterHeader(DisplayName = "单据类型")] + public string Type { set; get; } + [ImporterHeader(Name = "物料号")] + [ExporterHeader(DisplayName = "物料号")] + public string SapMaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "版本号")] + [ExporterHeader(DisplayName = "版本号")] + public string Version { set; get; } + [ImporterHeader(Name = "是否备件")] + [ExporterHeader(DisplayName = "是否备件")] + public string IsBack { set; get; } + [ImporterHeader(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal Qty { set; get; } + [ImporterHeader(Name = "寄售库存数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "寄售库存数量", IsIgnore = true)] + public decimal SockQty { set; get; } + + [ImporterHeader(Name = "真实数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "真实数量", IsIgnore = true)] + public decimal RealityNumber { set; get; } + + [ImporterHeader(Name = "出库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] + public decimal OutputQty { set; get; } + [ImporterHeader(Name = "Extend", IsIgnore = true)] + [ExporterHeader(DisplayName = "Extend", IsIgnore = true)] + public string Extend { set; get; } + [ImporterHeader(Name = "BillNum", IsIgnore = true)] + [ExporterHeader(DisplayName = "BillNum", IsIgnore = true)] + public string BillNum { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + [ExporterHeader(DisplayName = "状态", IsIgnore = true)] + public int State { set; get; } + [ImporterHeader(Name = "开票单价")] + [ExporterHeader(DisplayName = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + [ExporterHeader(DisplayName = "开票金额")] + public decimal Amt { set; get; } + + + } + + + /// + /// 大众备件出库单 + /// + public class WmsSharePartOutPutDetialDto + { + + [ExporterHeader(DisplayName = "组件组物料", IsIgnore = true)] + public string ParentMaterialCode { set; get; } + [ExporterHeader(DisplayName = "交货单号")] + public string WmsBillNum { set; get; } + [ExporterHeader(DisplayName = "采购订单号")] + //KENN号 + public string OrderBillNum { set; get; } + + [ExporterHeader(DisplayName = "SAP编码")] + //物料号 + public string MaterialCode { set; get; } + [ExporterHeader(DisplayName = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + [ExporterHeader(DisplayName = "物料组(车型)")] + //物料组(车型) + public string MaterialGroup { set; get; } + [ExporterHeader(DisplayName = "出库库位", IsIgnore = true)] + //出库库位 + public string OutPut { set; get; } + [ExporterHeader(DisplayName = "入库库位", IsIgnore = true)] + //入库库位 + public string InPut { set; get; } + [ExporterHeader(DisplayName = "状态", IsIgnore = true)] + public int State { get; set; } + [ExporterHeader(DisplayName = "物料代码")] + /// + /// 扩展字段1 + /// + public string Extend1 { set; get; } + /// + /// 扩展字段2 + /// + [ExporterHeader(DisplayName = "扩展字段2", IsIgnore = true)] + public string Extend2 { set; get; } + /// + /// 扩展字段3 + /// + [ExporterHeader(DisplayName = "版本号", IsIgnore = true)] + public string Version { set; get; } + [ExporterHeader(DisplayName = "开票数量")] + public decimal Qty { set; get; } + + [ExporterHeader(DisplayName = "单据", IsIgnore = true)] + public string BillNum { set; get; } + + + [ExporterHeader(DisplayName = "任务代码", IsIgnore = true)] + public Guid TaskId { set; get; } + + [ExporterHeader(DisplayName = "寄销库数量", IsIgnore = true)] + public decimal StockQty { set; get; } + + [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] + public decimal OutPutQty { set; get; } + [ExporterHeader(DisplayName = "开票单价")] + + public decimal Price { set; get; } + [ExporterHeader(DisplayName = "开票金额")] + public decimal Amt { set; get; } + + + } + + + /// + /// 大众备件手工出库单 + /// + public class WmsSharePart90OutPutDetialDto + { + [ImporterHeader(Name = "寄销库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "寄销库数量", IsIgnore = true)] + public decimal StockQty { set; get; } + + [ImporterHeader(Name = "出库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] + public decimal OutPutQty { set; get; } + + [ImporterHeader(Name = "组件组物料", IsIgnore = true)] + [ExporterHeader(DisplayName = "组件组物料", IsIgnore = true)] + public string ParentMaterialCode { set; get; } + [ImporterHeader(Name = "交货单号")] + [ExporterHeader(DisplayName = "交货单号")] + public string WmsBillNum { set; get; } + [ImporterHeader(Name = "采购订单号")] + [ExporterHeader(DisplayName = "采购订单号")] + //KENN号 + public string OrderBillNum { set; get; } + + [ImporterHeader(Name = "SAP编码")] + [ExporterHeader(DisplayName = "SAP编码")] + //物料号 + public string MaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "物料组(车型)", IsIgnore = true)] + [ExporterHeader(DisplayName = "物料组(车型)", IsIgnore = true)] + //物料组(车型) + public string MaterialGroup { set; get; } + [ImporterHeader(Name = "出库库位", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库库位", IsIgnore = true)] + //出库库位 + public string OutPut { set; get; } + [ImporterHeader(Name = "入库库位", IsIgnore = true)] + [ExporterHeader(DisplayName = "入库库位", IsIgnore = true)] + //入库库位 + public string InPut { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + [ExporterHeader(DisplayName = "状态", IsIgnore = true)] + public int State { get; set; } + [ImporterHeader(Name = "物料代码")] + [ExporterHeader(DisplayName = "物料代码")] + /// + /// 扩展字段1 + /// + public string Extend1 { set; get; } + /// + /// 扩展字段2 + /// + [ImporterHeader(Name = "扩展字段2", IsIgnore = true)] + [ExporterHeader(DisplayName = "扩展字段2", IsIgnore = true)] + public string Extend2 { set; get; } + /// + /// 扩展字段3 + /// + [ImporterHeader(Name = "版本号", IsIgnore = true)] + [ExporterHeader(DisplayName = "版本号", IsIgnore = true)] + public string Version { set; get; } + + [ImporterHeader(Name = "开票数量")] + [ExporterHeader(DisplayName = "开票数量")] + public decimal Qty { set; get; } + + [ImporterHeader(Name = "单据", IsIgnore = true)] + [ExporterHeader(DisplayName = "单据", IsIgnore = true)] + public string BillNum { set; get; } + + + [ImporterHeader(Name = "任务代码", IsIgnore = true)] + [ExporterHeader(DisplayName = "任务代码", IsIgnore = true)] + public Guid TaskId { set; get; } + [ImporterHeader(Name = "开票单价")] + [ExporterHeader(DisplayName = "开票单价")] + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + [ExporterHeader(DisplayName = "开票金额")] + public decimal Amt { set; get; } + + + } + + + /// + /// 红旗数据手工出库单 + /// + public class WmsHQWithOutKanbanOutPutDetialDto + { + [ImporterHeader(Name = "单据类型", IsIgnore = true)] + [ExporterHeader(DisplayName = "单据类型", IsIgnore = true)] + public string Type { set; get; } + [ImporterHeader(Name = "物料号")] + [ExporterHeader(DisplayName = "物料号")] + public string SapMaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "版本号")] + [ExporterHeader(DisplayName = "版本号")] + public string Version { set; get; } + [ImporterHeader(Name = "是否备件")] + [ExporterHeader(DisplayName = "是否备件")] + public string IsBack { set; get; } + [ImporterHeader(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal Qty { set; get; } + [ImporterHeader(Name = "寄售库存数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "寄售库存数量", IsIgnore = true)] + public decimal SockQty { set; get; } + + [ImporterHeader(Name = "真实数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "真实数量", IsIgnore = true)] + public decimal RealityNumber { set; get; } + + [ImporterHeader(Name = "出库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] + public decimal OutputQty { set; get; } + [ImporterHeader(Name = "客户")] + [ExporterHeader(DisplayName = "客户")] + public string Extend { set; get; } + [ImporterHeader(Name = "BillNum", IsIgnore = true)] + [ExporterHeader(DisplayName = "BillNum", IsIgnore = true)] + public string BillNum { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + [ExporterHeader(DisplayName = "状态", IsIgnore = true)] + public int State { set; get; } + [ImporterHeader(Name = "开票单价")] + [ExporterHeader(DisplayName = "开票单价")] + + public decimal Price { set; get; } + [ImporterHeader(Name = "开票金额")] + [ExporterHeader(DisplayName = "开票金额")] + public decimal Amt { set; get; } + + } + + /// + ///一汽轿车出库单 + /// + public class WmsHQCarOutPutDetialDto + { + [ImporterHeader(Name = "是否备件", IsIgnore = true)] + [ExporterHeader(DisplayName = "是否备件", IsIgnore = true)] + public string IsSparePart { set; get; } + //交货单号 + + [ImporterHeader(Name = "寄销库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "寄销库数量", IsIgnore = true)] + public decimal StockQty { set; get; } + + [ImporterHeader(Name = "出库数量", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] + public decimal OutPutQty { set; get; } + + [ImporterHeader(Name = "组件组物料", IsIgnore = true)] + [ExporterHeader(DisplayName = "组件组物料", IsIgnore = true)] + public string ParentMaterialCode { set; get; } + [ImporterHeader(Name = "交货单号", IsIgnore = true)] + [ExporterHeader(DisplayName = "交货单号", IsIgnore = true)] + public string WmsBillNum { set; get; } + [ImporterHeader(Name = "看板号", IsIgnore = true)] + [ExporterHeader(DisplayName = "看板号", IsIgnore = true)] + //KENN号 + public string OrderBillNum { set; get; } + [ImporterHeader(Name = "SAP编码")] + [ExporterHeader(DisplayName = "SAP编码")] + //物料号 + public string MaterialCode { set; get; } + [ImporterHeader(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + //物料描述 + public string MaterialDesc { set; get; } + [ImporterHeader(Name = "物料组")] + [ExporterHeader(DisplayName = "物料组")] + //物料组(车型) + public string MaterialGroup { set; get; } + [ImporterHeader(Name = "出库库位", IsIgnore = true)] + [ExporterHeader(DisplayName = "出库库位", IsIgnore = true)] + //出库库位 + public string OutPut { set; get; } + [ImporterHeader(Name = "入库库位", IsIgnore = true)] + [ExporterHeader(DisplayName = "入库库位", IsIgnore = true)] + //入库库位 + public string InPut { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + [ExporterHeader(DisplayName = "状态", IsIgnore = true)] + public int State { get; set; } + [ImporterHeader(Name = "结算物料号")] + [ExporterHeader(DisplayName = "结算物料号")] + /// + /// 扩展字段1 + /// + public string Extend1 { set; get; } + /// + /// 扩展字段2 + /// + [ImporterHeader(Name = "收货仓库")] + [ExporterHeader(DisplayName = "收货仓库")] + public string Extend2 { set; get; } + /// + /// 扩展字段3 + /// + [ImporterHeader(Name = "版本号", IsIgnore = true)] + [ExporterHeader(DisplayName = "版本号", IsIgnore = true)] + public string Version { set; get; } + + [ImporterHeader(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal Qty { set; get; } + + [ImporterHeader(Name = "结算单价")] + [ExporterHeader(DisplayName = "结算单价")] + public decimal Price { set; get; } + + [ImporterHeader(Name = "结算金额")] + [ExporterHeader(DisplayName = "结算金额")] + public decimal Amt { set; get; } + + + [ImporterHeader(Name = "单据号", IsIgnore = true)] + [ExporterHeader(DisplayName = "单据号", IsIgnore = true)] + public string BillNum { set; get; } + [ImporterHeader(Name = "任务ID", IsIgnore = true)] + [ExporterHeader(DisplayName = "任务ID", IsIgnore = true)] + public Guid TaskId { set; get; } + } + + + + +} diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs index a422d8ca..ae1532e1 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_H/HQ_H_PlatformAppService.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; using Volo.Abp.Domain.Repositories; @@ -19,6 +20,7 @@ using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.Entities.HQ_M; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.Filter; @@ -28,7 +30,7 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H /// /// 红旗H平台导入 /// - [Authorize(SettleAccountPermissions.HQ_HPlatform.Default)] + //[Authorize(SettleAccountPermissions.HQ_HPlatform.Default)] //[AllowAnonymous] [Route("api/settleaccount/HQHPlatform")] public class HQ_H_PlatformAppService : SettleAccountApplicationBase, IHQ_H_PlatformAppService @@ -40,6 +42,11 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H private readonly ISettleAccountBranchEfCoreRepository _versionRepository; private readonly ISettleAccountBranchEfCoreRepository _repository; + + + private readonly ISettleAccountBranchEfCoreRepository _versionMRepository; + + private readonly ISettleAccountBranchEfCoreRepository _repositoryM; /// /// 构建方法 /// @@ -52,29 +59,43 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H IDistributedCache cache, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, - ICommonManager commonManager + ICommonManager commonManager, + ISettleAccountBranchEfCoreRepository versionMRepository, + ISettleAccountBranchEfCoreRepository repositoryM ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) { _versionRepository = versionRepository; _guidGenerator = guidGenerator; _excelImportService = excelImportService; _repository = repository; + _versionMRepository = versionMRepository; + _repositoryM = repositoryM; } - /// - /// 导入功能 + /// 统一导入红旗平台数据,包括H、M、F平台 /// - /// 上传的文件(前端已经限制只能上传一个附件) + /// + /// + /// + /// + /// + /// /// [HttpPost] [Route("ExcelImport")] [DisableRequestSizeLimit] - [Authorize(SettleAccountPermissions.HQ_HPlatform.Create)] + //[Authorize(SettleAccountPermissions.HQ_HPlatform.Create)] public async Task HQ_H_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) { ExportImporter _exportImporter = new ExportImporter(); var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + + if (result == null || result.Count == 0) + { + throw new BusinessException("导入模板数据不能为空!"); + } + var entityList = ObjectMapper.Map, List>(result); //删除版本 var _versionQuery = _versionRepository.Where(p => p.Version == version); @@ -83,17 +104,6 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H var _query = _repository.Where(p => p.Version == version); await _query.BatchDeleteAsync(); - //插入数据前检验 - var checkList = new List(); - var _group = entityList.GroupBy(x => new { x.Factory, x.HQHKanBan, x.Version }).Select(p => new { Count = p.Count(), Factory = p.Key.Factory, HQHKanBan = p.Key.HQHKanBan }); - foreach (var itm in _group) - { - if (itm.Factory != "H") - { - checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的平台数据不是{0}平台的,请检查!", itm.Factory), string.Empty)); - break; - } - } var _id = GuidGenerator.Create(); var _bomList = new List(); _bomList.Add(new HQ_H_PlatformVersion(_id, branchId, year, period, version, customerCode)); @@ -109,15 +119,70 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); } } - if (checkList.Count > 0) - { - return await ExportErrorReportAsync(checkList); - } + await _repository.GetDbContext().BulkInsertAsync(entityList); await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); + return ApplicationConsts.SuccessStr; } + + /// + /// 导入功能 + /// + /// 上传的文件(前端已经限制只能上传一个附件) + /// + //[HttpPost] + //[Route("ExcelImport")] + //[DisableRequestSizeLimit] + //[Authorize(SettleAccountPermissions.HQ_HPlatform.Create)] + //public async Task HQ_H_PlatformUploadExcelImport([FromForm] IFormFileCollection files, Guid branchId, string year, string period, string version, string customerCode) + //{ + // ExportImporter _exportImporter = new ExportImporter(); + // var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + // var entityList = ObjectMapper.Map, List>(result); + // //删除版本 + // var _versionQuery = _versionRepository.Where(p => p.Version == version); + // await _versionQuery.BatchDeleteAsync(); + // //删除明细 + // var _query = _repository.Where(p => p.Version == version); + // await _query.BatchDeleteAsync(); + + // //插入数据前检验 + // var checkList = new List(); + // var _group = entityList.GroupBy(x => new { x.Factory, x.HQHKanBan, x.Version }).Select(p => new { Count = p.Count(), Factory = p.Key.Factory, HQHKanBan = p.Key.HQHKanBan }); + // foreach (var itm in _group) + // { + // if (itm.Factory != "H") + // { + // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("导入的平台数据不是{0}平台的,请检查!", itm.Factory), string.Empty)); + // break; + // } + // } + // var _id = GuidGenerator.Create(); + // var _bomList = new List(); + // _bomList.Add(new HQ_H_PlatformVersion(_id, branchId, year, period, version, customerCode)); + // foreach (var itm in entityList) + // { + // if (string.IsNullOrEmpty(itm.HQHKanBan) && itm.StorageLocationDesc.Contains("备品")) + // { + // //赋值上主键ID + // itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, "BJ");//备品库没有看板号,需要特殊标识一下BJ,已经和客户确认 + // } + // else + // { + // itm.SetValue(GuidGenerator.Create(), branchId, year, period, version); + // } + // } + // if (checkList.Count > 0) + // { + // return await ExportErrorReportAsync(checkList); + // } + // await _repository.GetDbContext().BulkInsertAsync(entityList); + // await _versionRepository.GetDbContext().BulkInsertAsync(_bomList); + // return ApplicationConsts.SuccessStr; + //} + /// /// 按ID获取唯一实体 /// @@ -184,11 +249,11 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_H switch (input.FileType) { case 0: - _fileName = string.Format("红旗工厂H平台验收结算明细_{0}.csv", input.UserId.ToString()); + _fileName = string.Format("红旗工厂结算明细_{0}.csv", input.UserId.ToString()); result = await _csv.ExportAsByteArray(dtoDetails); break; case 1: - _fileName = string.Format("红旗工厂H平台验收结算明细_{0}.xlsx", input.UserId.ToString()); + _fileName = string.Format("红旗工厂结算明细_{0}.xlsx", input.UserId.ToString()); result = await _excel.ExportAsByteArray(dtoDetails); break; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs index ceea76cb..7ed42a09 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs @@ -56,7 +56,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts //[AllowAnonymous] [Route("api/settleaccount/wmsjitoutput")] - [Authorize(SettleAccountPermissions.WMSJIT.Default)] + //[Authorize(SettleAccountPermissions.WMSJIT.Default)] public class WMSJitAppService : SettleAccountApplicationBase { @@ -600,12 +600,14 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts 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, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(entities); + IExporter _excel = new ExcelExporter(); byte[] result = null; var _fileName = string.Format("准时化出库单_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(entities); + result = await _excel.ExportAsByteArray(dtos); result.ShouldNotBeNull(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs index e3533e34..db719bfc 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanAppService.cs @@ -772,11 +772,13 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(entities); + IExporter _excel = new ExcelExporter(); byte[] result = null; - var _fileName = string.Format("出库单_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(entities); + var _fileName = string.Format("大众看板出库单_{0}.xlsx", Guid.NewGuid().ToString()); + result = await _excel.ExportAsByteArray(dtos); result.ShouldNotBeNull(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs index 5cbbb5be..6f49a7a9 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSKanbanExtendAppService.cs @@ -440,11 +440,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(entities); + IExporter _excel = new ExcelExporter(); byte[] result = null; var _fileName = string.Format("大众无条码看板出库单_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(entities); + result = await _excel.ExportAsByteArray(dtos); result.ShouldNotBeNull(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs index 237cc2a7..9a18e965 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs @@ -651,11 +651,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(entities); + IExporter _excel = new ExcelExporter(); byte[] result = null; - var _fileName = string.Format("出库单_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(entities); + var _fileName = string.Format("大众备件手工出库单_{0}.xlsx", Guid.NewGuid().ToString()); + result = await _excel.ExportAsByteArray(dtos); result.ShouldNotBeNull(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs index 9c5481a8..d97db6c5 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs @@ -63,6 +63,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { private readonly ISettleAccountBranchEfCoreRepository _wmsRepository; private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository; + + private readonly ISettleAccountBranchEfCoreRepository _wmsRepository90; + private readonly ISettleAccountBranchEfCoreRepository _wmsVersionRepository90; + + private readonly WMSEfCoreRepository _wmsefRespository; private readonly WmsDapperRepository _wmsDapper; private readonly WMSEfCoreRepository _wmstbRespository; @@ -70,16 +75,16 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts private readonly IExcelImportAppService _excelImportService; private readonly TaskJobService _service; - /// - /// - /// - /// - /// - /// - /// - /// + /// + /// + /// + /// + /// + /// + /// + /// public WMSSharePartAppService( - + ISettleAccountBranchEfCoreRepository wmsRepository, ISettleAccountBranchEfCoreRepository job, ISettleAccountBranchEfCoreRepository wmsVersionRepository, @@ -89,6 +94,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts IDistributedCache cache, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, + ISettleAccountBranchEfCoreRepository wmsRepository90, + ISettleAccountBranchEfCoreRepository wmsVersionRepository90, WmsDapperRepository wmsDapper ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) { @@ -99,6 +106,9 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts _wmsVersionRepository = wmsVersionRepository; _wmsDapper = wmsDapper; _wmsefRespository = wmsefRespository; + + _wmsRepository90 = wmsRepository90; + _wmsVersionRepository90 = wmsVersionRepository90; } private async Task GetCountAsync(WmsSharePartOutPutDetialRequestDto input) @@ -218,45 +228,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts } - /// - /// 出库单导出 - /// - /// - /// - [HttpPost] - [Route("Export")] - //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] - virtual public async Task ExportAsync(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, int.MaxValue, - 0, true); - - IExporter _excel = new ExcelExporter(); - byte[] result = null; - - var _fileName = string.Format("大众备件出库单_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(entities); - - - result.ShouldNotBeNull(); - - //保存导出文件到服务器存成二进制 - await _excelImportService.SaveBlobAsync( - new SaveExcelImportInputDto - { - Name = _fileName, - Content = result - } - ); - return _fileName; - - - - } - - - + /// /// 选择任务,生成出库单,只包含已确认的单据 /// @@ -274,16 +246,18 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { var fileList = _joblist.Select(p => p.RealDownFileName).ToList(); List _lst = new List(); - List _lstBill = new List(); + List _lstBill = new List(); foreach (var filename in fileList) { string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename; ExcelHelper _excelHelper = new ExcelHelper(fileSavePath); - var _listSummary = _excelHelper.ExcelToListOne();//导入模板有多页签,需要取第一个页签 - var _list = _listSummary.Where(p => p.OrderBillNum == "").ToList();//过滤 采购订单号为空的集合 - var _listBill = _listSummary.Where(p => p.OrderBillNum != "").ToList();//过滤 采购订单号不为空的集合 + var _listSummary = _excelHelper.ExcelToListOne();//无单号 + + var _list90Summary = _excelHelper.ExcelToListOne();//有单号 + var _list = _listSummary.Where(p => p.OrderBillNum == "").ToList();//过滤 没有采购订单号为空的集合 + var _listBill = _list90Summary.Where(p => p.OrderBillNum != "").ToList();//过滤 有采购订单号的集合 @@ -433,12 +407,12 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts } - - + //有采购订单号 + //往Set_WmsSharePart90OutPutDetial表中存储 if (_lstBill != null && _lstBill.Count>0) { //有采购订单号 - var outPutDetailBill = await _wmsRepository.Where(p => p.Version == input.Version && p.OrderBillNum != "").ToListAsync(); + var outPutDetailBill = await _wmsRepository90.Where(p => p.Version == input.Version && p.OrderBillNum != "").ToListAsync(); var error = from itm1 in outPutDetailBill join itm2 in _lstBill on @@ -460,7 +434,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts select itm1; var _wmslstBill = queryBill.ToList(); _wmslstBill = _wmslstBill.Select(p => new - WmsSharePartOutPutDetial( + WmsSharePart90OutPutDetial( GuidGenerator.Create(), p.WmsBillNum, p.OrderBillNum, @@ -484,27 +458,19 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts p.Amt )).ToList(); - await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslstBill, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); - int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); + await _wmsRepository90.GetDbContext().BulkInsertAsync(_wmslstBill, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository90.Count(p => p.Version == input.Version && p.BillNum == _billNum); if (_wmslstBill.Count() > 0 && _count == 0) { - var _version = new WmsSharePartOutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); + var _version = new WmsSharePart90OutPut(GuidGenerator.Create(), input.Version, _billNum, CurrentUser.Email); _version.Remark= !string.IsNullOrEmpty(_joblist.FirstOrDefault().Remark) ? _joblist.FirstOrDefault().Remark : string.Empty; - await _wmsVersionRepository.InsertAsync(_version, true); + await _wmsVersionRepository90.InsertAsync(_version, true); } foreach (var job in _joblist) { - if (_lst != null && _lst.Count > 0) - { - job.FileName = _billNum + "/" + _billNoNum; - } - else - { - job.FileName = _billNum; - } - + job.FileName = _billNum; await _job.UpdateAsync(job); } } @@ -548,246 +514,36 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts [UnitOfWork(false)] public async Task WmsSharePartOutPutPass(WmsJitRequestDto input) { - if (input.BillNum.Contains("NoBill")) + if (input.Guids != null) { - //没有采购订单号的出库方式 - if (input.Guids != null) + List _ls = new List(); + if (input.Guids.Count() > 0) { - 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 = 2,\n" + - " @date = N'{1}'\n" + - "SELECT 'Return Value' = @return_value"; - await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( - string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString())); - - } + _ls = await _wmsRepository.Where(p => input.Guids.Contains(p.Id) && p.Version == input.Version && p.BillNum == input.BillNum && p.State != 2).ToListAsync(); } - } - else - { - //有采购订单号的出库方式 - if (input.Guids != null) + else { - 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 = 10,\n" + - " @date = N'{1}'\n" + - "SELECT 'Return Value' = @return_value"; - await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( - string.Format(sql, input.BillNum, input.AccountDate.ToShortDateString())); + _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 = 10,\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; } - - /// - /// 选择任务,生成出库单,只包含已确认的单据 - /// - /// - /// - /// - //[HttpPost] - //[Route("WmsSharePartOutPut")] - //public async Task WmsSharePartOutPut(WmsJitRequestDto input) - //{ - // var _billNum = "B" + 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 - // WmsSharePartOutPutDetial( - // GuidGenerator.Create(), - // string.Empty, - // string.Empty, - // p.MaterialCode, - // p.MaterialDesc, - // p.MaterialGroup, - // string.Empty, - // string.Empty, - // 0, - // !string.IsNullOrEmpty(p.Extend1) ? p.Extend1 : string.Empty, - - // string.Empty, - // string.Empty, - // p.MaterialCode, - // _billNum, - // GuidGenerator.Create(), - // string.Empty, - // p.Qty, - // p.StockQty, - // p.Qty, - // p.Price, - // p.Amt - // )); - // _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.OrderBillNum, itm1.WmsBillNum } - // equals - // new { itm2.MaterialCode, itm2.OrderBillNum, itm2.WmsBillNum } - // 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.OrderBillNum, itm1.WmsBillNum } - // equals - // new { itm2.MaterialCode, itm2.OrderBillNum, itm2.WmsBillNum } into temp1 - // from tm1 in temp1.DefaultIfEmpty() - // where tm1 == null - // select itm1; - // var _wmslst = query.ToList(); - // _wmslst = _wmslst.Select(p => new - // WmsSharePartOutPutDetial( - // GuidGenerator.Create(), - // string.Empty, - // string.Empty, - // p.MaterialCode, - // p.MaterialDesc, - // p.MaterialGroup, - // string.Empty, - // string.Empty, - // 0, - // !string.IsNullOrEmpty(p.Extend1) ? p.Extend1 : string.Empty, - // string.Empty, - // input.Version, - // p.MaterialCode, - // _billNum, - // GuidGenerator.Create(), - // string.Empty, - // p.Qty, - // p.StockQty, - // p.Qty, - // p.Price, - // p.Amt - // )).ToList(); - // await _wmsRepository.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); - // int _count = _wmsVersionRepository.Count(p => p.Version == input.Version && p.BillNum == _billNum); - // if (_wmslst.Count() > 0 && _count == 0) - // { - // var _version = new WmsSharePartOutPut(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("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 = 2,\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; - //} - - [HttpPost] [Route("WmsSharePartOutPutModify")] [DisableRequestSizeLimit] @@ -815,63 +571,31 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts [Route("WmsSharePartOutPut-Cancel")] public async Task WmsSharePartOutPutCancel(WmsJitRequestDto input) { - if (input.BillNum.Contains("NoBill")) + //没有有采购单据号的单子 + if (input.Guids != null && input.Guids.Count() > 0) { - //没有有采购单据号的单子 - if (input.Guids != null && input.Guids.Count() > 0) + List _ls = new List(); + foreach (var itm in input.Guids) { - 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 = 2,\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 - ); - + _ls.Add(string.Format("{0}", itm)); } - } - else - { - //有采购单据号的单子 - 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()); + 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 = 10,\n" + - " @accountdate = N'{2}'\n" + - "SELECT 'Return Value' = @return_value"; + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output_cancel]\n" + + " @Guids ='{0}', \n" + + " @billnum = N'{1}',\n" + + " @type = 2,\n" + + " @accountdate = N'{2}'\n" + + "SELECT 'Return Value' = @return_value"; - sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString()); + sql = string.Format(sql, str, input.BillNum, input.AccountDate.ToShortDateString()); - await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( - sql - ); + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + sql + ); - } } return true; @@ -888,44 +612,21 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts [UnitOfWork(false)] public async Task WmsOutPutDelete(WmsJitRequestDto input) { - if (input.BillNum.Contains("NoBill")) - { - //没有采购单据号的单子 - var count = _wmsRepository.Count(p => p.BillNum == input.BillNum && p.State != 0); + //没有采购单据号的单子 + 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 = 2\n" + - "SELECT 'Return Value' = @return_value"; - await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( - string.Format(sql, input.BillNum) - ); - } - else + if (count > 0) { - //有采购单据号的单子 - 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 = 10\n" + - "SELECT 'Return Value' = @return_value"; - await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( - string.Format(sql, input.BillNum) - ); + return false; } - - + var sql = "DECLARE @return_value int\n" + + "EXEC @return_value = [dbo].[p_wms_output_cancel_all]\n" + + " @billnum = N'{0}',\n" + + " @type = 2\n" + + "SELECT 'Return Value' = @return_value"; + await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( + string.Format(sql, input.BillNum) + ); return true; } @@ -946,8 +647,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts throw new BusinessException("导入的模板中没有数据,不能为空,请检查!"); } - var result_withbill = result.Where(p => p.OrderBillNum != "").ToList(); + var result90 = await _exportImporter.ExtendExcelOfSheetOneImport(files, _excelImportService); + var result_nobill = result.Where(p => p.OrderBillNum == "").ToList(); + var result_withbill = result90.Where(p => p.OrderBillNum != "").ToList(); + //没有采购单号 if (result_nobill != null) @@ -1034,12 +738,12 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts if (result_withbill != null) { var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss"); - List _lst = new List(); + List _lst = new List(); - var _lsCopy = new List(); + var _lsCopy = new List(); foreach (var itm in result_withbill) { - WmsSharePartOutPutDetial _detail = new WmsSharePartOutPutDetial( + WmsSharePart90OutPutDetial _detail = new WmsSharePart90OutPutDetial( GuidGenerator.Create(), itm.WmsBillNum, itm.OrderBillNum, @@ -1066,7 +770,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts } _lst.AddRange(_lsCopy.ToArray()); - var outPutDetail = await _wmsRepository.Where(p => p.Version == version).ToListAsync(); + var outPutDetail = await _wmsRepository90.Where(p => p.Version == version).ToListAsync(); var error = from itm1 in outPutDetail @@ -1103,12 +807,12 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { 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); + await _wmsRepository90.GetDbContext().BulkInsertAsync(_wmslst, new BulkConfig() { BulkCopyTimeout = 0, BatchSize = 10000 }); + int _count = _wmsVersionRepository90.Count(p => p.Version == version && p.BillNum == _billNum); if (_count == 0 && _wmslst.Count() > 0) { - var _version = new WmsSharePartOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); - await _wmsVersionRepository.InsertAsync(_version, true); + var _version = new WmsSharePart90OutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); + await _wmsVersionRepository90.InsertAsync(_version, true); } } @@ -1116,119 +820,46 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts } - //[HttpPost] - //[Route("ExcelImport")] - //[DisableRequestSizeLimit] - ////[Authorize(SettleAccountPermissions.SettleAccounts.Default)] - //public async Task ExcelImport([FromForm] IFormFileCollection files, string version) - //{ - // var _billNum = "B" + DateTime.Now.ToString("yyyyMMddhhmmss"); - // ExportImporter _exportImporter = new ExportImporter(); - // var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); - - // //if (result == null) - // //{ - // // throw new BusinessException("导入的模板中没有数据,不能为空,请检查!"); - // //} - - // //var result_withbill = result.Select(p => p.BillNum != string.Empty).ToList(); - // //var result_nobill = result.Select(p => p.BillNum == string.Empty).ToList(); - - // List _lst = new List(); - - // var _lsCopy = new List(); - // foreach (var itm in result) - // { - // WmsSharePartOutPutDetial _detail = new WmsSharePartOutPutDetial( - // GuidGenerator.Create(), - // //itm.WmsBillNum, - // //itm.OrderBillNum, - // string.Empty, - // string.Empty, - // itm.MaterialCode, - // itm.MaterialDesc, - // itm.MaterialGroup, - // string.Empty, - // string.Empty, - // 0, - // !string.IsNullOrEmpty(itm.Extend1) ? itm.Extend1 : string.Empty, - // string.Empty, - // version, - // itm.ParentMaterialCode, - // itm.BillNum, - // GuidGenerator.Create() - // , string.Empty - // , itm.Qty - // , 0 - // , itm.Qty - // , itm.Price - // , itm.Amt - // ); - // _lsCopy.Add(_detail); - // } - // _lst.AddRange(_lsCopy.ToArray()); - - // //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,itm1.WmsBillNum } - // // equals - // // new { itm2.MaterialCode, itm2.OrderBillNum,itm2.WmsBillNum } - // // select itm1; - - // 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 _ls1 - // // join itm2 in outPutDetail on - // // new { itm1.MaterialCode, itm1.OrderBillNum } - // // equals - // // new { itm2.MaterialCode, itm2.OrderBillNum } into temp1 - // // from tm1 in temp1.DefaultIfEmpty() - // // where tm1 == null - // // select itm1; - // 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 && _wmslst.Count() > 0) - // { - // var _version = new WmsSharePartOutPut(GuidGenerator.Create(), version, _billNum, CurrentUser.Email); - // await _wmsVersionRepository.InsertAsync(_version, true); - // } - // return ApplicationConsts.SuccessStr; - //} + + + /// + /// 出库单导出 + /// + /// + /// + [HttpPost] + [Route("Export")] + //[Authorize(SettleAccountPermissions.SettleAccounts.Default)] + virtual public async Task ExportAsync(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, int.MaxValue, + 0, true); + + var dtos = ObjectMapper.Map, List>(entities); + + IExporter _excel = new ExcelExporter(); + byte[] result = null; + + var _fileName = string.Format("大众备件出库单_{0}.xlsx", Guid.NewGuid().ToString()); + result = await _excel.ExportAsByteArray(dtos); + + + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = _fileName, + Content = result + } + ); + return _fileName; + + + + } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQCarAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQCarAppService.cs index 3d3889cf..25c74203 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQCarAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQCarAppService.cs @@ -502,11 +502,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(entities); + IExporter _excel = new ExcelExporter(); byte[] result = null; var _fileName = string.Format("一汽轿车平台出库单_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(entities); + result = await _excel.ExportAsByteArray(dtos); result.ShouldNotBeNull(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs index f550cf40..a5e94276 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQKBOutputAppService.cs @@ -421,11 +421,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(entities); + IExporter _excel = new ExcelExporter(); byte[] result = null; - var _fileName = string.Format("红旗数据调整出库单_{0}.xlsx", Guid.NewGuid().ToString()); - result = await _excel.ExportAsByteArray(entities); + var _fileName = string.Format("红旗数据手工出库单_{0}.xlsx", Guid.NewGuid().ToString()); + result = await _excel.ExportAsByteArray(dtos); result.ShouldNotBeNull(); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml index d2037f6f..c80d095d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml @@ -820,7 +820,7 @@ 红旗H平台导入 - + 构建方法 @@ -830,9 +830,14 @@ - 导入功能 + 统一导入红旗平台数据,包括H、M、F平台 - 上传的文件(前端已经限制只能上传一个附件) + + + + + + @@ -2132,13 +2137,6 @@ - - - 准时化出库明细 - - - - 准时化出库明细 @@ -2293,7 +2291,7 @@ wms出库 - + @@ -2331,13 +2329,6 @@ 上传的文件(前端已经限制只能上传一个附件) - - - 出库单导出 - - - - 选择任务,生成出库单,只包含已确认的单据 @@ -2354,14 +2345,6 @@ - - - 选择任务,生成出库单,只包含已确认的单据 - - - - - 出库界面功能, 撤销核准出库 @@ -2378,6 +2361,13 @@ + + + 出库单导出 + + + + 结算包与散件对应关系服务 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index a2ff2ef3..6ad9bdeb 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -87,6 +87,8 @@ using Win.Sfs.SettleAccount.Entities.HQ_H; using Win.Sfs.SettleAccount.Entities.HQ_M; using Win.Sfs.SettleAccount.Entities.HQ_F; using Win.Sfs.SettleAccount.Entities.BT_Car; +using Win.Sfs.SettleAccount.Entities.WMS; +using Win.Sfs.SettleAccount.Entities; namespace Win.Sfs.SettleAccount { @@ -245,10 +247,67 @@ namespace Win.Sfs.SettleAccount CreateMapBT_Car_Platform(); CreateMapBT_Car_PlatformVersion(); #endregion + + #region 出库单导出 + + CreateMapWMSJit(); + CreateMapWmsKanban(); + CreateMapWMSKanbanExtend(); + CreateMapWmsSharePart(); + CreateMapWmsSharePart90(); + CreateMapWmsHQWithOutKanban(); + CreateMapWmsHQCar(); + + + #endregion + } + + #region 派格出库单 + + private void CreateMapWMSJit() + { + CreateMap().ReverseMap(); + } + + private void CreateMapWmsKanban() + { + CreateMap().ReverseMap(); + } + + + private void CreateMapWMSKanbanExtend() + { + CreateMap().ReverseMap(); + } + + private void CreateMapWmsSharePart() + { + CreateMap().ReverseMap(); + } + + private void CreateMapWmsSharePart90() + { + CreateMap().ReverseMap(); + } + + + private void CreateMapWmsHQWithOutKanban() + { + CreateMap().ReverseMap(); } + private void CreateMapWmsHQCar() + { + CreateMap().ReverseMap(); + } + + #endregion + #region PG-派格映射 + + + /// /// 红旗F平台导入 /// 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 afaa0232..c6abda67 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs @@ -212,46 +212,46 @@ namespace Win.Sfs.SettleAccount.Entities.WMS [ImporterHeader(Name = "结算数量")] public decimal Qty { set; get; } - //以下继承的全部不导出 + ////以下继承的全部不导出 - [ExporterHeader(DisplayName = "BranchId", IsIgnore = true)] - public Guid BranchId { set; get; } + //[ExporterHeader(DisplayName = "BranchId", IsIgnore = true)] + //public Guid BranchId { set; get; } - [ExporterHeader(DisplayName = "Enabled", IsIgnore = true)] - public bool Enabled { set; get; } + //[ExporterHeader(DisplayName = "Enabled", IsIgnore = true)] + //public bool Enabled { set; get; } - [ExporterHeader(DisplayName = "Remark", IsIgnore = true)] - public string Remark { set; get; } + //[ExporterHeader(DisplayName = "Remark", IsIgnore = true)] + //public string Remark { set; get; } - [ExporterHeader(DisplayName = "IsDeleted", IsIgnore = true)] - public bool IsDeleted { set; get; } + //[ExporterHeader(DisplayName = "IsDeleted", IsIgnore = true)] + //public bool IsDeleted { set; get; } - [ExporterHeader(DisplayName = "DeleterId", IsIgnore = true)] - public bool DeleterId { set; get; } + //[ExporterHeader(DisplayName = "DeleterId", IsIgnore = true)] + //public bool DeleterId { set; get; } - [ExporterHeader(DisplayName = "DeletionTime", IsIgnore = true)] - public DateTime DeletionTime { set; get; } + //[ExporterHeader(DisplayName = "DeletionTime", IsIgnore = true)] + //public DateTime DeletionTime { set; get; } - [ExporterHeader(DisplayName = "LastModificationTime", IsIgnore = true)] - public DateTime LastModificationTime { set; get; } + //[ExporterHeader(DisplayName = "LastModificationTime", IsIgnore = true)] + //public DateTime LastModificationTime { set; get; } - [ExporterHeader(DisplayName = "LastModifierId", IsIgnore = true)] - public Guid LastModifierId { set; get; } + //[ExporterHeader(DisplayName = "LastModifierId", IsIgnore = true)] + //public Guid LastModifierId { set; get; } - [ExporterHeader(DisplayName = "CreationTime", IsIgnore = true)] - public DateTime CreationTime { set; get; } + //[ExporterHeader(DisplayName = "CreationTime", IsIgnore = true)] + //public DateTime CreationTime { set; get; } - [ExporterHeader(DisplayName = "CreatorId", IsIgnore = true)] - public Guid CreatorId { set; get; } + //[ExporterHeader(DisplayName = "CreatorId", IsIgnore = true)] + //public Guid CreatorId { set; get; } - [ExporterHeader(DisplayName = "ExtraProperties", IsIgnore = true)] - public string ExtraProperties { set; get; } + //[ExporterHeader(DisplayName = "ExtraProperties", IsIgnore = true)] + //public string ExtraProperties { set; get; } - [ExporterHeader(DisplayName = "ConcurrencyStamp", IsIgnore = true)] - public DateTime ConcurrencyStamp { set; get; } + //[ExporterHeader(DisplayName = "ConcurrencyStamp", IsIgnore = true)] + //public DateTime ConcurrencyStamp { set; get; } - [ExporterHeader(DisplayName = "Id", IsIgnore = true)] - public Guid Id { set; get; } + //[ExporterHeader(DisplayName = "Id", IsIgnore = true)] + //public Guid Id { set; get; } @@ -262,9 +262,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS - - - public class WmsKanbanOutPut : FullAuditedAggregateRootBase { public WmsKanbanOutPut() @@ -516,44 +513,44 @@ namespace Win.Sfs.SettleAccount.Entities.WMS //以下继承的全部不导出 - [ExporterHeader(DisplayName = "BranchId", IsIgnore = true)] - public Guid BranchId { set; get; } + //[ExporterHeader(DisplayName = "BranchId", IsIgnore = true)] + //public Guid BranchId { set; get; } - [ExporterHeader(DisplayName = "Enabled", IsIgnore = true)] - public bool Enabled { set; get; } + //[ExporterHeader(DisplayName = "Enabled", IsIgnore = true)] + //public bool Enabled { set; get; } - [ExporterHeader(DisplayName = "Remark", IsIgnore = true)] - public string Remark { set; get; } + //[ExporterHeader(DisplayName = "Remark", IsIgnore = true)] + //public string Remark { set; get; } - [ExporterHeader(DisplayName = "IsDeleted", IsIgnore = true)] - public bool IsDeleted { set; get; } + //[ExporterHeader(DisplayName = "IsDeleted", IsIgnore = true)] + //public bool IsDeleted { set; get; } - [ExporterHeader(DisplayName = "DeleterId", IsIgnore = true)] - public bool DeleterId { set; get; } + //[ExporterHeader(DisplayName = "DeleterId", IsIgnore = true)] + //public bool DeleterId { set; get; } - [ExporterHeader(DisplayName = "DeletionTime", IsIgnore = true)] - public DateTime DeletionTime { set; get; } + //[ExporterHeader(DisplayName = "DeletionTime", IsIgnore = true)] + //public DateTime DeletionTime { set; get; } - [ExporterHeader(DisplayName = "LastModificationTime", IsIgnore = true)] - public DateTime LastModificationTime { set; get; } + //[ExporterHeader(DisplayName = "LastModificationTime", IsIgnore = true)] + //public DateTime LastModificationTime { set; get; } - [ExporterHeader(DisplayName = "LastModifierId", IsIgnore = true)] - public Guid LastModifierId { set; get; } + //[ExporterHeader(DisplayName = "LastModifierId", IsIgnore = true)] + //public Guid LastModifierId { set; get; } - [ExporterHeader(DisplayName = "CreationTime", IsIgnore = true)] - public DateTime CreationTime { set; get; } + //[ExporterHeader(DisplayName = "CreationTime", IsIgnore = true)] + //public DateTime CreationTime { set; get; } - [ExporterHeader(DisplayName = "CreatorId", IsIgnore = true)] - public Guid CreatorId { set; get; } + //[ExporterHeader(DisplayName = "CreatorId", IsIgnore = true)] + //public Guid CreatorId { set; get; } - [ExporterHeader(DisplayName = "ExtraProperties", IsIgnore = true)] - public string ExtraProperties { set; get; } + //[ExporterHeader(DisplayName = "ExtraProperties", IsIgnore = true)] + //public string ExtraProperties { set; get; } - [ExporterHeader(DisplayName = "ConcurrencyStamp", IsIgnore = true)] - public DateTime ConcurrencyStamp { set; get; } + //[ExporterHeader(DisplayName = "ConcurrencyStamp", IsIgnore = true)] + //public DateTime ConcurrencyStamp { set; get; } - [ExporterHeader(DisplayName = "Id", IsIgnore = true)] - public Guid Id { set; get; } + //[ExporterHeader(DisplayName = "Id", IsIgnore = true)] + //public Guid Id { set; get; } } @@ -1910,72 +1907,6 @@ namespace Win.Sfs.SettleAccount.Entities.WMS } - public class ExportWmsSharePartOutPutDetial - { - - [ExporterHeader(DisplayName = "组件组物料", IsIgnore = true)] - public string ParentMaterialCode { set; get; } - [ExporterHeader(DisplayName = "交货单号")] - public string WmsBillNum { set; get; } - [ExporterHeader(DisplayName = "采购订单号")] - //KENN号 - public string OrderBillNum { set; get; } - - [ExporterHeader(DisplayName = "SAP编码")] - //物料号 - public string MaterialCode { set; get; } - [ExporterHeader(DisplayName = "物料描述")] - //物料描述 - public string MaterialDesc { set; get; } - [ExporterHeader(DisplayName = "物料组(车型)")] - //物料组(车型) - public string MaterialGroup { set; get; } - [ExporterHeader(DisplayName = "出库库位", IsIgnore = true)] - //出库库位 - public string OutPut { set; get; } - [ExporterHeader(DisplayName = "入库库位", IsIgnore = true)] - //入库库位 - public string InPut { set; get; } - [ExporterHeader(DisplayName = "状态", IsIgnore = true)] - public int State { get; set; } - [ExporterHeader(DisplayName = "物料代码")] - /// - /// 扩展字段1 - /// - public string Extend1 { set; get; } - /// - /// 扩展字段2 - /// - [ExporterHeader(DisplayName = "扩展字段2", IsIgnore = true)] - public string Extend2 { set; get; } - /// - /// 扩展字段3 - /// - [ExporterHeader(DisplayName = "版本号", IsIgnore = true)] - public string Version { set; get; } - [ExporterHeader(DisplayName = "开票数量")] - public decimal Qty { set; get; } - - [ExporterHeader(DisplayName = "单据", IsIgnore = true)] - public string BillNum { set; get; } - - - [ExporterHeader(DisplayName = "任务代码", IsIgnore = true)] - public Guid TaskId { set; get; } - - [ExporterHeader(DisplayName = "寄销库数量", IsIgnore = true)] - public decimal StockQty { set; get; } - - [ExporterHeader(DisplayName = "出库数量", IsIgnore = true)] - public decimal OutPutQty { set; get; } - [ExporterHeader(DisplayName = "开票单价")] - - public decimal Price { set; get; } - [ExporterHeader(DisplayName = "开票金额")] - public decimal Amt { set; get; } - - - } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs index 2d134ada..d0053c72 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs @@ -61,66 +61,59 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report ////{ //// condition += string.Format(" B.chassisNumber='{0}' ", materialGroup); ////} - string str = - "SELECT\n" + - " isnull(temp1.交货单号,'') 交货单号,\n" + - " temp1.交货时间,\n" + - " isnull(temp1.手工或自动,'') 手工或自动,\n" + - " temp1.收货仓库,\n" + - " temp1.收货仓库描述,\n" + - " temp1.订货看板编号,\n" + - " temp1.订货零件号,\n" + - " temp1.发货零件号,\n" + - " temp1.零件中文名称,\n" + - " temp1.Sap编码,\n" + - " temp1.物料组,\n" + - " temp1.发货数量,\n" + - " temp1.发货状态,\n" + - " temp1.结算验收单号,\n" + - " temp1.结算数量,\n" + - " temp1.结算单价,\n" + - " temp1.结算金额,\n" + - " isnull(TEMP2.Price,0) AS 发货定价,\n" + - " isnull(temp1.发货数量,0) * isnull(TEMP2.Price,0) AS 发货总金额,\n" + - " 0 AS 数量差异,\n" + - " 0 AS 单价差异,\n" + - " 0 AS 差异总金额 \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " b.WmsBillNum AS 交货单号,\n" + - " b.LastModificationTime AS 交货时间,\n" + - " b.IsAuto AS 手工或自动,\n" + - " a.StorageLocation AS 收货仓库,\n" + - " a.StorageLocationDesc AS 收货仓库描述,\n" + - " a.HQHKanBan AS 订货看板编号,\n" + - " a.MaterialCode AS 订货零件号,\n" + - " c.MaterialCode Sap编码,\n" + - " a.MaterialCode AS 发货零件号,\n" + - " c.MaterialDesc AS 零件中文名称,\n" + - " isnull(b.Qty,0) AS 发货数量,\n" + - " isnull(b.State,0) AS 发货状态,\n" + - " a.AcceptanceNo AS 结算验收单号,\n" + - " isnull(b.Qty,0) AS 结算数量,\n" + - " isnull(a.Price,0) AS 结算单价,\n" + - " isnull(a.Amt,0) AS 结算金额 ,\n" + - " C.EstimateTypeDesc AS 物料组\n" + - " FROM\n" + - " Set_HQ_H_Platform AS a\n" + - " LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" + - " AND a.MaterialCode = b.MaterialCode\n" + - " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + - " WHERE\n" + - " ( a.HQHKanBan <> 'BJ' ) and a.Version='{0}' {1}) 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 ) FROM Set_PriceList ))) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode"; + string str = "SELECT\n" + + " temp1.交货日期,\n" + + " isnull( temp1.手工或自动, '' ) 手工或自动,\n" + + " isnull( temp1.交货单号, '' ) 交货单号,\n" + + " temp1.收货仓库,\n" + + " temp1.收货仓库描述,\n" + + " temp1.订货看板编号,\n" + + " temp1.订货零件号,\n" + + " temp1.Sap编码,\n" + + " temp1.发货零件号,\n" + + " temp1.物料组,\n" + + " temp1.零件中文名称,\n" + + " temp1.发货数量,\n" + + " temp1.发货状态,\n" + + " temp1.结算验收单号,\n" + + " temp1.结算数量,\n" + + " temp1.结算单价,\n" + + " temp1.结算金额,\n" + + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + + " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" + + " 0 AS 数量差异,\n" + + " temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异,\n" + + " ( temp1.结算单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.结算数量 AS 差异总金额\n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " b.WmsBillNum AS 交货单号,\n" + + " b.LastModificationTime AS 交货日期,\n" + + " b.IsAuto AS 手工或自动,\n" + + " a.StorageLocation AS 收货仓库,\n" + + " a.StorageLocationDesc AS 收货仓库描述,\n" + + " a.HQHKanBan AS 订货看板编号,\n" + + " a.MaterialCode AS 订货零件号,\n" + + " c.MaterialCode Sap编码,\n" + + " '' AS 发货零件号,\n" + + " c.MaterialDesc AS 零件中文名称,\n" + + " isnull( b.Qty, 0 ) AS 发货数量,\n" + + " isnull( b.State, 0 ) AS 发货状态,\n" + + " a.AcceptanceNo AS 结算验收单号,\n" + + " isnull( a.Qty, 0 ) AS 结算数量,\n" + + " isnull( a.Price, 0 ) AS 结算单价,\n" + + " isnull( a.Amt, 0 ) AS 结算金额 ,\n" + + " C.EstimateTypeDesc AS 物料组 \n" + + " FROM\n" + + " Set_HQ_H_Platform AS a\n" + + " LEFT OUTER JOIN Set_HQ_H_Kanban AS b ON a.HQHKanBan = b.Kanban \n" + + " AND a.MaterialCode = b.MaterialCode\n" + + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + " WHERE\n" + + " ( a.HQHKanBan <> 'BJ' ) \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); var _query = DbConnection.Query(_sql, null, null, true, 1200, null); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs index 9c5335a9..ba73cee4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs @@ -85,7 +85,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " PurchaseOrderNoText,\n" + " AmountNoTax \n" + " FROM\n" + - " Set_SparePart WHERE Extend != 'is90' \n" + + " Set_SparePart WHERE Extend != 'is90' \n" + " GROUP BY\n" + " PurchaseOrderNo,\n" + " MaterialCode,\n" + @@ -356,6 +356,25 @@ public class SparePartSumQtyDiff //[ExcelExporter(Name = "未结明细", AutoFitAllColumn = true, MaxRowNumberOnASheet = 500000)] public class SettleSparePartExport { + + public SettleSparePartExport() + { + } + + + + public SettleSparePartExport( string sapMaterialCode, string materialCode, string materialDesc, + decimal qty, decimal sockQty) + { + SAP编码 = sapMaterialCode; + 物料描述 = materialDesc; + 物料代码 = materialCode; + 开票数量 = qty; + 寄售库存数量 = sockQty; + } + + + [ExporterHeader(DisplayName = "交货日期 ")] public string 交货日期 { set; get; } [ExporterHeader(DisplayName = "交货单号")] @@ -395,5 +414,8 @@ public class SparePartSumQtyDiff [ExporterHeader(DisplayName = "差异总金额")] public decimal 差异总金额 { set; get; } + [ExporterHeader(DisplayName = "寄售库存数量")] + public decimal 寄售库存数量 { set; get; } + } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs index 71e1ab99..1b25aa14 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs @@ -20,21 +20,24 @@ namespace SettleAccount.Job.Services.Report private readonly OutputService _outputService; private readonly ErpPartDapperRepository _erpdapperRepository; private readonly IBlobContainer _fileContainer; + private readonly WmsDapperRepository _wmsDapper; public SettleSparePartExportService(SettleSparePartDapperReportRepository dapper, ErpPartDapperRepository erpdapperRepository, OutputService outputService + , WmsDapperRepository wmsDapper , IBlobContainer fileContainer) { _dapper = dapper; _outputService = outputService; _erpdapperRepository = erpdapperRepository; _fileContainer = fileContainer; + _wmsDapper = wmsDapper; } public string ExportFile(Guid id, List exportName, List p_list) { - var fileName=exportName.FirstOrDefault(); + var fileName = exportName.FirstOrDefault(); 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; @@ -51,6 +54,20 @@ namespace SettleAccount.Job.Services.Report //反向对比,有发货无结算 var _reversels = _dapper.GetReverseSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime); + //按照零件号汇总数量,有一列显示寄售库数量 + var stockList = _wmsDapper.GetSalesStock(); + var queryStockList = from itm in _forwardls + join itm1 in stockList on itm.SAP编码 equals itm1.SapCode into temp1 + from tm1 in temp1.DefaultIfEmpty() + select new SettleSparePartExport( + itm.SAP编码, + itm.物料代码, + itm.物料描述, + itm.开票数量, + tm1 == null ? 0 : tm1.Qty + ); + + //var diffList = _dapper.GetSettleSparePartSumQtyDiff(version); //if (diffList != null) @@ -105,7 +122,7 @@ namespace SettleAccount.Job.Services.Report - // _outputService.Export(id, fileName, _ls); + // _outputService.Export(id, fileName, _ls); ExcelExporter _exporter = new ExcelExporter();//导出Excel @@ -113,7 +130,9 @@ namespace SettleAccount.Job.Services.Report .SeparateBySheet() .Append(_forwardls.ToList(), "有结算无发货对比") .SeparateBySheet() - .Append(_reversels.ToList(),"有发货无结算对比") + .Append(_reversels.ToList(), "有发货无结算对比") + .SeparateBySheet() + .Append(queryStockList.ToList(), "零件汇总比对寄售库存") .ExportAppendDataAsByteArray(); result.ShouldNotBeNull(); _fileContainer.SaveAsync(fileName, result.Result, true);