liuwf 1 year ago
commit 14d36d929f

@ -2481,6 +2481,16 @@
所属产线
</summary>
</member>
<member name="P:Admin.Core.Model.OffLineInfo.SaveRetuenInfo">
<summary>
上传条码系统保存接口返回信息
</summary>
</member>
<member name="P:Admin.Core.Model.OffLineInfo.LoginTeam">
<summary>
当前登录班组(一线白班,一线夜班,二线白班,二线夜班)
</summary>
</member>
<member name="T:Admin.Core.Model.Perfusion_Alarm">
<summary>
灌注告警
@ -3521,7 +3531,7 @@
工位号
</summary>
</member>
<member name="P:Admin.Core.Model.TemperatureHistory.Cpno">
<member name="P:Admin.Core.Model.TemperatureHistory.CpNo">
<summary>
产品条码
</summary>
@ -3671,9 +3681,179 @@
低压启动测试电压
</summary>
</member>
<member name="P:Admin.Core.Model.TemperatureHistory.flag">
<member name="P:Admin.Core.Model.TemperatureHistory.SyncDate">
<summary>
同步时间
</summary>
</member>
<member name="T:Admin.Core.Model.TestedCode_MES">
<summary>
测温历史记录
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.ID">
<summary>
主键
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Line_No">
<summary>
线号
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Gongwno">
<summary>
工位号
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.CpNo">
<summary>
产品条码
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.CpModel">
<summary>
产品型号
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.FactoryModel">
<summary>
基准型号
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Voltage">
<summary>
工作电压
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Point2">
<summary>
测试通道
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.TestTime">
<summary>
计划测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.TestedTime">
<summary>
实际测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Etemp">
<summary>
环温
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.BeginDateTime">
<summary>
开始测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.CpResult">
<summary>
测试结果
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.EndDateTime">
<summary>
测试结束时间
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.UserName">
<summary>
系统用户
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.TestNo">
<summary>
第几次测试
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Temp_Mes">
<summary>
温度数据
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Power_Mes">
<summary>
功率数据
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.Part_Mes">
<summary>
部件测试数据
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.ErrorCode_Mes">
<summary>
故障代码
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.T1Name">
<summary>
内部传感器 1 名称
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.T2Name">
<summary>
内部传感器 2 名称
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.T3Name">
<summary>
内部传感器 3 名称
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.T4Name">
<summary>
内部传感器 4 名称
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.T5Name">
<summary>
内部传感器 5 名称
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.T6Name">
<summary>
内部传感器 6 名称
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.IsOrder">
<summary>
是否测试部件”Y”测试
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.LowV_Time">
<summary>
低压启动测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.LowV_PowerMin">
<summary>
低压启动标准下限
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.LowV_PowerMax">
<summary>
低压启动标准上限
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.LowV_PowerFact">
<summary>
同步标识
低压启动实际采集值
</summary>
</member>
<member name="P:Admin.Core.Model.TestedCode_MES.LowVoltage">
<summary>
低压启动测试电压
</summary>
</member>
<member name="T:Admin.Core.Model.DeptView">
@ -5176,6 +5356,171 @@
班组
</summary>
</member>
<member name="T:Admin.Core.Model.ViewModels.Data_ForMES">
<summary>
测温信息
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Line_No">
<summary>
线号
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Gongwno">
<summary>
工位号
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Cpno">
<summary>
产品条码
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.CpModel">
<summary>
产品型号
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.FactoryModel">
<summary>
基准型号
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Voltage">
<summary>
工作电压
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Point2">
<summary>
测试通道
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.TestTime">
<summary>
计划测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.TestedTime">
<summary>
实际测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Etemp">
<summary>
环温
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.BeginDateTime">
<summary>
开始测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.CpResult">
<summary>
测试结果
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.EndDateTime">
<summary>
测试结束时间
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.UserName">
<summary>
系统用户
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.TestNo">
<summary>
第几次测试
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Temp_Mes">
<summary>
温度数据
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Power_Mes">
<summary>
功率数据
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.Part_Mes">
<summary>
部件测试数据
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.ErrorCode_Mes">
<summary>
故障代码
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.T1Name">
<summary>
内部传感器 1 名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.T2Name">
<summary>
内部传感器 2 名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.T3Name">
<summary>
内部传感器 3 名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.T4Name">
<summary>
内部传感器 4 名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.T5Name">
<summary>
内部传感器 5 名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.T6Name">
<summary>
内部传感器 6 名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.IsOrder">
<summary>
是否测试部件”Y”测试
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.LowV_Time">
<summary>
低压启动测试时间
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.LowV_PowerMin">
<summary>
低压启动标准下限
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.LowV_PowerMax">
<summary>
低压启动标准上限
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.LowV_PowerFact">
<summary>
低压启动实际采集值
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.Data_ForMES.LowVoltage">
<summary>
低压启动测试电压
</summary>
</member>
<member name="T:Admin.Core.Model.ViewModels.EnterLibView">
<summary>
泡前库入库相信展示

@ -15,7 +15,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Api")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Api")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Api")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
a93bec2e5ffdf4970a870b00ef63076582f8814a81b11aac5793b179560f6a09
d3fb98a6e9753e9778fbd74bfb1bab4b2109502e6ffb588dd6ac7fa35784db36

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
7ad81a09147b0478aa0b50225f58a9581fb29a1452bd9a328e249c4af9c9ba8b
87a0600a7f41dbd7fb6e17317b46dab48d599fb88ba27b9ecafe90600b623f5e

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
2fc7d476902952a95d287f6f5b416b2d2e0c4d9b481a5e49690d0af6f465138c
0b6334a8eca6220f34a70ef7e8638a5a7d7d915a08c883404c49ce9b20597be9

@ -18,42 +18,43 @@ namespace Admin.Core.Extensions
cfg.AddProfile(new CustomProfile());
cfg.CreateMap<TemperatureHistory, BoxTemperatureMeasurementHistory>()
.ForMember(dest => dest.LineNo, src => src.MapFrom(d => d.Line_No)).
ForMember(dest => dest.Gongwno, src => src.MapFrom(d => d.Gongwno)).
ForMember(dest => dest.Cpno, src => src.MapFrom(d => d.Cpno)).
ForMember(dest => dest.Cpmodel, src => src.MapFrom(d => d.CpModel)).
ForMember(dest => dest.Factorymodel, src => src.MapFrom(d => d.FactoryModel)).
ForMember(dest => dest.Voltage, src => src.MapFrom(d => d.Voltage)).
ForMember(dest => dest.Point2, src => src.MapFrom(d => d.Point2)).
ForMember(dest => dest.TestTime, src => src.MapFrom(d => d.TestTime)).
ForMember(dest => dest.TestedTime, src => src.MapFrom(d => d.TestedTime)).
ForMember(dest => dest.Etemp, src => src.MapFrom(d => d.Etemp)).
ForMember(dest => dest.BeginDatetime, src => src.MapFrom(d => d.BeginDateTime)).
ForMember(dest => dest.CpResult, src => src.MapFrom(d => d.CpResult)).
ForMember(dest => dest.EndDateTime, src => src.MapFrom(d => d.EndDateTime)).
ForMember(dest => dest.UserName, src => src.MapFrom(d => d.UserName)).
ForMember(dest => dest.Remark, src => src.MapFrom(d => d.Remark)).
ForMember(dest => dest.TestNo, src => src.MapFrom(d => d.TestNo)).
ForMember(dest => dest.Temp_Mes, src => src.MapFrom(d => d.Temp_Mes)).
ForMember(dest => dest.Power_Mes, src => src.MapFrom(d => d.Power_Mes)).
ForMember(dest => dest.Part_Mes, src => src.MapFrom(d => d.Part_Mes)).
ForMember(dest => dest.ErrorCode_Mes, src => src.MapFrom(d => d.ErrorCode_Mes)).
ForMember(dest => dest.T1Name, src => src.MapFrom(d => d.T1Name)).
ForMember(dest => dest.T2Name, src => src.MapFrom(d => d.T2Name)).
ForMember(dest => dest.T3Name, src => src.MapFrom(d => d.T3Name)).
ForMember(dest => dest.T4Name, src => src.MapFrom(d => d.T4Name)).
ForMember(dest => dest.T5Name, src => src.MapFrom(d => d.T5Name)).
ForMember(dest => dest.T6Name, src => src.MapFrom(d => d.T6Name)).
ForMember(dest => dest.IsOrder, src => src.MapFrom(d => d.IsOrder)).
ForMember(dest => dest.LowV_Time, src => src.MapFrom(d => d.LowV_Time)).
ForMember(dest => dest.LowV_PowerMin, src => src.MapFrom(d => d.LowV_PowerMin)).
ForMember(dest => dest.LowV_PowerMax, src => src.MapFrom(d => d.LowV_PowerMax)).
ForMember(dest => dest.LowV_PowerFact, src => src.MapFrom(d => d.LowV_PowerFact)).
ForMember(dest => dest.LowVoltage, src => src.MapFrom(d => d.LowVoltage));
//ForMember(dest => dest.CreateTime, src => src.MapFrom(d => d.Create_Time)).
// cfg.CreateMap<TemperatureHistory, BoxTemperatureMeasurementHistory>()
// .ForMember(dest => dest.LineNo, src => src.MapFrom(d => d.Line_No)).
// ForMember(dest => dest.Gongwno, src => src.MapFrom(d => d.Gongwno)).
// ForMember(dest => dest.Cpno, src => src.MapFrom(d => d.CpNo)).
// ForMember(dest => dest.Cpmodel, src => src.MapFrom(d => d.CpModel)).
// ForMember(dest => dest.Factorymodel, src => src.MapFrom(d => d.FactoryModel)).
// ForMember(dest => dest.Voltage, src => src.MapFrom(d => d.Voltage)).
// ForMember(dest => dest.Point2, src => src.MapFrom(d => d.Point2)).
// ForMember(dest => dest.TestTime, src => src.MapFrom(d => d.TestTime)).
// ForMember(dest => dest.TestedTime, src => src.MapFrom(d => d.TestedTime)).
// ForMember(dest => dest.Etemp, src => src.MapFrom(d => d.Etemp)).
// ForMember(dest => dest.BeginDatetime, src => src.MapFrom(d => d.BeginDateTime)).
// ForMember(dest => dest.CpResult, src => src.MapFrom(d => d.CpResult)).
// ForMember(dest => dest.EndDateTime, src => src.MapFrom(d => d.EndDateTime)).
// ForMember(dest => dest.UserName, src => src.MapFrom(d => d.UserName)).
// ForMember(dest => dest.Remark, src => src.MapFrom(d => d.Remark)).
// ForMember(dest => dest.TestNo, src => src.MapFrom(d => d.TestNo)).
// ForMember(dest => dest.Temp_Mes, src => src.MapFrom(d => d.Temp_Mes)).
// ForMember(dest => dest.Power_Mes, src => src.MapFrom(d => d.Power_Mes)).
// ForMember(dest => dest.Part_Mes, src => src.MapFrom(d => d.Part_Mes)).
// ForMember(dest => dest.ErrorCode_Mes, src => src.MapFrom(d => d.ErrorCode_Mes)).
// ForMember(dest => dest.T1Name, src => src.MapFrom(d => d.T1Name)).
// ForMember(dest => dest.T2Name, src => src.MapFrom(d => d.T2Name)).
// ForMember(dest => dest.T3Name, src => src.MapFrom(d => d.T3Name)).
// ForMember(dest => dest.T4Name, src => src.MapFrom(d => d.T4Name)).
// ForMember(dest => dest.T5Name, src => src.MapFrom(d => d.T5Name)).
// ForMember(dest => dest.T6Name, src => src.MapFrom(d => d.T6Name)).
// ForMember(dest => dest.IsOrder, src => src.MapFrom(d => d.IsOrder)).
// ForMember(dest => dest.LowV_Time, src => src.MapFrom(d => d.LowV_Time)).
// ForMember(dest => dest.LowV_PowerMin, src => src.MapFrom(d => d.LowV_PowerMin)).
// ForMember(dest => dest.LowV_PowerMax, src => src.MapFrom(d => d.LowV_PowerMax)).
// ForMember(dest => dest.LowV_PowerFact, src => src.MapFrom(d => d.LowV_PowerFact)).
// ForMember(dest => dest.LowVoltage, src => src.MapFrom(d => d.LowVoltage));
// //ForMember(dest => dest.CreateTime, src => src.MapFrom(d => d.Create_Time)).
});
}
);
}
}
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
d780f4c71d7f81730d6e88e43ff8d26d1f8e15b705f157a4bf086caa5e7da499
4a7a5e632f75acc2920835c957e2ba4bacf9c19fa66b0e4b558910512e4ad1f0

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+09425abb94ddbc502762491aeee6d081b0fd9246")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.FrameWork")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
8726b4a34e466084643a48e8c0039a17689dbbba68bb056ab0191f984716dde6
95b9afb20f612087230db37b666e22f3502b9cda1b891f7e39f9c1fa82a9e378

@ -1,5 +1,6 @@
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
@ -11,17 +12,6 @@ namespace Admin.Core.IRepository
/// </summary>
public interface ITemperatureHistoryRepository : IBaseRepository<TemperatureHistory>
{
/// <summary>
/// 传递时间时间 调用存储过程 获取测温历史记录
/// </summary>
/// <param name="startTime">起始时间</param>
/// <returns></returns>
List<TemperatureHistory> QueryTemperatureHistory(DateTime startTime);
/// <summary>
/// 传递条码 调用存储过程 获取测温历史记录
/// </summary>
/// <param name="barCode">条码</param>
/// <returns></returns>
List<TemperatureHistory> QueryTemperatureHistory(string barCode);
}
}

@ -0,0 +1,21 @@
using Admin.Core.Model;
using Admin.Core.Model.ViewModels;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Admin.Core.IRepository
{
/// <summary>
/// ITestedCodeMESRepository
/// </summary>
public interface ITestedCodeMESRepository : IBaseRepository<TestedCode_MES>
{
/// <summary>
/// 传递时间时间 调用存储过程 获取测温历史记录
/// </summary>
/// <param name="time">结束时间</param>
/// <returns></returns>
List<TestedCode_MES> QueryTemperatureHistory(DateTime time);
}
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
72f20f6cf98a472ebf4c20b336a615ec584766bd52e85cd9501f3b4e781988db
1729bdd33c92c32780dfc41d1c8c22b6e81b413dc7bcedea2de590235227a7d0

@ -12,18 +12,6 @@ namespace Admin.Core.IService
/// </summary>
public interface ITemperatureHistoryServices : IBaseServices<TemperatureHistory>
{
/// <summary>
/// 根据起始时间查询 测温历史记录
/// </summary>
/// <param name="startTime"></param>
/// <returns></returns>
List<TemperatureHistory> QueryTemperatureHistory(DateTime startTime);
/// <summary>
///根据条码查询历史记录
/// </summary>
/// <param name="barCode"></param>
/// <returns></returns>
List<TemperatureHistory> QueryTemperatureHistory(string barCode);
}
}

