17 Commits

Author SHA1 Message Date
jl
85be80759a 2024-12-27 16:54:02 +08:00
jl
78b193a52a 2024-12-25 10:15:41 +08:00
jl
43d0c7e249 2024-12-12 18:27:10 +08:00
jl
d64bd2fcdf 2024-12-06 13:19:43 +08:00
jl
4e4c0dbb59 2024-12-05 14:36:37 +08:00
jl
261fde99ce 2024-12-04 17:04:16 +08:00
jl
a867e6244c 2024-12-03 10:55:54 +08:00
jl
7bdb8633db 2024-12-02 13:53:56 +08:00
jl
fb0c29fb89 2024-11-28 11:35:38 +08:00
jl
de246b1cf2 2024-11-27 18:33:35 +08:00
jl
90ec40a018 2024-11-27 10:39:18 +08:00
jl
068fe0a148 2024-11-23 20:47:14 +08:00
jl
48afa11af7 2024-11-22 15:31:46 +08:00
jl
7f5e4fcc3f 2024-11-20 14:49:56 +08:00
jl
2219cae500 2024-11-08 11:54:40 +08:00
jl
7c1ab8ce69 2024-09-05 13:36:12 +08:00
jl
d5e45f63b4 2024-09-02 16:42:28 +08:00
42 changed files with 2749 additions and 1324 deletions

148
Common/AgvHelper.cs Normal file
View File

@ -0,0 +1,148 @@
using Epost.Model;
using NPOI.POIFS.Crypt.Dsig;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.Common
{
public class AgvHelper
{
string agvSchedulingTaskUrl = ConfigurationManager.AppSettings["agvSchedulingTaskUrl"];
string bindCtnrAndBinUrl = ConfigurationManager.AppSettings["bindCtnrAndBinUrl"];
HttpHelper http = new HttpHelper();
#region
public AgvResultModel genAgvSchedulingTask(AgvSchedulingTaskModel model)
{
AgvResultModel resmodel = new AgvResultModel();
try
{
string postData = JsonHelper.SerializeObject(model);
LogHelper.WriteLogInfo("调用AGV生成任务单接口请求参数" + postData, LogHelper.Log_Type.INFO);
string res = http.HttpPost_Old(agvSchedulingTaskUrl, postData);
LogHelper.WriteLogInfo("调用AGV生成任务单接口返回" + res, LogHelper.Log_Type.INFO);
if (!string.IsNullOrEmpty(res))
{
resmodel = JsonHelper.DeserializeObject<AgvResultModel>(res);
if (resmodel.code == "0")
{
LogHelper.WriteLogInfo("调用AGV生成任务单接口返回成功", LogHelper.Log_Type.INFO);
}
else
{
LogHelper.WriteLogInfo("调用AGV生成任务单接口返回失败" + resmodel.message, LogHelper.Log_Type.ERROR);
}
}
else
{
LogHelper.WriteLogInfo("调用AGV生成任务单接口返回失败", LogHelper.Log_Type.ERROR);
}
string resinfo = JsonHelper.SerializeObject(resmodel);
return resmodel;
}
catch (Exception ex)
{
resmodel.code = "-1";
resmodel.message = ex.ToString();
LogHelper.WriteLogInfo("调用AGV生成任务单接口异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
return resmodel;
}
}
#endregion
#region
public AgvResultModel cancelTask(cancelTaskModel model)
{
string url = string.Empty;
AgvResultModel resmodel = new AgvResultModel();
try
{
string postData = JsonHelper.SerializeObject(model);
LogHelper.WriteLogInfo("调用AGV取消任务接口请求参数" + postData, LogHelper.Log_Type.INFO);
string res = http.HttpPost_Old(url, postData);
LogHelper.WriteLogInfo("调用AGV取消任务接口返回" + res, LogHelper.Log_Type.INFO);
if (!string.IsNullOrEmpty(res))
{
resmodel = JsonHelper.DeserializeObject<AgvResultModel>(res);
if (resmodel.code == "0")
{
LogHelper.WriteLogInfo("调用AGV取消任务接口返回成功", LogHelper.Log_Type.INFO);
}
else
{
LogHelper.WriteLogInfo("调用AGV取消任务接口返回失败" + resmodel.message, LogHelper.Log_Type.ERROR);
}
}
else
{
LogHelper.WriteLogInfo("调用AGV取消任务接口返回失败", LogHelper.Log_Type.ERROR);
}
return resmodel;
}
catch (Exception ex)
{
resmodel.code = "-1";
resmodel.message = ex.ToString();
LogHelper.WriteLogInfo("调用AGV取消任务接口异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
return resmodel;
}
}
#endregion
#region
public bindCtnrAndBinResponse bindCtnrAndBin(string agvloc, string type)
{
bindCtnrAndBinReq reqModel = new bindCtnrAndBinReq();
bindCtnrAndBinResponse resmodel = new bindCtnrAndBinResponse();
reqModel.reqCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
reqModel.ctnrTyp = "1";//agv提供
reqModel.indBind = "1";
reqModel.stgBinCode = agvloc;
reqModel.ctnrCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
string reqstr = JsonHelper.SerializeObject(reqModel);
LogHelper.WriteLogInfo("调用AGV绑定解绑接口请求参数" + reqstr, LogHelper.Log_Type.INFO);
string resultStr = http.HttpPost_Old(bindCtnrAndBinUrl, reqstr);
LogHelper.WriteLogInfo("调用AGV绑定解绑接口返回" + resultStr, LogHelper.Log_Type.INFO);
if (!string.IsNullOrEmpty(resultStr))
{
resmodel = JsonHelper.DeserializeObject<bindCtnrAndBinResponse>(resultStr);
if (resmodel.code == "0")
{
LogHelper.WriteLogInfo("调用AGV绑定解绑接口成功", LogHelper.Log_Type.INFO);
}
else
{
LogHelper.WriteLogInfo("调用AGV绑定解绑接口失败" + resmodel.data, LogHelper.Log_Type.ERROR);
}
}
else
{
LogHelper.WriteLogInfo("调用AGV绑定解绑接口返回失败", LogHelper.Log_Type.ERROR);
}
return resmodel;
}
#endregion
}
}

View File

@ -53,7 +53,7 @@ namespace Epost.Common
sb.Append(b.ToString("x2"));
}
//所有字符转为大写
return sb.ToString().ToUpper();
return sb.ToString();
}
#endregion
@ -232,6 +232,36 @@ namespace Epost.Common
#endregion
#endregion
#region Base64编码
/// <summary>
/// 对字符串进行Base64编码
/// </summary>
/// <param name="source"></param>
/// <returns>string</returns>
public static string Base64EnCode(string source)
{
byte[] bytes = UTF8Encoding.UTF8.GetBytes(source);
return Convert.ToBase64String(bytes);
}
#endregion
#region Base64解码
/// <summary>
/// 对字符串进行Base64解码
/// </summary>
/// <param name="source"></param>
/// <returns>string</returns>
public static string Base64Decode(string source)
{
byte[] bytes = Convert.FromBase64String(source);
return UTF8Encoding.UTF8.GetString(bytes);
}
#endregion
}
#endregion
}

View File

@ -106,6 +106,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AgvHelper.cs" />
<Compile Include="CacheHelper.cs" />
<Compile Include="ConfigurationOperator.cs" />
<Compile Include="ConvertHexHelper.cs" />
@ -122,6 +123,7 @@
<Compile Include="ModelConvertHelper.cs" />
<Compile Include="PingHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Time_TaskHelper.cs" />
<Compile Include="XmlHelper.cs" />
</ItemGroup>
<ItemGroup>

72
Common/Time_TaskHelper.cs Normal file
View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.Common
{
public class Time_TaskHelper
{
public event System.Timers.ElapsedEventHandler ExecuteTask;
private static readonly Time_TaskHelper _task = null;
private System.Timers.Timer _timer = null;
//定义时间
private int _interval = 1000;
public int Interval
{
set
{
_interval = value;
}
get
{
return _interval;
}
}
static Time_TaskHelper()
{
_task = new Time_TaskHelper();
}
public static Time_TaskHelper Instance()
{
return _task;
}
//开始
public void Start()
{
if (_timer == null)
{
_timer = new System.Timers.Timer(_interval);
_timer.Elapsed += new System.Timers.ElapsedEventHandler(_timer_Elapsed);
_timer.Enabled = true;
_timer.Start();
}
}
protected void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (null != ExecuteTask)
{
ExecuteTask(sender, e);
}
}
//停止
public void Stop()
{
if (_timer != null)
{
_timer.Stop();
_timer.Dispose();
_timer = null;
}
}
}
}

View File

@ -146,9 +146,9 @@ namespace Epost.BLL
#endregion
#region
public DataTable getLabelList(string controlid)
public DataTable getLabelList(string controlid,string batchno)
{
return dal.getLabelList(controlid);
return dal.getLabelList(controlid, batchno);
}
#endregion

View File

@ -0,0 +1,24 @@
using Epost.DAL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.BLL
{
public class AgvLogInfoBLL
{
AgvLogInfoDAL dal = new AgvLogInfoDAL();
public bool insertAgvLogInfo(string reqCode, string reqTime, string robotCode, string beginDate, string warnContent, string taskCode)
{
return dal.insertAgvLogInfo(reqCode,reqTime,robotCode,beginDate,warnContent,taskCode);
}
public DataTable getAgvLogList(string strwhere)
{
return dal.getAgvLogList(strwhere);
}
}
}

View File

