291 lines
9.1 KiB
C#
291 lines
9.1 KiB
C#
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
|
|
|
|
}
|
|
}
|