@ -0,0 +1,19 @@
using Admin.Core.Model;
using System;
using System.Collections.Generic;
namespace Admin.Core.IService
{
/// <summary>
/// IBaseBomInfoServices
/// </summary>
public interface ITestedCodeMESServices : IBaseServices<TestedCode_MES>
{
/// <summary>
/// 获取系统班组时间
/// </summary>
public List<TestedCode_MES> QueryTemperatureHistory(DateTime startTime);
}
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
58e5bcaec14d01e659427d2a8c0b1fbc2e0da050bb91443cceff81b9cb2a3e6c
c83a04ebc368821387c3ab97734761bca5244ace0e4e216ff1cefcac9c4ba4da

@ -85,7 +85,7 @@ namespace Admin.Core.Model
/// 开始测试时间
/// </summary>
[SugarColumn(ColumnName = "BEGINDATETIME")]
public DateTime BeginDatetime { get; set; }
public string BeginDatetime { get; set; }
/// <summary>
/// 测试结果
@ -97,7 +97,7 @@ namespace Admin.Core.Model
/// 测试结束时间
/// </summary>
[SugarColumn(ColumnName = "ENDDATETIME")]
public DateTime EndDateTime { get; set; }
public string EndDateTime { get; set; }
/// <summary>
/// 系统用户

@ -1,191 +1,217 @@
using NPOI.Util;
using SqlSugar;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.Core.Model
{
/// <summary>
/// 测温历史记录
/// </summary>
[Table("TemperatureHistory")]
[SugarTable("TemperatureHistory", "Hsdb")]
[Table("BOX_TEMPERATUREHISTORY")]
[SugarTable("BOX_TEMPERATUREHISTORY", "AUCMA_SCADA")]
public class TemperatureHistory
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
[SugarColumn(ColumnName = "OBJ_ID", IsIdentity = true, IsPrimaryKey = true, OracleSequenceName = "SEQ_CODE_BINDING")]
public int ObjId { get; set; }
/// <summary>
/// 线号
/// </summary>
[SugarColumn(ColumnName = "LINE_NO")]
public int Line_No { get; set; }
/// <summary>
/// 工位号
/// </summary>
[SugarColumn(ColumnName = "GONGWNO")]
public int Gongwno { get; set; }
/// <summary>
/// 产品条码
/// </summary>
public string Cpno { get; set; }
[SugarColumn(ColumnName = "CPNO")]
public string CpNo { get; set; }
/// <summary>
/// 产品型号
/// </summary>
[SugarColumn(ColumnName = "CPMODEL")]
public string CpModel { get; set; }
/// <summary>
/// 基准型号
/// </summary>
[SugarColumn(ColumnName = "FACTORYMODEL")]
public string FactoryModel { get; set; }
/// <summary>
/// 工作电压
/// </summary>
[SugarColumn(ColumnName = "FACTORYMODEL")]
public int Voltage { get; set; }
/// <summary>
/// 测试通道
/// </summary>
[SugarColumn(ColumnName = "POINT2")]
public string Point2 { get; set; }
/// <summary>
/// 计划测试时间
/// </summary>
[SugarColumn(ColumnName = "TESTTIME")]
public int TestTime { get; set; }
/// <summary>
/// 实际测试时间
/// </summary>
[SugarColumn(ColumnName = "TESTEDTIME")]
public decimal TestedTime { get; set; }
/// <summary>
/// 环温
/// </summary>
[SugarColumn(ColumnName = "ETEMP")]
public decimal Etemp { get; set; }
/// <summary>
/// 开始测试时间
/// </summary>
public DateTime BeginDateTime { get; set; }
[SugarColumn(ColumnName = "BEGINDATETIME")]
public string BeginDateTime { get; set; }
/// <summary>
/// 测试结果
/// </summary>
[SugarColumn(ColumnName = "CPRESULT")]
public string CpResult { get; set; }
/// <summary>
/// 测试结束时间
/// </summary>
public DateTime EndDateTime { get; set; }
[SugarColumn(ColumnName = "ENDDATETIME")]
public string EndDateTime { get; set; }
/// <summary>
/// 系统用户
/// </summary>
[SugarColumn(ColumnName = "USERNAME")]
public string UserName { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "REMARK")]
public string Remark { get; set; }
/// <summary>
/// 第几次测试
/// </summary>
[SugarColumn(ColumnName = "TESTNO")]
public int TestNo { get; set; }
/// <summary>
/// 温度数据
/// </summary>
[SugarColumn(ColumnName = "TEMP_MES")]
public string Temp_Mes { get; set; }
/// <summary>
/// 功率数据
/// </summary>
[SugarColumn(ColumnName = "POWER_MES")]
public string Power_Mes { get; set; }
/// <summary>
/// 部件测试数据
/// </summary>
[SugarColumn(ColumnName = "PART_MES")]
public string Part_Mes { get; set; }
/// <summary>
/// 故障代码
/// </summary>
[SugarColumn(ColumnName = "ERRORCODE_MES")]
public string ErrorCode_Mes { get; set; }
/// <summary>
/// 内部传感器 1 名称
/// </summary>
[SugarColumn(ColumnName = "T1NAME")]
public string T1Name { get; set; }
/// <summary>
/// 内部传感器 2 名称
/// </summary>
[SugarColumn(ColumnName = "T2NAME")]
public string T2Name { get; set; }
/// <summary>
/// 内部传感器 3 名称
/// </summary>
[SugarColumn(ColumnName = "T3NAME")]
public string T3Name { get; set; }
/// <summary>
/// 内部传感器 4 名称
/// </summary>
[SugarColumn(ColumnName = "T4NAME")]
public string T4Name { get; set; }
/// <summary>
/// 内部传感器 5 名称
/// </summary>
[SugarColumn(ColumnName = "T5NAME")]
public string T5Name { get; set; }
/// <summary>
/// 内部传感器 6 名称
/// </summary>
[SugarColumn(ColumnName = "T6NAME")]
public string T6Name { get; set; }
/// <summary>
/// 是否测试部件”Y”测试
/// </summary>
[SugarColumn(ColumnName = "ISORDER")]
public string IsOrder { get; set; }
/// <summary>
/// 低压启动测试时间
/// </summary>
[SugarColumn(ColumnName = "LOWV_TIME")]
public int LowV_Time { get; set; }
/// <summary>
/// 低压启动标准下限
/// </summary>
[SugarColumn(ColumnName = "LOWV_POWERMIN")]
public decimal LowV_PowerMin { get; set; }
/// <summary>
/// 低压启动标准上限
/// </summary>
[SugarColumn(ColumnName = "LOWV_POWERMAX")]
public decimal LowV_PowerMax { get; set; }
/// <summary>
/// 低压启动实际采集值
/// </summary>
[SugarColumn(ColumnName = "LOWV_POWERFACT")]
public decimal LowV_PowerFact { get; set; }
/// <summary>
/// 低压启动测试电压
/// </summary>
[SugarColumn(ColumnName = "LOWVOLTAGE")]
public decimal LowVoltage { get; set; }
/// <summary>
/// 同步标识
/// 同步时间
/// </summary>
public int flag { get; set; }
[SugarColumn(ColumnName = "SYNC_DATETIME")]
public DateTime SyncDate { get; set; }
}
}

@ -0,0 +1,183 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.Core.Model
{
/// <summary>
/// 测温历史记录
/// </summary>
[Table("TestedCode_MES")]
[SugarTable("TestedCode_MES", "TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261")]
public class TestedCode_MES
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int ID { get; set; }
/// <summary>
/// 线号
/// </summary>
public int Line_No { get; set; }
/// <summary>
/// 工位号
/// </summary>
public int Gongwno { get; set; }
/// <summary>
/// 产品条码
/// </summary>
public string CpNo { get; set; }
/// <summary>
/// 产品型号
/// </summary>
public string CpModel { get; set; }
/// <summary>
/// 基准型号
/// </summary>
public string FactoryModel { get; set; }
/// <summary>
/// 工作电压
/// </summary>
public int Voltage { get; set; }
/// <summary>
/// 测试通道
/// </summary>
public string Point2 { get; set; }
/// <summary>
/// 计划测试时间
/// </summary>
public int TestTime { get; set; }
/// <summary>
/// 实际测试时间
/// </summary>
public decimal TestedTime { get; set; }
/// <summary>
/// 环温
/// </summary>
public decimal Etemp { get; set; }
/// <summary>
/// 开始测试时间
/// </summary>
public string BeginDateTime { get; set; }
/// <summary>
/// 测试结果
/// </summary>
public string CpResult { get; set; }
/// <summary>
/// 测试结束时间
/// </summary>
public string EndDateTime { get; set; }
/// <summary>
/// 系统用户
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 第几次测试
/// </summary>
public int TestNo { get; set; }
/// <summary>
/// 温度数据
/// </summary>
public string Temp_Mes { get; set; }
/// <summary>
/// 功率数据
/// </summary>
public string Power_Mes { get; set; }
/// <summary>
/// 部件测试数据
/// </summary>
public string Part_Mes { get; set; }
/// <summary>
/// 故障代码
/// </summary>
public string ErrorCode_Mes { get; set; }
/// <summary>
/// 内部传感器 1 名称
/// </summary>
public string T1Name { get; set; }
/// <summary>
/// 内部传感器 2 名称
/// </summary>
public string T2Name { get; set; }
/// <summary>
/// 内部传感器 3 名称
/// </summary>
public string T3Name { get; set; }
/// <summary>
/// 内部传感器 4 名称
/// </summary>
public string T4Name { get; set; }
/// <summary>
/// 内部传感器 5 名称
/// </summary>
public string T5Name { get; set; }
/// <summary>
/// 内部传感器 6 名称
/// </summary>
public string T6Name { get; set; }
/// <summary>
/// 是否测试部件”Y”测试
/// </summary>
public string IsOrder { get; set; }
/// <summary>
/// 低压启动测试时间
/// </summary>
public int LowV_Time { get; set; }
/// <summary>
/// 低压启动标准下限
/// </summary>
public decimal LowV_PowerMin { get; set; }
/// <summary>
/// 低压启动标准上限
/// </summary>
public decimal LowV_PowerMax { get; set; }
/// <summary>
/// 低压启动实际采集值
/// </summary>
public decimal LowV_PowerFact { get; set; }
/// <summary>
/// 低压启动测试电压
/// </summary>
public decimal LowVoltage { get; set; }
}
}

@ -0,0 +1,174 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.Core.Model.ViewModels
{
/// <summary>
/// 测温信息
/// </summary>
public class Data_ForMES
{
/// <summary>
/// 线号
/// </summary>
public int Line_No { get; set; }
/// <summary>
/// 工位号
/// </summary>
public int Gongwno { get; set; }
/// <summary>
/// 产品条码
/// </summary>
public string Cpno { get; set; }
/// <summary>
/// 产品型号
/// </summary>
public string CpModel { get; set; }
/// <summary>
/// 基准型号
/// </summary>
public string FactoryModel { get; set; }
/// <summary>
/// 工作电压
/// </summary>
public int Voltage { get; set; }
/// <summary>
/// 测试通道
/// </summary>
public string Point2 { get; set; }
/// <summary>
/// 计划测试时间
/// </summary>
public int TestTime { get; set; }
/// <summary>
/// 实际测试时间
/// </summary>
public decimal TestedTime { get; set; }
/// <summary>
/// 环温
/// </summary>
public decimal Etemp { get; set; }
/// <summary>
/// 开始测试时间
/// </summary>
public string BeginDateTime { get; set; }
/// <summary>
/// 测试结果
/// </summary>
public string CpResult { get; set; }
/// <summary>
/// 测试结束时间
/// </summary>
public string EndDateTime { get; set; }
/// <summary>
/// 系统用户
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 第几次测试
/// </summary>
public int TestNo { get; set; }
/// <summary>
/// 温度数据
/// </summary>
public string Temp_Mes { get; set; }
/// <summary>
/// 功率数据
/// </summary>
public string Power_Mes { get; set; }
/// <summary>
/// 部件测试数据
/// </summary>
public string Part_Mes { get; set; }
/// <summary>
/// 故障代码
/// </summary>
public string ErrorCode_Mes { get; set; }
/// <summary>
/// 内部传感器 1 名称
/// </summary>
public string T1Name { get; set; }
/// <summary>
/// 内部传感器 2 名称
/// </summary>
public string T2Name { get; set; }
/// <summary>
/// 内部传感器 3 名称
/// </summary>
public string T3Name { get; set; }
/// <summary>
/// 内部传感器 4 名称
/// </summary>
public string T4Name { get; set; }
/// <summary>
/// 内部传感器 5 名称
/// </summary>
public string T5Name { get; set; }
/// <summary>
/// 内部传感器 6 名称
/// </summary>
public string T6Name { get; set; }
/// <summary>
/// 是否测试部件”Y”测试
/// </summary>
public string IsOrder { get; set; }
/// <summary>
/// 低压启动测试时间
/// </summary>
public int LowV_Time { get; set; }
/// <summary>
/// 低压启动标准下限
/// </summary>
public decimal LowV_PowerMin { get; set; }
/// <summary>
/// 低压启动标准上限
/// </summary>
public decimal LowV_PowerMax { get; set; }
/// <summary>
/// 低压启动实际采集值
/// </summary>
public decimal LowV_PowerFact { get; set; }
/// <summary>
/// 低压启动测试电压
/// </summary>
public decimal LowVoltage { get; set; }
}
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
1ec56689cad54c12209e5fbd483faa339ac415e2614a8fd6b45ec357a392a616
1aeaf67c9b05c0229d5cde75302719d662a4718be25a06f06faf717d4b7ecb6e

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.RealTimeService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
0233e45d9021e3993970f80743611620290253700f9f88fdb16a4673a7d9f624
9b91b2796fb406d49fdb27eb68d79566580a4e8d69d50cc0f88bef80277b52f1

@ -1,5 +1,6 @@
using Admin.Core.IRepository;
using Admin.Core.Model;
using Admin.Core.Model.ViewModels;
using SqlSugar;
using System;
using System.Collections.Generic;
@ -16,35 +17,7 @@ namespace Admin.Core.Repository
{
}
#region 传递时间时间 调用存储过程 获取测温历史记录
/// <summary>
/// 传递的参数为信息起始时间,该存储过程会提取从起始时间开始按时间排序的 2000 条数据
/// </summary>
/// <returns></returns>
public List<TemperatureHistory> QueryTemperatureHistory(DateTime startTime)
{
var s = new SugarParameter("@p", startTime);
var res = new SugarParameter("@History", null, true);//设置为output
var list = Db.CopyNew().Ado.UseStoredProcedure().SqlQuery<TemperatureHistory>("Data_ForMES2", s);
return list;
}
#endregion
#region 传递条码 调用存储过程 获取测温历史记录
/// <summary>
/// 调用存储过程 获取测温历史记录
/// </summary>
/// <returns></returns>
public List<TemperatureHistory> QueryTemperatureHistory(string barCode)
{
string startTime = string.Empty;
string endTime = string.Empty;
var s = new SugarParameter("@p", barCode);
var res = new SugarParameter("@History", null, true);//设置为output
var list = Db.CopyNew().Ado.UseStoredProcedure().SqlQuery<TemperatureHistory>("Data_ForMES", s);
return list;
}
#endregion
}
}

