Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
87c34c4efe
  1. 65
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs
  2. 256
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs
  3. 236
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs
  4. 66
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
  5. 29
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

65
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/UnSettle/UnSettleDetailReport.cs

@ -66,4 +66,69 @@ namespace Win.Sfs.SettleAccount.Entities.UnSettle
} }
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class UnSettleDetailReport1 : ReportDetailBase
{
[ExporterHeader(DisplayName = "交货单号 ")]
public override string WmsBillNum { set; get; }
[ExporterHeader(DisplayName = "实际发货日期 ")]
public new string CP5Time { set; get; }
[ExporterHeader(DisplayName = "KENN号")]
public override string KENNCode { set; get; }
[ExporterHeader(DisplayName = "底盘号")]
public override string ChassisNumber { set; get; }
[ExporterHeader(DisplayName = "交货状态", IsIgnore = true)]
public override string WmsState { set; get; }
[ExporterHeader(DisplayName = "物料号")]
public override string SapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "物料描述 ")]
public override string MaterialDesc { set; get; }
[ExporterHeader(DisplayName = "客户物料 ")]
public override string MaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料 ")]
public override string ParentSapMaterialCode { set; get; }
[ExporterHeader(DisplayName = "组件组物料描述 ")]
public override string ParentMaterialDesc { set; get; }
[ExporterHeader(DisplayName = "物料组(车型) ")]
public override string MaterialGroup { set; get; }
[ExporterHeader(DisplayName = "定价 ")]
public override decimal Price { set; get; }
[ExporterHeader(DisplayName = "金额 ")]
public override decimal Amt { set; get; }
[ExporterHeader(DisplayName = "结算日期", IsIgnore = true)]
public override DateTime CP7Time { set; get; }
[ExporterHeader(DisplayName = "开票单价", IsIgnore = true)]
public override decimal InvoicePrice { set; get; }
[ExporterHeader(DisplayName = "结算平台未结数量 ")]
public decimal Qty { set; get; }
[ExporterHeader(DisplayName = "大众R3未结数量")]
public decimal UnSettleQty { set; get; }
[ExporterHeader(DisplayName = "差异金额")]
public decimal DiffAMT { set; get; }
[ExporterHeader(DisplayName = "退货数量")]
public decimal ReturnQty { set; get; }
[ExporterHeader(DisplayName = "差异数量")]
public decimal DiffQty { set; get; }
[ExporterHeader(DisplayName = "漏结标识 ")]
public string Flag { set; get; }
[ExporterHeader(DisplayName = "漏结期间 ")]
public string UnSettleVersion { set; get; }
[ExporterHeader(DisplayName = "说明 ")]
public string Remark { set; get; }
}
} }

256
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettleDiffDapperRepository.cs

