From 7865b72aa43b2f24150f7c815f6dbcf2e8f2f283 Mon Sep 17 00:00:00 2001 From: hwh <332078369@qq.com> Date: 星期五, 16 八月 2024 16:32:20 +0800 Subject: [PATCH] 设备PLC --- Admin.NET/WCS.Application/Entity/WcsPlc.cs | 36 Admin.NET/WCS.Application/Service/WcsStation/WcsStationService.cs | 144 +++ Web/src/views/wcs/wcsPlc/index.vue | 203 ++++ Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs | 116 ++ Web/src/views/wcs/wcsStation/component/editDialog.vue | 166 +++ Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs | 118 ++ Web/src/views/wcs/wcsStation/index.vue | 196 ++++ Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs | 106 ++ Web/src/views/wcs/wcsPlc/component/editDialog.vue | 149 +++ Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs | 39 Admin.NET/WCS.Application/Entity/WcsplcStation.cs | 47 + Web/src/api/wcs/wcsplcStation.ts | 56 + Web/src/views/wcs/wcsDevice/component/editDialog.vue | 195 ++++ Web/src/api/wcs/wcsStation.ts | 56 + Admin.NET/WCS.Application/Entity/WcsDevice.cs | 65 + Admin.NET/WCS.Application/Configuration/Database.json | 2 Admin.NET/WCS.Application/Enum/PLCEnum.cs | 47 + Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs | 176 +++ Web/src/api/wcs/wcsDevice.ts | 56 + Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs | 41 Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs | 56 + Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs | 156 +++ Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs | 49 + Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs | 104 ++ Web/src/views/wcs/wcsDevice/index.vue | 220 ++++ Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs | 114 ++ Web/src/api/wcs/wcsPlc.ts | 50 + 27 files changed, 2,762 insertions(+), 1 deletions(-) diff --git a/Admin.NET/WCS.Application/Configuration/Database.json b/Admin.NET/WCS.Application/Configuration/Database.json index 7f1fb9f..ae5c372 100644 --- a/Admin.NET/WCS.Application/Configuration/Database.json +++ b/Admin.NET/WCS.Application/Configuration/Database.json @@ -2,7 +2,7 @@ // 璇︾粏鏁版嵁搴撻厤缃SqlSugar瀹樼綉锛堢涓�涓负榛樿搴擄級锛屾瀬鍔涙帹鑽� PostgreSQL 鏁版嵁搴� // 鏁版嵁搴撹繛鎺ュ瓧绗︿覆鍙傝�冨湴鍧�锛歨ttps://www.connectionstrings.com/ "DbConnection": { - "EnableConsoleSql": false, // 鍚敤鎺у埗鍙版墦鍗癝QL + "EnableConsoleSql": true, // 鍚敤鎺у埗鍙版墦鍗癝QL "ConnectionConfigs": [ { //"ConfigId": "1300000000001", // 榛樿搴撴爣璇�-绂佹淇敼 diff --git a/Admin.NET/WCS.Application/Entity/WcsDevice.cs b/Admin.NET/WCS.Application/Entity/WcsDevice.cs new file mode 100644 index 0000000..5d2b84c --- /dev/null +++ b/Admin.NET/WCS.Application/Entity/WcsDevice.cs @@ -0,0 +1,65 @@ +锘� +namespace WCS.Application; + +/// <summary> +/// 璁惧淇℃伅琛� +/// </summary> +[SugarTable("WCSPLCDevice","璁惧淇℃伅琛�")] +public class WcsDevice : EntityBaseData +{ + /// <summary> + /// PlcId + /// </summary> + [Required] + [SugarColumn(ColumnName = "PlcId", ColumnDescription = "PlcId")] + public long PlcId { get; set; } + + /// <summary> + /// 璁惧绾у埆 + /// </summary> + [SugarColumn(ColumnName = "Level", ColumnDescription = "璁惧绾у埆")] + public DeviceLevelEnum? Level { get; set; } + + /// <summary> + /// DB鍖哄煙 + /// </summary> + [SugarColumn(ColumnName = "DbNumber", ColumnDescription = "DB鍖哄煙", Length = 10)] + public string? DbNumber { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + [SugarColumn(ColumnName = "StationNum", ColumnDescription = "宸ヤ綅鍙�", Length = 4)] + public string? StationNum { get; set; } + + /// <summary> + /// PLC鍋忕Щ閲� + /// </summary> + [SugarColumn(ColumnName = "PlcPos", ColumnDescription = "PLC鍋忕Щ閲�", Length = 10)] + public string? PlcPos { get; set; } + + /// <summary> + /// WCS鍋忕Щ閲� + /// </summary> + [SugarColumn(ColumnName = "WcsPos", ColumnDescription = "WCS鍋忕Щ閲�", Length = 10)] + public string? WcsPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + [SugarColumn(ColumnName = "PosType", ColumnDescription = "娴佺▼瀛楃被鍨�", Length = 10)] + public string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + [SugarColumn(ColumnName = "LedIP", ColumnDescription = "鏄剧ず灞廼p鍦板潃", Length = 50)] + public string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + [SugarColumn(ColumnName = "Text", ColumnDescription = "鎻忚堪", Length = 20)] + public string? Text { get; set; } + +} diff --git a/Admin.NET/WCS.Application/Entity/WcsPlc.cs b/Admin.NET/WCS.Application/Entity/WcsPlc.cs new file mode 100644 index 0000000..e3a1519 --- /dev/null +++ b/Admin.NET/WCS.Application/Entity/WcsPlc.cs @@ -0,0 +1,36 @@ +锘� +namespace WCS.Application; + +/// <summary> +/// PLC琛� +/// </summary> +[SugarTable("WCSPLC","PLC琛�")] +public class WcsPlc : EntityBaseData +{ + /// <summary> + /// PLCIP鍦板潃 + /// </summary> + [Required] + [SugarColumn(ColumnName = "IP", ColumnDescription = "PLCIP鍦板潃", Length = 20)] + public string IP { get; set; } + + /// <summary> + /// 璁惧绫诲瀷 + /// </summary> + [Required] + [SugarColumn(ColumnName = "Type", ColumnDescription = "璁惧绫诲瀷")] + public PLCTypeEnum Type { get; set; } + + /// <summary> + /// 浠撳簱鍙� + /// </summary> + [SugarColumn(ColumnName = "WareHouseNo", ColumnDescription = "浠撳簱鍙�", Length = 20)] + public string? WareHouseNo { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + [SugarColumn(ColumnName = "Text", ColumnDescription = "鎻忚堪", Length = 100)] + public string? Text { get; set; } + +} diff --git a/Admin.NET/WCS.Application/Entity/WcsplcStation.cs b/Admin.NET/WCS.Application/Entity/WcsplcStation.cs new file mode 100644 index 0000000..d4e6c59 --- /dev/null +++ b/Admin.NET/WCS.Application/Entity/WcsplcStation.cs @@ -0,0 +1,47 @@ +锘� +namespace WCS.Application; + +/// <summary> +/// 宸ヤ綅瀵瑰簲鐨勬祦绋嬪瓧琛� +/// </summary> +[SugarTable("WCSPLCStation","宸ヤ綅瀵瑰簲鐨勬祦绋嬪瓧琛�")] +public class WcsStation : EntityBaseData +{ + /// <summary> + /// 璁惧ID + /// </summary> + [Required] + [SugarColumn(ColumnName = "DeviceId", ColumnDescription = "璁惧ID")] + public long DeviceId { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + [SugarColumn(ColumnName = "StationNum", ColumnDescription = "宸ヤ綅鍙�", Length = 4)] + public string? StationNum { get; set; } + + /// <summary> + /// 鍋忕Щ閲� + /// </summary> + [SugarColumn(ColumnName = "PlcPos", ColumnDescription = "鍋忕Щ閲�", Length = 32)] + public string? PlcPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + [SugarColumn(ColumnName = "PosType", ColumnDescription = "娴佺▼瀛楃被鍨�", Length = 10)] + public string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + [SugarColumn(ColumnName = "LedIP", ColumnDescription = "鏄剧ず灞廼p鍦板潃", Length = 50)] + public string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + [SugarColumn(ColumnName = "Text", ColumnDescription = "鎻忚堪", Length = 20)] + public string? Text { get; set; } + +} diff --git a/Admin.NET/WCS.Application/Enum/PLCEnum.cs b/Admin.NET/WCS.Application/Enum/PLCEnum.cs new file mode 100644 index 0000000..786fcbb --- /dev/null +++ b/Admin.NET/WCS.Application/Enum/PLCEnum.cs @@ -0,0 +1,47 @@ +锘� +namespace WCS.Application; +/// <summary> +/// PLC绫诲瀷鏋氫妇 +/// </summary> +[Description("PLC绫诲瀷鏋氫妇")] +public enum PLCTypeEnum +{ + /// <summary> + /// 鍫嗚泛鏈� + /// </summary> + [Description("鍫嗚泛鏈�")] + StackingMachine = 0, + /// <summary> + /// 杈撻�佺嚎 + /// </summary> + [Description("杈撻�佺嚎")] + ConveyorLine = 1, + /// <summary> + /// RGV灏忚溅 + /// </summary> + [Description("RGV灏忚溅")] + RGV = 2, + /// <summary> + /// 鍙犳媶鎵樻満 + /// </summary> + [Description("鍙犳媶鎵樻満")] + PalletMachine = 3, +} + +/// <summary> +/// 璁惧绾у埆鏋氫妇 +/// </summary> +[Description("璁惧绾у埆鏋氫妇")] +public enum DeviceLevelEnum +{ + /// <summary> + /// DB鍖哄煙绾у埆 + /// </summary> + [Description("DB鍖哄煙绾у埆")] + DB = 1, + /// <summary> + /// 宸ヤ綅绾у埆 + /// </summary> + [Description("宸ヤ綅绾у埆")] + Station = 2, +} \ 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 new file mode 100644 index 0000000..5766a55 --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs @@ -0,0 +1,114 @@ +锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� +// +// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� +// +// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� + +namespace WCS.Application; + + /// <summary> + /// 璁惧淇℃伅杈撳嚭鍙傛暟 + /// </summary> + public class WcsDeviceDto + { + /// <summary> + /// PlcId + /// </summary> + public string PlcIdIP { get; set; } + + /// <summary> + /// 涓婚敭Id + /// </summary> + public long Id { get; set; } + + /// <summary> + /// PlcId + /// </summary> + public long PlcId { get; set; } + + /// <summary> + /// 璁惧绾у埆 + /// </summary> + public DeviceLevelEnum Level { get; set; } + + /// <summary> + /// DB鍖哄煙 + /// </summary> + public string? DbNumber { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + public string? StationNum { get; set; } + + /// <summary> + /// PLC鍋忕Щ閲� + /// </summary> + public string? PlcPos { get; set; } + + /// <summary> + /// WCS鍋忕Щ閲� + /// </summary> + public string? WcsPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + public string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + public string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Text { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + public DateTime? CreateTime { get; set; } + + /// <summary> + /// 鏇存柊鏃堕棿 + /// </summary> + public DateTime? UpdateTime { get; set; } + + /// <summary> + /// 鍒涘缓鑰匢d + /// </summary> + public long? CreateUserId { get; set; } + + /// <summary> + /// 鍒涘缓鑰呭鍚� + /// </summary> + public string? CreateUserName { get; set; } + + /// <summary> + /// 淇敼鑰匢d + /// </summary> + public long? UpdateUserId { get; set; } + + /// <summary> + /// 淇敼鑰呭鍚� + /// </summary> + public string? UpdateUserName { get; set; } + + /// <summary> + /// 鍒涘缓鑰呴儴闂↖d + /// </summary> + public long? CreateOrgId { get; set; } + + /// <summary> + /// 鍒涘缓鑰呴儴闂ㄥ悕绉� + /// </summary> + public string? CreateOrgName { get; set; } + + /// <summary> + /// 杞垹闄� + /// </summary> + public bool IsDelete { get; set; } + + } diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs new file mode 100644 index 0000000..b20902b --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs @@ -0,0 +1,176 @@ +锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� +// +// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� +// +// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� + +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace WCS.Application; + + /// <summary> + /// 璁惧淇℃伅鍩虹杈撳叆鍙傛暟 + /// </summary> + public class WcsDeviceBaseInput + { + /// <summary> + /// PlcId + /// </summary> + public virtual long PlcId { get; set; } + + /// <summary> + /// 璁惧绾у埆 + /// </summary> + public virtual DeviceLevelEnum Level { get; set; } + + /// <summary> + /// DB鍖哄煙 + /// </summary> + public virtual string? DbNumber { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + public virtual string? StationNum { get; set; } + + /// <summary> + /// PLC鍋忕Щ閲� + /// </summary> + public virtual string? PlcPos { get; set; } + + /// <summary> + /// WCS鍋忕Щ閲� + /// </summary> + public virtual string? WcsPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + public virtual string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + public virtual string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public virtual string? Text { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + public virtual DateTime? CreateTime { get; set; } + + /// <summary> + /// 鏇存柊鏃堕棿 + /// </summary> + public virtual DateTime? UpdateTime { get; set; } + + /// <summary> + /// 鍒涘缓鑰匢d + /// </summary> + public virtual long? CreateUserId { get; set; } + + /// <summary> + /// 鍒涘缓鑰呭鍚� + /// </summary> + public virtual string? CreateUserName { get; set; } + + /// <summary> + /// 淇敼鑰匢d + /// </summary> + public virtual long? UpdateUserId { get; set; } + + /// <summary> + /// 淇敼鑰呭鍚� + /// </summary> + public virtual string? UpdateUserName { get; set; } + + /// <summary> + /// 鍒涘缓鑰呴儴闂↖d + /// </summary> + public virtual long? CreateOrgId { get; set; } + + /// <summary> + /// 鍒涘缓鑰呴儴闂ㄥ悕绉� + /// </summary> + public virtual string? CreateOrgName { get; set; } + + /// <summary> + /// 杞垹闄� + /// </summary> + public virtual bool IsDelete { get; set; } + + } + + /// <summary> + /// 璁惧淇℃伅鍒嗛〉鏌ヨ杈撳叆鍙傛暟 + /// </summary> + public class PageWcsDeviceInput : BasePageInput + { + /// <summary> + /// 鍏抽敭瀛楁煡璇� + /// </summary> + public string? SearchKey { get; set; } + + /// <summary> + /// PlcId + /// </summary> + public long? PlcId { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Text { get; set; } + + } + + /// <summary> + /// 璁惧淇℃伅澧炲姞杈撳叆鍙傛暟 + /// </summary> + public class AddWcsDeviceInput : WcsDeviceBaseInput + { + /// <summary> + /// PlcId + /// </summary> + [Required(ErrorMessage = "PlcId涓嶈兘涓虹┖")] + public override long PlcId { get; set; } + + /// <summary> + /// 杞垹闄� + /// </summary> + [Required(ErrorMessage = "杞垹闄や笉鑳戒负绌�")] + public override bool IsDelete { get; set; } + + } + + /// <summary> + /// 璁惧淇℃伅鍒犻櫎杈撳叆鍙傛暟 + /// </summary> + public class DeleteWcsDeviceInput : BaseIdInput + { + } + + /// <summary> + /// 璁惧淇℃伅鏇存柊杈撳叆鍙傛暟 + /// </summary> + public class UpdateWcsDeviceInput : WcsDeviceBaseInput + { + /// <summary> + /// 涓婚敭Id + /// </summary> + [Required(ErrorMessage = "涓婚敭Id涓嶈兘涓虹┖")] + public long Id { get; set; } + + } + + /// <summary> + /// 璁惧淇℃伅涓婚敭鏌ヨ杈撳叆鍙傛暟 + /// </summary> + public class QueryByIdWcsDeviceInput : DeleteWcsDeviceInput + { + + } diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs new file mode 100644 index 0000000..33dcd35 --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs @@ -0,0 +1,116 @@ +锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� +// +// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� +// +// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� + +namespace WCS.Application; + +/// <summary> +/// 璁惧淇℃伅杈撳嚭鍙傛暟 +/// </summary> +public class WcsDeviceOutput +{ + /// <summary> + /// 涓婚敭Id + /// </summary> + public long Id { get; set; } + + /// <summary> + /// PlcId + /// </summary> + public long PlcId { get; set; } + + /// <summary> + /// PlcId 鎻忚堪 + /// </summary> + public string PlcIdIP { get; set; } + + /// <summary> + /// 璁惧绾у埆 + /// </summary> + public DeviceLevelEnum Level { get; set; } + + /// <summary> + /// DB鍖哄煙 + /// </summary> + public string? DbNumber { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + public string? StationNum { get; set; } + + /// <summary> + /// PLC鍋忕Щ閲� + /// </summary> + public string? PlcPos { get; set; } + + /// <summary> + /// WCS鍋忕Щ閲� + /// </summary> + public string? WcsPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + public string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + public string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Text { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + public DateTime? CreateTime { get; set; } + + /// <summary> + /// 鏇存柊鏃堕棿 + /// </summary> + public DateTime? UpdateTime { get; set; } + + /// <summary> + /// 鍒涘缓鑰匢d + /// </summary> + public long? CreateUserId { get; set; } + + /// <summary> + /// 鍒涘缓鑰呭鍚� + /// </summary> + public string? CreateUserName { get; set; } + + /// <summary> + /// 淇敼鑰匢d + /// </summary> + public long? UpdateUserId { get; set; } + + /// <summary> + /// 淇敼鑰呭鍚� + /// </summary> + public string? UpdateUserName { get; set; } + + /// <summary> + /// 鍒涘缓鑰呴儴闂↖d + /// </summary> + public long? CreateOrgId { get; set; } + + /// <summary> + /// 鍒涘缓鑰呴儴闂ㄥ悕绉� + /// </summary> + public string? CreateOrgName { get; set; } + + /// <summary> + /// 杞垹闄� + /// </summary> + public bool IsDelete { get; set; } + + } + + diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs new file mode 100644 index 0000000..5d2c9ca --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs @@ -0,0 +1,156 @@ +锘� +namespace WCS.Application; + +/// <summary> +/// 璁惧淇℃伅鏈嶅姟 +/// </summary> +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class WcsDeviceService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository<WcsDevice> _wcsDeviceRep; + public WcsDeviceService(SqlSugarRepository<WcsDevice> wcsDeviceRep) + { + _wcsDeviceRep = wcsDeviceRep; + } + + /// <summary> + /// 鍒嗛〉鏌ヨ璁惧淇℃伅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + [DisplayName("鍒嗛〉鏌ヨ璁惧淇℃伅")] + public async Task<SqlSugarPagedList<WcsDeviceOutput>> Page(PageWcsDeviceInput input) + { + if (input.Field.IsNullOrEmpty()) + { + input.Field = "u.Id"; + input.Order = "desc"; + } + input.SearchKey = input.SearchKey?.Trim(); + var query = _wcsDeviceRep.AsQueryable() + .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u => + u.Text.Contains(input.SearchKey) + ) + .WhereIF(input.PlcId>0, u => u.PlcId == input.PlcId) + .WhereIF(!string.IsNullOrWhiteSpace(input.Text), u => u.Text.Contains(input.Text.Trim())) + //澶勭悊澶栭敭鍜孴reeSelector鐩稿叧瀛楁鐨勮繛鎺� + .LeftJoin<WcsPlc>((u, plcid) => u.PlcId == plcid.Id ) + .Select((u, plcid) => new WcsDeviceOutput + { + Id = u.Id, + PlcId = u.PlcId, + PlcIdIP = plcid.IP, + Level = (DeviceLevelEnum)u.Level, + DbNumber = u.DbNumber, + StationNum = u.StationNum, + PlcPos = u.PlcPos, + WcsPos = u.WcsPos, + PosType = u.PosType, + LedIP = u.LedIP, + Text = u.Text, + CreateTime = u.CreateTime, + UpdateTime = u.UpdateTime, + CreateUserId = u.CreateUserId, + CreateUserName = u.CreateUserName, + UpdateUserId = u.UpdateUserId, + UpdateUserName = u.UpdateUserName, + CreateOrgId = u.CreateOrgId, + CreateOrgName = u.CreateOrgName, + IsDelete = u.IsDelete, + }); + return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); + } + + /// <summary> + /// 澧炲姞璁惧淇℃伅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + [DisplayName("澧炲姞璁惧淇℃伅")] + public async Task<long> Add(AddWcsDeviceInput input) + { + var entity = input.Adapt<WcsDevice>(); + await _wcsDeviceRep.InsertAsync(entity); + return entity.Id; + } + + /// <summary> + /// 鍒犻櫎璁惧淇℃伅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Delete")] + [DisplayName("鍒犻櫎璁惧淇℃伅")] + public async Task Delete(DeleteWcsDeviceInput input) + { + var entity = await _wcsDeviceRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002); + await _wcsDeviceRep.FakeDeleteAsync(entity); //鍋囧垹闄� + //await _wcsDeviceRep.DeleteAsync(entity); //鐪熷垹闄� + } + + /// <summary> + /// 鏇存柊璁惧淇℃伅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + [DisplayName("鏇存柊璁惧淇℃伅")] + public async Task Update(UpdateWcsDeviceInput input) + { + var entity = input.Adapt<WcsDevice>(); + await _wcsDeviceRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// <summary> + /// 鑾峰彇璁惧淇℃伅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + [DisplayName("鑾峰彇璁惧淇℃伅")] + public async Task<WcsDevice> Detail([FromQuery] QueryByIdWcsDeviceInput input) + { + return await _wcsDeviceRep.GetFirstAsync(u => u.Id == input.Id); + } + + /// <summary> + /// 鑾峰彇璁惧淇℃伅鍒楄〃 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + [DisplayName("鑾峰彇璁惧淇℃伅鍒楄〃")] + public async Task<List<WcsDeviceOutput>> List([FromQuery] PageWcsDeviceInput input) + { + return await _wcsDeviceRep.AsQueryable().Select<WcsDeviceOutput>().ToListAsync(); + } + + /// <summary> + /// 鑾峰彇PlcId鍒楄〃 + /// </summary> + /// <returns></returns> + [ApiDescriptionSettings(Name = "WcsPlcPlcIdDropdown"), HttpGet] + [DisplayName("鑾峰彇PlcId鍒楄〃")] + public async Task<dynamic> WcsPlcPlcIdDropdown() + { + return await _wcsDeviceRep.Context.Queryable<WcsPlc>() + .Select(u => new + { + Label = u.IP, + Value = u.Id + } + ).ToListAsync(); + } + + + + +} diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs new file mode 100644 index 0000000..6be8c4c --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs @@ -0,0 +1,39 @@ +锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� +// +// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� +// +// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� + +namespace WCS.Application; + + /// <summary> + /// PLC杈撳嚭鍙傛暟 + /// </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; } + + } diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs new file mode 100644 index 0000000..70fbf15 --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs @@ -0,0 +1,106 @@ +锘�// 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> + /// 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; } + + } + + /// <summary> + /// 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; } + + } + + /// <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; } + + } + + /// <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 new file mode 100644 index 0000000..0b233cf --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs @@ -0,0 +1,41 @@ +锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� +// +// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� +// +// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� + +namespace WCS.Application; + +/// <summary> +/// PLC杈撳嚭鍙傛暟 +/// </summary> +public class WcsPlcOutput +{ + /// <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; } + + } + + diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs new file mode 100644 index 0000000..0b3cfec --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs @@ -0,0 +1,118 @@ +锘�// 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> +/// PLC鏈嶅姟 +/// </summary> +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class WcsPlcService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository<WcsPlc> _wcsPlcRep; + public WcsPlcService(SqlSugarRepository<WcsPlc> wcsPlcRep) + { + _wcsPlcRep = wcsPlcRep; + } + + /// <summary> + /// 鍒嗛〉鏌ヨPLC + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + [DisplayName("鍒嗛〉鏌ヨPLC")] + public async Task<SqlSugarPagedList<WcsPlcOutput>> Page(PageWcsPlcInput input) + { + input.SearchKey = input.SearchKey?.Trim(); + var query = _wcsPlcRep.AsQueryable() + .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u => + u.IP.Contains(input.SearchKey) + ) + .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); + } + + /// <summary> + /// 澧炲姞PLC + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + [DisplayName("澧炲姞PLC")] + public async Task<long> Add(AddWcsPlcInput input) + { + var entity = input.Adapt<WcsPlc>(); + await _wcsPlcRep.InsertAsync(entity); + return entity.Id; + } + + /// <summary> + /// 鍒犻櫎PLC + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Delete")] + [DisplayName("鍒犻櫎PLC")] + public async Task Delete(DeleteWcsPlcInput input) + { + var entity = await _wcsPlcRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002); + await _wcsPlcRep.FakeDeleteAsync(entity); //鍋囧垹闄� + //await _wcsPlcRep.DeleteAsync(entity); //鐪熷垹闄� + } + + /// <summary> + /// 鏇存柊PLC + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + [DisplayName("鏇存柊PLC")] + public async Task Update(UpdateWcsPlcInput input) + { + var entity = input.Adapt<WcsPlc>(); + await _wcsPlcRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// <summary> + /// 鑾峰彇PLC + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + [DisplayName("鑾峰彇PLC")] + public async Task<WcsPlc> Detail([FromQuery] QueryByIdWcsPlcInput input) + { + return await _wcsPlcRep.GetFirstAsync(u => u.Id == input.Id); + } + + /// <summary> + /// 鑾峰彇PLC鍒楄〃 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + [DisplayName("鑾峰彇PLC鍒楄〃")] + public async Task<List<WcsPlcOutput>> List([FromQuery] PageWcsPlcInput input) + { + return await _wcsPlcRep.AsQueryable().Select<WcsPlcOutput>().ToListAsync(); + } + + + + + +} diff --git a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs new file mode 100644 index 0000000..9343a37 --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs @@ -0,0 +1,49 @@ +锘� +namespace WCS.Application; + + /// <summary> + /// 璁惧宸ヤ綅杈撳嚭鍙傛暟 + /// </summary> + public class WcsStationDto + { + /// <summary> + /// 璁惧ID + /// </summary> + public string? DeviceIdText { get; set; } + + /// <summary> + /// 涓婚敭Id + /// </summary> + public long Id { get; set; } + + /// <summary> + /// 璁惧ID + /// </summary> + public long DeviceId { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + public string? StationNum { get; set; } + + /// <summary> + /// 鍋忕Щ閲� + /// </summary> + public string? PlcPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + public string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + public string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Text { get; set; } + + } diff --git a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs new file mode 100644 index 0000000..fd618ab --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs @@ -0,0 +1,104 @@ +锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� +// +// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� +// +// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� + +using Admin.NET.Core; +using System.ComponentModel.DataAnnotations; + +namespace WCS.Application; + + /// <summary> + /// 璁惧宸ヤ綅鍩虹杈撳叆鍙傛暟 + /// </summary> + public class WcsStationBaseInput + { + /// <summary> + /// 璁惧ID + /// </summary> + public virtual long DeviceId { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + public virtual string? StationNum { get; set; } + + /// <summary> + /// 鍋忕Щ閲� + /// </summary> + public virtual string? PlcPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + public virtual string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + public virtual string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public virtual string? Text { get; set; } + + } + + /// <summary> + /// 璁惧宸ヤ綅鍒嗛〉鏌ヨ杈撳叆鍙傛暟 + /// </summary> + public class PageWcsStationInput : BasePageInput + { + /// <summary> + /// 鍏抽敭瀛楁煡璇� + /// </summary> + public string? SearchKey { get; set; } + + /// <summary> + /// 璁惧ID + /// </summary> + public long DeviceId { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Text { get; set; } + + } + + /// <summary> + /// 璁惧宸ヤ綅澧炲姞杈撳叆鍙傛暟 + /// </summary> + public class AddWcsStationInput : WcsStationBaseInput + { + } + + /// <summary> + /// 璁惧宸ヤ綅鍒犻櫎杈撳叆鍙傛暟 + /// </summary> + public class DeleteWcsStationInput : BaseIdInput + { + } + + /// <summary> + /// 璁惧宸ヤ綅鏇存柊杈撳叆鍙傛暟 + /// </summary> + public class UpdateWcsStationInput : WcsStationBaseInput + { + /// <summary> + /// 涓婚敭Id + /// </summary> + [Required(ErrorMessage = "涓婚敭Id涓嶈兘涓虹┖")] + public long Id { get; set; } + + } + + /// <summary> + /// 璁惧宸ヤ綅涓婚敭鏌ヨ杈撳叆鍙傛暟 + /// </summary> + public class QueryByIdWcsStationInput : DeleteWcsStationInput + { + + } diff --git a/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs new file mode 100644 index 0000000..2a2de65 --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs @@ -0,0 +1,56 @@ +锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆� +// +// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆� +// +// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛� + +namespace WCS.Application; + +/// <summary> +/// 璁惧宸ヤ綅杈撳嚭鍙傛暟 +/// </summary> +public class WcsStationOutput +{ + /// <summary> + /// 涓婚敭Id + /// </summary> + public long Id { get; set; } + + /// <summary> + /// 璁惧ID + /// </summary> + public long DeviceId { get; set; } + + /// <summary> + /// 璁惧ID 鎻忚堪 + /// </summary> + public string? DeviceIdText { get; set; } + + /// <summary> + /// 宸ヤ綅鍙� + /// </summary> + public string? StationNum { get; set; } + + /// <summary> + /// 鍋忕Щ閲� + /// </summary> + public string? PlcPos { get; set; } + + /// <summary> + /// 娴佺▼瀛楃被鍨� + /// </summary> + public string? PosType { get; set; } + + /// <summary> + /// 鏄剧ず灞廼p鍦板潃 + /// </summary> + public string? LedIP { get; set; } + + /// <summary> + /// 鎻忚堪 + /// </summary> + public string? Text { get; set; } + + } + + diff --git a/Admin.NET/WCS.Application/Service/WcsStation/WcsStationService.cs b/Admin.NET/WCS.Application/Service/WcsStation/WcsStationService.cs new file mode 100644 index 0000000..8df0741 --- /dev/null +++ b/Admin.NET/WCS.Application/Service/WcsStation/WcsStationService.cs @@ -0,0 +1,144 @@ +锘� +namespace WCS.Application; + +/// <summary> +/// 璁惧宸ヤ綅鏈嶅姟 +/// </summary> +[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)] +public class WcsStationService : IDynamicApiController, ITransient +{ + private readonly SqlSugarRepository<WcsStation> _wcsStationRep; + public WcsStationService(SqlSugarRepository<WcsStation> wcsStationRep) + { + _wcsStationRep = wcsStationRep; + } + + /// <summary> + /// 鍒嗛〉鏌ヨ璁惧宸ヤ綅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Page")] + [DisplayName("鍒嗛〉鏌ヨ璁惧宸ヤ綅")] + public async Task<SqlSugarPagedList<WcsStationOutput>> Page(PageWcsStationInput input) + { + if (input.Field.IsNullOrEmpty()) + { + input.Field = "u.Id"; + input.Order = "desc"; + } + input.SearchKey = input.SearchKey?.Trim(); + var query = _wcsStationRep.AsQueryable() + .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u => + u.Text.Contains(input.SearchKey) + ) + .WhereIF(input.DeviceId>0, u => u.DeviceId == input.DeviceId) + .WhereIF(!string.IsNullOrWhiteSpace(input.Text), u => u.Text.Contains(input.Text.Trim())) + //澶勭悊澶栭敭鍜孴reeSelector鐩稿叧瀛楁鐨勮繛鎺� + .LeftJoin<WcsDevice>((u, deviceid) => u.DeviceId == deviceid.Id ) + .Select((u, deviceid) => new WcsStationOutput + { + Id = u.Id, + DeviceId = u.DeviceId, + DeviceIdText = deviceid.Text, + StationNum = u.StationNum, + PlcPos = u.PlcPos, + PosType = u.PosType, + LedIP = u.LedIP, + Text = u.Text, + }); + return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); + } + + /// <summary> + /// 澧炲姞璁惧宸ヤ綅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Add")] + [DisplayName("澧炲姞璁惧宸ヤ綅")] + public async Task<long> Add(AddWcsStationInput input) + { + var entity = input.Adapt<WcsStation>(); + await _wcsStationRep.InsertAsync(entity); + return entity.Id; + } + + /// <summary> + /// 鍒犻櫎璁惧宸ヤ綅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Delete")] + [DisplayName("鍒犻櫎璁惧宸ヤ綅")] + public async Task Delete(DeleteWcsStationInput input) + { + var entity = await _wcsStationRep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002); + await _wcsStationRep.FakeDeleteAsync(entity); //鍋囧垹闄� + //await _wcsStationRep.DeleteAsync(entity); //鐪熷垹闄� + } + + /// <summary> + /// 鏇存柊璁惧宸ヤ綅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "Update")] + [DisplayName("鏇存柊璁惧宸ヤ綅")] + public async Task Update(UpdateWcsStationInput input) + { + var entity = input.Adapt<WcsStation>(); + await _wcsStationRep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } + + /// <summary> + /// 鑾峰彇璁惧宸ヤ綅 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "Detail")] + [DisplayName("鑾峰彇璁惧宸ヤ綅")] + public async Task<WcsStation> Detail([FromQuery] QueryByIdWcsStationInput input) + { + return await _wcsStationRep.GetFirstAsync(u => u.Id == input.Id); + } + + /// <summary> + /// 鑾峰彇璁惧宸ヤ綅鍒楄〃 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpGet] + [ApiDescriptionSettings(Name = "List")] + [DisplayName("鑾峰彇璁惧宸ヤ綅鍒楄〃")] + public async Task<List<WcsStationOutput>> List([FromQuery] PageWcsStationInput input) + { + return await _wcsStationRep.AsQueryable().Select<WcsStationOutput>().ToListAsync(); + } + + /// <summary> + /// 鑾峰彇璁惧ID鍒楄〃 + /// </summary> + /// <returns></returns> + [ApiDescriptionSettings(Name = "WcsDeviceDeviceIdDropdown"), HttpGet] + [DisplayName("鑾峰彇璁惧ID鍒楄〃")] + public async Task<dynamic> WcsDeviceDeviceIdDropdown() + { + return await _wcsStationRep.Context.Queryable<WcsDevice>() + .Select(u => new + { + Label = u.Text, + Value = u.Id + } + ).ToListAsync(); + } + + + + +} diff --git a/Web/src/api/wcs/wcsDevice.ts b/Web/src/api/wcs/wcsDevice.ts new file mode 100644 index 0000000..985447f --- /dev/null +++ b/Web/src/api/wcs/wcsDevice.ts @@ -0,0 +1,56 @@ +锘縤mport request from '/@/utils/request'; +enum Api { + AddWcsDevice = '/api/wcsDevice/add', + DeleteWcsDevice = '/api/wcsDevice/delete', + UpdateWcsDevice = '/api/wcsDevice/update', + PageWcsDevice = '/api/wcsDevice/page', + DetailWcsDevice = '/api/wcsDevice/detail', + GetWcsPlcPlcIdDropdown = '/api/wcsDevice/WcsPlcPlcIdDropdown', +} + +// 澧炲姞璁惧淇℃伅 +export const addWcsDevice = (params?: any) => + request({ + url: Api.AddWcsDevice, + method: 'post', + data: params, + }); + +// 鍒犻櫎璁惧淇℃伅 +export const deleteWcsDevice = (params?: any) => + request({ + url: Api.DeleteWcsDevice, + method: 'post', + data: params, + }); + +// 缂栬緫璁惧淇℃伅 +export const updateWcsDevice = (params?: any) => + request({ + url: Api.UpdateWcsDevice, + method: 'post', + data: params, + }); + +// 鍒嗛〉鏌ヨ璁惧淇℃伅 +export const pageWcsDevice = (params?: any) => + request({ + url: Api.PageWcsDevice, + method: 'post', + data: params, + }); + +// 璇︽儏璁惧淇℃伅 +export const detailWcsDevice = (id: any) => + request({ + url: Api.DetailWcsDevice, + method: 'get', + data: { id }, + }); + +export const getWcsPlcPlcIdDropdown = () => + request({ + url: Api.GetWcsPlcPlcIdDropdown, + method: 'get' + }); + diff --git a/Web/src/api/wcs/wcsPlc.ts b/Web/src/api/wcs/wcsPlc.ts new file mode 100644 index 0000000..8b133f3 --- /dev/null +++ b/Web/src/api/wcs/wcsPlc.ts @@ -0,0 +1,50 @@ +锘縤mport request from '/@/utils/request'; +enum Api { + AddWcsPlc = '/api/wcsPlc/add', + DeleteWcsPlc = '/api/wcsPlc/delete', + UpdateWcsPlc = '/api/wcsPlc/update', + PageWcsPlc = '/api/wcsPlc/page', + DetailWcsPlc = '/api/wcsPlc/detail', +} + +// 澧炲姞PLC +export const addWcsPlc = (params?: any) => + request({ + url: Api.AddWcsPlc, + method: 'post', + data: params, + }); + +// 鍒犻櫎PLC +export const deleteWcsPlc = (params?: any) => + request({ + url: Api.DeleteWcsPlc, + method: 'post', + data: params, + }); + +// 缂栬緫PLC +export const updateWcsPlc = (params?: any) => + request({ + url: Api.UpdateWcsPlc, + method: 'post', + data: params, + }); + +// 鍒嗛〉鏌ヨPLC +export const pageWcsPlc = (params?: any) => + request({ + url: Api.PageWcsPlc, + method: 'post', + data: params, + }); + +// 璇︽儏PLC +export const detailWcsPlc = (id: any) => + request({ + url: Api.DetailWcsPlc, + method: 'get', + data: { id }, + }); + + diff --git a/Web/src/api/wcs/wcsStation.ts b/Web/src/api/wcs/wcsStation.ts new file mode 100644 index 0000000..71712ca --- /dev/null +++ b/Web/src/api/wcs/wcsStation.ts @@ -0,0 +1,56 @@ +锘縤mport request from '/@/utils/request'; +enum Api { + AddWcsStation = '/api/wcsStation/add', + DeleteWcsStation = '/api/wcsStation/delete', + UpdateWcsStation = '/api/wcsStation/update', + PageWcsStation = '/api/wcsStation/page', + DetailWcsStation = '/api/wcsStation/detail', + GetWcsDeviceDeviceIdDropdown = '/api/wcsStation/WcsDeviceDeviceIdDropdown', +} + +// 澧炲姞璁惧宸ヤ綅 +export const addWcsStation = (params?: any) => + request({ + url: Api.AddWcsStation, + method: 'post', + data: params, + }); + +// 鍒犻櫎璁惧宸ヤ綅 +export const deleteWcsStation = (params?: any) => + request({ + url: Api.DeleteWcsStation, + method: 'post', + data: params, + }); + +// 缂栬緫璁惧宸ヤ綅 +export const updateWcsStation = (params?: any) => + request({ + url: Api.UpdateWcsStation, + method: 'post', + data: params, + }); + +// 鍒嗛〉鏌ヨ璁惧宸ヤ綅 +export const pageWcsStation = (params?: any) => + request({ + url: Api.PageWcsStation, + method: 'post', + data: params, + }); + +// 璇︽儏璁惧宸ヤ綅 +export const detailWcsStation = (id: any) => + request({ + url: Api.DetailWcsStation, + method: 'get', + data: { id }, + }); + +export const getWcsDeviceDeviceIdDropdown = () => + request({ + url: Api.GetWcsDeviceDeviceIdDropdown, + method: 'get' + }); + diff --git a/Web/src/api/wcs/wcsplcStation.ts b/Web/src/api/wcs/wcsplcStation.ts new file mode 100644 index 0000000..88e9546 --- /dev/null +++ b/Web/src/api/wcs/wcsplcStation.ts @@ -0,0 +1,56 @@ +锘縤mport request from '/@/utils/request'; +enum Api { + AddWcsplcStation = '/api/wcsplcStation/add', + DeleteWcsplcStation = '/api/wcsplcStation/delete', + UpdateWcsplcStation = '/api/wcsplcStation/update', + PageWcsplcStation = '/api/wcsplcStation/page', + DetailWcsplcStation = '/api/wcsplcStation/detail', + GetWcsDeviceDeviceIdDropdown = '/api/wcsplcStation/WcsDeviceDeviceIdDropdown', +} + +// 澧炲姞璁惧宸ヤ綅 +export const addWcsplcStation = (params?: any) => + request({ + url: Api.AddWcsplcStation, + method: 'post', + data: params, + }); + +// 鍒犻櫎璁惧宸ヤ綅 +export const deleteWcsplcStation = (params?: any) => + request({ + url: Api.DeleteWcsplcStation, + method: 'post', + data: params, + }); + +// 缂栬緫璁惧宸ヤ綅 +export const updateWcsplcStation = (params?: any) => + request({ + url: Api.UpdateWcsplcStation, + method: 'post', + data: params, + }); + +// 鍒嗛〉鏌ヨ璁惧宸ヤ綅 +export const pageWcsplcStation = (params?: any) => + request({ + url: Api.PageWcsplcStation, + method: 'post', + data: params, + }); + +// 璇︽儏璁惧宸ヤ綅 +export const detailWcsplcStation = (id: any) => + request({ + url: Api.DetailWcsplcStation, + method: 'get', + data: { id }, + }); + +export const getWcsDeviceDeviceIdDropdown = () => + request({ + url: Api.GetWcsDeviceDeviceIdDropdown, + method: 'get' + }); + diff --git a/Web/src/views/wcs/wcsDevice/component/editDialog.vue b/Web/src/views/wcs/wcsDevice/component/editDialog.vue new file mode 100644 index 0000000..10396a3 --- /dev/null +++ b/Web/src/views/wcs/wcsDevice/component/editDialog.vue @@ -0,0 +1,195 @@ +锘�<template> + <div class="wcsDevice-container"> + <el-dialog v-model="isShowDialog" :width="800" draggable="" :close-on-click-modal="false"> + <template #header> + <div style="color: #fff"> + <!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>--> + <span>{{ props.title }}</span> + </div> + </template> + <el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules"> + <el-row :gutter="35"> + <el-form-item v-show="false"> + <el-input v-model="ruleForm.id" /> + </el-form-item> + <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-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-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-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-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-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-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-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-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-form-item> + + </el-col> + </el-row> + </el-form> + <template #footer> + <span class="dialog-footer"> + <el-button @click="cancel">鍙� 娑�</el-button> + <el-button type="primary" @click="submit">纭� 瀹�</el-button> + </span> + </template> + </el-dialog> + </div> +</template> +<style lang="scss" scoped> +:deep(.el-select), +:deep(.el-input-number) { + width: 100%; +} +</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'; + + //鐖剁骇浼犻�掓潵鐨勫弬鏁� + 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>({ + }); + + // 椤甸潰鍔犺浇鏃� + 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 closeDialog = () => { + emit("reloadTable"); + 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(); + } 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(); + + + + + + + //灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠� + defineExpose({ openDialog }); +</script> + + + + diff --git a/Web/src/views/wcs/wcsDevice/index.vue b/Web/src/views/wcs/wcsDevice/index.vue new file mode 100644 index 0000000..d22f856 --- /dev/null +++ b/Web/src/views/wcs/wcsDevice/index.vue @@ -0,0 +1,220 @@ +锘�<template> + <div class="wcsDevice-container"> + <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-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-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-form-item> + </el-col> + <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> + <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-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=""> + <template #default="scope"> + <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 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')"> + <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> + </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-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 { 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 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 printWcsDeviceTitle = ref(""); + const editWcsDeviceTitle = ref(""); + + // 鏀瑰彉楂樼骇鏌ヨ鐨勬帶浠舵樉绀虹姸鎬� + 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 sortChange = async (column: any) => { + queryParams.value.field = column.prop; + queryParams.value.order = column.order; + await handleQuery(); + }; + + // 鎵撳紑鏂板椤甸潰 + 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 delWcsDevice = (row: any) => { + ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ悧?`, "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .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(); + + handleQuery(); +</script> +<style scoped> +:deep(.el-input), +:deep(.el-select), +:deep(.el-input-number) { + width: 100%; +} +</style> + diff --git a/Web/src/views/wcs/wcsPlc/component/editDialog.vue b/Web/src/views/wcs/wcsPlc/component/editDialog.vue new file mode 100644 index 0000000..64cb9f5 --- /dev/null +++ b/Web/src/views/wcs/wcsPlc/component/editDialog.vue @@ -0,0 +1,149 @@ +锘�<template> + <div class="wcsPlc-container"> + <el-dialog v-model="isShowDialog" :width="800" draggable="" :close-on-click-modal="false"> + <template #header> + <div style="color: #fff"> + <!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>--> + <span>{{ props.title }}</span> + </div> + </template> + <el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules"> + <el-row :gutter="35"> + <el-form-item v-show="false"> + <el-input v-model="ruleForm.id" /> + </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-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-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-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-form-item> + + </el-col> + </el-row> + </el-form> + <template #footer> + <span class="dialog-footer"> + <el-button @click="cancel">鍙� 娑�</el-button> + <el-button type="primary" @click="submit">纭� 瀹�</el-button> + </span> + </template> + </el-dialog> + </div> +</template> +<style lang="scss" scoped> +:deep(.el-select), +:deep(.el-input-number) { + width: 100%; +} +</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'; + + //鐖剁骇浼犻�掓潵鐨勫弬鏁� + 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',},], + }); + + // 椤甸潰鍔犺浇鏃� + 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 closeDialog = () => { + emit("reloadTable"); + 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(); + } else { + ElMessage({ + message: `琛ㄥ崟鏈�${Object.keys(fields).length}澶勯獙璇佸け璐ワ紝璇蜂慨鏀瑰悗鍐嶆彁浜, + type: "error", + }); + } + }); + }; + + + + + + + //灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠� + defineExpose({ openDialog }); +</script> + + + + diff --git a/Web/src/views/wcs/wcsPlc/index.vue b/Web/src/views/wcs/wcsPlc/index.vue new file mode 100644 index 0000000..9de7109 --- /dev/null +++ b/Web/src/views/wcs/wcsPlc/index.vue @@ -0,0 +1,203 @@ +锘�<template> + <div class="wcsPlc-container"> + <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-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-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-select> + + </el-form-item> + </el-col> + <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> + <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-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-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')"> + <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> + </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-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 { 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 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 printWcsPlcTitle = ref(""); + const editWcsPlcTitle = ref(""); + + // 鏀瑰彉楂樼骇鏌ヨ鐨勬帶浠舵樉绀虹姸鎬� + 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 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 openPrintWcsPlc = async (row: any) => { + printWcsPlcTitle.value = '鎵撳嵃PLC'; + } + + // 鎵撳紑缂栬緫椤甸潰 + 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(() => {}); + }; + + // 鏀瑰彉椤甸潰瀹归噺 + 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%; +} +</style> + diff --git a/Web/src/views/wcs/wcsStation/component/editDialog.vue b/Web/src/views/wcs/wcsStation/component/editDialog.vue new file mode 100644 index 0000000..f1b9c10 --- /dev/null +++ b/Web/src/views/wcs/wcsStation/component/editDialog.vue @@ -0,0 +1,166 @@ +锘�<template> + <div class="wcsStation-container"> + <el-dialog v-model="isShowDialog" :width="800" draggable="" :close-on-click-modal="false"> + <template #header> + <div style="color: #fff"> + <!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>--> + <span>{{ props.title }}</span> + </div> + </template> + <el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules"> + <el-row :gutter="35"> + <el-form-item v-show="false"> + <el-input v-model="ruleForm.id" /> + </el-form-item> + <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> + <el-form-item label="璁惧ID" prop="deviceId"> + <el-select clearable filterable v-model="ruleForm.deviceId" placeholder="璇烽�夋嫨璁惧ID"> + <el-option v-for="(item,index) in wcsDeviceDeviceIdDropdownList" :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="stationNum"> + <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="鍋忕Щ閲�" prop="plcPos"> + <el-input v-model="ruleForm.plcPos" placeholder="璇疯緭鍏ュ亸绉婚噺" maxlength="32" 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-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-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-form-item> + + </el-col> + </el-row> + </el-form> + <template #footer> + <span class="dialog-footer"> + <el-button @click="cancel">鍙� 娑�</el-button> + <el-button type="primary" @click="submit">纭� 瀹�</el-button> + </span> + </template> + </el-dialog> + </div> +</template> +<style lang="scss" scoped> +:deep(.el-select), +:deep(.el-input-number) { + width: 100%; +} +</style> +<script lang="ts" setup> + import { ref,onMounted } from "vue"; + import { ElMessage } from "element-plus"; + import type { FormRules } from "element-plus"; + import { addWcsStation, updateWcsStation, detailWcsStation } from "/@/api/wcs/wcsStation"; + import { getWcsDeviceDeviceIdDropdown } from '/@/api/wcs/wcsStation'; + + //鐖剁骇浼犻�掓潵鐨勫弬鏁� + 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>({ + }); + + // 椤甸潰鍔犺浇鏃� + 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 detailWcsStation(rowData.id)).data.result; + else + ruleForm.value = rowData; + isShowDialog.value = true; + }; + + // 鍏抽棴寮圭獥 + const closeDialog = () => { + emit("reloadTable"); + 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 addWcsStation(values); + } else { + await updateWcsStation(values); + } + closeDialog(); + } else { + ElMessage({ + message: `琛ㄥ崟鏈�${Object.keys(fields).length}澶勯獙璇佸け璐ワ紝璇蜂慨鏀瑰悗鍐嶆彁浜, + type: "error", + }); + } + }); + }; + + const wcsDeviceDeviceIdDropdownList = ref<any>([]); + const getWcsDeviceDeviceIdDropdownList = async () => { + let list = await getWcsDeviceDeviceIdDropdown(); + wcsDeviceDeviceIdDropdownList.value = list.data.result ?? []; + }; + getWcsDeviceDeviceIdDropdownList(); + + + + + + + //灏嗗睘鎬ф垨鑰呭嚱鏁版毚闇茬粰鐖剁粍浠� + defineExpose({ openDialog }); +</script> + + + + diff --git a/Web/src/views/wcs/wcsStation/index.vue b/Web/src/views/wcs/wcsStation/index.vue new file mode 100644 index 0000000..dfc6ff1 --- /dev/null +++ b/Web/src/views/wcs/wcsStation/index.vue @@ -0,0 +1,196 @@ +锘�<template> + <div class="wcsStation-container"> + <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-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="璁惧ID"> + <el-select clearable="" filterable="" v-model="queryParams.deviceId" placeholder="璇烽�夋嫨璁惧ID"> + <el-option v-for="(item, index) in wcsDeviceDeviceIdDropdownList" :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-form-item> + </el-col> + <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> + <el-form-item> + <el-button-group style="display: flex; align-items: center;"> + <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'wcsStation: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="openAddWcsStation" + v-auth="'wcsStation: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="deviceId" label="璁惧ID" show-overflow-tooltip=""> + <template #default="scope"> + <span>{{ scope.row.deviceIdText }}</span> + + </template> + + </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="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('wcsStation:update') || auth('wcsStation:delete')"> + <template #default="scope"> + <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsStation(scope.row)" + v-auth="'wcsStation:update'"> 缂栬緫 </el-button> + <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsStation(scope.row)" + v-auth="'wcsStation: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="printWcsStationTitle" @reloadTable="handleQuery" /> + <editDialog ref="editDialogRef" :title="editWcsStationTitle" @reloadTable="handleQuery" /> + </el-card> + </div> +</template> + +<script lang="ts" setup="" name="wcsStation"> +import { ref } from "vue"; +import { ElMessageBox, ElMessage } from "element-plus"; +import { auth } from '/@/utils/authFunction'; + +import ModifyRecord from '/@/components/table/modifyRecord.vue'; + +import printDialog from '/@/views/system/print/component/hiprint/preview.vue' +import editDialog from '/@/views/wcs/wcsStation/component/editDialog.vue' +import { pageWcsStation, deleteWcsStation } from '/@/api/wcs/wcsStation'; +import { getWcsDeviceDeviceIdDropdown } from '/@/api/wcs/wcsStation'; + +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 printWcsStationTitle = ref(""); +const editWcsStationTitle = ref(""); + +// 鏀瑰彉楂樼骇鏌ヨ鐨勬帶浠舵樉绀虹姸鎬� +const changeAdvanceQueryUI = () => { + showAdvanceQueryUI.value = !showAdvanceQueryUI.value; +} + +// 鏌ヨ鎿嶄綔 +const handleQuery = async () => { + loading.value = true; + var res = await pageWcsStation(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 openAddWcsStation = () => { + editWcsStationTitle.value = '娣诲姞璁惧宸ヤ綅'; + editDialogRef.value.openDialog({}); +}; + +// 鎵撳紑鎵撳嵃椤甸潰 +const openPrintWcsStation = async (row: any) => { + printWcsStationTitle.value = '鎵撳嵃璁惧宸ヤ綅'; +} + +// 鎵撳紑缂栬緫椤甸潰 +const openEditWcsStation = (row: any) => { + editWcsStationTitle.value = '缂栬緫璁惧宸ヤ綅'; + editDialogRef.value.openDialog(row); +}; + +// 鍒犻櫎 +const delWcsStation = (row: any) => { + ElMessageBox.confirm(`纭畾瑕佸垹闄ゅ悧?`, "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(async () => { + await deleteWcsStation(row); + handleQuery(); + ElMessage.success("鍒犻櫎鎴愬姛"); + }) + .catch(() => { }); +}; + +// 鏀瑰彉椤甸潰瀹归噺 +const handleSizeChange = (val: number) => { + tableParams.value.pageSize = val; + handleQuery(); +}; + +// 鏀瑰彉椤电爜搴忓彿 +const handleCurrentChange = (val: number) => { + tableParams.value.page = val; + handleQuery(); +}; + +const wcsDeviceDeviceIdDropdownList = ref<any>([]); +const getWcsDeviceDeviceIdDropdownList = async () => { + let list = await getWcsDeviceDeviceIdDropdown(); + wcsDeviceDeviceIdDropdownList.value = list.data.result ?? []; +}; +getWcsDeviceDeviceIdDropdownList(); + +handleQuery(); +</script> +<style scoped> +:deep(.el-input), +:deep(.el-select), +:deep(.el-input-number) { + width: 100%; +} +</style> -- Gitblit v1.8.0