@ -30,7 +30,9 @@ namespace NFine.Application.WMS
List < DbParameter > parameter = new List < DbParameter > ( ) ;
List < DbParameter > parameter = new List < DbParameter > ( ) ;
#region [SQL]
#region [SQL]
string sql = @" SELECT * FROM (select row_number() over(partition by a.MTDOCCode ORDER BY a.CreateDateTime) as row, a.MTDOCCode,a.CreatePerson,a.CreateDateTime,a.Status,a.MUSER,a.MUSERName,a.MTIME from ICSMTDOC a" ;
string sql = @ " SELECT * FROM (select row_number() over(partition by a.MTDOCCode ORDER BY a.CreateDateTime) as row, a.MTDOCCode,a.CreatePerson,a.CreateDateTime,a.Status,a.MUSER,a.MUSERName,a.MTIME
from ICSMTDOC a
LEFT JOIN ICSInventoryDetail detail on a . InvCode = detail . INVCode AND a . WHCode = detail . WHCode AND a . WorkPoint = detail . WorkPoint ";
sql + = " WHERE 1=1" ;
sql + = " WHERE 1=1" ;
sql = string . Format ( sql , DbHelper . GetErpIp ( ) , DbHelper . GetErpName ( ) ) ;
sql = string . Format ( sql , DbHelper . GetErpIp ( ) , DbHelper . GetErpName ( ) ) ;
#endregion
#endregion
@ -41,15 +43,19 @@ namespace NFine.Application.WMS
{
{
sql + = " and a.MTDOCCode like '%" + queryParam [ "MTDOCCode" ] . ToString ( ) + "%' " ;
sql + = " and a.MTDOCCode like '%" + queryParam [ "MTDOCCode" ] . ToString ( ) + "%' " ;
}
}
if ( ! string . IsNullOrWhiteSpace ( queryParam [ "Area" ] . ToString ( ) ) )
{
sql + = " and detail.LocationCode='" + queryParam [ "Area" ] . ToString ( ) + "'" ;
}
if ( ! string . IsNullOrWhiteSpace ( queryParam [ "ReleaseState" ] . ToString ( ) ) )
{
sql + = " and a.Status = '" + queryParam [ "ReleaseState" ] . ToString ( ) + "' " ;
}
}
}
if ( NFine . Code . OperatorProvider . Provider . GetCurrent ( ) . RoleEnCode ! = "admin" )
if ( NFine . Code . OperatorProvider . Provider . GetCurrent ( ) . RoleEnCode ! = "admin" )
{
{
sql + = " and a.WorkPoint='" + NFine . Code . OperatorProvider . Provider . GetCurrent ( ) . Location + "'" ;
sql + = " and a.WorkPoint='" + NFine . Code . OperatorProvider . Provider . GetCurrent ( ) . Location + "'" ;
}
}
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
//{
// sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
//}
sql + = " ) t WHERE t.Row=1" ;
sql + = " ) t WHERE t.Row=1" ;
return Repository ( ) . FindTablePageBySql ( sql . ToString ( ) , parameter . ToArray ( ) , ref jqgridparam ) ;
return Repository ( ) . FindTablePageBySql ( sql . ToString ( ) , parameter . ToArray ( ) , ref jqgridparam ) ;
}
}
@ -61,11 +67,12 @@ namespace NFine.Application.WMS
string sql = string . Empty ;
string sql = string . Empty ;
List < DbParameter > parameter = new List < DbParameter > ( ) ;
List < DbParameter > parameter = new List < DbParameter > ( ) ;
string WorkPoint = NFine . Code . OperatorProvider . Provider . GetCurrent ( ) . Location . TrimEnd ( ',' ) ;
string WorkPoint = NFine . Code . OperatorProvider . Provider . GetCurrent ( ) . Location . TrimEnd ( ',' ) ;
sql = @ " select a.ID,a.DepCode,d.DepName,a.WHCode,c.WarehouseName,a.Sequence,b.InvCode,b.InvName,a.Quantity,a.Amount,a.MTDOCQuantity,case WHEN a.MTDOCType='1' then '转换前' ELSE '转换后' END as MTDOCType
sql = @ " select a.ID,a.DepCode,d.DepName,a.WHCode,c.WarehouseName,a.Sequence,b.InvCode,b.InvName,a.Quantity,a.Amount,a.MTDOCQuantity,case WHEN a.MTDOCType='1' then '转换前' ELSE '转换后' END as MTDOCType , detail.LocationCode AS Area
from ICSMTDOC a
from ICSMTDOC a
left join ICSInventory b on a . InvCode = b . InvCode and a . WorkPoint = b . WorkPoint
left join ICSInventory b on a . InvCode = b . InvCode and a . WorkPoint = b . WorkPoint
left join ICSWarehouse c on a . WHCode = c . WarehouseCode and a . WorkPoint = c . WorkPoint
left join ICSWarehouse c on a . WHCode = c . WarehouseCode and a . WorkPoint = c . WorkPoint
left join ICSDepartment d on a . DepCode = d . DepCode and a . WorkPoint = d . WorkPoint
left join ICSDepartment d on a . DepCode = d . DepCode and a . WorkPoint = d . WorkPoint
LEFT JOIN ICSInventoryDetail detail on b . InvCode = detail . INVCode AND a . WHCode = detail . WHCode AND a . WorkPoint = detail . WorkPoint
WHERE a . MTDOCCode = ' { 0 } ' and a . WorkPoint in ( ' { 1 } ' ) order by a . Sequence ";
WHERE a . MTDOCCode = ' { 0 } ' and a . WorkPoint in ( ' { 1 } ' ) order by a . Sequence ";
sql = string . Format ( sql , MTDOCCode , WorkPoint ) ;
sql = string . Format ( sql , MTDOCCode , WorkPoint ) ;
return Repository ( ) . FindTableBySql ( sql . ToString ( ) ) ;
return Repository ( ) . FindTableBySql ( sql . ToString ( ) ) ;