using Core.Mes.Client.Comm; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using System.Data; namespace Core.StlMes.Client.Qcm { public class Dal { private OpeBase _ob = null; public Dal(OpeBase ob) { _ob = ob; } public CoreProductManageSvr CoreProductManage { get { return new CoreProductManageSvr(_ob); } } } public class CoreProductManageSvr { private string _serverName = "com.steering.pss.qcm.CoreProductManage"; private DalEntity _dal; public CoreProductManageSvr(OpeBase ob) { _dal = new DalEntity("com.steering.pss.qcm.CoreProductManage", ob); } public DataRow IsExistStdName(params object[] param) { return _dal.GetRow("IsExistStdName", param); } public void CopyStd(params object[] param) { _dal.Set("CopyStd", param); } } public class DalEntity { private string _serverName = ""; private OpeBase _ob = null; public DalEntity(string serverName, OpeBase ob) { _serverName = serverName; _ob = ob; } public DataTable GetTable(string methodName, params object[] param) { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = _serverName; ccp.MethodName = methodName; ccp.ServerParams = param; ccp = _ob.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp == null) { throw new MESException("服务端处理失败!"); } if (ccp.ReturnCode < 0) { throw new MESException("服务端处理失败!", ccp.ReturnCode, ccp.ReturnInfo); } return ccp.SourceDataTable; } public DataRow GetRow(string methodName, params object[] param) { DataTable dt = GetTable(methodName, param); if (dt.Rows.Count == 0) { return null; } else { return dt.Rows[0]; } } public DataSourceList GetData(string methodName, params object[] param) { return EntityHelper.GetData(_serverName + "." + methodName, param, _ob); } public object Set(string methodName, params object[] param) { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = _serverName; ccp.MethodName = methodName; ccp.ServerParams = param; ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp == null) { throw new MESException("服务端处理失败!"); } if (ccp.ReturnCode < 0) { throw new MESException("服务端处理失败!", ccp.ReturnCode, ccp.ReturnInfo); } return ccp.ReturnObject; } } }