From 37c4da42e6bc67a0c40ef1d4f2527a5577f86a2e Mon Sep 17 00:00:00 2001 From: hwh <332078369@qq.com> Date: 星期三, 21 八月 2024 07:56:21 +0800 Subject: [PATCH] plc设备信息页面优化 --- Admin.NET/WCS.Application/Entity/WcsPlc.cs | 7 Web/src/views/wcs/wcsPlc/index.vue | 279 +++++----- Admin.NET/WCS.Application/Util/PLCUtil.cs | 12 Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs | 9 Web/src/views/wcs/wcsStation/component/editDialog.vue | 7 Admin.NET/WCS.Application/Enum/PLCEnum.cs | 86 +++ Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs | 2 Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs | 14 Web/src/views/wcs/wcsStation/index.vue | 11 Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs | 180 +++--- Web/src/views/wcs/wcsPlc/component/editDialog.vue | 173 +++--- Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs | 63 +- Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs | 26 Web/src/views/wcs/wcsDevice/component/editDialog.vue | 218 ++++---- Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs | 9 Admin.NET/WCS.Application/Entity/WcsDevice.cs | 4 Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs | 2 Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs | 2 Web/src/views/wcs/wcsDevice/index.vue | 297 ++++++------ Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs | 9 Admin.NET/WCS.Application/Entity/WcsStation.cs | 4 Admin.NET/WCS.Application/WCS.Application.csproj | 4 22 files changed, 773 insertions(+), 645 deletions(-) diff --git a/Admin.NET/WCS.Application/Entity/WcsDevice.cs b/Admin.NET/WCS.Application/Entity/WcsDevice.cs index 5d2b84c..beca712 100644 --- a/Admin.NET/WCS.Application/Entity/WcsDevice.cs +++ b/Admin.NET/WCS.Application/Entity/WcsDevice.cs @@ -47,8 +47,8 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - [SugarColumn(ColumnName = "PosType", ColumnDescription = "娴佺▼瀛楃被鍨�", Length = 10)] - public string? PosType { get; set; } + [SugarColumn(ColumnName = "PosType", ColumnDescription = "娴佺▼瀛楃被鍨�")] + public PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Entity/WcsPlc.cs b/Admin.NET/WCS.Application/Entity/WcsPlc.cs index e3a1519..e92777f 100644 --- a/Admin.NET/WCS.Application/Entity/WcsPlc.cs +++ b/Admin.NET/WCS.Application/Entity/WcsPlc.cs @@ -15,6 +15,13 @@ public string IP { get; set; } /// <summary> + /// PLC绫诲瀷 + /// </summary> + [Required] + [SugarColumn(ColumnName = "PLCType", ColumnDescription = "PLC绫诲瀷")] + public PLCEnum PLCType { get; set; } + + /// <summary> /// 璁惧绫诲瀷 /// </summary> [Required] diff --git a/Admin.NET/WCS.Application/Entity/WcsplcStation.cs b/Admin.NET/WCS.Application/Entity/WcsStation.cs similarity index 94% rename from Admin.NET/WCS.Application/Entity/WcsplcStation.cs rename to Admin.NET/WCS.Application/Entity/WcsStation.cs index d4e6c59..565ef8b 100644 --- a/Admin.NET/WCS.Application/Entity/WcsplcStation.cs +++ b/Admin.NET/WCS.Application/Entity/WcsStation.cs @@ -29,8 +29,8 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - [SugarColumn(ColumnName = "PosType", ColumnDescription = "娴佺▼瀛楃被鍨�", Length = 10)] - public string? PosType { get; set; } + [SugarColumn(ColumnName = "PosType", ColumnDescription = "娴佺▼瀛楃被鍨�")] + public PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Enum/PLCEnum.cs b/Admin.NET/WCS.Application/Enum/PLCEnum.cs index 786fcbb..7b0d9e4 100644 --- a/Admin.NET/WCS.Application/Enum/PLCEnum.cs +++ b/Admin.NET/WCS.Application/Enum/PLCEnum.cs @@ -44,4 +44,90 @@ /// </summary> [Description("宸ヤ綅绾у埆")] Station = 2, +} +/// <summary> +/// PLC鏋氫妇 +/// </summary> +[Description("PLC鏋氫妇")] +public enum PLCEnum +{ + //鏈畾涔� + [Description("鏈畾涔�")] + None = 0, + //瑗块棬瀛怱7-200 + [Description("瑗块棬瀛怱7-200")] + S7_200 = 1, + //瑗块棬瀛怱7-200Smar + [Description("瑗块棬瀛怱7-200Smar")] + S7_200Smart = 2, + //瑗块棬瀛怱7-300 + [Description("瑗块棬瀛怱7-300")] + S7_300 = 3, + //瑗块棬瀛怱7-400 + [Description("瑗块棬瀛怱7-400")] + S7_400 = 4, + //瑗块棬瀛怱7-1200 + [Description("瑗块棬瀛怱7-1200")] + S7_1200 = 5, + //瑗块棬瀛怱7-1500 + [Description("瑗块棬瀛怱7-1500")] + S7_1500 = 6, + //ModBusTcp + [Description("ModBusTcp")] + ModBusTcp =7, + //ModBusRtu + [Description("ModBusRtu")] + ModBusRtu = 8, + //ModBusAscii + [Description("ModBusAscii")] + ModBusAscii = 9, + //ModbusRtuOverTcp + [Description("ModbusRtuOverTcp")] + ModbusRtuOverTcp = 10, + //涓夎彵 + [Description("涓夎彵")] + Mitsubishi = 11, + //娆у榫� + [Description("娆у榫�")] + OmronFins = 12, + //缃楀厠闊﹀皵 + [Description("缃楀厠闊﹀皵")] + AllenBradley = 13, +} +/// <summary> +/// PLC鏁版嵁绫诲瀷鏋氫妇 +/// </summary> +[Description("PLC鏁版嵁绫诲瀷鏋氫妇")] +public enum PLCDataTypeEnum +{ + //Bit + [Description("Bit")] + Bit = 1, + //Byte + [Description("Byte")] + Byte = 2, + //Char + [Description("Char")] + Char = 3, + //Word + [Description("Word")] + Word = 4, + //DWord + [Description("DWord")] + DWord = 5, + //Int + [Description("Int")] + Int = 6, + //DInt + [Description("DInt")] + DInt = 7, + //Real + [Description("Real")] + Real = 8, + //LReal + [Description("LReal")] + LReal = 9, + //String + [Description("String")] + String = 10, } \ No newline at end of file diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs index 5766a55..52b07b4 100644 --- a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs +++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs @@ -1,9 +1,4 @@ -锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� -// -// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� -// -// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� - +锘� namespace WCS.Application; /// <summary> @@ -54,7 +49,7 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - public string? PosType { get; set; } + public PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs index b20902b..4ce65df 100644 --- a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs +++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs @@ -47,7 +47,7 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - public virtual string? PosType { get; set; } + public virtual PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs index 33dcd35..1cfabf2 100644 --- a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs +++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs @@ -1,9 +1,4 @@ -锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� -// -// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� -// -// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� - +锘� namespace WCS.Application; /// <summary> @@ -54,7 +49,7 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - public string? PosType { get; set; } + public PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs index 6be8c4c..d2030b3 100644 --- a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs +++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs @@ -6,34 +6,39 @@ namespace WCS.Application; +/// <summary> +/// PLC杈撳嚭鍙傛暟 +/// </summary> +public class WcsPlcDto +{ /// <summary> - /// PLC杈撳嚭鍙傛暟 + /// 涓婚敭Id /// </summary> - public class WcsPlcDto - { - /// <summary> - /// 涓婚敭Id - /// </summary> - public long Id { get; set; } - - /// <summary> - /// PLCIP鍦板潃 - /// </summary> - public string IP { get; set; } - - /// <summary> - /// 璁惧绫诲瀷 - /// </summary> - public PLCTypeEnum Type { get; set; } - - /// <summary> - /// 浠撳簱鍙� - /// </summary> - public string? WareHouseNo { get; set; } - - /// <summary> - /// 鎻忚堪 - /// </summary> - public string? Text { get; set; } - - } + public long Id { get; set; } + + /// <summary> + /// PLCIP鍦板潃 + /// </summary> + public string IP { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + public PLCEnum PLCType { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + public PLCTypeEnum Type { get; set; } + + /// <summary> + /// 浠撳簱鍙� + /// </summary> + public string? WareHouseNo { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Text { get; set; } + +} diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs index 70fbf15..68983b8 100644 --- a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs +++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs @@ -1,106 +1,114 @@ -锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� -// -// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� -// -// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� - -using Admin.NET.Core; -using System.ComponentModel.DataAnnotations; - +锘� namespace WCS.Application; +/// <summary> +/// PLC鍩虹杈撳叆鍙傛暟 +/// </summary> +public class WcsPlcBaseInput +{ /// <summary> - /// PLC鍩虹杈撳叆鍙傛暟 + /// PLCIP鍦板潃 /// </summary> - public class WcsPlcBaseInput - { - /// <summary> - /// PLCIP鍦板潃 - /// </summary> - public virtual string IP { get; set; } - - /// <summary> - /// 璁惧绫诲瀷 - /// </summary> - public virtual PLCTypeEnum Type { get; set; } - - /// <summary> - /// 浠撳簱鍙� - /// </summary> - public virtual string? WareHouseNo { get; set; } - - /// <summary> - /// 鎻忚堪 - /// </summary> - public virtual string? Text { get; set; } - - } + public virtual string IP { get; set; } /// <summary> - /// PLC鍒嗛〉鏌ヨ杈撳叆鍙傛暟 + /// PLC绫诲瀷 /// </summary> - public class PageWcsPlcInput : BasePageInput - { - /// <summary> - /// 鍏抽敭瀛楁煡璇� - /// </summary> - public string? SearchKey { get; set; } - - /// <summary> - /// PLCIP鍦板潃 - /// </summary> - public string? IP { get; set; } - - /// <summary> - /// 璁惧绫诲瀷 - /// </summary> - public PLCTypeEnum? Type { get; set; } - - } + public virtual PLCEnum PLCType { get; set; } /// <summary> - /// PLC澧炲姞杈撳叆鍙傛暟 + /// 璁惧绫诲瀷 /// </summary> - public class AddWcsPlcInput : WcsPlcBaseInput - { - /// <summary> - /// PLCIP鍦板潃 - /// </summary> - [Required(ErrorMessage = "PLCIP鍦板潃涓嶈兘涓虹┖")] - public override string IP { get; set; } - - /// <summary> - /// 璁惧绫诲瀷 - /// </summary> - [Required(ErrorMessage = "璁惧绫诲瀷涓嶈兘涓虹┖")] - public override PLCTypeEnum Type { get; set; } - - } + public virtual PLCTypeEnum Type { get; set; } /// <summary> - /// PLC鍒犻櫎杈撳叆鍙傛暟 + /// 浠撳簱鍙� /// </summary> - public class DeleteWcsPlcInput : BaseIdInput - { - } + public virtual string? WareHouseNo { get; set; } /// <summary> - /// PLC鏇存柊杈撳叆鍙傛暟 + /// 鎻忚堪 /// </summary> - public class UpdateWcsPlcInput : WcsPlcBaseInput - { - /// <summary> - /// 涓婚敭Id - /// </summary> - [Required(ErrorMessage = "涓婚敭Id涓嶈兘涓虹┖")] - public long Id { get; set; } - - } + public virtual string? Text { get; set; } + +} + +/// <summary> +/// PLC鍒嗛〉鏌ヨ杈撳叆鍙傛暟 +/// </summary> +public class PageWcsPlcInput : BasePageInput +{ + /// <summary> + /// 鍏抽敭瀛楁煡璇� + /// </summary> + public string? SearchKey { get; set; } /// <summary> - /// PLC涓婚敭鏌ヨ杈撳叆鍙傛暟 + /// PLCIP鍦板潃 /// </summary> - public class QueryByIdWcsPlcInput : DeleteWcsPlcInput - { + public string? IP { get; set; } - } + /// <summary> + /// PLC绫诲瀷 + /// </summary> + public PLCEnum? PLCType { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + public PLCTypeEnum? Type { get; set; } + +} + +/// <summary> +/// PLC澧炲姞杈撳叆鍙傛暟 +/// </summary> +public class AddWcsPlcInput : WcsPlcBaseInput +{ + /// <summary> + /// PLCIP鍦板潃 + /// </summary> + [Required(ErrorMessage = "PLCIP鍦板潃涓嶈兘涓虹┖")] + public override string IP { get; set; } + + /// <summary> + /// PLC绫诲瀷 + /// </summary> + [Required(ErrorMessage = "PLC绫诲瀷涓嶈兘涓虹┖")] + public override PLCEnum PLCType { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + [Required(ErrorMessage = "璁惧绫诲瀷涓嶈兘涓虹┖")] + public override PLCTypeEnum Type { get; set; } + +} + +/// <summary> +/// PLC鍒犻櫎杈撳叆鍙傛暟 +/// </summary> +public class DeleteWcsPlcInput : BaseIdInput +{ +} + +/// <summary> +/// PLC鏇存柊杈撳叆鍙傛暟 +/// </summary> +public class UpdateWcsPlcInput : WcsPlcBaseInput +{ + /// <summary> + /// 涓婚敭Id + /// </summary> + [Required(ErrorMessage = "涓婚敭Id涓嶈兘涓虹┖")] + public long Id { get; set; } + +} + +/// <summary> +/// PLC涓婚敭鏌ヨ杈撳叆鍙傛暟 +/// </summary> +public class QueryByIdWcsPlcInput : DeleteWcsPlcInput +{ + +} diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs index 0b233cf..3668e2a 100644 --- a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs +++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs @@ -1,9 +1,4 @@ -锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� -// -// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� -// -// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� - +锘� namespace WCS.Application; /// <summary> @@ -15,27 +10,32 @@ /// 涓婚敭Id /// </summary> public long Id { get; set; } - + /// <summary> /// PLCIP鍦板潃 /// </summary> public string IP { get; set; } - + + /// <summary> + /// PLC绫诲瀷 + /// </summary> + public PLCEnum PLCType { get; set; } + /// <summary> /// 璁惧绫诲瀷 /// </summary> public PLCTypeEnum Type { get; set; } - + /// <summary> /// 浠撳簱鍙� /// </summary> public string? WareHouseNo { get; set; } - + /// <summary> /// 鎻忚堪 /// </summary> public string? Text { get; set; } - - } - + +} + diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs index 0b3cfec..20f41a3 100644 --- a/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs +++ b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs @@ -1,11 +1,4 @@ -锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� -// -// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� -// -// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� - -using Admin.NET.Core.Service; -using Microsoft.AspNetCore.Http; +锘� namespace WCS.Application; /// <summary> @@ -30,15 +23,16 @@ [DisplayName("鍒嗛〉鏌ヨPLC")] public async Task<SqlSugarPagedList<WcsPlcOutput>> Page(PageWcsPlcInput input) { - input.SearchKey = input.SearchKey?.Trim(); + input.SearchKey = input.SearchKey?.Trim(); var query = _wcsPlcRep.AsQueryable() .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u => u.IP.Contains(input.SearchKey) ) + .WhereIF(input.PLCType.HasValue, u => u.PLCType == input.PLCType) .WhereIF(!string.IsNullOrWhiteSpace(input.IP), u => u.IP.Contains(input.IP.Trim())) .WhereIF(input.Type.HasValue, u => u.Type == input.Type) .Select<WcsPlcOutput>(); - return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); + return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); } /// <summary> diff --git a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs index 9343a37..b04b356 100644 --- a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs +++ b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs @@ -34,7 +34,7 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - public string? PosType { get; set; } + public PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs index fd618ab..f6afe50 100644 --- a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs +++ b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs @@ -32,7 +32,7 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - public virtual string? PosType { get; set; } + public virtual PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs index 2a2de65..1ad17eb 100644 --- a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs +++ b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs @@ -1,9 +1,4 @@ -锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� -// -// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� -// -// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� - +锘� namespace WCS.Application; /// <summary> @@ -39,7 +34,7 @@ /// <summary> /// 娴佺▼瀛楃被鍨� /// </summary> - public string? PosType { get; set; } + public PLCDataTypeEnum? PosType { get; set; } /// <summary> /// 鏄剧ず灞廼p鍦板潃 diff --git a/Admin.NET/WCS.Application/Util/PLCUtil.cs b/Admin.NET/WCS.Application/Util/PLCUtil.cs new file mode 100644 index 0000000..ce92a19 --- /dev/null +++ b/Admin.NET/WCS.Application/Util/PLCUtil.cs @@ -0,0 +1,12 @@ +锘縰sing IoTClient.Clients.PLC; +using IoTClient.Common.Enums; + +namespace WCS.Application; +public class PLCUtil +{ + public PLCUtil() + { + SiemensClient client = new SiemensClient(SiemensVersion.S7_200Smart, "127.0.0.1", 102); + + } +} diff --git a/Admin.NET/WCS.Application/WCS.Application.csproj b/Admin.NET/WCS.Application/WCS.Application.csproj index 4ecdaac..a46c333 100644 --- a/Admin.NET/WCS.Application/WCS.Application.csproj +++ b/Admin.NET/WCS.Application/WCS.Application.csproj @@ -118,6 +118,10 @@ </ItemGroup> <ItemGroup> + <PackageReference Include="IoTClient" Version="1.0.40" /> + </ItemGroup> + + <ItemGroup> <ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" /> <ProjectReference Include="..\Plugins\Admin.NET.Plugin.ApprovalFlow\Admin.NET.Plugin.ApprovalFlow.csproj" /> <ProjectReference Include="..\Plugins\Admin.NET.Plugin.DingTalk\Admin.NET.Plugin.DingTalk.csproj" /> diff --git a/Web/src/views/wcs/wcsDevice/component/editDialog.vue b/Web/src/views/wcs/wcsDevice/component/editDialog.vue index 10396a3..fc839f3 100644 --- a/Web/src/views/wcs/wcsDevice/component/editDialog.vue +++ b/Web/src/views/wcs/wcsDevice/component/editDialog.vue @@ -15,71 +15,85 @@ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="PlcId" prop="plcId"> <el-select clearable filterable v-model="ruleForm.plcId" placeholder="璇烽�夋嫨PlcId"> - <el-option v-for="(item,index) in wcsPlcPlcIdDropdownList" :key="index" :value="item.value" :label="item.label" /> - + <el-option v-for="(item, index) in wcsPlcPlcIdDropdownList" :key="index" + :value="item.value" :label="item.label" /> + </el-select> - + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="璁惧绾у埆" prop="level"> <el-select clearable v-model="ruleForm.level" placeholder="璇烽�夋嫨璁惧绾у埆"> - <el-option v-for="(item,index) in dl('DeviceLevelEnum')" :key="index" :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> - + <el-option v-for="(item, index) in dl('DeviceLevelEnum')" :key="index" + :value="Number(item.value)" + :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> + </el-select> - + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="DB鍖哄煙" prop="dbNumber"> - <el-input v-model="ruleForm.dbNumber" placeholder="璇疯緭鍏B鍖哄煙" maxlength="10" show-word-limit clearable /> - + <el-input v-model="ruleForm.dbNumber" placeholder="璇疯緭鍏B鍖哄煙" maxlength="10" show-word-limit + clearable /> + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="宸ヤ綅鍙�" prop="stationNum"> - <el-input v-model="ruleForm.stationNum" placeholder="璇疯緭鍏ュ伐浣嶅彿" maxlength="4" show-word-limit clearable /> - + <el-input v-model="ruleForm.stationNum" placeholder="璇疯緭鍏ュ伐浣嶅彿" maxlength="4" show-word-limit + clearable /> + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="PLC鍋忕Щ閲�" prop="plcPos"> - <el-input v-model="ruleForm.plcPos" placeholder="璇疯緭鍏LC鍋忕Щ閲�" maxlength="10" show-word-limit clearable /> - + <el-input v-model="ruleForm.plcPos" placeholder="璇疯緭鍏LC鍋忕Щ閲�" maxlength="10" show-word-limit + clearable /> + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="WCS鍋忕Щ閲�" prop="wcsPos"> - <el-input v-model="ruleForm.wcsPos" placeholder="璇疯緭鍏CS鍋忕Щ閲�" maxlength="10" show-word-limit clearable /> - + <el-input v-model="ruleForm.wcsPos" placeholder="璇疯緭鍏CS鍋忕Щ閲�" maxlength="10" show-word-limit + clearable /> + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="娴佺▼瀛楃被鍨�" prop="posType"> - <el-input v-model="ruleForm.posType" placeholder="璇疯緭鍏ユ祦绋嬪瓧绫诲瀷" maxlength="10" show-word-limit clearable /> - + <el-select clearable v-model="ruleForm.posType" placeholder="璇烽�夋嫨娴佺▼瀛楃被鍨�"> + <el-option v-for="(item, index) in dl('PLCDataTypeEnum')" :key="index" + :value="Number(item.value)" + :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> + + </el-select> + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="鏄剧ず灞廼p鍦板潃" prop="ledIP"> - <el-input v-model="ruleForm.ledIP" placeholder="璇疯緭鍏ユ樉绀哄睆ip鍦板潃" maxlength="50" show-word-limit clearable /> - + <el-input v-model="ruleForm.ledIP" placeholder="璇疯緭鍏ユ樉绀哄睆ip鍦板潃" maxlength="50" show-word-limit + clearable /> + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="鎻忚堪" prop="text"> - <el-input v-model="ruleForm.text" placeholder="璇疯緭鍏ユ弿杩�" maxlength="20" show-word-limit clearable /> - + <el-input v-model="ruleForm.text" placeholder="璇疯緭鍏ユ弿杩�" maxlength="20" show-word-limit + clearable /> + </el-form-item> - + </el-col> </el-row> </el-form> @@ -99,97 +113,93 @@ } </style> <script lang="ts" setup> - import { ref,onMounted } from "vue"; - import { ElMessage } from "element-plus"; - import type { FormRules } from "element-plus"; - import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; - import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; - import { formatDate } from '/@/utils/formatTime'; - import { addWcsDevice, updateWcsDevice, detailWcsDevice } from "/@/api/wcs/wcsDevice"; - import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice'; - import { getAPI } from '/@/utils/axios-utils'; - import { SysEnumApi } from '/@/api-services/api'; +import { ref, onMounted } from "vue"; +import { ElMessage } from "element-plus"; +import type { FormRules } from "element-plus"; +import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; +import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; +import { formatDate } from '/@/utils/formatTime'; +import { addWcsDevice, updateWcsDevice, detailWcsDevice } from "/@/api/wcs/wcsDevice"; +import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice'; +import { getAPI } from '/@/utils/axios-utils'; +import { SysEnumApi } from '/@/api-services/api'; - //鐖剁骇浼犻�掓潵鐨勫弬鏁� - var props = defineProps({ - title: { +//鐖剁骇浼犻�掓潵鐨勫弬鏁� +var props = defineProps({ + title: { type: String, default: "", }, - }); - //鐖剁骇浼犻�掓潵鐨勫嚱鏁帮紝鐢ㄤ簬鍥炶皟 - const emit = defineEmits(["reloadTable"]); - const ruleFormRef = ref(); - const isShowDialog = ref(false); - const ruleForm = ref<any>({}); - //鑷娣诲姞鍏朵粬瑙勫垯 - const rules = ref<FormRules>({ - }); +}); +//鐖剁骇浼犻�掓潵鐨勫嚱鏁帮紝鐢ㄤ簬鍥炶皟 +const emit = defineEmits(["reloadTable"]); +const ruleFormRef = ref(); +const isShowDialog = ref(false); +const ruleForm = ref<any>({}); +//鑷娣诲姞鍏朵粬瑙勫垯 +const rules = ref<FormRules>({ +}); - // 椤甸潰鍔犺浇鏃� - onMounted(() => { +// 椤甸潰鍔犺浇鏃� +onMounted(() => { - }); +}); - // 鎵撳紑寮圭獥 - const openDialog = async (row: any) => { - // ruleForm.value = JSON.parse(JSON.stringify(row)); - // 鏀圭敤detail鑾峰彇鏈�鏂版暟鎹潵缂栬緫 - let rowData = JSON.parse(JSON.stringify(row)); - if (rowData.id) - ruleForm.value = (await detailWcsDevice(rowData.id)).data.result; - else - ruleForm.value = rowData; - isShowDialog.value = true; - }; +// 鎵撳紑寮圭獥 +const openDialog = async (row: any) => { + // ruleForm.value = JSON.parse(JSON.stringify(row)); + // 鏀圭敤detail鑾峰彇鏈�鏂版暟鎹潵缂栬緫 + let rowData = JSON.parse(JSON.stringify(row)); + if (rowData.id) + ruleForm.value = (await detailWcsDevice(rowData.id)).data.result; + else + ruleForm.value = rowData; + isShowDialog.value = true; +}; - // 鍏抽棴寮圭獥 - const closeDialog = () => { - emit("reloadTable"); - isShowDialog.value = false; - }; +// 鍏抽棴寮圭獥 +const closeDialog = () => { + emit("reloadTable"); + isShowDialog.value = false; +}; - // 鍙栨秷 - const cancel = () => { - isShowDialog.value = false; - }; +// 鍙栨秷 +const cancel = () => { + isShowDialog.value = false; +}; - // 鎻愪氦 - const submit = async () => { - ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => { - if (isValid) { - let values = ruleForm.value; - if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) { - await addWcsDevice(values); - } else { - await updateWcsDevice(values); - } - closeDialog(); +// 鎻愪氦 +const submit = async () => { + ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => { + if (isValid) { + let values = ruleForm.value; + if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) { + await addWcsDevice(values); } else { - ElMessage({ - message: `琛ㄥ崟鏈�${Object.keys(fields).length}澶勯獙璇佸け璐ワ紝璇蜂慨鏀瑰悗鍐嶆彁浜, - type: "error", - }); + await updateWcsDevice(values); } - }); - }; + closeDialog(); + } else { + ElMessage({ + message: `琛ㄥ崟鏈�${Object.keys(fields).length}澶勯獙璇佸け璐ワ紝璇蜂慨鏀瑰悗鍐嶆彁浜, + type: "error", + }); + } + }); +}; - const wcsPlcPlcIdDropdownList = ref<any>([]); - const getWcsPlcPlcIdDropdownList = async () => { - let list = await getWcsPlcPlcIdDropdown(); - wcsPlcPlcIdDropdownList.value = list.data.result ?? []; - }; - getWcsPlcPlcIdDropdownList(); - +const wcsPlcPlcIdDropdownList = ref<any>([]); +const getWcsPlcPlcIdDropdownList = async () => { + let list = await getWcsPlcPlcIdDropdown(); + wcsPlcPlcIdDropdownList.value = list.data.result ?? []; +}; +getWcsPlcPlcIdDropdownList(); - //灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠� - defineExpose({ openDialog }); + +//灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠� +defineExpose({ openDialog }); </script> - - - - diff --git a/Web/src/views/wcs/wcsDevice/index.vue b/Web/src/views/wcs/wcsDevice/index.vue index d22f856..adb4f8f 100644 --- a/Web/src/views/wcs/wcsDevice/index.vue +++ b/Web/src/views/wcs/wcsDevice/index.vue @@ -1,220 +1,213 @@ 锘�<template> <div class="wcsDevice-container"> - <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> <el-form :model="queryParams" ref="queryForm" labelWidth="90"> <el-row> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> <el-form-item label="鍏抽敭瀛�"> - <el-input v-model="queryParams.searchKey" clearable="" placeholder="璇疯緭鍏ユā绯婃煡璇㈠叧閿瓧"/> - + <el-input v-model="queryParams.searchKey" clearable="" placeholder="璇疯緭鍏ユā绯婃煡璇㈠叧閿瓧" /> + </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-form-item label="PlcId"> <el-select clearable="" filterable="" v-model="queryParams.plcId" placeholder="璇烽�夋嫨PlcId"> - <el-option v-for="(item,index) in wcsPlcPlcIdDropdownList" :key="index" :value="item.value" :label="item.label" /> - + <el-option v-for="(item, index) in wcsPlcPlcIdDropdownList" :key="index" :value="item.value" + :label="item.label" /> + </el-select> - + </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-form-item label="鎻忚堪"> - <el-input v-model="queryParams.text" clearable="" placeholder="璇疯緭鍏ユ弿杩�"/> - + <el-input v-model="queryParams.text" clearable="" placeholder="璇疯緭鍏ユ弿杩�" /> + </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> - <el-form-item > + <el-form-item> <el-button-group style="display: flex; align-items: center;"> - <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'wcsDevice:page'"> 鏌ヨ </el-button> - <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 閲嶇疆 </el-button> - <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> 楂樼骇鏌ヨ </el-button> - <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> 闅愯棌 </el-button> - <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsDevice" v-auth="'wcsDevice:add'"> 鏂板 </el-button> - + <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'wcsDevice:page'"> 鏌ヨ + </el-button> + <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 閲嶇疆 </el-button> + <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" + style="margin-left:5px;"> 楂樼骇鏌ヨ </el-button> + <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" + style="margin-left:5px;"> 闅愯棌 </el-button> + <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsDevice" + v-auth="'wcsDevice:add'"> 鏂板 </el-button> + </el-button-group> </el-form-item> - + </el-col> </el-row> </el-form> </el-card> <el-card class="full-table" shadow="hover" style="margin-top: 5px"> - <el-table - :data="tableData" - style="width: 100%" - v-loading="loading" - tooltip-effect="light" - row-key="id" - @sort-change="sortChange" - border=""> - <el-table-column type="index" label="搴忓彿" width="55" align="center"/> - <el-table-column prop="plcId" label="PlcId" show-overflow-tooltip=""> + <el-table :data="tableData" style="width: 100%" v-loading="loading" tooltip-effect="light" row-key="id" + @sort-change="sortChange" border=""> + <el-table-column type="index" label="搴忓彿" width="55" align="center" /> + <el-table-column prop="plcId" label="PlcId" show-overflow-tooltip=""> <template #default="scope"> - <span>{{scope.row.plcIdIP}}</span> - + <span>{{ scope.row.plcIdIP }}</span> + </template> - + </el-table-column> - <el-table-column prop="level" label="璁惧绾у埆" show-overflow-tooltip="" > - <template #default="scope"> - <el-tag :type="dv('DeviceLevelEnum', scope.row.level)?.tagType"> {{dv('DeviceLevelEnum', scope.row.level)?.name}}</el-tag> - </template> - </el-table-column> - <el-table-column prop="dbNumber" label="DB鍖哄煙" show-overflow-tooltip="" /> - <el-table-column prop="stationNum" label="宸ヤ綅鍙�" show-overflow-tooltip="" /> - <el-table-column prop="plcPos" label="PLC鍋忕Щ閲�" show-overflow-tooltip="" /> - <el-table-column prop="wcsPos" label="WCS鍋忕Щ閲�" show-overflow-tooltip="" /> - <el-table-column prop="posType" label="娴佺▼瀛楃被鍨�" show-overflow-tooltip="" /> - <el-table-column prop="ledIP" label="鏄剧ず灞廼p鍦板潃" show-overflow-tooltip="" /> - <el-table-column prop="text" label="鎻忚堪" show-overflow-tooltip="" /> + <el-table-column prop="level" label="璁惧绾у埆" show-overflow-tooltip=""> + <template #default="scope"> + <el-tag :type="dv('DeviceLevelEnum', scope.row.level)?.tagType"> {{ dv('DeviceLevelEnum', + scope.row.level)?.name}}</el-tag> + </template> + </el-table-column> + <el-table-column prop="dbNumber" label="DB鍖哄煙" show-overflow-tooltip="" /> + <el-table-column prop="stationNum" label="宸ヤ綅鍙�" show-overflow-tooltip="" /> + <el-table-column prop="plcPos" label="PLC鍋忕Щ閲�" show-overflow-tooltip="" /> + <el-table-column prop="wcsPos" label="WCS鍋忕Щ閲�" show-overflow-tooltip="" /> + <el-table-column prop="posType" label="娴佺▼瀛楃被鍨�" show-overflow-tooltip=""> + <template #default="scope"> + <el-tag :type="dv('PLCDataTypeEnum', scope.row.posType)?.tagType"> {{ dv('PLCDataTypeEnum', + scope.row.posType)?.name}}</el-tag> + </template> + </el-table-column> + <el-table-column prop="ledIP" label="鏄剧ず灞廼p鍦板潃" show-overflow-tooltip="" /> + <el-table-column prop="text" label="鎻忚堪" show-overflow-tooltip="" /> <el-table-column label="淇敼璁板綍" width="80" align="center" show-overflow-tooltip> <template #default="scope"> <ModifyRecord :data="scope.row" /> </template> </el-table-column> - <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('wcsDevice:update') || auth('wcsDevice:delete')"> + <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right" show-overflow-tooltip="" + v-if="auth('wcsDevice:update') || auth('wcsDevice:delete')"> <template #default="scope"> - <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsDevice(scope.row)" v-auth="'wcsDevice:update'"> 缂栬緫 </el-button> - <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsDevice(scope.row)" v-auth="'wcsDevice:delete'"> 鍒犻櫎 </el-button> + <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsDevice(scope.row)" + v-auth="'wcsDevice:update'"> 缂栬緫 </el-button> + <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsDevice(scope.row)" + v-auth="'wcsDevice:delete'"> 鍒犻櫎 </el-button> </template> </el-table-column> </el-table> - <el-pagination - v-model:currentPage="tableParams.page" - v-model:page-size="tableParams.pageSize" - :total="tableParams.total" - :page-sizes="[10, 20, 50, 100, 200, 500]" - size="small" - background="" - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - layout="total, sizes, prev, pager, next, jumper" - /> - <printDialog - ref="printDialogRef" - :title="printWcsDeviceTitle" - @reloadTable="handleQuery" /> - <editDialog - ref="editDialogRef" - :title="editWcsDeviceTitle" - @reloadTable="handleQuery" - /> + <el-pagination v-model:currentPage="tableParams.page" v-model:page-size="tableParams.pageSize" + :total="tableParams.total" :page-sizes="[10, 20, 50, 100, 200, 500]" size="small" background="" + @size-change="handleSizeChange" @current-change="handleCurrentChange" + layout="total, sizes, prev, pager, next, jumper" /> + <printDialog ref="printDialogRef" :title="printWcsDeviceTitle" @reloadTable="handleQuery" /> + <editDialog ref="editDialogRef" :title="editWcsDeviceTitle" @reloadTable="handleQuery" /> </el-card> </div> </template> <script lang="ts" setup="" name="wcsDevice"> - import { ref } from "vue"; - import { ElMessageBox, ElMessage } from "element-plus"; - import { auth } from '/@/utils/authFunction'; +import { ref } from "vue"; +import { ElMessageBox, ElMessage } from "element-plus"; +import { auth } from '/@/utils/authFunction'; - import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; - import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; - import { formatDate } from '/@/utils/formatTime'; +import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; +import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; +import { formatDate } from '/@/utils/formatTime'; - import ModifyRecord from '/@/components/table/modifyRecord.vue'; +import ModifyRecord from '/@/components/table/modifyRecord.vue'; - import printDialog from '/@/views/system/print/component/hiprint/preview.vue' - import editDialog from '/@/views/wcs/wcsDevice/component/editDialog.vue' - import { pageWcsDevice, deleteWcsDevice } from '/@/api/wcs/wcsDevice'; - import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice'; +import printDialog from '/@/views/system/print/component/hiprint/preview.vue' +import editDialog from '/@/views/wcs/wcsDevice/component/editDialog.vue' +import { pageWcsDevice, deleteWcsDevice } from '/@/api/wcs/wcsDevice'; +import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice'; - const showAdvanceQueryUI = ref(false); - const printDialogRef = ref(); - const editDialogRef = ref(); - const loading = ref(false); - const tableData = ref<any>([]); - const queryParams = ref<any>({}); - const tableParams = ref({ - page: 1, - pageSize: 10, - total: 0, - }); +const showAdvanceQueryUI = ref(false); +const printDialogRef = ref(); +const editDialogRef = ref(); +const loading = ref(false); +const tableData = ref<any>([]); +const queryParams = ref<any>({}); +const tableParams = ref({ + page: 1, + pageSize: 10, + total: 0, +}); - const printWcsDeviceTitle = ref(""); - const editWcsDeviceTitle = ref(""); +const printWcsDeviceTitle = ref(""); +const editWcsDeviceTitle = ref(""); - // 鏀瑰彉楂樼骇鏌ヨ鐨勬帶浠舵樉绀虹姸鎬� - const changeAdvanceQueryUI = () => { - showAdvanceQueryUI.value = !showAdvanceQueryUI.value; - } +// 鏀瑰彉楂樼骇鏌ヨ鐨勬帶浠舵樉绀虹姸鎬� +const changeAdvanceQueryUI = () => { + showAdvanceQueryUI.value = !showAdvanceQueryUI.value; +} - // 鏌ヨ鎿嶄綔 - const handleQuery = async () => { - loading.value = true; - var res = await pageWcsDevice(Object.assign(queryParams.value, tableParams.value)); - tableData.value = res.data.result?.items ?? []; - tableParams.value.total = res.data.result?.total; - loading.value = false; - }; +// 鏌ヨ鎿嶄綔 +const handleQuery = async () => { + loading.value = true; + var res = await pageWcsDevice(Object.assign(queryParams.value, tableParams.value)); + tableData.value = res.data.result?.items ?? []; + tableParams.value.total = res.data.result?.total; + loading.value = false; +}; - // 鍒楁帓搴� - const sortChange = async (column: any) => { - queryParams.value.field = column.prop; - queryParams.value.order = column.order; - await handleQuery(); - }; +// 鍒楁帓搴� +const sortChange = async (column: any) => { + queryParams.value.field = column.prop; + queryParams.value.order = column.order; + await handleQuery(); +}; - // 鎵撳紑鏂板椤甸潰 - const openAddWcsDevice = () => { - editWcsDeviceTitle.value = '娣诲姞璁惧淇℃伅'; - editDialogRef.value.openDialog({}); - }; +// 鎵撳紑鏂板椤甸潰 +const openAddWcsDevice = () => { + editWcsDeviceTitle.value = '娣诲姞璁惧淇℃伅'; + editDialogRef.value.openDialog({}); +}; - // 鎵撳紑鎵撳嵃椤甸潰 - const openPrintWcsDevice = async (row: any) => { - printWcsDeviceTitle.value = '鎵撳嵃璁惧淇℃伅'; - } - - // 鎵撳紑缂栬緫椤甸潰 - const openEditWcsDevice = (row: any) => { - editWcsDeviceTitle.value = '缂栬緫璁惧淇℃伅'; - editDialogRef.value.openDialog(row); - }; +// 鎵撳紑鎵撳嵃椤甸潰 +const openPrintWcsDevice = async (row: any) => { + printWcsDeviceTitle.value = '鎵撳嵃璁惧淇℃伅'; +} - // 鍒犻櫎 - const delWcsDevice = (row: any) => { - ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ悧?`, "鎻愮ず", { +// 鎵撳紑缂栬緫椤甸潰 +const openEditWcsDevice = (row: any) => { + editWcsDeviceTitle.value = '缂栬緫璁惧淇℃伅'; + editDialogRef.value.openDialog(row); +}; + +// 鍒犻櫎 +const delWcsDevice = (row: any) => { + ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ悧?`, "鎻愮ず", { confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning", }) - .then(async () => { - await deleteWcsDevice(row); - handleQuery(); - ElMessage.success("鍒犻櫎鎴愬姛"); - }) - .catch(() => {}); - }; + .then(async () => { + await deleteWcsDevice(row); + handleQuery(); + ElMessage.success("鍒犻櫎鎴愬姛"); + }) + .catch(() => { }); +}; - // 鏀瑰彉椤甸潰瀹归噺 - const handleSizeChange = (val: number) => { - tableParams.value.pageSize = val; - handleQuery(); - }; - - // 鏀瑰彉椤电爜搴忓彿 - const handleCurrentChange = (val: number) => { - tableParams.value.page = val; - handleQuery(); - }; - - const wcsPlcPlcIdDropdownList = ref<any>([]); - const getWcsPlcPlcIdDropdownList = async () => { - let list = await getWcsPlcPlcIdDropdown(); - wcsPlcPlcIdDropdownList.value = list.data.result ?? []; - }; - getWcsPlcPlcIdDropdownList(); - +// 鏀瑰彉椤甸潰瀹归噺 +const handleSizeChange = (val: number) => { + tableParams.value.pageSize = val; handleQuery(); +}; + +// 鏀瑰彉椤电爜搴忓彿 +const handleCurrentChange = (val: number) => { + tableParams.value.page = val; + handleQuery(); +}; + +const wcsPlcPlcIdDropdownList = ref<any>([]); +const getWcsPlcPlcIdDropdownList = async () => { + let list = await getWcsPlcPlcIdDropdown(); + wcsPlcPlcIdDropdownList.value = list.data.result ?? []; +}; +getWcsPlcPlcIdDropdownList(); + +handleQuery(); </script> <style scoped> :deep(.el-input), :deep(.el-select), :deep(.el-input-number) { - width: 100%; + width: 100%; } </style> - diff --git a/Web/src/views/wcs/wcsPlc/component/editDialog.vue b/Web/src/views/wcs/wcsPlc/component/editDialog.vue index 64cb9f5..ed2acbf 100644 --- a/Web/src/views/wcs/wcsPlc/component/editDialog.vue +++ b/Web/src/views/wcs/wcsPlc/component/editDialog.vue @@ -14,34 +14,51 @@ </el-form-item> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="PLCIP鍦板潃" prop="ip"> - <el-input v-model="ruleForm.ip" placeholder="璇疯緭鍏LCIP鍦板潃" maxlength="20" show-word-limit clearable /> - + <el-input v-model="ruleForm.ip" placeholder="璇疯緭鍏LCIP鍦板潃" maxlength="20" show-word-limit + clearable /> + </el-form-item> - + + </el-col> + <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> + <el-form-item label="PLC绫诲瀷" prop="plcType"> + <el-select clearable v-model="ruleForm.plcType" placeholder="璇烽�夋嫨PLC绫诲瀷"> + <el-option v-for="(item, index) in dl('PLCEnum')" :key="index" + :value="Number(item.value)" + :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> + + </el-select> + + </el-form-item> + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="璁惧绫诲瀷" prop="type"> <el-select clearable v-model="ruleForm.type" placeholder="璇烽�夋嫨璁惧绫诲瀷"> - <el-option v-for="(item,index) in dl('PLCTypeEnum')" :key="index" :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> - + <el-option v-for="(item, index) in dl('PLCTypeEnum')" :key="index" + :value="Number(item.value)" + :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> + </el-select> - + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="浠撳簱鍙�" prop="wareHouseNo"> - <el-input v-model="ruleForm.wareHouseNo" placeholder="璇疯緭鍏ヤ粨搴撳彿" maxlength="20" show-word-limit clearable /> - + <el-input v-model="ruleForm.wareHouseNo" placeholder="璇疯緭鍏ヤ粨搴撳彿" maxlength="20" show-word-limit + clearable /> + </el-form-item> - + </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="鎻忚堪" prop="text"> - <el-input v-model="ruleForm.text" placeholder="璇疯緭鍏ユ弿杩�" maxlength="100" show-word-limit clearable /> - + <el-input v-model="ruleForm.text" placeholder="璇疯緭鍏ユ弿杩�" maxlength="100" show-word-limit + clearable /> + </el-form-item> - + </el-col> </el-row> </el-form> @@ -61,89 +78,85 @@ } </style> <script lang="ts" setup> - import { ref,onMounted } from "vue"; - import { ElMessage } from "element-plus"; - import type { FormRules } from "element-plus"; - import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; - import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; - import { addWcsPlc, updateWcsPlc, detailWcsPlc } from "/@/api/wcs/wcsPlc"; - import { getAPI } from '/@/utils/axios-utils'; - import { SysEnumApi } from '/@/api-services/api'; +import { ref, onMounted } from "vue"; +import { ElMessage } from "element-plus"; +import type { FormRules } from "element-plus"; +import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; +import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; +import { addWcsPlc, updateWcsPlc, detailWcsPlc } from "/@/api/wcs/wcsPlc"; +import { getAPI } from '/@/utils/axios-utils'; +import { SysEnumApi } from '/@/api-services/api'; - //鐖剁骇浼犻�掓潵鐨勫弬鏁� - var props = defineProps({ - title: { +//鐖剁骇浼犻�掓潵鐨勫弬鏁� +var props = defineProps({ + title: { type: String, default: "", }, - }); - //鐖剁骇浼犻�掓潵鐨勫嚱鏁帮紝鐢ㄤ簬鍥炶皟 - const emit = defineEmits(["reloadTable"]); - const ruleFormRef = ref(); - const isShowDialog = ref(false); - const ruleForm = ref<any>({}); - //鑷娣诲姞鍏朵粬瑙勫垯 - const rules = ref<FormRules>({ - iP: [{required: true, message: '璇疯緭鍏LCIP鍦板潃锛�', trigger: 'blur',},], - }); +}); +//鐖剁骇浼犻�掓潵鐨勫嚱鏁帮紝鐢ㄤ簬鍥炶皟 +const emit = defineEmits(["reloadTable"]); +const ruleFormRef = ref(); +const isShowDialog = ref(false); +const ruleForm = ref<any>({}); +//鑷娣诲姞鍏朵粬瑙勫垯 +const rules = ref<FormRules>({ + iP: [{ required: true, message: '璇疯緭鍏LCIP鍦板潃锛�', trigger: 'blur', },], +}); - // 椤甸潰鍔犺浇鏃� - onMounted(() => { +// 椤甸潰鍔犺浇鏃� +onMounted(() => { - }); +}); - // 鎵撳紑寮圭獥 - const openDialog = async (row: any) => { - // ruleForm.value = JSON.parse(JSON.stringify(row)); - // 鏀圭敤detail鑾峰彇鏈�鏂版暟鎹潵缂栬緫 - let rowData = JSON.parse(JSON.stringify(row)); - if (rowData.id) - ruleForm.value = (await detailWcsPlc(rowData.id)).data.result; - else - ruleForm.value = rowData; - isShowDialog.value = true; - }; +// 鎵撳紑寮圭獥 +const openDialog = async (row: any) => { + // ruleForm.value = JSON.parse(JSON.stringify(row)); + // 鏀圭敤detail鑾峰彇鏈�鏂版暟鎹潵缂栬緫 + let rowData = JSON.parse(JSON.stringify(row)); + if (rowData.id) + ruleForm.value = (await detailWcsPlc(rowData.id)).data.result; + else + ruleForm.value = rowData; + isShowDialog.value = true; +}; - // 鍏抽棴寮圭獥 - const closeDialog = () => { - emit("reloadTable"); - isShowDialog.value = false; - }; +// 鍏抽棴寮圭獥 +const closeDialog = () => { + emit("reloadTable"); + isShowDialog.value = false; +}; - // 鍙栨秷 - const cancel = () => { - isShowDialog.value = false; - }; +// 鍙栨秷 +const cancel = () => { + isShowDialog.value = false; +}; - // 鎻愪氦 - const submit = async () => { - ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => { - if (isValid) { - let values = ruleForm.value; - if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) { - await addWcsPlc(values); - } else { - await updateWcsPlc(values); - } - closeDialog(); +// 鎻愪氦 +const submit = async () => { + ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => { + if (isValid) { + let values = ruleForm.value; + if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) { + await addWcsPlc(values); } else { - ElMessage({ - message: `琛ㄥ崟鏈�${Object.keys(fields).length}澶勯獙璇佸け璐ワ紝璇蜂慨鏀瑰悗鍐嶆彁浜, - type: "error", - }); + await updateWcsPlc(values); } - }); - }; + closeDialog(); + } else { + ElMessage({ + message: `琛ㄥ崟鏈�${Object.keys(fields).length}澶勯獙璇佸け璐ワ紝璇蜂慨鏀瑰悗鍐嶆彁浜, + type: "error", + }); + } + }); +}; - //灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠� - defineExpose({ openDialog }); +//灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠� +defineExpose({ openDialog }); </script> - - - - diff --git a/Web/src/views/wcs/wcsPlc/index.vue b/Web/src/views/wcs/wcsPlc/index.vue index 9de7109..1ef2c39 100644 --- a/Web/src/views/wcs/wcsPlc/index.vue +++ b/Web/src/views/wcs/wcsPlc/index.vue @@ -1,203 +1,206 @@ 锘�<template> <div class="wcsPlc-container"> - <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> + <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> <el-form :model="queryParams" ref="queryForm" labelWidth="90"> <el-row> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> <el-form-item label="鍏抽敭瀛�"> - <el-input v-model="queryParams.searchKey" clearable="" placeholder="璇疯緭鍏ユā绯婃煡璇㈠叧閿瓧"/> - + <el-input v-model="queryParams.searchKey" clearable="" placeholder="璇疯緭鍏ユā绯婃煡璇㈠叧閿瓧" /> + </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-form-item label="PLCIP鍦板潃"> - <el-input v-model="queryParams.ip" clearable="" placeholder="璇疯緭鍏LCIP鍦板潃"/> - + <el-input v-model="queryParams.ip" clearable="" placeholder="璇疯緭鍏LCIP鍦板潃" /> + + </el-form-item> + </el-col> + <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> + <el-form-item label="PLC绫诲瀷"> + <el-select clearable="" v-model="queryParams.plcType" placeholder="璇烽�夋嫨PLC绫诲瀷"> + <el-option v-for="(item, index) in dl('PLCEnum')" :key="index" :value="item.value" + :label="`${item.name} (${item.code}) [${item.value}] `" /> + + </el-select> + </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> <el-form-item label="璁惧绫诲瀷"> <el-select clearable="" v-model="queryParams.type" placeholder="璇烽�夋嫨璁惧绫诲瀷"> - <el-option v-for="(item,index) in dl('PLCTypeEnum')" :key="index" :value="item.value" :label="`${item.name} (${item.code}) [${item.value}] `" /> - + <el-option v-for="(item, index) in dl('PLCTypeEnum')" :key="index" :value="item.value" + :label="`${item.name} (${item.code}) [${item.value}] `" /> + </el-select> - + </el-form-item> </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> - <el-form-item > + <el-form-item> <el-button-group style="display: flex; align-items: center;"> - <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'wcsPlc:page'"> 鏌ヨ </el-button> - <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 閲嶇疆 </el-button> - <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> 楂樼骇鏌ヨ </el-button> - <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> 闅愯棌 </el-button> - <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsPlc" v-auth="'wcsPlc:add'"> 鏂板 </el-button> - + <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'wcsPlc:page'"> 鏌ヨ </el-button> + <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 閲嶇疆 </el-button> + <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" + style="margin-left:5px;"> 楂樼骇鏌ヨ </el-button> + <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" + style="margin-left:5px;"> 闅愯棌 </el-button> + <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsPlc" + v-auth="'wcsPlc:add'"> 鏂板 </el-button> + </el-button-group> </el-form-item> - + </el-col> </el-row> </el-form> </el-card> <el-card class="full-table" shadow="hover" style="margin-top: 5px"> - <el-table - :data="tableData" - style="width: 100%" - v-loading="loading" - tooltip-effect="light" - row-key="id" - @sort-change="sortChange" - border=""> - <el-table-column type="index" label="搴忓彿" width="55" align="center"/> - <el-table-column prop="ip" label="PLCIP鍦板潃" show-overflow-tooltip="" /> - <el-table-column prop="type" label="璁惧绫诲瀷" show-overflow-tooltip="" > - <template #default="scope"> - <el-tag :type="dv('PLCTypeEnum', scope.row.type)?.tagType"> {{dv('PLCTypeEnum', scope.row.type)?.name}}</el-tag> - </template> - </el-table-column> - <el-table-column prop="wareHouseNo" label="浠撳簱鍙�" show-overflow-tooltip="" /> - <el-table-column prop="text" label="鎻忚堪" show-overflow-tooltip="" /> + <el-table :data="tableData" style="width: 100%" v-loading="loading" tooltip-effect="light" row-key="id" + @sort-change="sortChange" border=""> + <el-table-column type="index" label="搴忓彿" width="55" align="center" /> + <el-table-column prop="ip" label="PLCIP鍦板潃" show-overflow-tooltip="" /> + <el-table-column prop="plcType" label="PLC绫诲瀷" show-overflow-tooltip=""> + <template #default="scope"> + <el-tag :type="dv('PLCEnum', scope.row.plcType)?.tagType"> {{ dv('PLCEnum', + scope.row.plcType)?.name}}</el-tag> + </template> + </el-table-column> + <el-table-column prop="type" label="璁惧绫诲瀷" show-overflow-tooltip=""> + <template #default="scope"> + <el-tag :type="dv('PLCTypeEnum', scope.row.type)?.tagType"> {{ dv('PLCTypeEnum', + scope.row.type)?.name }}</el-tag> + </template> + </el-table-column> + <el-table-column prop="wareHouseNo" label="浠撳簱鍙�" show-overflow-tooltip="" /> + <el-table-column prop="text" label="鎻忚堪" show-overflow-tooltip="" /> <el-table-column label="淇敼璁板綍" width="80" align="center" show-overflow-tooltip> <template #default="scope"> <ModifyRecord :data="scope.row" /> </template> </el-table-column> - <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('wcsPlc:update') || auth('wcsPlc:delete')"> + <el-table-column label="鎿嶄綔" width="140" align="center" fixed="right" show-overflow-tooltip="" + v-if="auth('wcsPlc:update') || auth('wcsPlc:delete')"> <template #default="scope"> - <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsPlc(scope.row)" v-auth="'wcsPlc:update'"> 缂栬緫 </el-button> - <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsPlc(scope.row)" v-auth="'wcsPlc:delete'"> 鍒犻櫎 </el-button> + <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsPlc(scope.row)" + v-auth="'wcsPlc:update'"> 缂栬緫 </el-button> + <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsPlc(scope.row)" + v-auth="'wcsPlc:delete'"> 鍒犻櫎 </el-button> </template> </el-table-column> </el-table> - <el-pagination - v-model:currentPage="tableParams.page" - v-model:page-size="tableParams.pageSize" - :total="tableParams.total" - :page-sizes="[10, 20, 50, 100, 200, 500]" - size="small" - background="" - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - layout="total, sizes, prev, pager, next, jumper" - /> - <printDialog - ref="printDialogRef" - :title="printWcsPlcTitle" - @reloadTable="handleQuery" /> - <editDialog - ref="editDialogRef" - :title="editWcsPlcTitle" - @reloadTable="handleQuery" - /> + <el-pagination v-model:currentPage="tableParams.page" v-model:page-size="tableParams.pageSize" + :total="tableParams.total" :page-sizes="[10, 20, 50, 100, 200, 500]" size="small" background="" + @size-change="handleSizeChange" @current-change="handleCurrentChange" + layout="total, sizes, prev, pager, next, jumper" /> + <printDialog ref="printDialogRef" :title="printWcsPlcTitle" @reloadTable="handleQuery" /> + <editDialog ref="editDialogRef" :title="editWcsPlcTitle" @reloadTable="handleQuery" /> </el-card> </div> </template> <script lang="ts" setup="" name="wcsPlc"> - import { ref } from "vue"; - import { ElMessageBox, ElMessage } from "element-plus"; - import { auth } from '/@/utils/authFunction'; +import { ref } from "vue"; +import { ElMessageBox, ElMessage } from "element-plus"; +import { auth } from '/@/utils/authFunction'; - import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; - import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; +import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; +import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; - import ModifyRecord from '/@/components/table/modifyRecord.vue'; +import ModifyRecord from '/@/components/table/modifyRecord.vue'; - import printDialog from '/@/views/system/print/component/hiprint/preview.vue' - import editDialog from '/@/views/wcs/wcsPlc/component/editDialog.vue' - import { pageWcsPlc, deleteWcsPlc } from '/@/api/wcs/wcsPlc'; - import { getAPI } from '/@/utils/axios-utils'; - import { SysEnumApi } from '/@/api-services/api'; - import commonFunction from '/@/utils/commonFunction'; +import printDialog from '/@/views/system/print/component/hiprint/preview.vue' +import editDialog from '/@/views/wcs/wcsPlc/component/editDialog.vue' +import { pageWcsPlc, deleteWcsPlc } from '/@/api/wcs/wcsPlc'; +import { getAPI } from '/@/utils/axios-utils'; +import { SysEnumApi } from '/@/api-services/api'; +import commonFunction from '/@/utils/commonFunction'; - const showAdvanceQueryUI = ref(false); - const printDialogRef = ref(); - const editDialogRef = ref(); - const loading = ref(false); - const tableData = ref<any>([]); - const queryParams = ref<any>({}); - const tableParams = ref({ - page: 1, - pageSize: 10, - total: 0, - }); +const showAdvanceQueryUI = ref(false); +const printDialogRef = ref(); +const editDialogRef = ref(); +const loading = ref(false); +const tableData = ref<any>([]); +const queryParams = ref<any>({}); +const tableParams = ref({ + page: 1, + pageSize: 10, + total: 0, +}); - const printWcsPlcTitle = ref(""); - const editWcsPlcTitle = ref(""); +const printWcsPlcTitle = ref(""); +const editWcsPlcTitle = ref(""); - // 鏀瑰彉楂樼骇鏌ヨ鐨勬帶浠舵樉绀虹姸鎬� - const changeAdvanceQueryUI = () => { - showAdvanceQueryUI.value = !showAdvanceQueryUI.value; - } +// 鏀瑰彉楂樼骇鏌ヨ鐨勬帶浠舵樉绀虹姸鎬� +const changeAdvanceQueryUI = () => { + showAdvanceQueryUI.value = !showAdvanceQueryUI.value; +} - // 鏌ヨ鎿嶄綔 - const handleQuery = async () => { - loading.value = true; - var res = await pageWcsPlc(Object.assign(queryParams.value, tableParams.value)); - tableData.value = res.data.result?.items ?? []; - tableParams.value.total = res.data.result?.total; - loading.value = false; - }; +// 鏌ヨ鎿嶄綔 +const handleQuery = async () => { + loading.value = true; + var res = await pageWcsPlc(Object.assign(queryParams.value, tableParams.value)); + tableData.value = res.data.result?.items ?? []; + tableParams.value.total = res.data.result?.total; + loading.value = false; +}; - // 鍒楁帓搴� - const sortChange = async (column: any) => { - queryParams.value.field = column.prop; - queryParams.value.order = column.order; - await handleQuery(); - }; +// 鍒楁帓搴� +const sortChange = async (column: any) => { + queryParams.value.field = column.prop; + queryParams.value.order = column.order; + await handleQuery(); +}; - // 鎵撳紑鏂板椤甸潰 - const openAddWcsPlc = () => { - editWcsPlcTitle.value = '娣诲姞PLC'; - editDialogRef.value.openDialog({}); - }; +// 鎵撳紑鏂板椤甸潰 +const openAddWcsPlc = () => { + editWcsPlcTitle.value = '娣诲姞PLC'; + editDialogRef.value.openDialog({}); +}; - // 鎵撳紑鎵撳嵃椤甸潰 - const openPrintWcsPlc = async (row: any) => { - printWcsPlcTitle.value = '鎵撳嵃PLC'; - } - - // 鎵撳紑缂栬緫椤甸潰 - const openEditWcsPlc = (row: any) => { - editWcsPlcTitle.value = '缂栬緫PLC'; - editDialogRef.value.openDialog(row); - }; +// 鎵撳紑鎵撳嵃椤甸潰 +const openPrintWcsPlc = async (row: any) => { + printWcsPlcTitle.value = '鎵撳嵃PLC'; +} - // 鍒犻櫎 - const delWcsPlc = (row: any) => { - ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ悧?`, "鎻愮ず", { +// 鎵撳紑缂栬緫椤甸潰 +const openEditWcsPlc = (row: any) => { + editWcsPlcTitle.value = '缂栬緫PLC'; + editDialogRef.value.openDialog(row); +}; + +// 鍒犻櫎 +const delWcsPlc = (row: any) => { + ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ悧?`, "鎻愮ず", { confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning", }) - .then(async () => { - await deleteWcsPlc(row); - handleQuery(); - ElMessage.success("鍒犻櫎鎴愬姛"); - }) - .catch(() => {}); - }; + .then(async () => { + await deleteWcsPlc(row); + handleQuery(); + ElMessage.success("鍒犻櫎鎴愬姛"); + }) + .catch(() => { }); +}; - // 鏀瑰彉椤甸潰瀹归噺 - const handleSizeChange = (val: number) => { - tableParams.value.pageSize = val; - handleQuery(); - }; - - // 鏀瑰彉椤电爜搴忓彿 - const handleCurrentChange = (val: number) => { - tableParams.value.page = val; - handleQuery(); - }; - +// 鏀瑰彉椤甸潰瀹归噺 +const handleSizeChange = (val: number) => { + tableParams.value.pageSize = val; handleQuery(); +}; + +// 鏀瑰彉椤电爜搴忓彿 +const handleCurrentChange = (val: number) => { + tableParams.value.page = val; + handleQuery(); +}; + +handleQuery(); </script> <style scoped> :deep(.el-input), :deep(.el-select), :deep(.el-input-number) { - width: 100%; + width: 100%; } </style> - diff --git a/Web/src/views/wcs/wcsStation/component/editDialog.vue b/Web/src/views/wcs/wcsStation/component/editDialog.vue index f1b9c10..d82c3cc 100644 --- a/Web/src/views/wcs/wcsStation/component/editDialog.vue +++ b/Web/src/views/wcs/wcsStation/component/editDialog.vue @@ -38,7 +38,10 @@ </el-col> <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> <el-form-item label="娴佺▼瀛楃被鍨�" prop="posType"> - <el-input v-model="ruleForm.posType" placeholder="璇疯緭鍏ユ祦绋嬪瓧绫诲瀷" maxlength="10" show-word-limit clearable /> + <el-select clearable v-model="ruleForm.posType" placeholder="璇烽�夋嫨娴佺▼瀛楃被鍨�"> + <el-option v-for="(item,index) in dl('PLCDataTypeEnum')" :key="index" :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}]`"></el-option> + + </el-select> </el-form-item> @@ -80,7 +83,7 @@ import type { FormRules } from "element-plus"; import { addWcsStation, updateWcsStation, detailWcsStation } from "/@/api/wcs/wcsStation"; import { getWcsDeviceDeviceIdDropdown } from '/@/api/wcs/wcsStation'; - + import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils'; //鐖剁骇浼犻�掓潵鐨勫弬鏁� var props = defineProps({ title: { diff --git a/Web/src/views/wcs/wcsStation/index.vue b/Web/src/views/wcs/wcsStation/index.vue index dfc6ff1..a2e056e 100644 --- a/Web/src/views/wcs/wcsStation/index.vue +++ b/Web/src/views/wcs/wcsStation/index.vue @@ -57,8 +57,13 @@ </el-table-column> <el-table-column prop="stationNum" label="宸ヤ綅鍙�" show-overflow-tooltip="" /> - <el-table-column prop="plcPos" label="鍋忕Щ閲�" show-overflow-tooltip="" /> - <el-table-column prop="posType" label="娴佺▼瀛楃被鍨�" show-overflow-tooltip="" /> + <el-table-column prop="plcPos" label="鍋忕Щ閲�" show-overflow-tooltip="" /> <el-table-column prop="posType" + label="娴佺▼瀛楃被鍨�" show-overflow-tooltip=""> + <template #default="scope"> + <el-tag :type="dv('PLCDataTypeEnum', scope.row.posType)?.tagType"> {{ dv('PLCDataTypeEnum', + scope.row.posType)?.name}}</el-tag> + </template> + </el-table-column> <el-table-column prop="ledIP" label="鏄剧ず灞廼p鍦板潃" show-overflow-tooltip="" /> <el-table-column prop="text" label="鎻忚堪" show-overflow-tooltip="" /> <el-table-column label="淇敼璁板綍" width="80" align="center" show-overflow-tooltip> @@ -90,7 +95,7 @@ import { ref } from "vue"; import { ElMessageBox, ElMessage } from "element-plus"; import { auth } from '/@/utils/authFunction'; - +import { getDictLabelByVal as dv } from '/@/utils/dict-utils'; import ModifyRecord from '/@/components/table/modifyRecord.vue'; import printDialog from '/@/views/system/print/component/hiprint/preview.vue' -- Gitblit v1.8.0