@ -222,148 +222,124 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//" SELECT\n" + var _sql = string.Format(sql1, condition,version);
//" t1.*,\n" +
//" isnull( t1.UNSettleQty, 0 ) * isnull( T2.Price, 0 ) AMT,\n" +
//" T2.Price,\n" +
//" Qty -(\n" +
//" ISNULL( UnSettleQty, 0 )) DiffQty \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" a.MaterialCode,\n" +
//" a.KENNCode,\n" +
//" a.ChassisNumber,\n" +
//" a.qty UNSettleQty,\n" +
//" isnull( b.qty, 0 ) qty,\n" +
//" a.CP5A CP5Time,\n" +
//" c.MaterialCode SapMaterialCode,\n" +
//" c.MaterialDesc MaterialDesc,\n" +
//" c.EstimateTypeDesc MaterialGroup,\n" +
//" a.model Factory \n" +
//" FROM\n" +
//" Set_unsettle a\n" +
//" LEFT JOIN (\n" +
//" SELECT\n" +
//" ItemCode,\n" +
//" KENNCode,\n" +
//" ChassisNumber2,\n" +
//" sum( qty ) qty \n" +
//" FROM\n" +
//" Set_fis \n" +
//" WHERE\n" +
//" state = 0 \n" +
//" OR state = 4 \n" +
//" GROUP BY\n" +
//" ItemCode,\n" +
//" KENNCode,\n" +
//" ChassisNumber2,\n" +
//" Model \n" +
//" ) b ON a.ChassisNumber = b.ChassisNumber2 \n" +
//" AND a.MaterialCode = b.ItemCode \n" +
//" AND a.KENNCode = b.KENNCode\n" +
//" LEFT JOIN Set_material c ON a.MaterialCode = c.CustomerPartCode {0}\n" +
//" ) t1\n" +
//" LEFT JOIN (\n" +
//" SELECT\n" +
//" MaterialCode,\n" +
//" Price \n" +
//" FROM\n" +
//" Set_PriceList \n" +
//" WHERE\n" +
//" version = ( SELECT max( version ) FROM Set_PriceListVersion )) t2 ON t1.SapMaterialCode = t2.MaterialCode \n" +
//"WHERE\n" +
//" 1 = 1";
// string sql2 =
//" SELECT\n " +
//" t1.*,\n" +
//" t1.Qty * T2.Price AMT,\n" +
//" T2.Price,\n" +
//" Qty -(\n" +
//" ISNULL( UnSettleQty, 0 )) DiffQty,\n" +
//" Qty -(\n" +
//" ISNULL( UnSettleQty, 0 ))* isnull( t2.Price, 0 ) DiffPrice \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" temp1.WMSState,\n" +
//" temp1.WMSBillNum,\n" +
//" temp1.MaterialCode,\n" +
//" temp1.KENNCode,\n" +
//" temp1.ChassisNumber2,\n" +
//" temp1.Qty,\n" +
//" temp1.ChassisNumber,\n" +
//" temp1.CP5Time,\n" +
//" temp1.UnSettleQty,\n" +
//" temp1.SapMaterialCode,\n" +
//" temp1.MaterialDesc,\n" +
//" temp1.MaterialGroup,\n" +
//" temp2.MaterialCode AS ParentSapMaterialCode,\n" +
//" temp2.MaterialDesc AS ParentMaterialDesc \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" a.WMSState,\n" +
//" a.WMSBillNum,\n" +
//" a.MaterialCode,\n" +
//" a.KENNCode,\n" +
//" a.ChassisNumber2,\n" +
//" a.Qty,\n" +
//" a.ParentCode,\n" +
//" a.ChassisNumber,\n" +
//" a.CP5Time,\n" +
//" b.Qty AS UnSettleQty,\n" +
//" C.MaterialCode AS SapMaterialCode,\n" +
//" C.MaterialDesc,\n" +
//" C.EstimateTypeDesc AS MaterialGroup \n" +
//" FROM\n" +
//" (\n" +
//" SELECT\n" +
//" WMSState,\n" +
//" WMSBillNum,\n" +
//" ItemCode AS MaterialCode,\n" +
//" KENNCode,\n" +
//" ChassisNumber2,\n" +
//" SUM( Qty ) AS Qty,\n" +
//" ErpMaterialCode AS ParentCode,\n" +
//" ChassisNumber,\n" +
//" CP5Time \n" +
//" FROM\n" +
//" Set_fis \n" +
//" WHERE\n" +
//" ( State = 0 ) \n" +
//" GROUP BY\n" +
//" ItemCode,\n" +
//" KENNCode,\n" +
//" ChassisNumber2,\n" +
//" WMSState,\n" +
//" WMSBillNum,\n" +
//" ErpMaterialCode,\n" +
//" ChassisNumber,\n" +
//" CP5Time \n" +
//" ) AS a\n" +
//" LEFT OUTER JOIN Set_Unsettle AS b ON a.ChassisNumber2 = b.ChassisNumber \n" +
//" AND b.MaterialCode = a.MaterialCode \n" +
//" AND a.KENNCode = b.KENNCode\n" +
//" LEFT OUTER JOIN Set_material AS C ON a.MaterialCode = C.CustomerPartCode {0}\n" +
//" ) AS temp1\n" +
//" LEFT OUTER JOIN Set_material AS temp2 ON temp1.ParentCode = temp2.MaterialCode \n" +
//" ) t1\n" +
//" LEFT JOIN (\n" +
//" SELECT\n" +
//" MaterialCode,\n" +
//" Price \n" +
//" FROM\n" +
//" Set_PriceList \n" +
//" WHERE\n" +
//" version = ( SELECT max( version ) FROM Set_PriceListVersion )) t2 ON t1.SapMaterialCode = t2.MaterialCode";
var _sql = string.Format(sql1, condition,version); var _query = DbConnection.Query<UnSettleDiff>(_sql);
return _query.ToList();
}
public virtual List<UnSettleDiff> GetDiffReport1(int type, string begin, string end, string materialCode, string kennCode, string chassisNumber, string version)
{
string condition = " ";
//if (!string.IsNullOrEmpty(materialCode))
//{
// condition += string.Format(" and d.MaterialCode='{0}' ", materialCode);
//}
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" and BeginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" and BeginTime<='{0}' ", end);
}
//if (!string.IsNullOrEmpty(kennCode))
//{
// condition += string.Format(" and a.kenncode='{0}' ", kennCode);
//}
//if (!string.IsNullOrEmpty(chassisNumber))
//{
// condition += string.Format(" and a.chassisNumber='{0}' ", chassisNumber);
//}
string sql1 =
"SELECT\n" +
" t1.*,\n" +
" Round(isnull( t1.UNSettleQty, 0 ) * isnull( T2.Price, 0 ),2) AMT,\n" +
" T2.Price,\n" +
" Qty -(\n" +
" ISNULL( UnSettleQty, 0 )) DiffQty ,\n" +
" Round((Qty - (ISNULL(UnSettleQty, 0))) * isnull(T2.Price, 0),2) DiffAmt \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.*,\n" +
" temp2.MaterialDesc ParentMaterialDesc \n" +
" FROM\n" +
" (\n" +
" SELECT\n" +
" a.MaterialCode,\n" +
" isnull( b.OrderBillNum, a.KENNCode ) KENNCode,\n" +
" isnull( b.ChassisNumber, a.ChassisNumber ) ChassisNumber,\n" +
" a.qty UNSettleQty,\n" +
" isnull( b.qty, 0 ) qty,\n" +
" a.CP5A CP5Time,\n" +
" c.MaterialCode SapMaterialCode,\n" +
" c.MaterialDesc MaterialDesc,\n" +
" c.EstimateTypeDesc MaterialGroup,\n" +
" a.model Factory,\n" +
" b.ErpMaterialCode ParentSapMaterialCode,\n" +
" b.WMSBillNum, \n" +
" a.UnsettledReason " +
" FROM\n" +
" (select * from Set_unsettle where Version='{1}') a\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" OrderBillNum,\n" +
" ChassisNumber,\n" +
" ItemCode,\n" +
" KENNCode,\n" +
" ChassisNumber2\n" +
"STUFF((SELECT ',' + ErpMaterialCode FROM Set_fis subTitle WHERE KENNCode =tm1.KENNCode\n" +
"and ChassisNumber2=tm1.ChassisNumber2 and ItemCode=tm1.ItemCode FOR XML PATH('')),1, 1, '') AS ErpMaterialCode,\n" +
"STUFF((SELECT ',' + WMSBillNum FROM Set_fis subTitle WHERE KENNCode =tm1.KENNCode\n" +
"and ChassisNumber2=tm1.ChassisNumber2 and ItemCode=tm1.ItemCode FOR XML PATH('')),1, 1, '') AS WMSBillNum,\n"+
" sum( qty ) qty \n" +
" FROM\n" +
" Set_fis tm1\n" +
" WHERE\n" +
" ( state = 0 \n" +
" OR state = 4) {0} \n" +
" GROUP BY\n" +
" ItemCode,\n" +
" KENNCode,\n" +
" ChassisNumber2,\n" +
" OrderBillNum,\n" +
" ChassisNumber,\n" +
" ) b ON a.ChassisNumber = b.ChassisNumber2 \n" +
" AND a.MaterialCode = b.ItemCode \n" +
" AND a.KENNCode = b.KENNCode\n" +
" LEFT JOIN Set_material c ON a.MaterialCode = c.CustomerPartCode \n" +
" ) temp1\n" +
" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) temp2 ON SUBSTRING(temp1.ParentSapMaterialCode,1,8) = temp2.MaterialCode \n" +
" ) t1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" MaterialCode,\n" +
" Price \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" version = ( SELECT max( version ) FROM Set_PriceListVersion )) t2 ON t1.SapMaterialCode = t2.MaterialCode \n" +
"WHERE\n" +
" 1 = 1";
var _sql = string.Format(sql1, condition, version);
@ -371,5 +347,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _query.ToList(); return _query.ToList();
} }
} }
} }

