Files
T-DAS/Epost.DAL/BoxQueueDAL.cs

291 lines
9.1 KiB
C#
Raw Permalink Normal View History

2023-01-13 15:30:20 +08:00
using Epost.Common;
using Epost.Model;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.DAL
{
public class BoxQueueDAL
{
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
#region
public bool insertQueueOrders(BoxQueueModel model)
{
string sql = string.Format("insert into BoxQueue(shopid,sort,taskarea,state,taskblock,usercode,orderid,matchid,carid,address,controlip) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')",
model.Shopid,
model.Sort,
model.Taskarea,
model.State,
model.Taskblock,
model.UserCode,
model.Orderid,
model.Matchid,
model.Carid,
model.Address,
model.Controlip);
LogHelper.WriteLogInfo("添加boxqueue任务信息=========" + sql);
long x = db.InsertSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public DataTable getQueuesOrder()
{
string sql = "select * from BoxQueue";
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueuesbyCar(string carid)
{
string sql =string.Format("select * from BoxQueue where state<>3",
carid);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueuesOrderbyState()
{
string sql = string.Format("select * from BoxQueue where state ='0'");
LogHelper.WriteLogInfo("-获取正在绑定的信息" + sql);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueuesOrderbyState(string shopcod,string state)
{
string sql = string.Format("select * from BoxQueue where state ='{0}' and shopid='{1}'",
state,
shopcod);
// LogHelper.WriteLogInfo("获取正在绑定的信息" + sql);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueuesBox(string block)
{
string sql = string.Format("select * from BoxQueue where state <>3 and taskblock='{0}'",
block);
// LogHelper.WriteLogInfo("获取正在绑定的信息" + sql);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueuesbyState()
{
string sql = "select * from BoxQueue where state<>0 and state<>3";
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getOrderqueueByAddr(string addr, string ip,string state)
{
string sql = string.Format("select * from BoxQueue where state='{2}' and address='{0}' and controlip='{1}'",
addr,
ip,
state);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueueOrderState(BoxQueueModel model)
{
string sql = string.Format("select * from BoxQueue where taskblock='{0}' and taskarea='{1}' and state<>2",
model.Taskblock,
model.Taskarea);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueueState(BoxQueueModel model)
{
string sql = string.Format("select * from BoxQueue where taskblock='{0}' and taskarea='{1}' and state=1",
model.Taskblock,
model.Taskarea);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueueStateByLoc(string loc)
{
string sql = string.Format("select * from ordersqueue where location='{0}' and state<>2",
loc);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getBoxDeatil(string Taskblock,string Taskarea)
{
string sql = string.Format("select * from BoxQueue where Taskblock='{0}' and taskarea='{1}'",
Taskblock,
Taskarea);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable getQueueOrderStateList(BoxQueueModel model)
{
string sql = string.Format("select * from BoxQueue where taskblock='{0}' and taskarea='{1}' ",
model.Taskblock,
model.Taskarea);
return db.GetsqlForDT(sql);
}
#endregion
#region
public bool UpdateQueueOrderState(BoxQueueModel model)
{
string sql = string.Format("update BoxQueue set state=1 where id =( SELECT a.id FROM (select min(id) as id from BoxQueue where state =0 and taskblock='{0}' and taskarea='{1}')AS a)",
model.Taskblock,
model.Taskarea);
long x = db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool UpdateQueueState(string id, string state)
{
string sql = string.Format("update BoxQueue set state='{0}' where id ='{1}'",
state, id);
long x = db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool UpdateBoxCode(string id, string boxcode,string traycode)
{
string sql = string.Format("update BoxQueue set state=3,boxcode='{0}',TrayCode='{1}' where id ='{2}'",
boxcode, traycode,
id );
long x = db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool UpdateQueueTaskArea(BoxQueueModel model)
{
string sql = string.Format("update BoxQueue set taskarea='{0}',state='{2}' where orderid='{1}' and state<>2",
model.Taskarea,
model.Orderid,
model.State);
long x = db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool UpdateQueueState()
{
string sql = string.Format("update BoxQueue set state=0 where state<>3");
long x = db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool deleteBoxpick()
{
string sql = string.Format(" delete from Boxpick where shopid not in(select shopid from BoxQueue )");
long x = db.DeleteSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool UpdateState(string matchid)
{
string sql = string.Format("update BoxQueue set state=0 where matchid='{0}' and state = 9",
matchid);
long x = db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool DeleteQueueOrder(string orderid)
{
string sql = string.Format("delete from BoxQueue where orderid='{0}' and state=0",
orderid);
long x = db.DeleteSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool DeleteQueueByMatch(string matchid)
{
string sql = string.Format("delete from BoxQueue where matchid='{0}'",
matchid);
long x = db.DeleteSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool deletequeue()
{
string sql = string.Format("delete from BoxQueue where state=3");
LogHelper.WriteLogInfo("删除已经做完的箱号信息"+sql);
long x = db.DeleteSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
}
}