diff --git a/Aucma.Scada.Business/InStoreBusiness.cs b/Aucma.Scada.Business/InStoreBusiness.cs index 115bb75..6e216ea 100644 --- a/Aucma.Scada.Business/InStoreBusiness.cs +++ b/Aucma.Scada.Business/InStoreBusiness.cs @@ -115,12 +115,12 @@ namespace Aucma.Scada.Business //Task.Run(() => //{ // Thread.Sleep(6000); - // for (int i = 1; i < 12; i++) + // for (int i = 1; i < 2; i++) // { - // InStore(appConfig.shellStoreCode, "B23600000781110900" + i.ToString().PadLeft(2, '0')); - // Thread.Sleep(1000 * 30); - // InStore(appConfig.linerStoreCode, "L23600000788110900" + i.ToString().PadLeft(2, '0')); - // Thread.Sleep(1000 * 30); + // InStore("B2401018302500586001" + i.ToString().PadLeft(2, '0') , "169.254.100.169"); + // // Thread.Sleep(1000 * 30); + // // InStore(appConfig.linerStoreCode, "L23600000788110900" + i.ToString().PadLeft(2, '0')); + // // Thread.Sleep(1000 * 30); // } //}); @@ -131,10 +131,19 @@ namespace Aucma.Scada.Business /// /// /// - private void InStore(string storeCode, string materialCode) + private void InStore(string materialCode,string scannerIp) { try { + string storeCode = string.Empty; + if (appConfig.shellHikRobotIp.Equals(scannerIp)) + { + storeCode = appConfig.shellStoreCode; + } + else + { + storeCode = appConfig.linerStoreCode; + } PrintLogInfoMessage($"扫码成功,物料码:{materialCode}"); string materialType = SubStringMaterialCode(materialCode); #region Delete By wenjy 2023-10-30 11:41:00 取消通过数据库获取货道数量、在途量,改为通过PLC获取货道信息 @@ -151,17 +160,17 @@ namespace Aucma.Scada.Business { #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); + //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获取货道信息(在库、在途数量)时不需要修改在途数量 @@ -173,7 +182,7 @@ namespace Aucma.Scada.Business //报警停线 PrintLogInfoMessage($"物料码:{materialCode};未匹配到可用货道"); } - } + } catch (Exception ex) { PrintLogErrorMessage("入库业务异常", ex); @@ -260,10 +269,12 @@ namespace Aucma.Scada.Business RealTaskInfo taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.shellStoreCode, appConfig.instoreTaskType); if (taskInfo != null) { - PrintLogInfoMessage($"下发箱壳入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); + int result = taskHandle.SendShellTask_InStore(taskInfo); if (result==1) { + + PrintLogInfoMessage($"箱壳入库任务:{taskInfo.taskCode};下发成功,等待PLC执行反馈"); shellSemaphore.Wait(); //一直堵塞直到信号量释放 @@ -305,7 +316,7 @@ namespace Aucma.Scada.Business RealTaskInfo taskInfo = _taskInfoService.GetTaskInfoByStoreCode(appConfig.linerStoreCode, appConfig.instoreTaskType); if (taskInfo != null) { - PrintLogInfoMessage($"下发内胆入库任务:{taskInfo.taskCode};仓库{taskInfo.storeCode};货道:{taskInfo.spaceCode}"); + int result = taskHandle.SendLinerTask_InStore(taskInfo); if (result==1) { diff --git a/Aucma.Scada.Business/InStoreTaskHandle.cs b/Aucma.Scada.Business/InStoreTaskHandle.cs index a699aa7..e6f785f 100644 --- a/Aucma.Scada.Business/InStoreTaskHandle.cs +++ b/Aucma.Scada.Business/InStoreTaskHandle.cs @@ -104,61 +104,76 @@ namespace Aucma.Scada.Business Task.Run(() => { - while (true) + try { - if (_plcDictionary.Count > 0) + while (true) { - IPlc _plc = _plcDictionary[appConfig.shellStoreCode]; - if (_plc != null && _plc.IsConnected) + if (_plcDictionary.Count > 0) { - - List taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.shellStoreCode, appConfig.instoreTaskType, 2); - if (taskList != null && taskList.Count > 0) + IPlc _plc = _plcDictionary[appConfig.shellStoreCode]; + if (_plc != null) { - foreach (RealTaskInfo taskInfo in taskList) + + List taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.shellStoreCode, appConfig.instoreTaskType, 2); + if (taskList != null && taskList.Count > 0) { - SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.shellStoreCode, taskInfo.spaceCode); - JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.shellStoreCode); + foreach (RealTaskInfo taskInfo in taskList) + { + SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.shellStoreCode, taskInfo.spaceCode); + JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.shellStoreCode); + } } } + else + { + logHelper.Info($"PLC信息为空或连接失败,通过{appConfig.shellStoreCode}未获取到该仓库对应的PLC信息"); + } } - else - { - logHelper.Info($"PLC信息为空或连接失败,通过{appConfig.shellStoreCode}未获取到该仓库对应的PLC信息"); - } - } - Thread.Sleep(1000); - }; + Thread.Sleep(1000); + }; + } + catch (Exception ex) + { + + logHelper.Error(ex.Message.ToString()); + } }); //内胆线程 Task.Run(() => { - while (true) + try { - if (_plcDictionary.Count > 0) + while (true) { - IPlc _plc = _plcDictionary[appConfig.linerStoreCode]; - if (_plc != null && _plc.IsConnected) + if (_plcDictionary.Count > 0) { - // 修改这个方法 - List taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.linerStoreCode, appConfig.instoreTaskType, 2); - if (taskList != null && taskList.Count > 0) + IPlc _plc = _plcDictionary[appConfig.linerStoreCode]; + if (_plc != null) { - foreach (RealTaskInfo taskInfo in taskList) + // 修改这个方法 + List taskList = _taskInfoService.GetTaskInfosForInstore(appConfig.linerStoreCode, appConfig.instoreTaskType, 2); + if (taskList != null && taskList.Count > 0) { - SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.linerStoreCode, taskInfo.spaceCode); - JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.linerStoreCode); + foreach (RealTaskInfo taskInfo in taskList) + { + SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(appConfig.linerStoreCode, taskInfo.spaceCode); + JudgeIsFinish(taskInfo, _plc, spaceAddress, appConfig.linerStoreCode); + } } } + else + { + logHelper.Info($"PLC信息为空或连接失败,通过{appConfig.linerStoreCode}未获取到该仓库对应的PLC信息"); + } } - else - { - logHelper.Info($"PLC信息为空或连接失败,通过{appConfig.linerStoreCode}未获取到该仓库对应的PLC信息"); - } - } - Thread.Sleep(1000); - }; + Thread.Sleep(1000); + }; + } + catch (Exception ex) + { + logHelper.Error(ex.Message.ToString()); + } }); } @@ -191,8 +206,7 @@ namespace Aucma.Scada.Business if (_plc != null) { - if (_plc.IsConnected) - { + if (_plc.readInt32ByAddress(plcConfig.in_shell_answer) == 1) { logHelper.Info("箱壳入库应答字为1,货道号:" + plcConfig.in_shell_spaceCode + ";写" + short.Parse(taskInfo.spaceCode.Substring(5, 1))); @@ -211,11 +225,7 @@ namespace Aucma.Scada.Business result = 2; logHelper.PlcLog("应答字为2,下发新任务plc未就绪"); } - } - else - { - logHelper.Info($"仓库{taskInfo.storeCode};PLC未连接"); - } + } else { diff --git a/Aucma.Scada.Business/OutStoreTaskHandle.cs b/Aucma.Scada.Business/OutStoreTaskHandle.cs index 680488e..3ca75f4 100644 --- a/Aucma.Scada.Business/OutStoreTaskHandle.cs +++ b/Aucma.Scada.Business/OutStoreTaskHandle.cs @@ -429,13 +429,16 @@ namespace Aucma.Scada.Business { //var info = shellTaskInfos.Where(x => x.taskStatus != 3).ToList(); var info = GetTaskInfoByTaskStatus(appConfig.shellStoreCode); - for (int i = 0; i < info.Count; i++) + if(info != null) { - var item = info[i]; - ReadShellFinish_OutStore(item); - Console.WriteLine($"箱壳任务:{item.taskCode};物料:{item.materialCode};出库完成"); - item.taskStatus = 3; - shellTaskInfos.Add(item); + for (int i = 0; i < info.Count; i++) + { + var item = info[i]; + ReadShellFinish_OutStore(item); + Console.WriteLine($"箱壳任务:{item.taskCode};物料:{item.materialCode};出库完成"); + item.taskStatus = 3; + shellTaskInfos.Add(item); + } } Thread.Sleep(1000); @@ -454,13 +457,16 @@ namespace Aucma.Scada.Business { //var info = linerTaskInfos.Where(x => x.taskStatus != 3).ToList(); var info = GetTaskInfoByTaskStatus(appConfig.linerStoreCode); - for (int i = 0; i < info.Count; i++) + if(info != null) { - var item = info[i]; - ReadLinerFinish_OutStore(item); - Console.WriteLine($"内胆任务:{item.taskCode};物料:{item.materialCode};出库完成"); - item.taskStatus = 3; - linerTaskInfos.Add(item); + for (int i = 0; i < info.Count; i++) + { + var item = info[i]; + ReadLinerFinish_OutStore(item); + Console.WriteLine($"内胆任务:{item.taskCode};物料:{item.materialCode};出库完成"); + item.taskStatus = 3; + linerTaskInfos.Add(item); + } } Thread.Sleep(1000); diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll index 58f876f..a97eca5 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb index 055ab57..5122184 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Business.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll index d9b8d2c..c5eb488 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb index 6056f31..03c793d 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.HikRobot.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb index 2f9d099..bb1c5b3 100644 Binary files a/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb and b/Aucma.Scada.Business/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll index ab4c9d8..a9bb518 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb index 0322de1..17d6959 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Config.pdb differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll index 0b08b08..5dbf48b 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.dll differ diff --git a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb index 7564a7c..fb56bc9 100644 Binary files a/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb and b/Aucma.Scada.Business/bin/Debug/HighWayIot.Repository.pdb differ diff --git a/Aucma.Scada.HikRobot/MvCodeHelper.cs b/Aucma.Scada.HikRobot/MvCodeHelper.cs index 2cbfb38..f03293b 100644 --- a/Aucma.Scada.HikRobot/MvCodeHelper.cs +++ b/Aucma.Scada.HikRobot/MvCodeHelper.cs @@ -17,7 +17,7 @@ namespace Aucma.Core.Scanner private static AppConfig appConfig = AppConfig.Instance; public static bool m_bGrabbing = true; #region 委托事件 - public delegate void RefreshMaterialCodeStr(string storeCode, string materialCodeStr); + public delegate void RefreshMaterialCodeStr(string materialCodeStr, string ip); public static event RefreshMaterialCodeStr RefreshMaterialCodeStrEvent; /// /// 日志信息刷新 @@ -66,7 +66,12 @@ namespace Aucma.Core.Scanner try { RefreshLogMessageEvent?.Invoke("获取扫码器设备列表,进入DeviceListAcq()方法"); - + + // 内胆扫码器ip + string LinerScannerIp = appConfig.linerHikRobotIp; + // 箱壳扫码器ip + string ShellScannerIp = appConfig.linerHikRobotIp; + System.GC.Collect(); m_stDeviceList.nDeviceNum = 0; // 获取设备列表 @@ -96,7 +101,9 @@ namespace Aucma.Core.Scanner // 获取ip string ip = ((stGigEDeviceInfo.nCurrentIp & 0xff000000) >> 24) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x00ff0000) >> 16) + "." + ((stGigEDeviceInfo.nCurrentIp & 0x0000ff00) >> 8) + "." + (stGigEDeviceInfo.nCurrentIp & 0x000000ff); - // Console.WriteLine($"打印扫码设备信息,下标:{i};IP:{ip}"); + // 只连接配置的扫码器 + if (!ip.Equals(LinerScannerIp) && !ip.Equals(ShellScannerIp)) continue; + Console.Write("扫码器设备[" + i + "],ip:" + ip); // 创建第i个设备 stDevInfo = (MvCodeReader.MV_CODEREADER_DEVICE_INFO)Marshal.PtrToStructure(m_stDeviceList.pDeviceInfo[i], typeof(MvCodeReader.MV_CODEREADER_DEVICE_INFO)); @@ -181,14 +188,9 @@ namespace Aucma.Core.Scanner RefreshLogMessageEvent?.Invoke("相机ip:" + hashmap.Value + " Get CodeNum: " + "CodeNum[" + i.ToString() + "], CodeString[" + strCode + "]"); if (!string.IsNullOrEmpty(strCode)) { - // 获取到条码处理业务 - if (appConfig.shellHikRobotIp == hashmap.Value) - { - RefreshMaterialCodeStrEvent?.Invoke(appConfig.shellStoreCode, strCode); - }else if(appConfig.linerHikRobotIp == hashmap.Value) - { - RefreshMaterialCodeStrEvent?.Invoke(appConfig.linerStoreCode, strCode); - } + + RefreshMaterialCodeStrEvent?.Invoke(strCode,hashmap.Value); + } } } diff --git a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll index d9b8d2c..c5eb488 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll and b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.dll differ diff --git a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb index 6056f31..03c793d 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb and b/Aucma.Scada.HikRobot/bin/Debug/Aucma.Scada.HikRobot.pdb differ diff --git a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll index ab4c9d8..a9bb518 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll and b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.dll differ diff --git a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb index 0322de1..17d6959 100644 Binary files a/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb and b/Aucma.Scada.HikRobot/bin/Debug/HighWayIot.Config.pdb differ diff --git a/Aucma.Scada.Model/Aucma.Scada.Model.csproj b/Aucma.Scada.Model/Aucma.Scada.Model.csproj index fe1c280..e8b484b 100644 --- a/Aucma.Scada.Model/Aucma.Scada.Model.csproj +++ b/Aucma.Scada.Model/Aucma.Scada.Model.csproj @@ -47,6 +47,7 @@ + diff --git a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll index ad579f4..289dba9 100644 Binary files a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll and b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.dll differ diff --git a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb index 2f9d099..bb1c5b3 100644 Binary files a/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb and b/Aucma.Scada.Model/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/Aucma.Scada.Model/domain/BaseMaterialInfo.cs b/Aucma.Scada.Model/domain/BaseMaterialInfo.cs new file mode 100644 index 0000000..b0eb682 --- /dev/null +++ b/Aucma.Scada.Model/domain/BaseMaterialInfo.cs @@ -0,0 +1,43 @@ +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("BASE_MATERIALINFO")] + public class BaseMaterialInfo + { + /// + /// 主键标识 + /// + [SugarColumn(ColumnName = "OBJ_ID", IsPrimaryKey = true, IsIdentity = true)] + public int ObjId { get; set; } + + /// + /// 物料编号 + /// + [SugarColumn(ColumnName = "MATERIAL_CODE")] + public string MaterialCode { get; set; } + + /// + /// 物料名称 + /// + [SugarColumn(ColumnName = "MATERIAL_NAME")] + public string MaterialName { get; set; } + /// + /// 物料小类 + /// + [SugarColumn(ColumnName = "MATERIAL_SUBCLASS")] + public string MaterialSubclass { get; set; } + + /// + /// 物料sap类型,FERT成品 + /// + [SugarColumn(ColumnName = "MATERIAL_TYPE")] + public string MaterialType { get; set; } + } +} diff --git a/Aucma.Scada.Model/domain/BaseSpaceInfo.cs b/Aucma.Scada.Model/domain/BaseSpaceInfo.cs index e943681..7c55e0f 100644 --- a/Aucma.Scada.Model/domain/BaseSpaceInfo.cs +++ b/Aucma.Scada.Model/domain/BaseSpaceInfo.cs @@ -51,7 +51,7 @@ namespace Aucma.Scada.Model.domain public int spaceType { get; set; } /// - /// 物料类型 + /// 物料类型A /// [SugarColumn(ColumnName = "MATERIAL_TYPE")] public string materialType { get; set; } @@ -97,5 +97,32 @@ namespace Aucma.Scada.Model.domain /// [SugarColumn(ColumnName = "UNUSUAL_FLAG")] public int unusualFlag { get; set; } + + /// + /// 物料类型B + /// + [SugarColumn(ColumnName = "TYPE_CODE_B")] + public string typeCodeB { get; set; } + /// + /// 物料类型C + /// + [SugarColumn(ColumnName = "TYPE_CODE_C")] + public string typeCodeC { get; set; } + /// + /// 物料类型(名称)A + /// + [SugarColumn(ColumnName = "TYPE_NAME_A")] + public string typeNameA { get; set; } + /// + /// 物料类型(名称)B + /// + [SugarColumn(ColumnName = "TYPE_NAME_B")] + public string typeNameB { get; set; } + /// + /// 物料类型(名称)C + /// + [SugarColumn(ColumnName = "TYPE_NAME_C")] + public string typeNameC { get; set; } + } } diff --git a/Aucma.Scada.UI/Aucma.Scada.UI.csproj b/Aucma.Scada.UI/Aucma.Scada.UI.csproj index 05b1cfb..960ef23 100644 --- a/Aucma.Scada.UI/Aucma.Scada.UI.csproj +++ b/Aucma.Scada.UI/Aucma.Scada.UI.csproj @@ -126,6 +126,9 @@ MaterialStatisticsWindow.xaml + + SelectType.xaml + ShellInventory.xaml @@ -152,6 +155,7 @@ + @@ -207,6 +211,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/Aucma.Scada.UI/MainWindow.xaml b/Aucma.Scada.UI/MainWindow.xaml index f1c2674..81713af 100644 --- a/Aucma.Scada.UI/MainWindow.xaml +++ b/Aucma.Scada.UI/MainWindow.xaml @@ -38,14 +38,19 @@ - + + + + + + + + diff --git a/Aucma.Scada.UI/Page/AssemblyPlan/PlanInfoEditWindow.xaml b/Aucma.Scada.UI/Page/AssemblyPlan/PlanInfoEditWindow.xaml index a8d41eb..b65304a 100644 --- a/Aucma.Scada.UI/Page/AssemblyPlan/PlanInfoEditWindow.xaml +++ b/Aucma.Scada.UI/Page/AssemblyPlan/PlanInfoEditWindow.xaml @@ -144,7 +144,7 @@ Foreground="#FFFFFF" SelectedItem="{Binding SelectedDataItem}" MouseLeftButtonDown="dataGrid_MouseLeftButtonDown"> - + diff --git a/Aucma.Scada.UI/Page/InventoryInfo/LinerInventory.xaml b/Aucma.Scada.UI/Page/InventoryInfo/LinerInventory.xaml index edb045e..ea4d270 100644 --- a/Aucma.Scada.UI/Page/InventoryInfo/LinerInventory.xaml +++ b/Aucma.Scada.UI/Page/InventoryInfo/LinerInventory.xaml @@ -129,7 +129,7 @@ - + @@ -161,7 +161,9 @@ - + diff --git a/Aucma.Scada.UI/Page/InventoryInfo/SelectType.xaml b/Aucma.Scada.UI/Page/InventoryInfo/SelectType.xaml new file mode 100644 index 0000000..015305f --- /dev/null +++ b/Aucma.Scada.UI/Page/InventoryInfo/SelectType.xaml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll index 58f876f..a97eca5 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb index 055ab57..5122184 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Business.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll index d9b8d2c..c5eb488 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb index 6056f31..03c793d 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.HikRobot.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll index ad579f4..289dba9 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb index 2f9d099..bb1c5b3 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe index 7b1f842..4dcffab 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.exe differ diff --git a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb index 6003154..01e9a28 100644 Binary files a/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb and b/Aucma.Scada.UI/bin/Debug/Aucma.Scada.UI.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll index ab4c9d8..a9bb518 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb index 0322de1..17d6959 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Config.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll index 0b08b08..5dbf48b 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.dll differ diff --git a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb index 7564a7c..fb56bc9 100644 Binary files a/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb and b/Aucma.Scada.UI/bin/Debug/HighWayIot.Repository.pdb differ diff --git a/Aucma.Scada.UI/bin/Debug/config/App.Ini b/Aucma.Scada.UI/bin/Debug/config/App.Ini index ae151a4..0897ba5 100644 --- a/Aucma.Scada.UI/bin/Debug/config/App.Ini +++ b/Aucma.Scada.UI/bin/Debug/config/App.Ini @@ -1,7 +1,7 @@ [system] #ݿ -mesConnStr=Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma -scadaConnStr=Data Source=175.27.215.92/helowin;User ID=aucma_scada;Password=aucma +mesConnStr=Data Source=10.100.72.20/ORCLCDB;User ID=c##aucma_mes;Password=aucma +scadaConnStr=Data Source=10.100.72.20/ORCLCDB;User ID=c##aucma_scada;Password=aucma #λ stationCode=1002 @@ -9,9 +9,9 @@ stationCode=1002 stationName=ڵװ #ǿ -shellStoreCode=XKJCK-001 +shellStoreCode=XKK-001 #ڵ -linerStoreCode=NDJCK-001 +linerStoreCode=NDK-001 #ͱ shellMaterialType =400 diff --git a/Aucma.Scada.UI/bin/Debug/config/Plc.Ini b/Aucma.Scada.UI/bin/Debug/config/Plc.Ini index ba20d71..17a9d47 100644 --- a/Aucma.Scada.UI/bin/Debug/config/Plc.Ini +++ b/Aucma.Scada.UI/bin/Debug/config/Plc.Ini @@ -8,7 +8,7 @@ [shell_inStore_address] =D7000 Ӧ=D7010 -=D7020 + #ڵַ [liner_inStore_address] =D7000 diff --git a/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini b/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini index b1c7ed0..15aab8b 100644 --- a/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini +++ b/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini @@ -1,63 +1,63 @@ #ǿϢ Ƿ=D7221 ״̬=D7231 ֿ״̬=D7300 #豸״̬,0δ״̬,1Զ,2ά޵״̬,ֹ -[XKJCK-001_XK_001] +[XKK-001_XK_001] ڿ=D7201 ;=D7211 =D7021 =D7240 -[XKJCK-001_XK_002] +[XKK-001_XK_002] ڿ=D7202 ;=D7212 =D7022 =D7240 -[XKJCK-001_XK_003] +[XKK-001_XK_003] ڿ=D7203 ;=D7213 =D7023 =D7240 -[XKJCK-001_XK_004] +[XKK-001_XK_004] ڿ=D7204 ;=D7214 =D7024 =D7240 -[XKJCK-001_XK_005] +[XKK-001_XK_005] ڿ=D7205 ;=D7215 =D7025 =D7240 -[XKJCK-001_XK_006] +[XKK-001_XK_006] ڿ=D7206 ;=D7216 =D7026 =D7240 #ڵϢ -[NDJCK-001_ND_001] +[NDK-001_ND_001] ڿ=D7201 ;=D7211 =D7021 =D7240 -[NDJCK-001_ND_002] +[NDK-001_ND_002] ڿ=D7202 ;=D7212 =D7022 =D7240 -[NDJCK-001_ND_003] +[NDK-001_ND_003] ڿ=D7203 ;=D7213 =D7023 =D7240 -[NDJCK-001_ND_004] +[NDK-001_ND_004] ڿ=D7204 ;=D7214 =D7024 =D7240 -[NDJCK-001_ND_005] +[NDK-001_ND_005] ڿ=D7205 ;=D7215 =D7025 =D7240 -[NDJCK-001_ND_006] +[NDK-001_ND_006] ڿ=D7206 ;=D7216 =D7026 diff --git a/Aucma.Scada.UI/viewModel/AssemblyPlan/QuantityIssuedViewModel.cs b/Aucma.Scada.UI/viewModel/AssemblyPlan/QuantityIssuedViewModel.cs index 018064c..d60f5c6 100644 --- a/Aucma.Scada.UI/viewModel/AssemblyPlan/QuantityIssuedViewModel.cs +++ b/Aucma.Scada.UI/viewModel/AssemblyPlan/QuantityIssuedViewModel.cs @@ -61,7 +61,7 @@ namespace Aucma.Scada.UI.viewModel.AssemblyPlan var productPlanInfo = _PlanInfo; if(productPlanInfo != null) - { + { // 8302501428 var materialType = productPlanInfo.materialCode; bool shellResult = assemblyPlanBusiness.JudgmentStock(productPlanInfo, Convert.ToInt32(_TransmitAmount), appConfig.shellMaterialType,appConfig.shellStoreCode); diff --git a/Aucma.Scada.UI/viewModel/InventoryInfo/LinerInventoryViewModel.cs b/Aucma.Scada.UI/viewModel/InventoryInfo/LinerInventoryViewModel.cs index e9a4b01..2c8a2af 100644 --- a/Aucma.Scada.UI/viewModel/InventoryInfo/LinerInventoryViewModel.cs +++ b/Aucma.Scada.UI/viewModel/InventoryInfo/LinerInventoryViewModel.cs @@ -31,6 +31,10 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo { #region 事件绑定 + + // 设置型号 + SubmitCommand = new RelayCommand(obj => SubmitCommandExecute(obj)); + UpdateInStoreFlagCommand = new RelayCommand(obj => UpdateInStoreFlag(obj)); UpdateOutStoreFlagCommand = new RelayCommand(obj => UpdateOutStoreFlag(obj)); @@ -44,7 +48,7 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo OutOnlyOneCommand = new RelayCommand(obj => OutOnlyOne(obj)); #endregion outStoreBusiness.RefreshStoreStockEvent += Query; - + SelectTypeViewModel.RefreshLinerPageEvent += Query; inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo; Query(); @@ -52,6 +56,18 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo } #region 参数定义 + + public RelayCommand SubmitCommand { get; set; } + + private void SubmitCommandExecute(string spaceCode) + { + + SelectType type = new SelectType(1, spaceCode); + type.ShowDialog(); + + } + + public ObservableCollection _shapes; public ObservableCollection Shapes diff --git a/Aucma.Scada.UI/viewModel/InventoryInfo/SelectTypeViewModel.cs b/Aucma.Scada.UI/viewModel/InventoryInfo/SelectTypeViewModel.cs new file mode 100644 index 0000000..05acdbe --- /dev/null +++ b/Aucma.Scada.UI/viewModel/InventoryInfo/SelectTypeViewModel.cs @@ -0,0 +1,320 @@ +using Aucma.Scada.Model.domain; +using Aucma.Scada.UI.Page.InventoryInfo; +using GalaSoft.MvvmLight; +using HighWayIot.Config; +using HighWayIot.Log4net; +using HighWayIot.Repository.service.Impl; +using HighWayIot.Repository.service; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using GalaSoft.MvvmLight.Command; + +namespace Aucma.Scada.UI.viewModel.InventoryInfo +{ + public class SelectTypeViewModel : ViewModelBase + { + + /// + /// 委托,关闭窗口 + /// + /// + public delegate void close(); + public event close closeEvent; + /// + /// 刷新箱壳库页面 + /// + /// + public delegate void RefreshShellPage(); + public static event RefreshShellPage RefreshShellPageEvent; + + /// + /// 刷新内胆库页面 + /// + /// + public delegate void RefreshLinerPage(); + public static event RefreshLinerPage RefreshLinerPageEvent; + + public RelayCommand QueryCommand { get; set; } + public RelayCommand deleteCommand { get; set; } + public RelayCommand SaveCommand { get; set; } + private AppConfig appConfig = AppConfig.Instance; + + private LogHelper logHelper = LogHelper.Instance; + + private ShellInventory shellInventory = new ShellInventory(); + + private LinerInventory linerInventory = new LinerInventory(); + + private IBaseMaterialInfoService baseMaterialInfoService = new BaseMaterialInfoServiceImpl(); + + private IBaseSpaceInfoService baseSpaceInfoService = new BaseSpaceInfoServiceImpl(); + + public RelayCommand MouseClickCommand { get; set; } + + private string spaceCodes = string.Empty; + + public SelectTypeViewModel() + { + + } + public SelectTypeViewModel(int ncount, string spaceCode) + { + QueryCommand = new RelayCommand(searchData); + SaveCommand = new RelayCommand(updateDirection); + deleteCommand = new RelayCommand(deleteModel); + spaceCodes = spaceCode; + MouseClickCommand = new RelayCommand(MouseClick); + materialDataGrid = new ObservableCollection(); + Console.WriteLine(spaceCode); + Load(); + if (ncount == 1) + { + IsSelectedOptionA = true; + } + else if (ncount == 2) + { + IsSelectedOptionB = true; + } + else if (ncount == 3) + { + IsSelectedOptionC = true; + } + } + public void Load() + { + var infos = baseMaterialInfoService.getAllInfos(); + MaterialDataGrid.Clear(); + Application.Current.Dispatcher.Invoke(() => + { + foreach (BaseMaterialInfo info in infos) + { + MaterialDataGrid.Add(info); + } + }); + } + + private ObservableCollection materialDataGrid; + + public ObservableCollection MaterialDataGrid + { + get { return materialDataGrid; } + + set { materialDataGrid = value; RaisePropertyChanged(() => MaterialDataGrid); } + + } + + private BaseMaterialInfo selectedDataItem; + public BaseMaterialInfo SelectedDataItem + { + get { return selectedDataItem; } + set + { + selectedDataItem = value; + RaisePropertyChanged(nameof(SelectedDataItem)); + } + } + + public void MouseClick(object obj) + { + var info = SelectedDataItem as BaseMaterialInfo; + if (info != null) + { + PlanInfo = info; + // SelectTypeWindow window = new SelectTypeWindow(spaceCodes, SelectedDataItem); + // window.ShowDialog(); + + } + } + + + private BaseMaterialInfo planInfo = new BaseMaterialInfo(); + public BaseMaterialInfo PlanInfo + { + get { return planInfo; } + set + { + planInfo = value; + RaisePropertyChanged(nameof(PlanInfo)); + + } + } + private string searchText; + public string SearchText + { + get { return searchText; } + set + { + searchText = value; + RaisePropertyChanged(nameof(SearchText)); + + } + } + + + #region 单选框 + private bool _isSelectedOptionA; + public bool IsSelectedOptionA + { + get { return _isSelectedOptionA; } + set + { + if (_isSelectedOptionA != value) + { + _isSelectedOptionA = value; + RaisePropertyChanged(nameof(IsSelectedOptionA)); + // 如果选择了A选项,将BC选项设为false + if (_isSelectedOptionA) + { + IsSelectedOptionB = false; + IsSelectedOptionC = false; + } + } + } + } + + private bool _isSelectedOptionB; + public bool IsSelectedOptionB + { + get { return _isSelectedOptionB; } + set + { + if (_isSelectedOptionB != value) + { + _isSelectedOptionB = value; + RaisePropertyChanged(nameof(IsSelectedOptionB)); + + // 如果选择了B选项,将A选项设为false + if (_isSelectedOptionB) + { + IsSelectedOptionA = false; + IsSelectedOptionC = false; + } + } + } + } + + private bool _isSelectedOptionC; + public bool IsSelectedOptionC + { + get { return _isSelectedOptionC; } + set + { + if (_isSelectedOptionC != value) + { + _isSelectedOptionC = value; + RaisePropertyChanged(nameof(IsSelectedOptionC)); + if (_isSelectedOptionC) + { + IsSelectedOptionA = false; + IsSelectedOptionB = false; + } + } + } + } + #endregion + private async void deleteModel() + { + if (!IsSelectedOptionA && !IsSelectedOptionB && !IsSelectedOptionC) + { + MessageBox.Show("请至少选择一个型号!"); + return; + } + // 查询货道信息 + string storeCode = spaceCodes.Substring(0,2).Equals("XK")? appConfig.shellStoreCode: appConfig.linerStoreCode; + + BaseSpaceInfo space = baseSpaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCodes); + if (IsSelectedOptionA) + { + space.materialType = null; + space.typeNameA = null; + } + else if (IsSelectedOptionB) + { + space.typeCodeB = null; + space.typeNameB = null; + } + else if (IsSelectedOptionC) + { + space.typeCodeC = null; + space.typeNameC = null; + } + bool result = baseSpaceInfoService.UpdateSpaceInfo(space); + if (result) + { + MessageBox.Show("清除型号成功!"); + } + //关闭窗口 + closeEvent?.Invoke(); + //刷新界面 + RefreshShellPageEvent?.Invoke(); + RefreshLinerPageEvent?.Invoke(); + } + /// + /// 设置型号 + /// + private async void updateDirection() + { + + if (!IsSelectedOptionA && !IsSelectedOptionB && !IsSelectedOptionC) + { + MessageBox.Show("请至少选择一个型号!"); + return; + } + + // 查询货道信息 + string storeCode = spaceCodes.Substring(0, 2).Equals("XK") ? appConfig.shellStoreCode : appConfig.linerStoreCode; + + BaseSpaceInfo space = baseSpaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCodes); + if (IsSelectedOptionA) + { + space.materialType = PlanInfo.MaterialCode; + space.typeNameA = PlanInfo.MaterialName; + } + else if (IsSelectedOptionB) + { + space.typeCodeB = PlanInfo.MaterialCode; + space.typeNameB = PlanInfo.MaterialName; + } + else if (IsSelectedOptionC) + { + space.typeCodeC = PlanInfo.MaterialCode; + space.typeNameC = PlanInfo.MaterialName; + } + bool result = baseSpaceInfoService.UpdateSpaceInfo(space); + if (result) + { + MessageBox.Show("型号设置成功"); + } + + //关闭窗口 + closeEvent?.Invoke(); + //刷新界面 + RefreshShellPageEvent?.Invoke(); + RefreshLinerPageEvent?.Invoke(); + } + + /// + ///条件查询型号 + /// + private async void searchData() + { + if (!string.IsNullOrEmpty(searchText)) + { + var infos = baseMaterialInfoService.getAllInfos().Where(x => x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText)); + MaterialDataGrid.Clear(); + Application.Current.Dispatcher.Invoke(() => + { + foreach (BaseMaterialInfo info in infos) + { + MaterialDataGrid.Add(info); + } + }); + } + } + } +} diff --git a/Aucma.Scada.UI/viewModel/InventoryInfo/ShellInventoryViewModel.cs b/Aucma.Scada.UI/viewModel/InventoryInfo/ShellInventoryViewModel.cs index 1825e88..2920b4c 100644 --- a/Aucma.Scada.UI/viewModel/InventoryInfo/ShellInventoryViewModel.cs +++ b/Aucma.Scada.UI/viewModel/InventoryInfo/ShellInventoryViewModel.cs @@ -31,6 +31,10 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo { #region 事件绑定 + + // 设置型号 + SubmitCommand = new RelayCommand(obj => SubmitCommandExecute(obj)); + UpdateInStoreFlagCommand = new RelayCommand(obj => UpdateInStoreFlag(obj)); UpdateOutStoreFlagCommand = new RelayCommand(obj => UpdateOutStoreFlag(obj)); @@ -46,13 +50,28 @@ namespace Aucma.Scada.UI.viewModel.InventoryInfo outStoreBusiness.RefreshStoreStockEvent += Query; + SelectTypeViewModel.RefreshShellPageEvent += Query; inStoreBusiness.RefreshInStoreTaskEvent += RefreshSpaceInfo; + + Query(); } #region 参数定义 + + public RelayCommand SubmitCommand { get; set; } + + private void SubmitCommandExecute(string spaceCode) + { + + SelectType type = new SelectType(1, spaceCode); + type.ShowDialog(); + + } + + public ObservableCollection _shapes; public ObservableCollection Shapes diff --git a/Aucma.Scada.UI/viewModel/MainViewModel.cs b/Aucma.Scada.UI/viewModel/MainViewModel.cs index 3271d1b..ab45600 100644 --- a/Aucma.Scada.UI/viewModel/MainViewModel.cs +++ b/Aucma.Scada.UI/viewModel/MainViewModel.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Windows; +using System.Windows.Threading; namespace Aucma.Scada.UI.viewModel { @@ -33,7 +34,12 @@ namespace Aucma.Scada.UI.viewModel public MainViewModel() { - + // 创建一个DispatcherTimer对象 + DispatcherTimer timer = new DispatcherTimer(); + timer.Interval = TimeSpan.FromSeconds(1); + timer.Tick += Timer_Tick; + timer.Start(); + ControlOnClickCommand = new RelayCommand(obj => ControlOnClick(obj)); OpenSystemKeyboardCommand = new RelayCommand(OpenSystemKeyboard); @@ -228,9 +234,17 @@ namespace Aucma.Scada.UI.viewModel /// public void RefreshStatus(object sender, System.Timers.ElapsedEventArgs e) { - RefreshMesDb(); - RefreshPlc(); - RefreshScanner(); + try + { + RefreshMesDb(); + RefreshPlc(); + RefreshScanner(); + } + catch (Exception ex) + { + + logHelper.Error(ex.Message.ToString()); + } } /// @@ -574,6 +588,38 @@ namespace Aucma.Scada.UI.viewModel } #endregion + public string _currentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + public string CurrentDateTime + { + get => _currentDateTime; + set { _currentDateTime = value; RaisePropertyChanged(nameof(CurrentDateTime)); } + + } + public string _shiftStr = string.Empty; + public string ShiftStr + { + get => _shiftStr; + set { _shiftStr = value; RaisePropertyChanged(nameof(ShiftStr)); } + + } + + private void Timer_Tick(object sender, EventArgs e) + { + DateTime now = DateTime.Now; + + // 判断当前是否是白班时间段 + if (now.Hour >= 8 && now.Hour < 20) + { + ShiftStr = $"白班 08点-20点"; + } + else + { + + ShiftStr = $"夜班 20点-08点"; + } + CurrentDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + } + } } diff --git a/HighWayIot.Config/PlcSpaceConfig.cs b/HighWayIot.Config/PlcSpaceConfig.cs index 46d355b..6cade79 100644 --- a/HighWayIot.Config/PlcSpaceConfig.cs +++ b/HighWayIot.Config/PlcSpaceConfig.cs @@ -32,7 +32,7 @@ namespace HighWayIot.Config SpaceAddress spaceAddress = new SpaceAddress(); spaceAddress.onStore = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "在库数量"); spaceAddress.onRoute = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "在途数量"); - spaceAddress.outStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "入库完成"); + spaceAddress.inStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "入库完成"); spaceAddress.outStoreFinish = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "出库完成"); return spaceAddress; // spaceAddress.isFull = iniHelper.IniReadValue($"{storeCode}_{spaceCode}", "是否已满"); diff --git a/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll b/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll index ab4c9d8..a9bb518 100644 Binary files a/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll and b/HighWayIot.Config/bin/Debug/HighWayIot.Config.dll differ diff --git a/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb b/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb index 0322de1..17d6959 100644 Binary files a/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb and b/HighWayIot.Config/bin/Debug/HighWayIot.Config.pdb differ diff --git a/HighWayIot.Repository/HighWayIot.Repository.csproj b/HighWayIot.Repository/HighWayIot.Repository.csproj index 708f312..40631da 100644 --- a/HighWayIot.Repository/HighWayIot.Repository.csproj +++ b/HighWayIot.Repository/HighWayIot.Repository.csproj @@ -52,7 +52,9 @@ + + diff --git a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll index ad579f4..289dba9 100644 Binary files a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll and b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.dll differ diff --git a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb index 2f9d099..bb1c5b3 100644 Binary files a/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb and b/HighWayIot.Repository/bin/Debug/Aucma.Scada.Model.pdb differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll index ab4c9d8..a9bb518 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll and b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.dll differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb index 0322de1..17d6959 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb and b/HighWayIot.Repository/bin/Debug/HighWayIot.Config.pdb differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll index 0b08b08..5dbf48b 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll and b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.dll differ diff --git a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb index 7564a7c..fb56bc9 100644 Binary files a/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb and b/HighWayIot.Repository/bin/Debug/HighWayIot.Repository.pdb differ diff --git a/HighWayIot.Repository/service/IBaseMaterialInfoService.cs b/HighWayIot.Repository/service/IBaseMaterialInfoService.cs new file mode 100644 index 0000000..9d9f01a --- /dev/null +++ b/HighWayIot.Repository/service/IBaseMaterialInfoService.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 IBaseMaterialInfoService + { + /// + /// 箱壳内胆条码绑定 + /// + List getAllInfos(); + } +} diff --git a/HighWayIot.Repository/service/Impl/BaseMaterialInfoServiceImpl.cs b/HighWayIot.Repository/service/Impl/BaseMaterialInfoServiceImpl.cs new file mode 100644 index 0000000..dd5b02c --- /dev/null +++ b/HighWayIot.Repository/service/Impl/BaseMaterialInfoServiceImpl.cs @@ -0,0 +1,32 @@ +using Aucma.Scada.Model.domain; +using HighWayIot.Log4net; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.service.Impl +{ + public class BaseMaterialInfoServiceImpl : IBaseMaterialInfoService + { + Repository _baseMaterialInfo => new Repository("mes"); + + private LogHelper logHelper = LogHelper.Instance; + + public List getAllInfos() + { + try + { + var info = _baseMaterialInfo.GetList(x => x.MaterialSubclass == "200"); + return info; + } + catch (Exception ex) + { + logHelper.Error("获取集合异常", ex); + return null; + } + } + + } +} diff --git a/HighWayIot.Repository/service/Impl/BaseSpaceInfoServiceImpl.cs b/HighWayIot.Repository/service/Impl/BaseSpaceInfoServiceImpl.cs index 7b8afea..6ec4c5a 100644 --- a/HighWayIot.Repository/service/Impl/BaseSpaceInfoServiceImpl.cs +++ b/HighWayIot.Repository/service/Impl/BaseSpaceInfoServiceImpl.cs @@ -178,28 +178,28 @@ namespace HighWayIot.Repository.service.Impl List spaceInfos = null; try { - //spaceInfos = _mesRepository.GetList(x => x.storeCode == storeCode).ToList(); + spaceInfos = _mesRepository.GetList(x => x.storeCode == storeCode).ToList(); - spaceInfos = _mesRepository.Context.Queryable() - .LeftJoin((s, b) => s.materialType == b.materialCode) - .Where((s, b) => s.storeCode == storeCode) - .Select((s, b) => new BaseSpaceInfo() - { - objId = s.objId, - spaceCode = s.spaceCode, - spaceName = s.spaceName, - spaceCapacity = s.spaceCapacity, - spaceStock = s.spaceStock, - spaceStatus = s.spaceStatus, - spaceType = s.spaceType, - isFlag = s.isFlag, - materialType = b.materialName, - onRouteAmount = s.onRouteAmount, - inStoreFlag = s.inStoreFlag, - outRouteAmount = s.outRouteAmount, - outStoreFlag = s.outStoreFlag, - unusualFlag = s.unusualFlag, - }).ToList(); + //spaceInfos = _mesRepository.Context.Queryable() + // .LeftJoin((s, b) => s.materialType == b.materialCode) + // .Where((s, b) => s.storeCode == storeCode) + // .Select((s, b) => new BaseSpaceInfo() + // { + // objId = s.objId, + // spaceCode = s.spaceCode, + // spaceName = s.spaceName, + // spaceCapacity = s.spaceCapacity, + // spaceStock = s.spaceStock, + // spaceStatus = s.spaceStatus, + // spaceType = s.spaceType, + // isFlag = s.isFlag, + // materialType = b.materialName, + // onRouteAmount = s.onRouteAmount, + // inStoreFlag = s.inStoreFlag, + // outRouteAmount = s.outRouteAmount, + // outStoreFlag = s.outStoreFlag, + // unusualFlag = s.unusualFlag, + // }).ToList(); } catch (Exception ex) { @@ -227,6 +227,8 @@ namespace HighWayIot.Repository.service.Impl return result; } + + /// /// /// @@ -251,13 +253,14 @@ namespace HighWayIot.Repository.service.Impl shellStock = g.Where(x => x.STORE_CODE == shellStoreCode).Select(x => x.SPACE_STOCK).FirstOrDefault(), linerStock = g.Where(x => x.STORE_CODE == linerStoreCode).Select(x => x.SPACE_STOCK).FirstOrDefault() }).ToList(); - + } } catch (Exception ex) { logHelper.Error("获取物料库存异常", ex); } + return result; }