236
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/UnSettledDetailDapperRepository.cs

@ -48,23 +48,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
str += string.Format(" and beginTime<='{0}' ", end); str += string.Format(" and beginTime<='{0}' ", end);
} }
//if (!string.IsNullOrEmpty(materialCode))
//{
// str += string.Format(" and ItemCode='{0}' ", materialCode);
//}
//string str2 = " ";
//if (!string.IsNullOrEmpty(sapCode))
//{
// str2 += string.Format(" and b.MaterialCode='{0}' ", sapCode);
//}
//if (!string.IsNullOrEmpty(materialGroup))
//{
// str += string.Format(" and MaterialGroup='{0}' ", materialGroup);
//}
//if (!string.IsNullOrEmpty(sapCode))
//{
// str += string.Format(" and SapCode='{0}' ", materialGroup);
//}
var sqlString = var sqlString =
" SELECT\n" + " SELECT\n" +
@ -172,6 +156,224 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
return _list; return _list;
} }
public virtual List<UnSettleDetailReport1> GetDiffReport1(string year, string begin, string end, string customcode, string version, string materialCode, string materialGroup, string sapCode)
{
string str = " ";
if (!string.IsNullOrEmpty(begin))
{
str += string.Format(" and beginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
str += string.Format(" and beginTime<='{0}' ", end);
}
var sqlString =
"SELECT\n" +
"2 WMSState,\n" +
"temp1.WMSBillNum ,\n" +
"temp1.UnSettleVersion\t\t ,\n" +
"temp1.CP5Time\t\t\t\t ,\n" +
"temp1.MaterialCode\t\t\t ,\n" +
"temp1.ChassisNumber\t\t\t ,\n" +
"temp1.KENNCode\t\t\t\t ,\n" +
"temp1.chassisNumber2\t\t ,\n" +
"temp1.KENNCode2\t\t\t\t ,\n" +
"temp1.QTY\t\t\t\t\t ,\n" +
"temp1.ParentSapMaterialCode\t ,\n" +
"temp1.FLAG\t\t\t\t\t ,\n" +
"temp1.UnSettleQty\t\t\t ,\n" +
"temp1.MaterialGroup\t\t\t ,\n" +
"temp1.MaterialDesc\t\t\t ,\n" +
"temp1.ParentMaterialDesc\t ,\n" +
"temp1.SapMaterialCode\t\t ,\n" +
"temp2.Price,\n" +
"ISNULL( temp1.QTY, 0 )* ISNULL( temp2.Price, 0 ) AMT,\n" +
"Round(ISNULL( temp1.DiffQty, 0 )* ISNULL( temp2.Price, 0 ),2) DiffAMT\n" +
"FROM\n" +
"(\n" +
"SELECT\n" +
"A.*,\n" +
"Isnull(F.Qty, 0) UnSettleQty,\n" +
"B.EstimateTypeDesc MaterialGroup,\n" +
"B.MaterialDesc MaterialDesc,\n" +
"d.MaterialDesc ParentMaterialDesc,\n" +
"B.MaterialCode SapMaterialCode,\n" +
"A.Qty-Isnull(F.Qty,\n" +
"0) DiffQty\n" +
"FROM\n" +
"(\n" +
"select\n" +
"\n" +
"MaterialCode,\n" +
"ChassisNumber,\n" +
"KENNCode,\n" +
"ChassisNumber2,\n" +
"KENNCode KENNCode2,\n" +
"flag,\n" +
"\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + ErpMaterialCode\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS ParentSapMaterialCode,\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + WMSBillNum\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS WMSBillNum,\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + cast(CP5Time as varchar(20))\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS CP5Time,\n" +
"STUFF((\n" +
"SELECT\n" +
"',' + UnSettleVersion\n" +
"FROM\n" +
"Set_fis subTitle\n" +
"WHERE\n" +
"KENNCode = tm1.KENNCode2\n" +
"and ChassisNumber2 = tm1.ChassisNumber2\n" +
"and ItemCode = tm1.MaterialCode FOR XML PATH('')),\n" +
"1,\n" +
"1,\n" +
"'') AS UnSettleVersion,\n" +
"sum(qty) qty\n" +
"from\n" +
"\n" +
"(\n" +
"SELECT\n" +
"WMSState,\n" +
"WMSBillNum,\n" +
"UnSettleVersion,\n" +
"BeginTime CP5Time,\n" +
"ItemCode MaterialCode,\n" +
"ChassisNumber,\n" +
"OrderBillNum KENNCode,\n" +
"ChassisNumber2,\n" +
"KENNCode KENNCode2,\n" +
"QTY,\n" +
"ErpMaterialCode ,\n" +
"'' FLAG\n" +
"FROM\n" +
"Set_fis\n" +
"where\n" +
"1 = 1\n" +
"AND STATE = 0\n" +
"UNION ALL\n" +
"SELECT\n" +
"\n" +
"WMSState,\n" +
"WMSBillNum,\n" +
"UnSettleVersion,\n" +
"BeginTime CP5Time,\n" +
"ItemCode MaterialCode,\n" +
"ChassisNumber,\n" +
"OrderBillNum KENNCode,\n" +
"ChassisNumber2,\n" +
"KENNCode KENNCode2,\n" +
"QTY,\n" +
"ErpMaterialCode ,\n" +
"'L' FLAG\n" +
"FROM\n" +
"Set_fis\n" +
"WHERE\n" +
"1 = 1\n" +
"AND STATE = 4\n" +
")\n" +
"tm1\n" +
"GROUP BY\n" +
"MaterialCode,\n" +
"KENNCode2,\n" +
"ChassisNumber2,\n" +
"KENNCode,\n" +
"ChassisNumber,\n" +
"FLAG\n" +
") A\n" +
"left join (\n" +
"select\n" +
"*\n" +
"from\n" +
"Set_Unsettle\n" +
"where\n" +
"version = '{1}') f\n" +
"on\n" +
"a.MaterialCode = f.MaterialCode\n" +
"and a.KENNCode2 = f.KENNCode\n" +
"and a.ChassisNumber2 = f.ChassisNumber\n" +
"LEFT JOIN Set_material B ON\n" +
"a.MaterialCode = b.CustomerPartCode\n" +
"LEFT JOIN (\n" +
"select\n" +
"max(Id) Id,\n" +
"MaterialCode,\n" +
"MaterialDesc\n" +
"from\n" +
"Set_material\n" +
"group by\n" +
"MaterialCode,\n" +
"MaterialDesc) d ON\n" +
"a.ParentSapMaterialCode = d.MaterialCode\n" +
") temp1\n" +
"LEFT JOIN (\n" +
"SELECT\n" +
"Price,\n" +
"MaterialCode\n" +
"FROM\n" +
"Set_PriceList\n" +
"WHERE\n" +
"version = (\n" +
"SELECT\n" +
"Max(Version)\n" +
"FROM\n" +
"Set_PriceList ) ) temp2 ON\n" +
"temp1.SapMaterialCode = temp2.MaterialCode\n";
//var _materialList = DbConnection.Query<Material>("select * from set_material").ToList();
//var _priceList = DbConnection.Query<PriceList>("select MaterialCode,Price from Set_PriceList where version=(select max(version) from set_Set_PriceListVersion)").ToList();
string _sql = string.Format(sqlString, str, version);
;
var _query = DbConnection.Query<UnSettleDetailReport>(_sql);
var _list = _query.ToList();
//_list= _list.Where(p => p.SapMaterialCode == sapCode).ToList();
return _list;
}
/// <summary> /// <summary>
/// 漏结 /// 漏结
/// </summary> /// </summary>

66
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs

@ -81,17 +81,17 @@ namespace SettleAccount.Job.Services.Report
var _first = exportName.FirstOrDefault(); var _first = exportName.FirstOrDefault();
var _ls = new List<UnSettleDiff>(); var _ls = new List<UnSettleDiff>();
_ls = _dapper.GetDiffReport(0,begin,end, materialCode,kenncode,chassisNumber,version); _ls = _dapper.GetDiffReport1(0,begin,end, materialCode,kenncode,chassisNumber,version);
foreach (var itm in _ls) //foreach (var itm in _ls)
{ //{
if (itm.KENNCode.Length > 8) // if (itm.KENNCode.Length > 8)
{ // {
itm.UNSettleQty = 1; // itm.UNSettleQty = 1;
itm.DiffQty = 0; // itm.DiffQty = 0;
itm.DiffAmt = 0; // itm.DiffAmt = 0;
} // }
} //}
var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode && !string.IsNullOrEmpty(p.ParentSapMaterialCode)).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode }) var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode && !string.IsNullOrEmpty(p.ParentSapMaterialCode)).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
@ -218,21 +218,7 @@ namespace SettleAccount.Job.Services.Report
DiffAmt = p.Sum(p => p.DiffAMT) DiffAmt = p.Sum(p => p.DiffAMT)
}); });
//var lst2 = LJ(id, exportName, p_list);
//_lsSum2= lst2.GroupBy(p => new { p.SapMaterialCode, p.MaterialCode, p.MaterialDesc, p.MaterialGroup })
// .Select(p =>
// new SumSettleDiffList
// {
// SapMaterialCode = p.Key.SapMaterialCode,
// MaterialCode = p.Key.MaterialCode,
// MaterialDesc = p.Key.MaterialDesc,
// MaterialGroup = p.Key.MaterialGroup,
// Qty = p.Sum(p => p.Qty),
// UnSettleQty = p.Sum(p => p.UnSettleQty),
// DiffQty = p.Sum(p => p.DiffQty),
// DiffAmt = p.Sum(p => p.DiffAMT)
// });
if (_ls1.Count() > 900000) if (_ls1.Count() > 900000)
{ {
@ -328,7 +314,7 @@ namespace SettleAccount.Job.Services.Report
return id.ToString(); return id.ToString();
} }
public List<UnSettleDetailReport> ExportList( List<CustomCondition> p_list) public List<UnSettleDetailReport1> ExportList( List<CustomCondition> p_list)
{ {
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value;
@ -341,23 +327,23 @@ namespace SettleAccount.Job.Services.Report
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value; var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value; //var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value; //var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
var _list = _dapper1.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, string.Empty, version, materialCode, materialGroup, sapCode); var _list = _dapper1.GetDiffReport1(DateTime.Now.Year.ToString(), begin, end, string.Empty, version, materialCode, materialGroup, sapCode);
foreach (var itm in _list) //foreach (var itm in _list)
{ //{
if (itm.UnSettleQty > 0) // if (itm.UnSettleQty > 0)
{ // {
itm.UnSettleQty = 1; // itm.UnSettleQty = 1;
} // }
itm.DiffQty = itm.Qty - itm.UnSettleQty; // itm.DiffQty = itm.Qty - itm.UnSettleQty;
if (itm.DiffQty == 0) // if (itm.DiffQty == 0)
{ // {
itm.DiffAMT = 0; // itm.DiffAMT = 0;
} // }
} //}
var _ls = _list.Where(p => p.Flag != "L").Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); var _ls = _list.Where(p => p.Flag != "L" && !p.ParentSapMaterialCode.Contains(",")).Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _compareLs = _ls.Where(p => p.DiffQty == 0).Select(p => new { p.ChassisNumber, p.KENNCode, p.ParentSapMaterialCode }); var _compareLs = _ls.Where(p => p.DiffQty == 0).Select(p => new { p.ChassisNumber, p.KENNCode, p.ParentSapMaterialCode });
var rangeList = _erpdapperRepository.GetSapList(_ls, version, false); var rangeList = _erpdapperRepository.GetSapList(_ls, version, false);
var query = from itm1 in rangeList var query = from itm1 in rangeList
@ -366,7 +352,7 @@ namespace SettleAccount.Job.Services.Report
new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber } new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber }
into temp1 into temp1
from tm1 in temp1.DefaultIfEmpty() from tm1 in temp1.DefaultIfEmpty()
select new UnSettleDetailReport select new UnSettleDetailReport1
{ {
WmsBillNum = itm1.WmsBillNum, WmsBillNum = itm1.WmsBillNum,
CP5Time = itm1.CP5Time, CP5Time = itm1.CP5Time,

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

@ -73,6 +73,7 @@ namespace SettleAccount.Job.Services.Report
[UnitOfWork(false)] [UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{ {
var _lsExport= GetReport(id,exportName,p_list); var _lsExport= GetReport(id,exportName,p_list);
var _first = exportName.FirstOrDefault(); var _first = exportName.FirstOrDefault();
@ -99,13 +100,13 @@ namespace SettleAccount.Job.Services.Report
//var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value; //var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
//var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value; //var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
//var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value; //var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value; //var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value; //var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, datetime, "", version, materailCode, materialGroup, "");
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, "", version, materailCode, materialGroup, "");
var _ls = _list.Where(p => p.Flag != "L").Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); var _ls = _list.Where(p => p.Flag != "L").Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _lst = _erpDapper.GetSapList(_ls, version, false); var _lst = _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p => _lst.ForEach(p =>
@ -204,8 +205,11 @@ namespace SettleAccount.Job.Services.Report
//var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value; //var kenncode = p_list.Where(p => p.Name == "KennCode").FirstOrDefault().Value;
//var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value; //var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value;
//var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value; //var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
var _ls = _kanbanDapper.GetKanbanReportList(version, begin, end, iscontionversion); var _ls = _kanbanDapper.GetKanbanReportList(version, begin, datetime, iscontionversion);
//if (!string.IsNullOrEmpty(sapCode)) //if (!string.IsNullOrEmpty(sapCode))
@ -235,6 +239,7 @@ namespace SettleAccount.Job.Services.Report
} }
var kanbanList = _ls.GroupBy(p => new { p.SapCode, p.MaterialDesc, p.MaterialGroup, p.CustomerPartCode }) var kanbanList = _ls.GroupBy(p => new { p.SapCode, p.MaterialDesc, p.MaterialGroup, p.CustomerPartCode })
.Select(p => new UnSettledSum .Select(p => new UnSettledSum
{ {
@ -275,8 +280,13 @@ 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 iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value; //var iscontionversion = p_list.Where(p => p.Name == "IsContainVersion").FirstOrDefault().Value;
var iscontionversion = "1";//不分区间,全查 var iscontionversion = "1";//不分区间,全查
//有发货无结算,单独拿出去,财务要求 //有发货无结算,单独拿出去,财务要求
var _ls = _hqkanbanDapper.GetReverseSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup, iscontionversion);
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
var _ls = _hqkanbanDapper.GetReverseSettledDetailDiffReportList(version, materialCode, begin, datetime, materialGroup, iscontionversion);
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();
@ -313,9 +323,12 @@ namespace SettleAccount.Job.Services.Report
var beginTime = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value; var beginTime = p_list.Where(p => p.Name == "Begin").FirstOrDefault().Value;
var endTime = p_list.Where(p => p.Name == "End").FirstOrDefault().Value; var endTime = p_list.Where(p => p.Name == "End").FirstOrDefault().Value;
var datestr = version.Substring(0, 4) + "-" + version.Substring(4, 2) + "-01";
var date = DateTime.Parse(datestr).AddMonths(1).AddDays(-1);
var datetime = date.ToShortDateString() + " 23:59:59 ";
//var _ls = _sparepartdapper.GetReverseWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime); //var _ls = _sparepartdapper.GetReverseWithCodeSettleSparePartReportList(purchaseOrderNo, version, sapCode, matialCode, beginTime, endTime);
var _ls = _sparepartdapper.GetReverseWithCodeSettleSparePartReportList("", version, sapCode, matialCode, beginTime, endTime); var _ls = _sparepartdapper.GetReverseWithCodeSettleSparePartReportList("", version, sapCode, matialCode, beginTime, datetime);
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();

Loading…
Cancel
Save