一厂MES,含注塑,喷涂,冲孔
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.

63 lines
2.4 KiB

3 months ago
using DBUtility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Web;
namespace PaintingScreen.Handler
{
public class StationPlanFunction
{
public static DataTable GetTableContent()
{
DataTable res = new DataTable();
try
{
string sql = @"
SELECT [StationID]
,[StationNo]
INTO #station
FROM tb_Station
WHERE StationNo LIKE 'IM%'
ORDER BY StationNo
SELECT a.InjectionPlanID,a.StationID,b.StationNo,a.StockNo,a.PlanCount,a.BeginTime,a.EndTime,a.PartNo
INTO #temp
FROM tb_InjectionPlan a
RIGHT JOIN #station b
ON a.StationID = b.StationID
WHERE a.IsFinish IS NULL OR a.IsFinish = 0
ORDER BY b.StationNo,a.BeginTime
SELECT aa.StationNo,cc.ProductName,aa.PlanCount,aa.BeginTime,aa.EndTime
FROM #temp aa
JOIN
(
SELECT StationNo,MIN(BeginTime) BeginTime FROM #temp GROUP BY StationNo
) bb
ON aa.StationNo = bb.StationNo AND aa.BeginTime = bb.BeginTime
LEFT JOIN
(
SELECT StockNo,PartNo,ProductName FROM dbo.tb_Product
) cc
ON aa.StockNo = cc.StockNo OR aa.PartNo = cc.PartNo
DROP TABLE #station;
DROP TABLE #temp;
";
res = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
}
catch (Exception ex)
{
LogHelper.WriteLogManager(ex);
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
}
return res;
}
}
}