Administrator 3 years ago
parent
commit
5a6e61cd54
  1. 1
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  2. 393
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs
  3. 46
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 3
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQFactoryUnSettledDetailDiffExportService.cs
  5. 1
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs

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

@ -773,6 +773,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
customConditionList.Add(new CustomCondition() { Name = "Kanban", Value = input.Kanban });
customConditionList.Add(new CustomCondition() { Name = "MaterialGroup", Value = string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup });
customConditionList.Add(new CustomCondition() { Name = "SapCode", Value = string.IsNullOrEmpty(input.SapCode) ? string.Empty : input.SapCode });
customConditionList.Add(new CustomCondition() { Name = "IsContainVersion", Value = input.IsContainVersion });
var _taskid = await _service.ExportEnqueueAsync("红旗未结核对", ExportExtentsion.Excel, input.Version, string.IsNullOrEmpty(input.MaterialGroup) ? string.Empty : input.MaterialGroup, CurrentUser, typeof(HQFactoryUnSettledDetailDiffExportService), customConditionList, (rs) =>
{
});

393
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs

@ -203,41 +203,41 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var sql11 = "SELECT DISTINCT\n" +
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.KanbanNumber AS KanbanNumber,\n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" +
" HQHKanBan,\n" +
" b2.MaterialCode \n" +
" FROM\n" +
" Set_UnHQSettleAccount a\n" +
" LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" +
" WHERE\n" +
" Version = '{0}' \n" +
" AND HQHKanBan <> 'BJ' \n" +
" ) t1\n" +
" INNER JOIN (\n" +
" SELECT\n" +
" HQHKanBan,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_UnHQSettleAccount a \n" +
" WHERE\n" +
" Version = '{0}' \n" +
" AND HQHKanBan <> 'BJ' \n" +
" GROUP BY\n" +
" HQHKanBan,\n" +
" MaterialCode \n" +
" HAVING\n" +
" COUNT ( * ) > 1 \n" +
" ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
"ORDER BY\n" +
" t1.HQHKanBan,\n" +
" t1.MaterialCode";
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.KanbanNumber AS KanbanNumber,\n" +
" CONVERT ( VARCHAR ( 100 ), a.AcceptanceDate, 23 ) AS AcceptanceDate,\n" +
" HQHKanBan,\n" +
" b2.MaterialCode \n" +
" FROM\n" +
" Set_UnHQSettleAccount a\n" +
" LEFT JOIN Set_material b2 ON a.MaterialCode = b2.CustomerPartCode \n" +
" WHERE\n" +
" Version = '{0}' \n" +
" AND HQHKanBan <> 'BJ' \n" +
" ) t1\n" +
" INNER JOIN (\n" +
" SELECT\n" +
" HQHKanBan,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_UnHQSettleAccount a \n" +
" WHERE\n" +
" Version = '{0}' \n" +
" AND HQHKanBan <> 'BJ' \n" +
" GROUP BY\n" +
" HQHKanBan,\n" +
" MaterialCode \n" +
" HAVING\n" +
" COUNT ( * ) > 1 \n" +
" ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
"ORDER BY\n" +
" t1.HQHKanBan,\n" +
" t1.MaterialCode";
var list12 = DbConnection.Query<CompareExtend1>(string.Format(sql11, version));
@ -355,7 +355,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
/// <param name="end"></param>
/// <param name="materialGroup"></param>
/// <returns></returns>
public virtual List<HQFactoryUnSettledDetailDiff> GetSettleToFactoryDetailDiffReportList(string version, string materialCode, string begin, string end, string materialGroup)
public virtual List<HQFactoryUnSettledDetailDiff> GetSettleToFactoryDetailDiffReportList(string version, string materialCode,
string begin, string end, string materialGroup, string iscontionversion)
{
List<HQFactoryUnSettledDetailDiff> _list = new List<HQFactoryUnSettledDetailDiff>();
@ -370,66 +371,306 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{
condition += string.Format(" and a.LastModificationTime<='{0}' ", end);
}
string contion = string.Empty;
//选中,是否过滤掉当期结算数据
if (iscontionversion == "0")
{
contion += string.Format(" WHERE Version <'{0}' ", version);
}
else
{
contion += " WHERE 1=1 ";
}
//按照客户财务要求 去掉结算验收单号换成外部验收单号
//string str = "SELECT\n" +
//" temp1.交货单号,\n" +
//" temp1.交货时间,\n" +
//" temp1.收货仓库,\n" +
//" temp1.收货仓库描述,\n" +
//" temp1.订货看板编号,\n" +
//" temp1.外部验收单号,\n" +
//" temp1.Sap编码,\n" +
//" temp1.[客户物料号],\n" +
//" temp1.物料组,\n" +
//" temp1.零件中文名称,\n" +
//" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
//" ISNULL( temp1.系统未结数量, 0 ) 系统未结数量,\n" +
//" isnull( temp3.Qty, 0 ) AS 红旗未结数量,\n" +
//" ( ISNULL( temp1.系统未结数量, 0 ) - ISNULL( temp3.Qty, 0 ) ) 差异 \n" +
//"FROM\n" +
//" (\n" +
//" SELECT\n" +
//" a.WmsBillNum [交货单号],\n" +
//" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) 交货时间,\n" +
//" b.StorageLocation AS 收货仓库,\n" +
//" b.StorageLocationDesc AS 收货仓库描述,\n" +
//" a.Kanban AS 订货看板编号,\n" +
//" c.MaterialCode Sap编码,\n" +
//" c.CustomerPartCode 客户物料号,\n" +
//" c.MaterialDesc AS 零件中文名称,\n" +
//" isnull( a.Qty, 0 ) AS 系统未结数量,\n" +
//" b.ExternalKanbanNumber AS 外部验收单号,\n" +
//" C.EstimateTypeDesc AS 物料组 \n" +
//" FROM\n" +
//" ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode, WmsBillNum, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode, WmsBillNum, LastModificationTime ) AS a\n" +
//" LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) 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 {0}\n" +
//" ) AS temp1\n" +
//" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
//" LEFT JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount GROUP BY HQHKanBan, MaterialCode ) temp3 ON temp1.[订货看板编号] = temp3.HQHKanBan \n" +
//" AND temp1.[客户物料号] = temp3.MaterialCode";
string str = "SELECT\n" +
" temp1.交货单号,\n" +
" temp1.交货时间,\n" +
" temp1.收货仓库,\n" +
" temp1.收货仓库描述,\n" +
" temp1.订货看板编号,\n" +
" temp1.外部验收单号,\n" +
" temp1.Sap编码,\n" +
" temp1.[客户物料号],\n" +
" temp1.物料组,\n" +
" temp1.零件中文名称,\n" +
" temp.交货单号,\n" +
" temp.交货时间,\n" +
" temp.订货看板编号,\n" +
" temp.外部验收单号,\n" +
" temp.Sap编码,\n" +
" temp.[客户物料号],\n" +
" temp.物料组,\n" +
" temp.零件中文名称,\n" +
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" ISNULL( temp1.系统未结数量, 0 ) 系统未结数量,\n" +
" temp.发货数量,\n" +
" temp.结算数量,\n" +
" temp.退货数量,\n" +
" ISNULL( temp.系统未结数量, 0 ) 系统未结数量,\n" +
" isnull( temp3.Qty, 0 ) AS 红旗未结数量,\n" +
" ( ISNULL( temp1.系统未结数量, 0 ) - ISNULL( temp3.Qty, 0 ) ) 差异 \n" +
" ( ISNULL( temp.系统未结数量, 0 ) - ISNULL( temp3.Qty, 0 ) ) 差异 \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.WmsBillNum [交货单号],\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) 交货时间,\n" +
" b.StorageLocation AS 收货仓库,\n" +
" b.StorageLocationDesc AS 收货仓库描述,\n" +
" a.Kanban AS 订货看板编号,\n" +
" c.MaterialCode Sap编码,\n" +
" c.CustomerPartCode 客户物料号,\n" +
" c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 系统未结数量,\n" +
" b.ExternalKanbanNumber AS 外部验收单号,\n" +
" C.EstimateTypeDesc AS 物料组 \n" +
" * \n" +
" FROM\n" +
" ( SELECT SUM ( Qty ) AS Qty, Kanban, MaterialCode, WmsBillNum, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY Kanban, MaterialCode, WmsBillNum, LastModificationTime ) AS a\n" +
" LEFT OUTER JOIN ( SELECT * FROM Set_HQ_H_Platform WHERE HQHKanBan <> 'BJ' ) 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 {0}\n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
" LEFT JOIN ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount GROUP BY HQHKanBan, MaterialCode ) temp3 ON temp1.[订货看板编号] = temp3.HQHKanBan \n" +
" AND temp1.[客户物料号] = temp3.MaterialCode";
var _sql = string.Format(str, condition);
" (\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 = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) 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 = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) 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 temp\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) 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" +
" AND temp.[客户物料号] = temp3.MaterialCode";
var _sql = string.Format(str, version,contion);
//发运数据中,查出看板号+物料号相同的重复数据
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<CompareFactoryExtend>(_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(sql2, condition);
var listCompare1 = DbConnection.Query<CompareFactoryExtend>(_sql3);
//发运数据比较
List<CompareFactoryExtend> _ls = new List<CompareFactoryExtend>();
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<HQFactoryUnSettledDetailDiff>(_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;
}
public class CompareFactoryExtend
{
public string WmsBillNum { set; get; }
public string MaterialCode { set; get; }
public string Kanban { set; get; }
public string WmsDate { set; get; }
}
public class CompareFactoryExtend1
{
public string ExternalKanbanNumber { set; get; }
public string KanbanNumber { set; get; }
public string AcceptanceDate { set; get; }
public string HQHKanBan { set; get; }
public string MaterialCode { set; get; }
}
public class HQFactoryUnSettledDetailDiff
{
[ExporterHeader(DisplayName = "交货单号")]
public string { set; get; }
[ExporterHeader(DisplayName = "交货时间")]
public string { set; get; }
[ExporterHeader(DisplayName = "收货仓库")]
[ExporterHeader(DisplayName = "收货仓库", IsIgnore = true)]
public string { set; get; }
[ExporterHeader(DisplayName = "收货仓库描述")]
[ExporterHeader(DisplayName = "收货仓库描述", IsIgnore = true)]
public string { set; get; }
[ExporterHeader(DisplayName = "订货看板编号")]
public string { set; get; }
@ -459,6 +700,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
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 = "红旗未结数量")]

46
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs

@ -388,7 +388,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
}
/// <summary>
/// 有结算无发货报表
/// 有结算无发货报表,同时按照财务要求“看板号为空”也要归为未结当中,所以做了UNION ALL
/// </summary>
/// <param name="version"></param>
/// <param name="materialCode"></param>
@ -421,7 +421,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.零件中文名称,\n" +
" temp1.发货数量,\n" +
" temp1.发货状态,\n" +
" temp1.结算验收单号,\n" +
" temp1.外部验收单号,\n" +
" temp1.结算数量,\n" +
" temp1.结算单价,\n" +
" temp1.结算金额,\n" +
@ -483,7 +483,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.零件中文名称,\n" +
" temp1.发货数量,\n" +
" temp1.发货状态,\n" +
" temp1.结算验收单号,\n" +
" temp1.外部验收单号,\n" +
" temp1.结算数量,\n" +
" temp3.Price AS 结算单价,\n" +
" ( temp1.[结算数量] * ISNULL( temp3.Price, 0 ) ) AS 结算金额,\n" +
@ -507,7 +507,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" c.MaterialDesc AS 零件中文名称,\n" +
" 0 AS 发货数量,\n" +
" 0 AS 发货状态,\n" +
" a.ExternalKanbanNumber AS 结算验收单号,\n" +
" a.ExternalKanbanNumber AS 外部验收单号,\n" +
" isnull( a.Qty, 0 ) AS 结算数量,\n" +
" C.EstimateTypeDesc AS 物料组,\n" +
" a.Factory AS 工厂,\n" +
@ -606,7 +606,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.交货时间,\n" +
" isnull( temp1.交货单号, '' ) 交货单号,\n" +
" temp1.订货看板编号,\n" +
" temp1.订货零件号,\n" +
@ -629,7 +628,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" SELECT\n" +
" '' AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" a.Kanban AS 订货看板编号,\n" +
" b.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" +
@ -642,16 +640,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" 0 AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode, LastModificationTime ) AS a\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 {0} 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 {1}\n" +
" AND b.MaterialCode IS NULL \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
" LEFT JOIN (select * from set_backQty WHERE Version='{2}') tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" LEFT JOIN (select * from set_backQty WHERE Version='{1}') tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION1 UNION ALL\n" +
"SELECT\n" +
@ -659,7 +657,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"FROM\n" +
" (\n" +
" SELECT\n" +
" temp1.交货时间,\n" +
" isnull( temp1.交货单号, '' ) 交货单号,\n" +
" temp1.订货看板编号,\n" +
" temp1.订货零件号,\n" +
@ -682,7 +679,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" (\n" +
" SELECT\n" +
" '' AS 交货单号,\n" +
" CONVERT ( VARCHAR ( 100 ), a.LastModificationTime, 23 ) AS 交货时间 ,\n" +
" a.Kanban AS 订货看板编号,\n" +
" b.MaterialCode AS 订货零件号,\n" +
" c.MaterialCode Sap编码,\n" +
@ -695,20 +691,21 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" isnull( b.Qty, 0 ) * isnull( b.Price, 0 ) AS 结算金额 ,\n" +
" C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode, LastModificationTime FROM Set_HQ_H_Kanban GROUP BY kanban, MaterialCode, LastModificationTime ) AS a\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,Price FROM Set_HQ_H_Platform {0} GROUP BY HQHKanBan, MaterialCode,Price ) 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 {1}\n" +
" a.Qty> b.Qty \n" +
" ) AS temp1\n" +
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) FROM Set_PriceList ) ) ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
" LEFT JOIN (select * from set_backQty WHERE Version='{2}') tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" LEFT JOIN (select * from set_backQty WHERE Version='{1}') tt ON temp1.Sap编码 = tt.MaterialCode \n" +
" AND temp1.订货看板编号 = tt.Code \n" +
" ) UNION2";
var _sql = string.Format(str, contion, condition,version);
//var _sql = string.Format(str, contion, condition,version);
var _sql = string.Format(str, contion, version);
@ -717,13 +714,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" a.WmsBillNum,\n" +
" t1.MaterialCode MaterialCode,\n" +
" a.Kanban ,\n" +
" A.LastModificationTime WmsDate \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 ";
var listCompare = DbConnection.Query<CompareExtend>(sql2);
" 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(str, condition);
var listCompare = DbConnection.Query<CompareExtend>(_sql2);
@ -741,9 +741,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" left join Set_material t1 on a.MaterialCode=t1.CustomerPartCode \n" +
"WHERE\n" +
" B.Kanban IS NULL";
" B.Kanban IS NULL {0}";
var listCompare1 = DbConnection.Query<CompareExtend>(sql3);
var _sql3 = string.Format(str, condition);
var listCompare1 = DbConnection.Query<CompareExtend>(_sql3);
string contionCompare = string.Empty;

3
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQFactoryUnSettledDetailDiffExportService.cs

@ -56,11 +56,12 @@ namespace SettleAccount.Job.Services.Report
var acceptNo = p_list.Where(p => p.Name == "AcceptNo").FirstOrDefault().Value;
var sapCode = p_list.Where(p => p.Name == "SapCode").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 _ls = _dapperRepository.GetSettleToFactoryDetailDiffReportList(version, materialCode, begin, end, materialGroup);
var _ls = _dapperRepository.GetSettleToFactoryDetailDiffReportList(version, materialCode, begin, end, materialGroup,iscontionversion);
//红旗主机厂未结比对红旗系统未对
var _ls_reversal = _dapperRepository.GetHQFactoryDetailDiffReportList(version, materialCode, begin, end, materialGroup);

1
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/HQHSettledDetailDiffExportService.cs

@ -57,6 +57,7 @@ namespace SettleAccount.Job.Services.Report
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var warehouseDesc = p_list.Where(p => p.Name == "WarehouseDesc").FirstOrDefault().Value;
//红旗结算核对明细
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, materialGroup);
//有结算无发货报表

Loading…
Cancel
Save