Administrator 3 years ago
parent
commit
70f2993c02
  1. 1
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  2. 5
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WmsHQCarAppService.cs
  3. 4
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  4. 8
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  5. 3
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs
  6. 322
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs
  7. 142
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs
  8. 26
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePart90ExportService.cs
  9. 29
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

1
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj

@ -54,7 +54,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="wwwroot\files\host\my-file-container\" />
</ItemGroup>

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

@ -150,7 +150,8 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
itm.TaskId,
itm.Remark,
itm.Qty,
tm1 == null ? 0 : tm1.Qty
tm1 == null ? 0 : tm1.Qty,
itm.IsSparePart
);
@ -221,6 +222,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
string.Empty,
p.Qty,
p.StockQty
,p.IsSparePart
));
_lst.AddRange(_lsAry.ToArray());
}
@ -403,6 +405,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
, string.Empty
, itm.Qty
, 0
,itm.IsSparePart
);
_lsCopy.Add(_detail);
}

4
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -208,7 +208,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() });
var _taskid = await _service.ExportEnqueueAsync("(0-90天)大众备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePart90ExportService), customConditionList, (rs) =>
var _taskid = await _service.ExportEnqueueAsync("大众备件数据调整结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePart90ExportService), customConditionList, (rs) =>
{
});
@ -247,7 +247,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "BegingTime", Value = begin.ToString() });
customConditionList.Add(new CustomCondition() { Name = "EndTime", Value = end.ToString() });
var _taskid = await _service.ExportEnqueueAsync("备件结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) =>
var _taskid = await _service.ExportEnqueueAsync("大众备件正常结算输出", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettleSparePartExportService), customConditionList, (rs) =>
{
});

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

@ -676,7 +676,9 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
public WmsHQCarOutPutDetial()
{
}
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 extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty)
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 extend3, string parentMaterialCode, string billNum, Guid taskId, string remark, decimal qty, decimal stockQty,string issparepart)
{
Id = id;
WmsBillNum = wmsBillNum;
@ -696,11 +698,15 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
Remark = remark;
Qty = qty;
StockQty = stockQty;
IsSparePart = issparepart;
}
public void SetId(Guid id)
{
Id = id;
}
[ImporterHeader(Name = "是否备件")]
public string IsSparePart { set; get; }
//交货单号
[ImporterHeader(Name = "寄销库数量", IsIgnore = true)]

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

@ -142,6 +142,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "寄销库数量")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "是否备件")]
public string { set; get; }
}
public class HQCarSettleQtyDiff

322
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePart90DapperReportRepository.cs

