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.
129 lines
4.7 KiB
129 lines
4.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.DAL;
|
|
|
|
namespace QMAPP.FJC.DAL.Operation
|
|
{
|
|
public class PrintCodeDAL : BaseDAL
|
|
{
|
|
public void Insert(PrintCode entity)
|
|
{
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
session.Insert<PrintCode>(entity);
|
|
}
|
|
}
|
|
|
|
public void Update(PrintCode entity)
|
|
{
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
session.Update<PrintCode>(entity);
|
|
}
|
|
}
|
|
|
|
public int UpdateBySql(PrintCode entity)
|
|
{
|
|
int count = 0;
|
|
string sql = "UPDATE T_AW_PRINTCODE SET SERIAL_NUM='1' WHERE PID='" + entity .PID+ "'";
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
string sqlChange = base.ChangeSqlByDB(sql, session);
|
|
//删除基本信息
|
|
count = session.ExecuteSql(sqlChange);
|
|
}
|
|
return count;
|
|
}
|
|
|
|
public int InsertExchangeProduct(string MainCode,string ProductCode)
|
|
{
|
|
int count = 0;
|
|
string sql = $"INSERT INTO T_MD_ExchangeProduct (PID, MainCode, ProductCode) VALUES (NEWID(), '{MainCode}', '{ProductCode}');";
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
string sqlChange = base.ChangeSqlByDB(sql, session);
|
|
//删除基本信息
|
|
count = session.ExecuteSql(sqlChange);
|
|
}
|
|
return count;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="materialcode"></param>
|
|
/// <returns></returns>
|
|
public PrintCode GetPrintCodeInfo(PrintCode proCodeInfo)
|
|
{
|
|
PrintCode printcode = new PrintCode();
|
|
StringBuilder whereBuilder = new StringBuilder();
|
|
StringBuilder printeBuilder = new StringBuilder();
|
|
try
|
|
{
|
|
printeBuilder.Append(" select PID,");
|
|
printeBuilder.Append(" PRODUCTCODE,");
|
|
printeBuilder.Append(" MATERIAL_NAME,");
|
|
printeBuilder.Append(" COLOR_CODE,");
|
|
printeBuilder.Append(" MINVALUE,");
|
|
printeBuilder.Append(" MAXVALUE,");
|
|
printeBuilder.Append(" MAINCODE,");
|
|
printeBuilder.Append(" SERIAL_NUM,");
|
|
printeBuilder.Append(" PRECODE,");
|
|
printeBuilder.Append(" ISCOMPLETE,");
|
|
printeBuilder.Append(" PRINT_TEMPALTE_TEM,");
|
|
printeBuilder.Append(" PRINT_TEMPALTE_DATA,");
|
|
printeBuilder.Append(" CREATETIME,");
|
|
printeBuilder.Append(" UPDATETIME");
|
|
printeBuilder.Append(" from T_AW_PRINTCODE");
|
|
|
|
if (string.IsNullOrEmpty(proCodeInfo.PRODUCTCODE) == false)
|
|
{
|
|
whereBuilder.Append(" AND PRODUCTCODE = '" + proCodeInfo.PRODUCTCODE + "'"); ;
|
|
}
|
|
if (whereBuilder.Length > 0)
|
|
{
|
|
printeBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4));
|
|
}
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
//获取信息
|
|
printcode = session.Get<PrintCode>(printeBuilder.ToString());
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
return printcode;
|
|
}
|
|
|
|
|
|
public int UpdateForChangeCode(PrintCode entity)
|
|
{
|
|
int count = 0;
|
|
StringBuilder strSql = new StringBuilder();
|
|
StringBuilder strFields = new StringBuilder();
|
|
StringBuilder strValues = new StringBuilder(); using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
strFields.Append(" MAINCODE ='" + entity.MAINCODE + "', ");
|
|
strFields.Append(" ISCOMPLETE ='" + entity.ISCOMPLETE + "',");
|
|
strFields.Append(" CREATETIME ='" + entity.CREATETIME + "',");
|
|
strFields.Append(" UPDATETIME ='" + System.DateTime.Now + "'");
|
|
strFields.Append(" WHERE PID ='" + entity.PID + "'");
|
|
|
|
strSql.Append(" UPDATE T_AW_PRINTCODE SET");
|
|
strSql.Append(" " + strFields.ToString() + " ");
|
|
|
|
string sqlChange = base.ChangeSqlByDB(strSql.ToString(), session);
|
|
//基本信息
|
|
count = session.ExecuteSql(sqlChange);
|
|
}
|
|
return count;
|
|
}
|
|
|
|
}
|
|
}
|
|
|