Browse Source

大众备件和红旗轿车

FoShanPG
44673626 3 years ago
parent
commit
29176d6017
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs
  2. 8
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQCarAppService.cs
  3. 31
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  4. 54
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
  5. 123
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleKBWithCodeDapperReportRepository.cs
  6. 170
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  7. 34
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs

2
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSHQHKanbanAppService.cs

@ -447,6 +447,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
, string.Empty , string.Empty
, itm.Qty, , itm.Qty,
itm.PoLine itm.PoLine
,itm.Price
,itm.Amt
); );
_lsCopy.Add(_detail); _lsCopy.Add(_detail);
} }

8
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQCarAppService.cs

@ -151,7 +151,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
itm.Remark, itm.Remark,
itm.Qty, itm.Qty,
tm1 == null ? 0 : tm1.Qty, tm1 == null ? 0 : tm1.Qty,
itm.IsSparePart itm.IsSparePart,
itm.Price,
itm.Amt
); );
@ -223,6 +225,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
p.Qty, p.Qty,
p.StockQty p.StockQty
,p.IsSparePart ,p.IsSparePart
,p.Price
,p.Amt
)); ));
_lst.AddRange(_lsAry.ToArray()); _lst.AddRange(_lsAry.ToArray());
} }
@ -406,6 +410,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
, itm.Qty , itm.Qty
, 0 , 0
,itm.IsSparePart ,itm.IsSparePart
,itm.Price
,itm.Amt
); );
_lsCopy.Add(_detail); _lsCopy.Add(_detail);
} }

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