@ -0,0 +1,34 @@
using Admin.Core.IRepository;
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Admin.Core.Repository
{
/// <summary>
/// BaseBomInfoRepository
/// </summary>
public class TestedCodeMESRepository : BaseRepository<TestedCode_MES>, ITestedCodeMESRepository
{
public TestedCodeMESRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
#region 传递时间时间 调用存储过程 获取测温历史记录
/// <summary>
/// 传递的参数为信息起始时间,该存储过程会提取从起始时间开始按时间排序的 2000 条数据
/// </summary>
/// <returns></returns>
public List<TestedCode_MES> QueryTemperatureHistory(DateTime time)
{
var endDatetime = new SugarParameter("@EndDatetime", time.AddDays(-1));
var list = Db.CopyNew().Ado.UseStoredProcedure().SqlQuery<TestedCode_MES>("Data_ForMES2", endDatetime);
return list;
}
#endregion
}
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
4639e0ce1dff133705f35aae6cc343d3a434fc547d556f93e46bcf77a8fe9d80
b421458c05255ab19c6ba5623d1ed22be575b82ed8d7983727203ddffdd5b0aa

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Serilog.Es")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
4f26aea112ddb2e1ceead1b404f91a11042202d3d8738b7674a88a5c5fae49b0
9d1ed847a59d4aaa1c69df7da8b87e219b4aa9e3db77ec0e15f4efb6543c845c

@ -26,23 +26,6 @@ namespace Admin.Core.Service
base.BaseDal = dal;
_temperatureHistoryRepository = temperatureHistoryRepository;
}
/// <summary>
/// 传递时间时间 调用存储过程 获取测温历史记录
/// </summary>
/// <param name="startTime">开始时间</param>
/// <returns></returns>
public List<TemperatureHistory> QueryTemperatureHistory(DateTime startTime)
{
return _temperatureHistoryRepository.QueryTemperatureHistory(startTime);
}
/// <summary>
/// 传递条码 调用存储过程 获取测温历史记录
/// </summary>
/// <param name="barCode">条码</param>
/// <returns></returns>
public List<TemperatureHistory> QueryTemperatureHistory(string barCode)
{
return _temperatureHistoryRepository.QueryTemperatureHistory(barCode);
}
}
}

@ -0,0 +1,33 @@
using Admin.Core.IRepository;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Model.ViewModels;
using log4net;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.IdentityModel.Logging;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Admin.Core.Service
{
public class TestedCodeMESServices : BaseServices<TestedCode_MES>, ITestedCodeMESServices
{
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(TestedCodeMESServices));
private readonly IBaseRepository<BaseBomInfo> _dal;
private readonly ITestedCodeMESRepository _testedCodeMESRepository;
public TestedCodeMESServices(IBaseRepository<BaseBomInfo> dal, ITestedCodeMESRepository testedCodeMESRepository)
{
this._dal = dal;
_testedCodeMESRepository = testedCodeMESRepository;
}
public List<TestedCode_MES> QueryTemperatureHistory(DateTime time)
{
return _testedCodeMESRepository.QueryTemperatureHistory(time);
}
}
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
f7af35947834bb2b8700b1aa87f9fe428cf89bd259aefe95cb2c632699945ffb
f06bf3f95de6133293581e9c4d429b8fc9930722c7d92c532fcb3f4c84aab97d

@ -1,140 +0,0 @@
using Admin.Core.IService.ISys;
using Admin.Core.IService;
using Quartz;
using System;
using System.Threading.Tasks;
using log4net;
using Admin.Core.Model;
using System.Linq;
using Admin.Core.Model.Model_New;
using Aucma.Core.HwPLc;
using HwCommunication.Core;
using Admin.Core.Common.Helper;
using System.Collections;
using System.Text;
using NetTaste;
using Admin.Core.Service;
using AutoMapper;
using System.Collections.Generic;
/// <summary>
/// 测温数据采集
/// </summary>
namespace Admin.Core.Tasks
{
public class Job_TemperatureMeasurement_Quartz : JobBase, IJob
{
public delegate Task RefreshBoxFoamDataDelegate();
public static event RefreshBoxFoamDataDelegate RefreshBoxFoamDataDelegateEvent;
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(Job_TemperatureMeasurement_Quartz));
private readonly IBoxTemperatureMeasurementHistoryServices _boxTMHistoryServices;
private readonly ITemperatureHistoryServices _temperatureHistoryServices;
IMapper _mapper;
public Job_TemperatureMeasurement_Quartz(ISysTasksQzService SysTasksQzService, ISysJobLogService sysJobLogService,
ITemperatureHistoryServices temperatureHistoryServices, IBoxTemperatureMeasurementHistoryServices boxTMHistoryServices,
IMapper mapper)
{
_SysTasksQzService = SysTasksQzService;
_boxTMHistoryServices = boxTMHistoryServices;
_temperatureHistoryServices = temperatureHistoryServices;
_mapper = mapper;
}
public async Task Execute(IJobExecutionContext context)
{
await ExecuteJob(context, async () => await Run(context));
}
#region PLC 任务处理表
/// <summary>
/// PLC 任务处理表
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public async Task Run(IJobExecutionContext context)
{
try
{
var list = await _temperatureHistoryServices.QueryAsync(d => d.flag == 0);
Console.WriteLine(list.Count());
if (list.Count == 0) return;
List< BoxTemperatureMeasurementHistory > historyList = new List<BoxTemperatureMeasurementHistory>();
foreach (var item in list)
{
BoxTemperatureMeasurementHistory dest = new BoxTemperatureMeasurementHistory();
dest.LineNo = item.Line_No;
dest.Gongwno = item.Gongwno;
dest.Cpno = item.Cpno;
dest.Cpmodel = item.CpModel;
dest.Factorymodel = item.FactoryModel;
dest.Voltage = item.Voltage;
dest.Point2 = item.Point2;
dest.TestTime = item.TestTime;
dest.TestedTime = item.TestedTime;
dest.Etemp = item.Etemp;
dest.BeginDatetime = item.BeginDateTime;
dest.CpResult = item.CpResult;
dest.EndDateTime = item.EndDateTime;
dest.UserName = item.UserName;
dest.Remark = item.Remark;
dest.TestNo = item.TestNo;
dest.Temp_Mes = item.Temp_Mes;
dest.Power_Mes = item.Power_Mes;
dest.Part_Mes = item.Part_Mes;
dest.ErrorCode_Mes = item.ErrorCode_Mes;
dest.T1Name = item.T1Name;
dest.T2Name = item.T2Name;
dest.T3Name = item.T3Name;
dest.T4Name = item.T4Name;
dest.T5Name = item.T5Name;
dest.T6Name = item.T6Name;
dest.IsOrder = item.IsOrder;
dest.LowV_Time = item.LowV_Time;
dest.LowV_PowerMin = item.LowV_PowerMin;
dest.LowV_PowerMax = item.LowV_PowerMax;
dest.LowV_PowerFact = item.LowV_PowerFact;
dest.LowVoltage = item.LowVoltage;
historyList.Add(dest);
}
//List<BoxTemperatureMeasurementHistory> history =new _mapper.Map<List<BoxTemperatureMeasurementHistory>>(list);
Console.WriteLine(historyList.Count());
var result = await _boxTMHistoryServices.AddAsync(historyList);
if (result > 0)
{
if (list == null) return;
list.ForEach(x => x.flag = 1);
await _temperatureHistoryServices.UpdateAsync(list);
Console.WriteLine("保存测温系统成功");
}
}
catch (Exception ex)
{
logHelper.Error($"测温数据处理异常:{ex.Message}");
}
}
private async Task<BoxFoamData> UpdateRealData(BoxFoamData item)
{
try
{
}
catch (Exception ex)
{
logHelper.Error($"更新测温数据失败");
}
return await Task.FromResult(item);
}
#endregion
}
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1fc9493a7ff9eb3e5bc2b6109e38a8c263e3b897")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
357d4cf1da9d0baaf00ea24891148cc7f0ef3028d39279eea9f552730b5fa818
f7fa8a41ec3905813b997136243c860aeed960ff6eeb235d5d9115eb72d57db0

@ -62,7 +62,6 @@ namespace Aucam.Core.PerfusionService
//PLC
services.AddPlcSetup();
services.AddAucmaTaskSetup();
//支持编码大全 例如:支持 System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030")
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
@ -84,8 +83,7 @@ namespace Aucam.Core.PerfusionService
/// <param name="app"></param>
/// <param name="env"></param>
public void Configure(IApplicationBuilder app, ISysTasksQzService tasksQzService,
ISchedulerCenter schedulerCenter, IRunPlcService runPlcService,
IAucamTaskService aucamTaskService)
ISchedulerCenter schedulerCenter, IRunPlcService runPlcService)
{
// 使用静态文件
app.UseStaticFiles();
@ -95,8 +93,6 @@ namespace Aucam.Core.PerfusionService
app.UseQuartzJobMildd(tasksQzService, schedulerCenter);
//PLC
app.UsePlcMildd(runPlcService);
app.AucmaTaskMildds(aucamTaskService);
}
#region 注册服务

@ -109,7 +109,7 @@
"TriggerType": 1,
"IntervalSecond": 1,
"CycleRunTimes": 1,
"IsStart": false,
"IsStart": true,
"JobParams": null,
"DelFlag": false,
"CreateBy": "admin",
@ -165,11 +165,11 @@
"Enabled": true
},
"QuartzNetJob": {
"Enabled": false
"Enabled": true
},
"AucamTask": {
"Enabled": true
"Enabled": false
}
},
"PLCServer": [

@ -62,7 +62,7 @@
// *** MutiDBEnabled false ***
// *** MutiDBEnabled trueEnabledtrue **
// https://www.bilibili.com/video/BV1BJ411B7mn?p=6
"MainDB": "AUCMA_SCADA", //Enabledtrue
"MainDB": "TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261", //Enabledtrue
"MutiDBEnabled": true, //
"CQRSEnabled": false, //SqlServer
"DBS": [
@ -85,37 +85,21 @@
"ProviderName": "System.Data.SqlClient"
},
{
"ConnId": "Hsdb",
"ConnId": "TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261",
"DBType": 1,
"Enabled": true,
"HitRate": 40,
"Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;",
"Connection": "Data Source=localhost;Initial Catalog=TOPLINE_T10_E_P2_32_AUCMA_HeNan_D_261;User ID=sa;Password=sa;",
"ProviderName": "System.Data.SqlClient"
}
],
"QuartzNetJob": [
{
"ID": 1,
"Name": "TemperatureMeasurement",
"JobGroup": "DEFAULT",
"Cron": "*/10 * * * * ?",
"AssemblyName": "Admin.Core.Tasks",
"ClassName": "Job_TemperatureMeasurement_Quartz",
"Remark": "执行测温设备数据采集程序",
"RunTimes": 3881,
"BeginTime": "2023-04-23 11:08:50.000",
"EndTime": "2100-08-06 16:45:30.000",
"TriggerType": 1,
"IntervalSecond": 1,
"CycleRunTimes": 1,
"IsStart": true,
"JobParams": null,
"DelFlag": false,
"CreateBy": "admin",
"CreateTime": "2023-04-23 11:09:22.0000000",
"UpdateBy": "admin",
"UpdateTime": "2023-11-15 16:45:45.0530000"
}
//{
// "ConnId": "Hsdb",
// "DBType": 1,
// "Enabled": true,
// "HitRate": 10,
// "Connection": "Data Source=localhost;Initial Catalog=Hsdb;User ID=sa;Password=sa;",
// "ProviderName": "System.Data.SqlClient"
//}
],
"Startup": {
"Cors": {
@ -144,88 +128,9 @@
"Enabled": false //Nacos
}
},
"Redis": {
//"ConnectionString": "127.0.0.1:6379"
"ConnectionString": "127.0.0.1:6379"
},
"RabbitMQ": {
"Enabled": true,
"Connection": "http://localhost:15672/",
"UserName": "robin",
"Password": "123456",
"RetryCount": 3
},
"EventBus": {
"Enabled": true,
"SubscriptionClientName": "Admin.Core"
},
"Middleware": {
"Plc": {
"Enabled": true
},
"QuartzNetJob": {
"Enabled": true
},
"AucamTask": {
"Enabled": true
}
},
"PLCServer": [
{
"Id": 1,
"EquipName": "PerfusionPlc",
"PlcType": "Siemens",
"Enabled": true,
"IP": "127.0.0.1",
"Port": 102
}
],
"IpRateLimiting": {
"EnableEndpointRateLimiting": false, //False: globally executed, true: executed for each
"StackBlockedRequests": false, //False: Number of rejections should be recorded on another counter
"RealIpHeader": "X-Real-IP",
"ClientIdHeader": "X-ClientId",
"IpWhitelist": [], //
"EndpointWhitelist": [ "get:/api/xxx", "*:/api/yyy" ],
"ClientWhitelist": [ "dev-client-1", "dev-client-2" ],
"QuotaExceededResponse": {
"Content": "{{\"status\":429,\"msg\":\"访问过于频繁,请稍后重试\",\"success\":false}}",
"ContentType": "application/json",
"StatusCode": 429
},
"HttpStatusCode": 429, //
"GeneralRules": [ //api,*
{
"Endpoint": "*:/api/Admin*",
"Period": "1m",
"Limit": 20
},
{
"Endpoint": "*/api/*",
"Period": "1s",
"Limit": 3
},
{
"Endpoint": "*/api/*",
"Period": "1m",
"Limit": 30
},
{
"Endpoint": "*/api/*",
"Period": "12h",
"Limit": 500
}
]
},
"LogFiedOutPutConfigs": {
"tcpAddressHost": "", // elktcp
"tcpAddressPort": 0, // elktcp
"ConfigsInfo": [ // elk
{
"FiedName": "applicationName",
"FiedValue": "Admin.Core.Api"
}
]
}
}

@ -110,6 +110,7 @@ namespace Aucma.Core.DoorFoam.Business
// ch:打印设备信息 | en:Print device info
for (Int32 i = 0; i < stDevList.nDeviceNum; i++)
{
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
if (MvCodeReader.MV_CODEREADER_GIGE_DEVICE == stDevInfo.nTLayerType)
@ -141,7 +142,7 @@ namespace Aucma.Core.DoorFoam.Business
}
// ch:打开设备 | en:Open device
nRet = device.MV_CODEREADER_OpenDevice_NET();
nRet = device.MV_CODEREADER_OpenDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Open device failed:{0:x8}", nRet);

@ -77,6 +77,12 @@
<ProjectReference Include="..\Admin.Core.Extensions\Admin.Core.Extensions.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="MvCodeReaderSDK.Net">
<HintPath>..\dll\MvCodeReaderSDK.Net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Update="Views\HandPalletizView.xaml.cs">
<SubType>Code</SubType>

