2023-01-13 15:30:20 +08:00
|
|
|
|
using ComposerSDK;
|
|
|
|
|
using Epost.BLL;
|
|
|
|
|
using Epost.Common;
|
2025-06-26 10:21:15 +08:00
|
|
|
|
using Epost.DAL;
|
2023-01-13 15:30:20 +08:00
|
|
|
|
using Epost.DAL.Cache;
|
|
|
|
|
using Epost.DAL.Enum;
|
|
|
|
|
using Epost.DPS.Controllers;
|
|
|
|
|
using Epost.Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
2025-06-26 10:21:15 +08:00
|
|
|
|
using System.Data.Entity.Core.Metadata.Edm;
|
2023-01-13 15:30:20 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Web.Http;
|
|
|
|
|
using static Epost.Common.LogHelper;
|
|
|
|
|
using static Epost.DAL.Enum.ShowViewType;
|
|
|
|
|
|
|
|
|
|
namespace Epost.TestToolsWeb.Controllers
|
|
|
|
|
{
|
|
|
|
|
[RoutePrefix("api/WebAPI")]
|
|
|
|
|
public class WebAPIController : ApiController
|
|
|
|
|
{
|
|
|
|
|
BLL.OrderBLL orderBLL = new BLL.OrderBLL();
|
|
|
|
|
BLL.CommandBLL combll = new BLL.CommandBLL();
|
|
|
|
|
BLL.AddressstorageBLL addrbll = new BLL.AddressstorageBLL();
|
|
|
|
|
JobModelCacheDAL cache = new JobModelCacheDAL();
|
|
|
|
|
ScanModelCacheDAL ScanCache = new ScanModelCacheDAL();
|
|
|
|
|
UserModelCacheDAL userCache = new UserModelCacheDAL();
|
|
|
|
|
JobDownCacheDAL downCache = new JobDownCacheDAL();
|
|
|
|
|
OrdersQueueBLL qubll = new OrdersQueueBLL();
|
|
|
|
|
XgateCacheDAL xageDAL = new XgateCacheDAL();
|
|
|
|
|
BoxQueueBLL quboxbll = new BoxQueueBLL();
|
|
|
|
|
JobDownCacheDAL JobCache = new JobDownCacheDAL();
|
|
|
|
|
HttpHelper http = new HttpHelper();
|
2025-06-26 10:21:15 +08:00
|
|
|
|
AddressstorageDAL addal = new AddressstorageDAL();
|
|
|
|
|
ErrorLogDAL errdal = new ErrorLogDAL();
|
2023-01-13 15:30:20 +08:00
|
|
|
|
[Route("ProcessingResult")]
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public string ProcessingResult([FromBody]ResultMessageModel data)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
LogHelper.WriteLogInfo(JsonHelper.SerializeObject(data));
|
|
|
|
|
LogHelper.WriteLogInfo("设备拍下:IP:" + data.IP + "Address:" + data.Address + "Command:" + data.Command + "Uid:" + data.Uid +"===Loc:" + data.Loc+"===Quantity:" + data.Quantity + "===W_Quanitty:" + data.W_Quantity + "===RFcode:" + data.Rfcode+ "===Result:" + data.Result+ "===Parameter:" + data.Parameter, Log_Type.JOB_DONE);
|
|
|
|
|
DataTable sdt = orderBLL.getArea(data.Address,data.IP);
|
|
|
|
|
if (sdt != null && sdt.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
data.Area = sdt.Rows[0]["area"].ToString();
|
|
|
|
|
data.Block = sdt.Rows[0]["Block"].ToString();
|
|
|
|
|
data.Type = sdt.Rows[0]["type"].ToString();
|
|
|
|
|
data.Way = sdt.Rows[0]["way"].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (data.Command == "QUERY_SPECIAL_STATUS")//扫描枪返回
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LogHelper.WriteLogInfo("*************Command:" + data.Command + "Parameter:" + data.Parameter, Log_Type.JOB_DONE);
|
|
|
|
|
string scanStr = data.Parameter.Trim();
|
|
|
|
|
data.Parameter = scanStr;
|
|
|
|
|
data.ScanCode = scanStr;
|
|
|
|
|
// JobDownCacheDAL JobCache = new JobDownCacheDAL();
|
|
|
|
|
data.Status = "0";
|
|
|
|
|
JobCache.UpdateJobDownModelList(new List<ResultMessageModel>() { data }, EdownCommend.Create);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.Command == "JOB_DONE")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
data.Status = "0";
|
|
|
|
|
data.Port = data.Loc;
|
|
|
|
|
data.IsChange =data.Result;
|
|
|
|
|
data.Parameter =data.Quantity;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JobCache.UpdateJobDownModelList(new List<ResultMessageModel>() { data }, EdownCommend.Create);
|
|
|
|
|
|
|
|
|
|
}
|
2025-06-19 16:50:57 +08:00
|
|
|
|
if (data.Command == "JOB_Fail")
|
|
|
|
|
{
|
|
|
|
|
LabelParamModel lbmodel = new LabelParamModel();
|
|
|
|
|
lbmodel.Address = data.Address;
|
|
|
|
|
lbmodel.Uid = data.Address;
|
2025-06-26 10:21:15 +08:00
|
|
|
|
string stype = "N";
|
|
|
|
|
if (data.Type == "2")
|
|
|
|
|
{ stype = "C"; }
|
|
|
|
|
lbmodel.Type = stype;
|
2025-06-24 15:46:02 +08:00
|
|
|
|
lbmodel.ControlIP = data.IP;
|
2025-06-19 16:50:57 +08:00
|
|
|
|
combll.FORMAT_DEVICE(lbmodel);
|
|
|
|
|
LogHelper.WriteLogInfo("设备报错:"+JsonHelper.SerializeObject(data), Log_Type.ERROR);
|
2025-06-26 10:21:15 +08:00
|
|
|
|
|
|
|
|
|
ErrorLogModel errmodel = new ErrorLogModel();
|
|
|
|
|
errmodel.Address = data.Address;
|
|
|
|
|
errmodel.ControlIP = data.IP;
|
|
|
|
|
addal.UpdateErrorState(data.Address, data.IP);
|
|
|
|
|
|
|
|
|
|
}
|
2023-01-13 15:30:20 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
LogHelper.WriteLogInfo("设备返回异常:" + ex.Message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string sendStr = "OK";
|
|
|
|
|
return sendStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|