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.
115 lines
5.4 KiB
115 lines
5.4 KiB
using MESClassLibrary.BLL.Log;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MESClassLibrary.DAL.Injection
|
|
{
|
|
public class InjectionRecordDAL
|
|
{
|
|
public DataTable SearchByTime(string StartTime, string EndTime)
|
|
{
|
|
try
|
|
{
|
|
|
|
string sql = "select * FROM [dbo].[tb_Product_Injection] ";
|
|
sql += " where ProductDate is not null and ProductDate>='" + StartTime + "' and ProductDate<='" + EndTime + "'";
|
|
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public DataTable SearchProductInjectionRecord(string StartTime, string EndTime) {
|
|
|
|
string sql = "SELECT t.PlanID,t.ProductDate,t.ClassName,t.MarketCount,s.StationNo,p.ProductName,p.IsOneMore,p.PartNo,m.ManufacturerName,r.MaterialName,r.BatchNo,pl.OpenDebugTime,pl.CycleTime,i.RealCycle,i.PlanCount,t.ProductCount,t.BadCount,pl.Weight,pl.OneWeight,ir.Waste_Weight,ir.JK_Weight,i.BeginTime,i.EndTime ";
|
|
sql += " FROM[dbo].[tb_Product_Injection] t ";
|
|
sql += " left join tb_Product p on t.PartNo = p.PartNo ";
|
|
sql += " left join tb_Station s on t.StationID = s.StationID ";
|
|
sql += " left join tb_InjectPlanReport r on t.PlanID = r.InjectionPlanID ";
|
|
sql += " left join tb_Plastic pl on t.StockNo = pl.StockNo and t.StationID = pl.StationID ";
|
|
sql += " left join tb_InjectionPlan i on t.PlanID = i.InjectionPlanID ";
|
|
sql += " left join tb_Injection_Record ir on t.PlanID = ir.PlanID ";
|
|
sql += " left join tb_CarType c on p.CarTypeID = c.id ";
|
|
sql += " left join tb_Manufacturer m on c.ManufacturerID = m.id ";
|
|
sql += " where t.ProductDate >='" + StartTime + "' and t.ProductDate <='" + EndTime + "' order by t.ProductDate,t.ClassName,t.StationID";
|
|
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
}
|
|
|
|
public DataTable SearchProductInjectionRecordBadReason(string StartTime, string EndTime)
|
|
{
|
|
|
|
string sql = "SELECT bc.PlanID,bi.BadReason from tb_Bad_Injection bi ";
|
|
sql += " left join v_BarCode bc on bi.OneBarCode = bc.OneBarCode ";
|
|
sql += " where bc.PlanID in (SELECT PlanID FROM tb_Product_Injection t where t.ProductDate >='"+ StartTime + "' and t.ProductDate <='"+ EndTime + "')";
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
}
|
|
|
|
|
|
public DataTable SearchProductInjectionRecordDownReason(string StartTime, string EndTime)
|
|
{
|
|
|
|
string sql = "SELECT PlanID,DownTime,DownTypeName,Reason from tb_Injection_DownRecord r ";
|
|
sql += " left join tb_Injection_DownType t on r.DownType = t.ID ";
|
|
sql += " left join tb_Inhection_DownReason s on r.DownReason = s.ID ";
|
|
sql += " where r.PlanID in (SELECT PlanID FROM tb_Product_Injection t where t.ProductDate >='" + StartTime + "' and t.ProductDate <='" + EndTime + "') and DownTime is not null";
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
}
|
|
|
|
|
|
public DataTable SearchProductInjection(string StartTime, string EndTime,string StationID)
|
|
{
|
|
|
|
string sql = "SELECT t.ID,t.ProductDate,t.ClassName,s.StationNo,t.StockNo,t.PartNo,t.ProductCount,ir.RealCycle,ir.Waste_Weight,ir.JK_Weight ";
|
|
sql += " FROM[dbo].[tb_Product_Injection] t ";
|
|
sql += " left join tb_Station s on t.StationID = s.StationID ";
|
|
sql += " left join tb_Injection_Record ir on t.ID = ir.PI_ID ";
|
|
|
|
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
}
|
|
|
|
|
|
public DataTable SearchRecordByPage(int pageIndex, int pageSize, string StartTime, string EndTime, string StationID)
|
|
{
|
|
try
|
|
{
|
|
string sql = @"SELECT t.ID,t.ProductDate,t.ClassName,t.StationID,s.StationNo,t.StockNo,t.PartNo,t.ProductCount,ir.RealCycle,ir.Waste_Weight,ir.JK_Weight ";
|
|
sql += " FROM[dbo].[tb_Product_Injection] t ";
|
|
sql += " left join tb_Station s on t.StationID = s.StationID ";
|
|
sql += " left join tb_Product_Injection_w ir on t.ID = ir.ID ";
|
|
sql += " where t.ProductDate >='" + StartTime + "' and t.ProductDate <='" + EndTime + "' ";
|
|
|
|
if (!string.IsNullOrEmpty(StationID))
|
|
{
|
|
sql += " and t.StationID = '" + StationID + "' ";
|
|
}
|
|
sql += " order by t.ProductDate,t.ClassName,t.StationID ";
|
|
sql += " offset " + ((pageIndex - 1) * pageSize) + " rows ";
|
|
sql += " fetch next " + pageSize + " rows only ";
|
|
|
|
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0];
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|