|
|
using System;
|
|
|
using System.Data;
|
|
|
using System.Text;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data.SqlClient;
|
|
|
using ApServerProvider;
|
|
|
using DbCommon;
|
|
|
using System.Collections;
|
|
|
|
|
|
namespace Estsh.Core.Repositories
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
* 配置生产信息管理
|
|
|
*
|
|
|
* NOAH
|
|
|
*
|
|
|
*/
|
|
|
public class ModelProdInfoDefineDal : BaseApp
|
|
|
{
|
|
|
public ModelProdInfoDefineDal(RemotingProxy remotingProxy)
|
|
|
: base(remotingProxy)
|
|
|
{
|
|
|
}
|
|
|
#region 成员方法
|
|
|
/// <summary>
|
|
|
/// 获得菜单列表数据
|
|
|
/// </summary>
|
|
|
public DataTable getList(string strWhere,string filedOrder)
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT a.* ,c.enum_desc AS forecolor ,c.enum_id AS forecolor_id,d.enum_desc AS bgcolor ,d.enum_id AS bgcolor_id, e.enum_desc AS fillPatter,e.enum_id AS fillPatter_id ,b.model_name FROM dbo.sys_model_prodinfo a LEFT JOIN dbo.sys_model b ON a.model_id = b.model_id LEFT JOIN dbo.sys_enum c ON a.insp_page_forecolor = c.enum_value LEFT JOIN dbo.sys_enum d ON a.insp_page_bgcolor = d.enum_value LEFT JOIN dbo.sys_enum e ON a.insp_page_fillpattern = e.enum_value WHERE c.enum_type = 'sys_forecolor' AND d.enum_type = 'sys_bgcolor' AND e.enum_type = 'insp_page_fillpattern' ");
|
|
|
if (!strWhere.Trim().Equals(""))
|
|
|
{
|
|
|
strSql.Append(" and " + strWhere);
|
|
|
}
|
|
|
if (filedOrder != null && !filedOrder.Trim().Equals(""))
|
|
|
{
|
|
|
strSql.Append(" order by " + filedOrder);
|
|
|
}
|
|
|
return this._remotingProxy.GetDataTable(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取分页数据列表
|
|
|
/// </summary>
|
|
|
public DataTable getListByPage(int PageSize, int PageIndex, string strWhere, string OrderBy)
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
if (strWhere.Trim() != "")
|
|
|
{
|
|
|
//strWhere = strWhere.Remove(0, 6);//因为存储过程中已经有where,这里需要把之前加入的where去掉,这里截除前六个字符
|
|
|
strWhere = " c.enum_type = 'sys_forecolor' AND d.enum_type = 'sys_bgcolor' AND e.enum_type = 'insp_page_fillpattern' " + strWhere;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strWhere = " c.enum_type = 'sys_forecolor' AND d.enum_type = 'sys_bgcolor' AND e.enum_type = 'insp_page_fillpattern' ";
|
|
|
}
|
|
|
if (OrderBy.Trim() != "")
|
|
|
{
|
|
|
OrderBy = " " + OrderBy; //排序
|
|
|
}
|
|
|
Hashtable Params = new Hashtable(6);
|
|
|
|
|
|
Params.Add("@TotalCount", 100);
|
|
|
Params.Add("@TotalPage", 100);
|
|
|
Params.Add("@GroupColumn", "");
|
|
|
Params.Add("@Table", "dbo.sys_model_prodinfo a LEFT JOIN dbo.sys_model b ON a.model_id = b.model_id LEFT JOIN dbo.sys_enum c ON a.insp_page_forecolor = c.enum_value LEFT JOIN dbo.sys_enum d ON a.insp_page_bgcolor = d.enum_value LEFT JOIN dbo.sys_enum e ON a.insp_page_fillpattern = e.enum_value");
|
|
|
Params.Add("@Column", "a.* ,c.enum_desc AS forecolor ,c.enum_id AS forecolor_id,d.enum_desc AS bgcolor ,d.enum_id AS bgcolor_id, e.enum_desc AS fillPatter,e.enum_id AS fillPatter_id ,b.model_name");
|
|
|
Params.Add("@PageSize", PageSize);
|
|
|
Params.Add("@CurrentPage", PageIndex);
|
|
|
Params.Add("@Condition", strWhere);
|
|
|
Params.Add("@OrderColumn", OrderBy);
|
|
|
Params.Add("@Group", 0);
|
|
|
|
|
|
String strProcedure = "EXEC Com_Pagination @TotalCount, @TotalPage, @Table, @Column,@OrderColumn,@GroupColumn,@PageSize, @CurrentPage,@Group,@Condition";
|
|
|
return _remotingProxy.GetDataTable(strProcedure, Params);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取分页记录总数
|
|
|
/// </summary>
|
|
|
public int getCountWhere(string strWhere)
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("select count(*) as Total FROM dbo.sys_model_prodinfo a LEFT JOIN dbo.sys_model b ON a.model_id = b.model_id LEFT JOIN dbo.sys_enum c ON a.insp_page_forecolor = c.enum_value LEFT JOIN dbo.sys_enum d ON a.insp_page_bgcolor = d.enum_value LEFT JOIN dbo.sys_enum e ON a.insp_page_fillpattern = e.enum_value WHERE c.enum_type = 'sys_forecolor' AND d.enum_type = 'sys_bgcolor' AND e.enum_type = 'insp_page_fillpattern' ");
|
|
|
if (strWhere.Trim() != "")
|
|
|
{
|
|
|
strSql.Append(" " + strWhere);
|
|
|
}
|
|
|
int i = 0;
|
|
|
DataTable dt = _remotingProxy.GetDataTable(strSql.ToString());
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
if (dt.Rows[0]["Total"].ToString() != "")
|
|
|
{
|
|
|
i = int.Parse(dt.Rows[0]["Total"].ToString());
|
|
|
}
|
|
|
}
|
|
|
return i;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 插入菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int saveModelProdInfo(Hashtable htParams)
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
StringBuilder SqlStringBuilder = new StringBuilder(1024);
|
|
|
SqlStringBuilder.Append("INSERT INTO dbo.sys_model_prodinfo(model_id,print_barcode,print_tray_page,print_insp_page,barcode_template,insp_page_template,");
|
|
|
SqlStringBuilder.Append("tray_page_template,insp_page_fillpattern,insp_page_bgcolor,insp_page_forecolor,insp_special_char,Barcode_count,tray_page_count,");
|
|
|
SqlStringBuilder.Append("insp_page_count,need_ab_data,need_zkc_data,enabled,create_userid,create_ymd,create_hms) values");
|
|
|
SqlStringBuilder.Append("(@model_id,@print_barcode,@print_tray_page,@print_insp_page,@barcode_template,@insp_page_template,");
|
|
|
SqlStringBuilder.Append("@tray_page_template,@insp_page_fillpattern,@insp_page_bgcolor,@insp_page_forecolor,@insp_special_char,@Barcode_count,@tray_page_count,");
|
|
|
SqlStringBuilder.Append("@insp_page_count,@need_ab_data,@need_zkc_data,@enabled,@create_userid,Convert(varchar(10),getdate(),23),Convert(varchar(10),getdate(),108))");
|
|
|
|
|
|
return _remotingProxy.ExecuteNonQuery(SqlStringBuilder.ToString(), htParams);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int updateModelProdInfo(Hashtable htParams)
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
StringBuilder SqlStringBuilder = new StringBuilder(1024);
|
|
|
SqlStringBuilder.Append("UPDATE sys_model_prodinfo SET ");
|
|
|
SqlStringBuilder.Append("model_id=@model_id,print_barcode=@print_barcode,print_tray_page=@print_tray_page,print_insp_page=@print_insp_page,barcode_template=@barcode_template,insp_page_template=@insp_page_template");
|
|
|
SqlStringBuilder.Append(",tray_page_template=@tray_page_template,insp_page_fillpattern=@insp_page_fillpattern,insp_page_bgcolor=@insp_page_bgcolor,insp_page_forecolor=@insp_page_forecolor,insp_special_char=@insp_special_char,Barcode_count=@Barcode_count,tray_page_count=@tray_page_count");
|
|
|
SqlStringBuilder.Append(",insp_page_count=@insp_page_count,need_ab_data=@need_ab_data,need_zkc_data=@need_zkc_data,enabled=@enabled,update_userid=@update_userid,update_ymd=Convert(varchar(10),getdate(),23),update_hms=Convert(varchar(10),getdate(),108) ");
|
|
|
SqlStringBuilder.Append("WHERE model_id=@model_id ");
|
|
|
|
|
|
return _remotingProxy.ExecuteNonQuery(SqlStringBuilder.ToString(), htParams);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="model_id"></param>
|
|
|
/// <returns></returns>
|
|
|
public int deleteModelProdInfo(String model_id )
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
String delStr = "DELETE FROM sys_model_prodinfo WHERE model_id = @model_id";
|
|
|
Hashtable htparams = new Hashtable();
|
|
|
htparams.Add("@model_id", model_id);
|
|
|
return _remotingProxy.ExecuteNonQuery(delStr, htparams);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion 成员方法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取 可添加的配置名称
|
|
|
/// BY NOAH
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public DataTable getModelName()
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT DISTINCT model_id as [value],model_name as [key] from sys_model where enabled = 'Y' AND model_id IN (SELECT model_id FROM sys_model EXCEPT SELECT model_id FROM sys_model_prodinfo)");
|
|
|
return _remotingProxy.GetDataTable(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取 填充样式
|
|
|
/// BY NOAH
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public DataTable getFillPatterName(String style)
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT DISTINCT enum_id as [value],enum_desc as [key] FROM sys_enum WHERE enum_type = @style");
|
|
|
|
|
|
Hashtable Params = new Hashtable(1);
|
|
|
|
|
|
Params.Add("@style", style);
|
|
|
|
|
|
return _remotingProxy.GetDataTable(strSql.ToString(), Params);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取 Enum_value
|
|
|
/// BY NOAH
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public DataTable getEnumValue(String enum_type, String enum_id)
|
|
|
{
|
|
|
lock (_remotingProxy)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT enum_value FROM sys_enum WHERE enum_type = @enum_type AND enum_id = @enum_id");
|
|
|
|
|
|
Hashtable Params = new Hashtable(2);
|
|
|
|
|
|
Params.Add("@enum_type", enum_type);
|
|
|
Params.Add("@enum_id", enum_id);
|
|
|
|
|
|
return _remotingProxy.GetDataTable(strSql.ToString(), Params);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|