2025-06-05 15:11:19 +08:00
using Epost.Common ;
using Epost.Model ;
using System ;
using System.Collections.Generic ;
using System.Data ;
using System.Linq ;
using System.Text ;
using System.Threading.Tasks ;
namespace Epost.DAL
{
public class Print_BoxDAL
{
DataBaseOpration . OprationSqlDAL db = DB_DLL . GetInstance ( ) ;
#region 获 取 打 印 列 表
public DataTable GetPrintList ( string block )
{
try
{
string strwhere = string . Empty ;
if ( ! string . IsNullOrEmpty ( block ) )
{
strwhere = strwhere + " and block='" + block + "'" ;
}
2025-06-24 15:35:29 +08:00
string sql = string . Format ( "select id, orderid, city , fdate , boxcode, shopname, shopid, orderway, boxno,isnull(totalcount,0) as totalcount , warehouseid, state,block,printstate,senddate,loc,matchid from print_box where state=0 " + strwhere + " order by id" ) ;
2025-06-05 15:11:19 +08:00
return db . GetsqlForDT ( sql ) ;
}
catch ( Exception ex )
{
LogHelper . WriteLogInfo ( "Box获取打印列表异常: " + ex . Message , LogHelper . Log_Type . ERROR ) ;
return null ;
}
}
#endregion
#region 修 改 打 印 状 态
public bool UpPrintList ( string id )
{
try
{
string sql = string . Format ( "update print_box set state=1 where id='{0}'" ,
id ) ;
long x = db . UpdateSql ( sql ) ;
if ( x > 0 )
return true ;
return false ;
}
catch ( Exception ex )
{
LogHelper . WriteLogInfo ( "Box修改打印状态异常: " + ex . Message , LogHelper . Log_Type . ERROR ) ;
return false ;
}
}
#endregion
#region 添 加 箱 号 打 印
public bool InsertPrint ( JobModel model , int boxno , int totalcount )
{
try
{
string sql = string . Format ( "insert into print_box(orderid ,city,fdate,boxcode,shopname,shopid,orderway,boxno,warehouseid,state,block,senddate,totalcount,matchid,loc) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}') " ,
model . OrderID , model . ProdArea , DateTime . Now . ToString ( ) , model . BoxCode , model . Shopname , model . ShopID , model . Orderway , boxno , "" , "0" , "" , "" , totalcount , model . Matchid , "" ) ;
long x = db . UpdateSql ( sql ) ;
if ( x > 0 )
return true ;
return false ;
}
catch ( Exception ex )
{
LogHelper . WriteLogInfo ( "Box修改打印状态异常: " + ex . Message , LogHelper . Log_Type . ERROR ) ;
return false ;
}
}
#endregion
}
}