Browse Source

增加ASCII解析数据

master
songnan.zhang 3 years ago
parent
commit
6895ea40b4
  1. 14
      ServicesCenter/WCF/OpcServerHost/OpcDeal/ParaInit.cs

14
ServicesCenter/WCF/OpcServerHost/OpcDeal/ParaInit.cs

@ -17,6 +17,7 @@ using QMFrameWork.Data;
using QMAPP.FJC.Entity.Operation;
using OpcServerHost.WebServiceForOpc;
using QMAPP.FJC.Entity.QT;
using System.Text;
namespace OpcServerHost.Init
{
@ -746,11 +747,20 @@ namespace OpcServerHost.Init
if (result != null)
{
parameter.PARAVALUE = result;
ASCIIEncoding asciiEncoding = new ASCIIEncoding();
var product_str = result.ToString().Replace("[","").Replace("]", "").Split('.');
var count = Convert.ToInt32(product_str[1]) - 1;
var productCode = "";
for (int c = 0; c <= count; c++)
{
byte[] byteArray = new byte[] { Convert.ToByte(product_str[c + 2]) };
productCode += asciiEncoding.GetString(byteArray);
}
parameter.PARAVALUE = productCode;
}
Console.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "Get Barcode " + " " + parameter.MACHINECODDE + ":" + parameter.MOLDNUMBER + ":" + parameter.COLUMNCODE + " " + ((result == null) ? " " : result.ToString()), currentPC.MACHINECODDE);
WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "Get Barcode " + ":" + parameter.COLUMNCODE + " " + ((result == null) ? " " : result.ToString()), currentPC.MACHINECODDE);
WriteLog.Write(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "Get Barcode " + ":" + parameter.PARAVALUE + " " + ((result == null) ? " " : result.ToString()), currentPC.MACHINECODDE);
getParaList.Add(parameter);

Loading…
Cancel
Save