diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs index deab4a71..cfb10e36 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs @@ -59,29 +59,29 @@ namespace Win.Sfs.SettleAccount.Entities.Prices [Display(Name = "版本")] [ExporterHeader(DisplayName = "版本")] public string Version { set; get; } - [ImporterHeader(Name = "有效从")] + [ExporterHeader(DisplayName = "有效从")] public DateTime BeginDate { get; set; } /// ///结算时间 /// - [ImporterHeader(Name = "有效到")] + [ExporterHeader(DisplayName = "有效到")] public DateTime EndDate { get; set; } /// ///价格 /// - [ImporterHeader(Name = "*金额")] + [ExporterHeader(DisplayName = "*金额")] public decimal Price { get; set; } /// ///物料编号 /// - [ImporterHeader(Name = "*物料编码")] + [ExporterHeader(DisplayName = "*物料编码")] public string MaterialCode { get; set; } /// ///价格类型 /// - [ImporterHeader(Name = "*分销渠道")] + [ExporterHeader(DisplayName = "*分销渠道")] public int Type { get; set; } - [ImporterHeader(Name = "*客户")] + [ExporterHeader(DisplayName = "*客户")] public string CustomerCode { get; set; } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs index 43406cd1..2fd44524 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/HQ_F/HQ_F_PlatformAppService.cs @@ -28,7 +28,7 @@ namespace Win.Sfs.SettleAccount.Entities.HQ_F /// /// 红旗F平台导入 /// - [Authorize(SettleAccountPermissions.HQ_FPlatform.Default)] + //[Authorize(SettleAccountPermissions.HQ_FPlatform.Default)] //[AllowAnonymous] [Route("api/settleaccount/HQFPlatform")] public class HQ_F_PlatformAppService : SettleAccountApplicationBase, IHQ_F_PlatformAppService diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs index c2cb1a15..bb0a728c 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs @@ -39,7 +39,8 @@ using Win.Utils; namespace Win.Sfs.SettleAccount.Entities.TaskJobs { - [Authorize(SettleAccountPermissions.Reports.Default)] + //调整权限-派格张影导入数据时此模块她要看 + [Authorize(SettleAccountPermissions.HQ_FPlatform.Default)] //[AllowAnonymous] [Route("api/settleaccount/Job")] public class JobAppService: ApplicationService 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 06602b29..713cde98 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 @@ -628,6 +628,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report /// /// 大众备件未结(带单号),包含有发货有结算(条件:发货数量大于结算数据)也整合到大众备件未结中 + /// 用于--寄售未结比对WMS库存 /// /// /// @@ -1077,7 +1078,261 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report } + /// + /// 大众备件未结(带单号),包含有发货有结算(条件:发货数量大于结算数据)也整合到大众备件未结中 + /// + /// + /// + /// + /// + /// + /// + /// + public virtual List GetReverseWithCodeSettleSparePartReportList_unsettle(string purchaseOrderNo, string version, string sapCode, string matialCode, + string begintime, string endtime) + { + List _list = new List(); + + string condition = ""; + + //if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue) + //{ + // condition += string.Format(" and a.SpareDate>='{0}' ", begintime); + //} + //if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue) + //{ + // condition += string.Format(" and a.SpareDate<='{0}' ", endtime); + //} + + string conditionDate = ""; + if (!string.IsNullOrEmpty(begintime) && Convert.ToDateTime(begintime) != DateTime.MinValue) + { + conditionDate += string.Format(" and SpareDate>='{0}' ", begintime); + } + if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue) + { + conditionDate += string.Format(" and SpareDate<='{0}' ", endtime); + } + //第三次更改,财务又要求把有发货有结算,发货数量 大于 结算数量 加上 + string sqlString = "SELECT\n" + +" * \n" + +"FROM\n" + +" (\n" + +" SELECT\n" + +" temp1.交货单号,\n" + +" temp1.交货日期,\n" + +" temp1.采购订单号,\n" + +" temp1.SAP编码,\n" + +" temp1.物料代码,\n" + +" temp1.物料描述,\n" + +" temp1.发货数量,\n" + +" temp1.开票数量,\n" + +" temp1.收货与交货差异,\n" + +" ISNULL( temp3.Qty, 0 ) 退货数量,\n" + +" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 未结数量,\n" + +" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) 实际发货数量,\n" + +" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" + +" ISNULL( TEMP2.Price, 0 ) * ( ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) ) 实际发货总金额 \n" + +" FROM\n" + +" (\n" + +" SELECT\n" + +" '' AS 交货单号,\n" + +" NULL AS 交货日期,\n" + +" a.PurchaseOrderNo AS 采购订单号,\n" + +" c.MaterialCode AS SAP编码,\n" + +" c.CustomerPartCode AS 物料代码,\n" + +" c.MaterialDesc AS 物料描述,\n" + +" c.EstimateTypeDesc AS 物料组,\n" + +" ISNULL( a.ReceiptQty, 0 ) AS 发货数量,\n" + +" ISNULL( b.Qty, 0 ) AS 开票数量,\n" + +" ( ISNULL( a.ReceiptQty, 0 ) - ISNULL( b.Qty, 0 ) ) AS 收货与交货差异 \n" + +" FROM\n" + +" (\n" + +" SELECT SUM\n" + +" ( ReceiptQty ) AS ReceiptQty,\n" + +" PurchaseOrderNo,\n" + +" MaterialCode,\n" + +" SapCode \n" + +" FROM\n" + +" Set_WMSSparePart \n" + +" WHERE\n" + +" PurchaseOrderNo IS NOT NULL \n" + +" AND PurchaseOrderNo != '' {0}\n" + +" GROUP BY\n" + +" PurchaseOrderNo,\n" + +" MaterialCode,\n" + +" SapCode \n" + +" ) AS a\n" + +" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode\n" + +" LEFT JOIN ( SELECT SUM ( Qty ) Qty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n" + +" AND a.SapCode = b.MaterialCode \n" + +" WHERE\n" + +" b.OrderBillNum IS NULL \n" + +" AND b.MaterialCode IS NULL \n" + +" ) AS temp1\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" + +" ) unint1 UNION ALL\n" + +"SELECT\n" + +" * \n" + +"FROM\n" + +" (\n" + +" SELECT\n" + +" temp1.交货单号,\n" + +" temp1.交货日期,\n" + +" temp1.采购订单号,\n" + +" temp1.SAP编码,\n" + +" temp1.物料代码,\n" + +" temp1.物料描述,\n" + +" temp1.发货数量,\n" + +" temp1.开票数量,\n" + +" temp1.收货与交货差异,\n" + +" ISNULL( temp3.Qty, 0 ) 退货数量,\n" + +" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) 未结数量,\n" + +" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) 实际发货数量,\n" + +" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" + +" ISNULL( TEMP2.Price, 0 ) * (ISNULL( temp1.发货数量, 0 ) - ISNULL( temp3.Qty, 0 ) - ISNULL( temp1.开票数量, 0 ) ) 实际发货总金额 \n" + +" FROM\n" + +" (\n" + +" SELECT\n" + +" '' AS 交货单号,\n" + +" NULL AS 交货日期,\n" + +" a.PurchaseOrderNo AS 采购订单号,\n" + +" c.MaterialCode AS SAP编码,\n" + +" c.CustomerPartCode AS 物料代码,\n" + +" c.MaterialDesc AS 物料描述,\n" + +" c.EstimateTypeDesc AS 物料组,\n" + +" ISNULL( a.ReceiptQty, 0 ) AS 发货数量,\n" + +" ISNULL( b.ReceiptQty, 0 ) AS 开票数量,\n" + +" ( ISNULL( b.ReceiptQty, 0 ) - ISNULL( a.ReceiptQty, 0 ) ) AS 收货与交货差异 \n" + +" FROM\n" + +" (\n" + +" SELECT SUM\n" + +" ( ReceiptQty ) AS ReceiptQty,\n" + +" PurchaseOrderNo,\n" + +" MaterialCode \n" + +" FROM\n" + +" Set_WMSSparePart \n" + +" WHERE\n" + +" PurchaseOrderNo IS NOT NULL \n" + +" AND PurchaseOrderNo != '' {0}\n" + +" GROUP BY\n" + +" PurchaseOrderNo,\n" + +" MaterialCode \n" + +" ) a\n" + +" INNER JOIN ( SELECT SUM ( Qty ) ReceiptQty, OrderBillNum, MaterialCode FROM Set_WmsSharePart90OutPutDetial WHERE State = 2 GROUP BY OrderBillNum, MaterialCode ) AS b ON a.PurchaseOrderNo= b.OrderBillNum \n" + +" AND a.MaterialCode = b.MaterialCode\n" + +" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, CustomerPartCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc, CustomerPartCode ) AS c ON a.MaterialCode = c.CustomerPartCode \n" + +" WHERE\n" + +" a.ReceiptQty> b.ReceiptQty \n" + +" ) AS temp1\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" + +" ) unint2;"; + + + + + string _sql = string.Format(sqlString, conditionDate); + + + + //发运数据中,查出看板号+物料号相同的重复数据 + var sql2 = "SELECT\n" + + " a.WMSDeliveryNote WmsBillNum,\n" + + " t1.MaterialCode MaterialCode,\n" + + " a.PurchaseOrderNo Kanban ,\n" + + " A.SpareDate WmsDate \n" + + "FROM\n" + + " Set_WMSSparePart A\n" + + " INNER JOIN ( SELECT MaterialCode, PurchaseOrderNo FROM Set_WMSSparePart GROUP BY MaterialCode, PurchaseOrderNo HAVING COUNT ( * ) > 1 ) B ON A.PurchaseOrderNo = B.PurchaseOrderNo \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.WMSDeliveryNote WmsBillNum,\n" + + " t1.MaterialCode MaterialCode,\n" + + " a.PurchaseOrderNo Kanban,\n" + + " A.SpareDate WmsDate \n" + + "FROM\n" + + " Set_WMSSparePart A\n" + + " LEFT JOIN ( SELECT MaterialCode, PurchaseOrderNo FROM Set_WMSSparePart GROUP BY MaterialCode, PurchaseOrderNo HAVING COUNT ( * ) > 1 ) B ON A.PurchaseOrderNo = B.PurchaseOrderNo \n" + + " AND A.MaterialCode = B.MaterialCode\n" + + " LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n" + + "WHERE\n" + + " B.PurchaseOrderNo IS NULL {0}"; + var _sql3 = string.Format(sql3, condition); + var listCompare1 = DbConnection.Query(_sql3); + + + + + + //发运数据比较 + 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); + } + + + + 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; + } + } + + + return _list; + + } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs index b6a2a311..2675f8db 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs @@ -103,10 +103,6 @@ namespace SettleAccount.Job.Services.Report return id.ToString(); - - - return id.ToString(); - }