|
@@ -51,6 +51,7 @@ namespace Toolkit.ViewMode
|
|
|
|
|
|
try
|
|
|
{
|
|
|
+
|
|
|
BackgroundColor = Brushes.White;
|
|
|
string data = MsgSplit(this.Tdata);
|
|
|
this.Data =data;
|
|
@@ -115,6 +116,7 @@ namespace Toolkit.ViewMode
|
|
|
{
|
|
|
if ( tcpTrigger.SendStrs.Count > 1 )
|
|
|
{
|
|
|
+ LogHelper.Info("未收到打印完成信号");
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
@@ -220,12 +222,12 @@ namespace Toolkit.ViewMode
|
|
|
}
|
|
|
if ( ribbon < 30 )
|
|
|
{
|
|
|
- plcMsg.ribbon = "2";
|
|
|
+ plcMsg.ribbon = "0";
|
|
|
}
|
|
|
|
|
|
- if ( ribbon < 2 )
|
|
|
+ if ( ribbon <=1 )
|
|
|
{
|
|
|
- plcMsg.ribbon = "3";
|
|
|
+ plcMsg.ribbon = "2";
|
|
|
}
|
|
|
|
|
|
Type personType = plcMsg.GetType();
|
|
@@ -319,6 +321,7 @@ namespace Toolkit.ViewMode
|
|
|
{
|
|
|
string str;
|
|
|
SendNetCmd(client.socket, "22");
|
|
|
+ Thread.Sleep(100);
|
|
|
SendNetCmd(client.socket, "25");
|
|
|
|
|
|
while ( true )
|
|
@@ -413,12 +416,12 @@ namespace Toolkit.ViewMode
|
|
|
}
|
|
|
if ( ribbon < 30 )
|
|
|
{
|
|
|
- plcMsg.ribbon = "2";
|
|
|
+ plcMsg.ribbon = "0";
|
|
|
}
|
|
|
|
|
|
- if ( ribbon < 2 )
|
|
|
+ if ( ribbon <= 1 )
|
|
|
{
|
|
|
- plcMsg.ribbon = "3";
|
|
|
+ plcMsg.ribbon = "2";
|
|
|
}
|
|
|
|
|
|
Type personType = plcMsg.GetType();
|
|
@@ -565,12 +568,10 @@ namespace Toolkit.ViewMode
|
|
|
public string MsgSplit(string str)
|
|
|
{
|
|
|
|
|
|
- List<string> builder = new List<string>();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
-
|
|
|
-
|
|
|
str = str.Trim();
|
|
|
string[] strs = str.Split(';');
|
|
|
|
|
@@ -584,68 +585,141 @@ namespace Toolkit.ViewMode
|
|
|
{
|
|
|
for (int j = 0; j < properties.Length; j++)
|
|
|
{
|
|
|
- if (strs[i].Split(':')[0] == properties[j].Name)
|
|
|
+ string temp=strs[ i ].Split(':')[ 0 ].ToString();
|
|
|
+ if (temp.Trim() == properties[j].Name)
|
|
|
{
|
|
|
- properties[j].SetValue(msg, strs[i].Split(':')[1]);
|
|
|
+ string []splits=strs[ i ].Split(':');
|
|
|
+ string splitst="";
|
|
|
+ //if ( splits.Length > 2 )
|
|
|
+ //{
|
|
|
+ // string[] newArray = new string[splits.Length - 1];
|
|
|
+ // Array.Copy(splits, 1, newArray, 0, newArray.Length);
|
|
|
+ // splits[ 0 ] = "";
|
|
|
+ // splitst = string.Join(":", newArray);
|
|
|
+
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ splitst = strs[ i ].Split(':')[ 1 ];
|
|
|
+ // }
|
|
|
+ properties[ j ].SetValue(msg, splitst);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- builder.Add(msg.taskid);
|
|
|
- builder.Add(msg.client_name);
|
|
|
- builder.Add(msg.datetime);
|
|
|
- builder.Add(msg.phone);
|
|
|
- string[] items = msg.items.Split(']');
|
|
|
+ sb.Append(msg.tasknum +":|:");
|
|
|
+ sb.Append(msg.client_name + ":|:");
|
|
|
+ sb.Append(msg.datetime + ":|:");
|
|
|
+ sb.Append(msg.phone + ":|:");
|
|
|
+ string[] items = msg.items.Trim().Split(']');
|
|
|
string amount = "";
|
|
|
- for (int i = 0; i < items.Length; i++)
|
|
|
+ string amountT="0";
|
|
|
+ for (int i = 0; i < 4; i++)
|
|
|
{
|
|
|
- if (items[i].Length == 0) continue;
|
|
|
- int startindex = items[i].IndexOf("<") + 1;
|
|
|
- int stopindex = items[i].IndexOf(">") - startindex;
|
|
|
- amount = items[i].Substring(startindex, stopindex);
|
|
|
- items[i] = items[i].Substring(items[i].IndexOf(">")+1);
|
|
|
- startindex = items[i].IndexOf("<") + 1;
|
|
|
- stopindex = items[i].IndexOf(">") - startindex;
|
|
|
- string currcycode = items[0].Substring(startindex, stopindex);
|
|
|
- //items:[amount<300>currcycode<USD>itdetail<100 | 1,50 | 4 >][...];
|
|
|
- items[i] = items[i].Substring(items[i].IndexOf(">")+1);
|
|
|
- string[] itdetail = items[i].Split(',');
|
|
|
-
|
|
|
- for (int j = 0; j < itdetail.Length; j++)
|
|
|
+ if ( items.Length > i )
|
|
|
{
|
|
|
- builder.Add(currcycode);
|
|
|
- startindex = itdetail[j].IndexOf("<")+1;
|
|
|
- stopindex = itdetail[j].IndexOf("|") - startindex;
|
|
|
- builder.Add(itdetail[j].Substring(startindex, stopindex));
|
|
|
- int num = Convert.ToInt32(itdetail[j].Substring(startindex, stopindex));
|
|
|
-
|
|
|
- startindex = itdetail[j].IndexOf("|")+1;
|
|
|
- stopindex = itdetail[j].IndexOf(">") ;
|
|
|
- if (stopindex == -1)
|
|
|
+ if ( items[ i ].Length == 0 )
|
|
|
+ {
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ int startindex = items[i].IndexOf("<") + 1;
|
|
|
+ int stopindex = items[i].IndexOf(">") - startindex;
|
|
|
+ amount = items[ i ].Substring(startindex, stopindex);
|
|
|
+ items[ i ] = items[ i ].Substring(items[ i ].IndexOf(">") + 1);
|
|
|
+ startindex = items[ i ].IndexOf("<") + 1;
|
|
|
+ stopindex = items[ i ].IndexOf(">") - startindex;
|
|
|
+ string currcycode = items[i].Substring(startindex, stopindex);
|
|
|
+ //items:[amount<300>currcycode<USD>itdetail<100 | 1,50 | 4 >][...];
|
|
|
+ items[ i ] = items[ i ].Substring(items[ i ].IndexOf(">") + 1);
|
|
|
+ string[] itdetail = items[i].Split(',');
|
|
|
+ for ( int j = 0; j < itdetail.Length; j++ )
|
|
|
{
|
|
|
+ if(j!=0)
|
|
|
+ i++;
|
|
|
+ sb.Append(currcycode + ":|:");
|
|
|
+ startindex = itdetail[ j ].IndexOf("<") + 1;
|
|
|
+ stopindex = itdetail[ j ].IndexOf("|") - startindex;
|
|
|
+ sb.Append((itdetail[ j ].Substring(startindex, stopindex)) + ":|:");
|
|
|
+ int num = Convert.ToInt32(itdetail[j].Substring(startindex, stopindex));
|
|
|
+
|
|
|
+ startindex = itdetail[ j ].IndexOf("|") + 1;
|
|
|
+ stopindex = itdetail[ j ].IndexOf(">");
|
|
|
+ if ( stopindex == -1 )
|
|
|
+ {
|
|
|
+
|
|
|
+ if ( itdetail[ j ].Substring(startindex) == "?" )
|
|
|
+ {
|
|
|
+ sb.Append("?:|:");
|
|
|
+ sb.Append("?:|:");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int count = Convert.ToInt32(itdetail[ j ].Substring(startindex));
|
|
|
+ sb.Append(count + ":|:");
|
|
|
+ sb.Append(num * count + ":|:");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
|
|
|
- builder.Add(itdetail[j].Substring(startindex));
|
|
|
- int count = Convert.ToInt32(itdetail[j].Substring(startindex));
|
|
|
- builder.Add((num * count).ToString());
|
|
|
+ if ( itdetail[ j ].Substring(startindex, stopindex - startindex) == "?" )
|
|
|
+ {
|
|
|
+ sb.Append("?:|:");
|
|
|
+ sb.Append("?:|:");
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int count = Convert.ToInt32(itdetail[ j ].Substring(startindex, stopindex - startindex));
|
|
|
+ sb.Append(count + ":|:");
|
|
|
+ sb.Append(num * count + ":|:");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ( amount == "?" )
|
|
|
+ {
|
|
|
+ amountT ="?";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
- builder.Add(itdetail[j].Substring(startindex, stopindex - startindex));
|
|
|
- int count = Convert.ToInt32(itdetail[j].Substring(startindex, stopindex - startindex));
|
|
|
- builder.Add((num * count).ToString());
|
|
|
+ amountT = (Convert.ToDouble(amount)+ Convert.ToDouble(amountT)).ToString();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ sb.Append(" " + ":|:");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sb.Append(amountT.ToString() + ":|:");
|
|
|
+ sb.Append(msg.recv_date + ":|:");
|
|
|
+ sb.Append(msg.deal_name + ":|:");
|
|
|
+ sb.Append(msg.tasknum + ":|:");
|
|
|
+ sb.Append(msg.dep_name + ":|:");
|
|
|
+ sb.Append(msg.packno + ":|:");
|
|
|
+ sb.Append(msg.totalpack + ":|:");
|
|
|
+ if ( msg.taskstatus == "0" )
|
|
|
+ {
|
|
|
+ sb.Append("正常");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sb.Append("异常");
|
|
|
}
|
|
|
- builder.Add(amount);
|
|
|
- builder.Add(msg.recv_date);
|
|
|
- builder.Add(msg.deal_name);
|
|
|
- builder.Add(msg.taskid);
|
|
|
- builder.Add(msg.dep_name);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
@@ -653,7 +727,7 @@ namespace Toolkit.ViewMode
|
|
|
}
|
|
|
|
|
|
|
|
|
- return string.Join(":|:", builder);
|
|
|
+ return sb.ToString();
|
|
|
}
|
|
|
|
|
|
}
|