@ -707,7 +707,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
} }
public WmsHQCarOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode, public WmsHQCarOutPutDetial(Guid id, string wmsBillNum, string orderBillNum, string materialCode,
string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2,
string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty,string issparepart) string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty,string issparepart,decimal price,decimal amt)
{ {
Id = id; Id = id;
WmsBillNum = wmsBillNum; WmsBillNum = wmsBillNum;
@ -728,13 +728,15 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Qty = qty; Qty = qty;
StockQty = stockQty; StockQty = stockQty;
IsSparePart = issparepart; IsSparePart = issparepart;
Price = price;
Amt = amt;
} }
public void SetId(Guid id) public void SetId(Guid id)
{ {
Id = id; Id = id;
} }
[ImporterHeader(Name = "是否备件")] [ImporterHeader(Name = "是否备件", IsIgnore = true)]
public string IsSparePart { set; get; } public string IsSparePart { set; get; }
//交货单号 //交货单号
@ -748,13 +750,13 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
[ImporterHeader(Name = "看板号", IsIgnore = true)] [ImporterHeader(Name = "看板号", IsIgnore = true)]
//KENN号 //KENN号
public string OrderBillNum { set; get; } public string OrderBillNum { set; get; }
[ImporterHeader(Name = "Sap编码")] [ImporterHeader(Name = "SAP编码")]
//物料号 //物料号
public string MaterialCode { set; get; } public string MaterialCode { set; get; }
[ImporterHeader(Name = "结算物料描述")] [ImporterHeader(Name = "物料描述")]
//物料描述 //物料描述
public string MaterialDesc { set; get; } public string MaterialDesc { set; get; }
[ImporterHeader(Name = "物料组(车型)")] [ImporterHeader(Name = "物料组")]
//物料组(车型) //物料组(车型)
public string MaterialGroup { set; get; } public string MaterialGroup { set; get; }
[ImporterHeader(Name = "出库库位", IsIgnore = true)] [ImporterHeader(Name = "出库库位", IsIgnore = true)]
@ -780,8 +782,17 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
/// </summary> /// </summary>
[ImporterHeader(Name = "版本号", IsIgnore = true)] [ImporterHeader(Name = "版本号", IsIgnore = true)]
public string Version { set; get; } public string Version { set; get; }
[ImporterHeader(Name = "结算数量")] [ImporterHeader(Name = "结算数量")]
public decimal Qty { set; get; } public decimal Qty { set; get; }
[ImporterHeader(Name = "结算单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "结算金额")]
public decimal Amt { set; get; }
[ImporterHeader(Name = "单据号", IsIgnore = true)] [ImporterHeader(Name = "单据号", IsIgnore = true)]
public string BillNum { set; get; } public string BillNum { set; get; }
[ImporterHeader(Name = "任务ID", IsIgnore = true)] [ImporterHeader(Name = "任务ID", IsIgnore = true)]
@ -1068,7 +1079,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
{ {
} }
public WmsHQHKanbanOutPutDetial(Guid id, string wmsBillNum, string kanban, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, string poline) public WmsHQHKanbanOutPutDetial(Guid id, string wmsBillNum, string kanban, string materialCode, string materialDesc, string materialGroup,
string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode, string billNum,
Guid taskId, string remark, decimal qty, string poline,decimal price,decimal amt)
{ {
Id = id; Id = id;
WmsBillNum = wmsBillNum; WmsBillNum = wmsBillNum;
@ -1088,6 +1101,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Remark = remark; Remark = remark;
Qty = qty; Qty = qty;
PoLine = poline; PoLine = poline;
Price = price;
Amt = amt;
} }
public void SetData(Guid id, string remark, string wmsbillnum, string version, Guid taskId) public void SetData(Guid id, string remark, string wmsbillnum, string version, Guid taskId)
{ {
@ -1147,6 +1162,10 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public string Version { set; get; } public string Version { set; get; }
[ImporterHeader(Name = "结算数量")] [ImporterHeader(Name = "结算数量")]
public decimal Qty { set; get; } public decimal Qty { set; get; }
[ImporterHeader(Name = "结算单价")]
public decimal Price { set; get; }
[ImporterHeader(Name = "结算金额")]
public decimal Amt { set; get; }
[ImporterHeader(Name = "数量", IsIgnore = true)] [ImporterHeader(Name = "数量", IsIgnore = true)]
public string BillNum { set; get; } public string BillNum { set; get; }
[ImporterHeader(Name = "任务描述", IsIgnore = true)] [ImporterHeader(Name = "任务描述", IsIgnore = true)]

54
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs

@ -86,14 +86,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" '' 发货零件号,\n" + " '' 发货零件号,\n" +
" C.EstimateTypeDesc 物料组,\n" + " C.EstimateTypeDesc 物料组,\n" +
" C.MaterialDesc 物料描述,\n" + " C.MaterialDesc 物料描述,\n" +
" 0 发货数量,\n" + " 0 AS 发货数量,\n" +
" 0 发货总金额,\n" + " 0 发货总金额,\n" +
" '' 发货状态,\n" + " '' 发货状态,\n" +
" '' 结算验收单,\n" + " '' 结算验收单,\n" +
" '' 结算零件号,\n" + " '' 结算零件号,\n" +
" A.Qty 结算数量,\n" + " isnull(A.Qty,0) AS 结算数量,\n" +
" A.Price 结算单价,\n" + " isnull(A.Price,0) AS 结算单价,\n" +
" A.Amt 结算金额,\n" + " isnull(A.Amt,0) AS 结算金额,\n" +
"--A.MaterialCode 物料号,\n" + "--A.MaterialCode 物料号,\n" +
" 0 寄销库数量 \n" + " 0 寄销库数量 \n" +
" FROM\n" + " FROM\n" +
@ -118,7 +118,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" AcceptanceNo,\n" + " AcceptanceNo,\n" +
" Amt \n" + " Amt \n" +
" ) A\n" + " ) A\n" +
" LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" + " INNER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" ) temp1\n" + " ) temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.SAP编码 = temp2.MaterialCode"; " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.SAP编码 = temp2.MaterialCode";
; ;
@ -203,32 +203,49 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public class HQCarSettledDetailDiff public class HQCarSettledDetailDiff
{ {
[ExporterHeader(DisplayName = "交货日期")]
public string { set; get; }
[ExporterHeader(DisplayName = "手工或自动")]
public string { set; get; }
[ExporterHeader(DisplayName = "交货单号")]
public string { set; get; }
[ExporterHeader(DisplayName = "收货仓库")] [ExporterHeader(DisplayName = "收货仓库")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "收货仓库描述")] [ExporterHeader(DisplayName = "收货仓库描述")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "结算物料号")] [ExporterHeader(DisplayName = "订货看板号")]
public string { set; get; } public string { set; get; }
[ExporterHeader(DisplayName = "订货零件号")]
[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; } public string { set; get; }
[ExporterHeader(DisplayName = "发货数量")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "发货总金额")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "发货状态")]
public string { set; get; }
[ExporterHeader(DisplayName = "结算验收单")]
public string { set; get; }
[ExporterHeader(DisplayName = "结算零件号")]
public string { set; get; }
[ExporterHeader(DisplayName = "结算数量")] [ExporterHeader(DisplayName = "结算数量")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "结算单价")] [ExporterHeader(DisplayName = "结算单价")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "结算金额")] [ExporterHeader(DisplayName = "结算金额")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "Sap编码")]
public string Sap编码 { set; get; }
[ExporterHeader(DisplayName = "物料组(车型)")]
public string { set; get; }
[ExporterHeader(DisplayName = "寄销库数量")] [ExporterHeader(DisplayName = "寄销库数量")]
public decimal { set; get; } public decimal { set; get; }
[ExporterHeader(DisplayName = "单价差异")]
[ExporterHeader(DisplayName = "是否备件")] public decimal { set; get; }
public string { set; get; } [ExporterHeader(DisplayName = "差异总金额")]
public decimal { set; get; }
} }
@ -263,6 +280,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
// public string 是否备件 { set; get; } // public string 是否备件 { set; get; }
//} //}
public class HQCarSettleQtyDiff public class HQCarSettleQtyDiff
{ {

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

@ -31,47 +31,90 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SettleKBWithCode> GetSettleKBWithCodeReportList(string kanBan, string version, string sapMaterialCode, public virtual List<SettleKBWithCode> GetSettleKBWithCodeReportList(string kanBan, string version, string sapMaterialCode,
string customerPartCode,string estimateTypeDesc, string begintime, string endtime) string customerPartCode,string estimateTypeDesc, string begintime, string endtime)
{ {
//string sqlString = "SELECT\n" +
//" * ,\n" +
//" ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
//" ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
//" ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
//" ISNULL( Price * Qty - InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异\n" +
//" \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" +
//" c.WMSDeliveryNote,--交货单号\n" +
//" CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
//" a.Kanban,--条码号\n" +
//" b.MaterialCode SapMaterialCode,--厂内物料号\n" +
//" b.MaterialDesc,--物料描述\n" +
//" b.CustomerPartCode,--客户物料\n" +
//" b.EstimateTypeDesc,--物料组(车型)\n" +
//" c.WMSDeliveryQty,--交货数量\n" +
//" a.Qty AS SettleNumber,--结算数量\n" +
//" a.SettleDate,--结算日期\n" +
//" a.Qty,--用于计算\n" +
//" ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" +
//" 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" +
//" a.Qty AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
//" d.InvoicePrice,--开票单价\n" +
//" 0 AS InvoiceMoney,--开票金额\n" +
//" '' DeliveryOrderNo --出库单号\n" +
//" \n" +
//" FROM\n" +
//" Set_KanBanSettle AS a\n" +
//" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
//" LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
//" AND a.MaterialCode= c.MaterialCode\n" +
//" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode where a.VERSION='{0}'\n" +
//" ) TEMP1\n" +
//" LEFT JOIN ( SELECT Price, --定价\n" +
//" MaterialCode --厂内物料号\n" +
//" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
//"WHERE 1=1 ";
string sqlString = "SELECT\n" + string sqlString = "SELECT\n" +
" * ,\n" + " * ,\n" +
" ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" + " ISNULL( Price * Qty, 0 ) AS InvoiceMoney,--开票金额\n" +
" ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" + " ISNULL( Price * WMSDeliveryQty, 0 ) AS Amount,--金额\n" +
" ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" + " ISNULL( Price * Qty, 0 ) AS SettlePrice,--结算金额\n" +
" ISNULL( Price * Qty - InvoiceMoney, 0 ) AS SumDiffMoney --总金额差异\n" + " ( Price - InvoicePrice ) AS InvoiceDiffPrice,--单价差异\n" +
" \n" + " ISNULL( Price * Qty - InvoicePrice * Qty, 0 ) AS SumDiffMoney,--总金额差异\n" +
"FROM\n" + " '' DeliveryOrderNo --出库单号\n" +
" (\n" + " \n" +
" SELECT\n" + "FROM\n" +
" row_number() over(order by b.EstimateTypeDesc) as RowId ,\n" + " (\n" +
" c.WMSDeliveryNote,--交货单号\n" + " SELECT\n" +
" CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" + " row_number ( ) OVER ( ORDER BY b.EstimateTypeDesc ) AS RowId,\n" +
" c.WMSDeliveryNote,--交货单号\n" +
" a.Kanban,--条码号\n" + " CONVERT ( VARCHAR ( 100 ), c.WMSActualGoodsDate, 23 ) AS WMSActualGoodsDate,--实际发货日期年-月-日\n" +
" b.MaterialCode SapMaterialCode,--厂内物料号\n" + " a.Kanban,--条码号\n" +
" b.MaterialDesc,--物料描述\n" + " b.MaterialCode SapMaterialCode,--厂内物料号\n" +
" b.CustomerPartCode,--客户物料\n" + " b.MaterialDesc,--物料描述\n" +
" b.EstimateTypeDesc,--物料组(车型)\n" + " b.CustomerPartCode,--客户物料\n" +
" c.WMSDeliveryQty,--交货数量\n" + " b.EstimateTypeDesc,--物料组(车型)\n" +
" a.Qty AS SettleNumber,--结算数量\n" + " c.WMSDeliveryQty,--交货数量\n" +
" a.SettleDate,--结算日期\n" + " a.Qty AS SettleNumber,--结算数量\n" +
" a.Qty,--用于计算\n" + " a.SettleDate,--结算日期\n" +
" ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" + " a.Qty,--用于计算\n" +
" 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" + " ( a.Qty- c.WMSDeliveryQty ) AS SettleWMSDiffQty,--结算与发货差异\n" +
" a.Qty AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" + " 0 AS SettleInvoiceDiffQty,--结算与发货差异\n" +
" d.InvoicePrice,--开票单价\n" + " a.Qty AS InvoiceDiffQty,--开票数量,默认0,后续拿算法动态算\n" +
" 0 AS InvoiceMoney,--开票金额\n" + " d.InvoicePrice --开票单价\n" +
" '' DeliveryOrderNo --出库单号\n" + " \n" +
" \n" + " FROM\n" +
" FROM\n" + " Set_KanBanSettle AS a\n" +
" Set_KanBanSettle AS a\n" + " LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" +
" LEFT JOIN Set_material AS b ON a.MaterialCode= b.CustomerPartCode\n" + " LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" +
" LEFT JOIN Set_WMSKanBanSettle c ON a.Kanban= c.Kanban \n" + " AND a.MaterialCode= c.MaterialCode\n" +
" AND a.MaterialCode= c.MaterialCode\n" + " LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode \n" +
" LEFT JOIN ( SELECT SUM ( amt ) / SUM ( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) d ON a.MaterialCode= d.MaterialCode where a.VERSION='{0}'\n" + " WHERE\n" +
" ) TEMP1\n" + " a.VERSION= '{0}' \n" +
" LEFT JOIN ( SELECT Price, --定价\n" + " ) TEMP1\n" +
" MaterialCode --厂内物料号\n" + " LEFT JOIN ( SELECT Price, --定价\n" +
" FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" + " MaterialCode --厂内物料号\n" +
"WHERE 1=1 "; " FROM Set_PriceList WHERE version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) TEMP2 ON TEMP1.SapMaterialCode= TEMP2.MaterialCode \n" +
"WHERE\n" +
" 1 = 1";
string addwhere = string.Empty; string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version); string addSqlStr = string.Format(sqlString, version);
//if (!string.IsNullOrEmpty(kanBan)) //if (!string.IsNullOrEmpty(kanBan))

170
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -25,11 +25,103 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SettleSparePartExport> GetSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode, public virtual List<SettleSparePartExport> GetSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime) string begintime, string endtime)
{ {
//string sqlString = "SELECT\n" +
//" temp1.交货日期,\n" +
//" temp1.交货单号,\n" +
//" '' 订单日期,\n" +
//" temp1.采购订单号,\n" +
//" temp1.SAP编码,\n" +
//" temp1.物料代码,\n" +
//" temp1.物料描述,\n" +
//" temp1.采购订单文本,\n" +
//" temp1.发货数量,\n" +
//" temp1.开票数量,\n" +
//" ISNULL( temp1.发货数量, 0 ) - ISNULL( temp1.开票数量, 0 ) AS 发货与开票差异,\n" +
//" temp1.开票单价,\n" +
//" ISNULL( temp1.开票金额, 0 ) AS 开票金额,\n" +
//" ISNULL( TEMP2.Price, 0 ) AS 定价,\n" +
//" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 ,\n" +
//" ( temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) ) * temp1.开票数量 AS 差异总金额 \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" a.Version AS 期间,\n" +
//" a.PurchaseOrderNoText AS 采购订单文本,\n" +
//" b.WMSDeliveryNote AS 交货单号,\n" +
//" b.SpareDate AS 交货日期,\n" +
//" a.PurchaseOrderNo AS 采购订单号,\n" +
//" b.SapCode AS SAP编码,\n" +
//" b.MaterialCode AS 物料代码,\n" +
//" c.MaterialDesc AS 物料描述,\n" +
//" c.EstimateTypeDesc AS 物料组,\n" +
//" a.PurchasePriceNoTax AS 开票单价,\n" +
//" 0 AS 数量差异,\n" +
//" ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" +
//" ISNULL( a.InvoicedQty, 0 ) AS 开票数量 ,\n" +
//" ISNULL( a.AmountNoTax, 0 ) AS 开票金额 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" t.ReceiptQty,\n" +
//" t.PurchaseOrderNo,\n" +
//" t.Version,\n" +
//" t.PurchasePriceNoTax,\n" +
//" t.InvoicedQty,\n" +
//" t.AmountNoTax,\n" +
//" t.PurchaseOrderNoText,\n" +
//" ( SELECT MaterialCode FROM Set_material WHERE CustomerPartCode = t.MaterialCode ) AS SapCode \n" +
//" FROM\n" +
//" (\n" +
//" SELECT SUM\n" +
//" ( ReceiptQty ) AS ReceiptQty,\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" PurchasePriceNoTax,\n" +
//" InvoicedQty,\n" +
//" PurchaseOrderNoText,\n" +
//" AmountNoTax \n" +
//" FROM\n" +
//" Set_SparePart \n" +
//" WHERE\n" +
//" Extend != 'is90' \n" +
//" GROUP BY\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" PurchasePriceNoTax,\n" +
//" InvoicedQty,\n" +
//" PurchaseOrderNoText,\n" +
//" AmountNoTax \n" +
//" ) t \n" +
//" ) AS a\n" +
//" INNER JOIN (\n" +
//" SELECT SUM\n" +
//" ( ReceiptQty ) AS ReceiptQty,\n" +
//" PurchaseOrderNo,\n" +
//" SapCode,\n" +
//" MaterialCode,\n" +
//" WMSDeliveryNote,\n" +
//" SpareDate \n" +
//" FROM\n" +
//" Set_WMSSparePart \n" +
//" GROUP BY\n" +
//" PurchaseOrderNo,\n" +
//" SapCode,\n" +
//" MaterialCode,\n" +
//" WMSDeliveryNote,\n" +
//" SpareDate \n" +
//" ) AS b ON a.SapCode = b.SapCode\n" +
//" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc ) AS c ON b.SapCode = c.MaterialCode \n" +
//" WHERE\n" +
//" ( a.Version = '{0}' ) \n" +
//" ) AS temp1\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" +
//"ORDER BY\n" +
//" temp1.采购订单号";
string sqlString = "SELECT\n" + string sqlString = "SELECT\n" +
" temp1.交货日期,\n" + " temp1.交货日期,\n" +
" temp1.交货单号,\n" +
" '' 订单日期,\n" + " '' 订单日期,\n" +
" temp1.采购订单号,\n" +
" temp1.SAP编码,\n" + " temp1.SAP编码,\n" +
" temp1.物料代码,\n" + " temp1.物料代码,\n" +
" temp1.物料描述,\n" + " temp1.物料描述,\n" +
@ -46,79 +138,25 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
" a.Version AS 期间,\n" + " a.Version AS 期间,\n" +
" a.PurchaseOrderNoText AS 采购订单文本,\n" + " '' AS 采购订单文本,\n" +
" b.WMSDeliveryNote AS 交货单号,\n" +
" b.SpareDate AS 交货日期,\n" + " b.SpareDate AS 交货日期,\n" +
" a.PurchaseOrderNo AS 采购订单号,\n" + " c.MaterialCode AS SAP编码,\n" +
" b.SapCode AS SAP编码,\n" + " a.MaterialCode AS 物料代码,\n" +
" b.MaterialCode AS 物料代码,\n" +
" c.MaterialDesc AS 物料描述,\n" + " c.MaterialDesc AS 物料描述,\n" +
" c.EstimateTypeDesc AS 物料组,\n" + " c.EstimateTypeDesc AS 物料组,\n" +
" a.PurchasePriceNoTax AS 开票单价,\n" + " a.PurchasePriceNoTax AS 开票单价,\n" +
" 0 AS 数量差异,\n" + " 0 AS 数量差异,\n" +
" ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" + " ISNULL( b.ReceiptQty, 0 ) AS 发货数量,\n" +
" ISNULL( a.InvoicedQty, 0 ) AS 开票数量 ,\n" + " ISNULL( a.ReceiptQty, 0 ) AS 开票数量 ,\n" +
" ISNULL( a.AmountNoTax, 0 ) AS 开票金额 \n" + " ISNULL( a.ReceiptQty, 0 )*ISNULL( a.PurchasePriceNoTax, 0 ) AS 开票金额 \n" +
" FROM\n" + " FROM\n" +
" (\n" + " ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, MaterialCode, Version, PurchasePriceNoTax FROM Set_SparePart WHERE Extend != 'is90' GROUP BY MaterialCode, Version, PurchasePriceNoTax ) AS a\n" +
" SELECT\n" + " LEFT JOIN ( SELECT SUM ( ReceiptQty ) AS ReceiptQty, SapCode, MaterialCode, SpareDate FROM Set_WMSSparePart GROUP BY SapCode, MaterialCode, SpareDate ) AS b ON a.MaterialCode = b.MaterialCode\n" +
" t.ReceiptQty,\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" +
" t.PurchaseOrderNo,\n" +
" t.Version,\n" +
" t.PurchasePriceNoTax,\n" +
" t.InvoicedQty,\n" +
" t.AmountNoTax,\n" +
" t.PurchaseOrderNoText,\n" +
" ( SELECT MaterialCode FROM Set_material WHERE CustomerPartCode = t.MaterialCode ) AS SapCode \n" +
" FROM\n" +
" (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax,\n" +
" InvoicedQty,\n" +
" PurchaseOrderNoText,\n" +
" AmountNoTax \n" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Extend != 'is90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax,\n" +
" InvoicedQty,\n" +
" PurchaseOrderNoText,\n" +
" AmountNoTax \n" +
" ) t \n" +
" ) AS a\n" +
" INNER JOIN (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" SapCode,\n" +
" MaterialCode,\n" +
" WMSDeliveryNote,\n" +
" SpareDate \n" +
" FROM\n" +
" Set_WMSSparePart \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" SapCode,\n" +
" MaterialCode,\n" +
" WMSDeliveryNote,\n" +
" SpareDate \n" +
" ) AS b ON a.SapCode = b.SapCode\n" +
" LEFT OUTER JOIN ( SELECT MAX ( Id ) Id, MaterialCode, MaterialDesc, EstimateTypeDesc FROM Set_material GROUP BY MaterialCode, MaterialDesc, EstimateTypeDesc ) AS c ON b.SapCode = c.MaterialCode \n" +
" WHERE\n" + " WHERE\n" +
" ( a.Version = '{0}' ) \n" + " ( a.Version = '{0}' and b.MaterialCode is NULL ) \n" +
" ) AS temp1\n" + " ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode \n" + " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.SAP编码 = TEMP2.MaterialCode";
"ORDER BY\n" +
" temp1.采购订单号";
string addwhere = string.Empty; string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version); string addSqlStr = string.Format(sqlString, version);

34
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQCarSettledDetailDiffExportService.cs

@ -51,14 +51,14 @@ namespace SettleAccount.Job.Services.Report
var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value; var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
var _ls = _dapperRepository.GetHQCarSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup); var _ls = _dapperRepository.GetHQCarSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
if (!string.IsNullOrEmpty(kanban)) //if (!string.IsNullOrEmpty(kanban))
{ //{
var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList(); // var _groupList = kanban.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0) // if (_groupList.Count() > 0)
{ // {
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList(); // _ls = _ls.Where(p => _groupList.Contains(p.结算物料号)).ToList();
} // }
} //}
if (!string.IsNullOrEmpty(warehouseDesc)) if (!string.IsNullOrEmpty(warehouseDesc))
@ -78,20 +78,20 @@ namespace SettleAccount.Job.Services.Report
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList(); _ls = _ls.Where(p => _groupList.Contains(p.)).ToList();
} }
} }
if (!string.IsNullOrEmpty(materialCode)) //if (!string.IsNullOrEmpty(materialCode))
{ //{
var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList(); // var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0) // if (_groupList.Count() > 0)
{ // {
_ls = _ls.Where(p => _groupList.Contains(p.)).ToList(); // _ls = _ls.Where(p => _groupList.Contains(p.结算物料号)).ToList();
} // }
} //}
if (!string.IsNullOrEmpty(sapCode)) if (!string.IsNullOrEmpty(sapCode))
{ {
var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList(); var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
if (_groupList.Count() > 0) if (_groupList.Count() > 0)
{ {
_ls = _ls.Where(p => _groupList.Contains(p.Sap编码)).ToList(); _ls = _ls.Where(p => _groupList.Contains(p.SAP编码)).ToList();
} }
} }
_outputService.Export<HQCarSettledDetailDiff>(id, _filename, _ls); _outputService.Export<HQCarSettledDetailDiff>(id, _filename, _ls);

Loading…
Cancel
Save