diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/UnHQSettleAccounts/UnHQSettleImportDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/UnHQSettleAccounts/UnHQSettleImportDto.cs index 1a4fff9b..ceb4f942 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/UnHQSettleAccounts/UnHQSettleImportDto.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/UnHQSettleAccounts/UnHQSettleImportDto.cs @@ -17,7 +17,7 @@ namespace Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts /// ///外部看板编号 /// - [ImporterHeader(Name = "外部看板编号")] + [ImporterHeader(Name = "外部单号")] public string ExternalKanbanNumber { get; set; } /// ///看板编号 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs index 775d2a02..92c75356 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs @@ -245,6 +245,9 @@ namespace Win.Sfs.SettleAccount.Entities.Wms //物料组(车型) public string MaterialGroup { set; get; } + [ImporterHeader(Name = "状态", IsIgnore = true)] + public int State { set; get; } + diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/UnHQSettleAccounts/UnHQSettleAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/UnHQSettleAccounts/UnHQSettleAppService.cs index f8413cc9..3a4aec7d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/UnHQSettleAccounts/UnHQSettleAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/UnHQSettleAccounts/UnHQSettleAppService.cs @@ -86,12 +86,13 @@ namespace Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts public async Task UnHQSettleUploadExcelImport([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 result_org = await _exportImporter.UploadExcelImport(files, _excelImportService); - if (result == null || result.Count == 0) + if (result_org == null || result_org.Count == 0) { throw new BusinessException("导入模板数据不能为空!"); } + var result = result_org.Where(p => p.Factory != "L").ToList();//去掉工厂L var entityList = ObjectMapper.Map, List>(result); //删除版本 diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWKanBan/VWKanBanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWKanBan/VWKanBanAppService.cs index 29c81593..7a570e4d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWKanBan/VWKanBanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/VWKanBan/VWKanBanAppService.cs @@ -304,6 +304,7 @@ namespace Win.Sfs.SettleAccount.Entities.VWKanBan /// [HttpPost] [Route("listversion")] + [Authorize(SettleAccountPermissions.VWKanBan.Default)] public async Task> GetVersionListAsync(VWKanBanVersionRequestDto input) { var entities = await _versionRepository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs index 121fa061..b265ce18 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs @@ -145,6 +145,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { //不用传version 单号能保证唯一 input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum }); + //input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "State", Logic = EnumFilterLogic.And, Value = input.State.ToString() }); + var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs index ae3c0664..04a978f4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs @@ -145,6 +145,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts { //不用传version 单号能保证唯一 input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "BillNum", Logic = EnumFilterLogic.And, Value = input.BillNum }); + //input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "State", Logic = EnumFilterLogic.And, Value = input.State.ToString() }); var entities = await _wmsRepository.GetListByFilterAsync(GuidGenerator.Create(), input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs index beb247d0..0d25a824 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs @@ -27,22 +27,22 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report /// /// /// - public virtual List GetHQFactoryDetailDiffReportList(string version, string materialCode, + public virtual List GetHQFactoryDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup, string iscontionversion) { - List _list = new List(); + 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); - //} + 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 contion = string.Empty; //选中,是否过滤掉当期结算数据 @@ -55,169 +55,343 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report contion += " WHERE 1=1 "; } - string str = "SELECT\n" + - " temp3.HQHKanBan 订货看板编号,\n" + - " temp3.MaterialCode Sap编码,\n" + - " temp3.hqMaterialCode 客户物料号,\n" + - " temp3.EstimateTypeDesc 物料组,\n" + - " temp3.MaterialDesc 零件中文名称,\n" + - " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + - " temp3.发货数量,\n" + - " temp3.结算数量,\n" + - " temp3.退货数量,\n" + - " temp3.系统未结数量,\n" + - " temp3.UnHQQty 红旗未结数量,\n" + - " ( ISNULL( temp3.系统未结数量, 0 ) - ISNULL( temp3.UnHQQty, 0 ) ) 差异 \n" + - "FROM\n" + - " (\n" + - " SELECT\n" + - " * \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " h.HQHKanBan,\n" + - " m.MaterialCode,\n" + - " h.MaterialCode hqMaterialCode,\n" + - " m.CustomerPartCode,\n" + - " m.MaterialDesc,\n" + - " m.EstimateTypeDesc,\n" + - " ISNULL( h.Qty, 0 ) AS UnHQQty \n" + - " FROM\n" + - " ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount GROUP BY HQHKanBan, MaterialCode ) AS h\n" + - " LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" + - " ) AS unhq\n" + - " LEFT JOIN (\n" + - " SELECT\n" + - " * \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " isnull( temp1.交货单号, '' ) 交货单号,\n" + - " NULL 交货时间,\n" + - " temp1.订货看板编号,\n" + - " temp1.订货零件号,\n" + - " temp1.Sap编码,\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" + - " isnull( tt.Qty, 0 ) 退货数量,\n" + - " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " '' AS 交货单号,\n" + - " a.Kanban AS 订货看板编号,\n" + - " b.MaterialCode AS 订货零件号,\n" + - " c.MaterialCode Sap编码,\n" + - " c.CustomerPartCode 客户物料号,\n" + - " c.MaterialDesc AS 零件中文名称,\n" + - " isnull( a.Qty, 0 ) AS 发货数量,\n" + - " '' AS 外部单号,\n" + - " isnull( b.Qty, 0 ) AS 结算数量,\n" + - " C.EstimateTypeDesc AS 物料组 \n" + - " FROM\n" + - " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" + - " LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + - " AND a.MaterialCode = b.MaterialCode\n" + - " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + - " WHERE\n" + - " b.HQHKanBan IS NULL \n" + - " AND b.MaterialCode IS NULL \n" + - " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + - " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + - " AND temp1.订货看板编号 = tt.Code \n" + - " ) UNION1 UNION ALL\n" + - " SELECT\n" + - " * \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " isnull( temp1.交货单号, '' ) 交货单号,\n" + - " NULL 交货时间,\n" + - " temp1.订货看板编号,\n" + - " temp1.订货零件号,\n" + - " temp1.Sap编码,\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" + - " isnull( tt.Qty, 0 ) 退货数量,\n" + - " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + - " FROM\n" + - " (\n" + - " SELECT\n" + - " '' AS 交货单号,\n" + - " a.Kanban AS 订货看板编号,\n" + - " b.MaterialCode AS 订货零件号,\n" + - " c.MaterialCode Sap编码,\n" + - " c.CustomerPartCode 客户物料号,\n" + - " c.MaterialDesc AS 零件中文名称,\n" + - " isnull( a.Qty, 0 ) AS 发货数量,\n" + - " '' AS 外部单号,\n" + - " isnull( b.Qty, 0 ) AS 结算数量,\n" + - " C.EstimateTypeDesc AS 物料组 \n" + - " FROM\n" + - " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" + - " INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + - " AND a.MaterialCode = b.MaterialCode\n" + - " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + - " WHERE\n" + - " a.Qty> b.Qty \n" + - " ) AS temp1\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + - " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + - " AND temp1.订货看板编号 = tt.Code \n" + - " ) UNION2 \n" + - " ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" + - " AND unhq.CustomerPartCode= temp1.客户物料号 WHERE temp1.[订货看板编号] is null and temp1.客户物料号 is null \n" + - " ) temp3\n" + - " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode"; - - - var _sql = string.Format(str,version, contion); - + string conditionDate = ""; - var sql2 = "SELECT\n" + - " a.WmsBillNum,\n" + - " t1.MaterialCode MaterialCode,\n" + - " a.Kanban ,\n" + - " A.LastModificationTime WmsDate \n" + - "FROM\n" + - " Set_HQ_H_Kanban A\n" + - " INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT(*)> 1 ) B ON A.Kanban = B.Kanban \n" + - " AND A.MaterialCode = B.MaterialCode " + - " left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode "; + if (!string.IsNullOrEmpty(begin)) + { + conditionDate += string.Format(" and LastModificationTime>='{0}' ", begin); + } + if (!string.IsNullOrEmpty(end)) + { + conditionDate += string.Format(" and LastModificationTime<='{0}' ", end); + } - var listCompare = DbConnection.Query(sql2); + #region + //string str = "SELECT\n" + + // " temp3.HQHKanBan 订货看板编号, temp3.ExternalKanbanNumber 外部单号,\n" + + // " temp3.MaterialCode Sap编码,\n" + + // " temp3.hqMaterialCode 客户物料号,\n" + + // " temp3.EstimateTypeDesc 物料组,\n" + + // " temp3.MaterialDesc 零件中文名称,\n" + + // " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + + // " temp3.发货数量,\n" + + // " temp3.结算数量,\n" + + // " temp3.退货数量,\n" + + // " temp3.系统未结数量,\n" + + // " temp3.UnHQQty 红旗未结数量,\n" + + // " ( ISNULL( temp3.系统未结数量, 0 ) - ISNULL( temp3.UnHQQty, 0 ) ) 差异 \n" + + // "FROM\n" + + // " (\n" + + // " SELECT\n" + + // " * \n" + + // " FROM\n" + + // " (\n" + + // " SELECT\n" + + // " h.HQHKanBan, h.ExternalKanbanNumber, \n" + + // " m.MaterialCode,\n" + + // " h.MaterialCode hqMaterialCode,\n" + + // " m.CustomerPartCode,\n" + + // " m.MaterialDesc,\n" + + // " m.EstimateTypeDesc,\n" + + // " ISNULL( h.Qty, 0 ) AS UnHQQty \n" + + // " FROM\n" + + // " ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode,ExternalKanbanNumber FROM Set_UnHQSettleAccount WHERE Version ='{0}' GROUP BY HQHKanBan, MaterialCode,ExternalKanbanNumber ) AS h\n" + + // " LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" + + // " ) AS unhq\n" + + // " LEFT JOIN (\n" + + // " SELECT\n" + + // " * \n" + + // " FROM\n" + + // " (\n" + + // " SELECT\n" + + // " isnull( temp1.交货单号, '' ) 交货单号,\n" + + // " NULL 交货时间,\n" + + // " temp1.订货看板编号,\n" + + // " temp1.订货零件号,\n" + + // " temp1.Sap编码,\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" + + // " isnull( tt.Qty, 0 ) 退货数量,\n" + + // " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + + // " FROM\n" + + // " (\n" + + // " SELECT\n" + + // " '' AS 交货单号,\n" + + // " a.Kanban AS 订货看板编号,\n" + + // " b.MaterialCode AS 订货零件号,\n" + + // " c.MaterialCode Sap编码,\n" + + // " c.CustomerPartCode 客户物料号,\n" + + // " c.MaterialDesc AS 零件中文名称,\n" + + // " isnull( a.Qty, 0 ) AS 发货数量,\n" + + // " '' AS 外部单号,\n" + + // " isnull( b.Qty, 0 ) AS 结算数量,\n" + + // " C.EstimateTypeDesc AS 物料组 \n" + + // " FROM\n" + + // " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {2} GROUP BY kanban, MaterialCode ) AS a\n" + + // " LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + + // " AND a.MaterialCode = b.MaterialCode\n" + + // " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + // " WHERE\n" + + // " b.HQHKanBan IS NULL \n" + + // " AND b.MaterialCode IS NULL \n" + + // " ) AS temp1\n" + + // " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + + // " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + + // " AND temp1.订货看板编号 = tt.Code \n" + + // " ) UNION1 UNION ALL\n" + + // " SELECT\n" + + // " * \n" + + // " FROM\n" + + // " (\n" + + // " SELECT\n" + + // " isnull( temp1.交货单号, '' ) 交货单号,\n" + + // " NULL 交货时间,\n" + + // " temp1.订货看板编号,\n" + + // " temp1.订货零件号,\n" + + // " temp1.Sap编码,\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" + + // " isnull( tt.Qty, 0 ) 退货数量,\n" + + // " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + + // " FROM\n" + + // " (\n" + + // " SELECT\n" + + // " '' AS 交货单号,\n" + + // " a.Kanban AS 订货看板编号,\n" + + // " b.MaterialCode AS 订货零件号,\n" + + // " c.MaterialCode Sap编码,\n" + + // " c.CustomerPartCode 客户物料号,\n" + + // " c.MaterialDesc AS 零件中文名称,\n" + + // " isnull( a.Qty, 0 ) AS 发货数量,\n" + + // " '' AS 外部单号,\n" + + // " isnull( b.Qty, 0 ) AS 结算数量,\n" + + // " C.EstimateTypeDesc AS 物料组 \n" + + // " FROM\n" + + // " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {2} GROUP BY kanban, MaterialCode ) AS a\n" + + // " INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + + // " AND a.MaterialCode = b.MaterialCode\n" + + // " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + // " WHERE\n" + + // " a.Qty> b.Qty \n" + + // " ) AS temp1\n" + + // " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + + // " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + + // " AND temp1.订货看板编号 = tt.Code \n" + + // " ) UNION2 \n" + + // " ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" + + // " AND unhq.CustomerPartCode= temp1.客户物料号 WHERE temp1.[订货看板编号] is null and temp1.客户物料号 is null \n" + + // " ) temp3\n" + + // " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode"; + #endregion + + //temp3.HQHKanBan 订货看板编号 temp3.ExternalKanbanNumber 外部单号 + string str = "SELECT\n" + + " temp3.HQHKanBan 订货看板编号,\n" + + " temp3.Factory 工厂,temp3.StorageLocationDesc 存储地点描述,\n" + + " '' 外部单号,\n" + + " temp3.MaterialCode Sap编码,\n" + + " temp3.hqMaterialCode 客户物料号,\n" + + " temp3.EstimateTypeDesc 物料组,\n" + + " temp3.MaterialDesc 零件中文名称,\n" + + " isnull( temp3.Qty, 0 ) 结算数量 ,\n" + + " isnull( temp3.Qty, 0 ) 结算单价,\n" + + " isnull( temp3.Qty, 0 ) * isnull( temp3.Qty, 0 ) 结算金额,\n" + + " temp3.系统未结数量,\n" + + " temp3.UnHQQty 红旗未结数量,\n" + + " ( ISNULL( temp3.系统未结数量, 0 ) - ISNULL( temp3.UnHQQty, 0 ) ) 数量差异 \n" + + "FROM\n" + + " (\n" + + " SELECT\n" + + " * \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " h.HQHKanBan,\n" + + " h.Qty,\n" + + " h.Price,\n" + + " h.Factory,h.StorageLocationDesc,\n" + + " m.MaterialCode,\n" + + " h.MaterialCode hqMaterialCode,\n" + + " m.CustomerPartCode,\n" + + " m.MaterialDesc,\n" + + " m.EstimateTypeDesc,\n" + + " ISNULL( h.Qty, 0 ) AS UnHQQty \n" + + " FROM\n" + + " (\n" + + " SELECT SUM\n" + + " ( Qty ) Qty,\n" + + " HQHKanBan,\n" + + " MaterialCode,\n" + + " Price,Factory,StorageLocationDesc \n" + + " FROM\n" + + " Set_UnHQSettleAccount \n" + + " WHERE\n" + + " Version = '{0}' \n" + + " GROUP BY\n" + + " HQHKanBan,\n" + + " MaterialCode,\n" + + " Price,Factory,StorageLocationDesc \n" + + " ) AS h\n" + + " LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" + + " ) AS unhq\n" + + " LEFT JOIN (\n" + + " SELECT\n" + + " * \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " isnull( temp1.交货单号, '' ) 交货单号,\n" + + " NULL 交货时间,\n" + + " temp1.订货看板编号,\n" + + " temp1.订货零件号,\n" + + " temp1.Sap编码,\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" + + " isnull( tt.Qty, 0 ) 退货数量,\n" + + " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " '' AS 交货单号,\n" + + " a.Kanban AS 订货看板编号,\n" + + " b.MaterialCode AS 订货零件号,\n" + + " c.MaterialCode Sap编码,\n" + + " c.CustomerPartCode 客户物料号,\n" + + " c.MaterialDesc AS 零件中文名称,\n" + + " isnull( a.Qty, 0 ) AS 发货数量,\n" + + " '' AS 外部单号,\n" + + " isnull( b.Qty, 0 ) AS 结算数量,\n" + + " C.EstimateTypeDesc AS 物料组 \n" + + " FROM\n" + + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1 = 1 {2} GROUP BY kanban, MaterialCode ) AS a\n" + + " LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + + " AND a.MaterialCode = b.MaterialCode\n" + + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + " WHERE\n" + + " b.HQHKanBan IS NULL \n" + + " AND b.MaterialCode IS NULL \n" + + " ) AS temp1\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + + " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + + " AND temp1.订货看板编号 = tt.Code \n" + + " ) UNION1 UNION ALL\n" + + " SELECT\n" + + " * \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " isnull( temp1.交货单号, '' ) 交货单号,\n" + + " NULL 交货时间,\n" + + " temp1.订货看板编号,\n" + + " temp1.订货零件号,\n" + + " temp1.Sap编码,\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" + + " isnull( tt.Qty, 0 ) 退货数量,\n" + + " isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量 \n" + + " FROM\n" + + " (\n" + + " SELECT\n" + + " '' AS 交货单号,\n" + + " a.Kanban AS 订货看板编号,\n" + + " b.MaterialCode AS 订货零件号,\n" + + " c.MaterialCode Sap编码,\n" + + " c.CustomerPartCode 客户物料号,\n" + + " c.MaterialDesc AS 零件中文名称,\n" + + " isnull( a.Qty, 0 ) AS 发货数量,\n" + + " '' AS 外部单号,\n" + + " isnull( b.Qty, 0 ) AS 结算数量,\n" + + " C.EstimateTypeDesc AS 物料组 \n" + + " FROM\n" + + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1 = 1 {2} GROUP BY kanban, MaterialCode ) AS a\n" + + " INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + + " AND a.MaterialCode = b.MaterialCode\n" + + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + + " WHERE\n" + + " a.Qty> b.Qty \n" + + " ) AS temp1\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + + " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + + " AND temp1.订货看板编号 = tt.Code \n" + + " ) UNION2 \n" + + " ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" + + " AND unhq.CustomerPartCode= temp1.客户物料号 \n" + + " WHERE\n" + + " temp1.[订货看板编号] IS NULL \n" + + " AND temp1.客户物料号 IS NULL \n" + + " ) temp3\n" + + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode"; + + + var _sql = string.Format(str,version, contion,conditionDate); + + + + ////发运数据中,查出看板号+物料号相同的重复数据 + //var sql2 = "SELECT\n" + + // " a.WmsBillNum,\n" + + // " t1.MaterialCode MaterialCode,\n" + + // " a.Kanban ,\n" + + // " A.LastModificationTime WmsDate \n" + + // "FROM\n" + + // " Set_HQ_H_Kanban A\n" + + // " INNER JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT ( * ) > 1 ) B ON A.Kanban = B.Kanban \n" + + // " AND A.MaterialCode = B.MaterialCode\n" + + // " LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n" + + // "WHERE\n" + + // " 1 = 1 {0}"; + //var _sql2 = string.Format(sql2, condition); + //var listCompare = DbConnection.Query(_sql2); + + + + + ////查询发运表中,看板号+物料号没有重复的数据 + //var sql3 = "SELECT\n" + + //" a.WmsBillNum,\n" + + //" t1.MaterialCode MaterialCode,\n" + + //" a.Kanban,\n" + + //" A.LastModificationTime WmsDate \n" + + //"FROM\n" + + //" Set_HQ_H_Kanban A\n" + + //" LEFT JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT(*)> 1 ) B ON A.Kanban = B.Kanban \n" + + //" AND A.MaterialCode = B.MaterialCode \n" + + //" left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode \n" + + + //"WHERE\n" + + //" B.Kanban IS NULL {0} "; + //var _sql3 = string.Format(sql3, condition); + //var listCompare1 = DbConnection.Query(_sql3); - var sql3 = "SELECT\n" + - " a.WmsBillNum,\n" + - " t1.MaterialCode MaterialCode,\n" + - " a.Kanban,\n" + - " A.LastModificationTime WmsDate \n" + - "FROM\n" + - " Set_HQ_H_Kanban A\n" + - " LEFT JOIN ( SELECT MaterialCode, Kanban FROM Set_HQ_H_Kanban GROUP BY MaterialCode, Kanban HAVING COUNT(*)> 1 ) B ON A.Kanban = B.Kanban \n" + - " AND A.MaterialCode = B.MaterialCode \n" + - " left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode \n" + - "WHERE\n" + - " B.Kanban IS NULL"; - var listCompare1 = DbConnection.Query(sql3); var sql10 = "SELECT DISTINCT\n" + @@ -323,7 +497,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report var first = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm.HQHKanBan && p.MaterialCode == itm.MaterialCode); if (first != null) { - //first.KanbanNumber += "," + itm.KanbanNumber; + first.HQHKanBan += "," + itm.HQHKanBan; //first.AcceptanceDate += "," + itm.AcceptanceDate; first.ExternalKanbanNumber += "," + itm.ExternalKanbanNumber; } @@ -342,57 +516,57 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } - List _ls = new List(); - foreach (var itm in listCompare.ToList()) - { - var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode); - if (first != null) - { - if (!string.IsNullOrEmpty(itm.WmsDate)) - { - itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); - } - - first.WmsBillNum += "," + itm.WmsBillNum; - first.WmsDate += "," + itm.WmsDate; - } - else - { - if (!string.IsNullOrEmpty(itm.WmsDate)) - { - itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); - } - _ls.Add(itm); - } + //List _ls = new List(); + //foreach (var itm in listCompare.ToList()) + //{ + // var first = _ls.FirstOrDefault(p => p.Kanban == itm.Kanban && p.MaterialCode == itm.MaterialCode); + // if (first != null) + // { + // if (!string.IsNullOrEmpty(itm.WmsDate)) + // { + // itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); + // } + + // first.WmsBillNum += "," + itm.WmsBillNum; + // first.WmsDate += "," + itm.WmsDate; + // } + // else + // { + // if (!string.IsNullOrEmpty(itm.WmsDate)) + // { + // itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); + // } + // _ls.Add(itm); + // } - } + //} - foreach (var itm in listCompare1.ToList()) - { - if (!string.IsNullOrEmpty(itm.WmsDate)) - { - itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); - } - _ls.Add(itm); - } + //foreach (var itm in listCompare1.ToList()) + //{ + // if (!string.IsNullOrEmpty(itm.WmsDate)) + // { + // itm.WmsDate = DateTime.Parse(itm.WmsDate).ToShortDateString(); + // } + // _ls.Add(itm); + //} - var _query = DbConnection.Query(_sql, null, null, true, 1200, null); + var _query = DbConnection.Query(_sql, null, null, true, 1200, null); _list = _query.ToList(); foreach (var itm1 in _list) { - var itm = _ls.FirstOrDefault(p => p.Kanban == itm1.订货看板编号 && p.MaterialCode == itm1.Sap编码); - if (itm != null) - { - itm1.交货单号 = itm.WmsBillNum; - itm1.交货时间 = itm.WmsDate; - } + //var itm = _ls.FirstOrDefault(p => p.Kanban == itm1.订货看板编号 && p.MaterialCode == itm1.Sap编码); + //if (itm != null) + //{ + // itm1.交货单号 = itm.WmsBillNum; + // itm1.交货时间 = itm.WmsDate; + //} var itmcopy = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm1.订货看板编号 && p.MaterialCode == itm1.Sap编码); if (itmcopy != null) { - //itm1.看板编号 = itmcopy.KanbanNumber; + itm1.订货看板编号 = itmcopy.HQHKanBan; //itm1.验收单日期 = itmcopy.AcceptanceDate; itm1.外部单号 = itmcopy.ExternalKanbanNumber; } @@ -441,7 +615,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report { contion += " WHERE 1=1 "; } - + + string conditionDate = ""; + + if (!string.IsNullOrEmpty(begin)) + { + conditionDate += string.Format(" and LastModificationTime>='{0}' ", begin); + } + if (!string.IsNullOrEmpty(end)) + { + conditionDate += string.Format(" and LastModificationTime<='{0}' ", end); + } + string str = "SELECT\n" + @@ -455,11 +640,13 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " temp.零件中文名称,\n" + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + " temp.发货数量,\n" + + " isnull( TEMP2.Price, 0 )*isnull(temp.发货数量, 0 ) 系统未结总金额,\n" + " temp.结算数量,\n" + " temp.退货数量,\n" + + " temp3.Factory AS 工厂,temp3.ExternalKanbanNumber 外部单号,temp3.StorageLocationDesc 存储地点描述,\n" + " ISNULL( temp.系统未结数量, 0 ) 系统未结数量,\n" + " isnull( temp3.Qty, 0 ) AS 红旗未结数量,\n" + - " ( ISNULL( temp.系统未结数量, 0 ) - ISNULL( temp3.Qty, 0 ) ) 差异 \n" + + " ( ISNULL( temp.系统未结数量, 0 ) - ISNULL( temp3.Qty, 0 ) ) 数量差异 \n" + "FROM\n" + " (\n" + " SELECT\n" + @@ -492,12 +679,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " c.CustomerPartCode 客户物料号,\n" + " c.MaterialDesc AS 零件中文名称,\n" + " isnull( a.Qty, 0 ) AS 发货数量,\n" + - " '' AS 外部单号,\n" + + " b.ExternalKanbanNumber AS 外部单号,\n" + " isnull( b.Qty, 0 ) AS 结算数量,\n" + " C.EstimateTypeDesc AS 物料组 \n" + " FROM\n" + - " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" + - " LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {0} GROUP BY kanban, MaterialCode ) AS a\n" + + " LEFT OUTER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode,ExternalKanbanNumber FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode,ExternalKanbanNumber ) AS b ON a.Kanban = b.HQHKanBan \n" + " AND a.MaterialCode = b.MaterialCode\n" + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " WHERE\n" + @@ -505,7 +692,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND b.MaterialCode IS NULL \n" + " ) AS temp1\n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + - " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + + " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION1 UNION ALL\n" + " SELECT\n" + @@ -542,7 +729,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " isnull( b.Qty, 0 ) AS 结算数量,\n" + " C.EstimateTypeDesc AS 物料组 \n" + " FROM\n" + - " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode ) AS a\n" + + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {0} GROUP BY kanban, MaterialCode ) AS a\n" + " INNER JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_HQ_H_Platform {1} GROUP BY HQHKanBan, MaterialCode ) AS b ON a.Kanban = b.HQHKanBan \n" + " AND a.MaterialCode = b.MaterialCode\n" + " LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + @@ -550,17 +737,17 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " a.Qty> b.Qty \n" + " ) AS temp1\n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" + - " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) tt ON temp1.Sap编码 = tt.MaterialCode \n" + + " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" + " AND temp1.订货看板编号 = tt.Code \n" + " ) UNION2 \n" + " ) AS temp\n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp.Sap编码 = TEMP2.MaterialCode\n" + - " LEFT JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount GROUP BY HQHKanBan, MaterialCode ) temp3 ON temp.[订货看板编号] = temp3.HQHKanBan \n" + + " LEFT JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode,ExternalKanbanNumber,Factory,StorageLocationDesc FROM Set_UnHQSettleAccount WHERE Version ='{2}' GROUP BY HQHKanBan, MaterialCode,ExternalKanbanNumber,Factory,StorageLocationDesc ) temp3 ON temp.[订货看板编号] = temp3.HQHKanBan \n" + " AND temp.[客户物料号] = temp3.MaterialCode"; - var _sql = string.Format(str, version,contion); + var _sql = string.Format(str, conditionDate, contion,version); @@ -686,15 +873,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public string 交货单号 { set; get; } [ExporterHeader(DisplayName = "交货时间")] public string 交货时间 { set; get; } - [ExporterHeader(DisplayName = "收货仓库", IsIgnore = true)] - public string 收货仓库 { set; get; } - [ExporterHeader(DisplayName = "收货仓库描述", IsIgnore = true)] - public string 收货仓库描述 { set; get; } + [ExporterHeader(DisplayName = "订货看板编号")] public string 订货看板编号 { set; get; } - - [ExporterHeader(DisplayName = "结算验收单号", IsIgnore = true)] - public string 结算验收单号 { set; get; } + + [ExporterHeader(DisplayName = "工厂")] + public string 工厂 { set; get; } + + [ExporterHeader(DisplayName = "存储地点描述")] + public string 存储地点描述 { set; get; } [ExporterHeader(DisplayName = "外部单号")] public string 外部单号 { set; get; } @@ -711,29 +898,90 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report [ExporterHeader(DisplayName = "物料组")] public string 物料组 { set; get; } - [ExporterHeader(DisplayName = "验收单日期",IsIgnore =true)] - public string 验收单日期 { set; get; } - [ExporterHeader(DisplayName = "发货定价")] public decimal 发货定价 { set; get; } - [ExporterHeader(DisplayName = "金额")] - public decimal 金额 { set; get; } + [ExporterHeader(DisplayName = "发货数量")] public decimal 发货数量 { set; get; } - [ExporterHeader(DisplayName = "结算数量")] - public decimal 结算数量 { set; get; } + + [ExporterHeader(DisplayName = "退货数量")] public decimal 退货数量 { set; get; } + + [ExporterHeader(DisplayName = "系统未结总金额")] + public decimal 系统未结总金额 { set; get; } + + [ExporterHeader(DisplayName = "系统未结数量")] public decimal 系统未结数量 { set; get; } + + [ExporterHeader(DisplayName = "结算数量")] + public decimal 结算数量 { set; get; } + [ExporterHeader(DisplayName = "红旗未结数量")] public decimal 红旗未结数量 { set; get; } - [ExporterHeader(DisplayName = "差异")] - public decimal 差异 { set; get; } + [ExporterHeader(DisplayName = "数量差异")] + public decimal 数量差异 { set; get; } + + + + + + } + + + /// + /// 红旗主机厂比对红旗未结 + /// + public class HQSettledUnFactoryDetailDiff + { - [ExporterHeader(DisplayName = "工厂", IsIgnore = true)] + + [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 = "Sap编码")] + public string Sap编码 { 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 = "系统未结数量")] + public decimal 系统未结数量 { set; get; } + [ExporterHeader(DisplayName = "红旗未结数量")] + public decimal 红旗未结数量 { set; get; } + [ExporterHeader(DisplayName = "数量差异")] + public decimal 差异 { set; get; } + + + } diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs index ca871349..a9540a15 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/KanbanUnSettledDapperRepository.cs @@ -81,7 +81,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report public decimal WMSDeliveryQty { set; get; } [ExporterHeader(DisplayName = "退货数量")] public decimal BackQty { set; get; } - [ExporterHeader(DisplayName = "量差")] + [ExporterHeader(DisplayName = "实际发货数量")] public decimal DiffQty { set; get; } @@ -204,7 +204,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND A.MaterialCode = B.MaterialCode\n" + " LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" + " LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" + - " AND a.MaterialCode = tt.MaterialCode \n" + + " AND c.MaterialCode = tt.MaterialCode \n" + " WHERE\n" + " B.Kanban IS NULL \n" + " AND B.MaterialCode IS NULL \n" + @@ -239,15 +239,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " AND A.MaterialCode = B.MaterialCode\n" + " LEFT JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode\n" + " LEFT JOIN set_backQty AS tt ON a.Kanban = tt.Code \n" + - " AND a.MaterialCode = tt.MaterialCode \n" + + " AND c.MaterialCode = tt.MaterialCode \n" + " WHERE\n" + - " a.WMSDeliveryQty> B.Qty \n" + + " a.WMSDeliveryQty> B.Qty AND (a.WMSDeliveryQty-tt.Qty)!=B.Qty \n" + " ) TEMP1\n" + " LEFT JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) TEMP2 ON TEMP1.SapCode = TEMP2.MaterialCode \n" + " ) UNION2"; + //财务香凝要求:交货数量-退货数量=结算数量 这样的不体现在未结中 - sql = string.Format(sql,contion,strDate); 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 6ee6a29d..2002acfd 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 @@ -121,7 +121,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " ) C ON A.PurchaseOrderNo = C.PurchaseOrderNo \n" + " AND A.MaterialCode = C.MaterialCode \n" + " ) AS temp1\n" + - " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" + + " LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" + " AND temp1.SAP编码= temp3.MaterialCode\n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode\n" + " LEFT JOIN (\n" + @@ -456,7 +456,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report " WHERE\n" + " C.PurchaseOrderNo is null and C.MaterialCode is NULL\n" + " ) AS temp1\n" + - " LEFT JOIN ( SELECT * FROM set_backQty WHERE Version = '{0}' ) temp3 ON temp1.采购订单号 = temp3.Code \n" + + " LEFT JOIN ( SELECT * FROM set_backQty ) temp3 ON temp1.采购订单号 = temp3.Code \n" + "AND temp1.SAP编码= temp3.MaterialCode\n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode"; diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs index c97a2840..5eaa591e 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/KanBanUnSettledExport.cs @@ -47,6 +47,9 @@ namespace SettleAccount.Job.Services.Report var _ls = _dapper.GetKanbanReportList(version, begin, end, iscontionversion); + //财务香凝要求:交货数量-退货数量=结算数量 这样的不体现在未结中 + //_ls = _ls.Where(p => p.DiffQty != 0).ToList(); + //有发货有结算,且发货数量大于结算 var _ls_wmskanban = _dapper.GetWMSKanbanReportList(version, begin, end, iscontionversion);