@ -1,6 +1,8 @@
using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Service;
using Aucma.Core.HwPLc;
using Aucma.Core.Scanner;
using log4net;
@ -9,6 +11,7 @@ using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
@ -32,9 +35,11 @@ namespace Aucma.Core.Palletiz.Business
#region 初始化对象
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(InstoreBusiness));
private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices;
private readonly ICodeBindingRecordServices? _codeBindingServices;
private readonly IRecordInStoreServices? _recordInstoreServices;
private readonly IBaseSpaceInfoServices _baseSpaceInfoServices;
private readonly ICodeBindingRecordServices _codeBindingServices;
private readonly IOffLineInfoServices _offLineInfoServices;
private readonly IRecordInStoreServices _recordInstoreServices;
private readonly IBaseOrderInfoServices _baseOrderInfoServices;
#endregion
#region 构造函数
@ -43,7 +48,9 @@ namespace Aucma.Core.Palletiz.Business
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
_codeBindingServices = App.ServiceProvider.GetService<ICodeBindingRecordServices>();
_recordInstoreServices = App.ServiceProvider.GetService<IRecordInStoreServices>();
MvCodeHelper.HandlePalletizDelegateEvent += ScannerInStore;//注册扫码器扫码后业务处理事件
_offLineInfoServices = App.ServiceProvider.GetService<IOffLineInfoServices>();
_baseOrderInfoServices = App.ServiceProvider.GetService<IBaseOrderInfoServices>();
MvCodeHelper.RefreshPalletizDelegateEvent += ScannerInStore;//注册扫码器扫码后业务处理事件
}
#endregion
@ -85,7 +92,7 @@ namespace Aucma.Core.Palletiz.Business
Task.Run(async () =>
{
Thread.Sleep(3000);
await InStore("16160030000000910999", "192.168.1.19");
await InStore("15100P000009E360795", "10.10.92.230");
});
}
#endregion
@ -130,51 +137,52 @@ namespace Aucma.Core.Palletiz.Business
Console.WriteLine($"上位机获取配置的扫码器【IP:{model.ToJson()}》名称:{model.Name}】");
LogInStoreInfoDelegateEvent?.Invoke($"上位机获取配置的扫码器【IP:{model.ToJson()}》名称:{model.Name}】","White");
//1.根据成品码找货道
List<BaseSpaceInfo>? spaceList = GetSpaceBySNCode(SNCode, recordInstore);
Console.WriteLine($"上位机获取配置的货道数量【{spaceList.Count}】");
// 根据货道信息判断下发plc信号
List<BaseSpaceInfo> spaceList = GetSpaceBySNCode2(SNCode, recordInstore);//2024
if (spaceList == null || spaceList.Count == 0)
{
logHelper.Error("未找到匹配货道,请手动入库!");
// 刷新页面提示信息
Console.WriteLine("未找到匹配货道,请手动入库!");
LogInStoreInfoDelegateEvent?.Invoke("未找到匹配货道,请手动入库!", "White");
// 刷新页面提示信息
LogInStoreInfoDelegateEvent?.Invoke("未找到匹配货道,请手动入库!", "Red");
return;
}
Console.WriteLine($"上位机获取配置的货道数量【{spaceList.Count}】");
// 过滤货道,找到最终需要下发的货道
BaseSpaceInfo finalSpace = FilterSpace(spaceList);
Console.WriteLine($"上位机获取需要下发的货道【货道名称:{finalSpace.SpaceName}》货道库存:{finalSpace.SpaceStock}》货道状态:{finalSpace.SpaceStatus}》货道类型:{finalSpace.SpaceType}》所属仓库:{finalSpace.StoreCode}】");
LogInStoreInfoDelegateEvent?.Invoke($"是否为大产品:【{finalSpace.IsTwoSpace}】", "White");
Console.WriteLine($"是否为大产品:【{finalSpace.IsTwoSpace}】");
//LogInStoreInfoDelegateEvent?.Invoke($"是否为大产品:【{finalSpace.IsTwoSpace}】", "White");
//Console.WriteLine($"是否为大产品:【{finalSpace.IsTwoSpace}】");
LogInStoreInfoDelegateEvent?.Invoke($"下发的货道:【货道名称:{finalSpace.SpaceName}", "White");
// 大产品占两道
if (finalSpace.IsTwoSpace == 1)
{
spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3)));
spaceNumList.Add(int.Parse(GetOtherSpace(finalSpace, spaceList).SpaceCode.Substring(5, 3)));
plcResult = SendAndAnswerPlc(scannerIp, spaceList[0].RotationRange, spaceNumList);
recordInstore.SpaceCode = finalSpace.SpaceCode;
recordInstore.StoreCode = finalSpace.StoreCode;
// 更新货道信息,大产品last存objId大的储存上一个货道的主键 如货道7,8存8
BaseSpaceInfo otherSpace = GetOtherSpace(finalSpace, spaceList);
Console.WriteLine($"大产品入库信息:【{finalSpace.ToJson()}】【{spaceList.ToJson()}】");
if (otherSpace != null)
{
UpdateSapceList(otherSpace.ObjId, spaceList);
Console.WriteLine("更新货道信息成功!");
LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White");
}
}
else
//if (finalSpace.IsTwoSpace == 1)
//{
// spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3)));
// spaceNumList.Add(int.Parse(GetOtherSpace(finalSpace, spaceList).SpaceCode.Substring(5, 3)));
// plcResult = SendAndAnswerPlc(scannerIp, spaceList[0].RotationRange, 1);
// recordInstore.SpaceCode = finalSpace.SpaceCode;
// recordInstore.StoreCode = finalSpace.StoreCode;
// // 更新货道信息,大产品last存objId大的储存上一个货道的主键 如货道7,8存8
// BaseSpaceInfo otherSpace = GetOtherSpace(finalSpace, spaceList);
// Console.WriteLine($"大产品入库信息:【{finalSpace.ToJson()}】【{spaceList.ToJson()}】");
// if (otherSpace != null)
// {
// UpdateSapceList(otherSpace.ObjId, spaceList);
// Console.WriteLine("更新货道信息成功!");
// LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White");
// }
//}
//else
{
// last不等于自己可以先入自己否则入另一条货道
if (IsOddNumber(finalSpace))
{
spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3)));
spaceNumList.Add(0);
plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, spaceNumList);
UpdateSapceList(finalSpace.ObjId, spaceList);
int space =Convert.ToInt32(finalSpace.SpaceCode.Substring(finalSpace.SpaceCode.Length - 3, 3));
plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, space);
UpdateSapceList(finalSpace.ObjId, finalSpace);
Console.WriteLine("更新货道信息成功!");
LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White");
}
@ -182,8 +190,9 @@ namespace Aucma.Core.Palletiz.Business
{
spaceNumList.Add(0);
spaceNumList.Add(int.Parse(finalSpace.SpaceCode.Substring(5, 3)));
plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, spaceNumList);//给PLC下传入库信号
UpdateSapceList(finalSpace.ObjId, spaceList);
int space = Convert.ToInt32(finalSpace.SpaceCode.Substring(finalSpace.SpaceCode.Length - 3, 3));
plcResult = SendAndAnswerPlc(scannerIp, finalSpace.RotationRange, space);//给PLC下传入库信号
UpdateSapceList(finalSpace.ObjId, finalSpace);
Console.WriteLine("更新货道信息成功!");
LogInStoreInfoDelegateEvent?.Invoke("更新货道信息成功!", "White");
}
@ -224,13 +233,18 @@ namespace Aucma.Core.Palletiz.Business
/// </summary>
/// <param name="SNCode"></param>
/// <returns></returns>
private List<BaseSpaceInfo>? GetSpaceBySNCode(string SNCode, RecordInStore recordInstore)
private List<BaseSpaceInfo> GetSpaceBySNCode(string SNCode, RecordInStore recordInstore)
{
try
{
CodeBindingRecord bindingRecord = _codeBindingServices.FirstAsync(c => c.ProductCode.Equals(SNCode)).Result;
if (bindingRecord == null) return null;
if (bindingRecord == null)
{
Console.WriteLine("成品下线库未有此成品下线记录!");
LogInStoreInfoDelegateEvent?.Invoke("成品下线库未有此成品下线记录!qin", "Red");
return null;
}
recordInstore.BarCodeCode = bindingRecord.BoxCode;
recordInstore.MaterialCode = bindingRecord.BoxCode;
@ -246,6 +260,8 @@ namespace Aucma.Core.Palletiz.Business
}
catch (Exception ex)
{
Console.WriteLine("成品下线库未有此成品下线记录!");
LogInStoreInfoDelegateEvent?.Invoke("成品下线库未有此成品下线记录!qin", "Red");
logHelper.Error(ex.Message.ToString());
Console.WriteLine(ex.Message.ToString());
@ -253,25 +269,62 @@ namespace Aucma.Core.Palletiz.Business
}
}
#endregion
private BaseSpaceInfo FilterSpace(List<BaseSpaceInfo> spaceInfos)
/// <summary>
/// 根据成品码找货道_临时 2024-03-11
/// </summary>
/// <param name="SNCode"></param>
/// <returns></returns>
private List<BaseSpaceInfo> GetSpaceBySNCode2(string SNCode, RecordInStore recordInstore)
{
BaseSpaceInfo spaceInfo = spaceInfos.First();
if (spaceInfos.Count == 1 || string.IsNullOrEmpty(spaceInfo.LastSpace))
try
{
return spaceInfo;
OffLineInfo record = _offLineInfoServices.FirstAsync(c => c.ProductSNCode.Equals(SNCode)).Result;
if (record == null)
{
Console.WriteLine("成品下线库未有此成品下线记录!");
return null;
}
Console.WriteLine(record.ProductOrderNo);
BaseOrderInfo baseOrderInfo =_baseOrderInfoServices.FirstAsync(d=>"0000"+d.OrderCode== record.ProductOrderNo).Result ;
recordInstore.BarCodeCode = record.BoxCode;
recordInstore.MaterialCode = baseOrderInfo.MaterialCode;
recordInstore.MaterialType = baseOrderInfo.MaterialCode;
recordInstore.MaterialName = baseOrderInfo.MaterialName;
string mType = baseOrderInfo.MaterialCode;
List<BaseSpaceInfo> bsInfo = _baseSpaceInfoServices.Query(s => (s.MaterialType.Equals(mType) && (s.StoreCode.Equals(storeCodeA))));
if (bsInfo.Count > 0)
return bsInfo.OrderBy(x => x.ObjId).ToList();
else
return null;
}
List<BaseSpaceInfo> spaceList = spaceInfos.Where(s => s.ObjId > int.Parse(spaceInfo.LastSpace)).ToList();
if (spaceList == null || spaceList.Count == 0)
catch (Exception ex)
{
return spaceInfo;
Console.WriteLine("成品下线库未有此成品下线记录!");
//LogInStoreInfoDelegateEvent?.Invoke("成品下线库查询成品下线记录异常!请联系当班负责人处理", "Red");
logHelper.Error(ex.Message.ToString());
Console.WriteLine($"成品下线库未有此成品下线记录!{ex.Message.ToString()}");
return null;
}
else
}
#endregion
private BaseSpaceInfo FilterSpace(List<BaseSpaceInfo> spaceInfos)
{
if (spaceInfos == null|| spaceInfos.Count==0) return null;
List<BaseSpaceInfo> baseSpaceInfoList = spaceInfos.OrderBy(d => d.UpdatedTime).ToList();
BaseSpaceInfo spaceInfo = baseSpaceInfoList.First();
if (spaceInfo!=null || string.IsNullOrEmpty(spaceInfo.LastSpace))
{
return spaceInfo;
}
return null;
}
/// <summary>
@ -336,12 +389,16 @@ namespace Aucma.Core.Palletiz.Business
/// <param name="objId"></param>
/// <param name="spaceList"></param>
/// <returns></returns>
private bool UpdateSapceList(int objId, List<BaseSpaceInfo> spaceList)
private bool UpdateSapceList(int objId, BaseSpaceInfo spaceList)
{
foreach (BaseSpaceInfo space in spaceList)
{
space.LastSpace = objId.ToString();
}
//foreach (BaseSpaceInfo space in spaceList)
//{
// space.LastSpace = objId.ToString();
// space.UpdatedTime =DateTime.Now;
//}
spaceList.LastSpace = objId.ToString();
spaceList.UpdatedTime = DateTime.Now;
return _baseSpaceInfoServices.UpdateAsync(spaceList).Result;
}
#endregion
@ -354,19 +411,19 @@ namespace Aucma.Core.Palletiz.Business
/// </summary>
/// <param name="scannerIp">扫码器ip</param>
/// <param name="range">转向角度</param>
/// <param name="spaceNum">货道号int集合</param>
/// <param name="spaceNum">货道号</param>
/// <returns></returns>
private bool SendAndAnswerPlc(string scannerIp, int range, List<int> spaceNum)
private bool SendAndAnswerPlc(string scannerIp, int range,int spaceNum)
{
bool result = false;
try
{
PlcModel obj = GetPlcByScanner(scannerIp);
if (obj != null)
if (obj != null&& obj.plc.IsConnected)
{
if (SendPlc(obj, range, spaceNum))
{
result = WaitAnswerPlc(obj);
return true;
}
}
else
@ -391,37 +448,65 @@ namespace Aucma.Core.Palletiz.Business
/// 下发plc信号
/// </summary>
/// <param name="obj"></param>
/// <param name="range"></param>
/// <param name="spaceNum"></param>
/// <param name="range">转向</param>
/// <param name="spaceNum">库数量</param>
/// <returns></returns>
private bool SendPlc(PlcModel obj, int range, List<int> spaceNum)
private bool SendPlc(PlcModel obj, int range,int spaceNum)
{
try
{
bool result = false;
DateTime targetTime = DateTime.Now.AddSeconds(8);
while (true)
int i= 0;
while (i<3)
{
if (DateTime.Now > targetTime) // plc超最大时限无反馈
if (obj.plc.IsConnected)
{
logHelper.Error("等待plc放行反馈信号超时");
Console.WriteLine("等待plc放行反馈信号超时");
return false;
Console.WriteLine($"是否可以下发:【{obj.plc.ReadBool("B1000")}】");
if (obj.plc.ReadBool("B1000"))//如果为true 则可以下发 任务
{
// 应答字允许下发
int storeNum = GetStoreNum(obj, spaceNum);
Console.WriteLine($"读取当前货道数量:【{storeNum}】");
//if (storeNum == 1)
{
//obj.plc.WriteInt16("D7010", range.ToString());//旋转角度1=》90 2=>反转90 D2 1正转 2反转
//obj.plc.WriteInt16("D29", spaceNum.ToString()); //货道号
//obj.plc.WriteInt16("B1001", "1");//发送完成信号
obj.plc.WriteInt16("D29", spaceNum.ToString());//货道号
if (range==0)
{
range = 3;
}
if (range == 90)
{
range = 1;
}
if (range == -90)
{
range = 2;
}
if (range == -180)
{
range = 4;
}
obj.plc.WriteInt16("D2", range.ToString());//角度 1正转90 2反转90 3不转 4 反转180
obj.plc.WriteInt16("B1001", "1");//发送完成信号
Console.WriteLine($"plc信号货道信号下发成功!【货道号:{spaceNum}");
result = true;
break;
}
}
}
// 应答字允许下发
Console.WriteLine($"读取应答字是否下传成功!【{obj.plc.ReadInt32("D102")}】");
if (obj.plc.ReadInt32("D102") == 1)
else
{
//obj.plc.WriteInt32("D110", range);//旋转角度暂时不赋值由PLC转向
obj.plc.WriteInt32("D112", spaceNum[0]); //货道号
obj.plc.WriteInt32("D114", spaceNum[1]); //货道号
Console.WriteLine($"plc信号货道信号下发成功!【D112:{spaceNum[0]}】D114:{spaceNum[1]}");
result = true;
break;
Console.WriteLine($"plc未连接");
}
Thread.Sleep(500);
Thread.Sleep(100);
i++;
}
return result;
}
@ -432,6 +517,58 @@ namespace Aucma.Core.Palletiz.Business
}
}
public int GetStoreNum(PlcModel obj, int spaceNum)
{
int storeNum = 0;
switch (spaceNum)
{
case 1:
storeNum = obj.plc.ReadInt16("D1001");
break;
case 2:
storeNum = obj.plc.ReadInt16("D1002");
break;
case 3:
storeNum = obj.plc.ReadInt16("D1003");
break;
case 4:
storeNum = obj.plc.ReadInt16("D1004");
break;
case 5:
storeNum = obj.plc.ReadInt16("D1005");
break;
case 6:
storeNum = obj.plc.ReadInt16("D1006");
break;
case 7:
storeNum = obj.plc.ReadInt16("D1007");
break;
case 8:
storeNum = obj.plc.ReadInt16("D1008");
break;
case 9:
storeNum = obj.plc.ReadInt16("D1009");
break;
case 10:
storeNum = obj.plc.ReadInt16("D1010");
break;
case 11:
storeNum = obj.plc.ReadInt16("D1011");
break;
case 12:
storeNum = obj.plc.ReadInt16("D1012");
break;
case 13:
storeNum = obj.plc.ReadInt16("D1013");
break;
case 14:
storeNum = obj.plc.ReadInt16("D1014");
break;
default:
break;
}
return storeNum;
}
#endregion
#region 等待plc信号反馈
@ -482,23 +619,24 @@ namespace Aucma.Core.Palletiz.Business
/// <returns></returns>
private PlcModel GetPlcByScanner(string scannerIp)
{
PlcModel obj = null;
ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp);
if (model.Id < 3)
{
obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc"));
}
else
{
obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreBPlc"));
}
//PlcModel obj = null;
//ScannerModel model = allScanners.FirstOrDefault(x => x.Ip == scannerIp);
//if (model.Id < 3)
//{
// obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc"));
//}
//else
//{
// obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreBPlc"));
//}
PlcModel obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc"));
return obj;
}
#endregion
#endregion
#region 手动写入货道号给PLC数据
#region 写入货道号给PLC数据
/// <summary>
/// 手动写入PLC数据
/// </summary>
@ -513,7 +651,6 @@ namespace Aucma.Core.Palletiz.Business
if (tempStackInfo.IsLargeProducts)
{
obj.plc.WriteInt16("D7000", tempStackInfo.BinNo.ToString());//写入货道
obj.plc.WriteInt16("D7100", tempStackInfo.BinNo.ToString());//写入货道
}
else
{
@ -545,32 +682,159 @@ namespace Aucma.Core.Palletiz.Business
}
#endregion
} while (flagA);
return true;
}
else
{
LogInStoreInfoDelegateEvent?.Invoke("PLC未连接!", "Red");
return false;
}
//更新货道
return false;
}
private static void GetResposeB()
#endregion
#region 人工操作入库
/// <summary>
/// 临时写入入库
/// </summary>
/// <param name="freightLaneNumber">货道号</param>
/// <param name="range">转向: 1正转 2反转3不转</param>
/// <returns></returns>
public static bool TempWritePlc(int freightLaneNumber, int range)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStorePlc"));
//写入PLC
if (obj.plc.IsConnected)
try
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("InStoreAPlc"));
//写入PLC
bool flag = true;
do
{
#region 2号区域码垛——B
int responseWord2 = obj.plc.ReadInt16("D7120");//读取1号区域码垛 等待应答字回去
Console.WriteLine("手动写入PLC成功");
if (responseWord2 == 2)
if (obj == null)
{
obj.plc.WriteInt16("D7000", "0");//清空
return false;
}
#endregion
if (obj.plc.IsConnected)
{
bool isDown = false;
int i = 0;
do
{
isDown = obj.plc.ReadBool("B1000");
if (isDown)
{
Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}");
LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 当前下发信号为:{isDown}", "White");
break;
}
else
{
Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown},不可以下发");
LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 当前下发信号为:{isDown}", "Red");
}
Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}");
Thread.Sleep(1000);
i++;
} while (i < 3);
if (isDown == false)
{
Console.WriteLine($"[{DateTime.Now}] 下发失败,当前下发信号为:{isDown},请稍等后重试!");
LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 下发失败,当前下发信号为:{isDown},请稍等后重试!", "Red");
return false;
}
LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 开始下发PLC》货道号{freightLaneNumber}》角度(1正转 2反转 3不转){range}", "Red");
Console.WriteLine($"[{DateTime.Now}] 开始下发PLC》货道号{freightLaneNumber}》角度(1正转 2反转 3不转){range}");
if (isDown)
{
obj.plc.WriteInt16("D29", freightLaneNumber.ToString());//货道号
obj.plc.WriteInt16("D2", range.ToString());//角度 1正转90 2反转90 3不转 4 反转180
obj.plc.WriteInt16("B1001", "1");//发送完成信号
Console.WriteLine($"[{DateTime.Now}] 下发PLC成功");
LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 下发PLC成功", "Red");
//将手动信息保存到库中设置000000000未手动设置的成品码
Thread.Sleep(1000);
isDown = obj.plc.ReadBool("B1000");
if (isDown)
{
Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}");
}
else
{
Console.WriteLine($"[{DateTime.Now}] 当前下发信号为:{isDown}");
}
return true;
}
flag = false;
}
else
{
flag = true;
}
} while (flag);
return true;
}
catch (Exception ex)
{
Console.WriteLine($"[{DateTime.Now}] 手动下发任务异常:{ex.Message}");
LogInStoreInfoDelegateEvent?.Invoke($"[{DateTime.Now}] 手动下发任务异常:{ex.Message}", "Red");
return false;
}
}
#endregion
} while (flagA);
public bool WriteIF(PlcModel obj, string space)
{
bool flag = true;
switch (space)
{
case "FD01_001":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_002":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_003":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_004":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_005":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_006":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_007":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_008":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_009":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_010":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_011":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_012":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_013":
flag = obj.plc.ReadBool("D1001");
break;
case "FD01_014":
flag = obj.plc.ReadBool("D1001");
break;
default:
break;
}
return flag;
}
#endregion
}
}