@ -23,181 +23,41 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SettleSparePart90Export> GetSettleSparePart90ReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
string sqlString =
"SELECT\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" +
" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.Version AS 期间,\n" +
" b.WMSDeliveryNote AS 交货单号,\n" +
" b.SpareDate AS 发货日期,\n" +
" b.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( b.ReceiptQty, 0 ) AS 开票数量 \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" t.ReceiptQty,\n" +
" t.PurchaseOrderNo,\n" +
" t.Version,\n" +
" t.PurchasePriceNoTax,\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" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Extend = 'is90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" ) t \n" +
" ) AS a\n" +
" INNER JOIN (\n" +
" SELECT\n" +
" WMSDeliveryNote,\n" +
" SpareDate,\n" +
" MaterialCode,\n" +
" ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" SapCode \n" +
" FROM\n" +
" Set_WMSSparePart \n" +
" WHERE\n" +
" PurchaseOrderNo != 'BM' \n" +
" AND PurchaseOrderNo LIKE '%D30%' \n" +
" OR PurchaseOrderNo LIKE '%D60%' \n" +
" OR PurchaseOrderNo LIKE '%D90%' \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 = '202112' ) \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.采购订单号";
//"SELECT\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" +
//" temp1.开票单价 - ISNULL( TEMP2.Price, 0 ) AS 单价差异 \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" a.Version AS 期间,\n" +
//" b.WMSDeliveryNote AS 交货单号,\n" +
//" b.SpareDate AS 发货日期,\n" +
//" b.PurchaseOrderNo AS 采购订单号,\n" +
//" c.MaterialCode 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( b.ReceiptQty, 0 ) AS 开票数量 \n" +
//" FROM\n" +
//" (\n" +
//" SELECT SUM\n" +
//" ( ReceiptQty ) AS ReceiptQty,\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" PurchasePriceNoTax \n" +
//" FROM\n" +
//" Set_SparePart \n" +
//" WHERE\n" +
//" Extend = 'is90' \n" +
//" GROUP BY\n" +
//" PurchaseOrderNo,\n" +
//" MaterialCode,\n" +
//" Version,\n" +
//" PurchasePriceNoTax \n" +
//" ) AS a\n" +
//" LEFT OUTER JOIN (\n" +
//" SELECT\n" +
//" WMSDeliveryNote,\n" +
//" SpareDate,\n" +
//" MaterialCode,\n" +
//" ReceiptQty,\n" +
//" PurchaseOrderNo \n" +
//" FROM\n" +
//" Set_WMSSparePart \n" +
//" WHERE\n" +
//" PurchaseOrderNo != 'BM' \n" +
//" AND PurchaseOrderNo LIKE '%D30%' \n" +
//" OR PurchaseOrderNo LIKE '%D60%' \n" +
//" OR PurchaseOrderNo LIKE '%D90%' \n" +
//" ) AS b ON a.MaterialCode = b.MaterialCode\n" +
//" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \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 ORDER BY temp1.采购订单号";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
string _sql = string.Format(addSqlStr, addwhere);
//string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleSparePart90Export>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
public virtual List<SparePart90SumQtyDiff> GetSettleSparePart90SumQtyDiff(string version)
{
string sqlString = "SELECT\n" +
" ISNULL( A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ), 0 ) 数量差异,\n" +
" a.PurchaseOrderNo 订单号,\n" +
" a.SapCode 厂内物料号 \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" +
" t.ReceiptQty,\n" +
" t.PurchaseOrderNo,\n" +
" t.Version,\n" +
" t.PurchasePriceNoTax,\n" +
" ( SELECT MaterialCode FROM Set_material WHERE CustomerPartCode = t.MaterialCode ) AS SapCode \n" +
" a.Version AS 期间,\n" +
" a.PurchaseOrderNoText AS 采购订单文本,\n" +
" b.WMSDeliveryNote AS 交货单号,\n" +
" b.SpareDate AS 交货日期,\n" +
" a.PurchaseOrderNo AS 采购订单号,\n" +
" c.MaterialCode 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 SUM\n" +
@ -205,56 +65,84 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \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" +
" ) t \n" +
" ) A\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" WMSDeliveryNote,\n" +
" SpareDate,\n" +
" MaterialCode,\n" +
" ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" SapCode \n" +
" FROM\n" +
" Set_WMSSparePart \n" +
" PurchasePriceNoTax,\n" +
" InvoicedQty,\n" +
" PurchaseOrderNoText,\n" +
" AmountNoTax \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.PurchaseOrderNo = b.PurchaseOrderNo \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \n" +
" WHERE\n" +
" PurchaseOrderNo != 'BM' \n" +
" AND PurchaseOrderNo LIKE '%D30%' \n" +
" OR PurchaseOrderNo LIKE '%D60%' \n" +
" OR PurchaseOrderNo LIKE '%D90%' \n" +
" ) B ON A.SapCode = B.SapCode WHERE (A.ReceiptQty - ISNULL( B.ReceiptQty, 0 )) <> 0";
" ( 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 addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
string _sql = string.Format(addSqlStr, addwhere);
var _query = DbConnection.Query<SparePart90SumQtyDiff>(_sql, null, null, true, 1200, null);
//string _sql = string.Format(sqlString, version);
var _query = DbConnection.Query<SettleSparePart90Export>(_sql, null, null, true, 1200, null);
return _query.ToList();
}
//public virtual List<SparePart90SumQtyDiff> GetSettleSparePart90SumQtyDiff(string version)
//{
// string sqlString = "SELECT\n" +
// " ISNULL( A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ), 0 ) 数量差异,\n" +
// " a.PurchaseOrderNo 订单号,\n" +
// " a.MaterialCode 物料号 \n" +
// "FROM\n" +
// " ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_SparePart WHERE Version = '{0}' GROUP BY PurchaseOrderNo, MaterialCode ) A\n" +
// " LEFT JOIN ( SELECT SUM ( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) B ON A.MaterialCode = B.MaterialCode \n" +
// " AND A.PurchaseOrderNo = B.PurchaseOrderNo \n" +
// "WHERE\n" +
// " A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ) <> 0";
// string addwhere = string.Empty;
// string addSqlStr = string.Format(sqlString, version);
}
// string _sql = string.Format(addSqlStr, addwhere);
// var _query = DbConnection.Query<SparePart90SumQtyDiff>(_sql, null, null, true, 1200, null);
// return _query.ToList();
//}
}
@ -279,12 +167,14 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public class SettleSparePart90Export
{
[ExporterHeader(DisplayName = "期 ")]
public string { set; get; }
[ExporterHeader(DisplayName = "交货日期 ")]
public string { set; get; }
[ExporterHeader(DisplayName = "交货单号")]
public string { set; get; }
[ExporterHeader(DisplayName = "发货日期")]
public string { set; get; }
[ExporterHeader(DisplayName = "订单日期")]
public string { set; get; }
[ExporterHeader(DisplayName = "采购订单号")]
public string { set; get; }
[ExporterHeader(DisplayName = "SAP编码")]
@ -293,26 +183,34 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
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 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; }
//[ExporterHeader(DisplayName = "出库数量")]
//public decimal 出库数量 { set; get; }
}
}

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

