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.
132 lines
5.8 KiB
132 lines
5.8 KiB
using System;
|
|
using System.Data;
|
|
using System.ServiceModel;
|
|
using SSWMS.Common;
|
|
|
|
namespace SSWMS.Server
|
|
{
|
|
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.Single,
|
|
ConcurrencyMode = ConcurrencyMode.Multiple, MaxItemsInObjectGraph = int.MaxValue, UseSynchronizationContext = false)]
|
|
public class S_BaseService : I_BaseService
|
|
{
|
|
#region Instance
|
|
//public static volatile P_Base_ERP<object> _P_Base_ERP = new P_Base_ERP<object>();
|
|
public static volatile P_Base_ERP<object> _P_Base_ERP = null;
|
|
public static volatile P_Base_House<object> _P_Base_House = new P_Base_House<object>();
|
|
public static volatile P_GOODS_MAIN _P_GOODS_MAIN = new P_GOODS_MAIN();
|
|
public static volatile P_IO_CONTROL _P_IO_CONTROL = new P_IO_CONTROL();
|
|
public static volatile P_IO_CONTROL_APPLY _P_IO_CONTROL_APPLY = new P_IO_CONTROL_APPLY();
|
|
public static volatile P_IO_CONTROL_MODEL _P_IO_CONTROL_MODEL = new P_IO_CONTROL_MODEL();
|
|
public static volatile P_IO_CONTROL_ROUTE _P_IO_CONTROL_ROUTE = new P_IO_CONTROL_ROUTE();
|
|
public static volatile P_MANAGE_LIST _P_MANAGE_LIST = new P_MANAGE_LIST();
|
|
public static volatile P_MANAGE_MAIN _P_MANAGE_MAIN = new P_MANAGE_MAIN();
|
|
public static volatile P_PLAN_LIST _P_PLAN_LIST = new P_PLAN_LIST();
|
|
public static volatile P_PLAN_MAIN _P_PLAN_MAIN = new P_PLAN_MAIN();
|
|
public static volatile P_RECORD_LIST _P_RECORD_LIST = new P_RECORD_LIST();
|
|
public static volatile P_RECORD_MAIN _P_RECORD_MAIN = new P_RECORD_MAIN();
|
|
public static volatile P_STORAGE_LIST _P_STORAGE_LIST = new P_STORAGE_LIST();
|
|
public static volatile P_STORAGE_MAIN _P_STORAGE_MAIN = new P_STORAGE_MAIN();
|
|
public static volatile P_SYS_CONFIG _P_SYS_CONFIG = new P_SYS_CONFIG();
|
|
public static volatile P_SYS_FLOW _P_SYS_FLOW = new P_SYS_FLOW();
|
|
public static volatile P_SYS_LOG _P_SYS_LOG = new P_SYS_LOG();
|
|
public static volatile P_SYS_MENU _P_SYS_MENU = new P_SYS_MENU();
|
|
public static volatile P_SYS_RELATION _P_SYS_RELATION = new P_SYS_RELATION();
|
|
public static volatile P_SYS_ROLE _P_SYS_ROLE = new P_SYS_ROLE();
|
|
public static volatile P_SYS_USER _P_SYS_USER = new P_SYS_USER();
|
|
public static volatile P_WH_CELL _P_WH_CELL = new P_WH_CELL();
|
|
|
|
public static volatile S_BaseService _S_BaseService = new S_BaseService();
|
|
public static volatile S_CellService _S_CellService = new S_CellService();
|
|
public static volatile S_ControlService _S_ControlService = new S_ControlService();
|
|
public static volatile S_DeviceService _S_DeviceService = new S_DeviceService();
|
|
public static volatile S_ERPService _S_ERPService = new S_ERPService();
|
|
public static volatile S_ManageService _S_ManageService = new S_ManageService();
|
|
public static volatile S_PlanService _S_PlanService = new S_PlanService();
|
|
public static volatile S_StorageService _S_StorageService = new S_StorageService();
|
|
public static volatile S_SystemService _S_SystemService = new S_SystemService();
|
|
#endregion
|
|
|
|
public DataTable GetDataTable(string sql, int database = SystemCode.ConstCode.DatabaseWarehouse)
|
|
{
|
|
if (database == SystemCode.ConstCode.DatabaseERP)
|
|
{
|
|
return _P_Base_ERP.GetDataTable(sql);
|
|
}
|
|
else
|
|
{
|
|
return _P_Base_House.GetDataTable(sql);
|
|
}
|
|
}
|
|
|
|
public int UpdateDataTable(DataTable dt, string sTableName, out string sResult, int database = SystemCode.ConstCode.DatabaseWarehouse)
|
|
{
|
|
int iResult = 0;
|
|
sResult = string.Empty;
|
|
if (database == SystemCode.ConstCode.DatabaseERP)
|
|
{
|
|
try
|
|
{
|
|
_P_Base_ERP.BeginTransaction();
|
|
iResult = _P_Base_ERP.UpdateDataTable(dt, sTableName, out sResult);
|
|
_P_Base_ERP.CommitTransaction();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_P_Base_ERP.RollBackTransaction();
|
|
sResult = ex.Message;
|
|
return 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
_P_Base_House.BeginTransaction();
|
|
iResult = _P_Base_House.UpdateDataTable(dt, sTableName, out sResult);
|
|
_P_Base_House.CommitTransaction();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_P_Base_House.RollBackTransaction();
|
|
sResult = ex.Message;
|
|
return 0;
|
|
}
|
|
}
|
|
return iResult;
|
|
}
|
|
|
|
public int ExecuteNonQuery(string sql, int database = SystemCode.ConstCode.DatabaseWarehouse)
|
|
{
|
|
int iResult = 0;
|
|
if (database == SystemCode.ConstCode.DatabaseERP)
|
|
{
|
|
try
|
|
{
|
|
_P_Base_ERP.BeginTransaction();
|
|
iResult = _P_Base_ERP.ExecuteNonQuery(sql);
|
|
_P_Base_ERP.CommitTransaction();
|
|
}
|
|
catch
|
|
{
|
|
_P_Base_ERP.RollBackTransaction();
|
|
return 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
_P_Base_House.BeginTransaction();
|
|
iResult = _P_Base_House.ExecuteNonQuery(sql);
|
|
_P_Base_House.CommitTransaction();
|
|
}
|
|
catch
|
|
{
|
|
_P_Base_House.RollBackTransaction();
|
|
return 0;
|
|
}
|
|
}
|
|
return iResult;
|
|
}
|
|
}
|
|
}
|