using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
|
namespace DAL
|
{
|
/// <summary>
|
/// 资源能力
|
/// </summary>
|
public class ClsGy_PlanShifts_View
|
{
|
|
//
|
public string MvarItemKey;
|
public string MvarReportTitle;
|
public string SQLName;
|
public Model.ClsGy_PlanShifts_Model omodel = new Model.ClsGy_PlanShifts_Model();
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
|
public ClsGy_PlanShifts_View()
|
{
|
MvarReportTitle = "资源能力设置";
|
MvarItemKey = "Gy_PlanShifts";
|
SQLName = "Select HItemID,HNumber 资源能力代码,HName 资源能力 from Gy_PlanShifts where HStopflag=0 Order by HItemID ";
|
}
|
//
|
public void Dispose()
|
{
|
GC.SuppressFinalize(this);
|
}
|
//
|
|
|
//根据代码返回项目信息
|
public bool GetInfoByDate(Int64 sSourceID,string sDate)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HDate='" + sDate + "' and HSourceID="+sSourceID.ToString(), MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
return GetInfo(DS);
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//根据代码返回项目信息
|
public bool GetInfoByDate_Line(Int64 sSourceID, string sDate)
|
{
|
DataSet DS;
|
try
|
{
|
DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HDate='" + sDate + "' and HSourceID=" + sSourceID.ToString(), MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS.Tables[0].Rows.Count == 0)
|
return false;
|
else
|
{
|
return GetInfo(DS);
|
}
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
|
//根据资源得到工作中心的工时
|
public Single GetInfoBySource(Int64 sSourceID)
|
{
|
try
|
{
|
DataSet DS;
|
DS = oCn.RunProcReturn(" select b.HWorkTimes from Gy_Source a inner join Gy_WorkCenter b on a.HCenterID=b.HItemID " +
|
" where a.HitemID=" + sSourceID.ToString(), "Gy_Source", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS == null || DS.Tables[0].Rows.Count == 0)
|
{
|
return 0;
|
}
|
else
|
{
|
return DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HWorkTimes"]);
|
}
|
}
|
catch (Exception e)
|
{
|
return 0;
|
}
|
}
|
|
//根据资源得到工作中心的工时
|
public Single GetInfoBySource_Line(Int64 sSourceID)
|
{
|
try
|
{
|
DataSet DS;
|
DS = oCn.RunProcReturn(" select HWorkTimes=a.HWorkTimes*a.HClassCount from Gy_Source a " +
|
" where a.HitemID=" + sSourceID.ToString(), "Gy_Source", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS == null || DS.Tables[0].Rows.Count == 0)
|
{
|
return 0;
|
}
|
else
|
{
|
return DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HWorkTimes"]);
|
}
|
}
|
catch (Exception e)
|
{
|
return 0;
|
}
|
}
|
|
//返回项目信息
|
public bool GetInfo(DataSet DS)
|
{
|
try
|
{
|
omodel = new Model.ClsGy_PlanShifts_Model();
|
omodel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]);
|
omodel.HDate = DBUtility.ClsPub.isDate(DS.Tables[0].Rows[0]["HDate"]);
|
omodel.HOverTimes = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HOverTimes"]);
|
omodel.HRemark = DS.Tables[0].Rows[0]["HRemark"].ToString().Trim();
|
omodel.HShiftsID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HShiftsID"]);
|
omodel.HSourceID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSourceID"]);
|
return true;
|
|
}
|
catch (Exception e)
|
{
|
throw (e);
|
}
|
}
|
}
|
}
|