@ -0,0 +1,726 @@
using Admin.Core.Common;
using Aucma.Core.Scanner;
using log4net;
using MvCodeReaderSDKNet;
using NPOI.SS.Formula.Functions;
using StackExchange.Profiling;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using UAParser;
namespace Aucma.Core.Palletiz.Business
{
public class MvCodeHelper
{
//private static AppConfig appConfig = AppConfig.Instance;
public static bool m_bGrabbing = true;
private static string lastCode;
private static List<ScannerModel> allScanners = Appsettings.app<ScannerModel>("ScannerServer").ToList();
// 10.10.92.230扫码器ip
private static string LinerScannerIp = allScanners.First(x => x.Name == "PalletizStoreCodeA").Ip;
// 10.10.92.231扫码器ip
private static string ShellScannerIp = allScanners.First(x => x.Name == "APalletizStoreCodeB2").Ip;
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(MvCodeHelper));
#region 全局变量定义
public static MvCodeReader ShellDevice = null;
public static MvCodeReader LinerDevice = null;
public static DateTime ShellLiveTime = DateTime.Now;
public static DateTime LinerLiveTime = DateTime.Now;
#endregion
#region 委托事件
/// <summary>
/// 成品入库委托
/// </summary>
/// <param name="materialCodeStr"></param>
/// <param name="ip"></param>
public delegate void RefreshPalletizDelegate(string materialCodeStr, string ip);
public static event RefreshPalletizDelegate RefreshPalletizDelegateEvent;
/// <summary>
/// 刷新扫码器状态
/// </summary>
/// <param name="materialCodeStr"></param>
/// <param name="ip"></param>
public delegate void RefreshState(string ip,bool flag);
public static event RefreshState RefreshStateEvent;
/// <summary>
/// 日志信息刷新
/// </summary>
/// <param name="message"></param>
public delegate void RefreshLogMessage(string message);
public static event RefreshLogMessage RefreshLogMessageEvent;
#endregion
#region +ShellImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser)
public static void ShellImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser)
{
var stFrameInfo = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2));
MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResult = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfo.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2));
// Console.WriteLine("CodeNum[" + Convert.ToString(stBcrResult.nCodeNum) + "]");
if (stBcrResult.nCodeNum == 0)
{
Console.WriteLine(DateTime.Now + ":外侧--->No Read 处理");
log.Info(DateTime.Now + ":外侧--->No Read 处理");
//更新扫码器存活时间
ShellLiveTime = DateTime.Now;
}
for (Int32 i = 0; i < stBcrResult.nCodeNum; i++)
{
bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode);
if (bIsValidUTF8)
{
string strCode = Encoding.UTF8.GetString(stBcrResult.stBcrInfoEx2[i].chCode);
Console.WriteLine(DateTime.Now + ":Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
}
else
{
string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode);
Console.WriteLine(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
log.Info(DateTime.Now + ":外侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
// RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
if (strCode.Trim().TrimEnd('\0').Length == 20)
{
//更新扫码器存活时间
ShellLiveTime = DateTime.Now;
//RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
// 业务处理
Console.WriteLine(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
}
else
{
// 更新存活时间
LinerLiveTime = DateTime.Now;
Console.WriteLine(DateTime.Now + ":外侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20当做No Read 处理");
log.Info(DateTime.Now + ":外侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20当做No Read 处理");
}
}
}
MvCodeReader.MV_CODEREADER_OCR_INFO_LIST stOcrInfo = (MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)Marshal.PtrToStructure(stFrameInfo.UnparsedOcrList.pstOcrList, typeof(MvCodeReader.MV_CODEREADER_OCR_INFO_LIST));
for (int i = 0; i < stOcrInfo.nOCRAllNum; i++)
{
string strOcrCharCode = Encoding.UTF8.GetString(stOcrInfo.stOcrRowInfo[i].chOcr);
// Console.WriteLine("Get OcrInfo:" + "ocrNum[" + i.ToString() + "], ocrLen[" + Convert.ToString(stOcrInfo.stOcrRowInfo[i].nOcrLen) + "], ocrChar[" + strOcrCharCode.Trim().TrimEnd('\0') + "]");
}
}
#endregion
#region + LinerImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser)
public static void LinerImageCallbackFunc(IntPtr pData, IntPtr pstFrameInfoEx2, IntPtr pUser)
{
var stFrameInfo = (MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2)Marshal.PtrToStructure(pstFrameInfoEx2, typeof(MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2));
MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2 stBcrResult = (MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2)Marshal.PtrToStructure(stFrameInfo.UnparsedBcrList.pstCodeListEx2, typeof(MvCodeReader.MV_CODEREADER_RESULT_BCR_EX2));
// Console.WriteLine("CodeNum[" + Convert.ToString(stBcrResult.nCodeNum) + "]");
if (stBcrResult.nCodeNum == 0)
{
Console.WriteLine(DateTime.Now + ":内侧--->No Read 处理");
log.Info(DateTime.Now + ":内侧--->No Read 处理");
// 更新存活时间
LinerLiveTime = DateTime.Now;
}
for (Int32 i = 0; i < stBcrResult.nCodeNum; i++)
{
bool bIsValidUTF8 = IsTextUTF8(stBcrResult.stBcrInfoEx2[i].chCode);
if (bIsValidUTF8)
{
string strCode = Encoding.UTF8.GetString(stBcrResult.stBcrInfoEx2[i].chCode);
Console.WriteLine(DateTime.Now + ":Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
}
else
{
string strCode = Encoding.GetEncoding("GB2312").GetString(stBcrResult.stBcrInfoEx2[i].chCode);
Console.WriteLine(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
log.Info(DateTime.Now + ":内侧扫码器==>Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode.Trim().TrimEnd('\0') + "]");
// RefreshMaterialCodeStrEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp);
if (strCode.Trim().TrimEnd('\0').Length == 20)
{
// 更新存活时间
LinerLiveTime = DateTime.Now;
// 业务处理
RefreshPalletizDelegateEvent?.Invoke(strCode.Trim().TrimEnd('\0'), LinerScannerIp);
//Console.WriteLine(strCode.Trim().TrimEnd('\0'), ShellScannerIp);
}
else
{
// 更新存活时间
LinerLiveTime = DateTime.Now;
Console.WriteLine(DateTime.Now + "内侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20当做No Read 处理");
log.Info(DateTime.Now + "内侧扫码器==>条码:" + strCode.Trim().TrimEnd('\0') + "长度不为20当做No Read 处理");
}
}
}
MvCodeReader.MV_CODEREADER_OCR_INFO_LIST stOcrInfo = (MvCodeReader.MV_CODEREADER_OCR_INFO_LIST)Marshal.PtrToStructure(stFrameInfo.UnparsedOcrList.pstOcrList, typeof(MvCodeReader.MV_CODEREADER_OCR_INFO_LIST));
Console.WriteLine("ocrAllNum[" + Convert.ToString(stOcrInfo.nOCRAllNum) + "]");
for (int i = 0; i < stOcrInfo.nOCRAllNum; i++)
{
string strOcrCharCode = Encoding.UTF8.GetString(stOcrInfo.stOcrRowInfo[i].chOcr);
Console.WriteLine("Get OcrInfo:" + "ocrNum[" + i.ToString() + "], ocrLen[" + Convert.ToString(stOcrInfo.stOcrRowInfo[i].nOcrLen) + "], ocrChar[" + strOcrCharCode.Trim().TrimEnd('\0') + "]");
}
}
#endregion
#region Shell()
public static void Shell()
{
ShellLiveTime = DateTime.Now;
MvCodeReader.cbOutputEx2delegate ImageCallback;
MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2 stFrameInfo = new MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2();
MvCodeReader device = new MvCodeReader();
int nRet = MvCodeReader.MV_CODEREADER_OK;
do
{
// ch:枚举设备 | en:Enum device
MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST stDevList = new MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST();
nRet = MvCodeReader.MV_CODEREADER_EnumDevices_NET(ref stDevList, MvCodeReader.MV_CODEREADER_GIGE_DEVICE);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("外侧", false);
//RefreshStateEvent?.Invoke("内侧", false);
Thread.Sleep(1000 * 10);
Console.WriteLine("Enum device failed:{0:x8}", nRet);
break;
}
Console.WriteLine("Enum device count : " + Convert.ToString(stDevList.nDeviceNum));
if (0 == stDevList.nDeviceNum)
{
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("外侧", false);
//RefreshStateEvent?.Invoke("内侧", false);
Thread.Sleep(1000 * 10);
break;
}
MvCodeReader.MV_CODEREADER_DEVICE_INFO stDevInfo; // 通用设备信息
int nDevIndex = -1;
// ch:打印设备信息 | en:Print device info
for (Int32 i = 0; i < stDevList.nDeviceNum; i++)
{
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
if (MvCodeReader.MV_CODEREADER_GIGE_DEVICE == stDevInfo.nTLayerType)
{
MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO stGigEDeviceInfo = (MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO)MvCodeReader.ByteToStruct(stDevInfo.SpecialInfo.stGigEInfo, typeof(MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO));
uint nIp1 = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24);
uint nIp2 = ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16);
uint nIp3 = ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8);
uint nIp4 = (stGigEDeviceInfo.nCurrentIp & 0x000000ff);
// Console.WriteLine("\n" + i.ToString() + ": [GigE] User Define Name : " + stGigEDeviceInfo.chUserDefinedName);
// Console.WriteLine("device IP :" + nIp1 + "." + nIp2 + "." + nIp3 + "." + nIp4);
string ipStr = nIp1 + "." + nIp2 + "." + nIp3 + "." + nIp4;
if (ipStr == ShellScannerIp)
{
nDevIndex = i;
Console.WriteLine("device IP :" + ipStr);
}
}
}
if (nDevIndex < 0)
{
Console.WriteLine("未找到外侧扫码器");
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("外侧", false);
Thread.Sleep(1000 * 30);
break;
}
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[nDevIndex], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
// ch:创建设备 | en:Create device
nRet = device.MV_CODEREADER_CreateHandle_NET(ref stDevInfo);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Create device failed:{0:x8}", nRet);
// 刷新扫码器状态
RefreshStateEvent?.Invoke("外侧", false);
break;
}
// ch:打开设备 | en:Open device
nRet = device.MV_CODEREADER_OpenDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Open device failed:{0:x8}", nRet);
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("外侧", false);
break;
}
// 刷新扫码器状态
RefreshStateEvent?.Invoke("外侧", true);
// ch:注册回调函数 | en:Register image callback
ImageCallback = new MvCodeReader.cbOutputEx2delegate(ShellImageCallbackFunc);
nRet = device.MV_CODEREADER_RegisterImageCallBackEx2_NET(ImageCallback, IntPtr.Zero);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Register image callback failed!");
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("外侧", false);
break;
}
// ch:开启抓图 || en: start grab image
nRet = device.MV_CODEREADER_StartGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Start grabbing failed:{0:x8}", nRet);
// 刷新扫码器状态
RefreshStateEvent?.Invoke("外侧", false);
break;
}
// 关闭使用
ShellDevice = device;
Console.WriteLine("Press enter to exit");
Console.WriteLine(DateTime.Now.ToString());
while (true)
{
Thread.Sleep(1000 * 60);
DateTime dateTime = DateTime.Now;
TimeSpan timeSpan = dateTime.Subtract(ShellLiveTime);
if (timeSpan.TotalMinutes >= 10)
{
Console.WriteLine("外侧扫码器超时");
//CloseShell();
//Shell();
break;
}
}
// Console.ReadLine();
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("外侧", false);
// ch:停止抓图 | en:Stop grabbing
nRet = device.MV_CODEREADER_StopGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Stop grabbing failed{0:x8}", nRet);
break;
}
// ch:关闭设备 | en:Close device
nRet = device.MV_CODEREADER_CloseDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Close device failed{0:x8}", nRet);
break;
}
// ch:销毁设备 | en:Destroy device
nRet = device.MV_CODEREADER_DestroyHandle_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
break;
}
} while (false);
Shell();
//if (MvCodeReader.MV_CODEREADER_OK != nRet)
//{
// // ch:销毁设备 | en:Destroy device
// nRet = device.MV_CODEREADER_DestroyHandle_NET();
// if (MvCodeReader.MV_CODEREADER_OK != nRet)
// {
// Console.WriteLine("Destroy device failed:{0:x8}", nRet);
// }
//}
}
#endregion
#region Liner()
public static void Liner()
{
LinerLiveTime = DateTime.Now;
MvCodeReader.cbOutputEx2delegate ImageCallback;
MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2 stFrameInfo = new MvCodeReader.MV_CODEREADER_IMAGE_OUT_INFO_EX2();
MvCodeReader device = new MvCodeReader();
int nRet = MvCodeReader.MV_CODEREADER_OK;
do
{
// ch:枚举设备 | en:Enum device
MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST stDevList = new MvCodeReader.MV_CODEREADER_DEVICE_INFO_LIST();
nRet = MvCodeReader.MV_CODEREADER_EnumDevices_NET(ref stDevList, MvCodeReader.MV_CODEREADER_GIGE_DEVICE);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
// 刷新扫码器状态
RefreshStateEvent?.Invoke("外侧", false);
RefreshStateEvent?.Invoke("内侧", false);
Thread.Sleep(1000 * 10);
Console.WriteLine("Enum device failed:{0:x8}", nRet);
break;
}
Console.WriteLine("Enum device count : " + Convert.ToString(stDevList.nDeviceNum));
if (0 == stDevList.nDeviceNum)
{
// 刷新扫码器状态
RefreshStateEvent?.Invoke("外侧", false);
RefreshStateEvent?.Invoke("内侧", false);
Thread.Sleep(1000 * 10);
break;
}
MvCodeReader.MV_CODEREADER_DEVICE_INFO stDevInfo; // 通用设备信息
Int32 nDevIndex = -1;
// ch:打印设备信息 | en:Print device info
for (Int32 i = 0; i < stDevList.nDeviceNum; i++)
{
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
if (MvCodeReader.MV_CODEREADER_GIGE_DEVICE == stDevInfo.nTLayerType)
{
MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO stGigEDeviceInfo = (MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO)MvCodeReader.ByteToStruct(stDevInfo.SpecialInfo.stGigEInfo, typeof(MvCodeReader.MV_CODEREADER_GIGE_DEVICE_INFO));
uint nIp1 = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24);
uint nIp2 = ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16);
uint nIp3 = ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8);
uint nIp4 = (stGigEDeviceInfo.nCurrentIp & 0x000000ff);
// Console.WriteLine("\n" + i.ToString() + ": [GigE] User Define Name : " + stGigEDeviceInfo.chUserDefinedName);
string ip = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8) + "." + (stGigEDeviceInfo.nCurrentIp & 0x000000ff);
string ipStr = nIp1 + "." + nIp2 + "." + nIp3 + "." + nIp4;
if (ipStr == LinerScannerIp)
{
Console.WriteLine("device IP :" + ipStr);
nDevIndex = i;
}
}
}
if (nDevIndex < 0)
{
Console.WriteLine("未找到10.10.92.230扫码器");
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("内侧", false);
Thread.Sleep(1000 * 30);
break;
}
stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(stDevList.pDeviceInfo[nDevIndex], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO));
// ch:创建设备 | en:Create device
nRet = device.MV_CODEREADER_CreateHandle_NET(ref stDevInfo);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Create device failed:{0:x8}", nRet);
break;
}
// ch:打开设备 | en:Open device
nRet = device.MV_CODEREADER_OpenDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Open device failed:{0:x8}", nRet);
// 刷新扫码器状态
RefreshStateEvent?.Invoke("外侧", false);
break;
}
// 刷新扫码器状态
//RefreshStateEvent?.Invoke("内侧", true);
// ch:注册回调函数 | en:Register image callback
ImageCallback = new MvCodeReader.cbOutputEx2delegate(LinerImageCallbackFunc);
nRet = device.MV_CODEREADER_RegisterImageCallBackEx2_NET(ImageCallback, IntPtr.Zero);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Register image callback failed!");
break;
}
// ch:开启抓图 || en: start grab image
nRet = device.MV_CODEREADER_StartGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Start grabbing failed:{0:x8}", nRet);
break;
}
// 关闭使用
ShellDevice = device;
Console.WriteLine("Press enter to exit");
Console.WriteLine(DateTime.Now.ToString());
while (true)
{
Thread.Sleep(1000 * 60);
DateTime dateTime = DateTime.Now;
TimeSpan timeSpan = dateTime.Subtract(LinerLiveTime);
if (timeSpan.TotalMinutes >= 10)
{
Console.WriteLine("内侧扫码器超时");
//CloseShell();
//Shell();
break;
}
}
//Console.ReadLine();
// ch:停止抓图 | en:Stop grabbing
nRet = device.MV_CODEREADER_StopGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Stop grabbing failed{0:x8}", nRet);
break;
}
// ch:关闭设备 | en:Close device
nRet = device.MV_CODEREADER_CloseDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Close device failed{0:x8}", nRet);
break;
}
// ch:销毁设备 | en:Destroy device
nRet = device.MV_CODEREADER_DestroyHandle_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
break;
}
} while (false);
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
// ch:销毁设备 | en:Destroy device
nRet = device.MV_CODEREADER_DestroyHandle_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
}
}
Liner();
}
#endregion
#region 关闭内胆扫码器
/// <summary>
/// 关闭内胆扫码器
/// </summary>
public static void CloseLiner()
{
int nRet = MvCodeReader.MV_CODEREADER_OK;
MvCodeReader device = LinerDevice;
// ch:停止抓图 | en:Stop grabbing
nRet = device.MV_CODEREADER_StopGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Stop grabbing failed{0:x8}", nRet);
return;
}
// ch:关闭设备 | en:Close device
nRet = device.MV_CODEREADER_CloseDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Close device failed{0:x8}", nRet);
return;
}
// ch:销毁设备 | en:Destroy device
nRet = device.MV_CODEREADER_DestroyHandle_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
return;
}
Console.WriteLine("关闭内胆扫码器成功");
return;
}
#endregion
#region 关闭箱壳扫码器
/// <summary>
/// 关闭箱壳扫码器
/// </summary>
public static void CloseShell()
{
int nRet = MvCodeReader.MV_CODEREADER_OK;
MvCodeReader device = ShellDevice;
// ch:停止抓图 | en:Stop grabbing
nRet = device.MV_CODEREADER_StopGrabbing_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Stop grabbing failed{0:x8}", nRet);
return;
}
// ch:关闭设备 | en:Close device
nRet = device.MV_CODEREADER_CloseDevice_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Close device failed{0:x8}", nRet);
return;
}
// ch:销毁设备 | en:Destroy device
nRet = device.MV_CODEREADER_DestroyHandle_NET();
if (MvCodeReader.MV_CODEREADER_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
return;
}
Console.WriteLine("关闭箱壳扫码器成功");
return;
}
#endregion
#region 监测扫码器15分钟以内是否有触发操作如果超时未触发关闭再重连扫码器
/// <summary>
/// 监测扫码器15分钟以内是否有触发操作如果超时未触发关闭再重连扫码器
/// </summary>
public static void JudgeShellIsConnectedAndReConnect()
{
try
{
DateTime dateTime = DateTime.Now;
TimeSpan timeSpan = dateTime.Subtract(ShellLiveTime);
Task.Run(() =>
{
if (timeSpan.TotalMinutes >= 1)
{
Console.WriteLine("箱壳扫码器超时,重连");
ShellLiveTime = dateTime;
CloseShell();
Shell();
}
});
Task.Run(() =>
{
TimeSpan timeSpan2 = dateTime.Subtract(LinerLiveTime);
if (timeSpan2.TotalMinutes >= 1)
{
Console.WriteLine("内胆扫码器超时,重连");
LinerLiveTime = dateTime;
CloseLiner();
Liner();
}
});
}
catch (Exception ex)
{
log.Error("JudgeShellIsConnectedAndReConnect判断扫码器重连方法异常:" + ex.Message.ToString());
}
}
#endregion
#region 判断字符编码
/// <summary>
/// 判断字符编码
/// </summary>
/// <param name="inputStream"></param>
/// <returns></returns>
public static bool IsTextUTF8(byte[] inputStream)
{
int encodingBytesCount = 0;
bool allTextsAreASCIIChars = true;
for (int i = 0; i < inputStream.Length; i++)
{
byte current = inputStream[i];
if ((current & 0x80) == 0x80)
{
allTextsAreASCIIChars = false;
}
// First byte
if (encodingBytesCount == 0)
{
if ((current & 0x80) == 0)
{
// ASCII chars, from 0x00-0x7F
continue;
}
if ((current & 0xC0) == 0xC0)
{
encodingBytesCount = 1;
current <<= 2;
// More than two bytes used to encoding a unicode char.
// Calculate the real length.
while ((current & 0x80) == 0x80)
{
current <<= 1;
encodingBytesCount++;
}
}
else
{
// Invalid bits structure for UTF8 encoding rule.
return false;
}
}
else
{
// Following bytes, must start with 10.
if ((current & 0xC0) == 0x80)
{
encodingBytesCount--;
}
else
{
// Invalid bits structure for UTF8 encoding rule.
return false;
}
}
}
if (encodingBytesCount != 0)
{
// Invalid bits structure for UTF8 encoding rule.
// Wrong following bytes count.
return false;
}
// Although UTF8 supports encoding for ASCII chars, we regard as a input stream, whose contents are all ASCII as default encoding.
return !allTextsAreASCIIChars;
}
#endregion
}
}