@ -27,7 +27,7 @@ namespace Epost.BLL
string IP = ConfigurationManager.AppSettings["WebAPIUrl"];
#region
public ResultModel Initialization_M(bool isback = true)
public ResultModel Initialization_T(bool isback = true)
{
ResultModel resultModel = new ResultModel();
List<LabelParamModel> list = new List<LabelParamModel>();
@ -60,6 +60,12 @@ namespace Epost.BLL
model.Command = "UNLOCK";
model.Timeout = "0.5";
list.Add(model);
model = new LabelParamModel();
model.ControlIP = item["ControlIP"].ToString();
model.Address = "9999";
model.Command = "LED_OFF";
model.Timeout = "0.5";
list.Add(model);
}
if (list.Any())
@ -84,7 +90,7 @@ namespace Epost.BLL
#endregion
#region
public ResultModel GetAllLabelList_M()
public ResultModel GetAllLabelList_M(string batchno)
{
ResultModel model = new ResultModel();
try
@ -96,11 +102,12 @@ namespace Epost.BLL
{
foreach (DataRow item in dt.Rows)
{
DataTable lableDt = addrBLL.getLabelList(item["id"].ToString());
DataTable lableDt = addrBLL.getLabelList(item["id"].ToString(), batchno);
if (lableDt != null && lableDt.Rows.Count > 0)
{
foreach (DataRow labelItem in lableDt.Rows)
{
string shopid = labelItem["address"].ToString();
if (labelItem["addresstype"].ToString() == "2")
{
LabelParamModel CNlablemodel = new LabelParamModel();
@ -115,12 +122,20 @@ namespace Epost.BLL
}
else
{
if (!string.IsNullOrEmpty(labelItem["shopid"].ToString()))
{
shopid = labelItem["shopid"].ToString();
if (shopid.Length > 4)
{
shopid = shopid.Substring(shopid.Length-4,4);
}
}
LabelParamModel lablemodel = new LabelParamModel();
lablemodel.Address = labelItem["address"].ToString();
lablemodel.ControlIP = item["ControlIP"].ToString();
lablemodel.Command = "DISPLAY_JOB";
lablemodel.Type = "N";
lablemodel.Quantity = labelItem["address"].ToString();
lablemodel.Quantity = shopid;
lablemodel.Uid = labelItem["address"].ToString();
lablemodel.Mode = "10";
list.Add(lablemodel);
@ -432,6 +447,7 @@ namespace Epost.BLL
LabelParamModel model = new LabelParamModel();
model.ControlIP = item["ControlIP"].ToString();
FORMATE_JOB_DATA(model);
LED_OFF_CLEAR(item["ControlIP"].ToString());
}
@ -639,6 +655,14 @@ namespace Epost.BLL
model.Address = addritem["address"].ToString();
model.ControlIP = addritem["controlip"].ToString();
model.Parameter =show.No;
model.Uid = show.Uid;
if (string.IsNullOrEmpty(show.Uid))
{ model.Uid = addritem["address"].ToString(); }
model.Type = "N";
if (addritem["addresstype"].ToString() == "2")
{
model.Type = "C";
}
model.Command = "REMOVE_JOB";
model.Timeout = "0.5";
list.Add(model);

View File

@ -92,6 +92,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AddressstorageBLL.cs" />
<Compile Include="AgvLogInfoBLL.cs" />
<Compile Include="BoxPickBLL.cs" />
<Compile Include="BoxQueueBLL.cs" />
<Compile Include="CommandBLL.cs" />
@ -99,12 +100,14 @@
<Compile Include="EntityBase.cs" />
<Compile Include="ErrorLogBLL.cs" />
<Compile Include="HistoryXmlBLL.cs" />
<Compile Include="InboundOrdersBLL.cs" />
<Compile Include="Light.cs" />
<Compile Include="LogXmlBLL.cs" />
<Compile Include="MenuInfoBLL.cs" />
<Compile Include="ModelConvertHelper.cs" />
<Compile Include="OrderBLL.cs" />
<Compile Include="OrderControlBLL.cs" />
<Compile Include="PalletinfoBLL.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RoleInfoBLL.cs" />
<Compile Include="ShopBLL.cs" />
@ -112,11 +115,13 @@
<Compile Include="StorageLocationBLL.cs" />
<Compile Include="OrdersQueueBLL.cs" />
<Compile Include="StoreBLL.cs" />
<Compile Include="Sys_operate_logBLL.cs" />
<Compile Include="UserBLL.cs" />
<Compile Include="WmsBLL.cs" />
<Compile Include="WmsTaskBLL.cs" />
<Compile Include="Work_DisplayJobThread.cs" />
<Compile Include="Work_JobDownThread.cs" />
<Compile Include="Work_ScanThread.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Epost.Common.csproj">

View File

@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Epost.DAL;
using Epost.Model;
namespace Epost.BLL
{
public class InboundOrdersBLL
{
InboundOrdersDAL dal = new InboundOrdersDAL();
#region
/// <summary>
/// 分页获取数据列表
/// </summary>
public List<InboundOrdersModel> GetOrdersListByPage(string strWhere, string orderby, int pageSize, int pageIndex, out int recordCount)
{
int startIndex = 0;
int endIndex = 0;
if (pageIndex <= 0)
pageIndex = 1;
//计算查询的开始行数与结束行数
startIndex = (pageIndex - 1) * pageSize + 1;
endIndex = pageIndex * pageSize;
return dal.GetOrdersListByPage(strWhere, orderby, startIndex, endIndex, out recordCount);
}
#endregion
#region
public DataTable GetOrdersList(string wmsDocNo)
{
return dal.GetOrdersList(wmsDocNo);
}
#endregion
#region
public DataTable GetInOrderList(string strwhere)
{
return dal.GetInOrderList(strwhere);
}
#endregion
#region
public DataTable GetV_InOrders(string strwhere)
{
return dal.GetV_InOrders(strwhere);
}
#endregion
#region
public string GetLocation(string strwhere,out string type1)
{
DataTable dt= dal.GetLocation(strwhere);
if (dt != null && dt.Rows.Count > 0)
{
type1 = dt.Rows[0]["type"].ToString();
return dt.Rows[0]["agvloc"].ToString();
}
else {
type1 ="";
return "";
}
}
#endregion
#region
public bool InsertOrder(DataTable dt, Dictionary<string, string> diclist)
{
return dal.InsertOrders(dt, diclist);
}
#endregion
#region
public bool UpInOrderList(string id, string state,string data="")
{
return dal.UpInOrderList(id,state,data);
}
public bool UpInOrder(string id, string errormsg)
{
return dal.UpInOrder(id, errormsg);
}
#endregion
#region agv单号更新订单状态
public bool UpInOrderListByAgvid(string agvid, string state)
{
return dal.UpInOrderListByAgvid(agvid, state);
}
#endregion
}
}

View File

@ -707,7 +707,7 @@ namespace Epost.BLL
demodel.BatchId = item["BatchId"].ToString();
demodel.ID = item["ID"].ToString();
demodel.GoodsName = item["GoodsName"].ToString();
demodel.GoodsType = item["GoodsType"].ToString();
demodel.Quantity = Convert.ToInt32(item["Quantity"].ToString());
demodel.CheckQuantity = Convert.ToInt32(item["CheckQuantity"].ToString());
demodel.Sku = item["Sku"].ToString();
@ -715,13 +715,13 @@ namespace Epost.BLL
demodel.Matchid = item["Matchid"].ToString();
demodel.ShopID = item["shopid"].ToString();
demodel.BoxCode = item["boxcode"].ToString();
demodel.LotNo = item["LotNo"].ToString();
demodel.Discount = item["Discount"].ToString();
demodel.ProdArea = item["ProdArea"].ToString();
demodel.ColorCode = item["corlorcode"].ToString();
demodel.WholeUnit = item["WholeUnit"].ToString();
demodel.Unit = item["Unit"].ToString();
demodel.TrayCode = item["bkbarcode"].ToString();
#region
demodel.Block = item["Block"].ToString();
demodel.Area = item["Area"].ToString();
@ -924,9 +924,9 @@ namespace Epost.BLL
return dal.getOrderListBysku(block, sku);
}
public bool UpOrderStateBybat(string batchid)
public bool UpOrderStateBybat(string id)
{
return dal.UpOrderStateBybat(batchid);
return dal.UpOrderStateBybat(id);
}

View File

@ -48,8 +48,8 @@ namespace Epost.BLL
orderbll.UpOrderstate();
UserCacheDAL.ClearUserCodeList();
boxcache.ClearBoxList();
ResultModel resultModel = comBLL.Initialization_M();
GetOrderQueue(); //加载任务显示器信息
ResultModel resultModel = comBLL.Initialization_T();
// GetOrderQueue(); //加载任务显示器信息
return resultModel;
}
@ -73,17 +73,18 @@ namespace Epost.BLL
{
OrisShow = true;
workbll.UpdateWorkModel(WorkEcommendType.Create);
//【多少个大区多少个线程】
List<AddressstorageModel> Arealist = addrBLL.GetshelfidList();
if (Arealist.Any())
{
////【多少个大区多少个线程】
//List<AddressstorageModel> Arealist = addrBLL.GetshelfidList();
//if (Arealist.Any())
//{
Work_JobDownThread downthread = new Work_JobDownThread();
downthread.tblock = "01|01";
Work_DisplayJobThread jobthread = new Work_DisplayJobThread();
jobthread.tblock = "01|01";
foreach (AddressstorageModel item in Arealist)
{
string block = item.block + "|" + item.shelfid;
//foreach (AddressstorageModel item in Arealist)
//{
string block = "01|01";
jobthread = new Work_DisplayJobThread();
jobthread.id = block;
jobthread.tblock = block;
@ -98,8 +99,10 @@ namespace Epost.BLL
downthread.OrisShow = OrisShow;
Thread thread = new Thread(new ThreadStart(downthread.Work));
thread.Start();
}
}
// }
// }
}
}
@ -110,10 +113,10 @@ namespace Epost.BLL
#region
public ResultModel TestStart()
public ResultModel TestStart(string batchno)
{
ResultModel result = comBLL.GetAllLabelList_M();
ResultModel result = comBLL.GetAllLabelList_M(batchno);
return result;
}
@ -293,12 +296,12 @@ namespace Epost.BLL
lock (showmes)
{
bool bo = orderbll.isTask(sblock, sarea);
// bool bo = orderbll.isTask(sblock, sarea);
string msg = string.Empty;
if (!bo)
{
msg = "当前商品无任务\r请送至下一区";
}
//if (!bo)
//{
// msg = "当前商品无任务\r请送至下一区";
//}
DataTable sudt = orderbll.GetSumList("", scanStr, sblock);
if (type == 2)
{

View File

@ -0,0 +1,40 @@
using Epost.DAL;
using Epost.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.BLL
{
public class PalletinfoBLL
{
PalletinfoDAL dal = new PalletinfoDAL();
#region
/// <summary>
/// 分页获取数据列表
/// </summary>
public List<PalletinfoModel> GetPalletListByPage(string strWhere, string orderby, int pageSize, int pageIndex, out int recordCount)
{
int startIndex = 0;
int endIndex = 0;
if (pageIndex <= 0)
pageIndex = 1;
//计算查询的开始行数与结束行数
startIndex = (pageIndex - 1) * pageSize + 1;
endIndex = pageIndex * pageSize;
return dal.GetPalletListByPage(strWhere, orderby, startIndex, endIndex, out recordCount);
}
#endregion
#region
public bool InsertPallet(DataTable dt, Dictionary<string, string> diclist)
{
return dal.InsertPallet(dt, diclist);
}
#endregion
}
}

View File

@ -14,26 +14,26 @@ namespace Epost.BLL
WmsTaskBLL taskbll = new WmsTaskBLL();
public DataTable GetSkuInfoList(string sku)
{
if (sku.Substring(0, 1) == "2")
{
if (sku.Substring(1, 1) == "5")
{
if (sku.Length >= 7)
{
sku = sku.Substring(2, 6);
}
}
else {
if (sku.Length >= 7)
{
sku = sku.Substring(1, 6);
}
}
return dal.GetSkuInfo(sku);
}
else {
//if (sku.Substring(0, 1) == "2")
//{
// if (sku.Substring(1, 1) == "5")
// {
// if (sku.Length >= 7)
// {
// sku = sku.Substring(2, 6);
// }
// }
// else {
// if (sku.Length >= 7)
// {
// sku = sku.Substring(1, 6);
// }
// }
// return dal.GetSkuInfo(sku);
//}
//else {
return dal.GetSkuInfoList(sku);
}
// }
}

View File

@ -0,0 +1,62 @@
using Epost.DAL;
using Epost.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.BLL
{
public class Sys_operate_logBLL
{
Sys_operate_logDAL dal = new Sys_operate_logDAL();
#region
/// <summary>
/// 分页获取数据列表
/// </summary>
public List<Sys_operate_logModel> GetLogListByPage(string strWhere, string orderby, int pageSize, int pageIndex, out int recordCount)
{
int startIndex = 0;
int endIndex = 0;
if (pageIndex <= 0)
pageIndex = 1;
//计算查询的开始行数与结束行数
startIndex = (pageIndex - 1) * pageSize + 1;
endIndex = pageIndex * pageSize;
return dal.GetLogListByPage(strWhere, orderby, startIndex, endIndex, out recordCount);
}
#endregion
#region
public List<Sys_operate_logModel> GetLogDetail(int mid)
{
return dal.GetLogDetail(mid);
}
#endregion
#region
public bool InsertLog(string title, string method, string operate_url, string operate_param, string json_result, int status, string error_msg, DateTime addtime)
{
Sys_operate_logModel logmodel = new Sys_operate_logModel();
logmodel.title = title;
logmodel.method = method;
logmodel.operate_url = operate_url;
logmodel.operate_param = operate_param;
logmodel.json_result = json_result;
logmodel.status = status;
logmodel.error_msg = error_msg;
logmodel.addtime = addtime;
return dal.InsertLogDetail(logmodel);
}
#endregion
}
}

View File

@ -2,7 +2,9 @@
using Epost.DAL.Cache;
using Epost.DAL.Enum;
using Epost.Model;
using Epost.Model.resource;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@ -19,7 +21,7 @@ namespace Epost.BLL
OrdersQueueBLL queueBLL = new OrdersQueueBLL();
CommandBLL comBLL = new CommandBLL();
JobModelCacheDAL JobCache = new JobModelCacheDAL();
private static object lockobj = new object();
AddressstorageBLL addrBLL = new AddressstorageBLL();
WorkIngCacheDAL workbll = new WorkIngCacheDAL();
public void Displayjob()
@ -31,8 +33,10 @@ namespace Epost.BLL
#region
private void GetWorkList(object block)
{
lock (lockobj)
string cm = "";
cm = "lockdisJob" + block;
object c = (Object)cm;
lock (c)
{
while (OrisShow)
{
@ -75,28 +79,17 @@ namespace Epost.BLL
try
{
string[] nlist = tblock.Split('|');
string nblock = nlist[0];
string shelfid = nlist[1];
List<AddressstorageModel> Arealist = addrBLL.GetAreaList(nblock, shelfid);
foreach (AddressstorageModel item in Arealist)
{
OrdersQueueModel model = new OrdersQueueModel(); ;
model.Taskarea = item.area;
model.Taskblock = nblock;
#region
DataTable queueDT = queueBLL.getQueueOrderState(model);
if (queueDT != null && queueDT.Rows.Count > 0)
{
//当前区没有作业
if (queueDT.Rows[0]["state"].ToString() == "0")
{
displayOrder(queueDT, nblock, item.area, model);
}
}
#endregion
}
#region
//查询是否有空闲的agv
//查询待执行的任务
//更新任务状态为执行中
#endregion
}
catch (Exception ex)
{
@ -110,120 +103,6 @@ namespace Epost.BLL
#endregion
#region
public void displayOrder(DataTable queueDT, string nblock, string narea, OrdersQueueModel model)
{
List<LabelParamModel> list = new List<LabelParamModel>();
model.Id = Convert.ToInt32(queueDT.Rows[0]["id"].ToString());
#region
List<JobModel> jobList = JobCache.GetPlanJobList();
List<JobModel> isJobList = jobList.FindAll(p => p.Block == nblock && p.Area == narea && p.State != 3);
ShowMessageModel showmodel = new ShowMessageModel();
//获取当前区任务并加入缓存
if (!isJobList.Any())
{
model.State = 1;
orderbll.GetOrderList(queueDT.Rows[0]["matchid"].ToString(), nblock, queueDT.Rows[0]["sku"].ToString(), narea, queueDT.Rows[0]["usercode"].ToString());
List<JobModel> nowJoblist = jobList.FindAll(p => p.State == 0 && p.Block == model.Taskblock && p.Area == model.Taskarea);
if (nowJoblist.Any())
{
var nowmodel = nowJoblist.FirstOrDefault();
LogHelper.WriteLogInfo("进入任务点亮=====matchid=" + nowmodel.Matchid + "===orderid===" + nowmodel.OrderID + "=====sku==" + nowmodel.Sku + "========");
#region
foreach (JobModel item in nowJoblist.ToArray())
{
#region
if (queueDT.Rows[0]["lightcolor"].ToString() == EnumHelper.EMToDescriptionString(LightColor.Color.Blue))
{
LabelParamModel locklamodel = new LabelParamModel();
locklamodel.Address = item.Address.ToString();
locklamodel.ControlIP = item.ControlIP.ToString();
locklamodel.Command = "LOCK";
locklamodel.Parameter = "11111000";
locklamodel.Type = "N";
list.Add(locklamodel);
}
#endregion
// else
//{
List<JobModel> manyJoblist = nowJoblist.FindAll(m => m.Tolocation == item.Tolocation);
int quantity = item.Quantity;
LabelParamModel lamodel = new LabelParamModel();
lamodel.Address = item.Address.ToString();
lamodel.ControlIP = item.ControlIP.ToString();
lamodel.Command = "DISPLAY_JOB";
#region
//if (manyJoblist.Count > 1)
//{
// if (manyJoblist.FindAll(m => m.State == 0).Any())
// {
// foreach (JobModel mitem in manyJoblist)
// {
// quantity += mitem.Quantity;
// mitem.State = 1;
// mitem.ManyState = 1;
// }
// }
//}
#endregion
lamodel.Type = "N";
lamodel.Quantity = quantity.ToString();
lamodel.Uid = "U" + item.ID;
lamodel.Mode = queueDT.Rows[0]["lightcolor"].ToString() + "0";
list.Add(lamodel);
//}
item.State = 1;
item.ColorCode = queueDT.Rows[0]["lightcolor"].ToString();
item.DisplayTime = DateTime.Now;
}
#endregion
#region
comBLL.DISPLAY_LIGHT_BLOCK(model.Taskblock, model.Taskarea, "1");
#endregion
if (list != null && list.Count > 0)
{
LogHelper.WriteLogInfo("添加到点亮的list————————————————————" + list.Count);
comBLL.DISPLAY_JOBALL(list);
}
}
else
{//无任务
LogHelper.WriteLogInfo("点亮====无任务=======================");
model.State = 3;
}
#endregion
if (jobList.Any())
{
var finishList = jobList.FindAll(p => p.State == 0);
if (!finishList.Any())
{
queueBLL.UpdateQueueOrderState(model);//缓存队列状态修改
}
}
}
else
{
LogHelper.WriteLogInfo("还有未完成任务" + isJobList.Count);
foreach (JobModel item in isJobList)
{
LogHelper.WriteLogInfo("还有未完成任务" + item.Address + item.ID);
}
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,564 @@
using Epost.Common;
using Epost.DAL.Cache;
using Epost.DAL.Enum;
using Epost.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Epost.BLL
{
public class Work_ScanThread
{
public string tblock, id;
public bool OrisShow = false;
OrderBLL orderbll = new OrderBLL();
OrdersQueueBLL queueBLL = new OrdersQueueBLL();
CommandBLL comBLL = new CommandBLL();
JobDownCacheDAL downCacheDAL = new JobDownCacheDAL();
JobModelCacheDAL JobCache = new JobModelCacheDAL();
AddressstorageBLL addrBLL = new AddressstorageBLL();
private static object lockscanList = new object();
public static bool OrcheckisShow = false;
WorkIngCacheDAL workbll = new WorkIngCacheDAL();
SkuInfoBLL skuBLL = new SkuInfoBLL();
UserModelCacheDAL UserCacheDAL = new UserModelCacheDAL();
public void ScanList()
{
GetScanList(tblock);
}
#region
private void GetScanList(object block)
{
string job = "";
job = "lockScan" + block;
object cJob = (object)job;
lock (cJob)
{
while (OrisShow)
{
try
{
string workstate = workbll.GetWorkState();
if (!string.IsNullOrEmpty(workstate))
{
OrisShow = true;
JobScanList(block.ToString());
Thread.Sleep(50);
}
else
{
OrisShow = false;
}
}
catch (Exception ex)
{
LogHelper.WriteLogInfo(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "ScanList异常\r\n" + ex.Message);
}
}
}
}
#endregion
#region
public ResultModel JobScanList(string tblock)
{
lock (lockscanList)
{
string[] nlist = tblock.Split('|');
string nblock = nlist[0];
string shelfid = nlist[1];
ResultModel resmodel = new ResultModel();
resmodel.result = "0";
try
{
List<AddressstorageModel> Arealist = addrBLL.GetAreaList(nblock, shelfid);
foreach (AddressstorageModel item in Arealist)
{
List<ResultMessageModel> sacnList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Status == "0" && m.Block == item.block && m.Area == item.area && m.Command == "QUERY_SPECIAL_STATUS");
if (sacnList != null && sacnList.Count > 0)
{
foreach (ResultMessageModel data in sacnList.ToArray())
{
switch (data.Command)
{
case "QUERY_SPECIAL_STATUS":
BindJobList(data);
break;
default:
break;
}
}
}
}
return resmodel;
}
catch (Exception ex)
{
resmodel.result = "-1";
resmodel.msg = "扫描异常";
LogHelper.WriteLogInfo("扫描异常:" + ex.Message);
return resmodel;
}
}
}
#endregion
#region
public ResultModel BindJobList(ResultMessageModel data)
{
ResultModel res = new ResultModel();
res.result = "0";
try
{
string sblock = data.Block;
string scanStr = data.Parameter.Trim();
string sarea = data.Area;
string name = string.Empty;
string matchid = string.Empty;
#region
List<UserCodeModel> ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == sblock && m.Area == sarea);//
bool isnum = ConvertHexHelper.IsNum(scanStr.Substring(0, 1));//判断扫描首字母是否是数字
if (!ulist.Any())
{
//手动加波次信息
DataTable matdt = orderbll.GetMatchOrderList();
if (matdt != null && matdt.Rows.Count > 0)
{
UserCodeModel umodel = new UserCodeModel();
umodel.Matchid = matdt.Rows[0]["matchid"].ToString();
umodel.Block = sblock;
umodel.Area = sarea;
UserCacheDAL.UpdateUserCodeList(new List<UserCodeModel> { umodel }, EUserCommend.Create);
}
}
ulist = UserCacheDAL.GetUserCodeList().FindAll(m => m.Block == sblock && m.Area == sarea);
if (ulist.Any())
{ matchid = ulist.FirstOrDefault().Matchid; }
#endregion
if (data.Type == "5")//中分扫描枪
{
zhongfenBind(ulist, scanStr, data);
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
}
else if (data.Type == "6")//播种扫描枪
{
xifenBind(ulist, scanStr, data, matchid, isnum);
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
}
return res;
}
catch (Exception ex)
{
res.result = "-1";
res.msg = "绑定任务异常";
LogHelper.WriteLogInfo("绑定任务异常:" + ex.Message);
return res;
}
}
#endregion
#region
public void zhongfenBind(List<UserCodeModel> ulist, string scanStr, ResultMessageModel data)
{
//if (ulist.Any())
//{
// UserCodeModel usermodel = ulist.FirstOrDefault();
//if (string.IsNullOrEmpty(usermodel.ZfCode) && scanStr.Substring(0, 1) != "U")//
//{
// #region 提示先扫描工号
// ShowMessageModel_M show = new ShowMessageModel_M();
// show.Title = "请先扫描工号!";
// show.Contents = "";
// show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
// show.Block = sblock;
// show.Type =2;
// show.Area = sarea;
// show.Islock = true;
// comBLL.ShowBoxMessage_M(show);
// downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
// #endregion
//}
//else {
if (scanStr.Substring(0, 1) == "U")
{
#region
if (ulist.Any())
{
UserCodeModel umodel = ulist.FirstOrDefault();
umodel.ZfCode = scanStr;
#region
ShowMessageModel_M show = new ShowMessageModel_M();
show.Title = "请扫描sku开始作业";
show.Contents = "";
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
show.Block = data.Block;
show.Area = data.Area;
show.Type = 2;
show.Islock = true;
comBLL.ShowBoxMessage_M(show);
#endregion
}
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
#endregion
}
else
{
#region sku
DataTable sinfodt = skuBLL.GetSkuInfoList(data.Parameter);
//string location = string.Empty;
if (sinfodt != null && sinfodt.Rows.Count > 0)
{
scanStr = sinfodt.Rows[0]["sku"].ToString();
// location = data.Parameter;// sinfodt.Rows[0]["tolocation"].ToString();
}
LogHelper.WriteLogInfo("中分" + data.Parameter + "===SKU" + scanStr);
DataTable skudt = orderbll.GetSumList("", scanStr, data.Block);
if (skudt != null && skudt.Rows.Count > 0)
{
//规格
int discount = Convert.ToInt32(skudt.Rows[0]["discount"].ToString());
//整件总数
int SumCkQuantity = 0;//= Convert.ToInt32(skudt.Rows[0]["SumCkQuantity"].ToString());
//散件总数
int SumQuantity = Convert.ToInt32(skudt.Rows[0]["SumQuantity"].ToString());
if (discount != 1)
{
if (SumQuantity >= discount)
{
SumCkQuantity = SumQuantity / discount;
SumQuantity = SumQuantity % discount;
}
}
ShowMessageModel_M show = new ShowMessageModel_M();
show.Title = skudt.Rows[0]["goodsname"].ToString();
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
show.Block = data.Block;
show.Islock = true;
show.Contents = data.Parameter + "(" + scanStr + ")\r" + "规格:" + discount;
show.Qty = SumQuantity.ToString();
show.Wholeqty = SumCkQuantity;
show.Unit = "件";
show.Wholeunit = "箱";
show.Type = 2;
comBLL.ShowBoxMessage_M(show);
}
else
{
ShowMessageModel_M show = new ShowMessageModel_M();
show.Title = "SKU" + scanStr + "无任务!";
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
show.Block = data.Block;
show.Islock = true;
show.Contents = "请扫描其他商品!";
show.Type = 2;
comBLL.ShowBoxMessage_M(show);
}
#endregion
}
}
#endregion
#region
public void xifenBind(List<UserCodeModel> ulist, string scanStr, ResultMessageModel data, string matchid, bool isnum)
{
//if (ulist.Any())
//{
// UserCodeModel usermodel = ulist.FirstOrDefault();
//if (string.IsNullOrEmpty(usermodel.UserCode) && scanStr.Substring(0, 1) != "U")//
//{
// #region 提示先扫描工号
// ShowMessageModel_M show = new ShowMessageModel_M();
// show.Title = "请先扫描工号!";
// show.Contents = "";
// show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
// show.Block = sblock;
// show.Area = sarea;
// show.Type = 8;
// show.Islock = true;
// comBLL.ShowBoxMessage_M(show);
// downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
// #endregion
//}
//else
//{
if (scanStr.Substring(0, 1) == "U")
{
#region
if (ulist.Any())
{
UserCodeModel umodel = ulist.FirstOrDefault();
umodel.UserCode = scanStr;
#region
ShowMessageModel_M show = new ShowMessageModel_M();
show.Title = "请扫描sku开始作业";
show.Contents = "";
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
show.Block = data.Block;
show.Area = data.Area;
show.Type = 8;
show.Islock = true;
comBLL.ShowBoxMessage_M(show);
#endregion
}
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
#endregion
}
else
{
#region
List<ResultMessageModel> hangList = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Parameter == "888888");
if (hangList.Any())
{
#region
LogHelper.WriteLogInfo("挂起" + data.Parameter + "-------通道" + data.Block);
// LabelParamModel FORMATEModel = new LabelParamModel();
// FORMATEModel.ControlIP = data.IP;
// comBLL.FORMATE_JOB_DATA(FORMATEModel);
DataTable qdt = queueBLL.getQueuesOrderbyState(data.Block, data.Area, "1");
if (qdt != null && qdt.Rows.Count > 0)
{
scanStr = qdt.Rows[0]["sku"].ToString();
ShowMessageModel_M show = new ShowMessageModel_M();
show.Block = data.Block;
show.Area = data.Area;
show.Type = 8;
comBLL.RemoveBoxMessage_M(show);
// data.Parameter = scanStr;
Hangup_SKU(scanStr, data.Block, data.Area);
//删除sku对应缓存
List<ResultMessageModel> sdown = downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == scanStr && p.Parameter == qdt.Rows[0]["sku"].ToString()&&p.Block == data.Block);
downCacheDAL.UpdateJobDownModelList(sdown, EdownCommend.Execute);
}
downCacheDAL.UpdateJobDownModelList(hangList, EdownCommend.Execute);
#endregion
}
else if (isnum)//sku
{
#region SKU
//根据扫描商品内码获取商品码
data.ScanCode = data.Parameter;
DataTable sinfodt = skuBLL.GetSkuInfoList(data.Parameter);
string location = string.Empty;
if (sinfodt != null && sinfodt.Rows.Count > 0)
{
scanStr = sinfodt.Rows[0]["sku"].ToString();
location = data.Parameter;// sinfodt.Rows[0]["tolocation"].ToString();
}
data.Parameter = scanStr;
DataTable skudt = queueBLL.GetOrderQueue(data.Block, data.Area, "3");
List<ResultMessageModel> scanlist = downCacheDAL.GetPlanJobDownList().FindAll(m => m.Address == data.Address && m.Parameter == scanStr && m.Parameter != "888888" && m.Block == data.Block && m.Area == data.Area);
if (scanlist.Count > 1 || (skudt != null && skudt.Rows.Count > 0))
{ //重复扫描
//ShowMessageModel_M show = new ShowMessageModel_M();
//show.Title = scanStr + "重复扫描/已拣配!";
//show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
//show.Block = sblock;
//show.Area = sarea;
//show.Type = 8;
//comBLL.ShowBoxMessage_M(show);
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
}
else
{
DataTable OrderDt = orderbll.GetOrderList_Car(matchid, scanStr, data.Area, data.Block);
if (OrderDt != null && OrderDt.Rows.Count > 0)
{
if (ulist.Any())
{
UserCodeModel umodel = ulist.FirstOrDefault();
data.Port = OrderDt.Rows[0]["matchid"].ToString();
OrdersQueueModel qmodel = new OrdersQueueModel();
qmodel.Sku = scanStr;
qmodel.Taskblock = data.Block;
qmodel.Taskarea = data.Area;
qmodel.UserCode = umodel.UserCode;
qmodel.Matchid = umodel.Matchid;
qmodel.Shopid = OrderDt.Rows[0]["GoodsName"].ToString();
qmodel.Location = location;
qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
queueBLL.insertQueueOrders(qmodel);
}
else
{
LogHelper.WriteLogInfo("未扫描波次信息", LogHelper.Log_Type.ERROR);
}
}
else
{
#region
DataTable echoDt = orderbll.GetOrderList_echo(matchid, scanStr, data.Area, data.Block);
if (echoDt != null && echoDt.Rows.Count > 0)
{
if (ulist.Any())
{
UserCodeModel umodel = ulist.FirstOrDefault();
data.Port = echoDt.Rows[0]["matchid"].ToString();
OrdersQueueModel qmodel = new OrdersQueueModel();
qmodel.Sku = scanStr;
qmodel.Taskblock = data.Block;
qmodel.Taskarea = data.Area;
qmodel.UserCode = umodel.UserCode;
qmodel.Matchid = umodel.Matchid;
// qmodel.Location = location;
qmodel.Shopid = echoDt.Rows[0]["GoodsName"].ToString();
qmodel.Lightcolor = EnumHelper.EMToDescriptionString(LightColor.Color.Green);
queueBLL.insertQueueOrders(qmodel);
}
else
{
LogHelper.WriteLogInfo("未扫描波次信息", LogHelper.Log_Type.ERROR);
}
}
else
{
//提示无任务
ShowMessageModel_M show = new ShowMessageModel_M();
show.Title = "商品:" + scanStr + "当前区无任务!";
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
show.Block = data.Block;
show.Area = data.Area;
show.Type = 8;
show.Islock = false;
comBLL.ShowBoxMessage_M(show);
downCacheDAL.UpdateJobDownModelList(new List<ResultMessageModel> { data }, EdownCommend.Execute);
}
#endregion
}
}
#endregion
}
#endregion
}
}
#endregion
#region SKU挂起/
public void Hangup_SKU(string sku, string block, string area, ResultMessageModel data = null)
{
List<LabelParamModel> list = new List<LabelParamModel>();
//查询当前通道sku是否有任务
DataTable dt = orderbll.getOrderListBysku(block, sku);
if (dt != null && dt.Rows.Count > 0)
{
// 将当前通道所有sku正在亮的设备熄灭
foreach (DataRow item in dt.Rows)
{
LabelParamModel lamodel = new LabelParamModel();
lamodel.Address = item["address"].ToString(); ;
lamodel.ControlIP = item["ControlIP"].ToString();
lamodel.Command = "REMOVE_JOB";
lamodel.Parameter = "";
lamodel.Uid = "U" + item["id"].ToString();
lamodel.Type = "N";
list.Add(lamodel);
if (item["oprationstate"].ToString() == "1")
{
orderbll.UpOrderStateBybat(item["id"].ToString());
}
}
if (list != null && list.Count > 0)
{
LogHelper.WriteLogInfo("挂起list——" + sku + "——————————————————:" + list.Count);
comBLL.DISPLAY_JOBALL(list);
}
}
//删除缓存中sku记录
List<JobModel> jobList = JobCache.GetPlanJobList();
List<JobModel> relist = jobList.FindAll(m => m.Sku == sku && m.Block == block);
JobModel model = new JobModel();
if (relist.Any())
{
model = relist.FirstOrDefault();
JobCache.UpdateJobModelList(relist, EcommendType.Complete);
//删除Orderqueue中sku的记录
bool bo = queueBLL.DelQueueOrder(sku, block);
LogHelper.WriteLogInfo("删除queue返回" + bo);
}
else
{
ShowMessageModel_M show = new ShowMessageModel_M();
show.Title = "挂起商品:" + sku + "错误!";
show.Color = EnumHelper.EMToDescriptionString(LightColor.Color.Red);
show.Block = block;
show.Area = area;
show.Type = 8;
show.Islock = true;
comBLL.ShowBoxMessage_M(show);
}
//downCacheDAL.GetPlanJobDownList().FindAll(p => p.Parameter == sku && p.Block == block);
}
#endregion
}
}

View File

@ -133,6 +133,16 @@ namespace Epost.DAL
return dt;
}
#endregion
#region
public DataTable getLabelList(string controlid,string batchno)
{
string sql = string.Format(" select distinct address, state, type, ControlID,addresstype,isnull(shopid,'') as shopid,name,batchno from v_storeaddress where type in (1, 2, 8) and Controlid = '{0}' and batchno='{1}' ",
controlid,batchno);
DataTable dt = db.GetsqlForDT(sql);
return dt;
}
#endregion
#region
public DataTable getAddressByBlock(string block)
{

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.DAL
{
public class AgvLogInfoDAL
{
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
public bool insertAgvLogInfo(string reqCode, string reqTime, string robotCode, string beginDate, string warnContent, string taskCode)
{
string sql = string.Format("insert into agvLogInfo(reqCode ,reqTime,robotCode,beginDate,warnContent,taskCode,addtime) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')",
reqCode,reqTime,robotCode,beginDate,warnContent,
taskCode,DateTime.Now.ToString());
long x =db.InsertSql(sql);
if (x > 0)
return true;
return false;
}
public DataTable getAgvLogList(string strwhere)
{
string sql = string.Format("select * from agvLogInfo where 1=1 "+strwhere);
return db.GetsqlForDT(sql);
}
}
}

View File

@ -99,6 +99,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AddressstorageDAL.cs" />
<Compile Include="AgvLogInfoDAL.cs" />
<Compile Include="BoxPickDAL.cs" />
<Compile Include="BoxQueueDAL.cs" />
<Compile Include="Cache\BoxCodeCacheDAL.cs" />
@ -127,9 +128,11 @@
<Compile Include="Enum\SqlLogType.cs" />
<Compile Include="ErrorLogDAL.cs" />
<Compile Include="HistoryDataDAL.cs" />
<Compile Include="InboundOrdersDAL.cs" />
<Compile Include="MenuInfoDAL.cs" />
<Compile Include="OrcaleDB.cs" />
<Compile Include="OrdersDAL.cs" />
<Compile Include="PalletinfoDAL.cs" />
<Compile Include="PressureTestDAL.cs" />
<Compile Include="Properties\Class1.cs" />
<Compile Include="ControlDAL.cs" />
@ -140,6 +143,7 @@
<Compile Include="RoleInfoDAL.cs" />
<Compile Include="SkuInfoDAL.cs" />
<Compile Include="StoreDAL.cs" />
<Compile Include="Sys_operate_logDAL.cs" />
<Compile Include="UserDAL.cs" />
<Compile Include="WmsDAL.cs" />
<Compile Include="WmsDB.cs" />

View File

@ -0,0 +1,149 @@
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 InboundOrdersDAL
{
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
#region
public List<InboundOrdersModel> GetOrdersListByPage(string strWhere, string orderby, int startIndex, int endIndex, out int recordCount)
{
try
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT * FROM ( ");
strSql.Append(" SELECT ROW_NUMBER() OVER (");
if (!string.IsNullOrEmpty(orderby.Trim()))
{
strSql.Append("order by T." + orderby);
}
else
{
strSql.Append("order by id desc");
}
strSql.Append(")AS Row, T.* from inboundorders T WITH(NOLOCK) ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE 1=1 " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
List<InboundOrdersModel> list = ModelConvertHelper<InboundOrdersModel>.ConvertToList(db.GetsqlForDT(strSql.ToString()));
strSql.Remove(0, strSql.Length);
strSql.Append("SELECT COUNT(*) FROM inboundorders AS T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.AppendFormat(" WHERE 1=1 {0}", strWhere);
}
object obj = db.GetsqlForDT(strSql.ToString()).Rows[0][0];
if (obj != null)
recordCount = Convert.ToInt32(obj);
else
recordCount = 0;
return list;
}
catch (Exception ex)
{
LogHelper.WriteLog(GetType(), ex.Message);
recordCount = 0;
return new List<InboundOrdersModel>();
}
}
#endregion
#region
public DataTable GetOrdersList(string wmsDocNo)
{
string sql = string.Format("select top 1 * from InboundOrders where wmsDocNo = '{0}'",
wmsDocNo);
return db.GetsqlForDT(sql);
}
#endregion
#region
public bool InsertOrders(DataTable dt, Dictionary<string, string> diclist)
{
return db.UpdateData(dt, "InboundOrders", diclist);
}
#endregion
#region
public DataTable GetInOrderList(string strwhere)
{
string sql = string.Format("select * from InboundOrders where 1=1 "+strwhere);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable GetV_InOrders(string strwhere)
{
string sql = string.Format("select * from v_InboundOrders where 1=1 " + strwhere);
return db.GetsqlForDT(sql);
}
#endregion
#region
public DataTable GetLocation(string strwhere)
{
string sql = string.Format("select * from locationInfo where 1=1 " + strwhere);
return db.GetsqlForDT(sql);
}
#endregion
#region
public bool UpInOrderList(string id,string state,string data)
{
string upstr = string.Empty;
if (!string.IsNullOrEmpty(data))
{
upstr = ",agvmsg='',agvid='" + data+"'";
}
string sql = string.Format("update InboundOrders set state ='{0}'"+ upstr + " where id ='{1}'",
state,id);
long x= db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region
public bool UpInOrder(string id,string errormsg)
{
string sql = string.Format("update InboundOrders set agvmsg='{0}' where id ='{1}'",
errormsg, id);
long x = db.UpdateSql(sql);
if (x > 0)
return true;
return false;
}
#endregion
#region agv单号更新订单状态
public bool UpInOrderListByAgvid(string agvid, string state)
{
string sql = string.Format("update InboundOrders set state ='{0}' where agvid = '{1}'",
state, agvid);
long x = db.UpdateSql(sql);
LogHelper.WriteLogInfo(x+"更新agv状态"+sql);
if (x > 0)
return true;
return false;
}
#endregion
}
}

View File

@ -48,7 +48,7 @@ namespace Epost.DAL
string sql = string.Empty;
if (!string.IsNullOrEmpty(area))
{
sql = string.Format("select id, ProdArea, LotNo, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, GoodsType, corlorcode, address, ControlIP,area, block,boxcode,bkbarcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode from v_orders where state = 0 and oprationstate <>3 and sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + "",
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);
@ -56,7 +56,7 @@ namespace Epost.DAL
}
else
{
sql = string.Format("select id,ProdArea, LotNo, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, GoodsType, corlorcode, address, ControlIP, area , block,boxcode,bkbarcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode from v_orders where state = 0 and oprationstate <>3 and sku = '{0}' and block = '{1}' " + strwhere + "",
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}' " + strwhere + " order by layer,slist ",
sku,
block);
@ -90,7 +90,7 @@ namespace Epost.DAL
string sql = string.Empty;
if (!string.IsNullOrEmpty(area))
{
sql = string.Format("select id,ProdArea, LotNo, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, GoodsType, corlorcode, address, ControlIP,area, block,boxcode,bkbarcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode from v_orders where state = 0 and sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + "",
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 from v_orders where state = 0 and sku = '{0}' and block = '{1}' and area='{2}' " + strwhere + " order by layer,slist ",
sku,
block, area);
@ -98,7 +98,7 @@ namespace Epost.DAL
}
else
{
sql = string.Format("select id,ProdArea, LotNo, Matchid, orderid, barcode, BatchId, DownDate, Tolocation, Sku, GoodsName, Discount, Quantity, GoodsType, corlorcode, address, ControlIP, area , block,boxcode,bkbarcode,isnull(checkquantity,0) as checkquantity,wholeunit,unit,shopid,wmsboxcode from v_orders where state = 0 and sku = '{0}' and block = '{1}' " + strwhere + "",
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 from v_orders where state = 0 and sku = '{0}' and block = '{1}' " + strwhere + " order by layer,slist ",
sku,
block);
@ -106,7 +106,7 @@ namespace Epost.DAL
}
LogHelper.WriteLogInfo("获取订单信息location-" + sql);
LogHelper.WriteLogInfo("获取回显订单信息location-" + sql);
return db.GetsqlForDT(sql);
}
catch (Exception ex)
@ -158,7 +158,7 @@ namespace Epost.DAL
strwhere += " and matchid = '" + matchid + "'";
}
string sql = string.Format("select sum(Quantity) as SumQuantity, Sum(checkquantity) as SumCkQuantity,boxweight, Discount,unit,wholeunit,matchid ,goodscode,goodsname from v_orders where readtime= (select top 1 readtime from orders where state=0) and (oprationstate = 0 or oprationstate=1) and sku='{0}' and block='{1}' " + strwhere + " group by sku,boxweight, Discount,goodsname,unit,wholeunit,matchid ,goodscode",
string sql = string.Format("select sum(Quantity) as SumQuantity, Sum(checkquantity) as SumCkQuantity, Discount,unit,wholeunit,matchid ,goodscode,goodsname from v_orders where sku='{0}' and block='{1}' " + strwhere + " group by sku, Discount,goodsname,unit,wholeunit,matchid ,goodscode",
sku,
block);
LogHelper.WriteLogInfo("获取订单信息-中分" + sql);
@ -529,12 +529,12 @@ namespace Epost.DAL
#endregion
#region --使
public bool UpOrderStateBybat(string batchid)
public bool UpOrderStateBybat(string id)
{
try
{
string sql = string.Format(" update orders set oprationstate=0,oprationtime='' where batchid='{0}' and state<>3",
batchid);
string sql = string.Format(" update orders set oprationstate=0,oprationtime='' where id='{0}' and state<>3",
id);
long x = db.UpdateSql(sql);
if (x > 0)
return true;
@ -1247,7 +1247,7 @@ namespace Epost.DAL
#region sku对应的所有任务
public DataTable getOrderListBysku(string block, string sku)
{
string sql = string.Format("select * from v_orders where block = '{0}' and sku ='{1}' ",
string sql = string.Format("select * from v_orders where block = '{0}' and sku ='{1}' order by layer,slist ",
block,
sku);
LogHelper.WriteLogInfo("查询sku对应的所有任务:" + sql);

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 PalletinfoDAL
{
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
#region
public List<PalletinfoModel> GetPalletListByPage(string strWhere, string orderby, int startIndex, int endIndex, out int recordCount)
{
try
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT * FROM ( ");
strSql.Append(" SELECT ROW_NUMBER() OVER (");
if (!string.IsNullOrEmpty(orderby.Trim()))
{
strSql.Append("order by T." + orderby);
}
else
{
strSql.Append("order by id desc");
}
strSql.Append(")AS Row, T.* from Palletinfo T WITH(NOLOCK) ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE 1=1 " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
List<PalletinfoModel> list = ModelConvertHelper<PalletinfoModel>.ConvertToList(db.GetsqlForDT(strSql.ToString()));
strSql.Remove(0, strSql.Length);
strSql.Append("SELECT COUNT(*) FROM Palletinfo AS T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.AppendFormat(" WHERE 1=1 {0}", strWhere);
}
object obj = db.GetsqlForDT(strSql.ToString()).Rows[0][0];
if (obj != null)
recordCount = Convert.ToInt32(obj);
else
recordCount = 0;
return list;
}
catch (Exception ex)
{
LogHelper.WriteLog(GetType(), ex.Message);
recordCount = 0;
return new List<PalletinfoModel>();
}
}
#endregion
#region
public bool InsertPallet(DataTable dt, Dictionary<string, string> diclist)
{
return db.UpdateData(dt, "Palletinfo", diclist);
}
#endregion
}
}

View File

@ -0,0 +1,104 @@
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 Sys_operate_logDAL
{
DataBaseOpration.OprationSqlDAL db = DB_DLL.GetInstance();
#region
public List<Sys_operate_logModel> GetLogListByPage(string strWhere, string orderby, int startIndex, int endIndex, out int recordCount)
{
try
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT * FROM ( ");
strSql.Append(" SELECT ROW_NUMBER() OVER (");
if (!string.IsNullOrEmpty(orderby.Trim()))
{
strSql.Append("order by T." + orderby);
}
else
{
strSql.Append("order by id desc");
}
strSql.Append(")AS Row, T.* from Sys_operate_log T WITH(NOLOCK) ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE 1=1 " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
List<Sys_operate_logModel> list = ModelConvertHelper<Sys_operate_logModel>.ConvertToList(db.GetsqlForDT(strSql.ToString()));
strSql.Remove(0, strSql.Length);
strSql.Append("SELECT COUNT(*) FROM Sys_operate_log AS T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.AppendFormat(" WHERE 1=1 {0}", strWhere);
}
object obj = db.GetsqlForDT(strSql.ToString()).Rows[0][0];
if (obj != null)
recordCount = Convert.ToInt32(obj);
else
recordCount = 0;
return list;
}
catch (Exception ex)
{
LogHelper.WriteLog(GetType(), ex.Message);
recordCount = 0;
return new List<Sys_operate_logModel>();
}
}
#endregion
#region
public List<Sys_operate_logModel> GetLogDetail(int mid)
{
string sql = string.Format("select * from Sys_operate_log where ID='" + mid + "'");
DataTable dt = db.GetsqlForDT(sql);
return ModelConvertHelper<Sys_operate_logModel>.ConvertToList(dt);
}
#endregion
#region
public bool InsertLogDetail(Sys_operate_logModel model)
{
string sql = string.Format("insert into Sys_operate_log([title],[method],[operate_url],[operate_param],[json_result],[status],[error_msg],[addtime]) " +
"values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}' )",
model.title, model.method, model.operate_url, model.operate_param, model.json_result, model.status, model.error_msg, model.addtime);
long x = db.UpdateSql(sql);
if (x > 0)
{
return true;
}
else
{
LogHelper.WriteLogInfo("添加日志失败" + sql);
return false;
}
}
#endregion
}
}

174
Epost.Model/AgvReqModel.cs Normal file
View File

@ -0,0 +1,174 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.Model
{
#region
public class AgvSchedulingTaskModel
{
public string reqCode { get; set; }
public string reqTime { get; set; }
public string clientCode { get; set; }
public string tokenCode { get; set; }
public string taskTyp { get; set; }
public string ctnrTyp { get; set; }
public string ctnrCode { get; set; }
public string ctnrNum { get; set; }
public string taskMode { get; set; }
public string wbCode { get; set; }
public List<Positioncodepath> positionCodePath { get; set; }
public string podCode { get; set; }
public string podDir { get; set; }
public string podTyp { get; set; }
public string materialLot { get; set; }
public string materialType { get; set; }
public string priority { get; set; }
public string agvCode { get; set; }
public string taskCode { get; set; }
public string groupId { get; set; }
public string agvTyp { get; set; }
public string positionSelStrategy { get; set; }
public string data { get; set; }
}
public class Positioncodepath
{
public string positionCode { get; set; }
public string type { get; set; }
}
public class AgvResultModel
{
public string code { get; set; }
public string data { get; set; }
public string message { get; set; }
public string reqCode { get; set; }
}
#endregion
#region
public class cancelTaskModel
{
public string reqCode { get; set; }
public string reqTime { get; set; }
public string clientCode { get; set; }
public string tokenCode { get; set; }
public string forceCancel { get; set; }
public string matterArea { get; set; }
public string agvCode { get; set; }
public string taskCode { get; set; }
}
#endregion
#region
public class agvCallbackModel
{
public string action { get; set; }
public string areaCode { get; set; }
public string berthCode { get; set; }
public string callCode { get; set; }
public string callTyp { get; set; }
public string clientCode { get; set; }
public float cooX { get; set; }
public float cooY { get; set; }
public string ctnrCode { get; set; }
public string ctnrTyp { get; set; }
public string currentCallCode { get; set; }
public string currentPositionCode { get; set; }
public Data data { get; set; }
public string dstBinCode { get; set; }
public string eqpCode { get; set; }
public string indBind { get; set; }
public string layer { get; set; }
public string mapCode { get; set; }
public string mapDataCode { get; set; }
public string mapShortName { get; set; }
public string materialLot { get; set; }
public string materialType { get; set; }
public string method { get; set; }
public string orgCode { get; set; }
public string podCode { get; set; }
public string podDir { get; set; }
public string podNum { get; set; }
public string podTyp { get; set; }
public string relatedArea { get; set; }
public string reqCode { get; set; }
public string reqTime { get; set; }
public string roadWayCode { get; set; }
public string robotCode { get; set; }
public string seq { get; set; }
public string stgBinCode { get; set; }
public string subTaskNum { get; set; }
public string taskCode { get; set; }
public string taskTyp { get; set; }
public string tokenCode { get; set; }
public string username { get; set; }
public string wbCode { get; set; }
public string whCode { get; set; }
}
public class Data
{
}
#endregion
#region
public class bindCtnrAndBinReq
{
public string reqCode { get; set; }
public string reqTime { get; set; }
public string clientCode { get; set; }
public string tokenCode { get; set; }
public string ctnrCode { get; set; }
public string ctnrTyp { get; set; }
public string stgBinCode { get; set; }
public string positionCode { get; set; }
public string indBind { get; set; }
}
public class bindCtnrAndBinResponse
{
public string code { get; set; }
public string data { get; set; }
public bool interrupt { get; set; }
public string reqCode { get; set; }
}
#endregion
#region
public class warnCallbackReq
{
public string reqCode { get; set; }
public string reqTime { get; set; }
public string clientCode { get; set; }
public string tokenCode { get; set; }
public List<warnCallbackData> data { get; set; }
}
public class warnCallbackData
{
public string robotCode { get; set; }
public string beginDate { get; set; }
public string warnContent { get; set; }
public string taskCode { get; set; }
}
#endregion
}

View File

@ -84,6 +84,7 @@
<Compile Include="Addresssage\AddressList.cs" />
<Compile Include="AddressstorageModel.cs" />
<Compile Include="AddressViewModel.cs" />
<Compile Include="AgvReqModel.cs" />
<Compile Include="Base.cs" />
<Compile Include="BoxModel.cs" />
<Compile Include="BoxPickModel.cs" />
@ -97,6 +98,7 @@
<Compile Include="ErrorLogModel.cs" />
<Compile Include="ErrorLogViewModel.cs" />
<Compile Include="HistoryDataModel.cs" />
<Compile Include="InboundOrdersModel.cs" />
<Compile Include="JobModel.cs" />
<Compile Include="LabelModel.cs" />
<Compile Include="LabelParamModel.cs" />
@ -114,6 +116,7 @@
<Compile Include="OrderRepModel.cs" />
<Compile Include="OrderReportModel.cs" />
<Compile Include="OrdersModel.cs" />
<Compile Include="PalletinfoModel.cs" />
<Compile Include="ParameterModel.cs" />
<Compile Include="PressureTestModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -132,6 +135,8 @@
<Compile Include="OrdersQueueModel.cs" />
<Compile Include="ShowMessageModel_M.cs" />
<Compile Include="StoreModel.cs" />
<Compile Include="Sys_operate_logModel.cs" />
<Compile Include="TaskModel.cs" />
<Compile Include="UserCodeModel.cs" />
<Compile Include="UserLoginModel.cs" />
<Compile Include="UserModel.cs" />

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.Model
{
public class InboundOrdersModel : Base
{
int _id = 0;
string _wmsDocNo = string.Empty;
string _groupTaskId = string.Empty;
string _palletId = string.Empty;
string _spositionCode = string.Empty;
string _dpositionCode = string.Empty;
string _priority = string.Empty;
string _taskType = string.Empty;
string _userId = string.Empty;
string _userName = string.Empty;
string _notes = string.Empty;
string _warehouseId = string.Empty;
int _state;
private Nullable<DateTime> _addtime;
private Nullable<DateTime> _endtime;
private Nullable<DateTime> _operationtime;
public int id { get => _id; set => _id = value; }
public string wmsDocNo { get => _wmsDocNo; set => _wmsDocNo = value; }
public string groupTaskId { get => _groupTaskId; set => _groupTaskId = value; }
public string palletId { get => _palletId; set => _palletId = value; }
public string spositionCode { get => _spositionCode; set => _spositionCode = value; }
public string dpositionCode { get => _dpositionCode; set => _dpositionCode = value; }
public string priority { get => _priority; set => _priority = value; }
public string taskType { get => _taskType; set => _taskType = value; }
public string userId { get => _userId; set => _userId = value; }
public string userName { get => _userName; set => _userName = value; }
public string notes { get => _notes; set => _notes = value; }
public string warehouseId { get => _warehouseId; set => _warehouseId = value; }
public int state { get => _state; set => _state = value; }
public DateTime? addtime { get => _addtime; set => _addtime = value; }
public DateTime? endtime { get => _endtime; set => _endtime = value; }
public DateTime? operationtime { get => _operationtime; set => _operationtime = value; }
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.Model
{
public class PalletinfoModel : Base
{
int _id = 0;
string _wmsDocNo = string.Empty;
string _groupTaskId = string.Empty;
string _palletId = string.Empty;
string _sku = string.Empty;
string _skuDescr1 = string.Empty;
string _qty = string.Empty;
string _lotatt01 = string.Empty;
string _lotatt02 = string.Empty;
string _lotatt04 = string.Empty;
string _lotatt07 = string.Empty;
string _lotatt08 = string.Empty;
string _notes = string.Empty;
string _taskType = string.Empty;
private Nullable<DateTime> _addtime;
private Nullable<DateTime> _endtime;
public int id { get => _id; set => _id = value; }
public string wmsDocNo { get => _wmsDocNo; set => _wmsDocNo = value; }
public string groupTaskId { get => _groupTaskId; set => _groupTaskId = value; }
public string palletId { get => _palletId; set => _palletId = value; }
public string sku { get => _sku; set => _sku = value; }
public string skuDescr1 { get => _skuDescr1; set => _skuDescr1 = value; }
public string qty { get => _qty; set => _qty = value; }
public string lotatt01 { get => _lotatt01; set => _lotatt01 = value; }
public string lotatt02 { get => _lotatt02; set => _lotatt02 = value; }
public string lotatt04 { get => _lotatt04; set => _lotatt04 = value; }
public string lotatt07 { get => _lotatt07; set => _lotatt07 = value; }
public string lotatt08 { get => _lotatt08; set => _lotatt08 = value; }
public string notes { get => _notes; set => _notes = value; }
public string taskType { get => _taskType; set => _taskType = value; }
public DateTime? addtime { get => _addtime; set => _addtime = value; }
public DateTime? endtime { get => _endtime; set => _endtime = value; }
}
}

View File

@ -37,4 +37,10 @@ namespace Epost.Model
}
}
}
public class BatchModel {
string _batchno = string.Empty;
public string batchno { get => _batchno; set => _batchno = value; }
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.Model
{
public class Sys_operate_logModel : Base
{
private int _id = 0;
private string _title = string.Empty;
private string _method = string.Empty;
private string _operate_url = string.Empty;
private string _operate_param = string.Empty;
private string _json_result = string.Empty;
private int _status = 0;
private string _error_msg = string.Empty;
private Nullable<DateTime> _addtime;
private Nullable<DateTime> _endtime;
public int id { get => _id; set => _id = value; }
public string title { get => _title; set => _title = value; }
public string method { get => _method; set => _method = value; }
public string operate_url { get => _operate_url; set => _operate_url = value; }
public string operate_param { get => _operate_param; set => _operate_param = value; }
public string json_result { get => _json_result; set => _json_result = value; }
public int status { get => _status; set => _status = value; }
public string error_msg { get => _error_msg; set => _error_msg = value; }
public DateTime? addtime { get => _addtime; set => _addtime = value; }
public DateTime? endtime { get => _endtime; set => _endtime = value; }
}
}

220
Epost.Model/TaskModel.cs Normal file
View File

@ -0,0 +1,220 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Epost.Model
{
#region
#endregion
public class TaskModel
{
public TaskData data { get; set; }
}
public class TaskData
{
public List<TaskHeader> header { get; set; }
}
public class TaskHeader
{
public string warehouseId { get; set; }
public string wmsDocNo { get; set; }
public string priority { get; set; }
public string taskType { get; set; }
public string userId { get; set; }
public string userName { get; set; }
public string notes { get; set; }
public string udf01 { get; set; }
public string udf02 { get; set; }
public string udf03 { get; set; }
public string udf04 { get; set; }
public string udf05 { get; set; }
public string udf06 { get; set; }
public List<TaskDetail> details { get; set; }
public List<TaskDetails2> details2 { get; set; }
}
public class TaskDetail
{
public string groupTaskId { get; set; }
public string palletId { get; set; }
public string spositionCode { get; set; }
public string dpositionCode { get; set; }
public string notes { get; set; }
public string udf01 { get; set; }
public string udf02 { get; set; }
public string udf03 { get; set; }
public string udf04 { get; set; }
public string udf05 { get; set; }
public string udf06 { get; set; }
}
public class TaskDetails2
{
public string groupTaskId { get; set; }
public string palletId { get; set; }
public string sku { get; set; }
public string skuDescr1 { get; set; }
public string qty { get; set; }
public string lotatt01 { get; set; }
public string lotatt02 { get; set; }
public string lotatt04 { get; set; }
public string lotatt07 { get; set; }
public string lotatt08 { get; set; }
public string notes { get; set; }
public string udf01 { get; set; }
public string udf02 { get; set; }
public string udf03 { get; set; }
public string udf04 { get; set; }
public string udf05 { get; set; }
public string udf06 { get; set; }
}
#region
public class RetMesModel
{
public ResponseModel Response { get; set; }
}
public class ResponseModel
{
public ReturnRes returnnode { get; set; }
}
public class ReturnRes
{
public string returnCode { get; set; }
public string returnDesc { get; set; }
public string returnFlag { get; set; }
}
#endregion
#region
public class AgvCancleModel
{
public CancleData data { get; set; }
}
public class CancleData
{
public List<CancleHeader> header { get; set; }
}
public class CancleHeader
{
public string warehouseId { get; set; }
public string groupTaskId { get; set; }
public string palletId { get; set; }
public string userId { get; set; }
public string userName { get; set; }
public string notes { get; set; }
public string reason { get; set; }
public string udf01 { get; set; }
public string udf02 { get; set; }
public string udf03 { get; set; }
public string udf04 { get; set; }
public string udf05 { get; set; }
public string udf06 { get; set; }
}
#endregion
#region
public class agvBindPodModel
{
public agvBindData data { get; set; }
}
public class agvBindData
{
public List<agvBindHeader> header { get; set; }
}
public class agvBindHeader
{
public string warehouseId { get; set; }
public string indBind { get; set; }
public string palletId { get; set; }
public string positionCode { get; set; }
public string userId { get; set; }
public string userName { get; set; }
public string notes { get; set; }
public string udf01 { get; set; }
public string udf02 { get; set; }
public string udf03 { get; set; }
public string udf04 { get; set; }
public string udf05 { get; set; }
public string udf06 { get; set; }
}
#endregion
#region
public class wmsCallbackModel
{
public callback data { get; set; }
}
public class callback
{
public List<callbackHeader> header { get; set; }
}
public class callbackHeader
{
public string warehouseId { get; set; }
public string groupTaskId { get; set; }
public string wmsDocNo { get; set; }
public string reqCode { get; set; }
public string reqTime { get; set; }
public string method { get; set; }
public string currentPositionCode { get; set; }
public string robotCode { get; set; }
public string taskCode { get; set; }
}
#endregion
#region
public class agvexTaskReq
{
public agvexTaskData data { get; set; }
}
public class agvexTaskData
{
public List<agvexTaskHeader> header { get; set; }
}
public class agvexTaskHeader
{
public string reqCode { get; set; }
public string reqTime { get; set; }
public string clientCode { get; set; }
public string tokenCode { get; set; }
public string notes { get; set; }
public List<agvexTaskList> list { get; set; }
}
public class agvexTaskList
{
public string robotCode { get; set; }
public string taskCode { get; set; }
public string beginDate { get; set; }
public string warnContent { get; set; }
}
#endregion
}

View File

@ -9,6 +9,7 @@ using Epost.Common;
using System.Web.Helpers;
using System.Data;
using System.Configuration;
using System.Web;
namespace Epost.TestToolsWeb.Tests.Controllers
{
@ -19,14 +20,10 @@ namespace Epost.TestToolsWeb.Tests.Controllers
[TestMethod]
public void d()
{
string sku = "211100";
if (sku.Substring(0, 1) == "2" && sku.Substring(1, 1) != "5")
{
if (sku.Length >= 7)
{
sku = sku.Substring(1, 6);
}
}
string ss = "12345678test12345678";
string md= EncryptHelper.EncryptMD5By32(ss);
string b64= EncryptHelper.Base64EnCode(md).ToUpper();
string ddd = HttpUtility.UrlEncode(b64);
}
}
}

View File

@ -0,0 +1,183 @@
using Epost.BLL;
using Epost.Common;
using Epost.DAL.Cache;
using Epost.Model;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Helpers;
using System.Web.Http;
using static System.Net.WebRequestMethods;
namespace Epost.DPS.Controllers
{
[RoutePrefix("service/rest/agvCallbackService")]//agv=>WCS
public class AgvTaskApiController : ApiController
{
Sys_operate_logBLL logBLL = new Sys_operate_logBLL();
InboundOrdersBLL inboundBLL = new InboundOrdersBLL();
string agvCallbackUrl = ConfigurationManager.AppSettings["agvCallbackUrl"];
string agvexTaskUrl = ConfigurationManager.AppSettings["agvexTaskUrl"];
HttpHelper http = new HttpHelper();
AgvHelper agv = new AgvHelper();
AgvLogInfoBLL logbll = new AgvLogInfoBLL();
[Route("agvCallback")]
[HttpPost]
public AgvResultModel agvCallback([FromBody] agvCallbackModel data)
{
AgvResultModel retModel = new AgvResultModel();
try
{
LogHelper.WriteLogInfo("agvCallback请求报文" + JsonHelper.SerializeObject(data));
string state = string.Empty;
if (data.method == "start")
{
state = "2";//任务开始启动
}
else if (data.method == "outbin")
{
state = "3";//走出储位
}
else if (data.method == "end")
{
state = "4";
//更新任务已完成
wms_callback(data);
}
else if (data.method == "cancel")
{
state = "88";
wms_callback(data);
}
else { }
inboundBLL.UpInOrderListByAgvid(data.taskCode, state);
retModel.message = "成功!";
retModel.code = "0";
retModel.reqCode = data.reqCode;
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("agvCallback异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
retModel.message = "请求接口异常!";
retModel.code = "-1";
retModel.reqCode = data.reqCode;
}
string resinfo = JsonHelper.SerializeObject(retModel);
logBLL.InsertLog("AGV上报WCS", "agvCallback", "/api/AgvTaskApi/agvCallback", JsonHelper.SerializeObject(data), resinfo, 0, "", DateTime.Now);
return retModel;
}
public void wms_callback(agvCallbackModel data)
{
DataTable dt = inboundBLL.GetInOrderList(" and agvid ='" + data.taskCode + "'");
if (dt != null && dt.Rows.Count > 0)
{
wmsCallbackModel backModel = new wmsCallbackModel();
List<callbackHeader> list = new List<callbackHeader>();
callbackHeader headModel = new callbackHeader();
headModel.warehouseId = dt.Rows[0]["warehouseId"].ToString();
headModel.groupTaskId = dt.Rows[0]["groupTaskId"].ToString();
headModel.wmsDocNo = dt.Rows[0]["wmsDocNo"].ToString();
headModel.currentPositionCode = data.currentPositionCode;
headModel.robotCode = data.robotCode;
headModel.taskCode = data.taskCode;
headModel.method = data.method;
headModel.reqCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
headModel.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
callback back = new callback();
list.Add(headModel);
back.header = list;
backModel.data = back;
string reqstr = JsonHelper.SerializeObject(backModel);
LogHelper.WriteLogInfo("WCS->WMS任务执行通知请求" + reqstr + "===" + agvCallbackUrl);
string resultStr = http.HttpPost_Old(agvCallbackUrl, reqstr);
LogHelper.WriteLogInfo("WCS->WMS任务执行通知返回" + resultStr);
logBLL.InsertLog("WCS->WMS任务执行通知", "agvCallback", agvCallbackUrl, reqstr, resultStr, 0, "", DateTime.Now);
}
}
[Route("warnCallback")]
[HttpPost]
public AgvResultModel warnCallback([FromBody]warnCallbackReq data)
{
AgvResultModel retModel = new AgvResultModel();
try
{
LogHelper.WriteLogInfo("warnCallback请求报文" + JsonHelper.SerializeObject(data));
//DataTable dt = inboundBLL.GetInOrderList(" and agvid ='" + data.taskCode + "'");
//if (dt != null && dt.Rows.Count > 0)
//{
agvexTaskReq backModel = new agvexTaskReq();
agvexTaskData taskdata = new agvexTaskData();
List<agvexTaskList> taskList = new List<agvexTaskList>();
agvexTaskHeader agvexHeader = new agvexTaskHeader();
List<agvexTaskHeader> headerlist = new List<agvexTaskHeader>();
List<warnCallbackData> datalist = data.data;
string reqcode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
bool istrue = true;
if (datalist.Any())
{
foreach (warnCallbackData item in datalist)
{
agvexTaskList agvextmodel = new agvexTaskList();
agvextmodel.robotCode = item.robotCode;
agvextmodel.taskCode = item.taskCode;
agvextmodel.beginDate = item.beginDate;
agvextmodel.warnContent = item.warnContent;
taskList.Add(agvextmodel);
DataTable logdt= logbll.getAgvLogList(" and robotCode='"+ item.robotCode + "' and warnContent='"+ item.warnContent + "' and addtime>dateadd(minute,-10,GETDATE())");
if (logdt != null && logdt.Rows.Count > 0)
{
istrue = false;
}
else {
logbll.insertAgvLogInfo(reqcode, item.beginDate, item.robotCode, item.beginDate, item.warnContent, item.taskCode);
}
}
}
if (istrue) {
agvexHeader.list = taskList;
agvexHeader.clientCode = data.clientCode;
agvexHeader.reqCode = reqcode;
agvexHeader.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headerlist.Add(agvexHeader);
taskdata.header = headerlist;
backModel.data = taskdata;
string reqstr = JsonHelper.SerializeObject(backModel);
LogHelper.WriteLogInfo("WCS->WMS告警通知请求" + reqstr + "===" + agvexTaskUrl);
string resultStr = http.HttpPost_Old(agvexTaskUrl, reqstr);
LogHelper.WriteLogInfo("WCS->WMS告警通知返回" + resultStr);
logBLL.InsertLog("WCS->WMS告警通知", "warnCallback", agvexTaskUrl, reqstr, resultStr, 0, "", DateTime.Now);
// }
}
retModel.message = "成功!";
retModel.code = "0";
retModel.reqCode = data.reqCode;
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("agvPutTask异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
retModel.message = "请求接口异常!";
retModel.code = "-1";
retModel.reqCode = data.reqCode;
}
string resinfo = JsonHelper.SerializeObject(retModel);
logBLL.InsertLog("AGV上报WCS", "agvCallback", "/api/AgvTaskApi/agvCallback", JsonHelper.SerializeObject(data), resinfo, 0, "", DateTime.Now);
return retModel;
}
}
}

View File

@ -47,91 +47,5 @@ namespace Epost.TestToolsWeb.Controllers
return View();
}
#region
public ActionResult ClearALL()
{
bool result = false;
isShow = true;
try
{
ResultModel resultModel = contrbll.ClearALL();
return Json(new { Success = resultModel.result, Message = resultModel.msg });
}
catch (Exception)
{
return Json(new { Success = result, Message = "失败" });
}
}
#endregion
#region
public ActionResult StartWork()
{
isShow = true;
contrbll.StartWork();
isWork = 1;
return Json(new { Success = true, Message = "成功" });
}
#endregion
#region
public ActionResult TestStart()
{
ResultModel result = contrbll.TestStart();
if (result.result == "1")
{
return Json(new { Success = result, Message = result.msg });
}
else
{
return Json(new { Success = result, Message = result.msg });
}
}
#endregion
#region
public ActionResult TestEnd()
{
contrbll.TestEnd();
return Json(new { Success = true, Message = "成功" });
}
#endregion
#region
public ActionResult EndWork()
{
try
{
isShow = false;
isWork = 0;
isClear = 0;
contrbll.EndWork();
return Json(new { Success = true, Message = "成功" });
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("结束作业异常" + ex.Message);
return Json(new { Success = false, Message = "失败" });
}
}
#endregion
}
}

View File

@ -104,21 +104,21 @@ namespace Epost.DPS.Controllers
#region
[Route("TestStart")]
[HttpPost]
public ResultModel TestStart()
public ResultModel TestStart(BatchModel model)
{
lock (lockinit)
{
ResultModel res = new ResultModel();
try
{
ResultModel result = contrbll.TestStart();
ResultModel result = contrbll.TestStart(model.batchno);
return result;
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("GetDataList异常" + ex.Message);
LogHelper.WriteLogInfo("TestStart异常" + ex.Message);
res.msg = "请求异常!";
res.result = "-1";
return res;

View File

@ -0,0 +1,370 @@
using Epost.BLL;
using Epost.Common;
using Epost.Model;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using static System.Net.WebRequestMethods;
namespace Epost.DPS.Controllers
{
[RoutePrefix("api/TaskAPI")]//WMS=>WCS
public class TaskAPIController : ApiController
{
InboundOrdersBLL inOrderBLL = new InboundOrdersBLL();
PalletinfoBLL palletBLL = new PalletinfoBLL();
Sys_operate_logBLL logBLL = new Sys_operate_logBLL();
HttpHelper http = new HttpHelper();
AgvHelper agv = new AgvHelper();
string bindCtnrAndBinUrl = ConfigurationManager.AppSettings["bindCtnrAndBinUrl"];
[Route("agvPutTask")]//WMS=>WCS生成任务接口
[HttpPost]
public RetMesModel agvPutTask([FromBody] TaskModel model)
{
RetMesModel retMes = new RetMesModel();
ResponseModel response = new ResponseModel();
ReturnRes res = new ReturnRes();
try
{
LogHelper.WriteLogInfo("请求报文" + JsonHelper.SerializeObject(model));
if (model.data.header.Any())
{
foreach (TaskHeader item in model.data.header)
{
if (string.IsNullOrEmpty(item.wmsDocNo) || string.IsNullOrEmpty(item.taskType))
{
res.returnDesc = "请求参数错误!";
res.returnCode = "0001";
res.returnFlag = "0";
}
else
{
DataTable orderdt = inOrderBLL.GetOrdersList(item.wmsDocNo);
if (orderdt != null && orderdt.Rows.Count > 0)
{
res.returnDesc = "订单已存在!";
res.returnCode = "0001";
res.returnFlag = "0";
}
else
{
#region datatable创建
DataTable dataTable = new DataTable();
dataTable.TableName = "InboundOrders";
dataTable.Columns.Add(new DataColumn("wmsDocNo", typeof(string)));
dataTable.Columns.Add(new DataColumn("groupTaskId", typeof(string)));
dataTable.Columns.Add(new DataColumn("palletId", typeof(string)));
dataTable.Columns.Add(new DataColumn("spositionCode", typeof(string)));
dataTable.Columns.Add(new DataColumn("dpositionCode", typeof(string)));
dataTable.Columns.Add(new DataColumn("priority", typeof(string)));
dataTable.Columns.Add(new DataColumn("taskType", typeof(string)));
dataTable.Columns.Add(new DataColumn("userId", typeof(string)));
dataTable.Columns.Add(new DataColumn("userName", typeof(string)));
dataTable.Columns.Add(new DataColumn("notes", typeof(string)));
dataTable.Columns.Add(new DataColumn("warehouseId", typeof(string)));
dataTable.Columns.Add(new DataColumn("addtime", typeof(DateTime)));
dataTable.Columns.Add(new DataColumn("state", typeof(int)));
#endregion
if (item.details.Any())
{
foreach (TaskDetail detail in item.details)
{
#region datatable
DataRow dataRow = dataTable.NewRow();
dataRow["wmsDocNo"] = item.wmsDocNo;
dataRow["groupTaskId"] = detail.groupTaskId;
dataRow["palletId"] = detail.palletId;
dataRow["spositionCode"] = detail.spositionCode;
dataRow["dpositionCode"] = detail.dpositionCode;
dataRow["priority"] = item.priority;
dataRow["taskType"] = item.taskType;
dataRow["userId"] = item.userId;
dataRow["userName"] = item.userName;
dataRow["notes"] = detail.notes;
dataRow["warehouseId"] = item.warehouseId;
dataRow["addtime"] = DateTime.Now.ToString();
dataRow["state"] = "0";
dataTable.Rows.Add(dataRow);
#endregion
}
}
#region Dictionary
Dictionary<string, string> diclist = new Dictionary<string, string>();
diclist.Add("wmsDocNo", "wmsDocNo");
diclist.Add("groupTaskId", "groupTaskId");
diclist.Add("palletId", "palletId");
diclist.Add("spositionCode", "spositionCode");
diclist.Add("dpositionCode", "dpositionCode");
diclist.Add("priority", "priority");
diclist.Add("taskType", "taskType");
diclist.Add("userId", "userId");
diclist.Add("userName", "userName");
diclist.Add("notes", "notes");
diclist.Add("warehouseId", "warehouseId");
diclist.Add("addtime", "addtime");
diclist.Add("state", "state");
#endregion
bool bo = inOrderBLL.InsertOrder(dataTable, diclist);
if (bo)
{
//添加托盘明细
InsertPallet(item);
res.returnCode = "0000";
res.returnDesc = "成功!";
res.returnFlag = "1";
}
else
{
res.returnCode = "0001";
res.returnDesc = "请求失败,请重试!";
res.returnFlag = "0";
}
}
}
}
}
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("agvPutTask异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
res.returnDesc = "请求接口异常!";
res.returnCode = "0001";
res.returnFlag = "0";
}
response.returnnode = res;
retMes.Response = response;
string resinfo = JsonHelper.SerializeObject(retMes) ;
logBLL.InsertLog("生成任务单", "agvPutTask", "/api/TaskAPI/agvPutTask", JsonHelper.SerializeObject(model), resinfo, 0, res.returnDesc, DateTime.Now);
return retMes;
}
#region
public bool InsertPallet(TaskHeader item)
{
try
{
#region datatable创建
DataTable dataTable2 = new DataTable();
dataTable2.TableName = "Palletinfo";
dataTable2.Columns.Add(new DataColumn("wmsDocNo", typeof(string)));
dataTable2.Columns.Add(new DataColumn("groupTaskId", typeof(string)));
dataTable2.Columns.Add(new DataColumn("palletId", typeof(string)));
dataTable2.Columns.Add(new DataColumn("sku", typeof(string)));
dataTable2.Columns.Add(new DataColumn("skuDescr1", typeof(string)));
dataTable2.Columns.Add(new DataColumn("qty", typeof(string)));
dataTable2.Columns.Add(new DataColumn("taskType", typeof(string)));
dataTable2.Columns.Add(new DataColumn("notes", typeof(string)));
dataTable2.Columns.Add(new DataColumn("addtime", typeof(DateTime)));
#endregion
if (item.details2.Any())
{
foreach (TaskDetails2 detail in item.details2)
{
#region datatable
DataRow dataRow1 = dataTable2.NewRow();
dataRow1["wmsDocNo"] = item.wmsDocNo;
dataRow1["groupTaskId"] = detail.groupTaskId;
dataRow1["palletId"] = detail.palletId;
dataRow1["sku"] = detail.sku;
dataRow1["skuDescr1"] = detail.skuDescr1;
dataRow1["qty"] = detail.qty;
dataRow1["notes"] = item.notes;
dataRow1["taskType"] = item.taskType;
dataRow1["addtime"] = DateTime.Now.ToString();
dataTable2.Rows.Add(dataRow1);
#endregion
}
}
#region Dictionary
Dictionary<string, string> diclist1 = new Dictionary<string, string>();
diclist1.Add("wmsDocNo", "wmsDocNo");
diclist1.Add("groupTaskId", "groupTaskId");
diclist1.Add("palletId", "palletId");
diclist1.Add("sku", "sku");
diclist1.Add("skuDescr1", "skuDescr1");
diclist1.Add("qty", "qty");
diclist1.Add("notes", "notes");
diclist1.Add("taskType", "taskType");
diclist1.Add("addtime", "addtime");
#endregion
bool bo = palletBLL.InsertPallet(dataTable2, diclist1);
LogHelper.WriteLogInfo(item.wmsDocNo + "添加托盘明细:" + bo);
return true;
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("添加托盘明细异常:" + ex.ToString(), LogHelper.Log_Type.ERROR);
return false;
}
}
#endregion
[Route("agvCancleTask")]//WMS=>WCS取消任务
[HttpPost]
public RetMesModel agvCancleTask([FromBody]AgvCancleModel model)
{
RetMesModel retMes = new RetMesModel();
ResponseModel response = new ResponseModel();
ReturnRes res = new ReturnRes();
try
{
LogHelper.WriteLogInfo("agvCancleTask请求报文" + JsonHelper.SerializeObject(model));
if (model.data.header.Any())
{
foreach (CancleHeader item in model.data.header)
{
if (string.IsNullOrEmpty(item.groupTaskId) || string.IsNullOrEmpty(item.palletId))
{
res.returnDesc = "请求参数错误!";
res.returnCode = "0001";
res.returnFlag = "0";
}
else
{
DataTable orderdt = inOrderBLL.GetInOrderList(" and groupTaskId='"+item.groupTaskId+ "' and palletId='"+ item.palletId + "' and state=0");
if (orderdt != null && orderdt.Rows.Count > 0)
{
bool bo= inOrderBLL.UpInOrderList(orderdt.Rows[0]["id"].ToString(), "88", "");
if (bo)
{
res.returnCode = "0000";
res.returnDesc = "成功!";
res.returnFlag = "1";
}
else {
res.returnCode = "0001";
res.returnDesc = "取消失败!!";
res.returnFlag = "0";
}
}
else {
res.returnDesc = "订单不存在/订单已执行!";
res.returnCode = "0001";
res.returnFlag = "0";
}
}
}
}
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("agvCancleTask异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
res.returnDesc = "请求接口异常!";
res.returnCode = "0001";
res.returnFlag = "0";
}
response.returnnode = res;
retMes.Response = response;
string resinfo = JsonHelper.SerializeObject(retMes) ;
logBLL.InsertLog("WMS=>WCS取消任务接口", "agvCancleTask", "/api/TaskAPI/agvCancleTask", JsonHelper.SerializeObject(model), resinfo, 0, res.returnDesc, DateTime.Now);
return retMes;
}
[Route("agvBindPodAndBerth")]//WMS=>WCS绑定解绑
[HttpPost]
public RetMesModel agvBindPodAndBerth([FromBody] agvBindPodModel model)
{
RetMesModel retMes = new RetMesModel();
ResponseModel response = new ResponseModel();
ReturnRes res = new ReturnRes();
try
{
LogHelper.WriteLogInfo("请求报文" + JsonHelper.SerializeObject(model));
if (model.data.header.Any())
{
foreach (agvBindHeader item in model.data.header)
{
if (string.IsNullOrEmpty(item.indBind) || string.IsNullOrEmpty(item.palletId) || string.IsNullOrEmpty(item.positionCode))
{
res.returnDesc = "请求参数错误!";
res.returnCode = "0001";
res.returnFlag = "0";
}
else
{
bindCtnrAndBinReq reqModel = new bindCtnrAndBinReq();
reqModel.reqCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
reqModel.ctnrTyp = "1";//agv提供
reqModel.indBind = item.indBind;
string type = string.Empty;
string agvloc = inOrderBLL.GetLocation(" and wmsloc = '" + item.positionCode + "'",out type );
reqModel.stgBinCode = agvloc;
if (item.indBind == "1")
{
reqModel.ctnrCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
}
string reqstr = JsonHelper.SerializeObject(reqModel);
string resultStr = http.HttpPost_Old(bindCtnrAndBinUrl, reqstr);
//string resultStr = "{\"code\":\"0\",\"data\":\"\",\"interrupt\":false,\"reqCode\":\"66ee6\"}";
logBLL.InsertLog("WCS->AGV绑定解绑", "bindCtnrAndBin", bindCtnrAndBinUrl, reqstr, resultStr, 0, "", DateTime.Now);
if (!string.IsNullOrEmpty(resultStr))
{
bindCtnrAndBinResponse resModel = JsonHelper.DeserializeObject<bindCtnrAndBinResponse>(resultStr);
if (resModel.code == "0")
{
res.returnCode = "0000";
res.returnDesc = "绑定/解绑成功!";
res.returnFlag = "1";
}
else
{
res.returnCode = "0000";
res.returnDesc = "绑定/解绑失败!";
res.returnFlag = "1";
}
}
}
}
}
}
catch (Exception ex)
{
LogHelper.WriteLogInfo("agvBindPodAndBerth异常" + ex.ToString(), LogHelper.Log_Type.ERROR);
res.returnDesc = "请求接口异常!";
res.returnCode = "0001";
res.returnFlag = "0";
}
response.returnnode = res;
retMes.Response = response;
string resinfo = JsonHelper.SerializeObject(retMes);
logBLL.InsertLog("WMS=>WCS绑定解绑接口", "agvBindPodAndBerth", "/api/TaskAPI/agvBindPodAndBerth", JsonHelper.SerializeObject(model), resinfo, 0, res.returnDesc, DateTime.Now);
return retMes;
}
}
}

View File

@ -222,8 +222,10 @@
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\Startup.Auth.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\AgvTaskApiController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ServerController.cs" />
<Compile Include="Controllers\TaskAPIController.cs" />
<Compile Include="Controllers\WebAPIController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>

View File

@ -10,7 +10,7 @@
<WebStackScaffolding_LayoutPageFile>~/Views/Shared/_EpostLayoutPage.cshtml</WebStackScaffolding_LayoutPageFile>
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<WebStackScaffolding_ViewDialogWidth>600</WebStackScaffolding_ViewDialogWidth>
<NameOfLastUsedPublishProfile>E:\WORK\代码管理\播种\T系列分支\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>E:\WORK\代码管理\T系列\播种\Epost.TestToolsWeb\Properties\PublishProfiles\Toolsweb.pubxml</NameOfLastUsedPublishProfile>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress />
<IISExpressSSLPort />
@ -19,7 +19,7 @@
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
<Controller_SelectedScaffolderCategoryPath>root/Common/Web API</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>

View File

@ -1,7 +1,10 @@
using Epost.Common;
using Epost.BLL;
using Epost.Common;
using Epost.Model;
using Epost.TestToolsWeb.App_Start;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
@ -12,11 +15,14 @@ using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.WebSockets;
namespace Epost.TestToolsWeb
{
public class MvcApplication : System.Web.HttpApplication
{
InboundOrdersBLL inboundBLL = new InboundOrdersBLL();
AgvHelper agv = new AgvHelper();
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
@ -25,12 +31,65 @@ namespace Epost.TestToolsWeb
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
Time_TaskHelper.Instance().ExecuteTask += new System.Timers.ElapsedEventHandler(Global_ExecuteTask);
Time_TaskHelper.Instance().Interval = 1000 * 10;//表示间隔
Time_TaskHelper.Instance().Start();
}
void Global_ExecuteTask(object sender, System.Timers.ElapsedEventArgs e)
{
//在这里编写需要定时执行的逻辑代码
LogHelper.WriteLogInfo("任务执行中");
DataTable dt = inboundBLL.GetInOrderList(" and state =0 order by priority,id");
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow row in dt.Rows) {
AgvSchedulingTaskModel reqmodel = new AgvSchedulingTaskModel();
reqmodel.reqCode = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString()+ row["id"].ToString();;
List<Positioncodepath> positionList = new List<Positioncodepath>();
Positioncodepath pathModel = new Positioncodepath();
string type = string.Empty;
pathModel.positionCode = inboundBLL.GetLocation(" and wmsloc ='"+ row["spositionCode"].ToString() + "'",out type);
#region --
if (type == "1")
{
LogHelper.WriteLogInfo("绑定点位"+ pathModel.positionCode);
agv.bindCtnrAndBin(pathModel.positionCode, type);
}
#endregion
pathModel.type = "05";//agv提供
positionList.Add(pathModel);
Positioncodepath pathModel2 = new Positioncodepath();
pathModel2.positionCode = inboundBLL.GetLocation(" and wmsloc = '"+ row["dpositionCode"].ToString() + "'",out type );
pathModel2.type = "05";
positionList.Add(pathModel2);
reqmodel.positionCodePath = positionList;
reqmodel.taskTyp = "ZY01";//agv提供
reqmodel.ctnrTyp = "1";
AgvResultModel res= agv.genAgvSchedulingTask(reqmodel);
if (res.code == "0")
{
//调用agv成功 更新订单状态
inboundBLL.UpInOrderList(row["id"].ToString(), "1", res.data);
}
else if (res.code == "1")
{
inboundBLL.UpInOrder(row["id"].ToString(),"AGV告警"+res.message);
}
}
}
}
protected void Session_Start(object sender, EventArgs e)
{
// 在新会话启动时运行的代码
}
}
}

View File

@ -9,13 +9,13 @@
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>D:\驿传\T系列</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<publishUrl>D:\驿传\zhuyou_wcs</publishUrl>
<DeleteExistingFiles>true</DeleteExistingFiles>
<PrecompileBeforePublish>true</PrecompileBeforePublish>
<EnableUpdateable>true</EnableUpdateable>
<DebugSymbols>false</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
</PropertyGroup>
</Project>

View File

@ -6,8 +6,9 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<_PublishTargetUrl>D:\驿传\T系列</_PublishTargetUrl>
<History>True|2022-07-15T08:41:13.9750291Z;True|2022-07-14T14:02:20.7983427+08:00;True|2022-07-13T17:40:22.7531000+08:00;True|2022-07-13T17:34:22.9908701+08:00;True|2022-07-13T17:30:06.3588502+08:00;True|2022-07-11T10:32:06.9053981+08:00;True|2021-04-26T10:07:37.4889549+08:00;True|2021-04-09T10:32:51.9130162+08:00;True|2021-04-09T10:31:50.4974012+08:00;</History>
<_PublishTargetUrl>D:\驿传\zhuyou_wcs</_PublishTargetUrl>
<History>True|2024-12-25T02:39:08.4069954Z;True|2024-12-24T14:23:59.6498280+08:00;True|2024-12-12T10:38:02.5914170+08:00;True|2024-12-05T11:08:47.6560918+08:00;True|2024-12-04T09:59:41.1980682+08:00;True|2024-11-29T15:21:54.3789957+08:00;True|2024-11-29T14:43:30.2764537+08:00;True|2024-11-29T14:05:34.1608373+08:00;True|2024-11-29T13:24:48.7549546+08:00;True|2024-11-29T11:33:32.4546950+08:00;True|2024-11-26T10:08:16.7734518+08:00;True|2024-11-22T14:00:39.7806019+08:00;False|2024-11-04T17:48:25.2781696+08:00;True|2024-11-01T16:04:56.3535724+08:00;True|2024-09-01T10:13:37.1598955+08:00;True|2024-08-31T17:27:57.5375469+08:00;True|2022-07-15T16:41:13.9750291+08:00;True|2022-07-14T14:02:20.7983427+08:00;True|2022-07-13T17:40:22.7531000+08:00;True|2022-07-13T17:34:22.9908701+08:00;True|2022-07-13T17:30:06.3588502+08:00;True|2022-07-11T10:32:06.9053981+08:00;True|2021-04-26T10:07:37.4889549+08:00;True|2021-04-09T10:32:51.9130162+08:00;True|2021-04-09T10:31:50.4974012+08:00;</History>
<LastFailureDetails />
</PropertyGroup>
<ItemGroup>
<File Include="ApplicationInsights.config">
@ -32,19 +33,19 @@
<publishTime>04/04/2018 15:45:12</publishTime>
</File>
<File Include="bin/App_global.asax.compiled">
<publishTime>07/15/2022 16:57:09</publishTime>
<publishTime>12/25/2024 16:29:27</publishTime>
</File>
<File Include="bin/App_global.asax.dll">
<publishTime>07/15/2022 16:57:09</publishTime>
<publishTime>12/25/2024 16:29:27</publishTime>
</File>
<File Include="bin/BouncyCastle.Crypto.dll">
<publishTime>02/24/2020 15:29:24</publishTime>
</File>
<File Include="bin/Common.dll">
<publishTime>07/15/2022 16:40:17</publishTime>
<publishTime>12/25/2024 10:38:45</publishTime>
</File>
<File Include="bin/Common.pdb">
<publishTime>07/15/2022 16:40:17</publishTime>
<publishTime>12/25/2024 10:38:45</publishTime>
</File>
<File Include="bin/ComposerSDK.dll">
<publishTime>04/29/2020 16:50:14</publishTime>
@ -62,31 +63,31 @@
<publishTime>10/23/2017 13:15:20</publishTime>
</File>
<File Include="bin/Epost.BLL.dll">
<publishTime>07/15/2022 16:56:59</publishTime>
<publishTime>12/25/2024 10:38:46</publishTime>
</File>
<File Include="bin/Epost.BLL.pdb">
<publishTime>07/15/2022 16:56:59</publishTime>
<publishTime>12/25/2024 10:38:46</publishTime>
</File>
<File Include="bin/Epost.BLL.XmlSerializers.dll">
<publishTime>08/26/2020 18:09:48</publishTime>
</File>
<File Include="bin/Epost.DAL.dll">
<publishTime>07/15/2022 16:40:18</publishTime>
<publishTime>12/25/2024 10:38:46</publishTime>
</File>
<File Include="bin/Epost.DAL.pdb">
<publishTime>07/15/2022 16:40:18</publishTime>
<publishTime>12/25/2024 10:38:46</publishTime>
</File>
<File Include="bin/Epost.DPS.dll">
<publishTime>07/15/2022 16:57:02</publishTime>
<publishTime>12/25/2024 16:29:12</publishTime>
</File>
<File Include="bin/Epost.DPS.pdb">
<publishTime>07/15/2022 16:57:02</publishTime>
<publishTime>12/25/2024 16:29:12</publishTime>
</File>
<File Include="bin/Epost.Model.dll">
<publishTime>07/14/2022 16:43:42</publishTime>
<publishTime>12/24/2024 14:23:36</publishTime>
</File>
<File Include="bin/Epost.Model.pdb">
<publishTime>07/14/2022 16:43:42</publishTime>
<publishTime>12/24/2024 14:23:36</publishTime>
</File>
<File Include="bin/Epost.TestToolsWeb.dll">
<publishTime>09/06/2018 11:57:11</publishTime>
@ -5651,7 +5652,7 @@
<publishTime>05/30/2022 16:58:47</publishTime>
</File>
<File Include="PrecompiledApp.config">
<publishTime>07/15/2022 16:57:03</publishTime>
<publishTime>12/25/2024 16:29:13</publishTime>
</File>
<File Include="Scripts/ai.0.22.9-build00167.js">
<publishTime>04/04/2018 15:45:12</publishTime>
@ -7571,7 +7572,7 @@
<publishTime>07/04/2022 14:22:38</publishTime>
</File>
<File Include="Web.config">
<publishTime>07/12/2022 15:10:39</publishTime>
<publishTime>12/24/2024 14:23:41</publishTime>
</File>
</ItemGroup>
</Project>

View File

@ -11,7 +11,7 @@
</configSections>
<connectionStrings>
<add name="weijie_dpsEntities" connectionString="metadata=res://*/WJDB.csdl|res://*/WJDB.ssdl|res://*/WJDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=weijie_dps;user id=sa;password=123456;min pool size=4;max pool size=4;packet size=3072;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
<add name="SqlLocDPSConnection" connectionString="server=139.196.36.200;user id=EpostTest;password=antion;database=EpostTest_T;min pool size=512;max pool size=512;packet size=3072" providerName="System.Data.SqlClient" />
<add name="SqlLocDPSConnection" connectionString="server=139.196.36.200;user id=EpostTest;password=antion;database=zhuyou_wcs;min pool size=512;max pool size=512;packet size=3072" providerName="System.Data.SqlClient" />
<add name="MysqlLocDPSConnection" connectionString="Server=localhost;Port=3306;Database=world;User=root; Password=antion;SslMode=None;Pooling=true;Allow User Variables=True;" />
<add name="WMSConnection" connectionString="data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=139.196.36.200)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=EpostDB)));user id=C##Test;password=test" />
@ -27,12 +27,21 @@
<add key="ControlXML" value="/App_Data/EpostController.xml" />
<add key="LabelXML" value="/App_Data/AddressStorage.xml" />
<add key="ResultsXML" value="/App_Data/Results.xml" />
<add key="WebAPIUrl" value="http://192.168.3.65:8051/api/WebAPI/ProcessingResult"/>
<add key="WebAPIUrl" value="http://192.168.0.20:8045/api/WebAPI/ProcessingResult"/>
<add key="ShowMode" value="1" />
<add key="SetupMode" value="\Epost_P\Epost.TestToolsWeb\App_Data\SetupMode.txt" />
<add key="CARID" value="HT01" />
<add key="ServerAPIURL" value="http://192.168.3.65:8051/api/WebAPI" />
<add key="ServerAPIURL" value="http://192.168.0.20:8045/api/WebAPI" />
<add key="SleepTime" value="1" />
<add key="agvSchedulingTaskUrl" value="http://172.18.26.26:8182/rcms/services/rest/hikRpcService/genAgvSchedulingTask" />
<!--wcs->agv绑定解绑-->
<add key="bindCtnrAndBinUrl" value="http://172.18.26.26:8182/rcms/services/rest/hikRpcService/bindCtnrAndBin" />
<!--wcs->wms任务执行通知-->
<add key="agvCallbackUrl" value="http://172.18.26.30:18080/datahubjson/ZYZY_AGV/?method=agvCallback" />
<!--wcs->wms告警-->
<add key="agvexTaskUrl" value="http://172.18.26.30:18080/datahubjson/ZYZY_AGV/?method=agvexTask" />
</appSettings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。