Commit 69aaaa89 刘韬

1

1 个父辈 407fa49b
......@@ -122,38 +122,6 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 -->
<system.serviceModel>
<services>
<service name="AcStoreWCF.CWSMDBox">
<endpoint address="" binding="basicHttpBinding" contract="AcStoreWCF.ICWSMDBox">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/CWSMDBox/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
......
......@@ -319,9 +319,9 @@
this.cmbJianGe.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbJianGe.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbJianGe.FormattingEnabled = true;
this.cmbJianGe.Location = new System.Drawing.Point(231, 60);
this.cmbJianGe.Location = new System.Drawing.Point(192, 60);
this.cmbJianGe.Name = "cmbJianGe";
this.cmbJianGe.Size = new System.Drawing.Size(146, 28);
this.cmbJianGe.Size = new System.Drawing.Size(185, 28);
this.cmbJianGe.TabIndex = 282;
//
// label30
......@@ -332,7 +332,7 @@
this.label30.Location = new System.Drawing.Point(3, 59);
this.label30.Name = "label30";
this.label30.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.label30.Size = new System.Drawing.Size(222, 36);
this.label30.Size = new System.Drawing.Size(183, 36);
this.label30.TabIndex = 281;
this.label30.Text = "入库存料库位间隔:";
this.label30.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
......@@ -367,9 +367,9 @@
this.cmbPosition.Items.AddRange(new object[] {
"料仓0",
"料仓1"});
this.cmbPosition.Location = new System.Drawing.Point(231, 23);
this.cmbPosition.Location = new System.Drawing.Point(192, 23);
this.cmbPosition.Name = "cmbPosition";
this.cmbPosition.Size = new System.Drawing.Size(146, 28);
this.cmbPosition.Size = new System.Drawing.Size(185, 28);
this.cmbPosition.TabIndex = 174;
this.cmbPosition.SelectedIndexChanged += new System.EventHandler(this.cmbPosition_SelectedIndexChanged);
//
......@@ -381,7 +381,7 @@
this.label21.Location = new System.Drawing.Point(3, 19);
this.label21.Name = "label21";
this.label21.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.label21.Size = new System.Drawing.Size(222, 36);
this.label21.Size = new System.Drawing.Size(183, 36);
this.label21.TabIndex = 172;
this.label21.Text = "选择仓位:";
this.label21.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
......@@ -425,7 +425,7 @@
this.groupBox6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox6.Location = new System.Drawing.Point(8, 119);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(668, 286);
this.groupBox6.Size = new System.Drawing.Size(668, 274);
this.groupBox6.TabIndex = 302;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "批量上下料操作";
......@@ -572,7 +572,7 @@
this.tabControl1.Location = new System.Drawing.Point(0, 29);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1287, 533);
this.tabControl1.Size = new System.Drawing.Size(1008, 700);
this.tabControl1.TabIndex = 301;
//
// tabPage4
......@@ -582,7 +582,7 @@
this.tabPage4.Controls.Add(this.btnClearLog);
this.tabPage4.Location = new System.Drawing.Point(4, 30);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(1279, 499);
this.tabPage4.Size = new System.Drawing.Size(1000, 666);
this.tabPage4.TabIndex = 4;
this.tabPage4.Text = "日志";
//
......@@ -617,7 +617,7 @@
this.tabPage5.Controls.Add(this.groupBox3);
this.tabPage5.Location = new System.Drawing.Point(4, 30);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(994, 676);
this.tabPage5.Size = new System.Drawing.Size(1000, 666);
this.tabPage5.TabIndex = 5;
this.tabPage5.Text = "设备信息";
//
......@@ -686,7 +686,7 @@
this.tabPage2.Location = new System.Drawing.Point(4, 30);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(994, 676);
this.tabPage2.Size = new System.Drawing.Size(1000, 666);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "伺服调试";
//
......@@ -713,7 +713,7 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(988, 670);
this.panel1.Size = new System.Drawing.Size(994, 660);
this.panel1.TabIndex = 307;
//
// axisMoveControl1
......@@ -809,7 +809,7 @@
this.btnInOutP4.Location = new System.Drawing.Point(288, 246);
this.btnInOutP4.Name = "btnInOutP4";
this.btnInOutP4.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnInOutP4.Size = new System.Drawing.Size(190, 34);
this.btnInOutP4.Size = new System.Drawing.Size(174, 34);
this.btnInOutP4.TabIndex = 277;
this.btnInOutP4.Text = "进出轴仓门出料点P4:";
this.btnInOutP4.UseVisualStyleBackColor = true;
......@@ -1175,7 +1175,7 @@
this.btnInOutP2.Location = new System.Drawing.Point(12, 246);
this.btnInOutP2.Name = "btnInOutP2";
this.btnInOutP2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnInOutP2.Size = new System.Drawing.Size(190, 34);
this.btnInOutP2.Size = new System.Drawing.Size(174, 34);
this.btnInOutP2.TabIndex = 211;
this.btnInOutP2.Text = "进出轴吸盘取料点P2:";
this.btnInOutP2.UseVisualStyleBackColor = true;
......@@ -1226,7 +1226,7 @@
this.btnUpDownP1.Location = new System.Drawing.Point(12, 19);
this.btnUpDownP1.Name = "btnUpDownP1";
this.btnUpDownP1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpDownP1.Size = new System.Drawing.Size(226, 34);
this.btnUpDownP1.Size = new System.Drawing.Size(174, 34);
this.btnUpDownP1.TabIndex = 199;
this.btnUpDownP1.Text = "升降轴吸盘下方取料点P1:";
this.btnUpDownP1.UseVisualStyleBackColor = true;
......@@ -1306,7 +1306,7 @@
this.btnInOutP3.Location = new System.Drawing.Point(288, 208);
this.btnInOutP3.Name = "btnInOutP3";
this.btnInOutP3.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnInOutP3.Size = new System.Drawing.Size(190, 34);
this.btnInOutP3.Size = new System.Drawing.Size(174, 34);
this.btnInOutP3.TabIndex = 193;
this.btnInOutP3.Text = "进出轴库位取料点P3:";
this.btnInOutP3.UseVisualStyleBackColor = true;
......@@ -1354,7 +1354,7 @@
this.btnUpDownP6.Location = new System.Drawing.Point(288, 132);
this.btnUpDownP6.Name = "btnUpDownP6";
this.btnUpDownP6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpDownP6.Size = new System.Drawing.Size(190, 34);
this.btnUpDownP6.Size = new System.Drawing.Size(174, 34);
this.btnUpDownP6.TabIndex = 189;
this.btnUpDownP6.Text = "升降轴出料缓冲点P6:";
this.btnUpDownP6.UseVisualStyleBackColor = true;
......@@ -1386,7 +1386,7 @@
this.btnUpDownP4.Location = new System.Drawing.Point(288, 56);
this.btnUpDownP4.Name = "btnUpDownP4";
this.btnUpDownP4.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.btnUpDownP4.Size = new System.Drawing.Size(190, 34);
this.btnUpDownP4.Size = new System.Drawing.Size(174, 34);
this.btnUpDownP4.TabIndex = 165;
this.btnUpDownP4.Text = "升降轴入料缓冲点P4:";
this.btnUpDownP4.UseVisualStyleBackColor = true;
......@@ -1511,7 +1511,7 @@
this.tabPage_Pos.Location = new System.Drawing.Point(4, 30);
this.tabPage_Pos.Name = "tabPage_Pos";
this.tabPage_Pos.Padding = new System.Windows.Forms.Padding(3);
this.tabPage_Pos.Size = new System.Drawing.Size(994, 676);
this.tabPage_Pos.Size = new System.Drawing.Size(1000, 666);
this.tabPage_Pos.TabIndex = 6;
this.tabPage_Pos.Text = "库位调试";
this.tabPage_Pos.UseVisualStyleBackColor = true;
......@@ -1536,7 +1536,7 @@
this.语言});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1287, 29);
this.menuStrip1.Size = new System.Drawing.Size(1008, 29);
this.menuStrip1.TabIndex = 257;
this.menuStrip1.Text = "menuStrip1";
//
......@@ -1912,7 +1912,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1287, 562);
this.ClientSize = new System.Drawing.Size(1008, 729);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
......
......@@ -633,6 +633,11 @@ namespace OnlineStore.AutoInOutStore
{
positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config, "_" + store.StoreID.ToString());
}
if (ktkPosition.PositionNum.StartsWith("1#AC1_0A_"))
{
var fixposfile = Path.Combine(Path.GetDirectoryName(positionConfigFile), @"FixPositions.csv");
positionConfigFile = fixposfile;
}
bool result = CSVPositionReader<AutoStorePosition>.SavePostion(positionConfigFile, ktkPosition);
if (!result)
{
......
......@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SO815-AutoInOutStore-newui 3f2df85964baa20c171b0ce228d8bc29c4a2eb1f")]
[assembly: AssemblyProduct("SO815-AutoInOutStore-newui 407fa49b653c99a7b801432901b0ab5226d03f6b")]
[assembly: AssemblyCopyright("edf7e3d07d3c8cafa890a08f4b855e559a36d414")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......
......@@ -36,6 +36,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.Camera.VisionLib">
<HintPath>..\..\..\Camera\CameraVisionLib\bin\Debug\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="Asa.IOModule.AIOBOX, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
......@@ -71,6 +74,7 @@
<Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="acSingleStore\AutomaticBaiting.cs" />
<Compile Include="DeviceLibrary\AxisManager.cs" />
<Compile Include="DeviceLibrary\Camera.cs" />
<Compile Include="DeviceLibrary\halcon\CodeManager.cs" />
<Compile Include="DeviceLibrary\HC\HCAxisManager.cs" />
<Compile Include="DeviceLibrary\IO\HCIOManager.cs" />
......@@ -124,6 +128,7 @@
<None Include="StoreConfig\AC\StoreConfig.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="StoreConfig\Camera.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
......
using Asa.Camera;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore
{
public class HIKCamera
{
Thread camerathread;
static HIKCamera _camera;
Asa.Camera.VisionLib camera;
public static HIKCamera Current { get {
if (_camera == null)
_camera = new HIKCamera();
return _camera;
} }
public string Name = "";
public event EventHandler<Bitmap> camera_event;
public string DeviceName= "monitor1";
bool loop=true;
public void LoadCameraConfig()
{
string path = @".\StoreConfig\Camera.json";
if (!File.Exists(path))
{
LogUtil.error(Name + "找不到监控相机配置文件" + path);
return;
}
try
{
var configtxt = File.ReadAllText(path);
if (configtxt.IndexOf("Pwd") > 0) {
configtxt = configtxt.Replace("Pwd", "Password");
configtxt = configtxt.Replace("\"8000\"", "8000");
File.WriteAllText(path, configtxt);
}
var m = Regex.Match(configtxt, "name\".*?\"(.+)\"", RegexOptions.IgnoreCase);
DeviceName = m.Groups[1].Value;
camera = new VisionLib(path,true, "HIK.IPCamera");
}
catch (Exception e){
LogUtil.error(Name + "加载监控相机配置文件失败:"+ e.ToString());
return;
}
camera.Open(DeviceName);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp == null)
{
LogUtil.error(Name + $"监控相机打开失败");
}
loop = true;
camerathread = new Thread(new ThreadStart(startCamera));
camerathread.Start();
GC.KeepAlive(camerathread);
}
int errortimes = 0;
void startCamera()
{
while (loop)
{
try
{
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
errortimes = 0;
camera_event?.Invoke(this, bmp);
}
else if (bmp == null && errortimes < 5)
{
errortimes++;
LogUtil.error(Name + $"相机获取图像出错,{errortimes}");
}
else if (errortimes == 5)
{
camera.Close(DeviceName);
Thread.Sleep(1000);
camera.Open(DeviceName);
errortimes=0;
LogUtil.error(Name + $"相机错误次数过多,重新打开,{errortimes}");
Thread.Sleep(5000);
}
Thread.Sleep(1000 / 7);
}
catch {
errortimes++;
}
}
camera.Close(DeviceName);
camera.Dispose();
}
public void Close() {
LogUtil.info(Name + "线程退出");
loop = false;
}
public void CameraGrabOne(string filename)
{
try
{
LogUtil.info(Name + "库位文件名:" + filename);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
if (File.Exists(filename))
File.Delete(filename);
bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose();
}
}
catch (Exception e)
{
LogUtil.error(Name + e.ToString());
}
}
public string GetFixtureStateFilename(InOutStoreParam inOutParam,StoreMoveType storeMoveType, FixtureState fixtureState)
{
string dir = $"\\image\\Fixture\\{storeMoveType}\\{inOutParam.PositionNum}\\";
Directory.CreateDirectory(dir);
string filename = $"{inOutParam.WareNumber}@@{fixtureState}.jpg";
foreach (var x in Path.GetInvalidFileNameChars())
{
filename = filename.Replace(x.ToString(), "");
}
return dir + filename;
}
}
public enum FixtureState
{
In,
Up,
Down,
Out,
DoorIn,
DoorOut,
}
}
......@@ -159,9 +159,10 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(cameraNameList.Count()+" 开始取图片");
for (int i = 0; i < cameraNameList.Count(); i++)
{
var ci = i;
cameraTask[i] = Task.Run(() =>
{
var cameraName = cameraNameList[i];
var cameraName = cameraNameList[ci];
if (cameraName.Trim().Equals(""))
{
......
{
"HIKIPCamera": [
{
"Name": "monitor",
"IP": "192.168.1.64",
"User": "admin",
"Password": "Acc123456",
"Port": 8000
}
]
}
\ No newline at end of file
......@@ -552,7 +552,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info(LOGGER, StoreName + "复位完成检测到叉子有料,启动清料失败:无可用库位");
return false;
}
InOutStoreParam param = new InOutStoreParam("", PositionNumList[0]);
InOutStoreParam param = new InOutStoreParam("", PositionNumList[PositionNumList.Count-1]);
if (LoadParamPosition(param))
{
StoreMove.MoveParam = param;
......@@ -1912,10 +1912,7 @@ namespace OnlineStore.DeviceLibrary
public void OperationProcess(Operation resultOperation)
{
if (resultOperation.op.Equals(5))
{
ProcessHumidityCMD(resultOperation);
}
if (resultOperation.op.Equals(2))
{
try
......@@ -1933,7 +1930,10 @@ namespace OnlineStore.DeviceLibrary
//ReviceInStoreProcess("", resultOperation);
LogUtil.error("发送定时消息时,服务器返回Op=1 【" + json + "】");
}
else if (resultOperation.op.Equals(5))
{
ProcessHumidityCMD(resultOperation);
}
if (resultOperation.data != null)
{
string result = "";
......
......@@ -1004,7 +1004,7 @@ namespace OnlineStore.DeviceLibrary
movePfix.UpDown_P1 = Config.GetUpDownP1(StoreMove.MoveParam.PlateH);
movePfix.ComPress_P2 = moveP.ComPress_P2;
movePfix.ComPress_P3 = moveP.ComPress_P3;
movePfix.ComPress_P3 = Config.CompressAxis_P1_Position;//moveP.ComPress_P3;
movePfix.InOut_P3 = fixposition.InOutAxis_Position_P3;
movePfix.Middle_P2 = fixposition.MiddleAxis_Position_P2;
movePfix.UpDown_P3 = fixposition.UpDownAxis_IHPosition_P3;
......
......@@ -640,7 +640,7 @@ namespace OnlineStore.DeviceLibrary
}
if (LastHeight <= 8) { LastHeight = 8; }
//string code = CodeManager.ProcessCode(LastCodeList);
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[ " + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + LastCode + "】";
string msg = Name + " 计算盘高:上升前 [" + StartMovePosition + "]实时[" + EndMovePosition + "]差值[" + (EndMovePosition - StartMovePosition) + "]系数[" + AxisChangeValue + "] 计算后" + buchongStr + "[" + height + "]" + ",归类为【" + LastHeight + "mm】条码【" + LastCode + "】";
LogUtil.info(msg);
return LastHeight;
}
......@@ -691,7 +691,7 @@ namespace OnlineStore.DeviceLibrary
private static void SendTrayOut()
{
string posId = StoreManager.Store.PositionNumList[0];
string posId = StoreManager.Store.PositionNumList[StoreManager.Store.PositionNumList.Count-1];
//盘先根据高低排序
if (AllPosList == null)
{
......@@ -701,7 +701,7 @@ namespace OnlineStore.DeviceLibrary
List<AutoStorePosition> okList = (from m in AllPosList where m.BagHeight >= LastHeight select m).ToList<AutoStorePosition>();
if (okList.Count > 0)
{
posId = okList[0].PositionNum;
posId = okList[okList.Count-1].PositionNum;
}
else
{
......
......@@ -331,7 +331,12 @@ namespace OnlineStore.DeviceLibrary
}
else if (WaitType == 2)
{
return ResourceControl.GetString(ResourceControl.WaitIo, "IO信号等待") + "【" + IoType + "】=【" + IoValue + "】";
var iodef = "";
if (StoreManager.Config.DILIst.ContainsKey(IoType))
{
iodef = StoreManager.Config.DILIst[IoType].ElectricalDefinition + ";";
}
return ResourceControl.GetString(ResourceControl.WaitIo, "IO信号等待") + "【"+ iodef + IoType + "】=【" + IoValue + "】";
}
else if (WaitType == 3)
{
......
......@@ -156,6 +156,7 @@ namespace OnlineStore.LoadCSVLibrary
public static bool SavePostion(string filePath, T position)
{
Type type = typeof(T);
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!