Browse Source

日常提交

FoShanPG
44673626 2 years ago
parent
commit
22b1c934c1
  1. 8
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSCusomerKanbanAppService.cs
  2. 495
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQFactorySettledDetailDapperRepository.cs
  3. 21
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQHSettledDetailDapperRepository.cs
  4. 8
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

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

@ -366,11 +366,11 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
[UnitOfWork(false)] [UnitOfWork(false)]
public async Task<bool> WmsCustomerKanbanOutPutPass(WmsJitRequestDto input) public async Task<bool> WmsCustomerKanbanOutPutPass(WmsJitRequestDto input)
{ {
if (DateTime.Now.ToString("yyyyMM") != input.AccountDate.ToString("yyyyMM")) //if (DateTime.Now.ToString("yyyyMM") != input.AccountDate.ToString("yyyyMM"))
{ //{
throw new BusinessException("8989", "填写过账日期应该为当月!"); // throw new BusinessException("8989", "填写过账日期应该为当月!");
} //}

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

@ -2,6 +2,7 @@
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -33,6 +34,152 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
List<HQSettledUnFactoryDetailDiff> _list = new List<HQSettledUnFactoryDetailDiff>(); List<HQSettledUnFactoryDetailDiff> _list = new List<HQSettledUnFactoryDetailDiff>();
var _query = DbConnection.Query<HQSettledUnFactoryDetailDiff>("[p_hq_unsettle_factory_weijie]", new { begin = begin, end = end, version = version, iscontionversion = iscontionversion }, null, true, 1200, CommandType.StoredProcedure);
_list = _query.ToList();
//看板号不是备件也不为空
var sql10 = " SELECT DISTINCT \n" +
" t1.* \n" +
" FROM \n" +
" ( \n" +
" SELECT \n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.Factory,\n" +
" a.StorageLocationDesc,\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" +
" LEFT JOIN ( SELECT HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount a WHERE Version = '{0}' AND HQHKanBan <> 'BJ' GROUP BY HQHKanBan, MaterialCode HAVING count(*)> 1 ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
" WHERE \n" +
" t2.HQHKanBan IS NULL ";
var list11 = DbConnection.Query<CompareExtendFactory>(string.Format(sql10, version));
var sql11 = "SELECT DISTINCT\n" +
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.KanbanNumber AS KanbanNumber,\n" +
" a.Factory,\n" +
" a.StorageLocationDesc,\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<CompareExtendFactory>(string.Format(sql11, version));
//看板号为备件
var sql12 = "SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.Factory,\n" +
" a.StorageLocationDesc,\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'";
var list13 = DbConnection.Query<CompareExtendFactory>(string.Format(sql12, version));
List<CompareExtendFactory> _lscopy = new List<CompareExtendFactory>();
//看板号不为空
foreach (var itm in list11)
{
var first = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm.HQHKanBan && p.MaterialCode == itm.MaterialCode);
if (first != null)
{
first.ExternalKanbanNumber += "," + itm.ExternalKanbanNumber;
}
else
{
_lscopy.Add(itm);
}
}
foreach (var itm in list12)
{
_lscopy.Add(itm);
}
//看板号为备件BJ
foreach (var itm in list13)
{
_lscopy.Add(itm);
//var first = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm.HQHKanBan && p.MaterialCode == itm.MaterialCode);
//if (first != null)
//{
// first.ExternalKanbanNumber += "," + itm.ExternalKanbanNumber;
//}
//else
//{
// _lscopy.Add(itm);
//}
}
foreach (var itm1 in _list)
{
var itmcopy = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm1. && p.MaterialCode == itm1.Sap编码);
if (itmcopy != null)
{
itm1. = itmcopy.ExternalKanbanNumber;
}
}
return _list;
}
public virtual List<HQSettledUnFactoryDetailDiff> GetHQFactoryDetailDiffReportList_org(string version, string materialCode,
string begin, string end, string materialGroup, string iscontionversion)
{
List<HQSettledUnFactoryDetailDiff> _list = new List<HQSettledUnFactoryDetailDiff>();
string condition = " "; string condition = " ";
if (!string.IsNullOrEmpty(begin)) if (!string.IsNullOrEmpty(begin))
@ -66,135 +213,6 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
conditionDate += string.Format(" and LastModificationTime<='{0}' ", end); conditionDate += string.Format(" and LastModificationTime<='{0}' ", end);
} }
#region
//string str = "SELECT\n" +
// " temp3.HQHKanBan 订货看板编号, temp3.ExternalKanbanNumber 外部单号,\n" +
// " temp3.MaterialCode Sap编码,\n" +
// " temp3.hqMaterialCode 客户物料号,\n" +
// " temp3.EstimateTypeDesc 物料组,\n" +
// " temp3.MaterialDesc 零件中文名称,\n" +
// " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
// " temp3.发货数量,\n" +
// " temp3.结算数量,\n" +
// " temp3.退货数量,\n" +
// " temp3.系统未结数量,\n" +
// " temp3.UnHQQty 红旗未结数量,\n" +
// " ( ISNULL( temp3.系统未结数量, 0 ) - ISNULL( temp3.UnHQQty, 0 ) ) 差异 \n" +
// "FROM\n" +
// " (\n" +
// " SELECT\n" +
// " * \n" +
// " FROM\n" +
// " (\n" +
// " SELECT\n" +
// " h.HQHKanBan, h.ExternalKanbanNumber, \n" +
// " m.MaterialCode,\n" +
// " h.MaterialCode hqMaterialCode,\n" +
// " m.CustomerPartCode,\n" +
// " m.MaterialDesc,\n" +
// " m.EstimateTypeDesc,\n" +
// " ISNULL( h.Qty, 0 ) AS UnHQQty \n" +
// " FROM\n" +
// " ( SELECT SUM ( Qty ) Qty, HQHKanBan, MaterialCode,ExternalKanbanNumber FROM Set_UnHQSettleAccount WHERE Version ='{0}' GROUP BY HQHKanBan, MaterialCode,ExternalKanbanNumber ) AS h\n" +
// " LEFT JOIN Set_material AS m ON h.MaterialCode = m.CustomerPartCode \n" +
// " ) AS unhq\n" +
// " LEFT JOIN (\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 WHERE 1=1 {2} 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 = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
// " LEFT JOIN set_backQty 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 WHERE 1=1 {2} 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 = '202110' ) AS TEMP2 ON temp1.Sap编码 = TEMP2.MaterialCode\n" +
// " LEFT JOIN set_backQty tt ON temp1.Sap编码 = tt.MaterialCode \n" +
// " AND temp1.订货看板编号 = tt.Code \n" +
// " ) UNION2 \n" +
// " ) AS temp1 ON unhq.HQHKanBan = temp1.[订货看板编号] \n" +
// " AND unhq.CustomerPartCode= temp1.客户物料号 WHERE temp1.[订货看板编号] is null and temp1.客户物料号 is null \n" +
// " ) temp3\n" +
// " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode";
#endregion
//temp3.HQHKanBan 订货看板编号 temp3.ExternalKanbanNumber 外部单号 //temp3.HQHKanBan 订货看板编号 temp3.ExternalKanbanNumber 外部单号
@ -348,7 +366,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode"; " LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE Version = '202110' ) AS TEMP2 ON temp3.MaterialCode = TEMP2.MaterialCode";
var _sql = string.Format(str,version, contion,conditionDate); var _sql = string.Format(str, version, contion, conditionDate);
@ -594,7 +612,197 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
List<HQFactoryUnSettledDetailDiff> _list = new List<HQFactoryUnSettledDetailDiff>(); List<HQFactoryUnSettledDetailDiff> _list = new List<HQFactoryUnSettledDetailDiff>();
string condition = ""; var _query = DbConnection.Query<HQFactoryUnSettledDetailDiff>("[dbo].[p_hq_unsettle_weijie_factory]", new { begin = begin, end = end, version = version, iscontionversion = iscontionversion }, null, true, 1200, CommandType.StoredProcedure);
_list = _query.ToList();
var listCompare = DbConnection.Query<CompareExtendWjFactory>("[dbo].[p_hq_unsettle_inner_1]", new { begin = begin, end = end }, null, true, 1200, CommandType.StoredProcedure);
var listCompare1 = DbConnection.Query<CompareExtendWjFactory>("[dbo].[p_hq_unsettle_leftjoin_1]", new { begin = begin, end = end }, null, true, 1200, CommandType.StoredProcedure);
var sql10 = " SELECT DISTINCT \n" +
" t1.* \n" +
" FROM \n" +
" ( \n" +
" SELECT \n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.Factory,\n" +
" a.StorageLocationDesc,\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" +
" LEFT JOIN ( SELECT HQHKanBan, MaterialCode FROM Set_UnHQSettleAccount a WHERE Version = '{0}' AND HQHKanBan <> 'BJ' GROUP BY HQHKanBan, MaterialCode HAVING count(*)> 1 ) t2 ON t1.HQHKanBan = t2.HQHKanBan \n" +
" AND t1.MaterialCode = t2.MaterialCode \n" +
" WHERE \n" +
" t2.HQHKanBan IS NULL ";
var list11 = DbConnection.Query<CompareExtendFactory>(string.Format(sql10, version));
var sql11 = "SELECT DISTINCT\n" +
" t1.* \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.KanbanNumber AS KanbanNumber,\n" +
" a.Factory,\n" +
" a.StorageLocationDesc,\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<CompareExtendFactory>(string.Format(sql11, version));
var sql12 = "SELECT\n" +
" a.ExternalKanbanNumber AS ExternalKanbanNumber,\n" +
" a.Factory,\n" +
" a.StorageLocationDesc,\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'";
var list13 = DbConnection.Query<CompareExtendFactory>(string.Format(sql12, version));
List<CompareExtendFactory> _lscopy = new List<CompareExtendFactory>();
foreach (var itm in list11)
{
var first = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm.HQHKanBan && p.MaterialCode == itm.MaterialCode);
if (first != null)
{
first.Factory += "," + itm.Factory;
first.StorageLocationDesc += "," + itm.StorageLocationDesc;
first.ExternalKanbanNumber += "," + itm.ExternalKanbanNumber;
}
else
{
_lscopy.Add(itm);
}
}
foreach (var itm in list12)
{
_lscopy.Add(itm);
}
foreach (var itm in list13)
{
_lscopy.Add(itm);
}
//发运数据比较
List<CompareExtendWjFactory> _ls = new List<CompareExtendWjFactory>();
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);
}
//数据整合,相同看板号+物料号的交货单号合并成一行中以逗号分隔
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;
// itm1.退货数量 = itm.ReturnQty;
}
var itmcopy = _lscopy.FirstOrDefault(p => p.HQHKanBan == itm1. && p.MaterialCode == itm1.Sap编码);
if (itmcopy != null)
{
itm1. = itmcopy.Factory;
itm1. = itmcopy.StorageLocationDesc;
itm1. = itmcopy.ExternalKanbanNumber;
}
}
return _list;
}
public virtual List<HQFactoryUnSettledDetailDiff> GetSettleToFactoryDetailDiffReportList_org(string version, string materialCode,
string begin, string end, string materialGroup, string iscontionversion)
{
List<HQFactoryUnSettledDetailDiff> _list = new List<HQFactoryUnSettledDetailDiff>();
string condition = "";//用于动态匹配
if (!string.IsNullOrEmpty(begin)) if (!string.IsNullOrEmpty(begin))
{ {
@ -641,7 +849,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" temp.发货数量,\n" + " temp.发货数量,\n" +
" isnull( TEMP2.Price, 0 )*isnull(temp.发货数量, 0 ) 系统未结总金额,\n" + " isnull( TEMP2.Price, 0 )*isnull(temp.发货数量, 0 ) 系统未结总金额,\n" +
" temp.结算数量,\n" + " temp.往期已结,\n" +
" temp.退货数量,\n" + " temp.退货数量,\n" +
" temp3.Factory AS 工厂,temp3.ExternalKanbanNumber 外部单号,temp3.StorageLocationDesc 存储地点描述,\n" + " temp3.Factory AS 工厂,temp3.ExternalKanbanNumber 外部单号,temp3.StorageLocationDesc 存储地点描述,\n" +
" ISNULL( temp.系统未结数量, 0 ) 系统未结数量,\n" + " ISNULL( temp.系统未结数量, 0 ) 系统未结数量,\n" +
@ -664,11 +872,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.零件中文名称,\n" + " temp1.零件中文名称,\n" +
" temp1.发货数量,\n" + " temp1.发货数量,\n" +
" temp1.外部单号,\n" + " temp1.外部单号,\n" +
" temp1.结算数量,\n" + " temp1.往期已结,\n" +
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" + " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
" isnull( tt.Qty, 0 ) 退货数量,\n" + " isnull( tt.Qty, 0 ) 退货数量,\n" +
" isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量\n" + " isnull( temp1.发货数量, 0 ) - isnull( temp1.往期已结, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量\n" +
" FROM\n" + " FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
@ -680,7 +888,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" c.MaterialDesc AS 零件中文名称,\n" + " c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" + " isnull( a.Qty, 0 ) AS 发货数量,\n" +
" b.ExternalKanbanNumber AS 外部单号,\n" + " b.ExternalKanbanNumber AS 外部单号,\n" +
" isnull( b.Qty, 0 ) AS 结算数量,\n" + " isnull( b.Qty, 0 ) AS 往期已结,\n" +
" C.EstimateTypeDesc AS 物料组 \n" + " C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" + " FROM\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {0} GROUP BY kanban, MaterialCode ) AS a\n" + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {0} GROUP BY kanban, MaterialCode ) AS a\n" +
@ -710,11 +918,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" temp1.零件中文名称,\n" + " temp1.零件中文名称,\n" +
" temp1.发货数量,\n" + " temp1.发货数量,\n" +
" temp1.外部单号,\n" + " temp1.外部单号,\n" +
" temp1.结算数量,\n" + " temp1.往期已结,\n" +
" isnull( TEMP2.Price, 0 ) AS 发货定价,\n" + " isnull( TEMP2.Price, 0 ) AS 发货定价,\n" +
" isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" + " isnull( temp1.发货数量, 0 ) * isnull( TEMP2.Price, 0 ) AS 发货总金额,\n" +
" isnull( tt.Qty, 0 ) 退货数量,\n" + " isnull( tt.Qty, 0 ) 退货数量,\n" +
" isnull( temp1.发货数量, 0 ) - isnull( temp1.结算数量, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量\n" + " isnull( temp1.发货数量, 0 ) - isnull( temp1.往期已结, 0 ) - isnull( tt.Qty, 0 ) AS 系统未结数量\n" +
" FROM\n" + " FROM\n" +
" (\n" + " (\n" +
" SELECT\n" + " SELECT\n" +
@ -726,7 +934,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" c.MaterialDesc AS 零件中文名称,\n" + " c.MaterialDesc AS 零件中文名称,\n" +
" isnull( a.Qty, 0 ) AS 发货数量,\n" + " isnull( a.Qty, 0 ) AS 发货数量,\n" +
" '' AS 外部单号,\n" + " '' AS 外部单号,\n" +
" isnull( b.Qty, 0 ) AS 结算数量,\n" + " isnull( b.Qty, 0 ) AS 往期已结,\n" +
" C.EstimateTypeDesc AS 物料组 \n" + " C.EstimateTypeDesc AS 物料组 \n" +
" FROM\n" + " FROM\n" +
" ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {0} GROUP BY kanban, MaterialCode ) AS a\n" + " ( SELECT SUM ( Qty ) Qty, Kanban, MaterialCode FROM Set_HQ_H_Kanban WHERE 1=1 {0} GROUP BY kanban, MaterialCode ) AS a\n" +
@ -747,7 +955,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
var _sql = string.Format(str, conditionDate, contion,version); var _sql = string.Format(str, conditionDate, contion, version);
@ -764,7 +972,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n" + " LEFT JOIN Set_material t1 ON a.MaterialCode= t1.CustomerPartCode \n" +
"WHERE\n" + "WHERE\n" +
" 1 = 1 {0}"; " 1 = 1 {0}";
var _sql2=string.Format(sql2, condition); var _sql2 = string.Format(sql2, condition);
var listCompare = DbConnection.Query<CompareFactoryExtend>(_sql2); var listCompare = DbConnection.Query<CompareFactoryExtend>(_sql2);
@ -908,6 +1116,9 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[ExporterHeader(DisplayName = "退货数量")] [ExporterHeader(DisplayName = "退货数量")]
public decimal 退 { set; get; } public decimal 退 { set; get; }
[ExporterHeader(DisplayName = "往期已结")]
public decimal { set; get; }
[ExporterHeader(DisplayName = "系统未结总金额")] [ExporterHeader(DisplayName = "系统未结总金额")]
public decimal { set; get; } public decimal { set; get; }
@ -915,8 +1126,8 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
[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; }

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

@ -23,6 +23,18 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
public class CompareExtendWjFactory
{
public string WmsBillNum { set; get; }
public string MaterialCode { set; get; }
public string Kanban { set; get; }
public string WmsDate { set; get; }
public decimal ReturnQty { set; get; }
}
public class CompareExtend1 public class CompareExtend1
{ {
public string ExternalKanbanNumber { set; get; } public string ExternalKanbanNumber { set; get; }
@ -32,6 +44,15 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
public string MaterialCode { set; get; } public string MaterialCode { set; get; }
} }
public class CompareExtendFactory
{
public string ExternalKanbanNumber { set; get; }
public string Factory { set; get; }
public string StorageLocationDesc { set; get; }
public string HQHKanBan { set; get; }
public string MaterialCode { set; get; }
}

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

@ -810,7 +810,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//{ //{
// condition += string.Format(" and a.SpareDate>='{0}' ", begintime); // condition += string.Format(" and a.SpareDate>='{0}' ", begintime);
//} //}
//if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue) //if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(endtime) != DateTime.MinValue)
//{ //{
// condition += string.Format(" and a.SpareDate<='{0}' ", endtime); // condition += string.Format(" and a.SpareDate<='{0}' ", endtime);
//} //}
@ -829,7 +829,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
//{ //{
// conditionDate += string.Format(" and SpareDate>='{0}' ", begintime); // conditionDate += string.Format(" and SpareDate>='{0}' ", begintime);
//} //}
//if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue) //if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(endtime) != DateTime.MinValue)
//{ //{
// conditionDate += string.Format(" and SpareDate<='{0}' ", endtime); // conditionDate += string.Format(" and SpareDate<='{0}' ", endtime);
//} //}
@ -1260,7 +1260,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
condition += string.Format(" and a.SpareDate>='{0}' ", begintime); condition += string.Format(" and a.SpareDate>='{0}' ", begintime);
} }
if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue) if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(endtime) != DateTime.MinValue)
{ {
condition += string.Format(" and a.SpareDate<='{0}' ", endtime); condition += string.Format(" and a.SpareDate<='{0}' ", endtime);
} }
@ -1271,7 +1271,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
conditionDate += string.Format(" and SpareDate>='{0}' ", begintime); conditionDate += string.Format(" and SpareDate>='{0}' ", begintime);
} }
if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(begintime) != DateTime.MinValue) if (!string.IsNullOrEmpty(endtime) && Convert.ToDateTime(endtime) != DateTime.MinValue)
{ {
conditionDate += string.Format(" and SpareDate<='{0}' ", endtime); conditionDate += string.Format(" and SpareDate<='{0}' ", endtime);
} }

Loading…
Cancel
Save