@ -63,9 +63,9 @@ namespace Aucma.Core.Palletiz
AddServices(services);
//任务调度
services.AddJobSetup();
//services.AddJobSetup();
//扫码器
services.AddScannerSetup();
// services.AddScannerSetup();
//PLC
services.AddPlcSetup();
//支持编码大全 例如:支持 System.Text.Encoding.GetEncoding("GB2312") System.Text.Encoding.GetEncoding("GB18030")
@ -88,8 +88,7 @@ namespace Aucma.Core.Palletiz
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
public void Configure(IApplicationBuilder app, ISysTasksQzService tasksQzService,
ISchedulerCenter schedulerCenter, IScannerService scannerService, IRunPlcService runPlcService)
public void Configure(IApplicationBuilder app, IRunPlcService runPlcService)
{
// 使用静态文件
app.UseStaticFiles();
@ -97,9 +96,9 @@ namespace Aucma.Core.Palletiz
//app.UseAuthorization();
// 开启QuartzNetJob调度服务
app.UseQuartzJobMildd(tasksQzService, schedulerCenter);
//app.UseQuartzJobMildd(tasksQzService, schedulerCenter);
//开启扫码服务
app.UseScannerMildd(scannerService);
//app.UseScannerMildd(scannerService);
//PLC
app.UsePlcMildd(runPlcService);
}

@ -1,9 +1,15 @@
using Aucma.Core.Palletiz.Business;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Service;
using Aucma.Core.Palletiz.Business;
using Aucma.Core.Palletiz.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Aucma.Core.Palletiz.ViewModels
@ -11,19 +17,17 @@ namespace Aucma.Core.Palletiz.ViewModels
public partial class HandPalletizViewModel : ObservableObject
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(HandPalletizViewModel));
#region 货道信息
private int LevelNo = 1;
private int BinNo = 1;
private int PortNo = 1;
private int RangeNo = 1;
#endregion
public static StackInfoModel tempStackInfo = new StackInfoModel();
public HandPalletizViewModel() {
PromptInfo("请选择信息下传......", "White");
private readonly IBaseSpaceInfoServices _baseSpaceInfoServices;
private readonly IRecordInStoreServices _recordInstoreServices;
public HandPalletizViewModel()
{
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
_recordInstoreServices = App.ServiceProvider.GetService<IRecordInStoreServices>();
Range = 1;
SpaceNo ="001";
InstoreBusiness.LogInStoreInfoDelegateEvent += PromptInfo;
PromptInfo("请选择信息下传......", "White");
}
#region 分垛信息下传
@ -35,21 +39,57 @@ namespace Aucma.Core.Palletiz.ViewModels
{
try
{
PromptInfo("分垛信息下传中......", "White");
DialogResult cr = MessageBox.Show("是否确认下传分垛信息?", "系统提醒", MessageBoxButtons.OKCancel);
if (cr != DialogResult.OK)
{
return;
}
tempStackInfo.LevelNo = LevelNo;
tempStackInfo.BinNo = (BinNo - 1) * 2 + PortNo + ((LevelNo - 1) * 10);
tempStackInfo.PortNo = PortNo;
tempStackInfo.RangeNo = RangeNo;
PromptInfo("分垛信息下传中......", "White");
bool backResult = InstoreBusiness.WritePlc(tempStackInfo);
int range = Range;
int spaceNo =Convert.ToInt32(SpaceNo);
if (spaceNo==0)
{
MessageBox.Show("请选择目的货道!","系统提醒");
return;
}
string hh = "FD01_" + SpaceNo;
Admin.Core.Model.BaseSpaceInfo spaceInfo = _baseSpaceInfoServices.FirstAsync(X => X.StoreCode.Contains("FD") && X.SpaceCode == "FD01_"+SpaceNo).Result;
if (spaceInfo == null)
{
MessageBox.Show("货道未创建!", "系统提醒");
return;
}
bool backResult = InstoreBusiness.TempWritePlc(spaceNo, range);
if (backResult)
{
PromptInfo("分垛信息下传成功!", "White");
#region 手动入库没有扫码 默认为"0000000000" 添加入库记录
RecordInStore recordInstore = new RecordInStore();// 入库记录
recordInstore.SpaceCode = spaceInfo.SpaceCode;
recordInstore.StoreCode = spaceInfo.StoreCode;
recordInstore.MaterialType = "0000000000";
recordInstore.MaterialCode = "0000000000";
recordInstore.MaterialName = "0000000000";
recordInstore.BarCodeCode= "0000000000";
recordInstore.InStoreAmount = 1;
recordInstore.InStoreTime = DateTime.Now;
recordInstore.InStoreTime = DateTime.Now;
recordInstore.CreatedTime = DateTime.Now;
recordInstore.UpdateTime = DateTime.Now;
int r= _recordInstoreServices.AddAsync(recordInstore).Result;
if (r>0)
{
PromptInfo("分垛信息下传成功!", "White");
}
else
{
PromptInfo("分垛信息下传成功!入库明细保存失败!", "Red");
}
#endregion
}
else
{
@ -100,5 +140,27 @@ namespace Aucma.Core.Palletiz.ViewModels
}));
}
#endregion
#region 目的货道
private string spaceNo;
public string SpaceNo
{
get => spaceNo;
set => SetProperty(ref spaceNo, value);
}
#endregion
#region 方向
private int range;
public int Range
{
get => range;
set => SetProperty(ref range, value);
}
#endregion
}
}

