Commit be7d6e80 by zxw

绑定保存标签tid

parent a9365374
......@@ -798,13 +798,14 @@ namespace JmpZbPrint
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static Tuple<bool, string> UpdateEpc(string id)
public static Tuple<bool, string> UpdateEpc(string id, string tid = "")
{
try
{
var body_par = JsonConvert.SerializeObject(new
{
id = id,
tid = tid,
isDirectEntryStock = CaChe.SysConfig.IsDirectEntryStock
});
var body_result = GetBody(body_par);
......@@ -882,6 +883,7 @@ namespace JmpZbPrint
shelfRange = recode.ShelfRange,
shelfRow = recode.ShelfRow,
shelfColumn = recode.ShelfColumn,
tid = recode.tid,
});
var body_result = GetBody(body_par);
if (body_result == null)
......
......@@ -107,6 +107,8 @@ namespace JmpZbPrint.Model
public int num { get; set; }
[JsonIgnore]
public string epc { get; set; }
[JsonIgnore]
public string tid { get; set; }
/// <summary>
/// 箱标epcList(json)
/// </summary>
......
......@@ -499,7 +499,8 @@ namespace JmpZbPrint.ViewModel
BindButton = true;
//更新状态
UpdateEpcStateByEpc(cmdInfo.Content.Replace("成功", "").Replace(" ", ""), true);
var arr = cmdInfo.Content.Replace("成功", "").Replace(" ", "").Split('|');
UpdateEpcStateByEpc(arr[0], arr[1], true);
}
else
{
......@@ -538,7 +539,7 @@ namespace JmpZbPrint.ViewModel
}
}
private void UpdateEpcStateByEpc(string epc, bool apply = false)
private void UpdateEpcStateByEpc(string epc, string tid, bool apply = false)
{
App.Current.Dispatcher.Invoke(() =>
{
......@@ -549,6 +550,7 @@ namespace JmpZbPrint.ViewModel
var flag = true;
if (apply)
{
item.tid = tid;
var res = HttpHelper.GenerateInventory(item, out string msg);
if (!res)
{
......
......@@ -427,7 +427,8 @@ namespace JmpZbPrint.ViewModel
BindButton = true;
//更新状态
UpdateEpcStateByEpc(cmdInfo.Content.Replace("成功", "").Replace(" ", ""), true);
var arr = cmdInfo.Content.Replace("成功", "").Replace(" ", "").Split('|');
UpdateEpcStateByEpc(arr[0], arr[1], true);
}
else
{
......@@ -466,7 +467,7 @@ namespace JmpZbPrint.ViewModel
}
}
private void UpdateEpcStateByEpc(string epc, bool apply = false)
private void UpdateEpcStateByEpc(string epc, string tid, bool apply = false)
{
App.Current.Dispatcher.Invoke(() =>
{
......@@ -484,6 +485,7 @@ namespace JmpZbPrint.ViewModel
sizeId = item.sizeId,
equId = item.productId,
epc = item.epc,
tid = tid,
supplierId = item.supplierId,
warehouseId = item.warehouseId,
productTime = Convert.ToDateTime(item.productTime),
......@@ -497,7 +499,7 @@ namespace JmpZbPrint.ViewModel
}
else
{
flagData = HttpHelper.UpdateEpc(item.id);
flagData = HttpHelper.UpdateEpc(item.id, tid);
}
}
if (flagData.Item1)
......
......@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{111435B9-7C04-4AE7-A9E0-FF7052D9F196}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<RootNamespace>JmpUhfService</RootNamespace>
<AssemblyName>JmpUhfService</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
......
......@@ -10,15 +10,15 @@ namespace JmpUhfService
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new JmpUhfService()
};
ServiceBase.Run(ServicesToRun);
//ServiceBase[] ServicesToRun;
//ServicesToRun = new ServiceBase[]
//{
// new JmpUhfService()
//};
//ServiceBase.Run(ServicesToRun);
//new JmpUhfService().TestService();
//Console.ReadKey();
new JmpUhfService().TestService();
Console.ReadKey();
}
}
}
......@@ -16,6 +16,8 @@ using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Markup;
using System.Windows.Shell;
namespace JmpUhfService
{
......@@ -390,6 +392,26 @@ namespace JmpUhfService
}
else
{
var tid = "";
//读取tid
var tag = new OperData
{
Offset = 0,
Length = 6,
Bank = BankType.TID,
Access = "00000000"
};
if (reader.ReadTag(ref tag) == OperResult.OK)
{
tid = tag.DATA;
}
else
{
OnSendMsg(client, InitializeCmdType.ReadInventorySingleError, "TID读取失败");
return;
}
//将EPC长度改成位字符串
//48/6400
//24/3400
......@@ -412,7 +434,7 @@ namespace JmpUhfService
var res = reader.WriteTag(_oper);
if (res == OperResult.OK)
{
OnSendMsg(client, InitializeCmdType.Initialize, "成功" + data.Epc);
OnSendMsg(client, InitializeCmdType.Initialize, "成功" + data.Epc + "|" + tid);
}
else
{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论