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 + "'"; } 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"); 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 } }