@ -15,6 +15,7 @@ using System.Windows.Threading;
using System.Threading.Tasks;
using Admin.Core.IService;
using Microsoft.Extensions.DependencyInjection;
using Aucma.Core.Palletiz.Business;
namespace Aucma.Core.Palletiz.ViewModels
{
@ -35,8 +36,16 @@ namespace Aucma.Core.Palletiz.ViewModels
{
await RefreshTeamTime();//班组时间
});
//测试开启
//InstoreBusiness instore=new InstoreBusiness();
//instore.test();
Task.Run(() =>
{
Thread.Sleep(2000);
Business.MvCodeHelper.Liner();
});
}
public void init()
@ -110,7 +119,7 @@ namespace Aucma.Core.Palletiz.ViewModels
public void RefreshScanner()
{
string ip1 = Appsettings.app("Middleware", "Scanner1", "Ip");
bool flag1 = MvCodeHelper.ConnectionStatus(ip1);
bool flag1 = true;// MvCodeHelper.ConnectionStatus(ip1);
Scanner1State(flag1);
}
#endregion

@ -22,6 +22,7 @@ namespace Aucma.Core.Palletiz.ViewModels
LoadDataGrid();
SelectTypeViewModel.RefreshPageEvent += LoadDataGrid;
}
public void LoadDataGrid()
{
Spaces.Clear();
@ -51,7 +52,6 @@ namespace Aucma.Core.Palletiz.ViewModels
SelectType direct = new SelectType(info);
direct.ShowDialog();
}
}
private BaseSpaceInfo selectedDataItem;

@ -1,20 +1,16 @@
using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Model.Model_New;
using Admin.Core.Service;
using Aucma.Core.Palletiz.Common;
using Aucma.Core.Palletiz.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Logging;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -39,8 +35,8 @@ namespace Aucma.Core.Palletiz.ViewModels
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(BaseSpaceInfoServices));
private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices;
private readonly IBaseOrderInfoServices? _baseOrderInfoServices;
private readonly IBaseSpaceInfoServices _baseSpaceInfoServices;
private string spaceCodes = string.Empty;
private AppConfigHelper appConfig = new AppConfigHelper();
@ -48,7 +44,8 @@ namespace Aucma.Core.Palletiz.ViewModels
public SelectTypeViewModel(BaseSpaceInfo space)
{
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
_baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
_baseOrderInfoServices = App.ServiceProvider.GetService<IBaseOrderInfoServices>();
//_baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
SpaceInfo = space;
SearchCriteriaViewModel.RefreshConfigDelegateEvent += SaveSearchCriteria;
@ -74,11 +71,11 @@ namespace Aucma.Core.Palletiz.ViewModels
string station = Appsettings.app("StationInfo", "StationCode");
if (!string.IsNullOrEmpty(selectedOption))
{
var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200" && x.MaterialName.Contains(selectedOption));
var infos = await _baseOrderInfoServices.QueryAsync(x => x.MaterialName.Contains(selectedOption));
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
{
foreach (BaseMaterialInfo info in infos)
foreach (BaseOrderInfo info in infos)
{
MaterialDataGrid.Add(info);
}
@ -113,11 +110,11 @@ namespace Aucma.Core.Palletiz.ViewModels
//初始化加载数据
public async void Load(BaseSpaceInfo space)
{
var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200");
var infos = await _baseOrderInfoServices.QueryAsync(d=>d.CompleteAmount!=d.OrderAmount);
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
{
foreach (BaseMaterialInfo info in infos)
foreach (BaseOrderInfo info in infos)
{
MaterialDataGrid.Add(info);
}
@ -133,7 +130,7 @@ namespace Aucma.Core.Palletiz.ViewModels
{
IsSelectedOptionB = true;
}
planInfo.MaterialCode = space.MaterialType;
planInfo.MaterialName = space.typeNameA;
@ -151,9 +148,9 @@ namespace Aucma.Core.Palletiz.ViewModels
/// <summary>
/// 初始化物料信息
/// </summary>
private ObservableCollection<BaseMaterialInfo> materialDataGrid = new ObservableCollection<BaseMaterialInfo>();
private ObservableCollection<BaseOrderInfo> materialDataGrid = new ObservableCollection<BaseOrderInfo>();
public ObservableCollection<BaseMaterialInfo> MaterialDataGrid
public ObservableCollection<BaseOrderInfo> MaterialDataGrid
{
get { return materialDataGrid; }
set => SetProperty(ref materialDataGrid, value);
@ -173,8 +170,8 @@ namespace Aucma.Core.Palletiz.ViewModels
/// <summary>
/// 初始化下拉列表
/// </summary>
private BaseMaterialInfo selectedDataItem;
public BaseMaterialInfo SelectedDataItem
private BaseOrderInfo selectedDataItem;
public BaseOrderInfo SelectedDataItem
{
get { return selectedDataItem; }
set => SetProperty(ref selectedDataItem, value);
@ -220,8 +217,8 @@ namespace Aucma.Core.Palletiz.ViewModels
#endregion
#region 计划信息
private BaseMaterialInfo planInfo = new BaseMaterialInfo();
public BaseMaterialInfo PlanInfo
private BaseOrderInfo planInfo = new BaseOrderInfo();
public BaseOrderInfo PlanInfo
{
get { return planInfo; }
set => SetProperty(ref planInfo, value);
@ -361,7 +358,6 @@ namespace Aucma.Core.Palletiz.ViewModels
try
{
// 转向角度
spaceInfo.RotationRange = int.Parse(SelectedRotation.Content.ToString());
spaceInfo.IsTwoSpace = IsSelectedOptionA ? 1 : 0;
spaceInfo.LastSpace = string.Empty;
@ -436,11 +432,11 @@ namespace Aucma.Core.Palletiz.ViewModels
{
if (!string.IsNullOrEmpty(searchText))
{
var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200" && (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText)));
var infos = await _baseOrderInfoServices.QueryAsync(x => (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText)));
MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() =>
{
foreach (BaseMaterialInfo info in infos)
foreach (BaseOrderInfo info in infos)
{
MaterialDataGrid.Add(info);
}

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" WindowStartupLocation="CenterScreen" FontFamily="Microsoft YaHei"
Title="手动分垛" Height="600" Width="800" Name="window" Background="White"
Title="手动分垛" Height="800" Width="800" Name="window" Background="White"
ResizeMode="NoResize" Topmost="True">
<Border Margin="5" Background="#1254AB" CornerRadius="10">
<Border.Effect>
@ -26,9 +26,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
@ -36,50 +34,61 @@
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
<TextBlock Text="手动分垛" FontSize="25" Foreground="#FFFFFF" Margin="10,0,0,0"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0" Visibility="Collapsed">
<TextBlock Text="成品码:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,50,0" VerticalAlignment="Center" />
<TextBox x:Name="txtBarCode" FontSize="20" Foreground="white" Height="50" Width="400" Style="{x:Null}" Margin="20 0" />
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<TextBlock Text="所属仓库:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,50,0" VerticalAlignment="Center" />
<Button x:Name="btn_A" Content="A 库" FontSize="20" Background="Lime" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Cursor="Hand" Click="btn_A_Click" />
<Button x:Name="btn_B" Content="B 库" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Margin="20 0" Click="btn_B_Click"/>
<Button x:Name="btn_B" Content="B 库" FontSize="20" IsEnabled="False" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Margin="20 0" Click="btn_B_Click"/>
</StackPanel>
<UniformGrid Grid.Row="3" VerticalAlignment="Center" Margin="50,0,0,0">
<StackPanel Width="500">
<WrapPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<WrapPanel Height="50" Orientation="Horizontal" VerticalAlignment="Center" Margin="0 10 0 0">
<TextBlock Text="目的货道:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,50,0" VerticalAlignment="Center" />
</StackPanel>
<StackPanel Width="500">
<Button x:Name="btn_space1" Content="1" FontSize="18" Background="Lime" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="45" RenderTransformOrigin="0.5,0.5" Margin="0 0 10 0" Click="btn_space1_Click"/>
<Button x:Name="btn_space2" Content="2" FontSize="18" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="45" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space2_Click"/>
<Button x:Name="btn_space3" Content="3" FontSize="18" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="45" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space3_Click"/>
<Button x:Name="btn_space4" Content="4" FontSize="18" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="45" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space4_Click"/>
<Button x:Name="btn_space5" Content="5" FontSize="18" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="45" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space5_Click"/>
<Button x:Name="btn_space6" Content="6" FontSize="18" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="45" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space6_Click"/>
<Button x:Name="btn_space7" Content="7" FontSize="18" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="45" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space6_Click"/>
</StackPanel>
</UniformGrid>
<StackPanel Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<TextBlock Text="货道分流:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,50,0" VerticalAlignment="Center" />
<Button x:Name="btn_left" Content="左 道" FontSize="20" Background="Lime" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Click="btn_left_Click" />
<Button x:Name="btn_right" Content="右 道" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Margin="20 0" Click="btn_right_Click"/>
</StackPanel>
<StackPanel Grid.Row="5" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
</WrapPanel>
<TextBlock x:Name="btn_spaceTemp" Text="{Binding SpaceNo,Mode=TwoWay}" Visibility="Collapsed" />
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5 0 0 0">
<Button x:Name="btn_space1" Content="1" FontSize="15" Background="Lime" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="0 0 10 0" Click="btn_space1_Click"/>
<Button x:Name="btn_space2" Content="2" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space2_Click"/>
<Button x:Name="btn_space3" Content="3" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space3_Click"/>
<Button x:Name="btn_space4" Content="4" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space4_Click"/>
<Button x:Name="btn_space5" Content="5" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space5_Click"/>
<Button x:Name="btn_space6" Content="6" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space6_Click"/>
<Button x:Name="btn_space7" Content="7" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space7_Click"/>
<Button x:Name="btn_space8" Content="8" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space8_Click"/>
</WrapPanel>
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center" Height="50" Margin="140 5 0 0">
<Button x:Name="btn_space9" Content="9" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space9_Click"/>
<Button x:Name="btn_space10" Content="10" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space10_Click"/>
<Button x:Name="btn_space11" Content="11" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space11_Click"/>
<Button x:Name="btn_space12" Content="12" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space12_Click"/>
<Button x:Name="btn_space13" Content="13" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space13_Click"/>
<Button x:Name="btn_space14" Content="14" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space14_Click"/>
<Button x:Name="btn_space15" Content="15" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space15_Click"/>
<Button x:Name="btn_space16" Content="16" FontSize="15" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="50" RenderTransformOrigin="0.5,0.5" Margin="10 0" Click="btn_space16_Click"/>
</WrapPanel>
</WrapPanel>
<StackPanel Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<TextBlock x:Name="btn_RangeTemp" Text="{Binding Range,Mode=TwoWay}" />
<TextBlock Text="转向方向:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,50,0" VerticalAlignment="Center" />
<Button Content="正 向" FontSize="20" Background="Lime" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Click="btn_left_Click" />
<Button Content="逆 向" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Margin="20 0" Click="btn_right_Click"/>
<Button x:Name="Forward" Content="正向90" FontSize="20" Background="Lime" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Click="btn_left_Click" />
<Button x:Name="Reverse" Content="逆向90" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0,0.5" Margin="20 0 20 0" Click="btn_right_Click"/>
<Button x:Name="Reverse180" Content="逆向180" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="115" RenderTransformOrigin="0,0.5" Margin="20 0 20 0" Click="btn_right180_Click"/>
<Button x:Name="Unchanged" Content="不 转" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0,0.5" Click="btn_unchanged_Click"/>
</StackPanel>
<StackPanel Grid.Row="5" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0" Visibility="Collapsed">
<TextBlock Text="转向角度:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,50,0" VerticalAlignment="Center" />
<Button x:Name="btn_range90" Content="90°" FontSize="20" Background="Lime" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Click="btn_range90_Click" />
<Button x:Name="btn_range180" Content="180°" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Margin="20 0" Click="btn_range180_Click"/>
<Button x:Name="btn_range90" Content="90°" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Click="btn_range90_Click" />
<Button x:Name="btn_range0" Content="0°" FontSize="20" Background="DarkCyan" BorderBrush="#FF36B5C1" Foreground="white" Height="50" Width="103" RenderTransformOrigin="0.5,0.5" Margin="20 0" Click="btn_range0_Click"/>
</StackPanel>
<StackPanel Grid.Row="6" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<StackPanel Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<TextBlock Text="提示信息:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,50,0" VerticalAlignment="Center" />
<TextBlock Text="{Binding MsgTxt}" Foreground="{Binding MsgColor,Mode=TwoWay}" FontWeight="Bold" FontSize="20" Width="400" Height="35"/>
</StackPanel>
<StackPanel Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0">
<StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 10 0">
<Button Content="保 存" FontSize="20" Command="{Binding SaveCommand}" Background="#FF36B5C1" BorderBrush="#FF36B5C1" Foreground="white" Margin="0,0,10,0" Height="50" Width="100" />
<Button Content="取 消" FontSize="20" Command="{Binding CloseWindowCommand}" CommandParameter="{Binding ElementName=window}" Background="#FF9900" Foreground="white" Margin="10,0,0,0" Height="50" BorderBrush="#FF9900" Width="100" Click="Button_Click_1" />
</StackPanel>

@ -25,13 +25,13 @@ namespace Aucma.Core.Palletiz.Views
private string store = "A";
private int space = 1;
/// <summary>
/// 货道分流
/// 转向 1正向 2:反向 3:不变
/// </summary>
private string spaceDirection = "左";
private int spaceDirection = 1;
/// <summary>
/// 转向角度
/// 转向角度 1 90
/// </summary>
private int range = 90;
private int range = 1;
@ -66,18 +66,38 @@ namespace Aucma.Core.Palletiz.Views
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
space = 1;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "001";
}
private void btn_space2_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.Lime;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
space = 2;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "002";
}
private void btn_space3_Click(object sender, RoutedEventArgs e)
@ -88,7 +108,17 @@ namespace Aucma.Core.Palletiz.Views
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
space = 3;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "003";
}
private void btn_space4_Click(object sender, RoutedEventArgs e)
@ -99,7 +129,17 @@ namespace Aucma.Core.Palletiz.Views
btn_space4.Background = Brushes.Lime;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
space = 4;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "004";
}
private void btn_space5_Click(object sender, RoutedEventArgs e)
@ -110,7 +150,17 @@ namespace Aucma.Core.Palletiz.Views
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.Lime;
btn_space6.Background = Brushes.DarkCyan;
space = 5;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "005";
}
private void btn_space6_Click(object sender, RoutedEventArgs e)
@ -121,25 +171,253 @@ namespace Aucma.Core.Palletiz.Views
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.Lime;
space = 6;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "006";
}
private void btn_space7_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.Lime;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "007";
}
private void btn_space8_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.Lime;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "008";
}
private void btn_space9_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.Lime;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "009";
}
private void btn_space10_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.Lime;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "010";
}
private void btn_space11_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.Lime;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "011";
}
private void btn_space12_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.Lime;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "012";
}
private void btn_space13_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.Lime;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "013";
}
private void btn_space14_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.Lime;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "014";
}
private void btn_space15_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.Lime;
btn_space16.Background = Brushes.DarkCyan;
this.btn_spaceTemp.Text = "015";
}
private void btn_space16_Click(object sender, RoutedEventArgs e)
{
btn_space1.Background = Brushes.DarkCyan;
btn_space2.Background = Brushes.DarkCyan;
btn_space3.Background = Brushes.DarkCyan;
btn_space4.Background = Brushes.DarkCyan;
btn_space5.Background = Brushes.DarkCyan;
btn_space6.Background = Brushes.DarkCyan;
btn_space7.Background = Brushes.DarkCyan;
btn_space8.Background = Brushes.DarkCyan;
btn_space9.Background = Brushes.DarkCyan;
btn_space10.Background = Brushes.DarkCyan;
btn_space11.Background = Brushes.DarkCyan;
btn_space12.Background = Brushes.DarkCyan;
btn_space13.Background = Brushes.DarkCyan;
btn_space14.Background = Brushes.DarkCyan;
btn_space15.Background = Brushes.DarkCyan;
btn_space16.Background = Brushes.Lime;
this.btn_spaceTemp.Text = "016";
}
#endregion
#region 货道分流选择
#region 转向
private void btn_left_Click(object sender, RoutedEventArgs e)
{
btn_left.Background = Brushes.Lime;
btn_right.Background = Brushes.DarkCyan;
spaceDirection = "左";
Forward.Background = Brushes.Lime;
Reverse.Background = Brushes.DarkCyan;
Unchanged.Background = Brushes.DarkCyan;
Reverse180.Background = Brushes.DarkCyan;
this.btn_RangeTemp.Text = "1";
}
private void btn_right_Click(object sender, RoutedEventArgs e)
{
btn_left.Background = Brushes.DarkCyan;
btn_right.Background = Brushes.Lime;
spaceDirection = "右";
Forward.Background = Brushes.DarkCyan;
Reverse.Background = Brushes.Lime;
Unchanged.Background = Brushes.DarkCyan;
Reverse180.Background = Brushes.DarkCyan;
this.btn_RangeTemp.Text = "2";
}
private void btn_right180_Click(object sender, RoutedEventArgs e)
{
Forward.Background = Brushes.DarkCyan;
Reverse.Background = Brushes.DarkCyan;
Reverse180.Background = Brushes.Lime;
Unchanged.Background = Brushes.DarkCyan;
this.btn_RangeTemp.Text = "4";
}
private void btn_unchanged_Click(object sender, RoutedEventArgs e)
{
Forward.Background = Brushes.DarkCyan;
Reverse.Background = Brushes.DarkCyan;
Unchanged.Background = Brushes.Lime;
this.btn_RangeTemp.Text = "3";
}
@ -149,26 +427,19 @@ namespace Aucma.Core.Palletiz.Views
private void btn_range90_Click(object sender, RoutedEventArgs e)
{
btn_range90.Background = Brushes.Lime;
btn_range180.Background = Brushes.DarkCyan;
btn_range0.Background = Brushes.DarkCyan;
//btn_range270.Background = Brushes.DarkCyan;
range = 90;
}
private void btn_range180_Click(object sender, RoutedEventArgs e)
private void btn_range0_Click(object sender, RoutedEventArgs e)
{
btn_range90.Background = Brushes.DarkCyan;
btn_range180.Background = Brushes.Lime;
btn_range0.Background = Brushes.Lime;
// btn_range270.Background = Brushes.DarkCyan;
range = 180;
range = 0;
}
private void btn_range270_Click(object sender, RoutedEventArgs e)
{
btn_range90.Background = Brushes.DarkCyan;
btn_range180.Background = Brushes.DarkCyan;
//btn_range270.Background = Brushes.Lime;
range = 270;
}
#endregion

