This commit is contained in:
jl
2025-06-05 15:11:19 +08:00
parent 285bae186b
commit 8c1493f76e
17 changed files with 351 additions and 273 deletions

View File

@ -572,29 +572,33 @@ namespace Epost.DAL
{
ResultsModel resultModel = new ResultsModel();
HttpHelper http = new HttpHelper();
string ControlIP = "http://" + model.ControlIP + ":8000/param/";
string ControlIP = "http://" + model.ControlIP + ":8000/param/";
string result = "";
SendParamModel sendModel = new SendParamModel();
sendModel.Address = model.Address;
sendModel.Command = model.Command;
sendModel.Parameter = model.Parameter;
sendModel.Type = model.Type;
sendModel.Uid = model.Uid;
sendModel.Quantity = model.Quantity;
sendModel.Timeout = model.Timeout;
sendModel.Mode = model.Mode;
try
{
string postStr = JsonHelper.SerializeObject(sendModel);
result = http.HttpPost_Old(ControlIP, postStr);
resultModel = JsonHelper.DeserializeObject<ResultsModel>(result);
LogHelper.WriteLogInfo("---------------------------------------" + ControlIP+"-----------"+ postStr);
LogHelper.WriteLogInfo("---------------------------------------" + ControlIP + "-----------" + postStr);
if (!resultModel.Status.Equals("OK"))
{
LogHelper.WriteLogInfo("发送指令失败-发送指令:" + postStr);
LogHelper.WriteLogInfo("发送指令失败-返回信息:" + result);
LogHelper.WriteLogInfo("发送指令失败-发送指令:" + postStr, Log_Type.ERROR);
LogHelper.WriteLogInfo("发送指令失败-返回信息:" + result, Log_Type.ERROR);
}
}
catch (Exception e)
{
LogHelper.WriteLogInfo("发送指令异常:" + e.Message);
LogHelper.WriteLogInfo("发送指令异常:" + e.Message, Log_Type.ERROR);
// throw;
}
if (resultModel != null && resultModel.Status.Equals("OK"))

View File

@ -131,6 +131,7 @@
<Compile Include="OrcaleDB.cs" />
<Compile Include="OrdersDAL.cs" />
<Compile Include="PressureTestDAL.cs" />
<Compile Include="Print_BoxDAL.cs" />
<Compile Include="Properties\Class1.cs" />
<Compile Include="ControlDAL.cs" />
<Compile Include="LabelDAL.cs" />

View File

@ -36,7 +36,7 @@ namespace Epost.DAL
#region
public DataTable GetOrderList_Car(string matchid, string sku, string area, string block)
public DataTable GetOrderList_Car(string matchid, string sku, string area, string block,string usercode)
{
try
{
@ -45,10 +45,15 @@ namespace Epost.DAL
{
strwhere = "and matchid= '" + matchid + "'";
}
if (!string.IsNullOrEmpty(usercode))
{
strwhere += "and info= '" + usercode + "'";
}
string sql = string.Empty;
if (!string.IsNullOrEmpty(area))
{
sql = string.Format("select id, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, corlorcode, address, ControlIP,area, block,boxcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode,shopname from v_orders where state = 0 and oprationstate <>3 and sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + " order by layer,slist ",
sql = string.Format("select id, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, corlorcode, address, ControlIP,area, block,boxcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode,shopname from v_orders where state = 0 and oprationstate <>3 and sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + " order by layer,slist ",
sku,
block, area);
@ -1068,17 +1073,17 @@ namespace Epost.DAL
}
string sql = "select matchid, sku from V_orders where oprationstate <> 3 and state<>99 and block ='" + block + "' " + strwheres;
LogHelper.WriteLogInfo("判断当前sku是否为已完成" + sql);
LogHelper.WriteLogInfo("判断当前门店是否为已完成" + sql);
DataTable dt = db.GetsqlForDT(sql);
if (dt == null || dt.Rows.Count == 0)
{
LogHelper.WriteLogInfo("判断当前sku是否为已完成true");
LogHelper.WriteLogInfo("判断当前门店是否为已完成true");
return true;
}
else
{
LogHelper.WriteLogInfo("判断订单状态为已完成false");
LogHelper.WriteLogInfo("判断当前门店是否为已完成false");
return false;
}
}
@ -2539,6 +2544,46 @@ namespace Epost.DAL
}
#endregion
#region
public bool ChangeBox(string shopid, string boxcode,int boxno,int totalcount)
{
string upstr = string.Empty;
if (totalcount != 0)
{
upstr = ",totalcount='"+totalcount+"'";
}
string sql = string.Format("update orders set boxcode='{0}',state =3 where shopid = '{1}' and oprationstate=3 and (boxcode is null or boxcode='') ",
boxcode, shopid);
long x = db.UpdateSql(sql);
LogHelper.WriteLogInfo(x+"换箱" +sql);
if (x > 0)
{
string newsql = string.Format("update orders set boxno='{0}'" + upstr + " where shopid = '{1}' ",
boxno, shopid);
long l = db.UpdateSql(newsql);
LogHelper.WriteLogInfo(l + "更新箱数" + newsql);
return true;
}
else { return false; }
}
#endregion
#region
public int GetStoreInfo(string shopid)
{
string sql = string.Format("select top 1 isnull(max(boxno),0) as boxno from orders where shopid = '{0}' and state = 0 ",
shopid);
DataTable dt= db.GetsqlForDT(sql);
if (dt != null && dt.Rows.Count > 0)
{
return Convert.ToInt32(dt.Rows[0]["boxno"].ToString()) ;
}
else { return 0; }
}
#endregion
}
}

View File

@ -89,7 +89,7 @@ namespace Epost.DAL
#region
public DataTable getQueueOrderState(OrdersQueueModel model)
{
string sql = string.Format("select * from OrdersQueue where taskblock='{0}' and taskarea='{1}' and state<>2 and state<>3 order by sort",
string sql = string.Format("select * from OrdersQueue where taskblock='{0}' and taskarea='{1}' and state=0 order by sort",
model.Taskblock,
model.Taskarea);
return db.GetsqlForDT(sql);
@ -213,7 +213,7 @@ namespace Epost.DAL
#region sku是否正在作业
public DataTable GetOrderQueue(string block,string area,string state)
{
string sql = string.Format("select * from OrdersQueue where state <>'{0}' and taskblock='{1}' and taskarea='{2}'",
string sql = string.Format("select * from OrdersQueue where state ='{0}' and taskblock='{1}' and taskarea='{2}'",
state,
block,area);
LogHelper.WriteLogInfo("获取sku是否正在作业" + sql);
@ -408,5 +408,18 @@ namespace Epost.DAL
}
#endregion
#region
public bool UpdateQueueByUser(string usercode,string color)
{
string sql = string.Format("update OrdersQueue set state = 0,usercode ='{0}',lightcolor='{1}' where state=2 ",
usercode,color);
long x= db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
}
}

76
Epost.DAL/Print_BoxDAL.cs Normal file
View File

@ -0,0 +1,76 @@
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 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
}
}