From b4083a6b047fc9e0964133c87227213c5154e37a Mon Sep 17 00:00:00 2001
From: IPC-610 <IPC-610@DESKTOP-6LEOOS3>
Date: 星期三, 15 一月 2025 15:47:44 +0800
Subject: [PATCH] 11111111
---
Web/src/views/device/inboundSorting/signalR.ts | 45 ++
Web/src/views/device/outboundSorting/signalR.ts | 45 ++
Web/src/api/wcs/wcsDevice.ts | 125 +++--
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceTaskOrderDto.cs | 1
Web/src/views/device/outboundSorting/index.vue | 275 +++++++++++++
Admin.NET/WCS.Application/PLC/PLCService.cs | 35 +
Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs | 8
Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs | 131 ++++--
Web/src/views/device/inboundSorting/index.vue | 308 +++++++++++++++
Web/src/views/device/alarmManage/index.vue | 6
Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs | 124 ++++--
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 15
Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs | 32
13 files changed, 980 insertions(+), 170 deletions(-)
diff --git a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
index 98397c0..a56718c 100644
--- a/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
+++ b/Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
@@ -158,12 +158,17 @@
{
foreach (var item in models)
{
+ string str = JsonConvert.SerializeObject(models);
+ Log.Information("鎺ユ敹WMS鎺ㄩ�佺殑绠辩爜淇℃伅锛�" + str);
// 楠岃瘉浠诲姟鏄惁宸插瓨鍦�
//var taskInfo = _db.Queryable<WcsOderTask>().First(w => w.OrderNo == item.OrderNo && w.SkuNo == item.SkuNo && w.LotNo == item.LotNo);
//if (taskInfo == null)
//{
- var orderAdd = new WcsOderTask()
+ //var taskid = _db.Queryable<WcsOderTask>().OrderByDescending(w=>w.CreateTime).First();
+ //int newid = (int)taskid.Id + 1;
+ var orderAdd = new WcsOderTask()
{
+
OrderNo = item.OrderNo,
TaskNo = "",
LotNo = item.LotNo,
@@ -172,6 +177,7 @@
BoxType = item.BoxType,
Qty = item.Qty,
TaskType = (TaskTypeEnum)item.TaskType,
+ CreateTime = DateTime.Now,
};
_db.Insertable(orderAdd).ExecuteCommand();
//}
diff --git a/Admin.NET/WCS.Application/PLC/PLCService.cs b/Admin.NET/WCS.Application/PLC/PLCService.cs
index 1b9e99f..204f571 100644
--- a/Admin.NET/WCS.Application/PLC/PLCService.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCService.cs
@@ -2,6 +2,7 @@
using Dm.filter;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Charts;
+using Elastic.Clients.Elasticsearch.Snapshot;
using Elastic.Clients.Elasticsearch.Tasks;
using Flurl.Util;
using Furion.Logging;
@@ -1800,7 +1801,7 @@
{
var plcConn = modDevice.PLCUtil;
- if (modDevice.DbNumber == "DB101" && modDevice.DbNumber == "DB102")
+ if (modDevice.DbNumber == "DB101")//&& modDevice.DbNumber == "DB102"&& (modDevice.DbNumber == "DB102"||modDevice.PlcIdIP == "10.18.51.110")
{
// 涓绘壂浜や簰娴佺▼
switch (modDevice.Value.ToString())
@@ -2023,8 +2024,8 @@
//鏄惁缁撴壒绠�
if (boxInfo[0].EndLotFlag == "1" && retVal.IsSucceed)
{
- // 瑙﹀彂缁撴壒 瑙g粦鍒嗛亾
- AutoEndLot(boxInfo[0].LotNo, plcConn, "0");
+ // 瑙﹀彂缁撴壒 鍒嗛亾鍙樹负缁撴壒涓�
+ AutoEndLot(boxInfo[0].LotNo, plcConn, "2");
}
}
else
@@ -2167,6 +2168,7 @@
string sqlStr2 = $"delete from WCSBoxInfoLog where IsDelete=0 and PalletNo='{palletNo}'";
_db.Ado.ExecuteCommand(sqlStr2);
}
+
// 鍚慦MS鐢宠宸烽亾
var http = new HttpService();
string TaskNo = "", EndLocate = "";
@@ -2179,6 +2181,29 @@
}
else
{
+ //鍒ゆ柇鏄惁缁撴壒涓�
+ var (res, jiepi) = plcConn.GetPlcDBValue(checkTaskMedel.PosType, modDevice.DbNumber, checkTaskMedel.PosLot);
+ if (jiepi == 2)//缁撴壒涓�
+ {
+ // 鍒嗛亾瑙g粦锛屾姄绠卞搧绉嶅啓鍏�0
+ var ret1 = plcConn.SetPlcDBValue(checkTaskMedel.PosTypeLot, modDevice.DbNumber, checkTaskMedel.PlcPos, "0");
+ if (ret1.IsSucceed)
+ {
+ //鍐欏叆娴佺▼瀛楁垚鍔熷悗鏇存柊鍒嗘嫞浠诲姟 liudl 鏈�鍚庝竴鎵樼洏鐢宠瀹屽叆搴撴墠鍙竻绌�
+ checkTaskMedel.OrderNo = "";
+ checkTaskMedel.TaskNo = "";
+ checkTaskMedel.LotNo = "";
+ checkTaskMedel.SkuNo = "";
+ checkTaskMedel.SkuName = "";
+ checkTaskMedel.BoxType = "";
+ checkTaskMedel.Qty = 0;
+ checkTaskMedel.PZNo = "";
+ checkTaskMedel.Status = "0"; // 缁戝畾鍒嗛亾 0锛氳В缁� 1锛氱粦瀹�
+
+ //鏇存柊鍒嗘嫞浠诲姟
+ _db.Updateable(checkTaskMedel).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+ }
+ }
// 鑾峰彇鍏ュ簱浠诲姟淇℃伅
var taskModel = _db.Queryable<WcsTask>().First(m => m.TaskNo == TaskNo && m.IsDelete == false && m.Status == TaskStatusEnum.Wait);
if (taskModel != null)
@@ -2376,7 +2401,7 @@
// 鍐欏叆缁撴壒淇″彿
var ret = plcConn.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "1");
// 鍒嗛亾瑙g粦锛屾姄绠卞搧绉嶅啓鍏�0
- var ret1 = plcConn.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PlcPos, "0");
+ //var ret1 = plcConn.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PlcPos, "0");
if (ret.IsSucceed)
{
//鍐欏叆娴佺▼瀛楁垚鍔熷悗鏇存柊鍒嗘嫞浠诲姟 liudl 鏈�鍚庝竴鎵樼洏鐢宠瀹屽叆搴撴墠鍙竻绌�
@@ -2388,7 +2413,7 @@
//item.BoxType = "";
//item.Qty = 0;
item.PZNo = "";
- item.Status = status; // 缁戝畾鍒嗛亾 0锛氳В缁� 1锛氱粦瀹�
+ item.Status = status; // 缁戝畾鍒嗛亾 0锛氳В缁� 1锛氱粦瀹� 2:缁撴壒涓�
//鏇存柊鍒嗘嫞浠诲姟
_db.Updateable(item).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
index 3a30f2c..451a68d 100644
--- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -69,7 +69,7 @@
/// </summary>
public static void Init()
{
- // var strMsg = new HttpService().RequestPackWcs("LN000001");
+ // var strMsg = new HttpService().RequestPackWcs("LN000001");
cts.Cancel();
listPlc = _db.Queryable<WcsPlc>()
.Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine)
@@ -162,7 +162,7 @@
{
//Console.WriteLine($"{modPlc.IP}璇诲彇{modDevice.DbNumber}.{modDevice.PlcPos}鐨勫�间负锛歿value}");
//鏃犳祦绋嬭烦鍑�
- if (value == 0 )// && modPlc.Type!= PLCTypeEnum.BoxConveyorLine
+ if (value == 0)// && modPlc.Type!= PLCTypeEnum.BoxConveyorLine
continue;
var dto = modDevice.Adapt<WcsDeviceDto>();
dto.Value = value;
@@ -316,7 +316,7 @@
listPulish.Add(modAlarm);
}
//鍙栨秷鎶ヨ
- else if (value && modAlarm.Status == YesNoEnum.Y)
+ else if (!value && modAlarm.Status == YesNoEnum.Y)
{
modAlarm.AlarmTime = null;
modAlarm.Status = YesNoEnum.N;
@@ -333,7 +333,8 @@
modLog.Id = 0;
listLog.Add(modLog);
}
- _db.Insertable(listLog).ExecuteCommand();
+ if (listLog.Count >= 0)
+ _db.Insertable(listLog).ExecuteCommand();
HubUtil.PublicAlarm(listPulish);
}
}
@@ -375,8 +376,8 @@
if (modPlcUtil == null)
continue;
var plcIp = modPlcUtil.PlcIP;
- var listDevice = listPlcDevice.Where(s => s.PlcId == modPlcUtil.PlcId && s.DeviceType == DeviceTypeEnum.Show).ToList();
- var modPlc = listPlc.FirstOrDefault(s => s.Id == modPlcUtil.PlcId);
+ var listDevice = listPlcDevice.Where(s => s.PlcId == modPlcUtil.PlcId && s.DeviceType == DeviceTypeEnum.Show).ToList();
+ var modPlc = listPlc.FirstOrDefault(s => s.Id == modPlcUtil.PlcId);
var listaddress = new Dictionary<string, PLCDataTypeEnum>();
foreach (var modDevice in listDevice)
{
@@ -435,7 +436,7 @@
{
bl = false;
}
- else
+ else
{
bl = true;
}
diff --git a/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs b/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs
index bcf0279..72a6f4e 100644
--- a/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsAlarmInfo/WcsAlarmInfoService.cs
@@ -137,20 +137,24 @@
if (value == null)
throw Oops.Bah("鏈壘鍒板浣嶅湴鍧�锛岃鍦ㄥ瓧鍏哥鐞嗕腑璁剧疆");
PLCUtil modUtil = new PLCUtil(modPlc);
- switch (input.layer)
- {
- case 1:
- break;
- case 2:
- {
- modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, value.Value, "1");
- }
- break;
- case 3:
- break;
- default:
- break;
- }
+ //switch (input.layer)
+ //{
+ // case 1:
+ // modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, value.Value, "1");
+ // break;
+ // case 2:
+ // {
+ // modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, value.Value, "1");
+ // }
+ // break;
+ // case 3:
+ // modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, value.Value, "1");
+ // break;
+ // default:
+ // break;
+ //}
+
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, value.Value, "1");
modUtil.Close();
}
diff --git a/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs b/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs
index b99dd08..16421c2 100644
--- a/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs
@@ -41,7 +41,7 @@
[DisplayName("鍒嗛〉鏌ヨ鍒嗘嫞浠诲姟琛�")]
public async Task<SqlSugarPagedList<WcsCheckTaskOutput>> Page(PageWcsCheckTaskInput input)
{
- input.SearchKey = input.SearchKey?.Trim();
+ input.SearchKey = input.SearchKey?.Trim();
var query = _wcsCheckTaskRep.AsQueryable()
.WhereIF(!string.IsNullOrEmpty(input.SearchKey), u =>
u.OrderNo.Contains(input.SearchKey)
@@ -67,14 +67,14 @@
.WhereIF(!string.IsNullOrWhiteSpace(input.Status), u => u.Status.Contains(input.Status.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.PZNo), u => u.PZNo.Contains(input.PZNo.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.PalletNo), u => u.PalletNo.Contains(input.PalletNo.Trim()))
- .WhereIF(input.BoxInsert>0, u => u.BoxInsert == input.BoxInsert)
- .WhereIF(input.BoxCount>0, u => u.BoxCount == input.BoxCount)
- .WhereIF(input.Qty>0, u => u.Qty == input.Qty)
- .WhereIF(input.FinishQty>0, u => u.FinishQty == input.FinishQty)
+ .WhereIF(input.BoxInsert > 0, u => u.BoxInsert == input.BoxInsert)
+ .WhereIF(input.BoxCount > 0, u => u.BoxCount == input.BoxCount)
+ .WhereIF(input.Qty > 0, u => u.Qty == input.Qty)
+ .WhereIF(input.FinishQty > 0, u => u.FinishQty == input.FinishQty)
.WhereIF(input.BindTimeRange != null && input.BindTimeRange.Length == 2, u => u.BindTime >= input.BindTimeRange[0] && u.BindTime <= input.BindTimeRange[1])
- .WhereIF(input.BindUserId>0, u => u.BindUserId == input.BindUserId)
+ .WhereIF(input.BindUserId > 0, u => u.BindUserId == input.BindUserId)
.Select<WcsCheckTaskOutput>();
- return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
+ return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
}
/// <summary>
@@ -191,34 +191,41 @@
checkTaskInfo.LotNo = taskInfo.LotNo;
checkTaskInfo.SkuNo = taskInfo.SkuNo;
checkTaskInfo.SkuName = taskInfo.SkuName;
- checkTaskInfo.BoxType = taskInfo.BoxType;
+ //checkTaskInfo.BoxType = taskInfo.BoxType;
checkTaskInfo.Qty = taskInfo.Qty;
checkTaskInfo.Status = "1";//宸茬粦瀹�
- checkTaskInfo.PZNo = skuInfo.PZNo;
+ checkTaskInfo.PZNo = skuInfo.PZNo;
#region#缁橮LC鍐欏叆鎶撶鍝佺鍙�
- var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == deviceInfo.PlcId);
- if (modPlc == null)
+ if (checkTaskInfo.Id >= 6)
{
- throw Oops.Bah("鎵句笉鍒癙LC淇℃伅");
- }
- PLCUtil modUtil = new PLCUtil(modPlc);
- if (modUtil.Connected)
- {
- var ret = modUtil.SetPlcDBValue(checkTaskInfo.PosType, checkTaskInfo.DbNumber, checkTaskInfo.PlcPos, checkTaskInfo.PZNo);
- if (ret.IsSucceed)
+ var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == deviceInfo.PlcId);
+ if (modPlc == null)
{
- //鍐欏叆娴佺▼瀛楁垚鍔熷悗鏇存柊鍒嗘嫞浠诲姟
- await _wcsCheckTaskRep.AsUpdateable(checkTaskInfo).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+ throw Oops.Bah("鎵句笉鍒癙LC淇℃伅");
+ }
+ PLCUtil modUtil = new PLCUtil(modPlc);
+ if (modUtil.Connected)
+ {
+ var ret = modUtil.SetPlcDBValue(checkTaskInfo.PosType, checkTaskInfo.DbNumber, checkTaskInfo.PlcPos, checkTaskInfo.PZNo);
+ if (ret.IsSucceed)
+ {
+ //鍐欏叆娴佺▼瀛楁垚鍔熷悗鏇存柊鍒嗘嫞浠诲姟
+ await _wcsCheckTaskRep.AsUpdateable(checkTaskInfo).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+ }
+ else
+ {
+ throw Oops.Bah("涓嶱CL浜や簰澶辫触锛岀粦瀹氬け璐ワ紒");
+ }
}
else
{
- throw Oops.Bah("涓嶱CL浜や簰澶辫触锛岀粦瀹氬け璐ワ紒");
+ throw Oops.Bah("PCL鏈繛鎺ワ紝缁戝畾澶辫触锛�");
}
}
else
{
- throw Oops.Bah("PCL鏈繛鎺ワ紝缁戝畾澶辫触锛�");
+ await _wcsCheckTaskRep.AsUpdateable(checkTaskInfo).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
#endregion
}
@@ -250,7 +257,7 @@
// throw Oops.Bah($"鎵句笉鍒板伐浣嶅彿锛�208鐨勮澶囦俊鎭�");
// }
// PLCUtil modUtil = new PLCUtil(modPlc);
-
+
// var ret = modUtil.SetPlcDBValue(checkTaskList2.PosTypeLot, checkTaskList2.DbNumber, checkTaskList2.PosLot, "1");
// return;
//}
@@ -281,27 +288,29 @@
PLCUtil modUtil = new PLCUtil(modPlc);
if (modUtil.Connected)
{
- var ret = modUtil.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "0"); // 瑙g粦鍒嗛亾
- if (ret.IsSucceed)
- {
- //鍐欏叆娴佺▼瀛楁垚鍔熷悗鏇存柊鍒嗘嫞浠诲姟
- item.OrderNo = "";
- item.TaskNo = "";
- item.LotNo = "";
- item.SkuNo = "";
- item.SkuName = "";
- item.BoxType = "";
- item.Qty = 0;
- item.PZNo = "";
- item.Status = "0";//鏈粦瀹�
+ // 鍐欏叆缁撴壒淇″彿
+ var ret = modUtil.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "1");
+ //var ret1 = modUtil.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "0"); // 瑙g粦鍒嗛亾
+ //if (ret1.IsSucceed)
+ //{
+ // //鍐欏叆娴佺▼瀛楁垚鍔熷悗鏇存柊鍒嗘嫞浠诲姟
+ // item.OrderNo = "";
+ // item.TaskNo = "";
+ // item.LotNo = "";
+ // item.SkuNo = "";
+ // item.SkuName = "";
+ // item.BoxType = "";
+ // item.Qty = 0;
+ // item.PZNo = "";
+ // item.Status = "0";//鏈粦瀹�
- //鏇存柊鍒嗘嫞浠诲姟
- await _wcsCheckTaskRep.AsUpdateable(item).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
- }
- else
- {
- throw Oops.Bah("涓嶱CL浜や簰澶辫触锛岀粨鎵瑰け璐ワ紒");
- }
+ // //鏇存柊鍒嗘嫞浠诲姟
+ // await _wcsCheckTaskRep.AsUpdateable(item).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+ //}
+ //else
+ //{
+ // throw Oops.Bah("涓嶱CL浜や簰澶辫触锛岀粨鎵瑰け璐ワ紒");
+ //}
}
else
{
@@ -310,4 +319,33 @@
#endregion
}
}
+ /// <summary>
+ /// 浠诲姟瑙g粦
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpPost]
+ [ApiDescriptionSettings(Name = "UnBindTaskForPLC")]
+ [DisplayName("浠诲姟瑙g粦")]
+ public async Task UnBindTaskForPLC(BaseIdInput input)
+ {
+ var modCheckTask = await _wcsCheckTaskRep.AsQueryable().FirstAsync(s => s.Id == input.Id);
+ if (modCheckTask == null)
+ throw Oops.Bah("鎵句笉鍒拌淇℃伅");
+ if (modCheckTask.Status != "1")
+ throw Oops.Bah("璇ヤ换鍔″凡瑙g粦");
+ modCheckTask.Status = "0";
+ modCheckTask.OrderNo = "";
+ modCheckTask.TaskNo = "";
+ modCheckTask.SkuNo = "";
+ modCheckTask.SkuName = "";
+ modCheckTask.LotNo = "";
+ modCheckTask.PZNo = "";
+ modCheckTask.BoxType = "";
+ modCheckTask.Qty = 0;
+
+ await _wcsCheckTaskRep.AsUpdateable(modCheckTask).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
+
+
+ }
}
diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceTaskOrderDto.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceTaskOrderDto.cs
index 2f97a92..bb29667 100644
--- a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceTaskOrderDto.cs
+++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceTaskOrderDto.cs
@@ -8,6 +8,7 @@
public class WcsDeviceTaskOrderDto
{
public long Id { get; set; }
+ public long TaskId { get; set; }
public string Text { get; set; }
public string? TaskNo { get; set; }
public string? OrderNo { get; set; }
diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
index dd5008e..c0c19d2 100644
--- a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
@@ -18,7 +18,7 @@
private readonly SqlSugarRepository<WcsPlc> _wcsPlcRep;
private readonly SqlSugarRepository<WcsDevice> _wcsDeviceRep;
private readonly SysCacheService _sysCacheService;
- public WcsDeviceService(SqlSugarRepository<WcsPlc> wcsPlcRep,SqlSugarRepository<WcsDevice> wcsDeviceRep, SysCacheService sysCacheService)
+ public WcsDeviceService(SqlSugarRepository<WcsPlc> wcsPlcRep, SqlSugarRepository<WcsDevice> wcsDeviceRep, SysCacheService sysCacheService)
{
_wcsPlcRep = wcsPlcRep;
_wcsDeviceRep = wcsDeviceRep;
@@ -82,7 +82,7 @@
case "suoding": // 閿佸畾
modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48.0", input.LocatNo);
break;
-
+
default:
break;
}
@@ -182,50 +182,46 @@
public async Task WriteInfo(WcsDeviceUpInfo input)
{
WcsPlc modPlc;
- string DbNum = "";// DB鍧�
-
+ string DbNum = "DB91";// DB鍧�
+
if (string.IsNullOrWhiteSpace(input.LocatNo))//濡傛灉宸ヤ綅涓虹┖
{
throw Oops.Bah("宸ヤ綅涓嶈兘涓虹┖");
}
- var plcList = await _wcsPlcRep.Context.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.IsDelete == false).ToListAsync();
+ var plcList = await _wcsPlcRep.Context.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine).ToListAsync();
switch (input.Layer)
{
case "1":
- modPlc = plcList.FirstOrDefault(m=>m.Text == "1灞傛墭鐩樿緭閫佺嚎");
- if (modPlc == null)
- throw Oops.Bah($"鏈煡璇㈠埌{input.Layer}妤煎眰PLC淇℃伅");
- DbNum = "";
+ modPlc = plcList.FirstOrDefault(m => m.Text == "1灞傛墭鐩樿緭閫佺嚎");
+ //DbNum = "";
break;
case "2":
modPlc = plcList.FirstOrDefault(m => m.Text == "2灞傛墭鐩樿緭閫佺嚎");
- if (modPlc == null)
- throw Oops.Bah($"鏈煡璇㈠埌{input.Layer}妤煎眰PLC淇℃伅");
- DbNum = "DB91";
+ //DbNum = "DB91";
break;
case "3":
modPlc = plcList.FirstOrDefault(m => m.Text == "3灞傛墭鐩樿緭閫佺嚎");
- if (modPlc == null)
- throw Oops.Bah($"鏈煡璇㈠埌{input.Layer}妤煎眰PLC淇℃伅");
- DbNum = "";
+ //DbNum = "";
break;
default:
throw Oops.Bah("妤煎眰淇℃伅閿欒");
}
-
- var device = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(s => s.PlcId == modPlc.Id && s.StationNum == input.LocatNo && s.IsDelete == false && s.DeviceType == DeviceTypeEnum.Show);
- if (device == null)
+ if (modPlc == null)
+ throw Oops.Bah($"鏈煡璇㈠埌{input.Layer}妤煎眰PLC淇℃伅");
+
+ var device = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(s => s.PlcId == modPlc.Id && s.StationNum == input.LocatNo && s.DeviceType == DeviceTypeEnum.Show);
+ if (device == null)
{
throw Oops.Bah("褰撳墠妤煎眰鏈煡璇㈠埌璇ュ伐浣嶄俊鎭�");
}
PLCUtil modUtil = new PLCUtil(modPlc);
-
+
// true 锛� 鎵嬪姩妯″紡 false:鑷姩妯″紡
var (result, value) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.4");
if (result.IsSucceed)
{
- if (input.TypeName != "shoudong" && value.ToString().ToLower() == "false" && input.TypeName != "huifu" && input.TypeName != "UpTask" )
+ if (input.TypeName != "shoudong" && value.ToString().ToLower() == "false" && input.TypeName != "huifu" && input.TypeName != "UpTask")
{
throw Oops.Bah("褰撳墠涓鸿嚜鍔ㄦā寮忥紝璇峰厛鍒囨崲涓烘墜鍔ㄦā寮�");
}
@@ -234,7 +230,7 @@
{
throw Oops.Bah("璇诲彇PLC鎵嬭嚜鍔ㄥ�煎け璐�");
}
-
+
switch (input.TypeName)
{
case "zidong": // 鑷姩
@@ -258,10 +254,10 @@
{
throw Oops.Bah("浜嬩欢缁撴灉閿欒");
}
-
+
break;
case "1diandong": // 1鐐瑰姩
- if(input.FuncName == "true")
+ if (input.FuncName == "true")
{
modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.7", "true");
}
@@ -403,11 +399,11 @@
case "fanzhuansheng":
if (input.FuncName == "true")
{
- modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "51.7", "true");
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "59.0", "true");
}
else if (input.FuncName == "false")
{
- modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "51.7", "false");
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "59.0", "false");
}
else
{
@@ -417,11 +413,11 @@
case "fanzhuanjiang":
if (input.FuncName == "true")
{
- modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "52.0", "true");
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "59.1", "true");
}
else if (input.FuncName == "false")
{
- modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "52.0", "false");
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "59.1", "false");
}
else
{
@@ -445,8 +441,8 @@
{
throw Oops.Bah("璇诲彇PLC鍊煎け璐�");
}
-
-
+
+
break;
default:
break;
@@ -547,7 +543,7 @@
Thread.Sleep(1000);
modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.2", "false");
break;
-
+
default:
break;
}
@@ -570,7 +566,7 @@
WcsPlc modPlc;
string DbNum = "";// DB鍧�
-
+
var plcList = await _wcsPlcRep.Context.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.IsDelete == false).ToListAsync();
if (input.Layer == "1")
{
@@ -685,7 +681,7 @@
{
throw Oops.Bah("浜嬩欢缁撴灉閿欒");
}
- break;
+ break;
case "TwoBoxStop":
if (input.FuncName == "true")
@@ -717,7 +713,7 @@
{
throw Oops.Bah("鎿嶄綔绫诲瀷淇℃伅閿欒");
}
-
+
}
#endregion
@@ -970,7 +966,7 @@
(result, var palletNo) = modConn.GetPlcDBValue(modPositionPalletNo.PosType, modDevice.DbNumber, modPositionPalletNo.PlcPos, modPositionPalletNo.StringLength);
modDevice.PalletNo = Convert.ToString(palletNo);
Console.WriteLine(modDevice.DbNumber + "." + modPositionPalletNo.PlcPos + "----------");
- }
+ }
if (cachePlc.Type == PLCTypeEnum.ConveyorLine || cachePlc.Type == PLCTypeEnum.StackingMachine)
{
//鏀捐揣鎺�
@@ -1015,11 +1011,11 @@
(result, var pickStorey) = modConn.GetPlcDBValue(modPositionPickStorey.PosType, modDevice.DbNumber, modPositionPickStorey.PlcPos);
modDevice.PickStorey = Convert.ToInt32(pickStorey);
}
-
+
if (cachePlc.Type == PLCTypeEnum.StackingMachine)
{
//璺烘満鐨勮捣濮嬪伐浣嶇敤鍙栬揣鎺掑垪灞�
- modDevice.StartLocatNo = $"{modDevice.PickRow.ToString().PadLeft(2,'0')}{modDevice.PickCol.ToString().PadLeft(2, '0')}{modDevice.PickStorey.ToString().PadLeft(2, '0')}";
+ modDevice.StartLocatNo = $"{modDevice.PickRow.ToString().PadLeft(2, '0')}{modDevice.PickCol.ToString().PadLeft(2, '0')}{modDevice.PickStorey.ToString().PadLeft(2, '0')}";
//璺烘満鐨勭洰鐨勫伐浣嶇敤鏀捐揣鎺掑垪灞�
modDevice.EndLocatNo = $"{modDevice.ReleaseRow.ToString().PadLeft(2, '0')}{modDevice.ReleaseCol.ToString().PadLeft(2, '0')}{modDevice.ReleaseStorey.ToString().PadLeft(2, '0')}";
}
@@ -1157,7 +1153,7 @@
var modPositionEndLocatNo = listPosition.FirstOrDefault(s => s.Text == "鐩殑宸ヤ綅");
if (modPositionEndLocatNo != null)
result = modUtil.SetPlcDBValue(modPositionEndLocatNo.PosType, modDbDevice.DbNumber, modPositionEndLocatNo.PlcPos, modDevice.EndLocatNo.ToString());
- }
+ }
}
//鎵樼洏鐮�
if (modDevice.PalletNo != null)
@@ -1237,7 +1233,7 @@
public async Task<dynamic> WcsPackPlcList()
{
return await _wcsDeviceRep.Context.Queryable<WcsPlc>()
- .Where(w => w.Type == PLCTypeEnum.RobotPalletizer || w.Type == PLCTypeEnum.StackingRobot)
+ .Where(w => w.Type == PLCTypeEnum.RobotPalletizer /*|| w.Type == PLCTypeEnum.StackingRobot*/)
.OrderByDescending(o => o.Type)
.Select(u => new
{
@@ -1282,7 +1278,7 @@
PZNo = task.PZNo,
Qty = task.Qty,
- PlcId=device.PlcId,
+ PlcId = device.PlcId,
Type = plc.Type
})
.ToListAsync();
@@ -1294,7 +1290,62 @@
if (modUtil.Connected)
{
connStatus = true;
- }
+ }
+ foreach (var item in list)
+ {
+ item.PlcStatus = connStatus;
+ }
+ return list;
+ }
+ /// <summary>
+ /// 鑾峰彇璁惧瀵瑰簲宸ヤ綅鍒楄〃
+ /// </summary>
+ /// <param name="entry"></param>
+ /// <returns></returns>
+ [HttpGet]
+ [ApiDescriptionSettings(Name = "WcsStackingRobotList")]
+ [DisplayName("鑾峰彇璁惧瀵瑰簲宸ヤ綅鍒楄〃")]
+ public async Task<List<WcsDeviceTaskOrderDto>> WcsStackingRobotList()
+ {
+ //var list = await _wcsDeviceRep.AsQueryable()
+ // .LeftJoin<WcsPlc>((a, b) => a.PlcId == b.Id)
+ // .Where((a, b) => a.DeviceType == DeviceTypeEnum.Business)
+ // .Select<WcsDeviceOutput>((a, b) => new WcsDeviceOutput() { Type = b.Type }, true)
+ // .ToListAsync();
+
+
+ var list = await _wcsDeviceRep.Context.Queryable<WcsCheckTask>()
+ .LeftJoin<WcsDevice>((task, device) => device.StationNum == task.Port)
+ .InnerJoin<WcsPlc>((task, device, plc) => device.PlcId == plc.Id)
+ .Where((task, device, plc) => task.Id <= 3)
+ .OrderBy((task, device, plc) => device.CreateTime)
+ .Select((task, device, plc) => new WcsDeviceTaskOrderDto()
+ {
+ Id = device.Id,
+ TaskId = task.Id,
+ Text = task.Id.ToString() + "鍙峰嚭搴撳垎鎷g嚎",
+ TaskNo = task.TaskNo,
+ OrderNo = task.OrderNo,
+ LotNo = task.LotNo,
+ SkuNo = task.SkuNo,
+ SkuName = task.SkuName,
+ LineNo = task.LineNo,
+ Status = task.Status,
+ PZNo = task.PZNo,
+ Qty = task.Qty,
+ PlcId = device.PlcId,
+ Type = plc.Type
+ })
+ .ToListAsync();
+
+ bool connStatus = false;
+ //鑾峰彇璁惧鐨勭姸鎬�
+ var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == list[0].PlcId);
+ PLCUtil modUtil = new PLCUtil(modPlc);
+ if (modUtil.Connected)
+ {
+ connStatus = true;
+ }
foreach (var item in list)
{
item.PlcStatus = connStatus;
diff --git a/Web/src/api/wcs/wcsDevice.ts b/Web/src/api/wcs/wcsDevice.ts
index d2b0fec..97bb3f5 100644
--- a/Web/src/api/wcs/wcsDevice.ts
+++ b/Web/src/api/wcs/wcsDevice.ts
@@ -1,26 +1,27 @@
锘縤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',
- GeneratePos = '/api/wcsDevice/GeneratePos',
- ListWcsDevice = '/api/wcsDevice/list',
- WriteValue = '/api/wcsdevice/writeValue',
+ AddWcsDevice = '/api/wcsDevice/add',
+ DeleteWcsDevice = '/api/wcsDevice/delete',
+ UpdateWcsDevice = '/api/wcsDevice/update',
+ PageWcsDevice = '/api/wcsDevice/page',
+ DetailWcsDevice = '/api/wcsDevice/detail',
+ GetWcsPlcPlcIdDropdown = '/api/wcsDevice/WcsPlcPlcIdDropdown',
+ GeneratePos = '/api/wcsDevice/GeneratePos',
+ ListWcsDevice = '/api/wcsDevice/list',
+ WriteValue = '/api/wcsdevice/writeValue',
- GetWcsPackPlcList='/api/wcsDevice/WcsPackPlcList',
- GetWcsPackStationPlcList='/api/wcsDevice/WcsPackStationPlcList',
- BindTaskForPLC='/api/WcsCheckTask/BindTaskForPLC',
- CloseTaskForPLC='/api/WcsCheckTask/CloseTaskForPLC',
+ GetWcsPackPlcList = '/api/wcsDevice/WcsPackPlcList',
+ GetWcsPackStationPlcList = '/api/wcsDevice/WcsPackStationPlcList',
+ GetWcsStackingRobotList = '/api/wcsDevice/WcsStackingRobotList',
+ BindTaskForPLC = '/api/WcsCheckTask/BindTaskForPLC',
+ CloseTaskForPLC = '/api/WcsCheckTask/CloseTaskForPLC',
+ UnBindTaskForPLC = '/api/WcsCheckTask/UnBindTaskForPLC',
-
- GetLocationInfo = '/api/wcsDevice/GetLocationInfo',
- WriteLocationInfo = '/api/wcsDevice/WriteLocationInfo',
- WriteInfo = '/api/wcsDevice/WriteInfo',
- WriteTaskInfo = '/api/wcsDevice/WriteTaskInfo',
- WriteStartStop = '/api/wcsDevice/WriteStartStop',
+ GetLocationInfo = '/api/wcsDevice/GetLocationInfo',
+ WriteLocationInfo = '/api/wcsDevice/WriteLocationInfo',
+ WriteInfo = '/api/wcsDevice/WriteInfo',
+ WriteTaskInfo = '/api/wcsDevice/WriteTaskInfo',
+ WriteStartStop = '/api/wcsDevice/WriteStartStop',
}
// 澧炲姞璁惧淇℃伅
export const WriteLocationInfo = (params?: any) =>
@@ -67,54 +68,54 @@
});
// 鍒犻櫎璁惧淇℃伅
-export const deleteWcsDevice = (params?: any) =>
+export const deleteWcsDevice = (params?: any) =>
request({
- url: Api.DeleteWcsDevice,
- method: 'post',
- data: params,
- });
+ url: Api.DeleteWcsDevice,
+ method: 'post',
+ data: params,
+ });
// 缂栬緫璁惧淇℃伅
-export const updateWcsDevice = (params?: any) =>
+export const updateWcsDevice = (params?: any) =>
request({
- url: Api.UpdateWcsDevice,
- method: 'post',
- data: params,
- });
+ url: Api.UpdateWcsDevice,
+ method: 'post',
+ data: params,
+ });
// 鍒嗛〉鏌ヨ璁惧淇℃伅
-export const pageWcsDevice = (params?: any) =>
+export const pageWcsDevice = (params?: any) =>
request({
- url: Api.PageWcsDevice,
- method: 'post',
- data: params,
- });
+ url: Api.PageWcsDevice,
+ method: 'post',
+ data: params,
+ });
// 璇︽儏璁惧淇℃伅
-export const detailWcsDevice = (id: any) =>
+export const detailWcsDevice = (id: any) =>
request({
- url: Api.DetailWcsDevice,
- method: 'get',
- data: { id },
- });
+ url: Api.DetailWcsDevice,
+ method: 'get',
+ data: { id },
+ });
export const getWcsPlcPlcIdDropdown = () =>
- request({
+ request({
url: Api.GetWcsPlcPlcIdDropdown,
method: 'get'
- });
+ });
export const generatePos = (params?: any) =>
request({
- url: Api.GeneratePos,
- method: 'post',
- data: params
+ url: Api.GeneratePos,
+ method: 'post',
+ data: params
});
-
+
export const listWcsDevice = () =>
request({
- url: Api.ListWcsDevice,
- method: 'get'
+ url: Api.ListWcsDevice,
+ method: 'get'
});
@@ -122,33 +123,45 @@
request({
url: Api.GetWcsPackPlcList,
method: 'get'
-});
+ });
export const GetWcsPackStationPlcList = (params?: any) =>
request({
url: Api.GetWcsPackStationPlcList,
method: 'get',
data: params
-});
-
+ });
+export const GetWcsStackingRobotList = (params?: any) =>
+ request({
+ url: Api.GetWcsStackingRobotList,
+ method: 'get',
+ data: params
+ });
// 鎵嬪姩缁戝畾浠诲姟鍒癙LC
-export const BindTaskForPLC = (params?: any) =>
+export const BindTaskForPLC = (params?: any) =>
request({
url: Api.BindTaskForPLC,
method: 'post',
data: params,
-});
+ });
//浠诲姟缁撴壒
-export const CloseTaskForPLC = (params?: any) =>
+export const CloseTaskForPLC = (params?: any) =>
request({
url: Api.CloseTaskForPLC,
method: 'post',
data: params,
-});
+ });
+//浠诲姟瑙g粦
+export const UnBindTaskForPLC = (params?: any) =>
+ request({
+ url: Api.UnBindTaskForPLC,
+ method: 'post',
+ data: params,
+ });
//鍐欏叆鍊�
-export const writeValue = (params?: any) =>
+export const writeValue = (params?: any) =>
request({
url: Api.WriteValue,
method: 'post',
data: params,
-});
\ No newline at end of file
+ });
\ No newline at end of file
diff --git a/Web/src/views/device/alarmManage/index.vue b/Web/src/views/device/alarmManage/index.vue
index 492665b..11ef7a2 100644
--- a/Web/src/views/device/alarmManage/index.vue
+++ b/Web/src/views/device/alarmManage/index.vue
@@ -11,12 +11,12 @@
<el-table-column prop="alarmName" label="鎻忚堪" align="center"></el-table-column>
<el-table-column prop="stationNum" label="浣嶇疆" align="center"></el-table-column>
<el-table-column prop="alarmTime" label="鏃堕棿" align="center"></el-table-column>
- <el-table-column label="鎿嶄綔" width="80" align="center" fixed="right" show-overflow-tooltip="">
+ <!-- <el-table-column label="鎿嶄綔" width="80" align="center" fixed="right" show-overflow-tooltip="">
<template #default="scope">
<el-button icon="ele-Check" size="small" text="" type="primary"
@click="topUpAlarm(scope.row)">鎭㈠</el-button>
</template>
- </el-table-column>
+ </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=""
@@ -73,10 +73,8 @@
signalR.off('PublicAlarm');
signalR.on('PublicAlarm', (dataArray: any) => {
dataArray.forEach(data => {
- console.log("1111111:"+data);
// 鏇存柊 tableData
const index = tableData.value.findIndex(t => t.id == data.id);
- console.log("2222222:"+index.value);
if (index === -1 && data.status == 1) {
// 濡傛灉涓嶅瓨鍦紝娣诲姞鏂版暟鎹�
diff --git a/Web/src/views/device/inboundSorting/index.vue b/Web/src/views/device/inboundSorting/index.vue
new file mode 100644
index 0000000..15dc589
--- /dev/null
+++ b/Web/src/views/device/inboundSorting/index.vue
@@ -0,0 +1,308 @@
+<template>
+ <el-container>
+ <el-col>
+ <el-row :span="1">
+ <div class="card-page">
+ <el-button
+ v-for="device in deviceList"
+ :key="device.id"
+ type="primary"
+ :plain="selectedDeviceId !== device.id"
+ @click="chooseDevice(device.id)"
+ >
+ {{ device.name }}
+ </el-button>
+ </div>
+ </el-row>
+ <el-row :span="1">
+ <div class="card-container">
+ <el-card class="other-box-card" v-for="deviceInfo in devicePointData" :key="deviceInfo.id">
+ <div slot="header" class="linefix">
+ <span>{{ deviceInfo.text }}</span>
+ <div :class="['lineStatus', { 'device-status-0': deviceInfo.plcStatus === true }, { 'device-status-1': deviceInfo.plcStatus === false }]"></div>
+ </div>
+ <div class="otherValuefix" >
+ <el-form label-position="left" label-width="90px">
+ <el-form-item label="WMS鏄庣粏鍗曞彿" v-if="deviceInfo.type==5">
+ <el-input v-model="deviceInfo.orderNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="浠诲姟鍙�">
+ <el-input v-model="deviceInfo.taskNo"></el-input>
+ </el-form-item>
+ <el-form-item label="鎵规鍙�">
+ <el-input v-model="deviceInfo.lotNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鐗╂枡缂栫爜">
+ <el-input v-model="deviceInfo.skuNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鐗╂枡鍚嶇О">
+ <el-input v-model="deviceInfo.skuName" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鍒嗘嫞绾跨紪鍙�" v-if="deviceInfo.type==5">
+ <el-input v-model="deviceInfo.lineNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="缁戝畾鐘舵��">
+ <el-input :value="deviceInfo.status === '0' ? '鏈粦瀹�' : '宸茬粦瀹�'" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鎶撶鍝佺">
+ <el-input v-model="deviceInfo.pzNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鎵樼洏鍙�">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鎻掔爜绠辨暟" v-if="deviceInfo.type==5">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鎷嗗灈绠辨暟" v-if="deviceInfo.type==6">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鏁磋泛绠辨暟">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="瀹屾垚绠辨暟">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <!-- <el-form-item label="WMS涓嬪彂鏁伴噺">
+ <el-input v-model="deviceInfo.qty" readonly></el-input>
+ </el-form-item> -->
+ <el-form-item label="鐘舵��">
+ <el-input :value="deviceInfo.plcStatus ? '鍦ㄧ嚎' : '绂荤嚎'" readonly></el-input>
+ </el-form-item>
+ </el-form>
+ </div>
+ <!-- 璁惧绫诲瀷涓虹爜鍨涙満鍣ㄤ汉 -->
+ <div v-if="deviceInfo.type==5" class="otherButtonfix">
+ <el-form label-position="left">
+ <el-form-item>
+ <el-button type="primary" @click="openBindDialog(deviceInfo.id)">缁戝畾</el-button>
+ <el-button @click="closeBindDialog(deviceInfo.lotNo)">缁撴壒</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+ </el-card>
+ </div>
+ </el-row>
+ </el-col>
+
+ <!-- 缁戝畾浠诲姟寮规 -->
+ <el-dialog v-model="bindDialogVisible" title="閫夋嫨鏁版嵁">
+ <el-table
+ :data="bindData"
+ highlight-current-row
+ @row-click="handleRowClick"
+ >
+ <el-table-column prop="orderNo" label="WMS涓嬪彂鍗曞彿" show-overflow-tooltip="" />
+ <el-table-column prop="taskNo" label="浠诲姟鍙�" show-overflow-tooltip="" />
+ <el-table-column prop="lotNo" label="鎵规鍙�" show-overflow-tooltip="" />
+ <el-table-column prop="skuNo" label="鐗╂枡缂栫爜" show-overflow-tooltip="" />
+ <el-table-column prop="skuName" label="鐗╂枡鍚嶇О" show-overflow-tooltip="" />
+ <el-table-column prop="boxType" label="瑙勬牸" show-overflow-tooltip="" />
+ <el-table-column prop="qty" label="鎬荤鏁�/璁″垝绠辨暟/棰勪及绠辨暟" show-overflow-tooltip="" />
+ </el-table>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="bindDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="confirmBinding">纭</el-button>
+ </div>
+ </el-dialog>
+ </el-container>
+</template>
+
+<script lang="ts" setup>
+import { ref, onMounted } from 'vue';
+import { GetWcsPackPlcList,GetWcsPackStationPlcList,BindTaskForPLC,CloseTaskForPLC } from '/@/api/wcs/wcsDevice';
+import { pageWcsOderTask } from '/@/api/device/wcsOderTask';
+import { ElMessageBox,ElMessage } from 'element-plus';
+import { signalR,stopConnection } from './signalR';
+//杩炴帴signalR 鐩戝惉鍙樻洿
+onMounted(async () => {
+ signalR.off('PublicCheckTask');
+ signalR.on('PublicCheckTask', (data: any) => {
+ //todo 闇�瑕佹祴璇�
+ // if (data.type == 0) {
+
+ // }
+ var index = devicePointData.value.findIndex(s => s.id == data.id);
+ if (index !== -1) {
+ devicePointData.value.splice(index, 1, data);
+ }
+ });
+});
+
+//璁惧鏁版嵁
+const deviceList=ref<any>([]);
+//璁惧瀵瑰簲宸ヤ綅鏁版嵁
+const devicePointData = ref<any>([]);
+//閫変腑璁惧ID
+const selectedDeviceId=ref<any>();
+//閫変腑宸ヤ綅ID
+const selectedStationId=ref<any>();
+
+const bindDialogVisible = ref(false);
+const bindData = ref<any>([]);
+const selectedRow = ref<any>(null);
+const queryParams = ref<any>({});
+const tableParams = ref({
+ page: 1,
+ pageSize: 20,
+ total: 0,
+});
+
+//鑾峰彇璁惧瀵瑰簲鐨勫伐浣嶆暟鎹�
+const fetchStationData = async (plcId: any) => {
+ const res2 = await GetWcsPackStationPlcList({ plcId });
+ devicePointData.value = res2.data.result;
+};
+// 鑾峰彇璁惧鏁版嵁
+const fetchPLCDeviceData = async () => {
+ var res = await GetWcsPackPlcList();
+ deviceList.value = res.data.result;
+
+ if (deviceList.value.length > 0) {
+ selectedDeviceId.value = deviceList.value[0].id;
+ await fetchStationData(selectedDeviceId.value);
+ }
+};
+fetchPLCDeviceData();
+
+//鍒囨崲璁惧
+function chooseDevice(id) {
+ selectedDeviceId.value = id;
+ fetchStationData(selectedDeviceId.value);
+}
+
+const handleQuery = async () => {
+ var res = await pageWcsOderTask(Object.assign(queryParams.value, tableParams.value));
+ bindData.value = res.data.result?.items ?? [];
+ tableParams.value.total = res.data.result?.total;
+ };
+//鎵撳紑缁戝畾寮规
+function openBindDialog(id) {
+ selectedStationId.value=null;
+ selectedRow.value=null;
+
+ selectedStationId.value=id;
+ bindDialogVisible.value = true;
+
+ handleQuery();
+}
+//鐐瑰嚮琛屾椂璁剧疆閫変腑琛�
+function handleRowClick(row) {
+ selectedRow.value = row;
+}
+
+//纭缁戝畾鎿嶄綔
+function confirmBinding() {
+ if (selectedRow.value) {
+ //鎵嬪姩缁戝畾浠诲姟鍒癙LC
+ bindTaskForPLC(selectedStationId.value,selectedRow.value.id);
+
+ bindDialogVisible.value = false;
+ } else {
+ ElMessage.error('璇烽�夋嫨瑕佺粦瀹氱殑浠诲姟锛�');
+ }
+}
+const bindTaskForPLC = async (deviceId: any,oderTaskId:any) => {
+ const res = await BindTaskForPLC({ deviceId,oderTaskId });
+ if(res.status==200){
+ ElMessage.success('缁戝畾鎴愬姛锛�');
+ // 鍒锋柊
+ fetchStationData(selectedDeviceId.value);
+ }
+}
+//缁撴壒鎿嶄綔
+function closeBindDialog(lotNo){
+ // if(lotNo==''){
+ // ElMessage.error('璇ュ伐浣嶆湭缁戝畾浠诲姟锛�');
+ // return;
+ // }
+ ElMessageBox.confirm(`纭畾瀵硅鎵规浠诲姟缁撴壒鍚�?`, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ })
+ .then(async () => {
+ closeTaskForPLC(lotNo);
+ })
+ .catch(() => {});
+}
+const closeTaskForPLC = async (lotNo: string) => {
+ const res = await CloseTaskForPLC({ lotNo });
+ if(res.status==200){
+ ElMessage.success('缁撴壒鎴愬姛锛�');
+ // 鍒锋柊
+ fetchStationData(selectedDeviceId.value);
+ }
+}
+
+</script>
+
+<style scoped>
+ .card-page {
+ width: 100%;
+ height: 50px;
+ display: flex;
+ text-align: center;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+ }
+ .card-page>button {
+ width: 150px;
+ height: 30px;
+ }
+ .card-container {
+ display: grid;
+ grid-template-columns: repeat(6, 1fr);
+ gap: 10px;
+ }
+ .other-box-card {
+ box-sizing: border-box;
+ background: linear-gradient(135deg, #66ccff, #3399ff);
+ }
+ .lineStatus{
+ position: absolute;
+ right: 0;
+ float: right;
+ height: 20px;
+ width: 20px;
+ border-radius: 20px;
+ background-color: #67C23A;
+ }
+ .linefix{
+ border-bottom: 1px solid rgb(197, 195, 195);
+ display: flex;
+ align-items: center;
+ height: 40px;
+ position: relative;
+ color: #fff;
+ }
+ .otherValuefix{
+ width: 100%;
+ height: 540px;
+ padding: 10px;
+ border-bottom: 1px solid rgb(197, 195, 195);
+ }
+ .otherButtonfix{
+ width: 100%;
+ height: 60px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0;
+ }
+ .device-status-0{
+ background-color: #58f709;
+ }
+ .device-status-1{
+ background-color: red;
+ }
+ .dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: 20px;
+ }
+ .divDisplay{
+ display:none
+ }
+</style>
+
\ No newline at end of file
diff --git a/Web/src/views/device/inboundSorting/signalR.ts b/Web/src/views/device/inboundSorting/signalR.ts
new file mode 100644
index 0000000..d9b25f2
--- /dev/null
+++ b/Web/src/views/device/inboundSorting/signalR.ts
@@ -0,0 +1,45 @@
+import * as SignalR from '@microsoft/signalr';
+import { getToken } from '/@/utils/axios-utils';
+
+// 鍒濆鍖朣ignalR瀵硅薄
+const connection = new SignalR.HubConnectionBuilder()
+ .configureLogging(SignalR.LogLevel.Information)
+ .withUrl(`${window.__env__.VITE_API_URL}/hubs/CheckTask?token=${getToken()}`, { transport: SignalR.HttpTransportType.WebSockets, skipNegotiation: true })
+ .withAutomaticReconnect({
+ nextRetryDelayInMilliseconds: () => {
+ return 5000; // 姣�5绉掗噸杩炰竴娆�
+ },
+ })
+ .build();
+
+connection.keepAliveIntervalInMilliseconds = 15 * 1000; // 蹇冭烦妫�娴�15s
+connection.serverTimeoutInMilliseconds = 30 * 60 * 1000; // 瓒呮椂鏃堕棿30m
+
+// 鍚姩杩炴帴
+connection.start().then(() => {
+ console.log('鍚姩杩炴帴checkTask');
+});
+// 鏂紑杩炴帴
+connection.onclose(async () => {
+ console.log('鏂紑杩炴帴checkTask');
+});
+// 閲嶈繛涓�
+connection.onreconnecting(() => {
+ console.log('鏈嶅姟鍣ㄥ凡鏂嚎checkTask');
+});
+// 閲嶈繛鎴愬姛
+connection.onreconnected(() => {
+ console.log('閲嶈繛鎴愬姛checkTask');
+});
+// 鍏抽棴杩炴帴鐨勬柟娉�
+async function stopConnection() {
+ try {
+ await connection.stop();
+ console.log('杩炴帴宸插叧闂�');
+ } catch (error) {
+ console.error('鍏抽棴杩炴帴鏃跺彂鐢熼敊璇�:', error);
+ }
+ }
+// connection.on('PublicPlcConn', () => {});
+
+export { connection as signalR,stopConnection };
diff --git a/Web/src/views/device/outboundSorting/index.vue b/Web/src/views/device/outboundSorting/index.vue
new file mode 100644
index 0000000..60caebc
--- /dev/null
+++ b/Web/src/views/device/outboundSorting/index.vue
@@ -0,0 +1,275 @@
+<template>
+ <el-container>
+ <el-col>
+ <el-row :span="1">
+ <div class="card-container">
+ <el-card class="other-box-card" v-for="deviceInfo in devicePointData" :key="deviceInfo.id">
+ <div slot="header" class="linefix">
+ <span>{{ deviceInfo.text }}</span>
+ <!-- <div
+ :class="['lineStatus', { 'device-status-0': deviceInfo.plcStatus === true }, { 'device-status-1': deviceInfo.plcStatus === false }]">
+ </div> -->
+ </div>
+ <div class="otherValuefix">
+ <el-form label-position="left" label-width="90px">
+ <el-form-item label="WMS鏄庣粏鍗曞彿">
+ <el-input v-model="deviceInfo.orderNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="浠诲姟鍙�">
+ <el-input v-model="deviceInfo.taskNo"></el-input>
+ </el-form-item>
+ <el-form-item label="鎵规鍙�">
+ <el-input v-model="deviceInfo.lotNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鐗╂枡缂栫爜">
+ <el-input v-model="deviceInfo.skuNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鐗╂枡鍚嶇О">
+ <el-input v-model="deviceInfo.skuName" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鍒嗘嫞绾跨紪鍙�" v-if="deviceInfo.type == 5">
+ <el-input v-model="deviceInfo.lineNo" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="缁戝畾鐘舵��">
+ <el-input :value="deviceInfo.status === '0' ? '鏈粦瀹�' : '宸茬粦瀹�'" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鎶撶鍝佺">
+ <el-input v-model="deviceInfo.pzNo" readonly></el-input>
+ </el-form-item>
+ <!-- <el-form-item label="鎵樼洏鍙�">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鎻掔爜绠辨暟" v-if="deviceInfo.type==5">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鎷嗗灈绠辨暟" v-if="deviceInfo.type==6">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鏁磋泛绠辨暟">
+ <el-input readonly></el-input>
+ </el-form-item>
+ <el-form-item label="瀹屾垚绠辨暟">
+ <el-input readonly></el-input>
+ </el-form-item> -->
+ <!-- <el-form-item label="WMS涓嬪彂鏁伴噺">
+ <el-input v-model="deviceInfo.qty" readonly></el-input>
+ </el-form-item> -->
+ <el-form-item label="鐘舵��">
+ <el-input :value="deviceInfo.plcStatus ? '鍦ㄧ嚎' : '绂荤嚎'" readonly></el-input>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div class="otherButtonfix">
+ <el-form label-position="left">
+ <el-form-item>
+ <el-button type="primary" @click="openBindDialog(deviceInfo.id)">缁戝畾</el-button>
+ <el-button @click="closeBindDialog(deviceInfo.taskId)">瑙g粦</el-button>
+ </el-form-item>
+ </el-form>
+ </div>
+ </el-card>
+ </div>
+ </el-row>
+ </el-col>
+
+ <!-- 缁戝畾浠诲姟寮规 -->
+ <el-dialog v-model="bindDialogVisible" title="閫夋嫨鏁版嵁">
+ <el-table :data="bindData" highlight-current-row @row-click="handleRowClick">
+ <el-table-column prop="orderNo" label="WMS涓嬪彂鍗曞彿" show-overflow-tooltip="" />
+ <el-table-column prop="taskNo" label="浠诲姟鍙�" show-overflow-tooltip="" />
+ <el-table-column prop="lotNo" label="鎵规鍙�" show-overflow-tooltip="" />
+ <el-table-column prop="skuNo" label="鐗╂枡缂栫爜" show-overflow-tooltip="" />
+ <el-table-column prop="skuName" label="鐗╂枡鍚嶇О" show-overflow-tooltip="" />
+ <el-table-column prop="boxType" label="瑙勬牸" show-overflow-tooltip="" />
+ <el-table-column prop="qty" label="鎬荤鏁�/璁″垝绠辨暟/棰勪及绠辨暟" show-overflow-tooltip="" />
+ </el-table>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="bindDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="confirmBinding">纭</el-button>
+ </div>
+ </el-dialog>
+ </el-container>
+</template>
+
+<script lang="ts" setup>
+import { ref, onMounted } from 'vue';
+import { GetWcsPackPlcList, GetWcsStackingRobotList, BindTaskForPLC, UnBindTaskForPLC } from '/@/api/wcs/wcsDevice';
+import { pageWcsOderTask } from '/@/api/device/wcsOderTask';
+import { ElMessageBox, ElMessage } from 'element-plus';
+import { signalR, stopConnection } from './signalR';
+//杩炴帴signalR 鐩戝惉鍙樻洿
+onMounted(async () => {
+ signalR.off('PublicCheckTask');
+ signalR.on('PublicCheckTask', (data: any) => {
+ var index = devicePointData.value.findIndex(s => s.id == data.id);
+ if (index !== -1) {
+ devicePointData.value.splice(index, 1, data);
+ }
+ });
+});
+
+//璁惧瀵瑰簲宸ヤ綅鏁版嵁
+const devicePointData = ref<any>([]);
+//閫変腑璁惧ID
+const selectedDeviceId = ref<any>();
+//閫変腑宸ヤ綅ID
+const selectedStationId = ref<any>();
+
+const bindDialogVisible = ref(false);
+const bindData = ref<any>([]);
+const selectedRow = ref<any>(null);
+const queryParams = ref<any>({});
+const tableParams = ref({
+ page: 1,
+ pageSize: 20,
+ total: 0,
+});
+//鑾峰彇璁惧瀵瑰簲鐨勫伐浣嶆暟鎹�
+const fetchStationData = async () => {
+ const res2 = await GetWcsStackingRobotList();
+ debugger;
+ devicePointData.value = res2.data.result;
+};
+fetchStationData();
+
+const handleQuery = async () => {
+ var res = await pageWcsOderTask(Object.assign(queryParams.value, tableParams.value));
+ bindData.value = res.data.result?.items ?? [];
+ tableParams.value.total = res.data.result?.total;
+};
+//鎵撳紑缁戝畾寮规
+function openBindDialog(id) {
+ selectedStationId.value = null;
+ selectedRow.value = null;
+
+ selectedStationId.value = id;
+ bindDialogVisible.value = true;
+
+ handleQuery();
+}
+//鐐瑰嚮琛屾椂璁剧疆閫変腑琛�
+function handleRowClick(row) {
+ selectedRow.value = row;
+}
+
+//纭缁戝畾鎿嶄綔
+function confirmBinding() {
+ if (selectedRow.value) {
+ //鎵嬪姩缁戝畾浠诲姟鍒癙LC
+ bindTaskForPLC(selectedStationId.value, selectedRow.value.id);
+
+ bindDialogVisible.value = false;
+ } else {
+ ElMessage.error('璇烽�夋嫨瑕佺粦瀹氱殑浠诲姟锛�');
+ }
+}
+const bindTaskForPLC = async (deviceId: any, oderTaskId: any) => {
+ const res = await BindTaskForPLC({ deviceId, oderTaskId });
+ if (res.status == 200) {
+ ElMessage.success('缁戝畾鎴愬姛锛�');
+ fetchStationData();
+ }
+}
+//瑙g粦鎿嶄綔
+function closeBindDialog(id) {
+ debugger;
+ ElMessageBox.confirm(`纭畾瀵硅鎵规浠诲姟瑙g粦鍚�?`, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning',
+ })
+ .then(async () => {
+ await closeTaskForPLC(id);
+ })
+ .catch(() => { });
+}
+const closeTaskForPLC = async (id: number) => {
+ const res = await UnBindTaskForPLC({ id });
+ if (res.status == 200) {
+ ElMessage.success('瑙g粦鎴愬姛锛�');
+ fetchStationData();
+ }
+}
+
+</script>
+
+<style scoped>
+.card-page {
+ width: 100%;
+ height: 50px;
+ display: flex;
+ text-align: center;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+}
+
+.card-page>button {
+ width: 150px;
+ height: 30px;
+}
+
+.card-container {
+ display: grid;
+ grid-template-columns: repeat(6, 1fr);
+ gap: 10px;
+}
+
+.other-box-card {
+ box-sizing: border-box;
+ background: linear-gradient(135deg, #66ccff, #3399ff);
+}
+
+.lineStatus {
+ position: absolute;
+ right: 0;
+ float: right;
+ height: 20px;
+ width: 20px;
+ border-radius: 20px;
+ background-color: #67C23A;
+}
+
+.linefix {
+ border-bottom: 1px solid rgb(197, 195, 195);
+ display: flex;
+ align-items: center;
+ height: 40px;
+ position: relative;
+ color: #fff;
+}
+
+.otherValuefix {
+ width: 100%;
+ height: 540px;
+ padding: 10px;
+ border-bottom: 1px solid rgb(197, 195, 195);
+}
+
+.otherButtonfix {
+ width: 100%;
+ height: 60px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 0;
+}
+
+.device-status-0 {
+ background-color: #58f709;
+}
+
+.device-status-1 {
+ background-color: red;
+}
+
+.dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: 20px;
+}
+
+.divDisplay {
+ display: none
+}
+</style>
\ No newline at end of file
diff --git a/Web/src/views/device/outboundSorting/signalR.ts b/Web/src/views/device/outboundSorting/signalR.ts
new file mode 100644
index 0000000..d9b25f2
--- /dev/null
+++ b/Web/src/views/device/outboundSorting/signalR.ts
@@ -0,0 +1,45 @@
+import * as SignalR from '@microsoft/signalr';
+import { getToken } from '/@/utils/axios-utils';
+
+// 鍒濆鍖朣ignalR瀵硅薄
+const connection = new SignalR.HubConnectionBuilder()
+ .configureLogging(SignalR.LogLevel.Information)
+ .withUrl(`${window.__env__.VITE_API_URL}/hubs/CheckTask?token=${getToken()}`, { transport: SignalR.HttpTransportType.WebSockets, skipNegotiation: true })
+ .withAutomaticReconnect({
+ nextRetryDelayInMilliseconds: () => {
+ return 5000; // 姣�5绉掗噸杩炰竴娆�
+ },
+ })
+ .build();
+
+connection.keepAliveIntervalInMilliseconds = 15 * 1000; // 蹇冭烦妫�娴�15s
+connection.serverTimeoutInMilliseconds = 30 * 60 * 1000; // 瓒呮椂鏃堕棿30m
+
+// 鍚姩杩炴帴
+connection.start().then(() => {
+ console.log('鍚姩杩炴帴checkTask');
+});
+// 鏂紑杩炴帴
+connection.onclose(async () => {
+ console.log('鏂紑杩炴帴checkTask');
+});
+// 閲嶈繛涓�
+connection.onreconnecting(() => {
+ console.log('鏈嶅姟鍣ㄥ凡鏂嚎checkTask');
+});
+// 閲嶈繛鎴愬姛
+connection.onreconnected(() => {
+ console.log('閲嶈繛鎴愬姛checkTask');
+});
+// 鍏抽棴杩炴帴鐨勬柟娉�
+async function stopConnection() {
+ try {
+ await connection.stop();
+ console.log('杩炴帴宸插叧闂�');
+ } catch (error) {
+ console.error('鍏抽棴杩炴帴鏃跺彂鐢熼敊璇�:', error);
+ }
+ }
+// connection.on('PublicPlcConn', () => {});
+
+export { connection as signalR,stopConnection };
--
Gitblit v1.8.0