@ -137,6 +137,7 @@
ColumnWidth="*" AutoGenerateColumns="False" IsReadOnly="True" CanUserAddRows="False" SelectionMode="Single"
SelectedItem="{Binding SelectedDataItem}" SelectionChanged="DataGrid_SelectionChanged">
<DataGrid.Columns>
<!--<DataGridTextColumn Binding="{Binding OrderCode}" Width="*" Header="订单编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>-->
<DataGridTextColumn Binding="{Binding MaterialCode}" Width="*" Header="产品编码" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding MaterialName}" Width="5*" Header="产品名称" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
</DataGrid.Columns>
@ -226,7 +227,8 @@
<ComboBoxItem Content="0" />
<ComboBoxItem Content="90" />
<ComboBoxItem Content="180" />
<ComboBoxItem Content="270" />
<ComboBoxItem Content="-90" />
<ComboBoxItem Content="-180" />
</ComboBox>
</StackPanel>
<StackPanel Grid.Row="6" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">

@ -177,28 +177,13 @@
"ScannerServer": [
{
"Id": 1,
"Ip":"127.0.0.1",// 192.168.1.19",
"Name": "A库扫码器1"
"Ip": "10.10.92.230", // 192.168.1.19",
"Name": "PalletizStoreCodeA"
},
{
"Id": 2,
"Ip": "127.0.0.1",//"192.168.1.20",
"Name": "A库扫码器2"
},
{
"Id": 3,
"Ip": "127.0.0.1", //"192.168.1.20",
"Name": "B库扫码器1"
},
{
"Id": 4,
"Ip": "192.168.1.22",
"Name": "B库扫码器2"
},
{
"Id": 5,
"Ip": "192.168.1.23",
"Name": "B库扫码器3"
"Ip": "10.10.92.231", //"192.168.1.20",
"Name": "APalletizStoreCodeB2"
}
],
"PLCServer": [
@ -207,16 +192,8 @@
"EquipName": "InStoreAPlc",
"PlcType": "Melsec",
"Enabled": true,
"IP": "127.0.0.1",
"Port": 6000
},
{
"Id": 2,
"EquipName": "InStoreBPlc",
"PlcType": "Melsec",
"Enabled": true,
"IP": "127.0.0.1",
"Port": 6001
"IP": "10.10.92.80", //10.10.92.80
"Port": 2015
}
],
"StoreInfo": {

@ -163,7 +163,7 @@ namespace Aucma.Core.PrintTo.ViewModels
/// 打印
/// </summary>
[RelayCommand]
private async void Print(string obj)
private void Print(string obj)
{
if (string.IsNullOrEmpty(obj))
{
@ -205,8 +205,8 @@ namespace Aucma.Core.PrintTo.ViewModels
PrintIsEnabled = "False";
//更新打印名称
var baseOrder=await _baseOrderInfoServices.FirstAsync(d=>d.OrderCode== order_code);
await _baseOrderInfoServices.UpdatePrintName(baseOrder);
var baseOrder= _baseOrderInfoServices.FirstAsync(d=>d.OrderCode== order_code).Result;
_ = _baseOrderInfoServices.UpdatePrintName(baseOrder).Result;
PrintToDevView printToDev = new PrintToDevView(order_code,product_code, product_name, standard_amount, printName,printType);
printToDev.ShowDialog();
}

@ -368,15 +368,14 @@ namespace Aucma.Core.PrintTo.ViewModels
var num= _printBarCodeServices.AddAsync(printBarCode).Result;
if (num<=0)
{
Console.WriteLine($"数据已保存【订单:{printBarCode.OrderCode}》条码:{printBarCode.MaterialBarcode}】");
BarcodesPrinted.Enqueue(BarcodesUnprinted.Dequeue());
Thread.Sleep(1000);
}
else
{
ErrorNum++;
log.Error($"打印保存出错:{printBarCode.ToJson()}");
}
}
catch (Exception ex)
{
@ -388,7 +387,7 @@ namespace Aucma.Core.PrintTo.ViewModels
}
//打印完成
SetCompletetd();
Thread.Sleep (3000);
Thread.Sleep (1000);
}
catch (Exception ex)
{
@ -466,7 +465,6 @@ namespace Aucma.Core.PrintTo.ViewModels
}
#endregion
#region 递归获取内胆、箱体数量
public static void GetParentID(List<BaseBomInfo> treeNodes, string materialCode)
{

@ -317,10 +317,10 @@ namespace Aucma.Core.Scanner
// DoorReceiveCodeDelegateEvent?.Invok'e(strCode);//箱门匹配扫码器
// 获取到条码处理业务
Console.WriteLine($"条码:{strCode}");
HandlePalletizDelegateEvent?.Invoke(strCode, hashmap.Value);//成品扫码入分垛库
//HandlePalletizDelegateEvent?.Invoke(strCode, hashmap.Value);//成品扫码入分垛库
Console.WriteLine(strCode, hashmap.Value);
// 泡前库业务处理
PQKReceiveCodeEvent(strCode);
//PQKReceiveCodeEvent(strCode);
lastCodeStr = strCode;
}
}

@ -1,6 +1,7 @@
using Admin.Core.IService;
using Admin.Core.Model;
using log4net;
using Serilog;
using StackExchange.Profiling.Internal;
/// <summary>
@ -14,12 +15,14 @@ namespace Aucma.Core.TemperatureTask
public static event RefreshBoxFoamDataDelegate? RefreshBoxFoamDataDelegateEvent;
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(AucamTemperatureMeasurementService));
private readonly IBoxTemperatureMeasurementHistoryServices _boxTMHistoryServices;
private readonly ITestedCodeMESServices _codeMESServices;
private readonly ITemperatureHistoryServices _temperatureHistoryServices;
public AucamTemperatureMeasurementService(ITemperatureHistoryServices temperatureHistoryServices, IBoxTemperatureMeasurementHistoryServices boxTMHistoryServices)
bool flag = true;
public AucamTemperatureMeasurementService(ITemperatureHistoryServices temperatureHistoryServices,
ITestedCodeMESServices codeMESServices)
{
_boxTMHistoryServices = boxTMHistoryServices;
_codeMESServices = codeMESServices;
_temperatureHistoryServices = temperatureHistoryServices;
}
@ -27,11 +30,8 @@ namespace Aucma.Core.TemperatureTask
{
while (true)
{
Task.Run(async () =>
{
await Run();
});
Thread.Sleep(1000);
Run();
Thread.Sleep(5000);
}
}
@ -40,65 +40,97 @@ namespace Aucma.Core.TemperatureTask
/// 采集任务处理
/// </summary>
/// <returns></returns>
public async Task Run()
public async void Run()
{
try
{
DateTime dt=DateTime.Now;
Console.WriteLine($"开始读取测温数据》起始时间:{dt}");
var list = _temperatureHistoryServices.QueryTemperatureHistory(dt);
Console.WriteLine($"时间:{dt};读取数据个数:{list.Count()}");
Console.WriteLine($"读取到的数据:{list.ToJson()}");
List<BoxTemperatureMeasurementHistory> historyList = new List<BoxTemperatureMeasurementHistory>();
foreach (var item in list)
if (flag)
{
BoxTemperatureMeasurementHistory dest = new BoxTemperatureMeasurementHistory();
dest.LineNo = item.Line_No;
dest.Gongwno = item.Gongwno;
dest.Cpno = item.Cpno;
dest.Cpmodel = item.CpModel;
dest.Factorymodel = item.FactoryModel;
dest.Voltage = item.Voltage;
dest.Point2 = item.Point2;
dest.TestTime = item.TestTime;
dest.TestedTime = item.TestedTime;
dest.Etemp = item.Etemp;
dest.BeginDatetime = item.BeginDateTime;
dest.CpResult = item.CpResult;
dest.EndDateTime = item.EndDateTime;
dest.UserName = item.UserName;
dest.Remark = item.Remark;
dest.TestNo = item.TestNo;
dest.Temp_Mes = item.Temp_Mes;
dest.Power_Mes = item.Power_Mes;
dest.Part_Mes = item.Part_Mes;
dest.ErrorCode_Mes = item.ErrorCode_Mes;
dest.T1Name = item.T1Name;
dest.T2Name = item.T2Name;
dest.T3Name = item.T3Name;
dest.T4Name = item.T4Name;
dest.T5Name = item.T5Name;
dest.T6Name = item.T6Name;
dest.IsOrder = item.IsOrder;
dest.LowV_Time = item.LowV_Time;
dest.LowV_PowerMin = item.LowV_PowerMin;
dest.LowV_PowerMax = item.LowV_PowerMax;
dest.LowV_PowerFact = item.LowV_PowerFact;
dest.LowVoltage = item.LowVoltage;
historyList.Add(dest);
try
{
flag = false;
DateTime dt;
Console.WriteLine($"【{DateTime.Now}】开始读取测温数据");
string sql = "select top 1 * from TemperatureHistory order by SyncDate desc";
var allList= await _temperatureHistoryServices.QuerySqlAsync(sql,null);
if (allList == null || allList.Count == 0)
{
dt = DateTime.Now.AddMinutes(-5);
}
else
{
TemperatureHistory maxHistory = allList.First();
if (maxHistory.SyncDate.ToString()==null)
{
dt = Convert.ToDateTime(maxHistory.EndDateTime);
}
else
{
dt = Convert.ToDateTime(maxHistory.SyncDate);
}
}
var historyList = _codeMESServices.QueryTemperatureHistory(dt);
var query = (from a in historyList
select new TemperatureHistory
{
Line_No = a.Line_No,
Gongwno = a.Gongwno,
CpNo = a.CpNo,
CpModel = a.CpModel,
FactoryModel = a.FactoryModel,
Voltage = a.Voltage,
Point2 = a.Point2,
TestTime = a.TestTime,
TestedTime = a.TestedTime,
Etemp = a.Etemp,
BeginDateTime = a.BeginDateTime,
CpResult = a.CpResult,
EndDateTime = a.EndDateTime,
UserName = a.UserName,
Remark = a.Remark,
TestNo = a.TestNo,
Temp_Mes = a.Temp_Mes,
Power_Mes = a.Power_Mes,
Part_Mes = a.Part_Mes,
ErrorCode_Mes = a.ErrorCode_Mes,
T1Name = a.T1Name,
T2Name = a.T2Name,
T3Name = a.T3Name,
T4Name = a.T4Name,
T5Name = a.T5Name,
T6Name = a.T6Name,
IsOrder = a.IsOrder,
LowV_Time = a.LowV_Time,
LowV_PowerMin = a.LowV_PowerMin,
LowV_PowerMax = a.LowV_PowerMax,
LowV_PowerFact = a.LowV_PowerFact,
LowVoltage = a.LowVoltage,
SyncDate = dt
}).ToList();
if (query == null|| query.Count==0) return;
Console.WriteLine($"【{DateTime.Now}】读取数据个数:{historyList.Count()}");
var result = await _temperatureHistoryServices.AddAsync(query);
if (result > 0)
{
Console.WriteLine($"【{DateTime.Now}】保存测温数据成功!保存数量:{query.Count}");
}
Thread.Sleep(50000);
}
catch (Exception ex)
{
Console.WriteLine($"【{DateTime.Now}】 {ex.Message}");
logHelper.Error(ex.Message);
}
finally { flag = true; }
}
Console.WriteLine($"映射个数:{historyList.Count()}");
var result = await _boxTMHistoryServices.AddAsync(historyList);
if (result > 0)
{
if (list == null) return;
list.ForEach(x => x.flag = 1);
await _temperatureHistoryServices.UpdateAsync(list);
Console.WriteLine("保存测温系统成功");
}
}
catch (Exception ex)
{

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("HwControlLib")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+60c5f54c3d8d93d68f008d6dfcabe9fc57d1a982")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f242c55c6773055ed882072b4cbd144f26a025f1")]
[assembly: System.Reflection.AssemblyProductAttribute("HwControlLib")]
[assembly: System.Reflection.AssemblyTitleAttribute("HwControlLib")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
a218c3aef6d49bc3835c2cb2557ea57f8a9ac0bbe4ada38d159f22eea471c672
938e93d92c7c67284652ee523db08e364763aa2a01370cdfa8200ffd97beede9

Loading…
Cancel
Save