diff --git a/Aucma.Scada.Business/InStoreBusiness.cs b/Aucma.Scada.Business/InStoreBusiness.cs index d3850812..a30942f3 100644 --- a/Aucma.Scada.Business/InStoreBusiness.cs +++ b/Aucma.Scada.Business/InStoreBusiness.cs @@ -38,8 +38,8 @@ namespace Aucma.Scada.Business private RegisterServices registerServices = RegisterServices.Instance; private InStoreTaskHandle taskHandle = InStoreTaskHandle.Instance; + - #endregion @@ -59,6 +59,13 @@ namespace Aucma.Scada.Business private IBaseBomInfoService _baseBomInfoService; private IRecordInStoreService _recordInStore; + + private IPrintBarCodeServices _printBarCodeServices; + + // 过点数据表 + private IMaterialCompletionServices _iMaterialCompletionServices; + + private IProductPlanInfoService _productPlanInfoServices; #endregion #region 委托事件 @@ -95,7 +102,9 @@ namespace Aucma.Scada.Business _baseSpaceDetailService = registerServices.GetService(); _baseBomInfoService = registerServices.GetService(); _recordInStore = registerServices.GetService(); - + _printBarCodeServices = registerServices.GetService(); + _productPlanInfoServices = registerServices.GetService(); + _iMaterialCompletionServices = registerServices.GetService(); taskHandle.InStoreFinsihEvent += InStoreFinish; taskHandle.InStoreAnswerEvent += InStoreAnswer; @@ -141,6 +150,20 @@ namespace Aucma.Scada.Business var result = CreateInStoreTask(spaceInfo, materialCode); //创建入库任务 if (result) { + #region 2023-12-15 更新过点数据,插入记录到MATERIAL_COMPLETION表 + PrintBarCode print =_printBarCodeServices.query(materialCode); + string planCode = _productPlanInfoServices.GetPlanCode(print.OrderCode, appConfig.stationCode); + MaterialCompletion completion = new MaterialCompletion(); + completion.OrderCode = print.OrderCode; + completion.MaterialBarcode = materialCode; + completion.MaterialCode = print.MaterialCode; + completion.MaterialName = print.MaterialName; + completion.StationName = appConfig.stationCode; + completion.CompleteDate = DateTime.Now; + completion.planCode = planCode; + _iMaterialCompletionServices.Add(completion); + #endregion + //spaceInfo.onRouteAmount += 1; //通过PLC获取货道信息(在库、在途数量)时不需要修改在途数量 _spaceInfoService.UpdateSpaceInfo(spaceInfo); } @@ -177,7 +200,6 @@ namespace Aucma.Scada.Business realTaskInfo.taskStatus = 1; realTaskInfo.createTime = DateTime.Now; #endregion - result = _taskInfoService.AddTaskInfo(realTaskInfo); if (result) { diff --git a/Aucma.Scada.HikRobot/MvCodeHelper.cs b/Aucma.Scada.HikRobot/MvCodeHelper.cs index 9d72138a..2cbfb389 100644 --- a/Aucma.Scada.HikRobot/MvCodeHelper.cs +++ b/Aucma.Scada.HikRobot/MvCodeHelper.cs @@ -187,7 +187,7 @@ namespace Aucma.Core.Scanner RefreshMaterialCodeStrEvent?.Invoke(appConfig.shellStoreCode, strCode); }else if(appConfig.linerHikRobotIp == hashmap.Value) { - RefreshMaterialCodeStrEvent?.Invoke(appConfig.linerHikRobotIp, strCode); + RefreshMaterialCodeStrEvent?.Invoke(appConfig.linerStoreCode, strCode); } } } diff --git a/Aucma.Scada.Model/Aucma.Scada.Model.csproj b/Aucma.Scada.Model/Aucma.Scada.Model.csproj index 42213d38..fe1c2801 100644 --- a/Aucma.Scada.Model/Aucma.Scada.Model.csproj +++ b/Aucma.Scada.Model/Aucma.Scada.Model.csproj @@ -49,6 +49,8 @@ + + diff --git a/Aucma.Scada.Model/domain/MaterialCompletion.cs b/Aucma.Scada.Model/domain/MaterialCompletion.cs new file mode 100644 index 00000000..cc0631f2 --- /dev/null +++ b/Aucma.Scada.Model/domain/MaterialCompletion.cs @@ -0,0 +1,64 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Principal; +using System.Text; +using System.Threading.Tasks; + +namespace Aucma.Scada.Model.domain +{ + /// + /// 物料完成记录 + /// + [SugarTable("MATERIAL_COMPLETION", "AUCMA_SCADA")] + public class MaterialCompletion + { + /// + /// 主键 + /// + [SugarColumn(ColumnName = "OBJ_ID", IsIdentity = true, IsPrimaryKey = true)] + public int ObjId { get; set; } + + /// + /// 订单编号 + /// + [SugarColumn(ColumnName = "ORDER_CODE")] + public string OrderCode { get; set; } + + /// + /// 物料条码 + /// + [SugarColumn(ColumnName = "MATERIAL_BARCODE")] + public string MaterialBarcode { get; set; } + + /// + /// 物料编码 + /// + [SugarColumn(ColumnName = "MATERIAL_CODE")] + public string MaterialCode { get; set; } + + /// + /// 物料名称 + /// + [SugarColumn(ColumnName = "MATERIAL_NAME")] + public string MaterialName { get; set; } + + /// + /// 所属工位 + /// + [SugarColumn(ColumnName = "STATION_NAME")] + public string StationName { get; set; } + + /// + /// 完成时间 + /// + [SugarColumn(ColumnName = "COMPLETE_DATE")] + public DateTime CompleteDate { get; set; } + /// + /// 工单编号 + /// + [SugarColumn(ColumnName = "PLAN_CODE")] + public string planCode { get; set; } + } +} diff --git a/Aucma.Scada.Model/domain/PrintBarCode.cs b/Aucma.Scada.Model/domain/PrintBarCode.cs new file mode 100644 index 00000000..5ef9136f --- /dev/null +++ b/Aucma.Scada.Model/domain/PrintBarCode.cs @@ -0,0 +1,62 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Principal; +using System.Text; +using System.Threading.Tasks; + +namespace Aucma.Scada.Model.domain +{ + /// + /// 打印条码信息 + /// + [SugarTable("PRINT_BARCODE", "AUCMA_SCADA")] + public class PrintBarCode + { + /// + /// 主键 + /// + [SugarColumn(ColumnName = "OBJ_ID", IsIdentity = true, IsPrimaryKey = true)] + public int ObjId { get; set; } + + /// + /// 订单号 + /// + [SugarColumn(ColumnName = "ORDER_CODE")] + public string OrderCode { get; set; } + /// + /// 物料编码 + /// + [SugarColumn(ColumnName = "MATERIAL_CODE")] + public string MaterialCode { get; set; } + /// + /// 物料名称 + /// + [SugarColumn(ColumnName = "MATERIAL_NAME")] + public string MaterialName { get; set; } + /// + /// 条码 + /// + [SugarColumn(ColumnName = "MATERIAL_BARCODE")] + public string MaterialBarcode { get; set; } + + /// + /// 打印时间 + /// + [SugarColumn(ColumnName = "PRINT_TIME")] + public DateTime PrintTime { get; set; } + + /// + /// 补打个数 + /// + [SugarColumn(ColumnName = "SUPPLEMENT_MATERIAL")] + public int SupplementMaterial { get; set; } + + /// + /// 打印类型:箱壳、内胆 + /// + [SugarColumn(ColumnName = "PRINT_BARTYPE")] + public int PrintBarType { get; set; } + } +} diff --git a/Aucma.Scada.Model/domain/ProductPlanInfo.cs b/Aucma.Scada.Model/domain/ProductPlanInfo.cs index db1338ad..e0ec9d78 100644 --- a/Aucma.Scada.Model/domain/ProductPlanInfo.cs +++ b/Aucma.Scada.Model/domain/ProductPlanInfo.cs @@ -13,13 +13,13 @@ namespace Aucma.Scada.Model.domain public int objId { get; set; } /// - /// 计划编号 + /// 计划编号 ----->>> 工单编号 /// [SugarColumn(ColumnName = "PLAN_CODE")] public string planCode { get; set; } /// - /// 工单编号 + /// 工单编号 ----->>> 订单编号 /// [SugarColumn(ColumnName = "ORDER_CODE")] public string orderCode { get; set; } diff --git a/Aucma.Scada.UI/bin/Debug/osk.exe b/Aucma.Scada.UI/bin/Debug/osk.exe new file mode 100644 index 00000000..643180cb Binary files /dev/null and b/Aucma.Scada.UI/bin/Debug/osk.exe differ diff --git a/Aucma.Scada.UI/viewModel/MainViewModel.cs b/Aucma.Scada.UI/viewModel/MainViewModel.cs index 28f8ee29..3271d1be 100644 --- a/Aucma.Scada.UI/viewModel/MainViewModel.cs +++ b/Aucma.Scada.UI/viewModel/MainViewModel.cs @@ -9,6 +9,7 @@ using GalaSoft.MvvmLight.Command; using HighWayIot.Config; using HighWayIot.Log4net; using HighWayIot.Plc; +using SqlSugar.DistributedSystem.Snowflake; using System; using System.Collections.Generic; using System.Diagnostics; @@ -149,25 +150,11 @@ namespace Aucma.Scada.UI.viewModel { try { - var commonFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles); - //程序集目标平台为X86时,获取到的是x86的Program Files,但TabTip.exe始终在Program Files目录下 - if (commonFilesPath.Contains("Program Files (x86)")) - { - commonFilesPath = commonFilesPath.Replace("Program Files (x86)", "Program Files"); - } - string tabTipPath = Path.Combine(commonFilesPath, @"microsoft shared\ink\TabTip.exe"); - if (File.Exists(tabTipPath)) - { - ProcessStartInfo psi = new ProcessStartInfo - { - FileName = tabTipPath, - UseShellExecute = true, - CreateNoWindow = true - }; - Process.Start(psi); - } - - + Process proc = new Process(); + proc.StartInfo.FileName = Path.Combine(Directory.GetCurrentDirectory(), "osk.exe"); + proc.StartInfo.UseShellExecute = true; + proc.StartInfo.Verb = "runas"; + proc.Start(); } catch (Exception ex) { diff --git a/HighWayIot.Repository/HighWayIot.Repository.csproj b/HighWayIot.Repository/HighWayIot.Repository.csproj index b5e64725..708f312a 100644 --- a/HighWayIot.Repository/HighWayIot.Repository.csproj +++ b/HighWayIot.Repository/HighWayIot.Repository.csproj @@ -54,7 +54,11 @@ + + + + diff --git a/HighWayIot.Repository/service/IMaterialCompletionServices.cs b/HighWayIot.Repository/service/IMaterialCompletionServices.cs new file mode 100644 index 00000000..11a8956e --- /dev/null +++ b/HighWayIot.Repository/service/IMaterialCompletionServices.cs @@ -0,0 +1,15 @@ +using Aucma.Scada.Model.domain; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.service +{ + public interface IMaterialCompletionServices + { + // 添加过点数据 + bool Add(MaterialCompletion info); + } +} diff --git a/HighWayIot.Repository/service/IPrintBarCodeServices.cs b/HighWayIot.Repository/service/IPrintBarCodeServices.cs new file mode 100644 index 00000000..fa6fce78 --- /dev/null +++ b/HighWayIot.Repository/service/IPrintBarCodeServices.cs @@ -0,0 +1,19 @@ +using Aucma.Scada.Model.domain; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.service +{ + public interface IPrintBarCodeServices + { + /// + /// 根据箱体码找到打印记录。订单号 + /// + /// + /// + PrintBarCode query(string code); + } +} diff --git a/HighWayIot.Repository/service/IProductPlanInfoService.cs b/HighWayIot.Repository/service/IProductPlanInfoService.cs index 6c48a987..cd6830b7 100644 --- a/HighWayIot.Repository/service/IProductPlanInfoService.cs +++ b/HighWayIot.Repository/service/IProductPlanInfoService.cs @@ -5,6 +5,10 @@ namespace HighWayIot.Repository.service { public interface IProductPlanInfoService { + /// + ///通过订单号和工位查询工单号 + /// + string GetPlanCode(string orderCode,string station); /// /// 通过产线工位获取生产计划 /// diff --git a/HighWayIot.Repository/service/Impl/MaterialCompletionServiceImpl.cs b/HighWayIot.Repository/service/Impl/MaterialCompletionServiceImpl.cs new file mode 100644 index 00000000..b711c0d5 --- /dev/null +++ b/HighWayIot.Repository/service/Impl/MaterialCompletionServiceImpl.cs @@ -0,0 +1,24 @@ +using Aucma.Scada.Model.domain; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.service.Impl +{ + public class MaterialCompletionServiceImpl : IMaterialCompletionServices + { + Repository _repository => new Repository("scada"); + /// + /// 添加过点数据 + /// + /// + /// + /// + public bool Add(MaterialCompletion info) + { + return _repository.Insert(info); + } + } +} diff --git a/HighWayIot.Repository/service/Impl/PrintBarCodeServicesImpl.cs b/HighWayIot.Repository/service/Impl/PrintBarCodeServicesImpl.cs new file mode 100644 index 00000000..cd500dab --- /dev/null +++ b/HighWayIot.Repository/service/Impl/PrintBarCodeServicesImpl.cs @@ -0,0 +1,19 @@ +using Aucma.Scada.Model.domain; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.service.Impl +{ + public class PrintBarCodeServicesImpl: IPrintBarCodeServices + { + Repository _repository => new Repository("scada"); + + public PrintBarCode query(string code) + { + return _repository.GetFirst(x=>x.MaterialBarcode==code); + } + } +} diff --git a/HighWayIot.Repository/service/Impl/ProductPlanInfoServiceImpl.cs b/HighWayIot.Repository/service/Impl/ProductPlanInfoServiceImpl.cs index 3d1e748c..5b48557d 100644 --- a/HighWayIot.Repository/service/Impl/ProductPlanInfoServiceImpl.cs +++ b/HighWayIot.Repository/service/Impl/ProductPlanInfoServiceImpl.cs @@ -15,6 +15,14 @@ namespace HighWayIot.Repository.service.Impl private JsonChange jsonChange = JsonChange.Instance; + /// + ///通过订单号和工位查询工单号 + /// + public string GetPlanCode(string orderCode, string station) + { + return _mesRepository.GetFirst(x => x.orderCode == orderCode && x.productLineCode == station).planCode; + } + /// /// 通过计划编号获取计划信息 ///