@ -25,64 +25,103 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SettleSparePartExport> GetSettleSparePartReportList(string purchaseOrderNo, string version, string sapCode, string matialCode,
string begintime, string endtime)
{
string sqlString =
"SELECT\n" +
" temp1.期间,\n" +
string sqlString = "SELECT\n" +
" temp1.交货日期,\n" +
" temp1.交货单号,\n" +
" temp1.发货日期,\n" +
" '' 订单日期,\n" +
" temp1.采购订单号,\n" +
" temp1.SAP编码,\n" +
" temp1.物料代码,\n" +
" temp1.物料描述,\n" +
" temp1.物料组,\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 ) 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" +
" b.SpareDate AS 货日期,\n" +
" a.PurchaseOrderNo AS 采购订单号,\n" +
" c.MaterialCode AS SAP编码,\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( 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" +
" LEFT OUTER JOIN (\n" +
" SELECT SUM\n" +
" ( ReceiptQty ) AS ReceiptQty,\n" +
" PurchaseOrderNo,\n" +
" SapCode,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" WMSDeliveryNote,\n" +
" SpareDate \n" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Extend = 'not90' \n" +
" Set_WMSSparePart \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" SapCode,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" ) AS a\n" +
" LEFT OUTER JOIN Set_WMSSparePart AS b ON a.PurchaseOrderNo = b.PurchaseOrderNo \n" +
" AND a.MaterialCode = b.MaterialCode\n" +
" LEFT OUTER JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode \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 ORDER BY temp1.采购订单号";
" 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 addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);
//if (!string.IsNullOrEmpty(purchaseOrderNo))
//{
// addwhere += string.Format(" AND PurchaseOrderNo LIKE '{0}%' ", purchaseOrderNo);
@ -170,13 +209,56 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public virtual List<SparePartSumQtyDiff> GetSettleSparePartSumQtyDiff(string version)
{
string sqlString = "SELECT\n" +
" ISNULL( A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ), 0 ) 数量差异,\n" +
" a.PurchaseOrderNo 订单号,\n" +
" a.MaterialCode 物料号 \n" +
" FROM\n" +
" ( SELECT sum( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_SparePart where Version='{0}' GROUP BY PurchaseOrderNo, MaterialCode ) A\n" +
" LEFT JOIN ( SELECT sum( ReceiptQty ) ReceiptQty, PurchaseOrderNo, MaterialCode FROM Set_WMSSparePart GROUP BY PurchaseOrderNo, MaterialCode ) B ON A.MaterialCode = B.MaterialCode \n" +
" AND A.PurchaseOrderNo = B.PurchaseOrderNo";
" ISNULL( A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ), 0 ) 数量差异,\n" +
" a.PurchaseOrderNo 订单号,\n" +
" a.SapCode 厂内物料号 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" t.ReceiptQty,\n" +
" t.PurchaseOrderNo,\n" +
" t.Version,\n" +
" t.PurchasePriceNoTax,\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" +
" FROM\n" +
" Set_SparePart \n" +
" WHERE\n" +
" Version = '{0}' \n" +
" AND Extend != 'is90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +
" Version,\n" +
" PurchasePriceNoTax \n" +
" ) t \n" +
" ) A\n" +
" LEFT 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" +
" ) B ON A.SapCode = B.SapCode \n" +
"WHERE\n" +
" ( A.ReceiptQty - ISNULL( B.ReceiptQty, 0 ) ) <> 0";
string addwhere = string.Empty;
string addSqlStr = string.Format(sqlString, version);

26
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePart90ExportService.cs

@ -35,20 +35,20 @@ namespace SettleAccount.Job.Services.Report
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _ls = _dapper.GetSettleSparePart90ReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
var diffList = _dapper.GetSettleSparePart90SumQtyDiff(version);
if (diffList != null)
{
foreach (var itm in diffList)
{
var _first = _ls.FirstOrDefault(p => p.SAP编码 == itm.);
if (_first != null)
{
_first. = _first. + itm.;//开票数量(结算数量+差异)
_first. = itm.;
//var diffList = _dapper.GetSettleSparePart90SumQtyDiff(version);
//if (diffList != null)
//{
// foreach (var itm in diffList)
// {
// var _first = _ls.FirstOrDefault(p => p.SAP编码 == itm.厂内物料号);
// if (_first != null)
// {
// _first.开票数量 = _first.发货数量 + itm.数量差异;//开票数量(结算数量+差异)
// _first.数量差异 = itm.数量差异;
}
}
}
// }
// }
//}
//if (!string.IsNullOrEmpty(materialGroup))
//{

29
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SettleSparePartExportService.cs

@ -34,20 +34,23 @@ namespace SettleAccount.Job.Services.Report
var beginTime = p_list.Where(p => p.Name == "BegingTime").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "EndTime").FirstOrDefault().Value;
var _ls = _dapper.GetSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
var diffList = _dapper.GetSettleSparePartSumQtyDiff(version);
if (diffList != null)
{
foreach (var itm in diffList)
{
var _first = _ls.FirstOrDefault(p => p. == itm. && p.==itm.);
if (_first != null)
{
_first. = _first. + itm.;//开票数量(结算数量+差异)
_first. = itm.;
//var diffList = _dapper.GetSettleSparePartSumQtyDiff(version);
//if (diffList != null)
//{
// foreach (var itm in diffList)
// {
// var _first = _ls.FirstOrDefault(p => p.采购订单号 == itm.订单号 && p.物料代码==itm.物料号);
// if (_first != null)
// {
// _first.开票数量 = _first.发货数量 + itm.数量差异;//开票数量(结算数量+差异)
// _first.数量差异 = itm.数量差异;
}
}
}
// }
// }
//}
//if (!string.IsNullOrEmpty(materialGroup))
//{

Loading…
Cancel
Save