Commit e1c28beb 几米阳光

删除不需要的文件

1 个父辈 928d536a
正在显示 227 个修改的文件 包含 55 行增加3145 行删除
...@@ -3,17 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00 ...@@ -3,17 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.27130.2024 VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "..\..\ACSingleStore\source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "..\ACSingleStore\source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACSingleStore", "..\..\ACSingleStore\source\ACSingleStore\ACSingleStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACSingleStore", "..\ACSingleStore\source\ACSingleStore\ACSingleStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\..\ACSingleStore\source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\ACSingleStore\source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "..\..\ACSingleStore\source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "..\ACSingleStore\source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserFromControl", "..\..\ACSingleStore\source\UserFromControl\UserFromControl.csproj", "{F018462A-D9BC-4365-97F2-F6D71751641E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserFromControl", "..\ACSingleStore\source\UserFromControl\UserFromControl.csproj", "{F018462A-D9BC-4365-97F2-F6D71751641E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "..\..\ACSingleStore\source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "..\ACSingleStore\source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
此文件类型无法预览
...@@ -87,8 +87,7 @@ namespace OnlineStore.ACSingleStore ...@@ -87,8 +87,7 @@ namespace OnlineStore.ACSingleStore
cmbWriteIO.DisplayMember = "DisplayStr"; cmbWriteIO.DisplayMember = "DisplayStr";
cmbWriteValue.SelectedIndex = 0; cmbWriteValue.SelectedIndex = 0;
txtSIP1.Text = boxBean.Config.Scanner_Ip;
txtSPort1.Text = boxBean.Config.Scanner_Port.ToString();
} }
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
...@@ -217,50 +216,7 @@ namespace OnlineStore.ACSingleStore ...@@ -217,50 +216,7 @@ namespace OnlineStore.ACSingleStore
} }
} }
} }
#region 扫码枪
private void btnSend_Click(object sender, EventArgs e)
{
boxBean.BeginScannering();
}
private void scannerCloseButton_Click(object sender, EventArgs e)
{
boxBean.StopScanner();
scannerConnectState(false);
}
private void scannerConnectButton_Click(object sender, EventArgs e)
{
try
{
string serverIp = this.txtSIP1.Text;
int port = FormUtil.GetIntValue(this.txtSPort1);
bool result = boxBean.StartScanner(serverIp, port);
if (!result)
{
LogUtil.error(LOGGER, "链接扫码枪ip=" + serverIp + ",port=" + port + "出错啦");
return;
}
else
{
scannerConnectState(true);
}
}
catch (Exception exception)
{
LogUtil.error(LOGGER, "连接到扫码枪出错:" + exception.StackTrace);
}
}
private void scannerConnectState(Boolean isStart)
{
this.scannerConnectButton.Enabled = !isStart;
//this.txtSIP1.Enabled = !isStart;
//this.txtSPort1.Enabled = !isStart;
this.btnSend.Enabled = isStart;
this.scannerCloseButton.Enabled = isStart;
}
#endregion
private void btnReadAllDi_Click(object sender, EventArgs e) private void btnReadAllDi_Click(object sender, EventArgs e)
{ {
string deviceName = txtDoName.Text; string deviceName = txtDoName.Text;
......
...@@ -162,7 +162,6 @@ ...@@ -162,7 +162,6 @@
this.日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.开启DEBUGToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.开启DEBUGToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.清理日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.清理日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.换肤ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lblThisSta = new System.Windows.Forms.Label(); this.lblThisSta = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.btnStart = new System.Windows.Forms.Button(); this.btnStart = new System.Windows.Forms.Button();
...@@ -1867,14 +1866,14 @@ ...@@ -1867,14 +1866,14 @@
// 轴卡点动ToolStripMenuItem // 轴卡点动ToolStripMenuItem
// //
this.轴卡点动ToolStripMenuItem.Name = "轴卡点动ToolStripMenuItem"; this.轴卡点动ToolStripMenuItem.Name = "轴卡点动ToolStripMenuItem";
this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.轴卡点动ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.轴卡点动ToolStripMenuItem.Text = "轴卡点动"; this.轴卡点动ToolStripMenuItem.Text = "轴卡点动";
this.轴卡点动ToolStripMenuItem.Click += new System.EventHandler(this.轴卡点动ToolStripMenuItem_Click); this.轴卡点动ToolStripMenuItem.Click += new System.EventHandler(this.轴卡点动ToolStripMenuItem_Click);
// //
// 扫码测试ToolStripMenuItem // 扫码测试ToolStripMenuItem
// //
this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem"; this.扫码测试ToolStripMenuItem.Name = "扫码测试ToolStripMenuItem";
this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.扫码测试ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.扫码测试ToolStripMenuItem.Text = "扫码测试"; this.扫码测试ToolStripMenuItem.Text = "扫码测试";
this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click); this.扫码测试ToolStripMenuItem.Click += new System.EventHandler(this.扫码测试ToolStripMenuItem_Click);
// //
...@@ -1882,8 +1881,7 @@ ...@@ -1882,8 +1881,7 @@
// //
this.日志ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.日志ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.开启DEBUGToolStripMenuItem, this.开启DEBUGToolStripMenuItem,
this.清理日志ToolStripMenuItem, this.清理日志ToolStripMenuItem});
this.换肤ToolStripMenuItem});
this.日志ToolStripMenuItem.Name = "日志ToolStripMenuItem"; this.日志ToolStripMenuItem.Name = "日志ToolStripMenuItem";
this.日志ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); this.日志ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.日志ToolStripMenuItem.Text = "其他"; this.日志ToolStripMenuItem.Text = "其他";
...@@ -1891,24 +1889,17 @@ ...@@ -1891,24 +1889,17 @@
// 开启DEBUGToolStripMenuItem // 开启DEBUGToolStripMenuItem
// //
this.开启DEBUGToolStripMenuItem.Name = "开启DEBUGToolStripMenuItem"; this.开启DEBUGToolStripMenuItem.Name = "开启DEBUGToolStripMenuItem";
this.开启DEBUGToolStripMenuItem.Size = new System.Drawing.Size(142, 22); this.开启DEBUGToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.开启DEBUGToolStripMenuItem.Text = "开启DEBUG"; this.开启DEBUGToolStripMenuItem.Text = "开启DEBUG";
this.开启DEBUGToolStripMenuItem.Click += new System.EventHandler(this.开启DEBUGToolStripMenuItem_Click); this.开启DEBUGToolStripMenuItem.Click += new System.EventHandler(this.开启DEBUGToolStripMenuItem_Click);
// //
// 清理日志ToolStripMenuItem // 清理日志ToolStripMenuItem
// //
this.清理日志ToolStripMenuItem.Name = "清理日志ToolStripMenuItem"; this.清理日志ToolStripMenuItem.Name = "清理日志ToolStripMenuItem";
this.清理日志ToolStripMenuItem.Size = new System.Drawing.Size(142, 22); this.清理日志ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.清理日志ToolStripMenuItem.Text = "清理日志"; this.清理日志ToolStripMenuItem.Text = "清理日志";
this.清理日志ToolStripMenuItem.Click += new System.EventHandler(this.清理日志ToolStripMenuItem_Click); this.清理日志ToolStripMenuItem.Click += new System.EventHandler(this.清理日志ToolStripMenuItem_Click);
// //
// 换肤ToolStripMenuItem
//
this.换肤ToolStripMenuItem.Name = "换肤ToolStripMenuItem";
this.换肤ToolStripMenuItem.Size = new System.Drawing.Size(142, 22);
this.换肤ToolStripMenuItem.Text = "换肤";
this.换肤ToolStripMenuItem.Click += new System.EventHandler(this.换肤ToolStripMenuItem_Click);
//
// lblThisSta // lblThisSta
// //
this.lblThisSta.AutoSize = true; this.lblThisSta.AutoSize = true;
...@@ -2176,7 +2167,6 @@ ...@@ -2176,7 +2167,6 @@
private System.Windows.Forms.ToolStripMenuItem 打开舱门ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 打开舱门ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 关闭仓门ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 关闭仓门ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 回待机点ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 回待机点ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 换肤ToolStripMenuItem;
private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.CheckBox chb3; private System.Windows.Forms.CheckBox chb3;
private System.Windows.Forms.CheckBox chb2; private System.Windows.Forms.CheckBox chb2;
......
...@@ -486,42 +486,7 @@ namespace OnlineStore.ACSingleStore ...@@ -486,42 +486,7 @@ namespace OnlineStore.ACSingleStore
ACServerManager.RelMove(portName, SlvAddr, position, speed); ACServerManager.RelMove(portName, SlvAddr, position, speed);
} }
private void btnAxisReturnHome_Click(object sender, EventArgs e)
{
int type = cmbAxisHomeType.SelectedIndex;
short startDirType = (short)CSmcConst.CSMC_CW;
if (type == 1)
{
startDirType = (short)CSmcConst.CSMC_CCW;
}
string portName = txtAxisDeviceName.Text;
short SlvAddr = FormUtil.GetShortValue(txtAxisValue);
ConfigMoveAxis configAxis = null;
if (portName.Equals(store.Config.Middle_Axis.DeviceName) && SlvAddr.Equals(store.Config.Middle_Axis.GetAxisValue()))
{
configAxis = store.Config.Middle_Axis;
}
else if (portName.Equals(store.Config.InOut_Axis.DeviceName) && SlvAddr.Equals(store.Config.InOut_Axis.GetAxisValue()))
{
configAxis = store.Config.InOut_Axis;
}
else if (portName.Equals(store.Config.UpDown_Axis.DeviceName) && SlvAddr.Equals(store.Config.UpDown_Axis.GetAxisValue()))
{
configAxis = store.Config.UpDown_Axis;
}
if (configAxis != null)
{
LogUtil.debug(LOGGER, "使用复位里面的原点返回方法进行返回");
ACServerManager.HomeMove(configAxis.DeviceName, configAxis.GetAxisValue(), configAxis.TargetSpeed);
}
else
{
LogUtil.debug(LOGGER, "使用输入框中的速度进行原点返回");
int speed = FormUtil.GetIntValue(txtASpeed);
ACServerManager.HomeMove(portName, SlvAddr,speed);
}
}
private void btnAxisStop_Click(object sender, EventArgs e) private void btnAxisStop_Click(object sender, EventArgs e)
{ {
...@@ -948,14 +913,14 @@ namespace OnlineStore.ACSingleStore ...@@ -948,14 +913,14 @@ namespace OnlineStore.ACSingleStore
private void 扫码测试ToolStripMenuItem_Click(object sender, EventArgs e) private void 扫码测试ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (!store.isScannerRun) //if (!store.isScannerRun)
{ //{
store.StartScanner(store.Config.Scanner_Ip,store.Config.Scanner_Port); // store.StartScanner(store.Config.Scanner_Ip,store.Config.Scanner_Port);
} //}
if (store.isScannerRun) //if (store.isScannerRun)
{ //{
store.BeginScannering(); // store.BeginScannering();
} //}
} }
private void 打开舱门ToolStripMenuItem_Click(object sender, EventArgs e) private void 打开舱门ToolStripMenuItem_Click(object sender, EventArgs e)
...@@ -1155,5 +1120,10 @@ namespace OnlineStore.ACSingleStore ...@@ -1155,5 +1120,10 @@ namespace OnlineStore.ACSingleStore
} }
} }
private void btnAxisReturnHome_Click(object sender, EventArgs e)
{
}
} }
} }
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<Compile Include="bean\Bean.cs" /> <Compile Include="bean\Bean.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting_Init.cs" /> <Compile Include="Setting_Init.cs" />
<Compile Include="util\AcSerialBean.cs" />
<Compile Include="util\ConfigAppSettings.cs" /> <Compile Include="util\ConfigAppSettings.cs" />
<Compile Include="util\CSVFileHelper.cs" /> <Compile Include="util\CSVFileHelper.cs" />
<Compile Include="util\CSVReaderControl.cs" /> <Compile Include="util\CSVReaderControl.cs" />
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
using System.IO;
using log4net;
using System.Reflection;
namespace OnlineStore.Common
{
public class ModbusDataConvert
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string btn_sender = "";
private const int read_num = 99;
private const int read_num2 = 60;
private Boolean received = false;
private SerialPort mySerialPort;
private System.Timers.Timer timer1;
public ModbusDataConvert()
{
timer1 = new System.Timers.Timer();
timer1.Interval = 100;
timer1.AutoReset = true;
timer1.Elapsed += timer1_Elapsed;
}
void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
throw new NotImplementedException();
}
private void btnOpen_Click(string myParity, string myStopBits, string portName, int baudRate,int dataBits)
{
mySerialPort = new SerialPort();
//设置校验位
switch (myParity)
{
case "None":
mySerialPort.Parity = Parity.None;
break;
case "Even":
mySerialPort.Parity = Parity.Even;
break;
case "Odd":
mySerialPort.Parity = Parity.Odd;
break;
default:
mySerialPort.Parity = Parity.None;
break;
}
//设置数据位
mySerialPort.DataBits = dataBits;
//设置停止位
switch (myStopBits)
{
case "1":
mySerialPort.StopBits = StopBits.One;
break;
case "2":
mySerialPort.StopBits = StopBits.Two;
break;
default:
mySerialPort.StopBits = StopBits.One;
break;
}
//采用ASCII编码方式
mySerialPort.Encoding = Encoding.ASCII;
//接收到一个字符就触发接收事件
mySerialPort.ReceivedBytesThreshold = 1;
//试图打开指定串口
try
{
if (mySerialPort.IsOpen == false)
{
mySerialPort.Open(); //打开串口
}
}
//打开异常,输出提示信息
catch
{
LogUtil.error(LOGGER, "串口异常,无法打开" );
}
}
private void btnClose_Click()
{
if (mySerialPort.IsOpen == true)
{
mySerialPort.Close(); //关闭串口
LogUtil.error(LOGGER, "串口已关闭");
}
}
private void mySerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
byte[] b = new byte[mySerialPort.BytesToRead];//定义byte数组,serialPort读取数据
mySerialPort.Read(b, 0, b.Length);
string str = "";
for (int i = 0; i < b.Length; i++)
{
str += string.Format("{0:X2} ", b[i]);
}
LogUtil.info(LOGGER, "收到串口反馈数据:" + str);
str = null;
received = true;
}
public static void formatstring(string strinput, int length, out string stroutput, out Boolean Valid)
{
stroutput = "";
Valid = true;
byte temp;
if ((strinput.Length <= length) & (strinput.Length > 0))
{
for (int i = 0; i < strinput.Length; i++)
{
try
{
temp = Convert.ToByte(strinput[i].ToString(), 16);
}
catch
{
Valid = false;
stroutput = "";
break;
}
stroutput += strinput[i];
}
if (Valid & (strinput.Length < length))
{
for (int j = 0; j < length - strinput.Length; j++)
{
stroutput = "0" + stroutput;
}
}
}
else
{
Valid = false;
stroutput = "";
}
}
private void btnsend_Click(string deviceAdd, string add1,string writData)
{
//btn_sender = ((Button)sender).Text.ToString();
byte[] defByte = new byte[6];
//设备号
string str1x = deviceAdd;
string str1 = "";
Boolean Macvalid1;
formatstring(str1x, 2, out str1, out Macvalid1);
if (!Macvalid1)
{
LogUtil.info(LOGGER,"设备地址数值不符合规范,最多输入2位十六进制数");
return;
}
byte[] numbyte1 = this.mysendb(str1);
defByte[0] = numbyte1[0];
//功能码 - 06
string fun_str1 = "06";
byte[] fun_numbyte1 = this.mysendb(fun_str1);
defByte[1] = fun_numbyte1[0];
//地址
string str2x = add1.ToString();
string str2 = "";
Boolean addrvalid1;
formatstring(str2x, 4, out str2, out addrvalid1);
if (!addrvalid1)
{
LogUtil.info(LOGGER,"寄存器地址数值不符合规范,最多输入4位十六进制数");
return;
}
// textBoxInformation.AppendText(str2);
byte[] numbyte2 = this.mysendb(str2);
defByte[2] = numbyte2[0];
defByte[3] = numbyte2[1];
//写入的数据
string str3x = writData;
string str3 = "";
Boolean valuevalid1;
formatstring(str3x, 4, out str3, out valuevalid1);
if (!valuevalid1)
{
LogUtil.info(LOGGER, "输入数值不符合规范,最多输入4位十六进制数");
return;
}
byte[] numbyte3 = this.mysendb(str3);
defByte[4] = numbyte3[0];
defByte[5] = numbyte3[1];
//计算CRC
byte crch = 0;
byte crcl = 0;
CalculateCRC(defByte, defByte.Length, out crch, out crcl);
// MOVE给新的数组
byte[] rebyte = new byte[defByte.Length + 2];
for (int i = 0; i < defByte.Length; i++)
{
rebyte[i] = defByte[i];
}
rebyte[6] = crcl;
rebyte[7] = crch;
received = false;
this.mySerialPort.Write(rebyte, 0, rebyte.Length); // 发送
//起动计时器
timer1.Enabled = true;
string strSend = "";
for (int i = 0; i < rebyte.Length; i++)
{
strSend += string.Format("{0:X2} ", rebyte[i]);
}
LogUtil.info(LOGGER, "发送【" + strSend + "】成功\r\n");
}
//打包方法,可以将字符串转成byte[]
public byte[] mysendb(string s)
{
string temps = delspace(s);
if (temps.Length % 2 != 0)
{
temps = "0" + temps;
}
byte[] tempb = new byte[50];
int j = 0;
for (int i = 0; i < temps.Length; i = i + 2, j++)
{
tempb[j] = Convert.ToByte(temps.Substring(i, 2), 16);
}
byte[] send = new byte[j];
Array.Copy(tempb, send, j);
return send;
}
//除去空格
public string delspace(string putin)
{
string putout = "";
for (int i = 0; i < putin.Length; i++)
{
if (putin[i] != ' ')
putout += putin[i];
}
return putout;
}
public static void CalculateCRC(byte[] pByte, int nNumberOfBytes, out ushort pChecksum)
{
int nBit;
ushort nShiftedBit;
pChecksum = 0xFFFF;
for (int nByte = 0; nByte < nNumberOfBytes; nByte++)
{
pChecksum ^= pByte[nByte];
for (nBit = 0; nBit < 8; nBit++)
{
if ((pChecksum & 0x1) == 1)
{
nShiftedBit = 1;
}
else
{
nShiftedBit = 0;
}
pChecksum >>= 1;
if (nShiftedBit != 0)
{
pChecksum ^= 0xA001;
}
}
}
}
public static void CalculateCRC(byte[] pByte, int nNumberOfBytes, out byte hi, out byte lo)
{
ushort sum;
CalculateCRC(pByte, nNumberOfBytes, out sum);
lo = (byte)(sum & 0xFF);
hi = (byte)((sum & 0xFF00) >> 8);
}
}
}
using System;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using log4net;
namespace OnlineStore.Common
{
public class TcpServer
{
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Thread m_serverThread;
private Socket m_serverSocket;
public delegate void ReceiveMessageDelegate(Client client);
ReceiveMessageDelegate receiveMessageDelegate;
private void logLocalIp()
{
string[] addresses = GetLocalAddresses();
string iplist = "本机IP:[";
if (addresses.Length > 0)
{
for (int i = 0; i < addresses.Length; i++)
{
if (addresses.Length != 0)
{
iplist = iplist + " " + addresses[i];
}
}
}
LogUtil.info(LOGGER, iplist + "]");
}
/// <summary>
/// 开始服务
/// </summary>
public void Start(int m_serverPort)
{
try
{
m_serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, m_serverPort);
m_serverSocket.Bind(localEndPoint);
m_serverSocket.Listen(10);
m_serverThread = new Thread(new ThreadStart(ReceiveAccept));
m_serverThread.Start();
LogUtil.info(LOGGER, " Server start listen : " + m_serverPort);
logLocalIp();
//this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Server started.");
}
catch (SocketException se)
{
throw new Exception(se.Message);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
/// <summary>
/// 停止服务
/// </summary>
public void Stop()
{
try
{
m_serverThread.Abort(); // 线程终止
m_serverSocket.Close(); // Socket Close
//this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Server stoped.");
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
private void ReceiveAccept()
{
while (true)
{
Client client = new Client();
try
{
client.ClientSocket = m_serverSocket.Accept();
//this.AddRunningInfo(">> " + DateTime.Now.ToString() + " Client[" + client.ClientSocket.RemoteEndPoint.ToString() + "] connected.");
receiveMessageDelegate = new ReceiveMessageDelegate(ReceiveMessages);
receiveMessageDelegate.BeginInvoke(client, ReceiveMessagesCallback, "");
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
private void ReceiveMessages(Client client)
{
try
{
while (true)
{
byte[] receiveBuffer = new byte[1024];
//int size = ;
int size = client.ClientSocket.Receive(receiveBuffer);
string strReceiveData = Encoding.ASCII.GetString(receiveBuffer, 0, size);
if (!string.IsNullOrEmpty(strReceiveData))
{
LogUtil.info(LOGGER, "收到数据:" + strReceiveData);
// this.AddRunningInfo(">> Receive data from [" + client.ClientSocket.RemoteEndPoint.ToString()+ "]:" + strReceiveData);
string strSendData = "OK. The content is:" + strReceiveData;
//LogUtil.info(LOGGER, "OK. The content is:" + strReceiveData);
int sendBufferSize = Encoding.Unicode.GetByteCount(strSendData);
byte[] sendBuffer = new byte[sendBufferSize];
sendBuffer = Encoding.Unicode.GetBytes(strSendData);
client.ClientSocket.Send(sendBuffer);
}
}
}
catch (SocketException e)
{
LogUtil.error(LOGGER, e.ToString());
}
catch (Exception ex)
{
LOGGER.Error(ex.ToString());
}
}
private void ReceiveMessagesCallback(IAsyncResult AR)
{
try
{
receiveMessageDelegate.EndInvoke(AR);
}
catch (Exception ex)
{
LOGGER.Error(ex.ToString());
}
}
/// <summary>
/// 获取本机地址列表
/// </summary>
public string[] GetLocalAddresses()
{
// 获取主机名
string strHostName = Dns.GetHostName();
// 根据主机名进行查找
IPHostEntry iphostentry = Dns.GetHostEntry(strHostName);
string[] retval = new string[iphostentry.AddressList.Length];
int i = 0;
foreach (IPAddress ipaddress in iphostentry.AddressList)
{
if (ipaddress.AddressFamily != AddressFamily.InterNetworkV6)
{
retval[i] = ipaddress.ToString();
i++;
}
}
return retval;
}
}
/// <summary>
/// 客户端会话信息类
/// </summary>
public class Client
{
Socket m_clientSocket;
public Client() { }
public Socket ClientSocket
{
get { return m_clientSocket; }
set { this.m_clientSocket = value; }
}
}
}
...@@ -63,47 +63,9 @@ ...@@ -63,47 +63,9 @@
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" /> <Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" /> <Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\ACStoreManager.cs" /> <Compile Include="acSingleStore\ACStoreManager.cs" />
<Compile Include="doubleStore\DBLineControl.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\DBStoreManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\DB_LA_BoxBean.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\DB_LA_BoxBean_Partial.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\DB_LA_LineBean.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\FileGenerated.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\FileInfomation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\FileLister.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="doubleStore\FileShare.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="halcon\HDevelopExport.cs" /> <Compile Include="halcon\HDevelopExport.cs" />
<Compile Include="KangNaiDe\KNDManager.cs" /> <Compile Include="KangNaiDe\KNDManager.cs" />
<Compile Include="KangNaiDe\MasterTcpClient.cs" /> <Compile Include="KangNaiDe\MasterTcpClient.cs" />
<Compile Include="KangTaiKe\CdioCs.cs" />
<Compile Include="KangTaiKe\CSmc.cs" />
<Compile Include="KangTaiKe\CSmcdef.cs" />
<Compile Include="KangTaiKe\KTKDeviceStatus.cs" />
<Compile Include="KangTaiKe\KTKDeviceInfo.cs" />
<Compile Include="KangTaiKe\KTKDIOManager.cs" />
<Compile Include="KangTaiKe\KTKMoveParam.cs" />
<Compile Include="KangTaiKe\KTKSMCManager.cs" />
<Compile Include="ktkSingleStore\KTK_SA_BoxBean.cs" />
<Compile Include="ktkSingleStore\KTK_SA_BoxBean_Partial.cs" />
<Compile Include="ktkSingleStore\SAStoreManager.cs" />
<Compile Include="PanasonicServo\ACCMDManager.cs" /> <Compile Include="PanasonicServo\ACCMDManager.cs" />
<Compile Include="PanasonicServo\ACServerManager.cs" /> <Compile Include="PanasonicServo\ACServerManager.cs" />
<Compile Include="PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="PanasonicServo\ACServerManager_Partial.cs" />
...@@ -119,9 +81,6 @@ ...@@ -119,9 +81,6 @@
<Compile Include="store\model\FixtureCodeInfo.cs" /> <Compile Include="store\model\FixtureCodeInfo.cs" />
<Compile Include="store\KTKLinePosition.cs" /> <Compile Include="store\KTKLinePosition.cs" />
<Compile Include="store\KTK_DeviceBase.cs" /> <Compile Include="store\KTK_DeviceBase.cs" />
<Compile Include="store\DeviceControl.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="store\InOrOutStoreParam.cs"> <Compile Include="store\InOrOutStoreParam.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
......
...@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -19,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return true ; return true ;
} }
SerialBean bean = new SerialBean(portName, 9600, Parity.Even, 8, StopBits.One); AcSerialBean bean = new AcSerialBean(portName, 9600, Parity.Even, 8, StopBits.One);
bool result = bean.openPort(); bool result = bean.openPort();
if (!result) if (!result)
{ {
...@@ -27,7 +27,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -27,7 +27,7 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
LogUtil.info("打开串口【" + portName + "】成功"); LogUtil.info("打开串口【" + portName + "】成功");
bean.DataReceived += DataReceived; //bean.DataReceived += DataReceived;
if (serialBeanMap.ContainsKey(portName)) if (serialBeanMap.ContainsKey(portName))
{ {
...@@ -39,7 +39,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -39,7 +39,7 @@ namespace OnlineStore.DeviceLibrary
} }
public static void ColsePort(string portName) public static void ColsePort(string portName)
{ {
SerialBean bean = GetSerialBean(portName); AcSerialBean bean = GetSerialBean(portName);
if (bean == null) if (bean == null)
{ {
LogUtil.info("串口【" + portName + "】未打开,不需要关闭"); LogUtil.info("串口【" + portName + "】未打开,不需要关闭");
......
...@@ -16,9 +16,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,9 +16,9 @@ namespace OnlineStore.DeviceLibrary
//private static SerialBean bean = null; //private static SerialBean bean = null;
private static string strFromat = "{0:X2}"; private static string strFromat = "{0:X2}";
private static Dictionary<string, SerialBean> serialBeanMap = new Dictionary<string, SerialBean>(); private static Dictionary<string, AcSerialBean> serialBeanMap = new Dictionary<string, AcSerialBean>();
private static SerialBean GetSerialBean(string portName) private static AcSerialBean GetSerialBean(string portName)
{ {
if (serialBeanMap.ContainsKey(portName)) if (serialBeanMap.ContainsKey(portName))
{ {
...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -198,7 +198,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend + "\r\n"); LogUtil.debug(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend + "\r\n");
// this.richTextBox1.AppendText("写入数据:" + strSend + "\r\n"); // this.richTextBox1.AppendText("写入数据:" + strSend + "\r\n");
SerialBean bean = GetSerialBean(portName); AcSerialBean bean = GetSerialBean(portName);
if (bean == null) if (bean == null)
{ {
LogUtil.info("ACServerManager SendData(string portName, byte[] data)试图写入数据:" + strSend + ",发现串口【" + portName + "】不在列表中"); LogUtil.info("ACServerManager SendData(string portName, byte[] data)试图写入数据:" + strSend + ",发现串口【" + portName + "】不在列表中");
...@@ -236,7 +236,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -236,7 +236,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend + "\r\n"); LogUtil.debug(DateTime.Now.ToLongTimeString() + " 写入数据:" + strSend + "\r\n");
// this.richTextBox1.AppendText("写入数据:" + strSend + "\r\n"); // this.richTextBox1.AppendText("写入数据:" + strSend + "\r\n");
SerialBean bean = GetSerialBean(portName); AcSerialBean bean = GetSerialBean(portName);
if (bean == null) if (bean == null)
{ {
LogUtil.info("ACServerManager SendCommand(string portName, byte[] data, int outTime, int reviceLength) 试图写入数据:" + strSend + ",发现串口【" + portName + "】不在列表中"); LogUtil.info("ACServerManager SendCommand(string portName, byte[] data, int outTime, int reviceLength) 试图写入数据:" + strSend + ",发现串口【" + portName + "】不在列表中");
......
...@@ -18,11 +18,12 @@ DO,故障指示灯,Alarm_HddLed,101,192.168.0.10,0,故障指示灯,Y02,DO-02,0 ...@@ -18,11 +18,12 @@ DO,故障指示灯,Alarm_HddLed,101,192.168.0.10,0,故障指示灯,Y02,DO-02,0
DO,待机指示灯,RunSign_HddLed,102,192.168.0.10,0,待机指示灯,Y03,DO-03,0 DO,待机指示灯,RunSign_HddLed,102,192.168.0.10,0,待机指示灯,Y03,DO-03,0
DO,吹气SOL ON,StartOrStopBlow,103,192.168.0.10,0,吹气SOL ON,Y04,DO-04,0 DO,吹气SOL ON,StartOrStopBlow,103,192.168.0.10,0,吹气SOL ON,Y04,DO-04,0
DO,料仓运转ON,Run_Sign,104,192.168.0.10,0,料仓运转ON,Y05,DO-05,0 DO,料仓运转ON,Run_Sign,104,192.168.0.10,0,料仓运转ON,Y05,DO-05,0
DO,上下轴刹车,Axis_Brake,105,192.168.0.10,0,上下轴刹车,Y06,DO-06,0 DO,轴2刹车电源ON,Axis_Brake,105,192.168.0.10,0,轴2刹车电源ON,Y06,DO-06,0
DO,进料口门上升SOL,Door_Up,106,192.168.0.10,0,进料口门上升SOL,Y07,DO-07,0 DO,进料口门上升SOL,Door_Up,106,192.168.0.10,0,进料口门上升SOL,Y07,DO-07,0
DO,进料口门下降SOL,Door_Down,107,192.168.0.10,0,进料口门下降SOL,Y08,DO-08,0 DO,进料口门下降SOL,Door_Down,107,192.168.0.10,0,进料口门下降SOL,Y08,DO-08,0
DO,定位上升SOL,LocationCylinder_Up,108,192.168.0.10,0,定位上升SOL,Y09,DO-09,0 DO,定位上升SOL,LocationCylinder_Up,108,192.168.0.10,0,定位上升SOL,Y09,DO-09,0
DO,定位下降SOL,LocationCylinder_Down,109,192.168.0.10,0,定位下降SOL,Y10,DO-10,0 DO,定位下降SOL,LocationCylinder_Down,109,192.168.0.10,0,定位下降SOL,Y10,DO-10,0
DO,相机照明开,CameraLight_Power,110,192.168.0.10,0,相机照明开,Y11,DO-11,0
AXIS,(轴一)旋转轴,Middle_Axis,1,COM1,0,,,, AXIS,(轴一)旋转轴,Middle_Axis,1,COM1,0,,,,
AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM2,0,,,, AXIS,(轴二)升降轴轴,UpDown_Axis,1,COM2,0,,,,
AXIS,(轴三)进出轴,InOut_Axis,1,COM3,0,,,, AXIS,(轴三)进出轴,InOut_Axis,1,COM3,0,,,,
......
...@@ -238,11 +238,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -238,11 +238,7 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.HomeMoving; storeRunStatus = StoreRunStatus.HomeMoving;
//启动温湿度服务器 //启动温湿度服务器
HumitureServer.StartTemperateServer(Config.TemperateServer_Port); HumitureServer.StartTemperateServer(Config.TemperateServer_Port);
//启动扫码枪
if (!isScannerRun)
{
StartScanner(Config.Scanner_Ip, Config.Scanner_Port);
}
ReturnHome(); ReturnHome();
StartTime = DateTime.Now; StartTime = DateTime.Now;
timersTimer.Enabled = true; timersTimer.Enabled = true;
...@@ -690,7 +686,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -690,7 +686,7 @@ namespace OnlineStore.DeviceLibrary
KNDManager.CloseAllDO(); KNDManager.CloseAllDO();
ShuoKeControls.ClosePort(); ShuoKeControls.ClosePort();
HumitureServer.StopTemperateServer(); HumitureServer.StopTemperateServer();
StopScanner();
LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString()); LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString());
} }
...@@ -988,6 +984,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -988,6 +984,12 @@ namespace OnlineStore.DeviceLibrary
LOGGER.Error(StoreName + "定时处理出错", ex); LOGGER.Error(StoreName + "定时处理出错", ex);
} }
} }
private void BeginScannering()
{
}
private DateTime preIoTimerOutTime = DateTime.Now; private DateTime preIoTimerOutTime = DateTime.Now;
/// <summary> /// <summary>
/// io检测异常 /// io检测异常
...@@ -1185,7 +1187,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1185,7 +1187,7 @@ namespace OnlineStore.DeviceLibrary
/// 扫码枪数据接收 /// 扫码枪数据接收
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
protected override void onCodeReceived(string message) private void onCodeReceived(string message)
{ {
try try
{ {
...@@ -1290,7 +1292,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1290,7 +1292,7 @@ namespace OnlineStore.DeviceLibrary
} }
LedProcess(); LedProcess();
isInProcess = true; isInProcess = true;
if (SAStoreManager.IsConnectServer) if (ACStoreManager.IsConnectServer)
{ {
try try
{ {
......
...@@ -726,6 +726,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -726,6 +726,9 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
public List<FixtureCodeInfo> waitOutStoreList = new List<FixtureCodeInfo>(); public List<FixtureCodeInfo> waitOutStoreList = new List<FixtureCodeInfo>();
public object waitOutListLock = ""; public object waitOutListLock = "";
public static Dictionary<string, List<string>> codeMap = new Dictionary<string, List<string>>();
public void AddWaitOutInfo(FixtureCodeInfo code) public void AddWaitOutInfo(FixtureCodeInfo code)
{ {
lock (waitOutListLock) lock (waitOutListLock)
......
using log4net;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary.doubleStore;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 流水线读写文件操作
/// </summary>
public class DBLineControl
{
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// 配置需要运行的流水线,同时只有一个流水线运行
/// </summary>
public static List<int> TheLineIdList = new List<int>();
/// <summary>
/// 0=需要等下位机信号,1=不等下位机信号,板子直接通过
/// </summary>
public static int NoWaitSingle = ConfigAppSettings.GetIntValue(Setting_Init.LineNoWaitSingle);
public static int ChangeNum = 0;
/// <summary>
/// 当前使用的产品ID
/// </summary>
public static int CurrProjectID=0;
/// <summary>
/// 当前使用的产品名称
/// </summary>
public static string CurrProjectName="";
public static string CurrM_Time = "";
public static int File_UpdateTime = 300;
/// <summary>
/// 当前的宽度
/// </summary>
public static int CurrWidth=200;
/// <summary>
/// 与iLIB通信的MachineId
/// </summary>
public static string MachineId = ConfigAppSettings.GetValue(Setting_Init.ManchineID);
/// <summary>
/// 远程共享文件夹地址
/// </summary>
public static string RemoteURL = "";
/// <summary>
/// 共享文件夹用户名
/// </summary>
public static string RemoteUsername= "";
/// <summary>
/// 共享文件夹密码
/// </summary>
public static string RemotePassword = "";
/// <summary>
/// 监控文件的过滤条件
/// </summary>
public static string FileListerFilter = "";
public static string CurrAA = "";
public static string currM_Time = "";
public static int PCB_CHECK = 0;
/// <summary>
/// 开始连接远程共享文件夹
/// </summary>
public static void StartConnect()
{
File_UpdateTime = ConfigAppSettings.GetIntValue(Setting_Init.File_UpdateTime);
string line = ConfigAppSettings.GetValue(Setting_Init.TheLineId);
TheLineIdList = new List<int>();
try
{
string[] objs = line.Split(',');
foreach (string str in objs)
{
TheLineIdList.Add(Int32.Parse(str));
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "解析启动的流水线ID时出错:" + ex.ToString());
}
MachineId = ConfigAppSettings.GetValue(Setting_Init.ManchineID);
RemoteURL = ConfigAppSettings.GetValue(Setting_Init.RemoteURL);
RemoteUsername = ConfigAppSettings.GetValue(Setting_Init.RemoteUsername);
RemotePassword = ConfigAppSettings.GetValue(Setting_Init.RemotePassword);
FileListerFilter = ConfigAppSettings.GetValue(Setting_Init.FileListerFilter);
FileGenerated.StartListerDirectory(RemoteURL, "*.*");
//读取所有产品
string appPath = Application.StartupPath;
string programConfig = ConfigAppSettings.GetValue(Setting_Init.ProgramConfig);
Dictionary<string, DBLineProgram> map = CSVProgramReader<DBLineProgram>.AddCSVFile(appPath + programConfig);
}
/// <summary>
/// 更改产品
/// </summary>
/// <param name="AA">产品ID</param>
/// <param name="projectName">产品名称</param>
public static void UpdateProject(string AA, string programName, string m_Time)
{
CurrAA = AA;
currM_Time = m_Time;
string AANumber = AA.Substring(7);
int pID = Convert.ToInt32(AANumber);
if (MachineId.Equals(""))
{
MachineId = ConfigAppSettings.GetValue(Setting_Init.ManchineID);
}
if (AA.Equals(CurrProjectID))
{
return;
}
//获取宽度
int width = GetWidthById(programName);
CurrWidth = width;
LogUtil.info(LOGGER, DBStoreManager.StoreName + "收到产品更改命令:ID【" + AA + "】Name【" + programName + "】width【" + width + "】time【" + m_Time + "】");
//更改失败
if (width <= 0)
{
DBStoreManager.WarnMsg = DBStoreManager.StoreName + "收到产品AA【" + AA + "】PP【" + programName + "】更改命令:更改失败,未找到产品的宽度";
LogUtil.info(LOGGER, DBStoreManager.WarnMsg);
FileGenerated.writeRequestFile(MachineId, AA, programName, FileGenerated.REQUEST_NG, m_Time);
}
ChangeNum++;
CurrProjectID = pID;
CurrProjectName = programName;
CurrM_Time = m_Time;
//如果所有的宽度和当前一样,直接返回ok
bool isOk = true;
foreach (DB_LA_LineBean line in DBStoreManager.StoreLineMap.Values)
{
if (line.Config.IsInDebug == 0 && line.currWidth != CurrWidth && line.storeRunStatus >= StoreRunStatus.Runing)
{
isOk = false;
break;
}
}
if (isOk)
{
FileGenerated.writeRequestFile(MachineId, AA, programName, FileGenerated.REQUEST_OK, m_Time);
//更新文件
FileGenerated.writeLSTFile(MachineId);
LogUtil.info(LOGGER, "收到的宽度和所有的流水线宽度一致,不需要更改宽度,直接返回ok");
}
else
{
LogUtil.info(LOGGER, "需要等待流水线更改宽度后才能OK");
}
}
private static int GetWidthById(string programName)
{
DBLineProgram program = CSVProgramReader<DBLineProgram>.GetProgram(programName);
if (program != null)
{
return program.ProgramWidth;
}
return -1;
}
public static string[] GetProgramList()
{
List<string> list = new List<string>(CSVProgramReader<DBLineProgram>.allProgramMap.Keys);
return list.ToArray();
}
#region 松下流水线轨道计算备份(康奈德,凌华C154,电钢组合版)
////松下流水线轨道计算备份(康奈德,凌华C154,电钢组合版)
//public static int GetNeedMS(int width)
//{
// double newWidht = width;
// //if (width <= 70)
// //{
// // newWidht = width + 2;
// //}
// //else if (width < 120)
// //{
// // newWidht = width - 1;
// //}
// //else if (width < 300)
// //{
// // newWidht = width - 4;
// //}
// //int ms = (int)((double)((newWidht - 64) * 6000 / 130));
// //ms = ms + 1150;
// //return ms;
// int ms = (int)((double)((newWidht - 45) * 44.5));
// if (width <= 70)
// { //70
// ms = (int)((double)((newWidht - 47.5) * 44.5));
// }
// else if (width <= 80)
// { //75
// ms = (int)((double)((newWidht - 47) * 44.5));
// }
// else if (width <= 120)
// { //100
// ms = 0 + (int)((double)((newWidht - 46) * 44.5));
// }
// else if (width <= 200)
// { //200
// ms = 0 + (int)((double)((newWidht - 45) * 44.5));
// }
// ms = ms + 1243;
// return ms;
//}
#endregion
#region (康泰克,康奈德,电钢组合流水线1的轨道计算)
///// <summary>
///// 流水线轨道调宽,(康泰克,康奈德,电钢组合)
///// </summary>
//public static int GetNeedMS(int width)
//{
// double newWidht = width;
// int ms = (int)((double)((newWidht - 52) * 108));
// if (width <= 70)
// { //70
// ms = (int)((double)((newWidht - 51.2) * 108));
// }
// else if (width <= 80)
// { //75
// ms = (int)((double)((newWidht - 51.2) * 108));
// }
// else if (width <= 120)
// { //100
// ms = 0 + (int)((double)((newWidht - 51.6) * 108));
// }
// else if (width <= 200)
// { //200
// ms = 0 + (int)((double)((newWidht - 52) * 108));
// }
// ms = ms + 1243;
// return ms;
//}
#endregion
/// <summary>
/// 轨道调宽需要的脉冲数(硕科步进控制驱动器)
/// </summary>
public static int GetNeedPosition(int width,int homeWidth)
{
//homeWidth是原点的宽度,1068是1毫米的脉冲数
double newWidht = width * 10 + 10 - homeWidth;
int position = (int)newWidht * 1068 / 10;
return position;
}
}
}
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
namespace OnlineStore.DeviceLibrary.doubleStore
{
public class FileGenerated
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/**
* プログラム変更受信 (基板搬入抑制)通知 Program change receive (board loading prohibit) notification
*/
public static string REQUEST_ACK = "ACK";
/**
* プログラム変更不可通知 Program change cancel notification
*/
public static string REQUEST_CAN = "CAN";
/**
* プログラム変更正常終了通知 Program change normal end notification
*/
public static string REQUEST_OK = "OK";
/**
* プログラム変更異常終了通知 Program change abnormal end notification
*/
public static string REQUEST_NG = "NG";
//private static string remoteURL = ConfigAppSettings.GetValue(Setting_Init.RemoteURL);
//private static string remoteURL = "//192.168.10.1/othersystem/iLNBIF/MachineIF/M-TowertoiLNB/";
//private static string remoteURL = "/testFile/";
private static string remoteURL = ConfigAppSettings.GetValue(Setting_Init.RemoteWriteURL);
//private static string remoteURL = "//192.168.10.11/doubleStore/";
private static char spiltStr = '&';
private static string localFileDir = "F:/FileDir/";
public static void WriteStrToRemoteUrl(string fileName, string[] lines)
{
try
{
if (!Directory.Exists(remoteURL))//若文件夹不存在则新建文件夹
{
Directory.CreateDirectory(remoteURL); //新建文件夹
}
//先写入本地
//string localFileFullName = "" + localFileDir + fileName;
//写入远程共享文件夹
String FullRemotePath = remoteURL + fileName;
FileShare.WriteFiles(FullRemotePath, lines);
}
catch (Exception ex)
{
LogUtil.error(LOGGER,"写入文件出错:[" + fileName + "]"+ex.ToString());
}
}
public static string GetDateStr()
{
// MCxxxxx&Lane&YYYYMMDDhhmmss&ZZ&TTTT&BZ&LV&A-A.SGI
string dateStr = DateTime.Now.ToString("yyyyMMddHHmmss");
return dateStr;
}
/**
* 8.2.1.1. ファイル名/File name MCxxxxx&Lane&YYYYMMDDhhmmss&ZZ&TTTT&BZ&LV&A-A.SGI
* 設備起動時。状態が変わった時 When machine started When state changed
*/
public static void writeSGIFile(string machineId, string lightT, string alarmInfo, string errorInfo, int autoRun, int troubleStop)
{
string fileEndName = ".SGI";
//固定值レーン No. 01 固定
string BZ = "0";
string ZZ = "00";
string lane = "01";
//拼接长度
lightT = lightT.PadLeft(4, '0');
machineId = machineId.PadLeft(5, '0');
alarmInfo = alarmInfo.PadLeft(2, '0');
errorInfo = errorInfo.PadLeft(8, '0');
string fileName = "MC" + machineId + spiltStr + lane + spiltStr + GetDateStr() + spiltStr + ZZ +
spiltStr + lightT + spiltStr + BZ + spiltStr + alarmInfo + spiltStr + errorInfo + fileEndName;
String warnMessage = DBStoreManager.GetWarMsg();
FileInfomation fileInfo = new FileInfomation();
string[] text = fileInfo.WarnMsgToFileString(warnMessage);
//FileInfomation fileInfo = new FileInfomation(autoRun, troubleStop);
//string[] text = fileInfo.ToFileString();
WriteStrToRemoteUrl(fileName, text);
}
/**
* 8.2.2.1. ファイル名/File name MCxxxxx&Lane&YYYYMMDDhhmmss &ZZ.STS
* 設備起動時。状態が変わった時 When machine started When state changed
*/
public static void writeSTSFile(string machineId, int autoRun, int troubleStop)
{
string fileEndName = ".STS";
//固定值レーン No. 01 固定
string ZZ = "00";
string lane = "01";
//拼接长度
machineId = machineId.PadLeft(5, '0');
string fileName = "MC" + machineId + spiltStr + lane + spiltStr + GetDateStr() + spiltStr + ZZ + fileEndName;
FileInfomation fileInfo = new FileInfomation(autoRun, troubleStop);
string[] text = fileInfo.ToFileString();
//string[] text = new string[] { };
WriteStrToRemoteUrl(fileName, text);
}
/**
* 8.2.3.1. ファイル名/File name (△2) MCxxxxx&Lane&CC.LCT
* 設備状態を常時出力( 500ms~可 変) Always output machine state (500ms–variable)
* 一直需要输出的文件
*/
public static void writeLCTFile(string machineId, int autoRun, int troubleStop,int pcbCount)
{
string fileEndName = ".LCT";
string CC =pcbCount.ToString().PadLeft(2,'0') ;
string lane = "01";
//拼接长度
machineId = machineId.PadLeft(5, '0');
string fileName = "MC" + machineId + spiltStr + lane + spiltStr + CC + fileEndName;
//FileInfomation fileInfo = new FileInfomation(autoRun, troubleStop);
//string[] text = fileInfo.ToFileString();
string[] text = new string[] { };
WriteStrToRemoteUrl(fileName, text);
}
/**
* 8.2.3.1. ファイル名/File name (△2) MCxxxxx&Lane.LST
* 設備状態を常時出力( 500ms~可 変) Always output machine state (500ms–variable)
* 一直需要输出的文件
*/
public static void writeLSTFile(string machineId)
{
string fileEndName = ".LST";
string lane = "01";
//拼接长度
machineId = machineId.PadLeft(5, '0');
string fileName = "MC" + machineId + spiltStr + lane + fileEndName;
//FileInfomation fileInfo = new FileInfomation(autoRun, troubleStop);
//string[] text = fileInfo.ToFileString();
string[] text = new string[] {
"PROGRAM_NAME1",
"PROGRAM_NAME2",
"PROGRAM_NAME3"
};
text = DBLineControl.GetProgramList();
WriteStrToRemoteUrl(fileName, text);
}
/**
* 10.1.2. 機種切り替え替えに使用するファイル一覧/List of files used for product change
* プログラム変更受信 (基板搬入抑制)通知 Program change receive (board loading prohibit) notification
* MCxxxxx&Lane&A-A&P-P&YYYYMMDDhhmmss.ACK
*/
public static void writeACKFile(string machineId, string AA, string PP,string m_time)
{
string fileEndName = ".ACK";
string lane = "01";
string fileName = "MC" + machineId + spiltStr + lane + spiltStr + AA + spiltStr + PP + spiltStr + m_time + fileEndName;
string[] text = new string[] { };
WriteStrToRemoteUrl(fileName, text);
}
/**
* 10.1.2. 機種切り替え替えに使用するファイル一覧/List of files used for product change
* Program change notification
* MCxxxxx&Lane&A-A&P-P&YYYYMMDDhhmmss.RequestType
*/
public static void writeRequestFile(string machineId, string AA, string PP, string RequestType,string m_time)
{
string fileEndName = "." + RequestType;
string lane = "01";
//拼接长度
machineId = machineId.PadLeft(5, '0');
//AA = AA.PadLeft(10, '0');
string fileName = "MC" + machineId + spiltStr + lane + spiltStr + AA + spiltStr + PP + spiltStr + m_time + fileEndName;
string[] text = new string[] { };
WriteStrToRemoteUrl(fileName, text);
}
/**
* 10.1.2. 機種切り替え替えに使用するファイル一覧/List of files used for product change
* MCxxxxx&Lane&A-A&P-P&YYYYMMDDhhmmss.CMD
* 由iLNB方创建
*/
public static void ReadCMDFile(string fullPath,String fileNameh)
{
String fileName = System.IO.Path.GetFileName(fileNameh);
String[] txt = fileName.Split(spiltStr);
String machineId = txt[0].Replace("MC","");
String AA = txt[2];
String PP = txt[3];
String m_time = txt[4].Substring(0,14);
writeACKFile(machineId, AA, PP, m_time);
DBLineControl.UpdateProject(AA,PP,m_time);
//String RequestType = "OK";
//writeRequestFile(machineId, AA, PP, RequestType, m_time);
//删除文件
//string fullPath = "//192.168.10.1/othersystem/iLNBIF/MachineIF/iLNBtoM-Tower/" + fileNameh;
Thread.Sleep(100);
deleteFile(fullPath);
}
/**
* 启动文件夹监视
*/
public static void StartListerDirectory(String DirectoryPath,String filter)
{
FileLister.WatcherStrat(DirectoryPath, filter);
}
public static void deleteFile(String fullName)
{
try
{
//if (!Directory.Exists(remoteURL))//若文件夹不存在则新建文件夹
//{
//}
File.Delete(fullName); //新建文件夹
}
catch (Exception ex)
{
LogUtil.error(LOGGER,"写入文件出错:[" + fullName + "]"+ex.ToString());
}
}
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary.doubleStore
{
public class FileInfomation
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FileInfomation()
{
}
/**
* 构造函数,除了AUTORUN和TROUBLE_STOP,其他都是固定值
*/
public FileInfomation(int AUTORUN, int TROUBLE_STOP)
{
this.AUTORUN = AUTORUN;
this.TROUBLE_STOP = TROUBLE_STOP;
}
/**
* 转换为文件内容
*/
public string[] ToFileString()
{
//String nextLine = "\r\n";
string[] data = new string[] {
"[STATUS]",
"ONLINE=" + ONLINE ,
"AUTORUN=" + AUTORUN ,
"PROCESS_WAITE=" + PROCESS_WAITE ,
"OTHER_LANE_WAIT=" + OTHER_LANE_WAIT ,
"TROUBLE_STOP=" + TROUBLE_STOP,
"PWAIT=" + PWAIT ,
"PCB_CHECK=" + PCB_CHECK ,
"CHANGE_OVER=" + CHANGE_OVER ,
};
return data;
}
public string[] WarnMsgToFileString(string Msg)
{
string jpnMsg = "テスト テスト テスト テスト テスト";
string engMsg = "test test test test test ";
string[] data = new string[]
{
"[Text_JPN]",
"MESSAGE=\""+jpnMsg+"\"",
"[Text_ENG]",
"MESSAGE=\""+engMsg+"\"",
"[Text_CHN]",
"MESSAGE=\""+Msg+"\"",
};
return data;
}
/**
* Online mode state 1:固定 fixed to 1
*/
public int ONLINE = 1;
/**
* 自動運転状態 * Auto operation state
* 0:停止中/1:自動運転中 * 0: Stopped/1: In auto operation
*/
public int AUTORUN = 1;
/**
* 工程待ち状態 * Process wait state * 0:固定 * fixed to 0
*/
public int PROCESS_WAITE = 0;
/**
* Other lane waiting * 0:固定 * fixed to 0
*/
public int OTHER_LANE_WAIT = 0;
/**
* In trouble stop * 0:トラブル停止中でない/1:トラブル停止中
* 0: Not in trouble stop/1: In trouble stop
*/
public int TROUBLE_STOP = 0;
/**
* 材料供給待ち停止中 * In material supply stop * 0:固定 * fixed to 0
*/
public int PWAIT = 0;
/**
* 基板確認中 * In board checking * 0:固定 * fixed to 0
*/
public int PCB_CHECK = 0;
/**
* 段取り替え中 * In changeover * 0:固定 * fixed to 0
*/
public int CHANGE_OVER = 0;
}
}
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary.doubleStore
{
/// <summary>
/// 文件监控类
/// </summary>
public class FileLister
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static bool isConnect = false;
public static void WatcherStrat(string path, string filter)
{
try
{
LogUtil.error(LOGGER, "启动监控【" + path + "】" );
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = path;
watcher.Filter = filter;
//watcher.Changed += new FileSystemEventHandler(OnProcess);
watcher.Created += new FileSystemEventHandler(OnProcess);
//watcher.Deleted += new FileSystemEventHandler(OnProcess);
//watcher.Renamed += new RenamedEventHandler(OnRenamed);
watcher.EnableRaisingEvents = true;
watcher.NotifyFilter = NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.LastAccess
| NotifyFilters.LastWrite | NotifyFilters.Security | NotifyFilters.Size;
watcher.IncludeSubdirectories = true;
isConnect = true;
}
catch (Exception ex)
{
isConnect = false;
LogUtil.error(LOGGER, "启动监控【"+path+"】出错:"+ ex.ToString());
}
}
private static void OnProcess(object source, FileSystemEventArgs e)
{
if (e.ChangeType == WatcherChangeTypes.Created)
{
OnCreated(source, e);
}
else if (e.ChangeType == WatcherChangeTypes.Changed)
{
OnChanged(source, e);
}
else if (e.ChangeType == WatcherChangeTypes.Deleted)
{
OnDeleted(source, e);
}
}
private static void OnCreated(object source, FileSystemEventArgs e)
{
LogUtil.info(LOGGER, "文件新建事件处理逻辑" + e.ChangeType + e.FullPath + e.Name);
if (e.Name.EndsWith(".cmd") || e.Name.EndsWith(".CMD"))
{
FileGenerated.ReadCMDFile(e.FullPath,e.Name);
}
}
private static void OnChanged(object source, FileSystemEventArgs e)
{
LogUtil.info(LOGGER, "文件改变事件处理逻辑" + e.ChangeType + e.FullPath + e.Name);
}
private static void OnDeleted(object source, FileSystemEventArgs e)
{
LogUtil.info(LOGGER, "文件删除事件处理逻辑 " + e.ChangeType + e.FullPath + e.Name);
}
private static void OnRenamed(object source, RenamedEventArgs e)
{
LogUtil.info(LOGGER, "文件重命名事件处理逻辑" + e.ChangeType + e.FullPath + e.Name);
}
}
}
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary.doubleStore
{
public class FileShare
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public FileShare() { }
public static bool isConnect = false;
public static bool connectState(string path)
{
return connectState(path, "", "");
}
public static bool connectState(string path, string userName, string passWord)
{
bool isConnect = false;
Process proc = new Process();
try
{
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardInput = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
string dosLine = @"net use " + path + " /User:" + userName + " " + passWord + " /PERSISTENT:YES";
proc.StandardInput.WriteLine(dosLine);
proc.StandardInput.WriteLine("exit");
while (!proc.HasExited)
{
proc.WaitForExit(1000);
}
string errormsg = proc.StandardError.ReadToEnd();
proc.StandardError.Close();
if (string.IsNullOrEmpty(errormsg))
{
isConnect = true;
}
else
{
LogUtil.error(LOGGER,"连接错误[" + path + "]:" + errormsg);
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "出错[" + path + "] "+ex.ToString());
}
finally
{
proc.Close();
proc.Dispose();
}
return isConnect;
}
//read file
public static void ReadFiles(string path)
{
try
{
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (StreamReader sr = new StreamReader(path))
{
String line;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
}
catch (Exception e)
{
LogUtil.error(LOGGER, "出错The file could not be read: [" + path + "]"+e.ToString());
}
}
//write file
public static void WriteFiles(string path,string[] lines)
{
try
{
using (StreamWriter sw = new StreamWriter(path))
{
foreach (string str in lines)
{
sw.WriteLine(str);
}
}
}
catch (Exception e)
{
LogUtil.error(LOGGER, "出错The file could not be read[" + path + "]: "+ e.ToString());
}
}
}
}
...@@ -71,7 +71,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -71,7 +71,7 @@ namespace OnlineStore.DeviceLibrary
string camerName = (string)paramList[2]; string camerName = (string)paramList[2];
List<string> codeArray = HDevelopExport.GetCode(ho_Image, cameraIndex); List<string> codeArray = HDevelopExport.GetCode(ho_Image, cameraIndex);
LogUtil.debug("扫码中:结束摄像机[" + camerName + "] 的识别 "); LogUtil.debug("扫码中:结束摄像机[" + camerName + "] 的识别 ");
KTK_SA_BoxBean.codeMap.Add(camerName, codeArray); AC_SA_BoxBean.codeMap.Add(camerName, codeArray);
} }
else else
{ {
......
//*******************************************************
// API-SMC(WDM)
// FILE NAME CSMCDEF.H
//********************************************************
namespace OnlineStore.DeviceLibrary
{
public enum CSmcConst
{
CSMC_PTP = 1,
CSMC_JOG = 2,
CSMC_ORG = 3,
CSMC_SINGLE = 4,
CSMC_LOOP = 5,
CSMC_ZMOVE = 6,
CSMC_PLSER = 10,
//正方向
CSMC_CW = 0,
//反方向
CSMC_CCW = 1,
//绝对坐标
CSMC_ABS = 0,
//相对坐标
CSMC_INC = 1,
CSMC_STOP = 0,
CSMC_PASS = 1,
CSMC_OUT1 = 1,
CSMC_OUT2 = 2,
CSMC_OUT3 = 4,
CSMC_IN1 = 1,
CSMC_IN2 = 2,
CSMC_IN3 = 4,
CSMC_IN4 = 8,
CSMC_IN5 = 0x10,
CSMC_IN6 = 0x20,
CSMC_IN7 = 0x40,
CSMC_STEP_0 = 0,
CSMC_STEP_1 = 1,
CSMC_HOLD = 0,
CSMC_HOLDOFF = 1,
//WGetPulseStatus的结果列表
CSMC_PLS_STOP = 0,
CSMC_PLS_FLCONST = 1,
CSMC_PLS_FHCONST = 2,
CSMC_PLS_READY = 3,
CSMC_PLS_ERCW = 4,
CSMC_PLS_DTMW = 5,
CSMC_PLS_ACCEL = 6,
CSMC_PLS_DECEL = 7,
CSMC_PLS_INPW = 8,
CSMC_PLS_PAPBW = 9,
CSMC_MOVE = 0,
CSMC_STOP_COMMAND = 1,
CSMC_SD_COMMAND = 2,
CSMC_STOP_OTHER = 3,
CSMC_STOP_ALARM = 4,
CSMC_STOP_PLIM = 5,
CSMC_STOP_MLIM = 6,
CSMC_STOP_SD = 7,
CSMC_ERROR_ORG = 8,
CSMC_ERROR_PULSER = 9,
CSMC_STOP_NORMAL = 0XFF,
CSMC_MESSAGE = 0X8700,
CSMC_DISABLE = 0,
CSMC_ENABLE = 1,
CSMC_OUTPULSE = 0,
CSMC_ENCODER = 1,
CSMC_LTC = 0,
CSMC_TRGERR = 0,
CSMC_TRGSTATUS = 1,
CSMC_TIMER = 1,
CSMC_ALM = 0x1,
CSMC_PLIM = 0x2,
CSMC_MLIM = 0x4,
CSMC_ORGLIM = 0x8,
CSMC_SD = 0x10,
CSMC_2PULSE = 0,
CSMC_1PULSE = 1,
CSMC_AB = 0,
CSMC_UD = 1,
CSMC_HOFF = 1,
CSMC_ALMCLR = 2,
CSMC_CNTCLR = 4,
CSMC_DISTANCE = 0,
CSMC_ANGLE = 1,
CSMC_ALLTIME = 0,
CSMC_LIM = 1,
CSMC_CTRL_PCS = 0x1,
CSMC_CTRL_ERC = 0x2,
CSMC_CTRL_EZ = 0x4,
CSMC_CTRL_CLR = 0x8,
CSMC_CTRL_LTC = 0x10,
CSMC_CTRL_SD = 0x12,
CSMC_CTRL_INP = 0x40,
CSMC_CTRL_DIRCCW = 0x80,
CSMC_PULSER_PTP = 1,
CSMC_PULSER_JOG = 2,
CSMC_PULSER_HOME_PULSE = 4,
CSMC_PULSER_HOME_ORG = 5,
CSMC_PULSER_INTER_LINE = 6,
CSMC_PULSER_INTER_ARC = 7
}
}
\ No newline at end of file \ No newline at end of file
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 康泰克IO版操作类
/// </summary>
public class KTKDIOManager
{
public static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string KTK_PI_DeviceName = ConfigAppSettings.GetValue(Setting_Init.KTK_PI_BoardName);
public static string KTK_PO_DeviceName = ConfigAppSettings.GetValue(Setting_Init.KTK_PO_BoardName);
private static Dictionary<string, KTKDeviceInfo> DIODeviceMap = new Dictionary<string, KTKDeviceInfo>();
private static Cdio cdio = new Cdio();
//每一个port的io数量
private static int portIONum=8;
private static int ret = 0;
/// <summary>
/// io卡初始化
/// </summary>
public static string DIOInit(string DeviceName)
{
if (!DIODeviceMap.ContainsKey(DeviceName))
{
short dio_Id = 0;
//初始化
ret = cdio.Init(DeviceName, out dio_Id);
short inPortName=0;
short outPortName=0;
//获取最多的端口
cdio.GetMaxPorts(dio_Id, out inPortName, out outPortName);
KTKDeviceInfo ktk = new KTKDeviceInfo(dio_Id, DeviceName, inPortName, outPortName);
DIODeviceMap.Add(DeviceName, ktk);
return DIOGetErrorString(ret);
}
return "";
}
/// <summary>
/// 判断设备是否初始化过了
/// </summary>
public static Boolean DIODeviceIsInit(string deviceName)
{
if (DIODeviceMap.ContainsKey(deviceName))
{
return true;
}
return false;
}
/// <summary>
/// 退出DIO卡
/// </summary>
public static string DIOExit(string DeviceName)
{
if (DIODeviceMap.ContainsKey(DeviceName))
{
short id = DIODeviceMap[DeviceName].DeviceId;
//退出
int ret = cdio.Exit(id);
DIODeviceMap.Remove(DeviceName);
return DIOGetErrorString(ret);
}
return "";
}
/// <summary>
/// 读取单个DI
/// </summary>
public static IO_VALUE ReadSingDI(string DeviceName, short ioIndex)
{
IO_VALUE value = (IO_VALUE)ReadSingDIValue(DeviceName,ioIndex);
return value;
}
public static int ReadSingDIValue(string DeviceName, short ioIndex)
{
byte Data = 0;
if (DIODeviceMap.ContainsKey(DeviceName))
{
short id = DIODeviceMap[DeviceName].DeviceId;
DateTime time = DateTime.Now;
cdio.InpBit(id, ioIndex, out Data);
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
{
log.Error("执行cdio.InpBit【" + DeviceName + " " + ioIndex + "】,共耗费了【" + span.TotalMilliseconds + "】毫秒");
}
}
return Data;
}
/// <summary>
/// 读取这块板子上所有DI的值
/// </summary>
public static List<IO_VALUE> ReadAllDI(string DeviceName)
{
List<IO_VALUE> returnList = new List<IO_VALUE>();
try
{
if (DIODeviceMap.ContainsKey(DeviceName))
{
KTKDeviceInfo deviceInfo = DIODeviceMap[DeviceName];
short inPortNum = deviceInfo.InPortNum;
if (inPortNum <= 0)
{
return returnList;
}
short[] portArray = new short[inPortNum];
byte[] portValueArr = new byte[inPortNum];
for (int inPort = 0; inPort < inPortNum; inPort++)
{
portArray[inPort] = (short)inPort;
}
cdio.InpMultiByte(deviceInfo.DeviceId, portArray, inPortNum, portValueArr);
foreach (byte value in portValueArr)
{
string strValue = System.Convert.ToString(value, 2).PadLeft(portIONum, '0');
for (int index = portIONum - 1; index >= 0; index--)
{
string ioVStr = strValue.Substring(index, 1);
IO_VALUE iov = (IO_VALUE)Int32.Parse(ioVStr);
returnList.Add(iov);
}
}
}
}
catch (Exception ex)
{
LogUtil.error(log, ex.ToString());
}
return returnList;
}
/// <summary>
/// 读取单个DO
/// </summary>
public static IO_VALUE ReadSingDO(string DeviceName, short ioIndex)
{
return (IO_VALUE)ReadSingDOValue(DeviceName,ioIndex);
}
public static int ReadSingDOValue(string DeviceName, short ioIndex)
{
byte Data = 0;
if (DIODeviceMap.ContainsKey(DeviceName))
{
short id = DIODeviceMap[DeviceName].DeviceId;
DateTime time = DateTime.Now;
cdio.EchoBackBit(id, ioIndex, out Data);
TimeSpan span = DateTime.Now - time;
if (span.TotalMilliseconds > 10)
{
log.Error("执行cdio.EchoBackBit【" + DeviceName + " " + ioIndex + "】,共耗费了【" + span.TotalMilliseconds + "】毫秒");
}
}
return Data;
}
/// <summary>
/// 写入单个DO
/// </summary>
public static int WriteSingDO(string DeviceName, short ioIndex, IO_VALUE value)
{
if (DIODeviceMap.ContainsKey(DeviceName))
{
short id = DIODeviceMap[DeviceName].DeviceId;
byte Data = (byte)value;
return cdio.OutBit(id, ioIndex, Data);
}
return 0;
}
/// <summary>
/// 读取这块板子上所有DO的值
/// </summary>
public static List<IO_VALUE> ReadAllDO(string DeviceName)
{
List<IO_VALUE> returnList = new List<IO_VALUE>();
try
{
if (DIODeviceMap.ContainsKey(DeviceName))
{
KTKDeviceInfo deviceInfo = DIODeviceMap[DeviceName];
short outPortNum = deviceInfo.OutPortNum;
if (outPortNum <= 0)
{
return returnList;
}
short[] portArray = new short[outPortNum];
byte[] portValueArr = new byte[outPortNum];
for (int inPort = 0; inPort < outPortNum; inPort++)
{
portArray[inPort] = (short)inPort;
}
cdio.EchoBackMultiByte(deviceInfo.DeviceId, portArray, outPortNum, portValueArr);
foreach (byte value in portValueArr)
{
string strValue = System.Convert.ToString(value, 2).PadLeft(portIONum, '0');
for (int index = portIONum - 1; index >= 0; index--)
{
string ioVStr = strValue.Substring(index, 1);
IO_VALUE iov = (IO_VALUE)Int32.Parse(ioVStr);
returnList.Add(iov);
}
}
}
}
catch (Exception ex)
{
LogUtil.error(log, ex.ToString());
}
return returnList;
}
/// <summary>
/// 获取错误文字提示
/// </summary>
public static string DIOGetErrorString(int ErrorCode)
{
//获取错误信息
string errMsg = "";
if (ret != 0)
{
cdio.GetErrorString(ErrorCode, out errMsg);
}
return errMsg;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 康泰克一个卡信息
/// </summary>
public class KTKDeviceInfo
{
public KTKDeviceInfo()
{
}
public KTKDeviceInfo(short id, string deviceName)
{
this.DeviceId = id;
this.DeviceName = deviceName;
InPortNum = 0;
OutPortNum = 0;
}
public KTKDeviceInfo(short id, string deviceName, short inPortName, short outPortName)
{
this.DeviceId = id;
this.DeviceName = deviceName;
InPortNum = inPortName;
OutPortNum = outPortName;
}
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get; set; }
/// <summary>
/// 设备ID
/// </summary>
public short DeviceId { get; set; }
/// <summary>
/// 输入端口数量
/// </summary>
public short InPortNum { get; set; }
/// <summary>
/// 输出端口数量
/// </summary>
public short OutPortNum { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
public class KTKDeviceStatus
{
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get; set; }
/// <summary>
/// 设备ID
/// </summary>
public short DeviceId { get; set; }
/// <summary>
/// 错误码
/// </summary>
public int ErrorCode { get; set; }
/// <summary>
/// 错误信息
/// </summary>
public string ErrorMsg { get; set; }
public int OutPulse { get; set; }
public int CountPulse { get; set; }
public int OutPulseStatus { get; set; }
public int MoveStatus { get; set; }
public int StopStatus { get; set; }
public void SetResult(int ret)
{
string ErrorString = "";
if (ret != 0)
{
ErrorString = KTKSMCManager.WGetErrorString(ret);
ErrorCode = ret;
ErrorMsg = ErrorString;
}
}
public short LimitStatus { get; set; }
public short AlarmCode { get; set; }
public string PulseStatusStr { get; set; }
public string MoveStatusStr { get; set; }
public string StopStatusStr { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.DeviceLibrary
{
/// <summary>
/// 康泰克轴运动需要的参数
/// </summary>
public class KTKMoveParam
{
public KTKMoveParam(string DeviceName, short AxisNo, short MotionType, short StartDir, short bCoordinate, short targetPosition, double ResolveSpeed, double StartSpeed, double TargetSpeed, short AccelTime, short DecelTime, double SSpeed)
{
this.DeviceName = DeviceName;
this.AxisNo = AxisNo;
this.MotionType = MotionType;
this.StartDir = StartDir;
this.BCoordinate = bCoordinate;
this.TargetPosition = targetPosition;
this.ResolveSpeed = ResolveSpeed;
this.StartSpeed = StartSpeed;
this.TargetSpeed = TargetSpeed;
this.AccelTime = AccelTime;
this.DecelTime = DecelTime;
this.SSpeed = SSpeed;
}
public KTKMoveParam(string DeviceName, short AxisNo, short MotionType, short StartDir, short bCoordinate, short targetPosition, double ResolveSpeed, double StartSpeed, double TargetSpeed, double AccelTime, double DecelTime, double SSpeed)
{
this.DeviceName = DeviceName;
this.AxisNo = AxisNo;
this.MotionType = MotionType;
this.StartDir = StartDir;
this.BCoordinate = bCoordinate;
this.TargetPosition = targetPosition;
this.ResolveSpeed = ResolveSpeed;
this.StartSpeed = StartSpeed;
this.TargetSpeed = TargetSpeed;
this.AccelTime = (short)AccelTime;
this.DecelTime = (short)DecelTime;
this.SSpeed = SSpeed;
}
public KTKMoveParam(string DeviceName, short AxisNo, short MotionType, short StartDir, short bCoordinate, short targetPosition)
{
this.DeviceName = DeviceName;
this.AxisNo = AxisNo;
this.MotionType = MotionType;
this.StartDir = StartDir;
this.BCoordinate = bCoordinate;
this.TargetPosition = targetPosition;
this.ResolveSpeed = KTKSMCManager.Move_ResolveSpeed;
this.StartSpeed = KTKSMCManager.Move_StartSpeed;
this.TargetSpeed = KTKSMCManager.Move_TargetSpeed;
this.AccelTime = KTKSMCManager.Move_AccelTime;
this.DecelTime = KTKSMCManager.Move_lDecelTime;
this.SSpeed = KTKSMCManager.Move_SSpeed;
}
public KTKMoveParam()
{
}
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get; set; }
/// <summary>
/// 轴
/// </summary>
public short AxisNo { get; set; }
/// <summary>
/// 运动类型
/// (short)CSmcConst.CSMC_PTP; 点对点运动(绝对运动,相对运动)
/// (short)CSmcConst.CSMC_JOG;匀速运动
/// (short)CSmcConst.CSMC_ORG; 原点运动
/// </summary>
public short MotionType { get; set; }
/// <summary>
/// 方向
/// CSmcConst.CSMC_CW
/// CSmcConst.CSMC_CCW
/// </summary>
public short StartDir { get; set; }
/// <summary>
/// (short)CSmcConst.CSMC_ABS;
/// (short)CSmcConst.CSMC_INC;
/// </summary>
public short BCoordinate { get; set; }
/// <summary>
/// 目标位置
/// </summary>
public short TargetPosition { get; set; }
/// <summary>
/// 速度倍率
/// </summary>
public double ResolveSpeed { get; set; }
/// <summary>
/// 开始速度
/// </summary>
public double StartSpeed { get; set; }
/// <summary>
/// 目标速度
/// </summary>
public double TargetSpeed { get; set; }
/// <summary>
/// 加速时间
/// </summary>
public short AccelTime { get; set; }
/// <summary>
/// 减速时间
/// </summary>
public short DecelTime { get; set; }
/// <summary>
/// SSpeed
/// </summary>
public double SSpeed { get; set; }
}
}
...@@ -80,10 +80,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -80,10 +80,7 @@ namespace OnlineStore.DeviceLibrary
/// 移动信息 /// 移动信息
/// </summary> /// </summary>
public StoreMoveInfo StoreMove = null; public StoreMoveInfo StoreMove = null;
///// <summary>
///// 回原点,所有装置回到原点位置
///// </summary>
//public abstract void Home();
/// <summary> /// <summary>
/// 定时处理,监听信号,监听IO /// 定时处理,监听信号,监听IO
/// </summary> /// </summary>
...@@ -105,25 +102,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -105,25 +102,7 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
/// <summary>
/// 判断急停是否开着,开着表示可以运行
/// </summary>
/// <returns></returns>
public Boolean ShutdownIsOpen()
{
if (DeviceControl.isNoDeviceDebug)
{
return true;
}
//急停按钮和气压检测需要一起判断
IO_VALUE suddenBtn = GetDeviceIO(Store_IO_Type.SuddenStop_BTN);
IO_VALUE airCheck = GetDeviceIO(Store_IO_Type.Airpressure_Check);
if (suddenBtn == IO_VALUE.HIGH && airCheck == IO_VALUE.HIGH)
{
return true;
}
return false;
}
public string GetRunStr() public string GetRunStr()
{ {
string sta = "运行中"; string sta = "运行中";
...@@ -199,175 +178,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -199,175 +178,6 @@ namespace OnlineStore.DeviceLibrary
return sta; return sta;
} }
} }
#region IO运动和等待
/// <summary>
/// 气缸移动方法,将IoLowType的DO写为0,IoHighType的DO写为1
/// 此方法不加入等待条件
/// </summary>
public void CylinderMove(string IoLowType, string IoHighType)
{
DeviceIOMove(IoLowType, IO_VALUE.LOW);
DeviceIOMove(IoHighType, IO_VALUE.HIGH);
}
/// <summary>
///气缸移动方法,将IoLowType的DO写为0,IoHighType的DO写为1
///此方法会自动加入等待条件
/// </summary>
public void CylinderMove(StoreMoveInfo moveInfo, string IoLowType, string IoHighType)
{
DeviceIOMove(IoLowType, IO_VALUE.LOW);
DeviceIOMove(IoHighType, IO_VALUE.HIGH);
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
}
//记录上次 写入的DO的值,下次不要重复写
protected Dictionary<string , IO_VALUE> DOValueMap = new Dictionary<string , IO_VALUE>();
protected object doMapLock = "";
protected void UpdateDoValue(string ioType,IO_VALUE doValue){
lock (doMapLock)
{
if (DOValueMap.ContainsKey(ioType))
{
DOValueMap[ioType]=doValue;
}else{
DOValueMap.Add(ioType, doValue);
}
}
}
/// <summary>
/// 判断Do是否是传入的值
/// </summary>
protected bool IsDoValue(string ioType, IO_VALUE doValue)
{
lock (doMapLock)
{
if (DOValueMap.ContainsKey(ioType))
{
if (doValue.Equals(DOValueMap[ioType]))
{
return true;
}
}
} return false;
}
public void DeviceIOMove(string ioType, IO_VALUE ioValue)
{
if (DOList.ContainsKey(ioType))
{
DeviceControl.WriteSingleIO(DOList[ioType], ioValue);
UpdateDoValue(ioType, ioValue);
}
else
{
LogUtil.error(LOGGER, StoreName + "没有DO=" + ioType);
}
}
public IO_VALUE GetDeviceIO(string ioType)
{
if (DIList.ContainsKey(ioType))
{
return DeviceControl.GetSingleIO(DIList[ioType]);
}
else
{
//这些IO只有DO没有DI,根据DO的值来判断
if (
//自动料仓的DO
ioType.Equals(Store_IO_Type.Run_Sign)
|| ioType.Equals(Store_IO_Type.Axis_Brake)
|| ioType.Equals(Store_IO_Type.StartOrStopBlow)
|| ioType.Equals(Store_IO_Type.StopCylinder_1)
|| ioType.Equals(Store_IO_Type.StopCylinder_2)
//流水线的DO
|| ioType.Equals(Store_IO_Type.AutoRun_HddLed)
|| ioType.Equals(Store_IO_Type.RunSign_HddLed)
|| ioType.Equals(Store_IO_Type.Alarm_HddLed)
|| ioType.Equals(Store_IO_Type.DriveMotor1_Forward)
|| ioType.Equals(Store_IO_Type.DriveMotor1_Back)
|| ioType.Equals(Store_IO_Type.DriveMotor2_Forward)
|| ioType.Equals(Store_IO_Type.DriveMotor2_Back)
)
{
return DeviceControl.GetSingleIO(DOList[ioType]);
}
else
{
LogUtil.error(LOGGER, StoreName + "没有DI=" + ioType);
}
return IO_VALUE.LOW;
}
}
///// <summary>
///// IO运动,将指定的IO类型写为指定的置,并等待检测结果成功,方法执行完毕
///// </summary>
///// <param name="ioMap">key=Store_IO_Type,value=需要写入和等待的值</param>
//protected void DeviceIOMoveAndWait(string ioType, IO_VALUE ioValue)
//{
// DeviceIOMove(ioType, ioValue);
// WaitIO(ioType, ioValue);
//}
///// <summary>
///// IO运动,将指定的IO类型写为指定的置,并等待检测结果成功,方法执行完毕
///// </summary>
///// <param name="ioMap">key=Store_IO_Type,value=需要写入和等待的值</param>
//protected void DeviceIOMove(Dictionary<string, IO_VALUE> ioMap)
//{
// foreach (string ioType in ioMap.Keys)
// {
// IO_VALUE value = ioMap[ioType];
// DeviceIOMove(ioType, value);
// }
//}
/// <summary>
/// 验证指定的IO是否达到对应值
/// </summary>
/// <param name="ioMap">key=Store_IO_Type,value=需要到达的值</param>
protected bool CheckIO(Dictionary<string, IO_VALUE> ioMap)
{
bool isAllOk = true;
foreach (string ioType in ioMap.Keys)
{
IO_VALUE value = ioMap[ioType];
if (GetDeviceIO(ioType).Equals(value) ||
(ioType.Equals(Store_IO_Type.Fixture_Check_1) && NoFixture_Check)
|| DeviceControl.isNoDeviceDebug)
{
}
else
{
isAllOk = false;
}
}
return isAllOk;
}
/// <summary>
/// 验证指定的IO达到对应的值后返回
/// </summary>
/// <param name="ioMap">key=Store_IO_Type,value=需要验证的值</param>
protected bool CheckIO(string ioType, IO_VALUE ioValue)
{
if (GetDeviceIO(ioType).Equals(ioValue)
|| (ioType.Equals(Store_IO_Type.Fixture_Check_1) && NoFixture_Check)
|| DeviceControl.isNoDeviceDebug)
{
return true;
}
return false;
}
/// <summary>
/// TODO:暂时没有夹具检测,调试时暂时=true,后面有信号需要删掉
/// </summary>
private bool NoFixture_Check = false;
#endregion
} }
} }
...@@ -85,7 +85,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -85,7 +85,7 @@ namespace OnlineStore.DeviceLibrary
return host + api_nextFeeder; return host + api_nextFeeder;
} }
public static void UpdateConfig(KTK_LA_LINE_Config lineConfig) public static void UpdateConfig(AC_SA_Config lineConfig)
{ {
try try
{ {
......
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1"/>
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key ="StartBlowValue" value ="4"/>
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
<add key ="StopBlowValue" value ="4"/>
<!--摄像机名称列表配置,用#分割-->
<add key ="CameraName" value ="192168024#192168025"/>
<!--二维码类型列表配置,用#分割-->
<add key ="CodeType" value ="QR Code#Data Matrix ECC 200"/>
<add key="App_Title" value="KTK_SA_料仓"/>
<add key="scanner_start_command" value="S"/>
<add key="ProgramConfig" value="\StoreConfig\SA-boshi\programConfig.csv"/>
<!--Server address-->
<add key="http.server" value="localhost/myproject/"/>
<!--storeType-->
<add key="store_count" value="1"/>
<!--start one store config-->
<add key="Store_Position_Config" value="\StoreConfig\SA-boshi\linePositions.csv"/>
<add key="Store_ConfigPath" value="\StoreConfig\SA-boshi\StoreConfig.csv"/>
<add key="Store_Type" value="RC_KTK_SA"/>
<add key="Store_CID" value="boshi1"/>
<!--end one store config-->
<!--康泰克运动默认参数:速度倍率,起始速度,目标速度,加速时间,减速时间,SSpeed,目标位置,默认运动轴-->
<add key="KTK_MOVE_ResolveSpeed" value="10"/>
<add key="KTK_MOVE_StartSpeed" value="1000"/>
<add key="KTK_MOVE_TargetSpeed" value="20000"/>
<add key="KTK_MOVE_AccelTime" value="500"/>
<add key="KTK_MOVE_lDecelTime" value="500"/>
<add key="KTK_MOVE_SSpeed" value="5000"/>
<add key="KTK_MOVE_Distance" value="10000"/>
<add key="KTK_MOVE_AxisNo" value="1"/>
</appSettings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/SingleStore.log"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<root>
<level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/>
</root>
</log4net>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe %~dp0\SMD-SAStoreSystem.exe
Net Start SMD-SAStoreSystem
sc config SMD-SAStoreSystem start= auto
pause
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E5CB4C92-F66C-4811-8662-5625204279A2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>KTKSAStoreSystem</RootNamespace>
<AssemblyName>SMD-SAStoreSystem</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>KTKSAStoreSystem.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\dll\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="StoreSystem.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="StoreSystem.Designer.cs">
<DependentUpon>StoreSystem.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="Install.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Uninstall.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="更新记录\20170925更新.zip" />
<None Include="更新记录\20170929更新SMD-SAStoreSystem服务.zip" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\DeviceLibrary\DeviceLibrary.csproj">
<Project>{513bc1c9-800d-43a6-9499-3700baec3554}</Project>
<Name>DeviceLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\LoadCVSLibrary\LoadCSVLibrary.csproj">
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="StoreSystem.resx">
<DependentUpon>StoreSystem.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="更新记录\20170925更新\20170925更新说明.txt" />
<Content Include="更新记录\20170925更新\UpdateFile\Common.dll" />
<Content Include="更新记录\20170925更新\UpdateFile\DeviceLibrary.dll" />
<Content Include="更新记录\20170925更新\UpdateFile\LoadCSVLibrary.dll" />
<Content Include="更新记录\20170925更新\UpdateFile\SMD-SAStoreSystem.exe" />
<Content Include="更新记录\20170925更新\UpdateFile\SMD-SAStoreSystem.vshost.exe" />
<Content Include="更新记录\20170929更新\20170929更新说明.txt" />
<Content Include="更新记录\20170929更新\UpdateFile\Common.dll" />
<Content Include="更新记录\20170929更新\UpdateFile\DeviceLibrary.dll" />
<Content Include="更新记录\20170929更新\UpdateFile\LoadCSVLibrary.dll" />
<Content Include="更新记录\20170929更新\UpdateFile\SMD-SAStoreSystem.exe" />
<Content Include="更新记录\20170929更新\UpdateFile\SMD-SAStoreSystem.vshost.exe" />
<Content Include="更新记录\20170930更新\20170930更新说明.txt" />
<Content Include="更新记录\20170930更新\UpdateFile\Common.dll" />
<Content Include="更新记录\20170930更新\UpdateFile\DeviceLibrary.dll" />
<Content Include="更新记录\20170930更新\UpdateFile\LoadCSVLibrary.dll" />
<Content Include="更新记录\20170930更新\UpdateFile\SMD-SAStoreSystem.exe" />
<Content Include="更新记录\20170930更新\UpdateFile\SMD-SAStoreSystem.vshost.exe" />
<Content Include="更新记录\20171017更新\updateFile\Common.dll" />
<Content Include="更新记录\20171017更新\updateFile\DeviceLibrary.dll" />
<Content Include="更新记录\20171017更新\updateFile\LoadCSVLibrary.dll" />
<Content Include="更新记录\20171017更新\updateFile\SMD-SAStoreSystem.exe" />
<Content Include="更新记录\20171018更新\updateFile\Common.dll" />
<Content Include="更新记录\20171018更新\updateFile\DeviceLibrary.dll" />
<Content Include="更新记录\20171018更新\updateFile\LoadCSVLibrary.dll" />
<Content Include="更新记录\20171018更新\updateFile\SMD-SAStoreSystem.exe" />
<Content Include="更新记录\20171030更新\20171030更新说明.txt" />
</ItemGroup>
<ItemGroup>
<Folder Include="更新记录\20171030更新\UpdateFile\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file \ No newline at end of file
using log4net.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
namespace KTKSAStoreSystem
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
static void Main()
{
XmlConfigurator.Configure();
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new StoreSystem()
};
ServiceBase.Run(ServicesToRun);
}
}
}
namespace KTKSAStoreSystem
{
partial class ProjectInstaller
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.Description = "单台料仓";
this.serviceInstaller1.DisplayName = "SMD-SAStoreSystem";
this.serviceInstaller1.ServiceName = "SMD-SAStoreSystem";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1});
}
#endregion
private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
private System.ServiceProcess.ServiceInstaller serviceInstaller1;
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
namespace KTKSAStoreSystem
{
[RunInstaller(true)]
public partial class ProjectInstaller : System.Configuration.Install.Installer
{
public ProjectInstaller()
{
InitializeComponent();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="serviceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="serviceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
\ No newline at end of file \ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("KTKSAStoreSystem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KTKSAStoreSystem")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("2b45bdf3-7d20-41d2-86af-4d1ec81976f3")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
namespace KTKSAStoreSystem
{
partial class StoreSystem
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
//
// StoreSystem
//
this.CanHandlePowerEvent = true;
this.CanShutdown = true;
this.ServiceName = "Service1";
}
#endregion
}
}
using log4net;
using Microsoft.Win32;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
namespace KTKSAStoreSystem
{
public partial class StoreSystem : ServiceBase
{
public StoreSystem()
{
InitializeComponent();
}
public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private KTK_SA_BoxBean store = null;
protected override void OnStart(string[] args)
{
LogUtil.info(LOGGER, "Server OnStart Begin!");
try
{
this.store = SAStoreManager.InitStore();
if (store == null)
{
LogUtil.error(LOGGER, "加载料仓失败");
return;
}
}
catch (Exception ex)
{
LOGGER.Error("启动服务出错:" + ex.ToString());
}
// store.StartRun();
LogUtil.info(LOGGER, "Server OnStart End!");
}
protected override void OnStop()
{
LogUtil.info(LOGGER, "Server OnStop Begin !");
try
{
if (store != null)
{
if (store.storeRunStatus > StoreRunStatus.Wait)
{
store.StopRun();
}
KNDManager.CloseAllDO();
KNDManager.CloseAllConnection();
}
}
catch (Exception ex)
{
LOGGER.Error("关闭服务出错:" + ex.ToString());
}
LogUtil.info(LOGGER, "Server OnStop End !");
}
protected override void OnShutdown()
{
LogUtil.info(LOGGER, "Server OnShutdown Begin !");
base.OnShutdown();
LogUtil.info(LOGGER, "开始停止服务 !");
this.Stop();
LogUtil.info(LOGGER, "Server OnShutdown End !");
}
protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
{
//LogUtil.info(LOGGER, "Server OnPowerEvent Begin !");
LogUtil.info(LOGGER, "powerStatus=" + powerStatus);
bool result= base.OnPowerEvent(powerStatus);
if (powerStatus.Equals(PowerBroadcastStatus.Suspend))
{
LogUtil.info(LOGGER, "电源挂起,开始停止服务 !");
this.Stop();
}
return result;
//LogUtil.info(LOGGER, "Server OnPowerEvent End !");
}
////下面是系统注销或关闭事件处理程序,
//private void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
//{
// SessionEndReasons reason = e.Reason;
// switch (reason)
// {
// case SessionEndReasons.Logoff:
// LOGGER.Info("用户正在注销。");
// break;
// case SessionEndReasons.SystemShutdown:
// LOGGER.Info("操作系统正在关闭,停止服务");
// this.Stop();
// break;
// }
//}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
\ No newline at end of file \ No newline at end of file
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /u %~dp0\SMD-SAStoreSystem.exe
pause
\ No newline at end of file \ No newline at end of file
更新时间:20170925
此次更新修改的问题:
1.关机时服务没有关闭的问题
2.二维码识别添加 Data Matrix ECC 200 类型。
更新步骤:
1:停止SMD-SAStoreSystem服务
2.将电脑中SMD-SAStoreSystem文件夹备份(必须备份,若更新后运行失败,需要恢复),请记录备份时间,方便还原
3.将此文件夹UpdateFile中的文件复制到SMD-SAStoreSystem文件夹中,对原来的文件进行替换
4.启动SMD-SAStoreSystem服务
5.更新完成后请先测试一下基本的出入库功能,然后再检查BUG是否已修复
\ No newline at end of file \ No newline at end of file
更新时间:20170929
此次更新修改的问题:
1.灯闪烁太慢,把灯闪烁加入主定时器中处理
2.给服务器发送消息后要判断op进行相关处理
3.摄像机每次用的时候再打开
4.出入库时,如果叉子在门口操作时,就打开光源
更新步骤:
1:停止SMD-SAStoreSystem服务
2.将电脑中SMD-SAStoreSystem文件夹备份(必须备份,若更新后运行失败,需要恢复),请记录备份时间,方便还原
3.将此文件夹UpdateFile中的文件复制到SMD-SAStoreSystem文件夹中,对原来的文件进行替换
4.启动SMD-SAStoreSystem服务
5.更新完成后请先测试一下基本的出入库功能,然后再检查BUG是否已修复
\ No newline at end of file \ No newline at end of file
更新时间:20170930
此次更新修改的问题:
1.二维码格式改为:=x*y=code
2.与服务器通信添加op=4,表示扫码入库
更新步骤:
1:停止SMD-SAStoreSystem服务
2.将电脑中SMD-SAStoreSystem文件夹备份(必须备份,若更新后运行失败,需要恢复),请记录备份时间,方便还原
3.将此文件夹UpdateFile中的文件复制到SMD-SAStoreSystem文件夹中,对原来的文件进行替换
4.启动SMD-SAStoreSystem服务
5.更新完成后请先测试一下基本的出入库功能,然后再检查BUG是否已修复
\ No newline at end of file \ No newline at end of file
更新时间:20171030
此次更新修改的问题:
1.使用两个摄像机识别二维码
更新步骤:
1:停止SMD-SAStoreSystem服务
2.将电脑中SMD-SAStoreSystem文件夹备份(必须备份,若更新后运行失败,需要恢复),请记录备份时间,方便还原
3.将此文件夹UpdateFile中的文件复制到SMD-SAStoreSystem文件夹中,对原来的文件进行替换
4.增加配置:
在SMD-SAStoreSystem\SMD-SAStoreSystem.exe.config中增加如下配置:
<!--摄像机名称列表配置,用#分割-->
<add key ="CameraName" value ="192168024#192168025"/>
<!--二维码类型列表配置,用#分割-->
<add key ="CodeType" value ="QR Code#Data Matrix ECC 200"/>
5.启动SMD-SAStoreSystem服务
6.更新完成后请先测试一下基本的出入库功能,然后再检查BUG是否已修复
\ No newline at end of file \ No newline at end of file
此文件的差异太大,无法显示。
此文件的差异太大,无法显示。
此文件的差异太大,无法显示。
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!