using Core.Mes.Client.Comm.Format;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Reflection;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using Infragistics.Win.UltraWinGrid;
using CoreFS.CA06;
namespace Core.StlMes.Client.PlnSaleOrd.PlanStove
{
public class BaseEntityDAL
{
///
/// 使用实体类与后台交互时,与后台交互的通用方法,实际上是可以执行查询,插入,更新的
///
/// 实体类类型
/// 实体类的实例
/// 需要执行的语句的sqlid
/// java端的实体类的全名,包路径.类名
/// sqlid对应的参数List
/// OpeBase对象
/// 成功执行的条数
public static int ExcuteNonQuery(T Entityobj, string sqlID, string javaEntityClassID, List paramList, CoreFS.CA06.OpeBase ob)
{
int nret = 0;
string jsonObj = JSONFormat.Format(Entityobj);
nret = Core.Mes.Client.Comm.Server.ServerHelper.SetData(MethodDef.StoveBase.ExcuteNonQuery, new Object[] { jsonObj, sqlID, javaEntityClassID, paramList }, ob);
return nret;
}
public static int ExcuteTransaction(List entitySqlIDs,List entityJsonStrings,List entityClassNames,List sqlIds,List> paramList,CoreFS.CA06.OpeBase ob)
{
int nRet = 0;
nRet = Core.Mes.Client.Comm.Server.ServerHelper.SetData(MethodDef.StoveBase.ExeTransction, new Object[] { entitySqlIDs, entityJsonStrings, entityClassNames, sqlIds, paramList }, ob);
return nRet;
}
public static int ExcuteTransaction(List sqlIds, List> paramList, CoreFS.CA06.OpeBase ob)
{
int nRet = 0;
nRet = Core.Mes.Client.Comm.Server.ServerHelper.SetData(MethodDef.StoveBase.ExeTransction, new Object[] { sqlIds, paramList }, ob);
return nRet;
}
///
/// 不使用实体类与后台交互,的非查询执行方法
///
///
///
///
///
public static int ExcuteNonQuery(string sqlId,List paramList,CoreFS.CA06.OpeBase ob)
{
int nRet = 0;
nRet = Core.Mes.Client.Comm.Server.ServerHelper.SetData(MethodDef.StoveBase.ExcuteNonQuery,new Object[]{sqlId,paramList},ob);
return nRet;
}
///
/// HEAT_PLAN_NO的格式如E201605160001,本函数获取获取DBK,RCL,ZG,JGX表中其后四位+1的整形数字
///
/// 表名,ZY_M表的表名
///
///
public static DataTable GetMaxHeatNo(string tableName, CoreFS.CA06.OpeBase ob)
{
return Core.Mes.Client.Comm.Server.ServerHelper.GetData(MethodDef.StoveBase.getMaxHeatPlanNo, new Object[] { tableName }, ob);
}
///
/// 根据PROPlanID和GXPLANNO更新BATCHED_WT和BATCHED_NUM
///
/// 表名,四大工序的Order_S表全名
///
///
///
///
/// frmbase的ob对象
public static void UpdateOrder_WT_NUM(string tableName, string BATCHED_WT, string BATCHED_NUM, string PRO_PLAN_ID, string GX_PLAN_NO, CoreFS.CA06.OpeBase ob)
{
Core.Mes.Client.Comm.Server.ServerHelper.SetData(MethodDef.StoveBase.UpdateOrder_WT_NUM, new Object[] { tableName, new List() { BATCHED_WT, BATCHED_NUM, PRO_PLAN_ID, GX_PLAN_NO } }, ob);
}
///
/// 根据PROPlanID和GXPLANNO更新MatchWtIn和MatchNumIn
///
///
///
///
///
///
///
public static void UpdateOrder_MATCHIN_WT_NUM(string tableName, string MatchWtIn, string MatchNumIn, string PRO_PLAN_ID, string GX_PLAN_NO, CoreFS.CA06.OpeBase ob)
{
Core.Mes.Client.Comm.Server.ServerHelper.SetData(MethodDef.StoveBase.UpdateOrder_MATCHIN_WT_NUM, new Object[] { tableName, new List() { MatchWtIn, MatchNumIn, PRO_PLAN_ID, GX_PLAN_NO } }, ob);
}
///
/// 待条件查询Order表
///
///
///
///
///
///
///
///
///
public static Object queryALL(string tableName, string PLINE_CODE, string ORD_NO, string PRO_PLAN_ID, string[] statusArr, CoreFS.CA06.OpeBase ob)
{
return Core.Mes.Client.Comm.Tool.EntityHelper.GetData(MethodDef.StoveBase.queryAll, new Object[] { tableName, PLINE_CODE, ORD_NO, PRO_PLAN_ID, statusArr }, ob);
}
///
/// 查询某个表的所有的内容,并把它填充进指定的实体类
///
/// 实体类
/// 表名
///
/// datasouceList对象
public static Object queryALL(string tableName, CoreFS.CA06.OpeBase ob)
{
return Core.Mes.Client.Comm.Tool.EntityHelper.GetData(MethodDef.StoveBase.queryAll, new Object[] { tableName }, ob);
}
///
///
///
///
///
///
///
public static Object queryALL(Object[] ServerParams, CoreFS.CA06.OpeBase ob)
{
return Core.Mes.Client.Comm.Tool.EntityHelper.GetData(MethodDef.StoveBase.queryAll, ServerParams, ob);
}
///
/// 根据heatplanno更新作业计划表的planstatus
///
/// 需要更新的表名
/// 需要更新的下发状态(0计划,1下发,2生产完成)
/// 作业计划表主键
///
public static int UpdateZYPlanStatus(string tablename, string PLAN_STATUS, string HEAT_PLAN_NO,string UpdateName, CoreFS.CA06.OpeBase ob)
{
return Core.Mes.Client.Comm.Server.ServerHelper.SetData(MethodDef.StoveBase.UpdatePlnStatus, new Object[] { tablename, new List() { PLAN_STATUS,UpdateName, HEAT_PLAN_NO} }, ob);
}
///
/// 获取作业计划表的批次生产序号()
///
///
///
public static DataTable GetMaxProdIndex(string tablename, CoreFS.CA06.OpeBase ob)
{
return Core.Mes.Client.Comm.Server.ServerHelper.GetData(MethodDef.StoveBase.queryMaxProdIndex, new Object[] { tablename }, ob);
}
///
/// 获取CHECKJVAL
///
///
///
///
public static Double GetCHECKJVAL(string ORDLNDLYPK, CoreFS.CA06.OpeBase ob)
{
DataTable dt = Core.Mes.Client.Comm.Server.ServerHelper.GetData(MethodDef.StoveBase.queryCHECKJVAL, new Object[] { ORDLNDLYPK }, ob);
string CHECKJVAL = "";
if (dt.Rows.Count > 0)
{
CHECKJVAL = dt.Rows[0][0].ToString();
}
try
{
return Convert.ToDouble(CHECKJVAL);
}
catch
{
return 0;
}
}
}
}