修改分垛入库部分内容

dev
liulb@mesnac.com 12 months ago
parent aa33ac5a0b
commit b16b4eda05

@ -1,114 +0,0 @@
using Aucma.Core.Palletiz.Models;
using Aucma.Core.Palletiz.ViewModels;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Aucma.Core.Palletiz.Business
{
public class ControlStackingScan
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(ControlStackingScan));
#region 首页提示事件
public delegate void HandPalletizDelegate(string mesg, string color);
public static event HandPalletizDelegate? HandPalletizDelegateEvent;
#endregion
#region 下传分垛信息
/// <summary>
/// 下传分垛信息
/// </summary>
/// <returns></returns>
public static bool DownLoadInInfo(StackInfoModel TempStackInInfo)
{
bool ResultFlag = false;
try
{
#region 下传入库货道信息
//下传信息包含 目的货道、物料编码、工艺编码
bool wresult1 = WriteData();
if (!wresult1)
{
log.Info("下传分垛信息出现异常请检查PLC连接.");
HandPalletizDelegateEvent?.Invoke("下传分垛信息出现异常请检查PLC连接.","Red");
return false;
}
string TempStr = "下传分垛信息出现完成等待PLC反馈......";
HandPalletizDelegateEvent?.Invoke(TempStr, "White");
log.Info(TempStr);
string Infostr = "";
//返回结果处理
while (true)
{
Thread.Sleep(200);
Infostr = string.Format("下传分垛信息成功,成功接收反馈信息.");
//创建入库记录及任务
//SysBusinessFunction.WriteLog(Infostr);
//SysBusinessFunction.OperationTipsAdd(Infostr);
//SysBusinessFunction.AssemblyTaryInfo.Tips = Infostr;
//SysBusinessFunction.TempStackingInfo.MsgInfo = Infostr;
ResultFlag = true;
break;
}
#endregion
}
catch (Exception ex)
{
log.Error("error:接收返回消息异常!具体原因:" + ex.Message);
}
finally
{
}
return ResultFlag;
}
#endregion
//下传数据
public static bool WriteData()
{
bool TempResult = true;
//写入三菱PLC
if (TempResult)
{
try
{
//获取扫码器给到的成品码
//根据成品码获读取货道、最后一次物料入库的角度
//根据角度设定给当前物料设置角度
//下发给PLC:货道号、角度
//是否下传成功,成功后将信息保存到入库记录中
do
{
} while (true);
}
catch
{
}
finally
{
TempResult = true;
}
}
return TempResult;
}
}
}

@ -6,15 +6,12 @@ using Aucma.Core.HwPLc;
using Aucma.Core.Scanner;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using NetTaste;
using Org.BouncyCastle.Asn1.Tsp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
namespace Aucma.Core.Palletiz.Business
{
@ -48,7 +45,6 @@ namespace Aucma.Core.Palletiz.Business
private readonly IRecordInStoreServices? _recordInstoreServices = App.ServiceProvider.GetService<IRecordInStoreServices>();
#endregion
public void test()
{
// B240101 8302501416 0001 SN:16160030000000910999
@ -87,6 +83,7 @@ namespace Aucma.Core.Palletiz.Business
{
logHelper.Error("未找到匹配货道,请手动入库!");
// 刷新页面提示信息
Console.WriteLine("未找到匹配货道,请手动入库!");
return;
}
// 过滤货道,找到最终需要下发的货道
@ -100,11 +97,12 @@ namespace Aucma.Core.Palletiz.Business
plcResult = sendAndAnswerPlc(scannerIp, spaceList[0].RotationRange, spaceNumList);
recordInstore.SpaceCode = finalSpace.SpaceCode;
recordInstore.StoreCode = finalSpace.StoreCode;
// 更新货道信息,大产品last存objId大的如货道7,8存8
// 更新货道信息,大产品last存objId大的储存上一个货道的主键 如货道7,8存8
BaseSpaceInfo otherSpace = getOtherSpace(finalSpace, spaceList);
if (otherSpace != null)
{
updateSapceList(otherSpace.ObjId,spaceList);
Console.WriteLine("更新货道信息成功!");
}
}
else
@ -115,14 +113,16 @@ namespace Aucma.Core.Palletiz.Business
spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3)));
spaceNumList.Add(0);
plcResult = sendAndAnswerPlc(scannerIp, finalSpace.RotationRange, spaceNumList);
updateSapceList(finalSpace.ObjId, spaceList);
updateSapceList(finalSpace.ObjId, spaceList);
Console.WriteLine("更新货道信息成功!");
}
else
{
spaceNumList.Add(0);
spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3)));
plcResult = sendAndAnswerPlc(scannerIp, finalSpace.RotationRange, spaceNumList);
updateSapceList(finalSpace.ObjId, spaceList);
updateSapceList(finalSpace.ObjId, spaceList);
Console.WriteLine("更新货道信息成功!");
}
}
@ -359,12 +359,14 @@ namespace Aucma.Core.Palletiz.Business
if (DateTime.Now > targetTime) // plc超最大时限无反馈
{
logHelper.Error("等待plc放行反馈信号超时");
Console.WriteLine("等待plc放行反馈信号超时");
return false;
}
// 应答字允许下发
if (obj.plc.ReadInt32("D102") == 2)
{
result = true;
Console.WriteLine("下发成功!");
break;
}
Thread.Sleep(500);

