天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

92 lines
3.5 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.Data;
using QMAPP.FJC.Entity.ShipmentMonitor;
namespace QMAPP.FJC.DAL.Monitor
{
/// <summary>
/// 发运看板-数据层对象
/// 作 者:李炳海
/// 编写日期:2017年09月27日
/// </summary>
public class ShipmentMonitorDAL
{
#region 获取待发运FIS数据列表
/// <summary>
/// 获取待发运FIS数据列表
/// </summary>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetShipmentFisList(DataPage page,out DateTime dbNowTime)
{
string sql = null;
List<DataParameter> parameters = new List<DataParameter>();
try
{
// sql = @"SELECT PID,VWSEQ,'' AS CARTYPE,PRODNO,R100_ASSY_DESC,R100_ONLINEDATE
// FROM T_PP_FISORDER WHERE SCANSTATE = '0'";
sql = @"SELECT P.PID,VWSEQ,m.PROJECTCODE AS CARTYPE,PRODNO,M.MATERIAL_SHORT AS R100_ASSY_DESC,M110_ONLINEDATE AS R100_ONLINEDATE FROM T_PP_FISORDER P LEFT JOIN T_MD_MATERIAL M ON P.PRODNO=M.MATERIAL_CODE WHERE SCANSTATE = '0' ";
//分页关键字段及排序
page.KeyName = "PRODNO";
page.SortExpression = "R100_ONLINEDATE";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
dbNowTime = session.GetNowDataTime();
page = session.GetDataPage<ShipmentFisData>(sql, parameters.ToArray(), page);
}
return page;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取在途数量数据数据列表
/// <summary>
/// 获取在途数量数据数据列表
/// </summary>
/// <param name="wayTimes">在途时间(分钟)</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetOnTheWayQTYList(DataPage page,int wayTimes)
{
string sql = null;
List<DataParameter> parameters = new List<DataParameter>();
// sql = @"SELECT PRODNO,R100_ASSY_DESC,COUNT(*) AS QTY
// FROM T_PP_FISORDER
// WHERE SHIP_DATE >= @STARTTIME AND SHIP_DATE <= @ENDTIME AND SCANSTATE = '1'
// GROUP BY PRODNO,R100_ASSY_DESC";
sql = @"SELECT PRODNO,M.MATERIAL_SHORT AS R100_ASSY_DESC,COUNT(*) AS QTY
FROM T_PP_FISORDER P
LEFT JOIN T_PP_PASCARDDETAILS F on F.FISDETAILID=P.PID
LEFT JOIN T_MD_MATERIAL M ON P.PRODNO=M.MATERIAL_CODE
WHERE SCANDATE >= @STARTTIME AND SCANDATE <= @ENDTIME AND SCANSTATE = '1'
GROUP BY PRODNO,M.MATERIAL_SHORT";
//分页关键字段及排序
page.KeyName = "PRODNO";
using (IDataSession session = AppDataFactory.CreateMainSession())
{
DateTime dbNowTime = session.GetNowDataTime();
parameters.Add(new DataParameter("STARTTIME", dbNowTime.AddMinutes(-wayTimes)));
parameters.Add(new DataParameter("ENDTIME", dbNowTime));
page = session.GetDataPage<OnTheWayQTYData>(sql, parameters.ToArray(), page);
}
return page;
}
#endregion
}
}