Commit be7d6e80 by zxw

绑定保存标签tid

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