@ -28,7 +28,7 @@ namespace Aucma.Core.Palletiz.ViewModels
//MaterialName = "SC-AUCMA-农夫山泉SC";
//OrderNo = "8512365486";
//BeginTime = DateTime.Now.ToString("yyyy-mm-dd HH:mm:ss");
TotalEnterStoreNum = 0;
InitEveryDayMethod();
MsgInfo = "提示信息";
ControlStackingScan.HandPalletizDelegateEvent += PromptInfo;
@ -265,7 +265,6 @@ namespace Aucma.Core.Palletiz.ViewModels
}
#endregion
#region 日产量柱状图
/// <summary>
@ -306,5 +305,19 @@ namespace Aucma.Core.Palletiz.ViewModels
set { productionHourList = value; }
}
#endregion
#region 总计入库数量
private int _totalEnterStoreNum;
public int TotalEnterStoreNum
{
get { return _totalEnterStoreNum; }
set
{
_totalEnterStoreNum = value;
OnPropertyChanged(nameof(_totalEnterStoreNum));
}
}
#endregion
}
}

@ -23,7 +23,6 @@ namespace Aucma.Core.Palletiz.ViewModels
{
public partial class SelectTypeViewModel : ObservableObject
{
/// <summary>
/// 委托,关闭窗口
/// </summary>
@ -45,6 +44,7 @@ namespace Aucma.Core.Palletiz.ViewModels
private string spaceCodes = string.Empty;
private AppConfigHelper appConfig = new AppConfigHelper();
#region 构造函数
public SelectTypeViewModel(BaseSpaceInfo space)
{
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
@ -56,8 +56,9 @@ namespace Aucma.Core.Palletiz.ViewModels
//加载快捷方式
SaveSearchCriteria();
Load(space);//加载货道
}
}
#endregion
#region 快捷查询
/// <summary>

@ -157,7 +157,7 @@
<TextBlock Text="入库数量" Foreground="White" FontSize="20"/>
</Border>
<Border Grid.Row="1" Grid.RowSpan="2" Grid.Column="5">
<TextBlock Text="255" Foreground="White" FontSize="40" FontWeight="Bold"/>
<TextBlock Text="{Binding TotalEnterStoreNum}" Foreground="White" FontSize="40" FontWeight="Bold"/>
</Border>
<Border Grid.Row="3" Grid.RowSpan="2" Grid.Column="5">
<Button Content="手动分垛" x:Name="hand" FontSize="20" Width="150" VerticalAlignment="Center" Command="{Binding HandPalletizCommand}" />

@ -101,12 +101,12 @@
<DataGridTextColumn Binding="{Binding RotationRange}" Header="转向角度" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<!--<DataGridTextColumn Binding="{Binding IsTwoSpace}" Header="是否大产品(占两道)" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<!--<DataGridTextColumn Binding="{Binding LastSpace}" Header="上次入货道" Width="1*" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<DataGridTemplateColumn Header="是否大产品(占两道)" Width="2*" >
<DataGridTemplateColumn Header="是否大产品(占两道)" Width="0.8*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<WrapPanel>
<TextBlock Text=""/>
</WrapPanel>
<!--<WrapPanel>
<TextBlock Width="10" Height="10" />
</WrapPanel>-->
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellStyle>
@ -116,7 +116,7 @@
<Setter Property="Background" Value="Red"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsTwoSpace}" Value="0">
<Setter Property="Background" Value="White"/>
<Setter Property="Background" Value="YellowGreen"/>
</DataTrigger>
</Style.Triggers>
</Style>

@ -209,21 +209,10 @@
"Enabled": true,
"IP": "127.0.0.1",
"Port": 6000
},
{
"Id": 2,
"EquipName": "B库Plc",
"PlcType": "Melsec",
"Enabled": true,
"IP": "127.0.0.1",
"Port": 6001
}
],
"StoreInfo": {
"ShellInventoryStoreCode": "XKK-001",
"LinerInventory": "NDK-001",
"AfterStoreCode": "PHK-001",
"BeforeStoreCode": "PQK-001",
"StationName": "成品分垛入库",
"PalletizStoreCodeA": "FDK-001",
"PalletizStoreCodeB": "FDK-002",
"ProductlineCode": "CX_02"

@ -9,7 +9,15 @@ namespace Aucma.Core.Scanner
public class ScannerService : IScannerService
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(ScannerService));
#region 分垛处理事件
/// <summary>
/// 分垛委托
/// </summary>
/// <param name="productNo">产品编码</param>
public delegate void HandlePalletizDelegate(string productNo);
public static event HandlePalletizDelegate? HandlePalletizDelegateEvent;
#endregion
public async Task StartScannerAsync()
{

Loading…
Cancel
Save