大改前备份

foamRearStore
liuwf 10 months ago
parent 5d47a04f7b
commit 29f8194841

Binary file not shown.

@ -193,6 +193,7 @@ namespace Aucma.Scada.Business
{
try
{
// plc报警信息清除
taskHandle.SendPlcWarnInfo(0);
@ -208,6 +209,7 @@ namespace Aucma.Scada.Business
{
PrintLogInfoMessage($"匹配货道:{spaceInfo.spaceName}");
spaceInfo.materialType = materialType;
spaceInfo.typeNameA = GetMaterialName(materialType);
RefreshScanMateriaCodeEvent?.Invoke(materialCode, GetMaterialName(materialType), spaceInfo.spaceName, appConfig.foamStoreCode); //刷新界面扫码信息
var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务
if (result)
@ -386,9 +388,6 @@ namespace Aucma.Scada.Business
}
///// <summary>
///// 泡后执行反馈
///// </summary>
@ -579,7 +578,7 @@ namespace Aucma.Scada.Business
BaseSpaceInfo result = null;
try
{
List<BaseSpaceInfo> info = _spaceInfoService.GetBaseSpaceInfosByMaterialType(storeCode, materialType);
List<BaseSpaceInfo> info = _spaceInfoService.GetBaseSpaceInfosByMaterialType(storeCode, materialType,1);
if (info != null)
{

@ -15,7 +15,7 @@ namespace Aucma.Scada.Business
/// <summary>
/// 入库任务处理
/// </summary>
internal sealed class InStoreTaskHandle
public sealed class InStoreTaskHandle
{
#region 单例实现
private static readonly Lazy<InStoreTaskHandle> lazy = new Lazy<InStoreTaskHandle>(() => new InStoreTaskHandle());
@ -43,6 +43,12 @@ namespace Aucma.Scada.Business
private JsonChange json = JsonChange.Instance;
/// <summary>
/// 货道信息
/// </summary>
private IBaseSpaceInfoService _spaceInfoService;
/// <summary>
/// 已下传的任务信息
/// </summary>
@ -67,6 +73,15 @@ namespace Aucma.Scada.Business
#region 委托事件
/// <summary>
/// 实时库存刷新
/// </summary>
/// <param name="message"></param>
public delegate void RefreshFoamStock();
public event RefreshFoamStock RefreshFoamStockEvent;
/// <summary>
/// 入库应答PLC收到下发的入库任务后进行应答
/// </summary>
@ -86,6 +101,7 @@ namespace Aucma.Scada.Business
private InStoreTaskHandle()
{
_taskInfoService = registerServices.GetService<IRealTaskInfoService>();
_spaceInfoService = registerServices.GetService<IBaseSpaceInfoService>();
_plcDictionary = _pool.GetAll();
// 程序启动查询数据库
foamRearTaskInfos = _taskInfoService.GetTaskInfosForInstore(appConfig.foamStoreCode, appConfig.instoreTaskType, 2);
@ -93,6 +109,7 @@ namespace Aucma.Scada.Business
RealReadPlcSpace();
SendHeart();
RealUpdateSpaceInfoByPlc();
// RealReadFinish(); change-入库完成信号改回监测在途数
// test();
}
@ -109,6 +126,59 @@ namespace Aucma.Scada.Business
// });
//}
/// <summary>
/// 实时读取plc更新数据库货道数量及在途
/// </summary>
private void RealUpdateSpaceInfoByPlc()
{
Task.Run(() =>
{
Thread.Sleep(2000);
while (true)
{
List<BaseSpaceInfo> spaceList = _spaceInfoService.GetSpaceInfosByStoreCode(appConfig.foamStoreCode);
if (spaceList != null && spaceList.Count > 0)
{
foreach (BaseSpaceInfo spaceInfo in spaceList)
{
int Stock = spaceInfo.spaceStock;
int OnAmount = spaceInfo.onRouteAmount;
ReadSpaceInfoByPlc(spaceInfo);
if (spaceInfo.spaceStock == 0 && spaceInfo.onRouteAmount == 0)
{
// 清空型号供新型号使用
spaceInfo.materialType = null;
spaceInfo.typeNameA = null;
//重置货道,可以再次入库
spaceInfo.inStoreFlag = 1;
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
RefreshFoamStockEvent?.Invoke();
}
// 更新库存
if (Stock != spaceInfo.spaceStock || OnAmount != spaceInfo.onRouteAmount)
{
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
RefreshFoamStockEvent?.Invoke();
}
}
}
Thread.Sleep(3000);
}
});
}
/// <summary>
/// 心跳
/// </summary>

@ -1,8 +1,10 @@
using Aucma.Core.Scanner;
using Aucma.Scada.HikRobot;
using HighWayIot.Config;
using HighWayIot.Log4net;
using HighWayIot.Plc;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Aucma.Scada.Business
@ -58,13 +60,19 @@ namespace Aucma.Scada.Business
{
try
{
MvCodeHelper.DeviceListAcq();//获取创建设备
MvCodeHelper.StartGrab(); // 开启触发扫码接收数据
Task.Run(() =>
{
Thread.Sleep(2000);
MvCodeHelper.Shell();
});
}
catch (Exception ex)
{
MvCodeHelper.CloseAllDevice();
InitHikRobot();
Console.WriteLine("InitHikRobotAndGun()开启海康扫码器和扫码枪方法异常" + ex.Message.ToString());
}
}
@ -75,7 +83,7 @@ namespace Aucma.Scada.Business
{
try
{
MvCodeHelper.CloseAllDevice();
// MvCodeHelper.CloseAllDevice();
}
catch (Exception ex)
{

@ -178,6 +178,9 @@ namespace Aucma.Scada.Business
if (result)
{
PrintLogInfoMessage("出库任务创建成功");
// 出过的库标记,禁止再次入库
spaceInfo.inStoreFlag = 2;
_spaceInfoService.UpdateSpaceInfo(spaceInfo);
}
else
{
@ -762,7 +765,7 @@ namespace Aucma.Scada.Business
try
{
List<BaseSpaceInfo> info = _spaceInfoService.GetBaseSpaceInfosByMaterialType(storeCode, materialType);
List<BaseSpaceInfo> info = _spaceInfoService.GetBaseSpaceInfosByMaterialType(storeCode, materialType,2);
if (info != null)
{

@ -46,7 +46,7 @@ namespace Aucma.Scada.UI
private void Application_Exit(object sender, ExitEventArgs e)
{
mainBusiness.DisConnectPlc();
mainBusiness.ExitHikRobot();
// mainBusiness.ExitHikRobot();
logHelper.Info("程序退出");
}

@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{43123E0B-B3B0-4FB4-A508-007D644B3E7C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<RootNamespace>Aucma.Scada.UI</RootNamespace>
<AssemblyName>Aucma.Scada.UI</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>

File diff suppressed because it is too large Load Diff

@ -24,5 +24,5 @@ instoreTaskType=1
outstoreTaskType=2
#泡后扫码器IP
foamHikRobotIp=169.254.100.169
foamHikRobotIp=10.10.92.133
searchItems=SC232%SC233%SC234%310%%%%

@ -1,5 +1,5 @@
[plcSystem]
ナンコ<EFBFBD>LCIP=10.10.92.40
ナンコ<EFBFBD>LCIP=10.10.92.49
ÅݺóPLC¶Ë¿Ú=2015
[foam_inStore_address]

@ -1,7 +1,7 @@
Aucma.Scada.UI
winexe
exe
C#
.cs
E:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\obj\Debug\

@ -1,7 +1,7 @@
Aucma.Scada.UI
winexe
exe
C#
.cs
E:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\obj\Debug\
@ -16,5 +16,5 @@ E:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\App.xaml
1371426297053
Page\AssemblyPlan\AssemblyPlanControl.xaml;Page\AssemblyPlan\PlanInfoEditWindow.xaml;Page\AssemblyPlan\QuantityIssuedWindow.xaml;Page\AssemblyPlan\SearchCriteriaWindow.xaml;Page\InStoreInfo\InStoreInfoControl.xaml;LogInfoControl.xaml;MainWindow.xaml;Page\InventoryInfo\BomFoamRearInventory.xaml;Page\InventoryInfo\InventoryInfoControl.xaml;Page\InventoryInfo\SelectType.xaml;Page\InventoryInfo\LinerInventory.xaml;Page\InventoryInfo\MaterialStatisticsWindow.xaml;Page\InventoryInfo\ShellInventory.xaml;Page\InventoryInfo\SpaceDetailWindow.xaml;Page\InventoryInfo\SpaceInfoControl.xaml;Page\OutStoreInfo\OutStoreInfoControl.xaml;Page\TaskInfo\TaskInfoControl.xaml;RecordControl.xaml;templates\style\resourceStyle.xaml;
False
True

@ -0,0 +1,21 @@
E:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\obj\Debug\GeneratedInternalTypeHelper.g.i.cs
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\App.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\AssemblyPlan\AssemblyPlanControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\AssemblyPlan\PlanInfoEditWindow.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\AssemblyPlan\QuantityIssuedWindow.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\AssemblyPlan\SearchCriteriaWindow.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InStoreInfo\InStoreInfoControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\LogInfoControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\MainWindow.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InventoryInfo\BomFoamRearInventory.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InventoryInfo\InventoryInfoControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InventoryInfo\LinerInventory.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InventoryInfo\MaterialStatisticsWindow.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InventoryInfo\ShellInventory.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InventoryInfo\SpaceDetailWindow.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\InventoryInfo\SpaceInfoControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\OutStoreInfo\OutStoreInfoControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\TaskInfo\TaskInfoControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\RecordControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\templates\style\resourceStyle.xaml;;

@ -1,4 +1,4 @@

E:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\obj\Debug\GeneratedInternalTypeHelper.g.cs
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\App.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\AssemblyPlan\AssemblyPlanControl.xaml;;
FE:\c#\AUCMA\aucma.scada\foam\Aucma.Scada.UI\Page\AssemblyPlan\PlanInfoEditWindow.xaml;;

@ -1,62 +1,2 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace XamlGeneratedNamespace {
/// <summary>
/// GeneratedInternalTypeHelper
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed class GeneratedInternalTypeHelper : System.Windows.Markup.InternalTypeHelper {
/// <summary>
/// CreateInstance
/// </summary>
protected override object CreateInstance(System.Type type, System.Globalization.CultureInfo culture) {
return System.Activator.CreateInstance(type, ((System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic)
| (System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.CreateInstance)), null, null, culture);
}
/// <summary>
/// GetPropertyValue
/// </summary>
protected override object GetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, System.Globalization.CultureInfo culture) {
return propertyInfo.GetValue(target, System.Reflection.BindingFlags.Default, null, null, culture);
}
/// <summary>
/// SetPropertyValue
/// </summary>
protected override void SetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, object value, System.Globalization.CultureInfo culture) {
propertyInfo.SetValue(target, value, System.Reflection.BindingFlags.Default, null, null, culture);
}
/// <summary>
/// CreateDelegate
/// </summary>
protected override System.Delegate CreateDelegate(System.Type delegateType, object target, string handler) {
return ((System.Delegate)(target.GetType().InvokeMember("_CreateDelegate", (System.Reflection.BindingFlags.InvokeMethod
| (System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)), null, target, new object[] {
delegateType,
handler}, null)));
}
/// <summary>
/// AddEventHandler
/// </summary>
protected override void AddEventHandler(System.Reflection.EventInfo eventInfo, object target, System.Delegate handler) {
eventInfo.AddEventHandler(target, handler);
}
}
}


@ -28,6 +28,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
private OutStoreBusiness outStoreBusiness = OutStoreBusiness.Instance;
private InStoreBusiness inStoreBusiness = InStoreBusiness.Instance;
private InStoreTaskHandle taskHandle = InStoreTaskHandle.Instance;
private AppConfig appConfig = AppConfig.Instance;
@ -60,7 +61,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo
outStoreBusiness.RefreshStoreStockEvent += Query;
inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo;
taskHandle.RefreshFoamStockEvent += Query;
SelectTypeViewModel.RefreshPageEvent += Query;
Query();

@ -45,7 +45,7 @@ namespace HighWayIot.Repository.service
/// <param name="storeCode"></param>
/// <param name="materialType"></param>
/// <returns></returns>
List<BaseSpaceInfo> GetBaseSpaceInfosByMaterialType(string storeCode, string materialType);
List<BaseSpaceInfo> GetBaseSpaceInfosByMaterialType(string storeCode, string materialType, int taskType);
/// <summary>
/// 更新货道信息

@ -1,5 +1,6 @@
using Aucma.Scada.Model.domain;
using HighWayIot.Common;
using HighWayIot.Config;
using HighWayIot.Log4net;
using System;
using System.Collections.Generic;
@ -12,10 +13,15 @@ namespace HighWayIot.Repository.service.Impl
{
private Repository<BaseSpaceInfo> _mesRepository = new Repository<BaseSpaceInfo>("mes");
private Repository<RealTaskInfo> _realTaskInfoRepository = new Repository<RealTaskInfo>("mes");
private AppConfig appConfig = AppConfig.Instance;
private LogHelper logHelper = LogHelper.Instance;
private JsonChange jsonChange = JsonChange.Instance;
/// <summary>
/// 入库通过物料类型获取指定货道,如果没有对应类型的货道返回空白类型的货道
/// </summary>
@ -202,18 +208,35 @@ namespace HighWayIot.Repository.service.Impl
}
return result;
}
public List<BaseSpaceInfo> GetBaseSpaceInfosByMaterialType(string storeCode, string materialType)
/// <summary>
/// 筛选货道的时候,入库不能选择正在出库的货道,也不能选择出过还未出干净货道,出库不能选择正在入库的货道
/// </summary>
/// <param name="storeCode"></param>
/// <param name="materialType"></param>
/// <param name="taskType">找货道任务类型入库1出库2</param>
/// <returns></returns>
public List<BaseSpaceInfo> GetBaseSpaceInfosByMaterialType(string storeCode, string materialType,int taskType)
{
List<BaseSpaceInfo> spaceInfos = null;
try
{
Expression<Func<BaseSpaceInfo, bool>> exp = s1 => true;
exp = exp.And(x => x.storeCode == storeCode && x.materialType == materialType && x.spaceStatus == 1); //相同型号、启用状态的货道信息
if(taskType==1)
{
exp = exp.And(x => x.storeCode == storeCode && x.materialType == materialType && x.spaceStatus == 1 && x.inStoreFlag == 1); //相同型号、启用状态的货道信息
}else if (taskType == 2)
{
exp = exp.And(x => x.storeCode == storeCode && x.materialType == materialType && x.spaceStatus == 1); //相同型号、启用状态的货道信息
}
spaceInfos = _mesRepository.GetList(exp);
if (spaceInfos.Count == 0) //没有指定该类型物料的货道信息,需获取空白货道信息进行分配
spaceInfos = FilterSpaceList(spaceInfos,taskType);
if (spaceInfos==null || spaceInfos.Count == 0) //没有指定该类型物料的货道信息,需获取空白货道信息进行分配
{
spaceInfos = GetEmptySpaceInfo(storeCode);
}
@ -225,5 +248,41 @@ namespace HighWayIot.Repository.service.Impl
}
return spaceInfos;
}
/// <summary>
/// 入库过滤掉有出库任务的货道或者是出过货的货道20240315
/// 出库过滤掉有入库任务的货道
/// </summary>
/// <param name="spaceInfos"></param>
/// <returns></returns>
public List<BaseSpaceInfo> FilterSpaceList(List<BaseSpaceInfo> spaceInfos,int taskType)
{
try
{
if (taskType == 1) // 入库找货道
{
List<RealTaskInfo> taskList = _realTaskInfoRepository.GetList(x => x.storeCode == appConfig.foamStoreCode && x.taskType == 2);
List<BaseSpaceInfo> filteredBaseSpaceInfos = spaceInfos.Where(s => !taskList.Any(r => r.spaceCode == s.spaceCode)).ToList();
return filteredBaseSpaceInfos;
}else if (taskType == 2) // 出库找货道
{
List<RealTaskInfo> taskList = _realTaskInfoRepository.GetList(x => x.storeCode == appConfig.foamStoreCode && x.taskType == 1);
List<BaseSpaceInfo> filteredBaseSpaceInfos = spaceInfos.Where(s => !taskList.Any(r => r.spaceCode == s.spaceCode)).ToList();
return filteredBaseSpaceInfos;
}
}
catch (Exception ex)
{
logHelper.Info("FilterOutSpaceList异常"+ex.Message.ToString());
}
return null;
}
}
}
Loading…
Cancel
Save