Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d657068976 | |||
| 45fe6d1384 | |||
| f95ca89c0f | |||
| 1c5b475696 | |||
| 875090c8f6 | |||
| 1986f6dc06 | |||
| 6a5b4a640e | |||
| 14ff462b79 | |||
| a3dcfff0c2 | |||
| 263d18f6c6 | |||
| 9e1af92672 | |||
| 79fc895f4a | |||
| 33d1911609 | |||
| ce51fe383a | |||
| bf6f171066 | |||
| 579852e4bd | |||
| 99d6668cf2 | |||
| f384489dd0 | |||
| 9ea2702e92 | |||
| 49aa3223b8 | |||
| 5350baa820 | |||
| 9e88464064 | |||
| cf6adc6027 | |||
| 8db348817b | |||
| 5c350543e2 | |||
| d8fb3797e1 | |||
| 2d635c7415 | |||
| 8a61f237eb | |||
| 93d720f595 | |||
| 60fa5d7c97 | |||
| 648b9ddbd7 | |||
| b2f1573805 | |||
| 799043a848 | |||
| 6469db09f6 | |||
| c85b53ad46 | |||
| 89efbfca22 | |||
| a36b6451fb | |||
| e86cc463e1 | |||
| e340de9a51 | |||
| fc892364e0 | |||
| 22fefead7c | |||
| acd744e046 | |||
| e1d3acd92a | |||
| c91a72e9e0 | |||
| 79d5f2b0b5 | |||
| 66c6b0789a | |||
| ed386af29e | |||
| 520004b056 | |||
| 2d43d0c040 | |||
| 3cf123647b | |||
| 9691bcedb9 | |||
| 7160730c40 | |||
| e4d2d54fcc | |||
| dc3ec1d9e2 | |||
| b78f8886eb | |||
| 6b29cd482f | |||
| e12ca2f02b | |||
| aed0a69c8c | |||
| d16b29ed6b | |||
| 3a245faa2c | |||
| 22980e9f2a | |||
| a3b103a279 | |||
| 1cf596f729 | |||
| f98f33cae7 | |||
| 9637d9f0a3 | |||
| 7ffb3e46be |
34
DB/tbl_app_err_record.sql
Normal file
34
DB/tbl_app_err_record.sql
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
Navicat Premium Dump SQL
|
||||||
|
|
||||||
|
Source Server : localhost
|
||||||
|
Source Server Type : MySQL
|
||||||
|
Source Server Version : 80404 (8.4.4)
|
||||||
|
Source Host : localhost:3306
|
||||||
|
Source Schema : wcs_szkt
|
||||||
|
|
||||||
|
Target Server Type : MySQL
|
||||||
|
Target Server Version : 80404 (8.4.4)
|
||||||
|
File Encoding : 65001
|
||||||
|
|
||||||
|
Date: 24/05/2025 15:13:32
|
||||||
|
*/
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for tbl_app_err_record
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `tbl_app_err_record`;
|
||||||
|
CREATE TABLE `tbl_app_err_record` (
|
||||||
|
`record_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '记录号',
|
||||||
|
`area` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '报警区域',
|
||||||
|
`err_no` int NOT NULL COMMENT '报警编号',
|
||||||
|
`equipment_id` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备号',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '发生时间',
|
||||||
|
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (`record_id`) USING BTREE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
29813
DB/wcs_kate_suzhou.sql
Normal file
29813
DB/wcs_kate_suzhou.sql
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -55,7 +55,7 @@ public class WebApiPost
|
||||||
/// <param name="method"></param>
|
/// <param name="method"></param>
|
||||||
/// <param name="time"></param>
|
/// <param name="time"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ApiResponseInfo<TResponse> HttpPost<TRequest, TResponse>(TRequest requestEntity, string method = "", int time = 10000) where TRequest : class where TResponse : class, new()
|
public ApiResponseInfo<TResponse> HttpPost<TRequest, TResponse>(TRequest requestEntity, string method = "", int time = 10000, bool executeAction = true) where TRequest : class where TResponse : class, new()
|
||||||
{
|
{
|
||||||
ApiResponseInfo<TResponse> result = new()
|
ApiResponseInfo<TResponse> result = new()
|
||||||
{
|
{
|
||||||
|
|
@ -112,7 +112,10 @@ public class WebApiPost
|
||||||
result.ResponseTime = DateTime.Now;
|
result.ResponseTime = DateTime.Now;
|
||||||
TimeSpan ts = sw.Elapsed;
|
TimeSpan ts = sw.Elapsed;
|
||||||
result.UseTime = ts.TotalMilliseconds;
|
result.UseTime = ts.TotalMilliseconds;
|
||||||
_apiAction?.Invoke(result);
|
if(executeAction)
|
||||||
|
{
|
||||||
|
_apiAction?.Invoke(result);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
namespace CirculateTool;
|
namespace CirculateTool.Attribute;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 一个类里面的方法加上这个特性就表示需要被循环执行
|
/// 一个类里面的方法加上这个特性就表示需要被循环执行
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
/// <param name="methodDescription">方法描述</param>
|
/// <param name="methodDescription">方法描述</param>
|
||||||
/// <param name="tags">方法描述</param>
|
/// <param name="tags">方法描述</param>
|
||||||
[AttributeUsage(AttributeTargets.All)]
|
[AttributeUsage(AttributeTargets.All)]
|
||||||
public class CirculationAttribute(string? methodDescription = null, int circulationTime = 500, string[]? tags = null) : Attribute
|
public class CirculationAttribute(string? methodDescription = null, int circulationTime = 500, string[]? tags = null) : System.Attribute
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
47
Tools/CirculateTool/Attribute/CirculationTimeAttribute.cs
Normal file
47
Tools/CirculateTool/Attribute/CirculationTimeAttribute.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CirculateTool.Attribute;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在指定时间执行的任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="times"></param>
|
||||||
|
/// <param name="methodDescription"></param>
|
||||||
|
/// <param name="tags"></param>
|
||||||
|
/// <remarks>
|
||||||
|
/// 只能加载公共 void 方法上,
|
||||||
|
/// 不得与<see cref="CirculationAttribute"/>同时使用,若同时使用则此项不生效
|
||||||
|
/// </remarks>
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public class CirculationTimeAttribute(string[] times, string? methodDescription = null, string[]? tags = null) : System.Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 定时执行的时间
|
||||||
|
/// </summary>
|
||||||
|
/// <example>12:00</example>
|
||||||
|
/// <remarks>
|
||||||
|
/// 格式必须为:HH:mm,例如:12:00,其他格式将无效
|
||||||
|
/// </remarks>
|
||||||
|
public string[] Times { get; } = times;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述
|
||||||
|
/// </summary>
|
||||||
|
public string? MethodDescription { get; } = methodDescription;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 标签
|
||||||
|
/// </summary>
|
||||||
|
public string[]? Tags { get; } = tags;
|
||||||
|
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Join(",", Times);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
36
Tools/CirculateTool/Entity/TimeTask.cs
Normal file
36
Tools/CirculateTool/Entity/TimeTask.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CirculateTool.Entity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 按时执行的任务的定时类
|
||||||
|
/// </summary>
|
||||||
|
public class TimeTask
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 执行任务的时间
|
||||||
|
/// </summary>
|
||||||
|
public string? ExecuteTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务
|
||||||
|
/// </summary>
|
||||||
|
public Action? Action { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述
|
||||||
|
/// </summary>
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否已经执行
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRun { get; set; } = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using CirculateTool.Attribute;
|
||||||
|
using CirculateTool.Entity;
|
||||||
|
|
||||||
namespace CirculateTool;
|
namespace CirculateTool;
|
||||||
/*
|
/*
|
||||||
|
|
@ -14,6 +16,10 @@ namespace CirculateTool;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StartCirculation
|
public class StartCirculation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 指定时间执行的方法类
|
||||||
|
/// </summary>
|
||||||
|
protected static List<TimeTask> _timeTasks = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 触发的异常
|
/// 触发的异常
|
||||||
|
|
@ -39,7 +45,7 @@ public class StartCirculation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assembly"></param>
|
/// <param name="assembly"></param>
|
||||||
/// <param name="instanceParams"></param>
|
/// <param name="instanceParams"></param>
|
||||||
public virtual void StartAssemblyCirculation(Assembly assembly, object[]? instanceParams = null)
|
public void StartAssemblyCirculation(Assembly assembly, object[]? instanceParams = null)
|
||||||
{
|
{
|
||||||
Type[] types = assembly.GetTypes();
|
Type[] types = assembly.GetTypes();
|
||||||
if (types.Length == 0) return;
|
if (types.Length == 0) return;
|
||||||
|
|
@ -53,6 +59,8 @@ public class StartCirculation
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 执行按时执行的任务 ---- 方法内判断,若没有此类方法则不会执行 */
|
||||||
|
StartTimeTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -65,20 +73,43 @@ public class StartCirculation
|
||||||
var methods = type.GetMethods();
|
var methods = type.GetMethods();
|
||||||
foreach (var method in methods)
|
foreach (var method in methods)
|
||||||
{
|
{
|
||||||
var attributes = method.GetCustomAttributes(false);
|
object[] attributes = method.GetCustomAttributes(false);
|
||||||
foreach (var attribute in attributes)
|
if(attributes.Length == 0) continue;
|
||||||
|
foreach (object attribute in attributes)
|
||||||
{
|
{
|
||||||
if (attribute is not CirculationAttribute needDurable) continue;
|
if(attribute == default) continue;
|
||||||
string methodDescription = needDurable.MethodDescription ?? $"{type.Name}.{method.Name}";
|
/* 定时执行的任务 */
|
||||||
bool Action() => (bool)(method.Invoke(Activator.CreateInstance(type, instanceParams), []) ?? false);
|
if(attribute is CirculationAttribute needDurable)
|
||||||
StartTask(Action, methodDescription, needDurable.CirculationTime);
|
{
|
||||||
break;
|
string methodDescription = needDurable.MethodDescription ?? $"{type.Name}.{method.Name}";
|
||||||
|
bool Action() => (bool)(method.Invoke(Activator.CreateInstance(type, instanceParams), []) ?? false);
|
||||||
|
StartTask(Action, methodDescription, needDurable.CirculationTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* 每天指定时间执行 */
|
||||||
|
if (attribute is CirculationTimeAttribute timeCirculate)
|
||||||
|
{
|
||||||
|
string methodDescription = timeCirculate.MethodDescription ?? $"{type.Name}.{method.Name}";
|
||||||
|
MessageHandler?.Invoke($"定时器任务:{methodDescription},已经添加,执行时间为:{timeCirculate}");
|
||||||
|
foreach (var time in timeCirculate.Times)
|
||||||
|
{
|
||||||
|
_timeTasks.Add(new TimeTask
|
||||||
|
{
|
||||||
|
ExecuteTime = time,
|
||||||
|
Action = () => method.Invoke(Activator.CreateInstance(type, instanceParams), []),
|
||||||
|
Description = methodDescription,
|
||||||
|
IsRun = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* END */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开启一个方法
|
/// 开启一个方法 ---- 隔一定时间执行一次
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="action"></param>
|
/// <param name="action"></param>
|
||||||
/// <param name="description"></param>
|
/// <param name="description"></param>
|
||||||
|
|
@ -107,4 +138,43 @@ public class StartCirculation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行按时间执行的任务
|
||||||
|
/// </summary>
|
||||||
|
public virtual async void StartTimeTask()
|
||||||
|
{
|
||||||
|
if(_timeTasks.Count == 0) return;
|
||||||
|
CancellationTokenSource cts = new();
|
||||||
|
PeriodicTimer timer = new(new TimeSpan(0, 0, 0, 1, 0));
|
||||||
|
while (await timer.WaitForNextTickAsync(cts.Token))
|
||||||
|
{
|
||||||
|
string timeStr = DateTime.Now.ToString("HH:mm");
|
||||||
|
List<Task> taskList = [];
|
||||||
|
foreach (var task in _timeTasks)
|
||||||
|
{
|
||||||
|
taskList.Add(Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
if (task.ExecuteTime != timeStr)
|
||||||
|
{
|
||||||
|
task.IsRun = false; // 当时刻不匹配时,重置任务状态
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (task.ExecuteTime == timeStr && !task.IsRun) // 当时间匹配且任务未执行时,执行任务
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
task.Action!();
|
||||||
|
task.IsRun = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExceptionHandler?.Invoke(task.Description ?? task.Action!.Method.Name, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
Task.WaitAll([.. taskList]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -56,6 +56,12 @@ public class WcsLog
|
||||||
/// <param name="strLog"></param>
|
/// <param name="strLog"></param>
|
||||||
public void WriteSystemLog(string strLog) => WriteLog("系统日志", strLog);
|
public void WriteSystemLog(string strLog) => WriteLog("系统日志", strLog);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写系统日志
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="strLog"></param>
|
||||||
|
public void WriteSystemLog(StringBuilder strLog) => WriteLog("系统日志", strLog.ToString(), false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 写事件日志
|
/// 写事件日志
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,45 @@
|
||||||
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 申请入库
|
/// 申请入库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ApplyInRequest
|
public class ApplyInRequest
|
||||||
{
|
{
|
||||||
|
public ApplyInRequest(string? point, string? vehicleNo, string? codeMessage = "", string? remark = "")
|
||||||
|
{
|
||||||
|
Point = point;
|
||||||
|
VehicleNo = vehicleNo;
|
||||||
|
CodeMessage = codeMessage;
|
||||||
|
Remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplyInRequest() { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 申请点位
|
/// 申请点位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("point")]
|
||||||
public string? Point { get; set; }
|
public string? Point { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具号
|
/// 载具号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("vehicleNo")]
|
||||||
public string? VehicleNo { get; set; }
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 条码信息
|
/// 条码信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("codeMessage")]
|
||||||
public string? CodeMessage { get; set; }
|
public string? CodeMessage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备注
|
/// 备注
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonProperty("remark")]
|
||||||
public string? Remark { get; set; }
|
public string? Remark { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上报输送线按钮
|
||||||
|
/// </summary>
|
||||||
|
public class ConceyButtonClickRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("vehicleNo")]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣选站台
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("location")]
|
||||||
|
public string? Location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("remark")]
|
||||||
|
public string? Remark { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电子标签确认按钮按下请求数据
|
||||||
|
/// </summary>
|
||||||
|
public class ElTagComfirmButtonClickRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("taskGroup")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("taskType")]
|
||||||
|
public int? TaskType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("vehicleNo")]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("orderId")]
|
||||||
|
public string? OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("taskId")]
|
||||||
|
public string? TaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("location")]
|
||||||
|
public string? Location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料ID
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("goodsId")]
|
||||||
|
public string? GoodsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("goodsName")]
|
||||||
|
public string? GoodsName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 需求数量
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("needNum")]
|
||||||
|
public int? NeedNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 确认数量
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("confirmNum")]
|
||||||
|
public int? ConfirmNum { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
18
WcsMain/ApiClient/DataEntity/WmsEntity/RequestBackRequest.cs
Normal file
18
WcsMain/ApiClient/DataEntity/WmsEntity/RequestBackRequest.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
public class RequestBackRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
public RequestBackRequest(string? vehicleId) => VehicleId = vehicleId;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("vehicleId")]
|
||||||
|
public string? VehicleId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Text.Json.Serialization;
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
|
@ -10,31 +11,31 @@ public class SendWmsTaskStatusRequest
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务号
|
/// 任务号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("taskId")]
|
[JsonProperty("taskId")]
|
||||||
public string? TaskId { get; set; }
|
public string? TaskId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务状态
|
/// 任务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("taskStatus")]
|
[JsonProperty("taskStatus")]
|
||||||
public int? TaskStatus { get; set; }
|
public int? TaskStatus { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务类型
|
/// 任务类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("destination")]
|
[JsonProperty("destination")]
|
||||||
public string? Destination { get; set; }
|
public string? Destination { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具号
|
/// 载具号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("vehicleNo")]
|
[JsonProperty("vehicleNo")]
|
||||||
public string? VehicleNo { get; set; }
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 信息
|
/// 信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("message")]
|
[JsonProperty("message")]
|
||||||
public string? Message { get; set; }
|
public string? Message { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Text.Json.Serialization;
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
|
@ -7,21 +8,27 @@ namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UploadPickStandRequest
|
public class UploadPickStandRequest
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("taskGroup")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具号
|
/// 载具号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("vehicleNo")]
|
[JsonProperty("vehicleNo")]
|
||||||
public string? VehicleNo { get; set; }
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拣选站台
|
/// 拣选站台
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("pickStand")]
|
[JsonProperty("location")]
|
||||||
public string? PickStand { get; set; }
|
public string? Location { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备注
|
/// 备注
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("remark")]
|
[JsonProperty("remark")]
|
||||||
public string? Remark { get; set; }
|
public string? Remark { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传堆垛机是否报错的请求实体
|
||||||
|
/// </summary>
|
||||||
|
public class UploadStackerStatusRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备号
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("equipment")]
|
||||||
|
public int? Equipment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否报错 --- 0:不报错;1:不可用
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("error")]
|
||||||
|
public int? Error { get; set; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"equipment":1,
|
||||||
|
"error":0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"equipment":2,
|
||||||
|
"error":1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Text.Json.Serialization;
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
|
@ -7,12 +8,12 @@ public class WmsResponse
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 代码
|
/// 代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("code")]
|
[JsonProperty("code")]
|
||||||
public int? Code { get; set; }
|
public int? Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 信息
|
/// 信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("message")]
|
[JsonProperty("message")]
|
||||||
public string? Message { get; set; }
|
public string? Message { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.ControllerFilter;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 权限验证
|
||||||
|
/// </summary>
|
||||||
|
public class WcsAuthorizationAttribute : Attribute, IAuthorizationFilter
|
||||||
|
{
|
||||||
|
public void OnAuthorization(AuthorizationFilterContext context)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var request = context.HttpContext.Request;
|
||||||
|
var headers = request.Headers;
|
||||||
|
var token = headers.Authorization;
|
||||||
|
if(string.IsNullOrEmpty(token))
|
||||||
|
{
|
||||||
|
context.Result = new Microsoft.AspNetCore.Mvc.UnauthorizedResult();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
_ = ex;
|
||||||
|
context.Result = new Microsoft.AspNetCore.Mvc.UnauthorizedResult();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.Service.BoardService;
|
||||||
|
using WcsMain.ApiServe.Vo.Board;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.BoardController;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 二维大屏数据接口
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/board/board2")]
|
||||||
|
[ApiController]
|
||||||
|
public class Board2Controller(Board2Service board2Service) : ControllerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取堆垛机运行效率
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getStackerRunningEfficiency")]
|
||||||
|
public StackerRunningEfficiencyResponse GetStackerRunningEfficiency() => board2Service.GetStackerRunningEfficiency();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据堆垛机获取错误信息数量
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getErrByCrane")]
|
||||||
|
public List<NameValueData<int>> GetErrByCrane() => board2Service.GetErrByCrane();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据故障类型获取错误信息数量
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getErrByCategory")]
|
||||||
|
public List<NameValueData<int>> GetErrByCategory() => board2Service.GetErrByCategory();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取错误信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getErrInfo")]
|
||||||
|
public List<ErrorDetail> GetErrInfo() => board2Service.GetErrInfo();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取任务数量
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getTaskCount")]
|
||||||
|
public TaskCountResponse GetTaskCount() => board2Service.GetTaskCount();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WMSEntity.Convey;
|
||||||
|
|
||||||
|
public class DisposeVehicleRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("location")]
|
||||||
|
public string? Location { get; set;}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WMSEntity.Convey;
|
||||||
|
|
||||||
|
public class GetConveyTaskRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskGroup")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("vehicleNo")]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskType")]
|
||||||
|
public int? TaskType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("location")]
|
||||||
|
public string[]? Locations { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("remark")]
|
||||||
|
public string? Remark { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
using DataCheck;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WMSEntity.ElTag;
|
||||||
|
|
||||||
|
public class GetElTagTaskRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务组
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskGroup")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskType")]
|
||||||
|
[DataRules]
|
||||||
|
public int? TaskType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("vehicleNo")]
|
||||||
|
[DataRules]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("orderId")]
|
||||||
|
public string? OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskData")]
|
||||||
|
public ElTagTaskdata[]? TaskData { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ElTagTaskdata
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("eTaskId")]
|
||||||
|
public string? ETaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS任务号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("taskId")]
|
||||||
|
public string? TaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("location")]
|
||||||
|
[DataRules]
|
||||||
|
public string? Location { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物品编号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("goodsId")]
|
||||||
|
public string? GoodsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物品名称
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("goodsName")]
|
||||||
|
public string? GoodsName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 需求数量
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("needNum")]
|
||||||
|
[DataRules]
|
||||||
|
public int? NeedNum { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ElTag;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WcsDto.Convey;
|
||||||
|
|
||||||
|
public class QueryConveyTaskWithPageRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询的字符串
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("searchStr")]
|
||||||
|
public string? SearchStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("conveyTaskType")]
|
||||||
|
public List<int>? TaskType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务状态
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("conveyTaskStatus")]
|
||||||
|
public List<int>? TaskStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询时间范围
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("timeRange")]
|
||||||
|
public List<DateTime>? TimeRange { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分页信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("page")]
|
||||||
|
public ConveyTaskPage? Page { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class ConveyTaskPage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 每页大小
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("pageSize")]
|
||||||
|
public int PageSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前页数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("pageIndex")]
|
||||||
|
public int PageIndex { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WcsDto.ElTag;
|
||||||
|
|
||||||
|
public class QueryLocationWithPageRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询的字符串
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("searchStr")]
|
||||||
|
public string? SearchStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分页信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("page")]
|
||||||
|
public ElTagLocationPage? Page { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ElTagLocationPage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 每页大小
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("pageSize")]
|
||||||
|
public int PageSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前页数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("pageIndex")]
|
||||||
|
public int PageIndex { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -11,6 +11,12 @@ public class QueryTaskRequest
|
||||||
[JsonPropertyName("searchStr")]
|
[JsonPropertyName("searchStr")]
|
||||||
public string? SearchStr { get; set; }
|
public string? SearchStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 任务类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("elTagTaskType")]
|
||||||
|
public List<int>? TaskType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务状态
|
/// 任务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WcsDto.Scan;
|
||||||
|
|
||||||
|
public class QueryScanRecordWithPageRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 模糊查询字符串
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("searchStr")]
|
||||||
|
public string? SearchStr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询时间范围
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("timeRange")]
|
||||||
|
public List<DateTime>? TimeRange { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分页信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("page")]
|
||||||
|
public ScaanRecordPage? Page { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ScaanRecordPage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 每页大小
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("pageSize")]
|
||||||
|
public int PageSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前页数
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("pageIndex")]
|
||||||
|
public int PageIndex { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WcsDto.Stacker;
|
||||||
|
|
||||||
|
|
||||||
|
public class QueryErrInfoRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 区域
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("area")]
|
||||||
|
public string? Area { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 报警编号
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("errNo")]
|
||||||
|
public int? ErrNo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.Dto.WcsDto.StackerConvey;
|
||||||
|
|
||||||
|
public class StackerConveyStatusResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// WCS 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("wcsLocation")]
|
||||||
|
public string? WcsLocation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WMS 点位
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("wmsLocation")]
|
||||||
|
public string? WmsLocation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位名称
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("locationName")]
|
||||||
|
public string? LocationName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// plc 的位置
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("plcLocation")]
|
||||||
|
public string? PlcLocation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 区域
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("area")]
|
||||||
|
public string? Area { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位类型
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("locationType")]
|
||||||
|
public int? LocationType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点位状态
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("locationStatus")]
|
||||||
|
public int? LocationStatus { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写入方式
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("writeType")]
|
||||||
|
public int? WriteType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("remark")]
|
||||||
|
public string? Remark { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询结果
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("msg")]
|
||||||
|
public string? Message { get; set; } = "-";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 条码
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("code")]
|
||||||
|
public string? Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动作允许
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("allowAction")]
|
||||||
|
public bool? AllowAction { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,12 @@ public class LoginResponse
|
||||||
[JsonPropertyName("userName")]
|
[JsonPropertyName("userName")]
|
||||||
public string? UserName { get; set; }
|
public string? UserName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// token
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("token")]
|
||||||
|
public string? Token { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单
|
/// 菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -9,21 +9,19 @@ namespace WcsMain.ApiServe.Controllers.ThreeDController;
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class TaskController(TaskService taskService) : ControllerBase
|
public class TaskController(TaskService taskService) : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly TaskService _taskService = taskService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询WMS任务
|
/// 查询WMS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getWmsTask")]
|
[HttpGet("getWmsTask")]
|
||||||
public WcsApiResponse<List<AppWmsTask>> GetWmsTask() => _taskService.GetWmsTask();
|
public WcsApiResponse<List<AppWmsTask>> GetWmsTask() => taskService.GetWmsTask();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询WMS任务
|
/// 查询WMS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getWmsTaskNotEnd")]
|
[HttpGet("getWmsTaskNotEnd")]
|
||||||
public WcsApiResponse<List<AppWmsTask>> GetWmsTaskNoEnd() => _taskService.GetWmsTaskNoEnd();
|
public WcsApiResponse<List<AppWmsTask>> GetWmsTaskNoEnd() => taskService.GetWmsTaskNoEnd();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据 plcId 查询任务
|
/// 根据 plcId 查询任务
|
||||||
|
|
@ -31,5 +29,5 @@ public class TaskController(TaskService taskService) : ControllerBase
|
||||||
/// <param name="plcId"></param>
|
/// <param name="plcId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("queryRunningTask")]
|
[HttpGet("queryRunningTask")]
|
||||||
public WcsApiResponse<AppWcsTask> GetWcsTask([FromQuery(Name = "plcId")] int? plcId) => _taskService.GetWcsTask(plcId);
|
public WcsApiResponse<AppWcsTask> GetWcsTask([FromQuery(Name = "plcId")] int? plcId) => taskService.GetWcsTask(plcId);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ApiAccept;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ApiAccept;
|
||||||
|
|
@ -10,15 +11,14 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/apiAccept")]
|
[Route("api/wcs/apiAccept")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class ApiAcceptController(ApiAcceptService apiAcceptService) : ControllerBase
|
public class ApiAcceptController(ApiAcceptService apiAcceptService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly ApiAcceptService _apiAcceptService = apiAcceptService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的WCS任务
|
/// 查询所有的WCS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getApiAcceptWithPage")]
|
[HttpPost("getApiAcceptWithPage")]
|
||||||
public WcsApiResponse<List<AppApiAccept>> GetApiAcceptWithPage([FromBody] GetApiAcceptWithPageRequest request) => _apiAcceptService.GetApiAcceptWithPage(request);
|
public WcsApiResponse<List<AppApiAccept>> GetApiAcceptWithPage([FromBody] GetApiAcceptWithPageRequest request) => apiAcceptService.GetApiAcceptWithPage(request);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ApiRequest;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ApiRequest;
|
||||||
|
|
@ -10,23 +11,22 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/apiRequest")]
|
[Route("api/wcs/apiRequest")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class ApiRequestController(ApiRequestService apiRequestService) : ControllerBase
|
public class ApiRequestController(ApiRequestService apiRequestService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly ApiRequestService _apiRequestService = apiRequestService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的WCS请求其他系统的记录
|
/// 查询所有的WCS请求其他系统的记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getApiRequest")]
|
[HttpGet("getApiRequest")]
|
||||||
public WcsApiResponse<List<AppApiRequest>> GetApiRequest() => _apiRequestService.GetApiRequest();
|
public WcsApiResponse<List<AppApiRequest>> GetApiRequest() => apiRequestService.GetApiRequest();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的WCS任务
|
/// 查询所有的WCS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getApiRequestWithPage")]
|
[HttpPost("getApiRequestWithPage")]
|
||||||
public WcsApiResponse<List<AppApiRequest>> GetApiRequestWithPage([FromBody] GetApiRequestWithPageRequest request) => _apiRequestService.GetApiRequestWithPage(request);
|
public WcsApiResponse<List<AppApiRequest>> GetApiRequestWithPage([FromBody] GetApiRequestWithPageRequest request) => apiRequestService.GetApiRequestWithPage(request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Config;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Config;
|
||||||
|
|
@ -10,18 +11,17 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/config")]
|
[Route("api/wcs/config")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class ConfigController(ConfigService configService) : ControllerBase
|
public class ConfigController(ConfigService configService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly ConfigService _configService = configService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询配置项
|
/// 查询配置项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="configKey"></param>
|
/// <param name="configKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getConfig")]
|
[HttpGet("getConfig")]
|
||||||
public WcsApiResponse<List<AppConfig>> GetConfig([FromQuery(Name = "configKey")] string? configKey) => _configService.GetConfig(configKey);
|
public WcsApiResponse<List<AppConfig>> GetConfig([FromQuery(Name = "configKey")] string? configKey) => configService.GetConfig(configKey);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页请求,获取配置项
|
/// 分页请求,获取配置项
|
||||||
|
|
@ -29,7 +29,7 @@ public class ConfigController(ConfigService configService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getConfigWithPage")]
|
[HttpPost("getConfigWithPage")]
|
||||||
public WcsApiResponse<List<AppConfig>> GetConfigWithPage([FromBody] GetConfigWithPageRequest request) => _configService.GetConfigWithPage(request);
|
public WcsApiResponse<List<AppConfig>> GetConfigWithPage([FromBody] GetConfigWithPageRequest request) => configService.GetConfigWithPage(request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加或者修改配置项
|
/// 添加或者修改配置项
|
||||||
|
|
@ -37,5 +37,5 @@ public class ConfigController(ConfigService configService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("editeConfig")]
|
[HttpPost("editeConfig")]
|
||||||
public WcsApiResponse EditeConfig([FromBody] EditeConfigRequest request) => _configService.EditeConfig(request);
|
public WcsApiResponse EditeConfig([FromBody] EditeConfigRequest request) => configService.EditeConfig(request);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Convey;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.ApiServe.Service.WcsService;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Route("api/wcs/conveyTask")]
|
||||||
|
[ApiController]
|
||||||
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
|
public class ConveyTaskController(ConveyService conveyService) : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分页查询箱式线任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("queryConveyTaskWithPage")]
|
||||||
|
public WcsApiResponse<int, List<AppConveyTask>> QueryConveyTaskWithPage([FromBody] QueryConveyTaskWithPageRequest request) => conveyService.QueryConveyTaskWithPage(request);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ElTag;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.ElTag;
|
||||||
|
|
@ -16,22 +17,17 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/elTag")]
|
[Route("api/wcs/elTag")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class ElTagController(ElTagService elTagService) : ControllerBase
|
public class ElTagController(ElTagService elTagService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly ElTagService _elTagService = elTagService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 向标签发送显示数字
|
/// 向标签发送显示数字
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("showNum")]
|
[HttpPost("showNum")]
|
||||||
public WcsApiResponse ShowNum([FromBody] ShowNumRequest request)
|
public WcsApiResponse ShowNum([FromBody] ShowNumRequest request) => elTagService.ShowNum(request);
|
||||||
{
|
|
||||||
return _elTagService.ShowNum(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询电子标签任务表
|
/// 分页查询电子标签任务表
|
||||||
|
|
@ -39,10 +35,7 @@ public class ElTagController(ElTagService elTagService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("queryTaskWithPage")]
|
[HttpPost("queryTaskWithPage")]
|
||||||
public WcsApiResponse<int, List<AppElTagTask>> QueryTaskWithPage([FromBody] QueryTaskRequest request)
|
public WcsApiResponse<int, List<AppElTagTask>> QueryTaskWithPage([FromBody] QueryTaskRequest request) => elTagService.QueryTaskWithPage(request);
|
||||||
{
|
|
||||||
return _elTagService.QueryTaskWithPage(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑电子标签任务信息
|
/// 编辑电子标签任务信息
|
||||||
|
|
@ -50,11 +43,7 @@ public class ElTagController(ElTagService elTagService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("editTaskInfo")]
|
[HttpPost("editTaskInfo")]
|
||||||
public WcsApiResponse EditTaskInfo([FromBody] EditTaskInfoRequest request)
|
public WcsApiResponse EditTaskInfo([FromBody] EditTaskInfoRequest request) => elTagService.EditTaskInfo(request);
|
||||||
{
|
|
||||||
return _elTagService.EditTaskInfo(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加一个电子标签任务信息
|
/// 添加一个电子标签任务信息
|
||||||
|
|
@ -62,11 +51,14 @@ public class ElTagController(ElTagService elTagService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("addTask")]
|
[HttpPost("addTask")]
|
||||||
public WcsApiResponse AddTaskInfo([FromBody] AddTaskInfoRequest request)
|
public WcsApiResponse AddTaskInfo([FromBody] AddTaskInfoRequest request) => elTagService.AddTaskInfo(request);
|
||||||
{
|
|
||||||
return _elTagService.AddTaskInfo(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分页查询电子标签库位表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("queryLocationWithPage")]
|
||||||
|
public WcsApiResponse<int, List<AppElTagLocation>> QueryLocationWithPage([FromBody] QueryLocationWithPageRequest request) => elTagService.QueryLocationWithPage(request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.Equipment;
|
using WcsMain.ApiServe.Controllers.Dto.Equipment;
|
||||||
|
|
@ -13,21 +14,20 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/equipment")]
|
[Route("api/wcs/equipment")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class EquipmentController(EquipmentService equipmentService) : ControllerBase
|
public class EquipmentController(EquipmentService equipmentService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly EquipmentService _equipmentService = equipmentService;
|
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("queryStackerInfo")]
|
[HttpGet("queryStackerInfo")]
|
||||||
public WcsApiResponse<List<StackerStatusResponse>> GetStackerInfo() => _equipmentService.GetStackerInfo();
|
public WcsApiResponse<List<StackerStatusResponse>> GetStackerInfo() => equipmentService.GetStackerInfo();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询库前输送机信息
|
/// 查询库前输送机信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("queryStackerConveyInfo")]
|
[HttpGet("queryStackerConveyInfo")]
|
||||||
public WcsApiResponse<List<ConveyStatusResponse>> GetConveyInfo() => _equipmentService.GetConveyInfo();
|
public WcsApiResponse<List<ConveyStatusResponse>> GetConveyInfo() => equipmentService.GetConveyInfo();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -36,7 +36,7 @@ public class EquipmentController(EquipmentService equipmentService) : Controller
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("resetStacker")]
|
[HttpPost("resetStacker")]
|
||||||
public WcsApiResponse ResetStacker([FromBody] ResetStackerRequest request) => _equipmentService.ResetStacker(request);
|
public WcsApiResponse ResetStacker([FromBody] ResetStackerRequest request) => equipmentService.ResetStacker(request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 堆垛机继续运行
|
/// 堆垛机继续运行
|
||||||
|
|
@ -44,5 +44,5 @@ public class EquipmentController(EquipmentService equipmentService) : Controller
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("stackerContinue")]
|
[HttpPost("stackerContinue")]
|
||||||
public WcsApiResponse StackerContinue([FromBody] StackerContinueRequest request) => _equipmentService.StackerContinue(request);
|
public WcsApiResponse StackerContinue([FromBody] StackerContinueRequest request) => equipmentService.StackerContinue(request);
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Location;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Location;
|
||||||
|
|
@ -10,30 +11,23 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/location")]
|
[Route("api/wcs/location")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class LocationController(LocationService locationService) : ControllerBase
|
public class LocationController(LocationService locationService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly LocationService _locationService = locationService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的点位状态
|
/// 查询所有的点位状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getLocation")]
|
[HttpGet("getLocation")]
|
||||||
public WcsApiResponse<List<AppLocation>> GetLocation()
|
public WcsApiResponse<List<AppLocation>> GetLocation() => locationService.GetLocation();
|
||||||
{
|
|
||||||
return _locationService.GetLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询所有的点位状态
|
/// 分页查询所有的点位状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getLocationWithPage")]
|
[HttpPost("getLocationWithPage")]
|
||||||
public WcsApiResponse<List<AppLocation>> GetLocationWithPage([FromBody] GetLocationWithPageRequest request)
|
public WcsApiResponse<List<AppLocation>> GetLocationWithPage([FromBody] GetLocationWithPageRequest request) => locationService.GetLocationWithPage(request);
|
||||||
{
|
|
||||||
return _locationService.GetLocationWithPage(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新点位信息
|
/// 更新点位信息
|
||||||
|
|
@ -41,8 +35,6 @@ public class LocationController(LocationService locationService) : ControllerBas
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("updateLocation")]
|
[HttpPost("updateLocation")]
|
||||||
public WcsApiResponse UpdateLocation([FromBody] UpdateLocationRequest request)
|
public WcsApiResponse UpdateLocation([FromBody] UpdateLocationRequest request) => locationService.UpdateLocation(request);
|
||||||
{
|
|
||||||
return _locationService.UpdateLocation(request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Menu;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Menu;
|
||||||
|
|
@ -10,21 +11,17 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/menu")]
|
[Route("api/wcs/menu")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class MenuController(MenuService menuService) : ControllerBase
|
public class MenuController(MenuService menuService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly MenuService _menuService = menuService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询菜单
|
/// 分页查询菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getMenuWithPage")]
|
[HttpPost("getMenuWithPage")]
|
||||||
public WcsApiResponse<List<AppMenu>> GetMenuWithPage([FromBody] GetMenuWithPageRequest request)
|
public WcsApiResponse<List<AppMenu>> GetMenuWithPage([FromBody] GetMenuWithPageRequest request) => menuService.GetMenuWithPage(request);
|
||||||
{
|
|
||||||
return _menuService.GetMenuWithPage(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新菜单信息
|
/// 更新菜单信息
|
||||||
|
|
@ -32,10 +29,7 @@ public class MenuController(MenuService menuService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("updateMenu")]
|
[HttpPost("updateMenu")]
|
||||||
public WcsApiResponse UpdateMenu([FromBody] UpdateMenuRequest request)
|
public WcsApiResponse UpdateMenu([FromBody] UpdateMenuRequest request) => menuService.UpdateMenu(request);
|
||||||
{
|
|
||||||
return _menuService.UpdateMenu(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加菜单信息
|
/// 添加菜单信息
|
||||||
|
|
@ -43,10 +37,6 @@ public class MenuController(MenuService menuService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("addMenu")]
|
[HttpPost("addMenu")]
|
||||||
public WcsApiResponse AddMenu([FromBody] AddMenuRequest request)
|
public WcsApiResponse AddMenu([FromBody] AddMenuRequest request) => menuService.AddMenu(request);
|
||||||
{
|
|
||||||
return _menuService.AddMenu(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.PLC;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.PLC;
|
||||||
|
|
@ -10,20 +11,16 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/plc")]
|
[Route("api/wcs/plc")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class PlcController(PlcService plcService) : ControllerBase
|
public class PlcController(PlcService plcService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly PlcService _plcService = plcService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询plc
|
/// 查询plc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getPlc")]
|
[HttpGet("getPlc")]
|
||||||
public WcsApiResponse<List<AppPLC>> GetPlc()
|
public WcsApiResponse<List<AppPLC>> GetPlc() => plcService.GetPlc();
|
||||||
{
|
|
||||||
return _plcService.GetPlc();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加或者修改配置项
|
/// 添加或者修改配置项
|
||||||
|
|
@ -31,11 +28,7 @@ public class PlcController(PlcService plcService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("editePlc")]
|
[HttpPost("editePlc")]
|
||||||
public WcsApiResponse EditePlc([FromBody] EditePLCRequest request)
|
public WcsApiResponse EditePlc([FromBody] EditePLCRequest request) => plcService.EditePlc(request);
|
||||||
{
|
|
||||||
return _plcService.EditePlc(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加或者修改配置项
|
/// 添加或者修改配置项
|
||||||
|
|
@ -43,8 +36,6 @@ public class PlcController(PlcService plcService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("deletePlc")]
|
[HttpDelete("deletePlc")]
|
||||||
public WcsApiResponse DeletePlc([FromQuery(Name = "plcId")] int? plcId)
|
public WcsApiResponse DeletePlc([FromQuery(Name = "plcId")] int? plcId) => plcService.DeletePlc(plcId);
|
||||||
{
|
|
||||||
return _plcService.DeletePlc(plcId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.DB;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.DB;
|
||||||
|
|
@ -10,21 +11,16 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/db")]
|
[Route("api/wcs/db")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class PlcDbController(PlcDbService plcDbService) : ControllerBase
|
public class PlcDbController(PlcDbService plcDbService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly PlcDbService _plcDbService = plcDbService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询 db
|
/// 查询 db
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getDB")]
|
[HttpGet("getDB")]
|
||||||
public WcsApiResponse<List<AppDB>> GetDB()
|
public WcsApiResponse<List<AppDB>> GetDB() => plcDbService.GetDB();
|
||||||
{
|
|
||||||
return _plcDbService.GetDB();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加或者修改db项
|
/// 添加或者修改db项
|
||||||
|
|
@ -32,10 +28,7 @@ public class PlcDbController(PlcDbService plcDbService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("addOrUpdate")]
|
[HttpPost("addOrUpdate")]
|
||||||
public WcsApiResponse EditeDB([FromBody] EditeDBRequest request)
|
public WcsApiResponse EditeDB([FromBody] EditeDBRequest request) => plcDbService.EditePlc(request);
|
||||||
{
|
|
||||||
return _plcDbService.EditePlc(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除一个DB信息
|
/// 删除一个DB信息
|
||||||
|
|
@ -43,10 +36,7 @@ public class PlcDbController(PlcDbService plcDbService) : ControllerBase
|
||||||
/// <param name="dbName"></param>
|
/// <param name="dbName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("deleteDB")]
|
[HttpDelete("deleteDB")]
|
||||||
public WcsApiResponse DeleteDb([FromQuery(Name = "dbName")] string? dbName)
|
public WcsApiResponse DeleteDb([FromQuery(Name = "dbName")] string? dbName) => plcDbService.DeleteDB(dbName);
|
||||||
{
|
|
||||||
return _plcDbService.DeleteDB(dbName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询 db 同时返回 PLC名称
|
/// 查询 db 同时返回 PLC名称
|
||||||
|
|
@ -54,9 +44,6 @@ public class PlcDbController(PlcDbService plcDbService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getDBWithPlcName")]
|
[HttpPost("getDBWithPlcName")]
|
||||||
public WcsApiResponse<List<GetDBWithPlcNameResponse>> GetDBWithPlcName(GetDBWithPlcNameRequest request)
|
public WcsApiResponse<List<GetDBWithPlcNameResponse>> GetDBWithPlcName(GetDBWithPlcNameRequest request) => plcDbService.GetDBWithPlcName(request);
|
||||||
{
|
|
||||||
return _plcDbService.GetDBWithPlcName(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.SystemController;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.SystemController;
|
||||||
|
|
@ -9,24 +10,16 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/runningInfo")]
|
[Route("api/wcs/runningInfo")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class RunningInfoController(RunningInfoService runningInfoService) : ControllerBase
|
public class RunningInfoController(RunningInfoService runningInfoService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private readonly RunningInfoService _runningInfoService = runningInfoService;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取日志的文件名称
|
/// 获取日志的文件名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logType"></param>
|
/// <param name="logType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getLogFileName")]
|
[HttpGet("getLogFileName")]
|
||||||
public WcsApiResponse<List<string>> GetLogFileName([FromQuery(Name = "logType")] string? logType)
|
public WcsApiResponse<List<string>> GetLogFileName([FromQuery(Name = "logType")] string? logType) => runningInfoService.GetLogFileName(logType);
|
||||||
{
|
|
||||||
return _runningInfoService.GetLogFileName(logType);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证下载文件是否存在
|
/// 验证下载文件是否存在
|
||||||
|
|
@ -34,11 +27,7 @@ public class RunningInfoController(RunningInfoService runningInfoService) : Cont
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("checkDownLoadLog")]
|
[HttpPost("checkDownLoadLog")]
|
||||||
public WcsApiResponse CheckDownLoadLog([FromBody] LogRequest request)
|
public WcsApiResponse CheckDownLoadLog([FromBody] LogRequest request) => runningInfoService.CheckDownLoadLog(request);
|
||||||
{
|
|
||||||
return _runningInfoService.CheckDownLoadLog(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下载文件
|
/// 下载文件
|
||||||
|
|
@ -46,10 +35,7 @@ public class RunningInfoController(RunningInfoService runningInfoService) : Cont
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("downLoadLog")]
|
[HttpPost("downLoadLog")]
|
||||||
public FileContentResult DownLoadLog([FromBody] LogRequest request)
|
public FileContentResult DownLoadLog([FromBody] LogRequest request) => runningInfoService.DownLoadLog(request, this);
|
||||||
{
|
|
||||||
return _runningInfoService.DownLoadLog(request, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
38
WcsMain/ApiServe/Controllers/WcsController/ScanController.cs
Normal file
38
WcsMain/ApiServe/Controllers/WcsController/ScanController.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Scan;
|
||||||
|
using WcsMain.ApiServe.Service.WcsService;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扫码器相关接口
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/wcs/scan")]
|
||||||
|
[ApiController]
|
||||||
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
|
public class ScanController(ScanService scanService) : ControllerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 分页查询扫码记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("queryScanRecordWithPage")]
|
||||||
|
public WcsApiResponse<int, List<AppScanRecord>> QueryScanRecordWithPage([FromBody] QueryScanRecordWithPageRequest request) => scanService.QueryScanRecordWithPage(request);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Settings;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Settings;
|
||||||
using WcsMain.ApiServe.Service.WcsService;
|
using WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
@ -8,23 +10,17 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
|
|
||||||
[Route("/api/wcs/setting")]
|
[Route("/api/wcs/setting")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class SettingController(SettingService settingService) : ControllerBase
|
public class SettingController(SettingService settingService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly SettingService _settingService = settingService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询设置项
|
/// 查询设置项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="settingKey"></param>
|
/// <param name="settingKey"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getSettings")]
|
[HttpGet("getSettings")]
|
||||||
public WcsApiResponse<List<AppSettings>> GetConfig([FromQuery(Name = "settingKey")] string? settingKey)
|
public WcsApiResponse<List<AppSettings>> GetConfig([FromQuery(Name = "settingKey")] string? settingKey) => settingService.GetConfig(settingKey);
|
||||||
{
|
|
||||||
return _settingService.GetConfig(settingKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加或者修改配置项
|
/// 添加或者修改配置项
|
||||||
|
|
@ -32,8 +28,6 @@ public class SettingController(SettingService settingService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("editSettings")]
|
[HttpPost("editSettings")]
|
||||||
public WcsApiResponse EditeConfig([FromBody] EditSettingsRequest request)
|
public WcsApiResponse EditeConfig([FromBody] EditSettingsRequest request) => settingService.EditeConfig(request);
|
||||||
{
|
|
||||||
return _settingService.EditeConfig(request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Socket;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Socket;
|
||||||
using WcsMain.ApiServe.Service.WcsService;
|
using WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
@ -8,21 +10,16 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
|
|
||||||
[Route("api/wcs/socket")]
|
[Route("api/wcs/socket")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class SocketController(SocketService socketService) : ControllerBase
|
public class SocketController(SocketService socketService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly SocketService _socketService = socketService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询 socket 连接信息
|
/// 查询 socket 连接信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getSocket")]
|
[HttpGet("getSocket")]
|
||||||
public WcsApiResponse<List<AppTcp>> GetDB()
|
public WcsApiResponse<List<AppTcp>> GetDB() => socketService.GetDB();
|
||||||
{
|
|
||||||
return _socketService.GetDB();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑 socket
|
/// 编辑 socket
|
||||||
|
|
@ -30,10 +27,7 @@ public class SocketController(SocketService socketService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("editSocket")]
|
[HttpPost("editSocket")]
|
||||||
public WcsApiResponse EditSocket([FromBody] EditSocketRequest request)
|
public WcsApiResponse EditSocket([FromBody] EditSocketRequest request) => socketService.EditSocket(request);
|
||||||
{
|
|
||||||
return _socketService.EditSocket(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除一条信息
|
/// 删除一条信息
|
||||||
|
|
@ -41,8 +35,6 @@ public class SocketController(SocketService socketService) : ControllerBase
|
||||||
/// <param name="socketNoStr"></param>
|
/// <param name="socketNoStr"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("deleteSocket")]
|
[HttpDelete("deleteSocket")]
|
||||||
public WcsApiResponse DeleteSocket([FromQuery(Name = "socketNo")] string? socketNoStr)
|
public WcsApiResponse DeleteSocket([FromQuery(Name = "socketNo")] string? socketNoStr) => socketService.DeleteSocket(socketNoStr);
|
||||||
{
|
|
||||||
return _socketService.DeleteSocket(socketNoStr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Stacker;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Stacker;
|
||||||
|
|
@ -10,31 +11,22 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/stacker")]
|
[Route("api/wcs/stacker")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class StackerController(StackerService stackerService) : ControllerBase
|
public class StackerController(StackerService stackerService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly StackerService _stackerService = stackerService;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的 堆垛机信息
|
/// 查询所有的 堆垛机信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getStacker")]
|
[HttpGet("getStacker")]
|
||||||
public WcsApiResponse<List<AppStacker>> GetStacker()
|
public WcsApiResponse<List<AppStacker>> GetStacker() => stackerService.GetStacker();
|
||||||
{
|
|
||||||
return _stackerService.GetStacker();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的 堆垛机状态信息 ---- 从设备返回
|
/// 查询所有的 堆垛机状态信息 ---- 从设备返回
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getStackerStatus")]
|
[HttpGet("getStackerStatus")]
|
||||||
public WcsApiResponse<List<GetStackerStatusResponse>> GetStackerStatus()
|
public WcsApiResponse<List<GetStackerStatusResponse>> GetStackerStatus() => stackerService.GetStackerStatus();
|
||||||
{
|
|
||||||
return _stackerService.GetStackerStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加或者编辑堆垛机信息
|
/// 添加或者编辑堆垛机信息
|
||||||
|
|
@ -42,8 +34,13 @@ public class StackerController(StackerService stackerService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("editStacker")]
|
[HttpPost("editStacker")]
|
||||||
public WcsApiResponse EditStacker([FromBody] EditStackerRequest request)
|
public WcsApiResponse EditStacker([FromBody] EditStackerRequest request) => stackerService.EditStacker(request);
|
||||||
{
|
|
||||||
return _stackerService.EditStacker(request);
|
/// <summary>
|
||||||
}
|
/// 查询故障详细信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("queryErrInfo")]
|
||||||
|
public WcsApiResponse<AppBaseErr> QueryErrInfo([FromBody] QueryErrInfoRequest request) => stackerService.QueryErrInfo(request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.Service.WcsService;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.StackerConvey;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库前输送线控制器
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/wcs/stackerConvey")]
|
||||||
|
[ApiController]
|
||||||
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
|
public class StackerConveyController(StackerConveyService stackerConveyService) : ControllerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询所有库前输送线信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("queryStackerConveyInfo")]
|
||||||
|
public WcsApiResponse<List<AppStackerConvey>> QueryStackerConveyInfo() => stackerConveyService.QueryStackerConveyInfo();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询所有库前输送线状态信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("queryStackerConveyStatus")]
|
||||||
|
public WcsApiResponse<List<StackerConveyStatusResponse>> QueryStackerConveyStatus() => stackerConveyService.QueryStackerConveyStatus();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.User;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.User;
|
||||||
|
|
@ -12,9 +13,6 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
public class UserController(UserService userService) : ControllerBase
|
public class UserController(UserService userService) : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly UserService _userService = userService;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户登录
|
/// 用户登录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -24,10 +22,7 @@ public class UserController(UserService userService) : ControllerBase
|
||||||
/// 若登录成功则返回用户名和用户菜单
|
/// 若登录成功则返回用户名和用户菜单
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[HttpPost("login")]
|
[HttpPost("login")]
|
||||||
public WcsApiResponse<LoginResponse> Login([FromBody] LoginRequest request)
|
public WcsApiResponse<LoginResponse> Login([FromBody] LoginRequest request) => userService.Login(request);
|
||||||
{
|
|
||||||
return _userService.Login(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询所有用户信息
|
/// 分页查询所有用户信息
|
||||||
|
|
@ -35,10 +30,7 @@ public class UserController(UserService userService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getUserWithPage")]
|
[HttpPost("getUserWithPage")]
|
||||||
public WcsApiResponse<List<AppUser>> GetUserWithPage([FromBody] GetUserWithPageRequest request)
|
[WcsAuthorization]
|
||||||
{
|
public WcsApiResponse<List<AppUser>> GetUserWithPage([FromBody] GetUserWithPageRequest request) => userService.GetUserWithPage(request);
|
||||||
return _userService.GetUserWithPage(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.UserGroup;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.UserGroup;
|
||||||
using WcsMain.ApiServe.Service.WcsService;
|
using WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
@ -8,21 +10,17 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
|
|
||||||
[Route("api/wcs/userGroup")]
|
[Route("api/wcs/userGroup")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class UserGroupController(UserGroupService userGroupService) : ControllerBase
|
public class UserGroupController(UserGroupService userGroupService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private readonly UserGroupService _userGroupService = userGroupService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询用户组
|
/// 查询用户组
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getUserGroup")]
|
[HttpGet("getUserGroup")]
|
||||||
public WcsApiResponse<List<AppUserGroup>> GetUserGroup()
|
public WcsApiResponse<List<AppUserGroup>> GetUserGroup() => userGroupService.GetUserGroup();
|
||||||
{
|
|
||||||
return _userGroupService.GetUserGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加用户组
|
/// 添加用户组
|
||||||
|
|
@ -30,10 +28,7 @@ public class UserGroupController(UserGroupService userGroupService) : Controller
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("addUserGroup")]
|
[HttpPost("addUserGroup")]
|
||||||
public WcsApiResponse AddUserGroup([FromBody] AddUserGroupRequest request)
|
public WcsApiResponse AddUserGroup([FromBody] AddUserGroupRequest request) => userGroupService.AddUserGroup(request);
|
||||||
{
|
|
||||||
return _userGroupService.AddUserGroup(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除用户组
|
/// 删除用户组
|
||||||
|
|
@ -41,10 +36,6 @@ public class UserGroupController(UserGroupService userGroupService) : Controller
|
||||||
/// <param name="groupId"></param>
|
/// <param name="groupId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("deleteUserGroup")]
|
[HttpDelete("deleteUserGroup")]
|
||||||
public WcsApiResponse DeleteUserGroup([FromQuery] string? groupId)
|
public WcsApiResponse DeleteUserGroup([FromQuery] string? groupId) => userGroupService.DeleteUserGroup(groupId);
|
||||||
{
|
|
||||||
return _userGroupService.DeleteUserGroup(groupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.UserRule;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.UserRule;
|
||||||
|
|
@ -10,21 +11,15 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/userRule")]
|
[Route("api/wcs/userRule")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class UserRuleController(UserRuleService userRuleService) : ControllerBase
|
public class UserRuleController(UserRuleService userRuleService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private readonly UserRuleService _userRuleService = userRuleService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取用户权限
|
/// 获取用户权限
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getUserRule")]
|
[HttpGet("getUserRule")]
|
||||||
public WcsApiResponse<List<AppUserRule>> GetUserRule([FromQuery] string? groupId)
|
public WcsApiResponse<List<AppUserRule>> GetUserRule([FromQuery] string? groupId) => userRuleService.GetUserRule(groupId);
|
||||||
{
|
|
||||||
return _userRuleService.GetUserRule(groupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新用户权限
|
/// 更新用户权限
|
||||||
|
|
@ -32,8 +27,6 @@ public class UserRuleController(UserRuleService userRuleService) : ControllerBas
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("updateUserRule")]
|
[HttpPost("updateUserRule")]
|
||||||
public WcsApiResponse UpdateUserRule([FromBody] UpdateUserRuleRequest request)
|
public WcsApiResponse UpdateUserRule([FromBody] UpdateUserRuleRequest request) => userRuleService.UpdateUserRule(request);
|
||||||
{
|
|
||||||
return _userRuleService.UpdateUserRule(request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.WcsTask;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.WcsTask;
|
||||||
|
|
@ -10,12 +11,9 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/wcsTask")]
|
[Route("api/wcs/wcsTask")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class WcsTaskController(WcsTaskService wcsTaskService) : ControllerBase
|
public class WcsTaskController(WcsTaskService wcsTaskService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly WcsTaskService _wcsTaskService = wcsTaskService;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的正在运行的WCS任务
|
/// 查询所有的正在运行的WCS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -23,7 +21,7 @@ public class WcsTaskController(WcsTaskService wcsTaskService) : ControllerBase
|
||||||
[HttpGet("getWcsTask")]
|
[HttpGet("getWcsTask")]
|
||||||
public WcsApiResponse<List<AppWcsTask>> GetWcsTask()
|
public WcsApiResponse<List<AppWcsTask>> GetWcsTask()
|
||||||
{
|
{
|
||||||
return _wcsTaskService.GetWcsTask();
|
return wcsTaskService.GetWcsTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -32,10 +30,7 @@ public class WcsTaskController(WcsTaskService wcsTaskService) : ControllerBase
|
||||||
/// <param name="taskId"></param>
|
/// <param name="taskId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getWcsTaskWithTaskId")]
|
[HttpGet("getWcsTaskWithTaskId")]
|
||||||
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithTaskId([FromQuery(Name = "taskId")] string taskId)
|
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithTaskId([FromQuery(Name = "taskId")] string taskId) => wcsTaskService.GetWcsTaskWithTaskId(taskId);
|
||||||
{
|
|
||||||
return _wcsTaskService.GetWcsTaskWithTaskId(taskId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询正在运行的任务
|
/// 分页查询正在运行的任务
|
||||||
|
|
@ -43,10 +38,8 @@ public class WcsTaskController(WcsTaskService wcsTaskService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getWcsTaskWithPage")]
|
[HttpPost("getWcsTaskWithPage")]
|
||||||
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithPage([FromBody] GetWcsTaskWithPageRequest request)
|
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithPage([FromBody] GetWcsTaskWithPageRequest request) => wcsTaskService.GetWcsTaskWithPage(request);
|
||||||
{
|
|
||||||
return _wcsTaskService.GetWcsTaskWithPage(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新任务信息
|
/// 更新任务信息
|
||||||
|
|
@ -54,8 +47,6 @@ public class WcsTaskController(WcsTaskService wcsTaskService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("updateStatus")]
|
[HttpPost("updateStatus")]
|
||||||
public WcsApiResponse UpdateWcsTaskStatus([FromBody] UpdateWcsTaskStatusRequest request)
|
public WcsApiResponse UpdateWcsTaskStatus([FromBody] UpdateWcsTaskStatusRequest request) => wcsTaskService.UpdateWcsTaskStatus(request);
|
||||||
{
|
|
||||||
return _wcsTaskService.UpdateWcsTaskStatus(request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
using WcsMain.ApiServe.ControllerFilter.ExceptionFilter;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.WmsTask;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.WmsTask;
|
||||||
|
|
@ -11,29 +12,22 @@ namespace WcsMain.ApiServe.Controllers.WcsController;
|
||||||
[Route("api/wcs/wmsTask")]
|
[Route("api/wcs/wmsTask")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[WcsExceptionFilter]
|
[WcsExceptionFilter]
|
||||||
|
[WcsAuthorization]
|
||||||
public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly WmsTaskService _wmsTaskService = wmsTaskService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询WMS任务
|
/// 查询WMS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getWmsTask")]
|
[HttpGet("getWmsTask")]
|
||||||
public WcsApiResponse<List<AppWmsTask>> GetWmsTask()
|
public WcsApiResponse<List<AppWmsTask>> GetWmsTask() => wmsTaskService.GetWmsTask();
|
||||||
{
|
|
||||||
return _wmsTaskService.GetWmsTask();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询所有的Wms任务
|
/// 分页查询所有的Wms任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("getWmsTaskWithPage")]
|
[HttpPost("getWmsTaskWithPage")]
|
||||||
public WcsApiResponse<int, List<AppWmsTask>> GetWmsTaskWithPage([FromBody] GetWmsTaskWithPageRequest request)
|
public WcsApiResponse<int, List<AppWmsTask>> GetWmsTaskWithPage([FromBody] GetWmsTaskWithPageRequest request) => wmsTaskService.GetWmsTaskWithPage(request);
|
||||||
{
|
|
||||||
return _wmsTaskService.GetWmsTaskWithPage(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// wcs前端向Wcs发送任务
|
/// wcs前端向Wcs发送任务
|
||||||
|
|
@ -41,10 +35,7 @@ public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("setStackerTask")]
|
[HttpPost("setStackerTask")]
|
||||||
public WcsApiResponse GetStackerTask([FromBody] SetWmsTask request)
|
public WcsApiResponse GetStackerTask([FromBody] SetWmsTask request) => wmsTaskService.GetStackerTask(request);
|
||||||
{
|
|
||||||
return _wmsTaskService.GetStackerTask(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wms向Wcs请求修改任务状态
|
/// Wms向Wcs请求修改任务状态
|
||||||
|
|
@ -52,9 +43,6 @@ public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("updateWmsTaskStatus")]
|
[HttpPost("updateWmsTaskStatus")]
|
||||||
public WcsApiResponse UpdateStackerTaskStatus([FromBody] UpdateStackerTaskStatusRequest request)
|
public WcsApiResponse UpdateStackerTaskStatus([FromBody] UpdateStackerTaskStatusRequest request) => wmsTaskService.UpdateStackerTaskStatus(request);
|
||||||
{
|
|
||||||
return _wmsTaskService.UpdateStackerTaskStatus(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.Convey;
|
||||||
|
using WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.WmsController;
|
||||||
|
|
||||||
|
[Route("api/wms/convey")]
|
||||||
|
[ApiController]
|
||||||
|
[ServiceFilter<ResponseFilterAttribute>]
|
||||||
|
[WmsApiExceptionFilter]
|
||||||
|
public class ConveyController(ConveyService conveyService) : ControllerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 接受上位系统发送过来的输送任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("conveyTask")]
|
||||||
|
public WmsApiResponse GetConveyTask([FromBody] List<GetConveyTaskRequest> request) => conveyService.GetConveyTask(request);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放站台,放箱子离开
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("disposeVehicle")]
|
||||||
|
public WmsApiResponse DisposeVehicle([FromBody] DisposeVehicleRequest request) => conveyService.DisposeVehicle(request);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收上位系统发过来的取消输送任务的指令
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("cancel")]
|
||||||
|
public WmsApiResponse CancelVehicle([FromBody] List<GetConveyTaskRequest> request) => conveyService.CancelConveyTask(request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using WcsMain.ApiServe.ControllerFilter;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.ElTag;
|
||||||
|
using WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Controllers.WmsController;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电子标签 WMS 外部接口类
|
||||||
|
/// </summary>
|
||||||
|
[Route("api/wms/elTag")]
|
||||||
|
[ApiController]
|
||||||
|
[ServiceFilter<ResponseFilterAttribute>]
|
||||||
|
[WmsApiExceptionFilter]
|
||||||
|
public class ElTagController(ElTagService elTagService) : ControllerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 接收 上位系统发来的 电子标签任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("elTagTask")]
|
||||||
|
public WmsApiResponse GetElTagTask([FromBody] GetElTagTaskRequest request) => elTagService.GetElTagTask(request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,28 +16,20 @@ namespace WcsMain.ApiServe.Controllers.WmsController
|
||||||
public class EquipmentController(EquipmentService equipmentService) : ControllerBase
|
public class EquipmentController(EquipmentService equipmentService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly EquipmentService _equipmentService = equipmentService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询站台是否允许动作
|
/// 查询站台是否允许动作
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("queryStandStatus")]
|
[HttpPost("queryStandStatus")]
|
||||||
public WmsApiResponse<QueryStandStatusResponse> QueryStandStatus([FromBody] QueryStandStatusRequest request)
|
public WmsApiResponse<QueryStandStatusResponse> QueryStandStatus([FromBody] QueryStandStatusRequest request) => equipmentService.QueryStandStatus(request);
|
||||||
{
|
|
||||||
return _equipmentService.QueryStandStatus(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通知输送机卸货完成
|
/// 通知输送机卸货完成
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("unloadSuccess")]
|
[HttpPost("unloadSuccess")]
|
||||||
public WmsApiResponse UnloadSuccess()
|
public WmsApiResponse UnloadSuccess() => equipmentService.UnloadSuccess();
|
||||||
{
|
|
||||||
return _equipmentService.UnloadSuccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,20 +16,13 @@ namespace WcsMain.ApiServe.Controllers.WmsController;
|
||||||
[WmsApiExceptionFilter]
|
[WmsApiExceptionFilter]
|
||||||
public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly WmsTaskService _wmsTaskService = wmsTaskService;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wms向Wcs发送任务
|
/// Wms向Wcs发送任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("setStackerTask")]
|
[HttpPost("setStackerTask")]
|
||||||
public WmsApiResponse GetStackerTask([FromBody] List<GetStackerRequest> request)
|
public WmsApiResponse<List<GetStackerRequest>> GetStackerTask([FromBody] List<GetStackerRequest> request) => wmsTaskService.GetStackerTask(request);
|
||||||
{
|
|
||||||
return _wmsTaskService.GetStackerTask(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wms向Wcs请求修改任务状态
|
/// Wms向Wcs请求修改任务状态
|
||||||
|
|
@ -37,10 +30,7 @@ public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("changeTaskStatus")]
|
[HttpPost("changeTaskStatus")]
|
||||||
public WmsApiResponse UpdateStackerTaskStatus([FromBody] UpdateStackerTaskStatusRequest request)
|
public WmsApiResponse UpdateStackerTaskStatus([FromBody] UpdateStackerTaskStatusRequest request) => wmsTaskService.UpdateStackerTaskStatus(request);
|
||||||
{
|
|
||||||
return _wmsTaskService.UpdateStackerTaskStatus(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WMS向WCS发送任务新终点,卸货位置有货的时候
|
/// WMS向WCS发送任务新终点,卸货位置有货的时候
|
||||||
|
|
@ -48,13 +38,5 @@ public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("setStackerTaskNewDestination")]
|
[HttpPost("setStackerTaskNewDestination")]
|
||||||
public WmsApiResponse GetStackerTaskNewDestination([FromBody] GetStackerTaskNewDestinationRequest request)
|
public WmsApiResponse GetStackerTaskNewDestination([FromBody] GetStackerTaskNewDestinationRequest request) => wmsTaskService.GetStackerTaskNewDestination(request);
|
||||||
{
|
|
||||||
return _wmsTaskService.GetStackerTaskNewDestination(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
187
WcsMain/ApiServe/Service/BoardService/Board2Service.cs
Normal file
187
WcsMain/ApiServe/Service/BoardService/Board2Service.cs
Normal file
|
|
@ -0,0 +1,187 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using WcsMain.ApiServe.Vo.Board;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.JoinTableEntity;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.Enum.Stacker;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.BoardService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 二维大屏 controller service
|
||||||
|
/// </summary>
|
||||||
|
[Service]
|
||||||
|
public class Board2Service(AppWmsTaskDao wmsTaskDao, AppErrRecorDao appErrRecorDao)
|
||||||
|
{
|
||||||
|
|
||||||
|
//private List<AppBaseErr>? _appBaseErrs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取堆垛机运行效率
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public StackerRunningEfficiencyResponse GetStackerRunningEfficiency()
|
||||||
|
{
|
||||||
|
int[] data = [0, 0, 0, 0, 0];
|
||||||
|
if (CommonData.AppLocations == null)
|
||||||
|
{
|
||||||
|
return new StackerRunningEfficiencyResponse() { Data = data };
|
||||||
|
}
|
||||||
|
List<AppWmsTask>? wmsTasks = wmsTaskDao.SelectRecentOneHour();
|
||||||
|
if(wmsTasks == null)
|
||||||
|
{
|
||||||
|
return new StackerRunningEfficiencyResponse() { Data = data };
|
||||||
|
}
|
||||||
|
foreach (var wmsTask in wmsTasks)
|
||||||
|
{
|
||||||
|
if(wmsTask.TaskType == (int)WmsTaskTypeEnum.inTask)
|
||||||
|
{
|
||||||
|
var location = CommonData.AppLocations.Find(f => f.WmsLocation == wmsTask.Destination);
|
||||||
|
if(location != null)
|
||||||
|
{
|
||||||
|
data[(int)location.EquipmentId! - 1]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wmsTask.TaskType == (int)WmsTaskTypeEnum.outTask)
|
||||||
|
{
|
||||||
|
var location = CommonData.AppLocations.Find(f => f.WmsLocation == wmsTask.Origin);
|
||||||
|
if (location != null)
|
||||||
|
{
|
||||||
|
data[(int)location.EquipmentId! - 1]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new StackerRunningEfficiencyResponse() { Data = data };
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据堆垛机获取错误信息数量
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<NameValueData<int>> GetErrByCrane()
|
||||||
|
{
|
||||||
|
List<AppErrorRecordJoin>? appErrorRecordJoins = appErrRecorDao.SelectErrorRecordWithJoin();
|
||||||
|
if(appErrorRecordJoins == null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
List<string> names = [];
|
||||||
|
foreach (var appErrorRecordJoin in appErrorRecordJoins)
|
||||||
|
{
|
||||||
|
if (!names.Contains(appErrorRecordJoin.EquipmentId!))
|
||||||
|
{
|
||||||
|
names.Add(appErrorRecordJoin.EquipmentId!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<int> counts = [];
|
||||||
|
foreach (var name in names)
|
||||||
|
{
|
||||||
|
int count = appErrorRecordJoins.FindAll(f => f.EquipmentId == name).Count;
|
||||||
|
counts.Add(count);
|
||||||
|
}
|
||||||
|
List<NameValueData<int>> nameValueDatas = [];
|
||||||
|
for (int i = 0; i < names.Count; i++)
|
||||||
|
{
|
||||||
|
nameValueDatas.Add(new NameValueData<int>() { Name = string.Concat("#", names[i].AsSpan(names[i].Length - 1, 1)), Value = counts[i] });
|
||||||
|
}
|
||||||
|
return nameValueDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据故障类型获取错误信息数量
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<NameValueData<int>> GetErrByCategory()
|
||||||
|
{
|
||||||
|
List<AppErrorRecordJoin>? appErrorRecordJoins = appErrRecorDao.SelectErrorRecordWithJoin();
|
||||||
|
if (appErrorRecordJoins == null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
List<string> names = [];
|
||||||
|
foreach (var appErrorRecordJoin in appErrorRecordJoins)
|
||||||
|
{
|
||||||
|
if (!names.Contains(appErrorRecordJoin.ErrType!))
|
||||||
|
{
|
||||||
|
names.Add(appErrorRecordJoin.ErrType!);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<int> counts = [];
|
||||||
|
foreach (var name in names)
|
||||||
|
{
|
||||||
|
int count = appErrorRecordJoins.FindAll(f => f.ErrType == name).Count;
|
||||||
|
counts.Add(count);
|
||||||
|
}
|
||||||
|
List<NameValueData<int>> nameValueDatas = [];
|
||||||
|
for (int i = 0; i < names.Count; i++)
|
||||||
|
{
|
||||||
|
nameValueDatas.Add(new NameValueData<int>() { Name = names[i], Value = counts[i] });
|
||||||
|
}
|
||||||
|
return nameValueDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取错误信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<ErrorDetail> GetErrInfo()
|
||||||
|
{
|
||||||
|
List<AppErrorRecordJoin>? appErrorRecordJoins = appErrRecorDao.SelectErrorRecordWithJoin();
|
||||||
|
if (appErrorRecordJoins == null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
List<ErrorDetail> errors = new List<ErrorDetail>();
|
||||||
|
int i = 0;
|
||||||
|
foreach(var appErrorRecordJoin in appErrorRecordJoins)
|
||||||
|
{
|
||||||
|
errors.Add(new ErrorDetail()
|
||||||
|
{
|
||||||
|
Time = ((DateTime)appErrorRecordJoin.CreateTime!).ToString("MM-dd HH:mm:ss"),
|
||||||
|
Material = string.Concat("#", appErrorRecordJoin.EquipmentId!.AsSpan(appErrorRecordJoin.EquipmentId!.Length - 1, 1)),
|
||||||
|
FaultName = appErrorRecordJoin.ErrMsg!,
|
||||||
|
FaultCode = appErrorRecordJoin.ErrNo!.ToString()
|
||||||
|
});
|
||||||
|
i++;
|
||||||
|
if(i >= 5)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取任务数量
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public TaskCountResponse GetTaskCount()
|
||||||
|
{
|
||||||
|
List<AppWmsTask>? recentDaysTask = wmsTaskDao.SelectRecenntDay(15);
|
||||||
|
if(recentDaysTask == null)
|
||||||
|
{
|
||||||
|
return new TaskCountResponse() { Date = [], In = [], Out = [] };
|
||||||
|
}
|
||||||
|
TaskCountResponse taskCountResponse = new() { Date = [], In = [], Out = [] };
|
||||||
|
for(var j = 15; j >= 0; j--)
|
||||||
|
{
|
||||||
|
var date = DateTime.Now.AddDays(-j).ToString("MM-dd");
|
||||||
|
var inCount = recentDaysTask.FindAll(f => f.TaskType == (int)WmsTaskTypeEnum.inTask && ((DateTime)f.CreateTime!).ToString("MM-dd") == date).Count;
|
||||||
|
var outCount = recentDaysTask.FindAll(f => f.TaskType == (int)WmsTaskTypeEnum.outTask && ((DateTime)f.CreateTime!).ToString("MM-dd") == date).Count;
|
||||||
|
if(inCount < 1 && outCount < 1) continue;
|
||||||
|
taskCountResponse.Date.Add(DateTime.Now.AddDays(-j).ToString("MM-dd"));
|
||||||
|
taskCountResponse.In.Add(inCount);
|
||||||
|
taskCountResponse.Out.Add(outCount);
|
||||||
|
}
|
||||||
|
var dateCount = taskCountResponse.Date.Count;
|
||||||
|
if (dateCount <= 7) return taskCountResponse;
|
||||||
|
taskCountResponse.Date.RemoveRange(0, dateCount - 7);
|
||||||
|
taskCountResponse.In.RemoveRange(0, dateCount - 7);
|
||||||
|
taskCountResponse.Out.RemoveRange(0, dateCount - 7);
|
||||||
|
return taskCountResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,16 +9,13 @@ namespace WcsMain.ApiServe.Service.TreeDService;
|
||||||
[Service]
|
[Service]
|
||||||
public class TaskService(AppWmsTaskDao wmsTaskDao, AppWcsTaskDao wcsTaskDao)
|
public class TaskService(AppWmsTaskDao wmsTaskDao, AppWcsTaskDao wcsTaskDao)
|
||||||
{
|
{
|
||||||
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
|
||||||
private readonly AppWmsTaskDao _wmsTaskDao = wmsTaskDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询WMS任务
|
/// 查询WMS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppWmsTask>> GetWmsTask()
|
public WcsApiResponse<List<AppWmsTask>> GetWmsTask()
|
||||||
{
|
{
|
||||||
List<AppWmsTask>? wmsTasks = _wmsTaskDao.SelectToWeb();
|
List<AppWmsTask>? wmsTasks = wmsTaskDao.SelectToWeb();
|
||||||
return WcsApiResponseFactory.Success(wmsTasks);
|
return WcsApiResponseFactory.Success(wmsTasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,7 +25,7 @@ public class TaskService(AppWmsTaskDao wmsTaskDao, AppWcsTaskDao wcsTaskDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppWmsTask>> GetWmsTaskNoEnd()
|
public WcsApiResponse<List<AppWmsTask>> GetWmsTaskNoEnd()
|
||||||
{
|
{
|
||||||
List<AppWmsTask>? wmsTasks = _wmsTaskDao.SelectWmsTaskNotEnd();
|
List<AppWmsTask>? wmsTasks = wmsTaskDao.SelectWmsTaskNotEnd();
|
||||||
return WcsApiResponseFactory.Success(wmsTasks);
|
return WcsApiResponseFactory.Success(wmsTasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +40,7 @@ public class TaskService(AppWmsTaskDao wmsTaskDao, AppWcsTaskDao wcsTaskDao)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.RequestErr<AppWcsTask>(default, $"无法识别查询的 plcId ,值为:{plcId}");
|
return WcsApiResponseFactory.RequestErr<AppWcsTask>(default, $"无法识别查询的 plcId ,值为:{plcId}");
|
||||||
}
|
}
|
||||||
List<AppWcsTask>? queryResult = _wcsTaskDao.Select(new AppWcsTask() { PlcId = plcId });
|
List<AppWcsTask>? queryResult = wcsTaskDao.Select(new AppWcsTask() { PlcId = plcId });
|
||||||
if (queryResult == default || queryResult.Count < 1)
|
if (queryResult == default || queryResult.Count < 1)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.Fail<AppWcsTask>(default, $"未找到该 plcId 对应的任务,值为:{plcId}");
|
return WcsApiResponseFactory.Fail<AppWcsTask>(default, $"未找到该 plcId 对应的任务,值为:{plcId}");
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class ApiAcceptService(AppApiAcceptDao apiAcceptDao)
|
public class ApiAcceptService(AppApiAcceptDao apiAcceptDao)
|
||||||
{
|
{
|
||||||
private readonly AppApiAcceptDao _apiAcceptDao = apiAcceptDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询API接收记录
|
/// 分页查询API接收记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -19,7 +17,7 @@ public class ApiAcceptService(AppApiAcceptDao apiAcceptDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppApiAccept>> GetApiAcceptWithPage(GetApiAcceptWithPageRequest request)
|
public WcsApiResponse<List<AppApiAccept>> GetApiAcceptWithPage(GetApiAcceptWithPageRequest request)
|
||||||
{
|
{
|
||||||
var (apiRequests, totalRows) = _apiAcceptDao.SelectPage(request);
|
var (apiRequests, totalRows) = apiAcceptDao.SelectPage(request);
|
||||||
if(apiRequests == default)
|
if(apiRequests == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppApiAccept>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppApiAccept>>();
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,13 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class ApiRequestService(AppApiRequestDao apiRequestDao)
|
public class ApiRequestService(AppApiRequestDao apiRequestDao)
|
||||||
{
|
{
|
||||||
private readonly AppApiRequestDao _apiRequestDao = apiRequestDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取所有API请求记录
|
/// 获取所有API请求记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppApiRequest>> GetApiRequest()
|
public WcsApiResponse<List<AppApiRequest>> GetApiRequest()
|
||||||
{
|
{
|
||||||
List<AppApiRequest>? apiRequests = _apiRequestDao.Select();
|
List<AppApiRequest>? apiRequests = apiRequestDao.Select();
|
||||||
if(apiRequests == default)
|
if(apiRequests == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppApiRequest>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppApiRequest>>();
|
||||||
|
|
@ -33,7 +31,7 @@ public class ApiRequestService(AppApiRequestDao apiRequestDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppApiRequest>> GetApiRequestWithPage(GetApiRequestWithPageRequest request)
|
public WcsApiResponse<List<AppApiRequest>> GetApiRequestWithPage(GetApiRequestWithPageRequest request)
|
||||||
{
|
{
|
||||||
var (apiRequests, totalRows) = _apiRequestDao.SelectPage(request);
|
var (apiRequests, totalRows) = apiRequestDao.SelectPage(request);
|
||||||
if(apiRequests == default)
|
if(apiRequests == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppApiRequest>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppApiRequest>>();
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class ConfigService(AppConfigDao configDao)
|
public class ConfigService(AppConfigDao configDao)
|
||||||
{
|
{
|
||||||
private readonly AppConfigDao _configDao = configDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询配置项,若查询参数为空则返回所有信息
|
/// 查询配置项,若查询参数为空则返回所有信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -20,7 +18,7 @@ public class ConfigService(AppConfigDao configDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppConfig>> GetConfig(string? configKey)
|
public WcsApiResponse<List<AppConfig>> GetConfig(string? configKey)
|
||||||
{
|
{
|
||||||
var configs = _configDao.GetAllConfig(configKey);
|
var configs = configDao.GetAllConfig(configKey);
|
||||||
if(configs == default)
|
if(configs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppConfig>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppConfig>>();
|
||||||
|
|
@ -35,7 +33,7 @@ public class ConfigService(AppConfigDao configDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppConfig>> GetConfigWithPage(GetConfigWithPageRequest request)
|
public WcsApiResponse<List<AppConfig>> GetConfigWithPage(GetConfigWithPageRequest request)
|
||||||
{
|
{
|
||||||
var (configs, totalNumber) = _configDao.GetAllConfigWithPage(request);
|
var (configs, totalNumber) = configDao.GetAllConfigWithPage(request);
|
||||||
if (configs == default)
|
if (configs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppConfig>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppConfig>>();
|
||||||
|
|
@ -66,12 +64,12 @@ public class ConfigService(AppConfigDao configDao)
|
||||||
};
|
};
|
||||||
if (request.IsEdite) // 修改信息
|
if (request.IsEdite) // 修改信息
|
||||||
{
|
{
|
||||||
var result = _configDao.Update(config);
|
var result = configDao.Update(config);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
else // 添加信息
|
else // 添加信息
|
||||||
{
|
{
|
||||||
var result = _configDao.Insert(config);
|
var result = configDao.Insert(config);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
30
WcsMain/ApiServe/Service/WcsService/ConveyService.cs
Normal file
30
WcsMain/ApiServe/Service/WcsService/ConveyService.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Convey;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
public class ConveyService(AppConveyTaskDao conveyTaskDao)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 分页查询箱式线任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WcsApiResponse<int, List<AppConveyTask>> QueryConveyTaskWithPage(QueryConveyTaskWithPageRequest request)
|
||||||
|
{
|
||||||
|
(List<AppConveyTask>? conveyTasks, int totalRows) = conveyTaskDao.QueryConveyTaskWithPage(request);
|
||||||
|
if (conveyTasks == default)
|
||||||
|
{
|
||||||
|
return WcsApiResponseFactory.DataBaseErr<int, List<AppConveyTask>>();
|
||||||
|
}
|
||||||
|
return WcsApiResponseFactory.Success(totalRows, conveyTasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,17 +5,14 @@ using WcsMain.ApiServe.Factory;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.DataService;
|
using WcsMain.DataService;
|
||||||
using WcsMain.Enum.TaskEnum;
|
using WcsMain.Enum.ElTag;
|
||||||
using WcsMain.WcsAttribute.AutoFacAttribute;
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
namespace WcsMain.ApiServe.Service.WcsService;
|
namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
public class ElTagService(AppElTagTaskDao tagTaskDao, DataBaseData dataBaseData)
|
public class ElTagService(AppElTagTaskDao tagTaskDao, DataBaseData dataBaseData, AppElTagLocationDao tagLocationDao)
|
||||||
{
|
{
|
||||||
private readonly DataBaseData _dataBaseData = dataBaseData;
|
|
||||||
private readonly AppElTagTaskDao _tagTaskDao = tagTaskDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 展示电子标签的数字
|
/// 展示电子标签的数字
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -33,7 +30,7 @@ public class ElTagService(AppElTagTaskDao tagTaskDao, DataBaseData dataBaseData)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<int, List<AppElTagTask>> QueryTaskWithPage(QueryTaskRequest request)
|
public WcsApiResponse<int, List<AppElTagTask>> QueryTaskWithPage(QueryTaskRequest request)
|
||||||
{
|
{
|
||||||
(List<AppElTagTask>? elTagTasks, int totalRows) = _tagTaskDao.QueryWithPage(request);
|
(List<AppElTagTask>? elTagTasks, int totalRows) = tagTaskDao.QueryWithPage(request);
|
||||||
if (elTagTasks == default)
|
if (elTagTasks == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<int, List<AppElTagTask>>();
|
return WcsApiResponseFactory.DataBaseErr<int, List<AppElTagTask>>();
|
||||||
|
|
@ -41,6 +38,24 @@ public class ElTagService(AppElTagTaskDao tagTaskDao, DataBaseData dataBaseData)
|
||||||
return WcsApiResponseFactory.Success(totalRows, elTagTasks);
|
return WcsApiResponseFactory.Success(totalRows, elTagTasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 分页查询电子标签库位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WcsApiResponse<int, List<AppElTagLocation>> QueryLocationWithPage(QueryLocationWithPageRequest request)
|
||||||
|
{
|
||||||
|
(List<AppElTagLocation>? elTagLocations, int totalRows) = tagLocationDao.QueryWithPage(request);
|
||||||
|
if (elTagLocations == default)
|
||||||
|
{
|
||||||
|
return WcsApiResponseFactory.DataBaseErr<int, List<AppElTagLocation>>();
|
||||||
|
}
|
||||||
|
return WcsApiResponseFactory.Success(totalRows, elTagLocations);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑电子标签任务信息
|
/// 编辑电子标签任务信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -48,12 +63,28 @@ public class ElTagService(AppElTagTaskDao tagTaskDao, DataBaseData dataBaseData)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse EditTaskInfo(EditTaskInfoRequest request)
|
public WcsApiResponse EditTaskInfo(EditTaskInfoRequest request)
|
||||||
{
|
{
|
||||||
var updateResult = _tagTaskDao.Update(new AppElTagTask
|
AppElTagTask elTagTask = new()
|
||||||
{
|
{
|
||||||
TaskId = request.TaskId,
|
TaskId = request.TaskId,
|
||||||
TaskStatus = request.TaskStatus,
|
TaskStatus = request.TaskStatus,
|
||||||
Remark = "WCS变更信息"
|
Remark = $"WCS变更信息 - {request.TaskStatus}"
|
||||||
});
|
};
|
||||||
|
switch(request.TaskStatus)
|
||||||
|
{
|
||||||
|
case (int)ElTagTaskStatusEnum.Lighting:
|
||||||
|
elTagTask.LightTime = DateTime.Now;
|
||||||
|
elTagTask.Remark = "WCS变更信息 - 点亮";
|
||||||
|
break;
|
||||||
|
case (int)ElTagTaskStatusEnum.Confirm:
|
||||||
|
elTagTask.ConfirmTime = DateTime.Now;
|
||||||
|
elTagTask.Remark = "WCS变更信息 - 确认";
|
||||||
|
break;
|
||||||
|
case (int)ElTagTaskStatusEnum.Off:
|
||||||
|
elTagTask.OffTime = DateTime.Now;
|
||||||
|
elTagTask.Remark = "WCS变更信息 - 熄灭";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var updateResult = tagTaskDao.Update(elTagTask);
|
||||||
return updateResult > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return updateResult > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,9 +96,9 @@ public class ElTagService(AppElTagTaskDao tagTaskDao, DataBaseData dataBaseData)
|
||||||
public WcsApiResponse AddTaskInfo(AddTaskInfoRequest request)
|
public WcsApiResponse AddTaskInfo(AddTaskInfoRequest request)
|
||||||
{
|
{
|
||||||
if (!CheckData.CheckDataRules(request)) return WcsApiResponseFactory.RequestErr();
|
if (!CheckData.CheckDataRules(request)) return WcsApiResponseFactory.RequestErr();
|
||||||
if(string.IsNullOrEmpty(request.TaskId)) request.TaskId = _dataBaseData.GetNewUUID();
|
if(string.IsNullOrEmpty(request.TaskId)) request.TaskId = dataBaseData.GetNewUUID();
|
||||||
if(string.IsNullOrEmpty(request.TaskGroup)) request.TaskGroup = _dataBaseData.GetNewUUID2();
|
if(string.IsNullOrEmpty(request.TaskGroup)) request.TaskGroup = dataBaseData.GetNewUUID2();
|
||||||
var insertResult = _tagTaskDao.Insert(new AppElTagTask
|
var insertResult = tagTaskDao.Insert(new AppElTagTask
|
||||||
{
|
{
|
||||||
TaskId = request.TaskId,
|
TaskId = request.TaskId,
|
||||||
TaskGroup = request.TaskGroup,
|
TaskGroup = request.TaskGroup,
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,13 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
public class LocationService(AppLocationDao locationDao)
|
public class LocationService(AppLocationDao locationDao)
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppLocationDao _locationDao = locationDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的点位状态
|
/// 查询所有的点位状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppLocation>> GetLocation()
|
public WcsApiResponse<List<AppLocation>> GetLocation()
|
||||||
{
|
{
|
||||||
List<AppLocation>? locations = _locationDao.Select();
|
List<AppLocation>? locations = locationDao.Select();
|
||||||
if (locations == default)
|
if (locations == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppLocation>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppLocation>>();
|
||||||
|
|
@ -34,7 +32,7 @@ public class LocationService(AppLocationDao locationDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppLocation>> GetLocationWithPage(GetLocationWithPageRequest request)
|
public WcsApiResponse<List<AppLocation>> GetLocationWithPage(GetLocationWithPageRequest request)
|
||||||
{
|
{
|
||||||
(List<AppLocation>? locations, int totalRows) = _locationDao.SelectPage(request);
|
(List<AppLocation>? locations, int totalRows) = locationDao.SelectPage(request);
|
||||||
if(locations == default)
|
if(locations == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppLocation>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppLocation>>();
|
||||||
|
|
@ -66,7 +64,7 @@ public class LocationService(AppLocationDao locationDao)
|
||||||
Explain = request.Explain,
|
Explain = request.Explain,
|
||||||
Remark = request.Remark
|
Remark = request.Remark
|
||||||
};
|
};
|
||||||
var result = _locationDao.Update(updateEntity);
|
var result = locationDao.Update(updateEntity);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class MenuService(AppMenuDao menuDao)
|
public class MenuService(AppMenuDao menuDao)
|
||||||
{
|
{
|
||||||
private readonly AppMenuDao _menuDao = menuDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分页查询菜单信息
|
/// 分页查询菜单信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -19,7 +17,7 @@ public class MenuService(AppMenuDao menuDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppMenu>> GetMenuWithPage(GetMenuWithPageRequest request)
|
public WcsApiResponse<List<AppMenu>> GetMenuWithPage(GetMenuWithPageRequest request)
|
||||||
{
|
{
|
||||||
var (menus, totalRows) = _menuDao.SelectPage(request);
|
var (menus, totalRows) = menuDao.SelectPage(request);
|
||||||
if (menus == default)
|
if (menus == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppMenu>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppMenu>>();
|
||||||
|
|
@ -46,7 +44,7 @@ public class MenuService(AppMenuDao menuDao)
|
||||||
MenuStatus = request.MenuStatus,
|
MenuStatus = request.MenuStatus,
|
||||||
Remark = request.Remark
|
Remark = request.Remark
|
||||||
};
|
};
|
||||||
var result = _menuDao.Update(menuData);
|
var result = menuDao.Update(menuData);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +68,7 @@ public class MenuService(AppMenuDao menuDao)
|
||||||
MenuStatus = request.MenuStatus,
|
MenuStatus = request.MenuStatus,
|
||||||
Remark = request.Remark
|
Remark = request.Remark
|
||||||
};
|
};
|
||||||
var result = _menuDao.Insert(menuData);
|
var result = menuDao.Insert(menuData);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class PlcDbService(AppDBDao dBDao)
|
public class PlcDbService(AppDBDao dBDao)
|
||||||
{
|
{
|
||||||
private readonly AppDBDao _dBDao = dBDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的Db地址信息
|
/// 查询所有的Db地址信息
|
||||||
|
|
@ -19,7 +18,7 @@ public class PlcDbService(AppDBDao dBDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppDB>> GetDB()
|
public WcsApiResponse<List<AppDB>> GetDB()
|
||||||
{
|
{
|
||||||
List<AppDB>? dbs = _dBDao.Select();
|
List<AppDB>? dbs = dBDao.Select();
|
||||||
if(dbs == default)
|
if(dbs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppDB>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppDB>>();
|
||||||
|
|
@ -49,7 +48,7 @@ public class PlcDbService(AppDBDao dBDao)
|
||||||
IsSystem = request.IsSystem,
|
IsSystem = request.IsSystem,
|
||||||
Remark = request.Remark
|
Remark = request.Remark
|
||||||
};
|
};
|
||||||
List<AppDB>? dBs = _dBDao.Select(new AppDB { DBName = request.DbName});
|
List<AppDB>? dBs = dBDao.Select(new AppDB { DBName = request.DbName});
|
||||||
if(dBs == default)
|
if(dBs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr();
|
return WcsApiResponseFactory.DataBaseErr();
|
||||||
|
|
@ -57,13 +56,13 @@ public class PlcDbService(AppDBDao dBDao)
|
||||||
if (dBs.Count > 0)
|
if (dBs.Count > 0)
|
||||||
{
|
{
|
||||||
// 修改信息
|
// 修改信息
|
||||||
var result = _dBDao.Update(db);
|
var result = dBDao.Update(db);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 添加信息
|
// 添加信息
|
||||||
var result = _dBDao.Insert(db);
|
var result = dBDao.Insert(db);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,7 +79,7 @@ public class PlcDbService(AppDBDao dBDao)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
var result = _dBDao.Delete(new AppDB() { DBName = dbName });
|
var result = dBDao.Delete(new AppDB() { DBName = dbName });
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +90,7 @@ public class PlcDbService(AppDBDao dBDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<GetDBWithPlcNameResponse>> GetDBWithPlcName(GetDBWithPlcNameRequest request)
|
public WcsApiResponse<List<GetDBWithPlcNameResponse>> GetDBWithPlcName(GetDBWithPlcNameRequest request)
|
||||||
{
|
{
|
||||||
List<GetDBWithPlcNameResponse>? dbs = _dBDao.QueryWithPlcName(new AppDB { PlcId = request.PlcId, DBName = request.DBName });
|
List<GetDBWithPlcNameResponse>? dbs = dBDao.QueryWithPlcName(new AppDB { PlcId = request.PlcId, DBName = request.DBName });
|
||||||
if (dbs == default)
|
if (dbs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<GetDBWithPlcNameResponse>>();
|
return WcsApiResponseFactory.DataBaseErr<List<GetDBWithPlcNameResponse>>();
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,9 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class PlcService(AppPLCDao pLCDao)
|
public class PlcService(AppPLCDao pLCDao)
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppPLCDao _plcDao = pLCDao;
|
|
||||||
|
|
||||||
|
|
||||||
public WcsApiResponse<List<AppPLC>> GetPlc()
|
public WcsApiResponse<List<AppPLC>> GetPlc()
|
||||||
{
|
{
|
||||||
List<AppPLC>? plcs = _plcDao.Query();
|
List<AppPLC>? plcs = pLCDao.Query();
|
||||||
if (plcs == default)
|
if (plcs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppPLC>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppPLC>>();
|
||||||
|
|
@ -51,7 +47,7 @@ public class PlcService(AppPLCDao pLCDao)
|
||||||
Remark = request.Remark
|
Remark = request.Remark
|
||||||
};
|
};
|
||||||
/* 判断这个编号是否存在 */
|
/* 判断这个编号是否存在 */
|
||||||
List <AppPLC>? appPLCs = _plcDao.Query(new AppPLC { PLCId = request.PlcId});
|
List <AppPLC>? appPLCs = pLCDao.Query(new AppPLC { PLCId = request.PlcId});
|
||||||
if (appPLCs == default)
|
if (appPLCs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr();
|
return WcsApiResponseFactory.DataBaseErr();
|
||||||
|
|
@ -59,13 +55,13 @@ public class PlcService(AppPLCDao pLCDao)
|
||||||
if (appPLCs.Count > 0)
|
if (appPLCs.Count > 0)
|
||||||
{
|
{
|
||||||
// 修改信息
|
// 修改信息
|
||||||
var result = _plcDao.Update(plc);
|
var result = pLCDao.Update(plc);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 添加信息
|
// 添加信息
|
||||||
var result = _plcDao.Insert(plc);
|
var result = pLCDao.Insert(plc);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +74,7 @@ public class PlcService(AppPLCDao pLCDao)
|
||||||
public WcsApiResponse DeletePlc(int? plcId)
|
public WcsApiResponse DeletePlc(int? plcId)
|
||||||
{
|
{
|
||||||
if(plcId == default) return WcsApiResponseFactory.RequestErr();
|
if(plcId == default) return WcsApiResponseFactory.RequestErr();
|
||||||
var result = _plcDao.Delete(new AppPLC { PLCId = plcId });
|
var result = pLCDao.Delete(new AppPLC { PLCId = plcId });
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
31
WcsMain/ApiServe/Service/WcsService/ScanService.cs
Normal file
31
WcsMain/ApiServe/Service/WcsService/ScanService.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Scan;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扫码器相关控制器的Service
|
||||||
|
/// </summary>
|
||||||
|
[Service]
|
||||||
|
public class ScanService(AppScanRecordDao scanRecordDao)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 分页查询扫码记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WcsApiResponse<int, List<AppScanRecord>> QueryScanRecordWithPage(QueryScanRecordWithPageRequest request)
|
||||||
|
{
|
||||||
|
(List<AppScanRecord>? records, int totalCount) = scanRecordDao.Query(request);
|
||||||
|
if(records == default)
|
||||||
|
{
|
||||||
|
return WcsApiResponseFactory.DataBaseErr<int, List<AppScanRecord>>();
|
||||||
|
}
|
||||||
|
return WcsApiResponseFactory.Success(totalCount, records);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,9 +11,6 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class SettingService(AppSettingsDao settingsDao)
|
public class SettingService(AppSettingsDao settingsDao)
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppSettingsDao _settingsDao = settingsDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据键名查询设置项
|
/// 根据键名查询设置项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -21,7 +18,7 @@ public class SettingService(AppSettingsDao settingsDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppSettings>> GetConfig(string? settingKey)
|
public WcsApiResponse<List<AppSettings>> GetConfig(string? settingKey)
|
||||||
{
|
{
|
||||||
List<AppSettings>? configs = _settingsDao.Select(new AppSettings() { SettingKey = settingKey });
|
List<AppSettings>? configs = settingsDao.Select(new AppSettings() { SettingKey = settingKey });
|
||||||
if(configs == default)
|
if(configs == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppSettings>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppSettings>>();
|
||||||
|
|
@ -41,7 +38,7 @@ public class SettingService(AppSettingsDao settingsDao)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
int updateRows = _settingsDao.Update(new AppSettings()
|
int updateRows = settingsDao.Update(new AppSettings()
|
||||||
{
|
{
|
||||||
SettingKey = request.SettingKey,
|
SettingKey = request.SettingKey,
|
||||||
SettingName = request.SettingName,
|
SettingName = request.SettingName,
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,13 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class SocketService(AppTcpDao socketDao)
|
public class SocketService(AppTcpDao socketDao)
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppTcpDao _socketDao = socketDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询 socket 连接信息
|
/// 查询 socket 连接信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppTcp>> GetDB()
|
public WcsApiResponse<List<AppTcp>> GetDB()
|
||||||
{
|
{
|
||||||
List<AppTcp>? sockets = _socketDao.Query();
|
List<AppTcp>? sockets = socketDao.Query();
|
||||||
if (sockets == default)
|
if (sockets == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppTcp>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppTcp>>();
|
||||||
|
|
@ -58,14 +55,14 @@ public class SocketService(AppTcpDao socketDao)
|
||||||
TcpStatus = socketStatus,
|
TcpStatus = socketStatus,
|
||||||
Remark = request.Remark,
|
Remark = request.Remark,
|
||||||
};
|
};
|
||||||
int updateRows = _socketDao.Update(socket);
|
int updateRows = socketDao.Update(socket);
|
||||||
return updateRows > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return updateRows > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 新增一条记录
|
// 新增一条记录
|
||||||
/* 校验这个编号是否已经存在 */
|
/* 校验这个编号是否已经存在 */
|
||||||
List<AppTcp>? checks = _socketDao.Query(new AppTcp() { TcpId = socketNo });
|
List<AppTcp>? checks = socketDao.Query(new AppTcp() { TcpId = socketNo });
|
||||||
if (checks == default)
|
if (checks == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr();
|
return WcsApiResponseFactory.DataBaseErr();
|
||||||
|
|
@ -83,7 +80,7 @@ public class SocketService(AppTcpDao socketDao)
|
||||||
TcpStatus = socketStatus,
|
TcpStatus = socketStatus,
|
||||||
Remark = request.Remark,
|
Remark = request.Remark,
|
||||||
};
|
};
|
||||||
int insertRows = _socketDao.Insert(socket);
|
int insertRows = socketDao.Insert(socket);
|
||||||
return insertRows > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return insertRows > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +98,7 @@ public class SocketService(AppTcpDao socketDao)
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
int socketNo = Convert.ToInt32(socketNoStr);
|
int socketNo = Convert.ToInt32(socketNoStr);
|
||||||
int deleteRows = _socketDao.Delete(new AppTcp() { TcpId = socketNo });
|
int deleteRows = socketDao.Delete(new AppTcp() { TcpId = socketNo });
|
||||||
return deleteRows > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return deleteRows > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
70
WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs
Normal file
70
WcsMain/ApiServe/Service/WcsService/StackerConveyService.cs
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.StackerConvey;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.EquipOperation.Convey;
|
||||||
|
using WcsMain.EquipOperation.StackerConvey;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
using static Dm.net.buffer.ByteArrayBuffer;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库前输送线的 Service
|
||||||
|
/// </summary>
|
||||||
|
[Service]
|
||||||
|
public class StackerConveyService(AppStackerConveyDao stackerConveyDao, ConveyOperation conveyOperation)
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询所有的库前输送线信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WcsApiResponse<List<AppStackerConvey>> QueryStackerConveyInfo()
|
||||||
|
{
|
||||||
|
List<AppStackerConvey>? stackerConveys = stackerConveyDao.Query();
|
||||||
|
return stackerConveys == default ? WcsApiResponseFactory.DataBaseErr<List<AppStackerConvey>>() : WcsApiResponseFactory.Success(stackerConveys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询所有的库前输送线状态信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WcsApiResponse<List<StackerConveyStatusResponse>> QueryStackerConveyStatus()
|
||||||
|
{
|
||||||
|
List<AppStackerConvey>? stackerConveys = stackerConveyDao.Query();
|
||||||
|
if(stackerConveys == default) return WcsApiResponseFactory.DataBaseErr<List<StackerConveyStatusResponse>>();
|
||||||
|
if(stackerConveys.Count == 0) return WcsApiResponseFactory.Fail<List<StackerConveyStatusResponse>>(default, "未找到库前输送机数据,请检查基础资料");
|
||||||
|
List<StackerConveyStatusResponse> responseData = [];
|
||||||
|
foreach (var stackerConvey in stackerConveys)
|
||||||
|
{
|
||||||
|
StackerConveyStatusResponse stackerConveyStatusResponse = ObjectCopy.CopyProperties<AppStackerConvey, StackerConveyStatusResponse>(stackerConvey);
|
||||||
|
// 读取允许取放货状态
|
||||||
|
// ---- 取货站台
|
||||||
|
if (stackerConvey.LocationType == 1)
|
||||||
|
{
|
||||||
|
stackerConveyStatusResponse.AllowAction = conveyOperation.AllowGetVehicle(stackerConvey.WcsLocation![..1]);
|
||||||
|
|
||||||
|
stackerConveyStatusResponse.Message = "查询成功";
|
||||||
|
// 读取条码
|
||||||
|
(string? errText, string? code) = conveyOperation.ReadConveyCode(stackerConvey.WcsLocation);
|
||||||
|
if (!string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
stackerConveyStatusResponse.Message = errText;
|
||||||
|
}
|
||||||
|
stackerConveyStatusResponse.Code = code;
|
||||||
|
}
|
||||||
|
if(stackerConvey.LocationType == 2)
|
||||||
|
{
|
||||||
|
stackerConveyStatusResponse.AllowAction = conveyOperation.AllowSetVehicle(stackerConvey.WcsLocation![..1]);
|
||||||
|
stackerConveyStatusResponse.Code = "-";
|
||||||
|
}
|
||||||
|
responseData.Add(stackerConveyStatusResponse);
|
||||||
|
}
|
||||||
|
return WcsApiResponseFactory.Success(responseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using DataCheck;
|
using DataCheck;
|
||||||
|
using Microsoft.VisualStudio.Web.CodeGenerators.Mvc.Dependency;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using WcsMain.ApiServe.Controllers.Dto;
|
using WcsMain.ApiServe.Controllers.Dto;
|
||||||
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Stacker;
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Stacker;
|
||||||
|
|
@ -11,19 +12,15 @@ using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
namespace WcsMain.ApiServe.Service.WcsService;
|
namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOperation)
|
public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOperation, AppBaseErrDao baseErrDao)
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppStackerDao _stackerDao = stackerDao;
|
|
||||||
private readonly StackerOperation _stackerOperation = stackerOperation;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的 堆垛机信息
|
/// 查询所有的 堆垛机信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppStacker>> GetStacker()
|
public WcsApiResponse<List<AppStacker>> GetStacker()
|
||||||
{
|
{
|
||||||
List<AppStacker>? stackers = _stackerDao.Select(new AppStacker());
|
List<AppStacker>? stackers = stackerDao.Select(new AppStacker());
|
||||||
if(stackers == default)
|
if(stackers == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppStacker>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppStacker>>();
|
||||||
|
|
@ -37,7 +34,7 @@ public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOp
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<GetStackerStatusResponse>> GetStackerStatus()
|
public WcsApiResponse<List<GetStackerStatusResponse>> GetStackerStatus()
|
||||||
{
|
{
|
||||||
List<AppStacker>? stackers = _stackerDao.Select(new AppStacker());
|
List<AppStacker>? stackers = stackerDao.Select(new AppStacker());
|
||||||
if (stackers == default)
|
if (stackers == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<GetStackerStatusResponse>>();
|
return WcsApiResponseFactory.DataBaseErr<List<GetStackerStatusResponse>>();
|
||||||
|
|
@ -53,18 +50,23 @@ public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOp
|
||||||
ForkStatus = stacker.ForkStatus,
|
ForkStatus = stacker.ForkStatus,
|
||||||
};
|
};
|
||||||
/* 获取堆垛机状态 */
|
/* 获取堆垛机状态 */
|
||||||
var (errMsg, stackerInfo) = _stackerOperation.GetStackerInfo((int)stacker.StackerId!);
|
var (errMsg, stackerInfo) = stackerOperation.GetStackerInfo((int)stacker.StackerId!);
|
||||||
if(string.IsNullOrEmpty(errMsg) && stackerInfo != default)
|
if(string.IsNullOrEmpty(errMsg) && stackerInfo != default)
|
||||||
{
|
{
|
||||||
stackerStatusResponse.Message = "查询成功";
|
stackerStatusResponse.Message = "查询成功";
|
||||||
stackerStatusResponse.PlcId = stackerInfo.PlcId.ToString();
|
stackerStatusResponse.PlcId = stackerInfo.PlcId.ToString() + " / " + stackerInfo.Spare1.ToString();
|
||||||
stackerStatusResponse.ControlModel = stackerInfo.ControlModel.ToString();
|
stackerStatusResponse.ControlModel = ((int)stackerInfo.ControlModel).ToString();
|
||||||
stackerStatusResponse.StackerStatusEquip = stackerInfo.StackerStatus.ToString();
|
stackerStatusResponse.StackerStatusEquip = ((int)stackerInfo.StackerStatus).ToString();
|
||||||
stackerStatusResponse.Queue = stackerInfo.Row;
|
stackerStatusResponse.Queue = stackerInfo.Row;
|
||||||
stackerStatusResponse.Line = stackerInfo.Line;
|
stackerStatusResponse.Line = stackerInfo.Line;
|
||||||
stackerStatusResponse.Layer = stackerInfo.Layer;
|
stackerStatusResponse.Layer = stackerInfo.Layer;
|
||||||
stackerStatusResponse.Depth = stackerInfo.Depth;
|
stackerStatusResponse.Depth = stackerInfo.Depth;
|
||||||
stackerStatusResponse.Code = stackerInfo.Code.ToString();
|
stackerStatusResponse.Code = new Func<string>(() =>
|
||||||
|
{
|
||||||
|
string code1 = stackerInfo.Code == 0 ? "-" : $"ASRS{stackerInfo.Code.ToString().PadLeft(6, '0')}";
|
||||||
|
string code2 = stackerInfo.DeletePlcId == 0 ? "-" : $"ASRS{stackerInfo.DeletePlcId.ToString().PadLeft(6, '0')}";
|
||||||
|
return $"{code1} / {code2}";
|
||||||
|
}).Invoke();
|
||||||
stackerStatusResponse.ErrCode = stackerInfo.ErrCode;
|
stackerStatusResponse.ErrCode = stackerInfo.ErrCode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -88,14 +90,14 @@ public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOp
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
/* 查询是否存在这个编号的堆垛机,若存在则更新数据,若不存在则添加 */
|
/* 查询是否存在这个编号的堆垛机,若存在则更新数据,若不存在则添加 */
|
||||||
List<AppStacker>? appStackers = _stackerDao.Select(new AppStacker { StackerId = request.StackerId });
|
List<AppStacker>? appStackers = stackerDao.Select(new AppStacker { StackerId = request.StackerId });
|
||||||
if (appStackers == default)
|
if (appStackers == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr();
|
return WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
if (appStackers.Count == 0) // 没有数据,新增一条新的
|
if (appStackers.Count == 0) // 没有数据,新增一条新的
|
||||||
{
|
{
|
||||||
var insertResult = _stackerDao.Insert(new AppStacker
|
var insertResult = stackerDao.Insert(new AppStacker
|
||||||
{
|
{
|
||||||
StackerId = request.StackerId,
|
StackerId = request.StackerId,
|
||||||
StackerName = request.StackerName,
|
StackerName = request.StackerName,
|
||||||
|
|
@ -110,7 +112,7 @@ public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOp
|
||||||
}
|
}
|
||||||
else // 存在,更新数据
|
else // 存在,更新数据
|
||||||
{
|
{
|
||||||
var updateResult = _stackerDao.Update(new AppStacker
|
var updateResult = stackerDao.Update(new AppStacker
|
||||||
{
|
{
|
||||||
StackerId = request.StackerId,
|
StackerId = request.StackerId,
|
||||||
StackerName = request.StackerName,
|
StackerName = request.StackerName,
|
||||||
|
|
@ -126,4 +128,19 @@ public class StackerService(AppStackerDao stackerDao, StackerOperation stackerOp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询对应的报警信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WcsApiResponse<AppBaseErr> QueryErrInfo(QueryErrInfoRequest request)
|
||||||
|
{
|
||||||
|
var queryResult = baseErrDao.Select(new AppBaseErr { Area = request.Area, ErrNo = request.ErrNo });
|
||||||
|
if (queryResult == default) return WcsApiResponseFactory.DataBaseErr<AppBaseErr>();
|
||||||
|
if (queryResult.Count() == 0) return WcsApiResponseFactory.Fail<AppBaseErr>(msg:"没有对应的报警资料");
|
||||||
|
var errInfo = queryResult[0];
|
||||||
|
return WcsApiResponseFactory.Success(errInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,13 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class UserGroupService(AppUserGroupDao userGroupDao)
|
public class UserGroupService(AppUserGroupDao userGroupDao)
|
||||||
{
|
{
|
||||||
private readonly AppUserGroupDao _userGroupDao = userGroupDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询用户组
|
/// 查询用户组
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppUserGroup>> GetUserGroup()
|
public WcsApiResponse<List<AppUserGroup>> GetUserGroup()
|
||||||
{
|
{
|
||||||
var userGroup = _userGroupDao.Query();
|
var userGroup = userGroupDao.Query();
|
||||||
if(userGroup == default)
|
if(userGroup == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppUserGroup>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppUserGroup>>();
|
||||||
|
|
@ -42,7 +40,7 @@ public class UserGroupService(AppUserGroupDao userGroupDao)
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
// 检查该用户组是否存在
|
// 检查该用户组是否存在
|
||||||
List<AppUserGroup>? checkUserGroup = _userGroupDao.Query(new AppUserGroup { GroupId = request.GroupId });
|
List<AppUserGroup>? checkUserGroup = userGroupDao.Query(new AppUserGroup { GroupId = request.GroupId });
|
||||||
if (checkUserGroup == default)
|
if (checkUserGroup == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr();
|
return WcsApiResponseFactory.DataBaseErr();
|
||||||
|
|
@ -58,7 +56,7 @@ public class UserGroupService(AppUserGroupDao userGroupDao)
|
||||||
GroupName = request.GroupName,
|
GroupName = request.GroupName,
|
||||||
GroupStatus = request.GroupStatus
|
GroupStatus = request.GroupStatus
|
||||||
};
|
};
|
||||||
var result = _userGroupDao.Insert(userGroup);
|
var result = userGroupDao.Insert(userGroup);
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,7 +74,7 @@ public class UserGroupService(AppUserGroupDao userGroupDao)
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
// 检查该用户组是否存在
|
// 检查该用户组是否存在
|
||||||
List<AppUserGroup>? checkUserGroup = _userGroupDao.Query(new AppUserGroup { GroupId = groupId });
|
List<AppUserGroup>? checkUserGroup = userGroupDao.Query(new AppUserGroup { GroupId = groupId });
|
||||||
if (checkUserGroup == default)
|
if (checkUserGroup == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr();
|
return WcsApiResponseFactory.DataBaseErr();
|
||||||
|
|
@ -86,7 +84,7 @@ public class UserGroupService(AppUserGroupDao userGroupDao)
|
||||||
return WcsApiResponseFactory.DataRepetition("该用户组不存在");
|
return WcsApiResponseFactory.DataRepetition("该用户组不存在");
|
||||||
}
|
}
|
||||||
// 删除用户组
|
// 删除用户组
|
||||||
var result = _userGroupDao.Delete(new AppUserGroup { GroupId = groupId });
|
var result = userGroupDao.Delete(new AppUserGroup { GroupId = groupId });
|
||||||
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
return result > 0 ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.DataBaseErr();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,13 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class UserRuleService(AppUserRuleDao userRuleDao)
|
public class UserRuleService(AppUserRuleDao userRuleDao)
|
||||||
{
|
{
|
||||||
private readonly AppUserRuleDao _userRuleDao = userRuleDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取用户组权限
|
/// 获取用户组权限
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppUserRule>> GetUserRule(string? groupId)
|
public WcsApiResponse<List<AppUserRule>> GetUserRule(string? groupId)
|
||||||
{
|
{
|
||||||
var userRule = _userRuleDao.Query(new AppUserRule() { GroupId = groupId });
|
var userRule = userRuleDao.Query(new AppUserRule() { GroupId = groupId });
|
||||||
if(userRule == default)
|
if(userRule == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppUserRule>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppUserRule>>();
|
||||||
|
|
@ -39,7 +37,7 @@ public class UserRuleService(AppUserRuleDao userRuleDao)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
bool result = _userRuleDao.UpdateUserRule(request);
|
bool result = userRuleDao.UpdateUserRule(request);
|
||||||
return result ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail();
|
return result ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class UserService(AppUserDao appUserDao, AppMenuDao menuDao)
|
public class UserService(AppUserDao appUserDao, AppMenuDao menuDao)
|
||||||
{
|
{
|
||||||
private readonly AppUserDao _userDao = appUserDao;
|
|
||||||
private readonly AppMenuDao _menuDao = menuDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 登录请求的具体实现
|
/// 登录请求的具体实现
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -30,7 +27,7 @@ public class UserService(AppUserDao appUserDao, AppMenuDao menuDao)
|
||||||
}
|
}
|
||||||
string encryptPwd = Md5Encrypt.EncryptPassword(request.UserPassword);
|
string encryptPwd = Md5Encrypt.EncryptPassword(request.UserPassword);
|
||||||
/* 判断用户账户ID和密码是否正确 */
|
/* 判断用户账户ID和密码是否正确 */
|
||||||
List<AppUser>? loginUser = _userDao.Query(new AppUser { UserId = request.UserId, UserPassword = encryptPwd });
|
List<AppUser>? loginUser = appUserDao.Query(new AppUser { UserId = request.UserId, UserPassword = encryptPwd });
|
||||||
if (loginUser == default)
|
if (loginUser == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<LoginResponse>();
|
return WcsApiResponseFactory.DataBaseErr<LoginResponse>();
|
||||||
|
|
@ -51,12 +48,17 @@ public class UserService(AppUserDao appUserDao, AppMenuDao menuDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private LoginResponse? GetUserMenu(AppUser user)
|
private LoginResponse? GetUserMenu(AppUser user)
|
||||||
{
|
{
|
||||||
var menus = _menuDao.GetMenuWithGroupId(user.UserGroup!);
|
var menus = menuDao.GetMenuWithGroupId(user.UserGroup!);
|
||||||
if (menus == default || menus.Count < 1)
|
if (menus == default || menus.Count < 1)
|
||||||
{
|
{
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
LoginResponse loginResponse = new() { UserName = user.UserName, Menu = [] };
|
LoginResponse loginResponse = new()
|
||||||
|
{
|
||||||
|
UserName = user.UserName,
|
||||||
|
Menu = [],
|
||||||
|
Token = Guid.NewGuid().ToString(),
|
||||||
|
};
|
||||||
// ---- 找出主菜单
|
// ---- 找出主菜单
|
||||||
List<(string Index, string MainMenuName, string ico)> mainMenuInfo = [];
|
List<(string Index, string MainMenuName, string ico)> mainMenuInfo = [];
|
||||||
foreach (var menu in menus)
|
foreach (var menu in menus)
|
||||||
|
|
@ -99,7 +101,7 @@ public class UserService(AppUserDao appUserDao, AppMenuDao menuDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppUser>> GetUserWithPage(GetUserWithPageRequest request)
|
public WcsApiResponse<List<AppUser>> GetUserWithPage(GetUserWithPageRequest request)
|
||||||
{
|
{
|
||||||
var (users, total) = _userDao.QueryWithPage(request);
|
var (users, total) = appUserDao.QueryWithPage(request);
|
||||||
return WcsApiResponseFactory.Success(users, total.ToString());
|
return WcsApiResponseFactory.Success(users, total.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,13 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class WcsTaskService(AppWcsTaskDao wcsTaskDao)
|
public class WcsTaskService(AppWcsTaskDao wcsTaskDao)
|
||||||
{
|
{
|
||||||
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有的Wcs任务列表
|
/// 查询所有的Wcs任务列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppWcsTask>> GetWcsTask()
|
public WcsApiResponse<List<AppWcsTask>> GetWcsTask()
|
||||||
{
|
{
|
||||||
List<AppWcsTask>? wcsTasks = _wcsTaskDao.Select();
|
List<AppWcsTask>? wcsTasks = wcsTaskDao.Select();
|
||||||
if(wcsTasks == default)
|
if(wcsTasks == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppWcsTask>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppWcsTask>>();
|
||||||
|
|
@ -37,7 +35,7 @@ public class WcsTaskService(AppWcsTaskDao wcsTaskDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithTaskId(string taskId)
|
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithTaskId(string taskId)
|
||||||
{
|
{
|
||||||
List<AppWcsTask>? wcsTasks = _wcsTaskDao.GetAllTasksWithBakData(taskId);
|
List<AppWcsTask>? wcsTasks = wcsTaskDao.GetAllTasksWithBakData(taskId);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppWcsTask>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppWcsTask>>();
|
||||||
|
|
@ -52,7 +50,7 @@ public class WcsTaskService(AppWcsTaskDao wcsTaskDao)
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithPage([FromBody] GetWcsTaskWithPageRequest request)
|
public WcsApiResponse<List<AppWcsTask>> GetWcsTaskWithPage([FromBody] GetWcsTaskWithPageRequest request)
|
||||||
{
|
{
|
||||||
(List<AppWcsTask>? wcsTasks, int totalRows) = _wcsTaskDao.SelectPage(request);
|
(List<AppWcsTask>? wcsTasks, int totalRows) = wcsTaskDao.SelectPage(request);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppWcsTask>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppWcsTask>>();
|
||||||
|
|
@ -72,7 +70,7 @@ public class WcsTaskService(AppWcsTaskDao wcsTaskDao)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
var taskData = _wcsTaskDao.Select(new AppWcsTask() { PlcId = request.PlcId });
|
var taskData = wcsTaskDao.Select(new AppWcsTask() { PlcId = request.PlcId });
|
||||||
if (taskData == default)
|
if (taskData == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr();
|
return WcsApiResponseFactory.DataBaseErr();
|
||||||
|
|
@ -81,7 +79,7 @@ public class WcsTaskService(AppWcsTaskDao wcsTaskDao)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.Fail("找不到该任务,可能该任务不存在或者已经完结");
|
return WcsApiResponseFactory.Fail("找不到该任务,可能该任务不存在或者已经完结");
|
||||||
}
|
}
|
||||||
int updateRows = _wcsTaskDao.Update(new AppWcsTask()
|
int updateRows = wcsTaskDao.Update(new AppWcsTask()
|
||||||
{
|
{
|
||||||
PlcId = request.PlcId,
|
PlcId = request.PlcId,
|
||||||
TaskStatus = request.TaskStatus,
|
TaskStatus = request.TaskStatus,
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.DataService;
|
using WcsMain.DataService;
|
||||||
using WcsMain.Enum.TaskEnum;
|
using WcsMain.Enum.Stacker;
|
||||||
using WcsMain.StaticData;
|
using WcsMain.StaticData;
|
||||||
using WcsMain.WcsAttribute.AutoFacAttribute;
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
|
@ -16,18 +16,13 @@ namespace WcsMain.ApiServe.Service.WcsService;
|
||||||
[Service]
|
[Service]
|
||||||
public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDao, DataBaseData dataBaseData)
|
public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDao, DataBaseData dataBaseData)
|
||||||
{
|
{
|
||||||
private readonly DataBaseData _dataBaseData = dataBaseData;
|
|
||||||
private readonly WmsTaskAction _wmsTaskAction = wmsTaskAction;
|
|
||||||
private readonly AppWmsTaskDao _wmsTaskDao = wmsTaskDao;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询Wms 任务表
|
/// 查询Wms 任务表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<List<AppWmsTask>> GetWmsTask()
|
public WcsApiResponse<List<AppWmsTask>> GetWmsTask()
|
||||||
{
|
{
|
||||||
List<AppWmsTask>? wmsTasks = _wmsTaskDao.SelectToWeb();
|
List<AppWmsTask>? wmsTasks = wmsTaskDao.SelectToWeb();
|
||||||
if(wmsTasks == default)
|
if(wmsTasks == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<List<AppWmsTask>>();
|
return WcsApiResponseFactory.DataBaseErr<List<AppWmsTask>>();
|
||||||
|
|
@ -43,7 +38,7 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse<int, List<AppWmsTask>> GetWmsTaskWithPage(GetWmsTaskWithPageRequest request)
|
public WcsApiResponse<int, List<AppWmsTask>> GetWmsTaskWithPage(GetWmsTaskWithPageRequest request)
|
||||||
{
|
{
|
||||||
(List<AppWmsTask>? wmsTasks, int totalRows) = _wmsTaskDao.SelectPage(request);
|
(List<AppWmsTask>? wmsTasks, int totalRows) = wmsTaskDao.SelectPage(request);
|
||||||
if(wmsTasks == default)
|
if(wmsTasks == default)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.DataBaseErr<int, List<AppWmsTask>>();
|
return WcsApiResponseFactory.DataBaseErr<int, List<AppWmsTask>>();
|
||||||
|
|
@ -58,7 +53,7 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WcsApiResponse GetStackerTask(SetWmsTask request)
|
public WcsApiResponse GetStackerTask(SetWmsTask request)
|
||||||
{
|
{
|
||||||
request.TaskId = _dataBaseData.GetNewUUID();
|
request.TaskId = dataBaseData.GetNewUUID();
|
||||||
bool checkData = CheckData.CheckDataRules(request);
|
bool checkData = CheckData.CheckDataRules(request);
|
||||||
if (!checkData)
|
if (!checkData)
|
||||||
{
|
{
|
||||||
|
|
@ -82,8 +77,8 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
CreatePerson = StaticString.WCS,
|
CreatePerson = StaticString.WCS,
|
||||||
};
|
};
|
||||||
/* 插入任务数据 */
|
/* 插入任务数据 */
|
||||||
//int insertRows = _wmsTaskDao.Insert(wmsTasks.ToArray()); // ---- 直接插入任务数据
|
//int insertRows = wmsTaskDao.Insert(wmsTasks.ToArray()); // ---- 直接插入任务数据
|
||||||
int insertRows = _wmsTaskDao.InsertTaskAndMarkErr(wmsTask); // ---- 先清除这个料箱之前未作的任务,然后插入新数据
|
int insertRows = wmsTaskDao.InsertTaskAndMarkErr(wmsTask); // ---- 先清除这个料箱之前未作的任务,然后插入新数据
|
||||||
if (insertRows > 0)
|
if (insertRows > 0)
|
||||||
{
|
{
|
||||||
return WcsApiResponseFactory.Success($"任务创建成功,任务号:{request.TaskId}");
|
return WcsApiResponseFactory.Success($"任务创建成功,任务号:{request.TaskId}");
|
||||||
|
|
@ -104,7 +99,7 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
return WcsApiResponseFactory.RequestErr();
|
return WcsApiResponseFactory.RequestErr();
|
||||||
}
|
}
|
||||||
/* 校验任务是否存在 */
|
/* 校验任务是否存在 */
|
||||||
var tasks = _wmsTaskDao.Select(new AppWmsTask { TaskId = request.TaskId });
|
var tasks = wmsTaskDao.Select(new AppWmsTask { TaskId = request.TaskId });
|
||||||
if (tasks == default)
|
if (tasks == default)
|
||||||
{
|
{
|
||||||
// 查询失败
|
// 查询失败
|
||||||
|
|
@ -119,13 +114,13 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
string resetErrText = _wmsTaskAction.ResetWmsTaskStatus(request.TaskId, request.Destination, StaticString.WCS); // 重置任务
|
string resetErrText = wmsTaskAction.ResetWmsTaskStatus(request.TaskId, request.Destination, StaticString.WCS); // 重置任务
|
||||||
return string.IsNullOrEmpty(resetErrText) ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail(resetErrText);
|
return string.IsNullOrEmpty(resetErrText) ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail(resetErrText);
|
||||||
case 3:
|
case 3:
|
||||||
string completeErrText = _wmsTaskAction.CompleteWmsTaskStatus(request.TaskId, StaticString.WCS); // 完成任务
|
string completeErrText = wmsTaskAction.CompleteWmsTaskStatus(request.TaskId, StaticString.WCS); // 完成任务
|
||||||
return string.IsNullOrEmpty(completeErrText) ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail(completeErrText);
|
return string.IsNullOrEmpty(completeErrText) ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail(completeErrText);
|
||||||
case 999:
|
case 999:
|
||||||
string deleteErrText = _wmsTaskAction.DeleteWmsTaskStatus(request.TaskId, StaticString.WCS); // 删除任务
|
string deleteErrText = wmsTaskAction.DeleteWmsTaskStatus(request.TaskId, StaticString.WCS); // 删除任务
|
||||||
return string.IsNullOrEmpty(deleteErrText) ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail(deleteErrText);
|
return string.IsNullOrEmpty(deleteErrText) ? WcsApiResponseFactory.Success() : WcsApiResponseFactory.Fail(deleteErrText);
|
||||||
default:
|
default:
|
||||||
return WcsApiResponseFactory.Fail($"任务状态不支持:任务状态:{request.TaskStatus}");
|
return WcsApiResponseFactory.Fail($"任务状态不支持:任务状态:{request.TaskStatus}");
|
||||||
|
|
|
||||||
118
WcsMain/ApiServe/Service/WmsService/ConveyService.cs
Normal file
118
WcsMain/ApiServe/Service/WmsService/ConveyService.cs
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
using System.Configuration;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.Convey;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.Enum.Convey;
|
||||||
|
using WcsMain.EquipOperation.Convey;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
public class ConveyService(DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao, ConveyOperation conveyOperation)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 接收WMS发送过来的输送线任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WmsApiResponse GetConveyTask(List<GetConveyTaskRequest> request)
|
||||||
|
{
|
||||||
|
foreach(var item in request)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(item.VehicleNo) || item.TaskType == default || item.Locations == default || item.Locations.Length < 1)
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr("存在必填项未填");
|
||||||
|
}
|
||||||
|
if (item.TaskGroup == default)
|
||||||
|
{
|
||||||
|
item.TaskGroup = dataBaseData.GetNewUUID2(); // 当任务组为空时生成一个新的
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<AppConveyTask> conveyTasks = [];
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
foreach (var item in request)
|
||||||
|
{
|
||||||
|
if (item.Locations == default) continue;
|
||||||
|
foreach (var location in item.Locations)
|
||||||
|
{
|
||||||
|
conveyTasks.Add(new AppConveyTask
|
||||||
|
{
|
||||||
|
TaskId = dataBaseData.GetNewUUID(),
|
||||||
|
TaskGroup = item.TaskGroup,
|
||||||
|
VehicleNo = item.VehicleNo,
|
||||||
|
TaskType = item.TaskType,
|
||||||
|
TaskStatus = (int)ConveyTaskStatusEnum.create,
|
||||||
|
Location = location,
|
||||||
|
CreatePerson = StaticData.StaticString.WMS,
|
||||||
|
CreateTime = now,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var insertResult = conveyTaskDao.Insert(conveyTasks);
|
||||||
|
return insertResult > 0 ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.DataBaseErr();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放输送线任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WmsApiResponse DisposeVehicle(DisposeVehicleRequest request)
|
||||||
|
{
|
||||||
|
if(string.IsNullOrEmpty(request.Location)) return WmsApiResponseFactory.RequestErr("存在必填项未填");
|
||||||
|
var writeResult = conveyOperation.AllowPickStandGo(request.Location, 2);
|
||||||
|
if(string.IsNullOrEmpty(writeResult)) return WmsApiResponseFactory.Success();
|
||||||
|
return WmsApiResponseFactory.Fail(writeResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 取消wms的箱式线任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WmsApiResponse CancelConveyTask(List<GetConveyTaskRequest> request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var item in request)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(item.VehicleNo) || item.TaskType == default || item.Locations == default || item.Locations.Length < 1)
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr("存在必填项未填");
|
||||||
|
}
|
||||||
|
//遍历所有点位
|
||||||
|
foreach (var location in item.Locations)
|
||||||
|
{
|
||||||
|
//生成删除的对象
|
||||||
|
var taskToDelete = new AppConveyTask
|
||||||
|
{
|
||||||
|
VehicleNo = item.VehicleNo,
|
||||||
|
Location = location
|
||||||
|
};
|
||||||
|
int deleteResult = conveyTaskDao.VehicledDelete(taskToDelete);
|
||||||
|
if (deleteResult > 0)
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.Success("删除成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.DataBaseErr("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ConsoleLog.Error(ex.ToString());
|
||||||
|
return WmsApiResponseFactory.Fail(ex);
|
||||||
|
}
|
||||||
|
return WmsApiResponseFactory.Success("没有找到匹配的记录");
|
||||||
|
}
|
||||||
|
}
|
||||||
64
WcsMain/ApiServe/Service/WmsService/ElTagService.cs
Normal file
64
WcsMain/ApiServe/Service/WmsService/ElTagService.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
using DataCheck;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WMSEntity.ElTag;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.Enum.ElTag;
|
||||||
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Service.WmsService;
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
public class ElTagService(DataBaseData dataBaseData, AppElTagTaskDao elTagTaskDao)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 接收电子标签任务
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public WmsApiResponse GetElTagTask(GetElTagTaskRequest request)
|
||||||
|
{
|
||||||
|
if (!CheckData.CheckDataRules(request) || request.TaskData == default || request.TaskData.Length < 1)
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr();
|
||||||
|
}
|
||||||
|
foreach (var elTagTask in request.TaskData)
|
||||||
|
{
|
||||||
|
if (!CheckData.CheckDataRules(elTagTask))
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(request.TaskGroup == default)
|
||||||
|
{
|
||||||
|
request.TaskGroup = dataBaseData.GetNewUUID2();
|
||||||
|
}
|
||||||
|
/* 插入任务 */
|
||||||
|
List<AppElTagTask> elTagTasks = [];
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
foreach (var elTagTask in request.TaskData)
|
||||||
|
{
|
||||||
|
elTagTasks.Add(new AppElTagTask()
|
||||||
|
{
|
||||||
|
TaskId = string.IsNullOrEmpty(elTagTask.ETaskId) ? dataBaseData.GetNewUUID() : elTagTask.ETaskId,
|
||||||
|
WmsTaskId = elTagTask.TaskId,
|
||||||
|
TaskGroup = request.TaskGroup,
|
||||||
|
TaskType = request.TaskType,
|
||||||
|
Location = elTagTask.Location,
|
||||||
|
OrderId = request.OrderId,
|
||||||
|
VehicleNo = request.VehicleNo,
|
||||||
|
GoodsId = elTagTask.GoodsId,
|
||||||
|
GoodsName = elTagTask.GoodsName,
|
||||||
|
TaskStatus = (int)ElTagTaskStatusEnum.NeedLight,
|
||||||
|
NeedNum = elTagTask.NeedNum ?? 0,
|
||||||
|
CreatePerson = StaticData.StaticString.WMS,
|
||||||
|
CreateTime = now
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var insertResult = elTagTaskDao.Insert(elTagTasks.ToArray());
|
||||||
|
return insertResult > 0 ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.DataBaseErr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,8 +7,10 @@ using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.Enum.TaskEnum;
|
using WcsMain.Enum.Convey;
|
||||||
|
using WcsMain.Enum.Stacker;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.Plugins;
|
||||||
using WcsMain.StaticData;
|
using WcsMain.StaticData;
|
||||||
using WcsMain.WcsAttribute.AutoFacAttribute;
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
|
@ -18,32 +20,57 @@ namespace WcsMain.ApiServe.Service.WmsService;
|
||||||
/// Wms任务接口逻辑
|
/// Wms任务接口逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Service]
|
[Service]
|
||||||
public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDao, AppWcsTaskDao wcsTaskDao)
|
public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDao)
|
||||||
{
|
{
|
||||||
private readonly AppWmsTaskDao _wmsTaskDao = wmsTaskDao;
|
|
||||||
private readonly WmsTaskAction _wmsTaskAction = wmsTaskAction;
|
|
||||||
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 接收WMS任务数据处理
|
/// 接收WMS任务数据处理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="taskEntity"></param>
|
/// <param name="request"></param>
|
||||||
/// <param name="createPerson"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WmsApiResponse GetStackerTask(List<GetStackerRequest> request)
|
public WmsApiResponse<List<GetStackerRequest>> GetStackerTask(List<GetStackerRequest> request)
|
||||||
{
|
{
|
||||||
if (request.Count < 1) return WmsApiResponseFactory.RequestErr("请求的任务数量为 0");
|
if (request.Count < 1 || request.Count > 26) return WmsApiResponseFactory.RequestErr<List<GetStackerRequest>>(null, "请求的任务数量只能在 1 至 26 范围内");
|
||||||
|
List<GetStackerRequest> errRequest = []; // 存放错误的请求
|
||||||
/* 插入库存信息 */ // ---- 库存由WMS管理,数据库表也无需操作
|
/* 插入库存信息 */ // ---- 库存由WMS管理,数据库表也无需操作
|
||||||
List<AppWmsTask> wmsTasks = [];
|
List<AppWmsTask> wmsTasks = [];
|
||||||
foreach (var taskData in request)
|
foreach (var taskData in request)
|
||||||
{
|
{
|
||||||
/* 检验传入的数据格式 */
|
/* 检验传入的数据格式 */
|
||||||
bool checkData = CheckData.CheckDataRules(taskData);
|
bool checkData = CheckData.CheckDataRules(taskData);
|
||||||
if (!checkData) return WmsApiResponseFactory.RequestErr("请求的任务数据部分存在格式问题,请检查数据格式");
|
if (!checkData)
|
||||||
|
{
|
||||||
|
var errorRequest = ObjectCopy.CopyProperties<GetStackerRequest, GetStackerRequest>(taskData);
|
||||||
|
errRequest.Add(errorRequest);
|
||||||
|
}
|
||||||
/* 检验起点和终点是否正常 */
|
/* 检验起点和终点是否正常 */
|
||||||
var existOringin = CommonData.AppLocations.ExistWmsLocation(taskData.Origin);
|
if(taskData.TaskType == (int)WmsTaskTypeEnum.moveTask)
|
||||||
var existDestination = CommonData.AppLocations.ExistWmsLocation(taskData.Destination);
|
{
|
||||||
if(!existOringin || !existDestination) return WmsApiResponseFactory.RequestErr($"任务号:{taskData.TaskId} 的起点或者终点不正确");
|
var existOringin = CommonData.AppLocations.ExistWmsLocation(taskData.Origin);
|
||||||
|
var existDestination = CommonData.AppLocations.ExistWmsLocation(taskData.Destination);
|
||||||
|
if (!existOringin || !existDestination)
|
||||||
|
{
|
||||||
|
var errorRequest = ObjectCopy.CopyProperties<GetStackerRequest, GetStackerRequest>(taskData);
|
||||||
|
errRequest.Add(errorRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(taskData.TaskType == (int)WmsTaskTypeEnum.inTask)
|
||||||
|
{
|
||||||
|
var existDestination = CommonData.AppLocations.ExistWmsLocation(taskData.Destination);
|
||||||
|
if (!existDestination)
|
||||||
|
{
|
||||||
|
var errorRequest = ObjectCopy.CopyProperties<GetStackerRequest, GetStackerRequest>(taskData);
|
||||||
|
errRequest.Add(errorRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(taskData.TaskType == (int)WmsTaskTypeEnum.outTask)
|
||||||
|
{
|
||||||
|
var existOringin = CommonData.AppLocations.ExistWmsLocation(taskData.Origin);
|
||||||
|
if (!existOringin)
|
||||||
|
{
|
||||||
|
var errorRequest = ObjectCopy.CopyProperties<GetStackerRequest, GetStackerRequest>(taskData);
|
||||||
|
errRequest.Add(errorRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
/* 构造任务 */
|
/* 构造任务 */
|
||||||
wmsTasks.Add(new AppWmsTask()
|
wmsTasks.Add(new AppWmsTask()
|
||||||
{
|
{
|
||||||
|
|
@ -62,27 +89,38 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
CreatePerson = StaticString.WMS,
|
CreatePerson = StaticString.WMS,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if(errRequest.Count > 0) // 如果有错误请求,则返回错误请求
|
||||||
|
{
|
||||||
|
return WmsApiResponseFactory.RequestErr(errRequest, "请求的任务数据存在异常");
|
||||||
|
}
|
||||||
List<string?> taskIds = []; // 存放任务号
|
List<string?> taskIds = []; // 存放任务号
|
||||||
foreach (var checkEntity in wmsTasks)
|
foreach (var checkEntity in wmsTasks)
|
||||||
{
|
{
|
||||||
/* 检查任务号是否重复 */
|
/* 检查任务号是否重复 */
|
||||||
List<AppWmsTask>? checkSame = _wmsTaskDao.Select(new AppWmsTask() { TaskId = checkEntity.TaskId });
|
List<AppWmsTask>? checkSame = wmsTaskDao.Select(new AppWmsTask() { TaskId = checkEntity.TaskId });
|
||||||
if (checkSame == default) return WmsApiResponseFactory.DataBaseErr();
|
if (checkSame == default) return WmsApiResponseFactory.DataBaseErr(errRequest);
|
||||||
if (checkSame.Count > 0 || taskIds.Exists(e => e == checkEntity.TaskId))
|
if (checkSame.Count > 0 || taskIds.Exists(e => e == checkEntity.TaskId))
|
||||||
{
|
{
|
||||||
return WmsApiResponseFactory.RequestErr($"任务:{checkEntity.TaskId} 已存在,请勿重复");
|
return WmsApiResponseFactory.RequestErr(errRequest, $"任务:{checkEntity.TaskId} 已存在,请勿重复");
|
||||||
}
|
}
|
||||||
taskIds.Add(checkEntity.TaskId);
|
taskIds.Add(checkEntity.TaskId);
|
||||||
}
|
}
|
||||||
/* 插入任务数据 */
|
/* 插入任务数据 */
|
||||||
//int insertRows = _wmsTaskDao.Insert(wmsTasks.ToArray()); // ---- 直接插入任务数据
|
//int insertRows = wmsTaskDao.Insert(wmsTasks.ToArray()); // ---- 直接插入任务数据
|
||||||
int insertRows = _wmsTaskDao.InsertTaskAndMarkErr([.. wmsTasks]); // ---- 先清除这个料箱之前未作的任务,然后插入新数据
|
int insertRows = wmsTaskDao.InsertTaskAndMarkErr([.. wmsTasks]); // ---- 先清除这个料箱之前未作的任务,然后插入新数据
|
||||||
if (insertRows > 0) return WmsApiResponseFactory.Success($"任务创建成功,任务号:{string.Join(',', taskIds)}");
|
if (insertRows > 0) return WmsApiResponseFactory.Success(errRequest, $"任务创建成功,任务号:{string.Join(',', taskIds)}");
|
||||||
return WmsApiResponseFactory.Fail("数据插入失败,请稍后重试或者联系我们");
|
return WmsApiResponseFactory.Fail(errRequest, "数据插入失败,请稍后重试或者联系我们");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新任务状态
|
/// 更新任务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -93,20 +131,20 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
bool checkData = CheckData.CheckDataRules(request);
|
bool checkData = CheckData.CheckDataRules(request);
|
||||||
if (!checkData) return WmsApiResponseFactory.RequestErr();
|
if (!checkData) return WmsApiResponseFactory.RequestErr();
|
||||||
/* 校验任务是否存在 */
|
/* 校验任务是否存在 */
|
||||||
var tasks = _wmsTaskDao.Select(new AppWmsTask { TaskId = request.TaskId });
|
var tasks = wmsTaskDao.Select(new AppWmsTask { TaskId = request.TaskId });
|
||||||
if (tasks == default) return WmsApiResponseFactory.DataBaseErr(); // 数据库连接失败
|
if (tasks == default) return WmsApiResponseFactory.DataBaseErr(); // 数据库连接失败
|
||||||
if (tasks.Count == 0) return WmsApiResponseFactory.RequestErr($"任务:{request.TaskId} 不存在");
|
if (tasks.Count == 0) return WmsApiResponseFactory.RequestErr($"任务:{request.TaskId} 不存在");
|
||||||
int? status = request.TaskStatus;
|
int? status = request.TaskStatus;
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
string resetErrText = _wmsTaskAction.ResetWmsTaskStatus(request.TaskId, request.Destination, StaticString.WMS); // 重置任务
|
string resetErrText = wmsTaskAction.ResetWmsTaskStatus(request.TaskId, request.Destination, StaticString.WMS); // 重置任务
|
||||||
return string.IsNullOrEmpty(resetErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(resetErrText);
|
return string.IsNullOrEmpty(resetErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(resetErrText);
|
||||||
case 2:
|
case 2:
|
||||||
string completeErrText = _wmsTaskAction.CompleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 完成任务
|
string completeErrText = wmsTaskAction.CompleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 完成任务
|
||||||
return string.IsNullOrEmpty(completeErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(completeErrText);
|
return string.IsNullOrEmpty(completeErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(completeErrText);
|
||||||
case 1:
|
case 1:
|
||||||
string deleteErrText = _wmsTaskAction.DeleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 删除任务
|
string deleteErrText = wmsTaskAction.DeleteWmsTaskStatus(request.TaskId, StaticString.WMS); // 删除任务
|
||||||
return string.IsNullOrEmpty(deleteErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(deleteErrText);
|
return string.IsNullOrEmpty(deleteErrText) ? WmsApiResponseFactory.Success() : WmsApiResponseFactory.Fail(deleteErrText);
|
||||||
default:
|
default:
|
||||||
return WmsApiResponseFactory.RequestErr($"不支持的任务状态:{request.TaskStatus}");
|
return WmsApiResponseFactory.RequestErr($"不支持的任务状态:{request.TaskStatus}");
|
||||||
|
|
@ -120,28 +158,21 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WmsApiResponse GetStackerTaskNewDestination(GetStackerTaskNewDestinationRequest request)
|
public WmsApiResponse GetStackerTaskNewDestination(GetStackerTaskNewDestinationRequest request)
|
||||||
{
|
{
|
||||||
if(!CheckData.CheckDataRules(request)) return WmsApiResponseFactory.RequestErr();
|
return WmsApiResponseFactory.Fail();
|
||||||
/* 查找该任务有没有无法卸货 */
|
// if(!CheckData.CheckDataRules(request)) return WmsApiResponseFactory.RequestErr();
|
||||||
List<AppWcsTask>? wcsTasks = _wcsTaskDao.Select(new AppWcsTask { TaskId = request.TaskId, TaskStatus = (int)WcsTaskStatusEnum.doubleIn });
|
// /* 查找该任务有没有无法卸货 */
|
||||||
if(wcsTasks == default) return WmsApiResponseFactory.DataBaseErr();
|
// List<AppWcsTask>? wcsTasks = _wcsTaskDao.Select(new AppWcsTask { TaskId = request.TaskId, TaskStatus = (int)WcsTaskStatusEnum.doubleIn });
|
||||||
if(wcsTasks.Count() < 1) return WmsApiResponseFactory.Fail($"任务号:{request.TaskId} 没有无法卸货的情况");
|
// if(wcsTasks == default) return WmsApiResponseFactory.DataBaseErr();
|
||||||
wcsTasks = [.. wcsTasks.OrderByDescending(x => x.CompleteTime)];
|
// if(wcsTasks.Count() < 1) return WmsApiResponseFactory.Fail($"任务号:{request.TaskId} 没有无法卸货的情况");
|
||||||
var wcsTask = wcsTasks[0]; // 获取最新的一条任务
|
// wcsTasks = [.. wcsTasks.OrderByDescending(x => x.CompleteTime)];
|
||||||
/* 如果是最后一条任务则更新WMS任务终点 */
|
// var wcsTask = wcsTasks[0]; // 获取最新的一条任务
|
||||||
if(wcsTask.IsLastTask())
|
// /* 如果是最后一条任务则更新WMS任务终点 */
|
||||||
{
|
// if(wcsTask.IsLastTask())
|
||||||
_wmsTaskDao.Update(new AppWmsTask { TaskId = request.TaskId, Destination = request.Destination, TaskMsg = "WMS修改终点" });
|
// {
|
||||||
|
// _wmsTaskDao.Update(new AppWmsTask { TaskId = request.TaskId, Destination = request.Destination, TaskMsg = "WMS修改终点" });
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
32
WcsMain/ApiServe/Vo/Board/ErrorDetail.cs
Normal file
32
WcsMain/ApiServe/Vo/Board/ErrorDetail.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Vo.Board;
|
||||||
|
|
||||||
|
public class ErrorDetail
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 时间
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("time")]
|
||||||
|
public string? Time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备名称
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("material")]
|
||||||
|
public string? Material { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障信息
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("faultName")]
|
||||||
|
public string? FaultName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 故障代码
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("faultCode")]
|
||||||
|
public string? FaultCode { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
17
WcsMain/ApiServe/Vo/Board/NameValueData.cs
Normal file
17
WcsMain/ApiServe/Vo/Board/NameValueData.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Vo.Board;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 键值对数据
|
||||||
|
/// </summary>
|
||||||
|
public class NameValueData<T>
|
||||||
|
{
|
||||||
|
[JsonPropertyName("name")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("value")]
|
||||||
|
public T? Value { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Vo.Board;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 堆垛机效率返回类
|
||||||
|
/// </summary>
|
||||||
|
public class StackerRunningEfficiencyResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 效率
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("data")]
|
||||||
|
public int[]? Data { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
17
WcsMain/ApiServe/Vo/Board/TaskCountResponse.cs
Normal file
17
WcsMain/ApiServe/Vo/Board/TaskCountResponse.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiServe.Vo.Board;
|
||||||
|
|
||||||
|
public class TaskCountResponse
|
||||||
|
{
|
||||||
|
[JsonPropertyName("date")]
|
||||||
|
public List<string>? Date { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("in")]
|
||||||
|
public List<int>? In { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("out")]
|
||||||
|
public List<int>? Out { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -21,34 +21,6 @@ public class AppConfigEntity
|
||||||
public string? WcsId { get; set; }
|
public string? WcsId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/***************************** API信息 *************************************/
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Wms 的根地址
|
|
||||||
/// </summary>
|
|
||||||
[ConfigKey("WmsBaseApiAddress")]
|
|
||||||
public string? WmsBaseAddressApiAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 请求入库的地址
|
|
||||||
/// </summary>
|
|
||||||
[ConfigKey("ApplyEnterApiAddress")]
|
|
||||||
public string? ApplyEnterApiAddress { get; set;}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 发送 Wms 任务状态
|
|
||||||
/// </summary>
|
|
||||||
[ConfigKey("SendWmsTaskStatusApiAddress")]
|
|
||||||
public string? SendWmsTaskStatusApiAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 上报载具到达
|
|
||||||
/// </summary>
|
|
||||||
[ConfigKey("VehicleArriveApiAddress")]
|
|
||||||
public string? VehicleArriveApiAddress { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************** 功能配置 ******************************/
|
/****************************** 功能配置 ******************************/
|
||||||
|
|
||||||
|
|
@ -114,4 +86,10 @@ public class AppConfigEntity
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[ConfigKey("ExcuteStackerInTaskWithScan")]
|
[ConfigKey("ExcuteStackerInTaskWithScan")]
|
||||||
public string? ExcuteStackerInTaskWithScan { get; set; }
|
public string? ExcuteStackerInTaskWithScan { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 去往 pick2 箱子的比率
|
||||||
|
/// </summary>
|
||||||
|
[ConfigKey("Pick2Lv")]
|
||||||
|
public string? Pick2Lv { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.EquipOperation;
|
using WcsMain.EquipOperation;
|
||||||
|
|
||||||
|
|
@ -10,7 +10,6 @@ namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
||||||
[Circulation]
|
[Circulation]
|
||||||
public class ConnectPlcWithCirculation(ConnectPLCs connectPLCs)
|
public class ConnectPlcWithCirculation(ConnectPLCs connectPLCs)
|
||||||
{
|
{
|
||||||
private readonly ConnectPLCs _connectPLCs = connectPLCs;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当plc断开时重新连接 PLC
|
/// 当plc断开时重新连接 PLC
|
||||||
|
|
@ -23,7 +22,7 @@ public class ConnectPlcWithCirculation(ConnectPLCs connectPLCs)
|
||||||
{
|
{
|
||||||
// 如果处于未连接的状态则需要连接
|
// 如果处于未连接的状态则需要连接
|
||||||
/* 连接 PLC */
|
/* 连接 PLC */
|
||||||
bool isContinue = _connectPLCs.ConnectPlc();
|
bool isContinue = connectPLCs.ConnectPlc();
|
||||||
if (!isContinue)
|
if (!isContinue)
|
||||||
{
|
{
|
||||||
return false; // 没有需要连接PLC可能,不需要接着继续检测了
|
return false; // 没有需要连接PLC可能,不需要接着继续检测了
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.Business.CommonAction;
|
using WcsMain.Business.CommonAction;
|
||||||
|
|
||||||
namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
||||||
|
|
@ -9,45 +9,27 @@ namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
||||||
[Circulation("数据清理")]
|
[Circulation("数据清理")]
|
||||||
public class DataClear(ClearData clearData)
|
public class DataClear(ClearData clearData)
|
||||||
{
|
{
|
||||||
private readonly ClearData _clearData = clearData;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 定时清理无用数据, ---- 每隔10分钟清理一次
|
/// 定时清理无用数据, ---- 每隔10分钟清理一次
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Circulation("数据清理", 1000 * 60 * 30)]
|
[CirculationTime(["03:00"], "数据清理")]
|
||||||
public bool ClearDataCirculate()
|
public void ClearDataCirculate()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 清理接口接收记录表 -- 保留多少天
|
|
||||||
int apiAcceptCount = _clearData.ClearApiAcceptData(30);
|
|
||||||
ConsoleLog.Tip(apiAcceptCount > 0, $"[数据清理]接口接收记录:{apiAcceptCount}");
|
|
||||||
|
|
||||||
// 清理日志文件 -- 清理多少天之前
|
// 清理日志文件 -- 清理多少天之前
|
||||||
int logCount = _clearData.ClearLogFile(60);
|
int logCount = clearData.ClearLogFile(100);
|
||||||
ConsoleLog.Tip(logCount > 0, $"[数据清理]日志文件:{logCount}");
|
ConsoleLog.Tip(logCount > 0, $"[数据清理]日志文件:{logCount}");
|
||||||
|
|
||||||
// 清理接口请求记录表 -- 保留多少天
|
// 清理数据库
|
||||||
int apiRequestCount = _clearData.ClearApiRequestData(30);
|
clearData.ClearDataBase();
|
||||||
ConsoleLog.Tip(apiRequestCount > 0, $"[数据清理]接口请求记录:{apiRequestCount}");
|
|
||||||
|
|
||||||
// 清理WCS任务备份表 -- 保留多少天
|
|
||||||
int apiWcsTaskCount = _clearData.ClearWcsTaskData(30);
|
|
||||||
ConsoleLog.Tip(apiWcsTaskCount > 0, $"[数据清理]WCS任务备份记录:{apiWcsTaskCount}");
|
|
||||||
|
|
||||||
// 清理WMS任务表 -- 保留多少天
|
|
||||||
int apiWmsTaskCount = _clearData.ClearWmsTaskData(30);
|
|
||||||
ConsoleLog.Tip(apiWmsTaskCount > 0, $"[数据清理]WMS任务记录:{apiWmsTaskCount}");
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"[数据清理]线程发生异常,异常信息:{ex}");
|
ConsoleLog.Exception($"【数据清理】线程发生异常,异常信息:{ex}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.EquipOperation.Convey;
|
using WcsMain.EquipOperation.Convey;
|
||||||
|
|
||||||
namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
||||||
|
|
@ -6,12 +6,11 @@ namespace WcsMain.Business.CirculationTask.CommonCirculation;
|
||||||
[Circulation]
|
[Circulation]
|
||||||
public class HeartBeat(ConveyOperation conveyOperation)
|
public class HeartBeat(ConveyOperation conveyOperation)
|
||||||
{
|
{
|
||||||
private readonly ConveyOperation _conveyOperation = conveyOperation;
|
|
||||||
|
|
||||||
[Circulation("输送机心跳", 1000)]
|
[Circulation("输送机心跳", 1000)]
|
||||||
public bool ConveyHeartBeat()
|
public bool ConveyHeartBeat()
|
||||||
{
|
{
|
||||||
_conveyOperation.WriteHeartBeat();
|
conveyOperation.WriteHeartBeat();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
83
WcsMain/Business/CirculationTask/Convey/PickStandButton.cs
Normal file
83
WcsMain/Business/CirculationTask/Convey/PickStandButton.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
using CirculateTool.Attribute;
|
||||||
|
using WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.Enum.Convey;
|
||||||
|
using WcsMain.EquipOperation.Convey;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.CirculationTask.Convey;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣选站台按钮
|
||||||
|
/// </summary>
|
||||||
|
[Circulation]
|
||||||
|
public class PickStandButton(AppConveyStandDao conveyStandDao, ConveyOperation conveyOperation, WmsWebApiPost wmsWebApiPost)
|
||||||
|
{
|
||||||
|
|
||||||
|
private static List<AppConveyStand>? _pickStands; // 拣选站台
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当拣选站站台按钮按下时上传 wms
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Circulation("拣选站按钮按下上报", 300)]
|
||||||
|
public bool UploadInfo()
|
||||||
|
{
|
||||||
|
if (_pickStands == default)
|
||||||
|
{
|
||||||
|
_pickStands = conveyStandDao.Query(new AppConveyStand() { StandStatus = 1, StandType = (int)ConveyStandTypeEnum.pick });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_pickStands.Count < 1)
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【提示】无卡特拣选站台信息,监控已经停止");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<Task> tasks = [];
|
||||||
|
foreach (var pickStand in _pickStands)
|
||||||
|
{
|
||||||
|
Thread.Sleep(20);
|
||||||
|
Task task = new(() =>
|
||||||
|
{
|
||||||
|
int pickButtonStatus = conveyOperation.GetAllowPickStandGo(pickStand.StandId!);
|
||||||
|
if (pickButtonStatus != 1) return;
|
||||||
|
//ConsoleLog.Info($"【提示】拣选站:{pickStand.StandId} 按钮已经按下");
|
||||||
|
//conveyOperation.AllowPickStandGo(pickStand.StandId!, 2);
|
||||||
|
//ConsoleLog.Success($"{pickStand.StandId}按钮按下,调试阶段直接放行");
|
||||||
|
//return;
|
||||||
|
// 发送wms按钮按下
|
||||||
|
ConceyButtonClickRequest request = new()
|
||||||
|
{
|
||||||
|
Location = pickStand.StandId,
|
||||||
|
VehicleNo = "",
|
||||||
|
Remark = "按钮按下上报"
|
||||||
|
};
|
||||||
|
var responseEntity = wmsWebApiPost.HttpPost<ConceyButtonClickRequest, WmsResponse>(request, CommonData.AppApiBaseInfos.GetAddress("UploadPickStandButtonMethod") ?? "", 2000);
|
||||||
|
if (!responseEntity.IsSend) return; // 发送失败不处理,下一次循环在发送
|
||||||
|
// 只要发送成功则不再发送
|
||||||
|
ConsoleLog.Info( $"拣选站:{pickStand.StandId} 按钮已经按下上报成功,WMS返回:{responseEntity.ResponseMsg}");
|
||||||
|
var result = responseEntity.ResponseEntity;
|
||||||
|
if (result is { Code: 0 })
|
||||||
|
{
|
||||||
|
conveyOperation.AllowPickStandGo(pickStand.StandId!, 2);
|
||||||
|
ConsoleLog.Success($"{pickStand.StandId}按钮按下,放行成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
conveyOperation.AllowPickStandGo(pickStand.StandId!, 0);
|
||||||
|
ConsoleLog.Error($"【异常】{pickStand.StandId}按钮按下,wms返回异常:{result?.Message}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
task.Start();
|
||||||
|
tasks.Add(task);
|
||||||
|
}
|
||||||
|
Task.WaitAll([.. tasks]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
62
WcsMain/Business/CirculationTask/Convey/ReadScanCode.cs
Normal file
62
WcsMain/Business/CirculationTask/Convey/ReadScanCode.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
using CirculateTool.Attribute;
|
||||||
|
using WcsMain.Business.Convey.HistoryDataHandler;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.Enum.General;
|
||||||
|
using WcsMain.EquipOperation.Convey;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.CirculationTask.Convey;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 箱式线读取扫码信息
|
||||||
|
/// </summary>
|
||||||
|
[Circulation]
|
||||||
|
public class ReadScanCode(AppRouterMethodDao routerMethodDao, ConveyOperation conveyOperation, HistoryConveyDataHander historyConveyDataHander, AppScanRecordDao scanRecordDao, DataBaseData dataBaseData)
|
||||||
|
{
|
||||||
|
private static List<AppRouterMethod>? routers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取扫码数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Circulation("读取扫码数据", 300)]
|
||||||
|
public bool ReadData()
|
||||||
|
{
|
||||||
|
if(routers == default)
|
||||||
|
{
|
||||||
|
routers = routerMethodDao.Query(new AppRouterMethod() { RouterStatus = (int)TrueFalseEnum.TRUE });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
List<Task> tasks = [];
|
||||||
|
foreach(AppRouterMethod router in routers)
|
||||||
|
{
|
||||||
|
tasks.Add(Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
(var readErrText, var scanOk, var code) = conveyOperation.ReadScanInfo(router.Area);
|
||||||
|
if (!string.IsNullOrEmpty(readErrText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Exception($"【异常】读取扫码:{router.Area} 数据异常,信息:{readErrText}");
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
return; // 不读了,估计网断了
|
||||||
|
}
|
||||||
|
if (scanOk != (short)TrueFalseEnum.TRUE) { return; }
|
||||||
|
string clearErrText = conveyOperation.ClearScanStatus(router.Area);
|
||||||
|
if (!string.IsNullOrEmpty(clearErrText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Exception($"【异常】扫码:{router.Area} 清理读码信号异常,信息:{clearErrText}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"扫码:{router.Area} 清理读码信号成功,点位:{router.Area}");
|
||||||
|
}
|
||||||
|
historyConveyDataHander.GetData("-", code, router.Area ?? "");
|
||||||
|
scanRecordDao.Insert(new AppScanRecord() { RecordId = dataBaseData.GetNewUUID2(), ScanId = router.Area, Code = code, ScanTime = DateTime.Now });
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
Task.WaitAll([.. tasks]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
107
WcsMain/Business/CirculationTask/Convey/UploadBoxArrive.cs
Normal file
107
WcsMain/Business/CirculationTask/Convey/UploadBoxArrive.cs
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
using CirculateTool.Attribute;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.Enum.Convey;
|
||||||
|
using WcsMain.EquipOperation.Convey;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.CirculationTask.Convey;
|
||||||
|
|
||||||
|
|
||||||
|
[Circulation]
|
||||||
|
public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation conveyOperation, WmsWebApiPost wmsWebApiPost, AppConveyTaskDao conveyTaskDao, AppElTagTaskDao elTagTaskDao)
|
||||||
|
{
|
||||||
|
private static List<AppConveyStand>? _pickStands; // 拣选站台
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拣选台上报料箱
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Circulation("拣选台上报料箱", 300)]
|
||||||
|
public bool UploadInfo()
|
||||||
|
{
|
||||||
|
if (_pickStands == default)
|
||||||
|
{
|
||||||
|
_pickStands = conveyStandDao.Query(new AppConveyStand() { StandStatus = 1, StandType = (int)ConveyStandTypeEnum.pick });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (_pickStands.Count < 1)
|
||||||
|
{
|
||||||
|
ConsoleLog.Info($"【提示】无拣选站台信息,监控已经停止");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<Task> tasks = [];
|
||||||
|
foreach (AppConveyStand stand in _pickStands)
|
||||||
|
{
|
||||||
|
Task task = new(() =>
|
||||||
|
{
|
||||||
|
string code = conveyOperation.ReadStandCode(stand.StandId!);
|
||||||
|
code = Regex.Replace(code, "\\W", "");
|
||||||
|
if (string.IsNullOrEmpty(code)) return;
|
||||||
|
elTagTaskDao.ClearNotCompleteTaskWithStand(stand.StandId); // 清理之前未完成的电子标签任务
|
||||||
|
ConsoleLog.Info($"【提示】料箱:{code} 已经到达拣选站台:{stand.StandId}");
|
||||||
|
conveyOperation.ClearStandCodeStatus(stand.StandId!);
|
||||||
|
|
||||||
|
// 查询 条码 对应的任务
|
||||||
|
List<AppConveyTask>? pickTasks = conveyTaskDao.Query(new AppConveyTask()
|
||||||
|
{
|
||||||
|
VehicleNo = code,
|
||||||
|
TaskType = (int)ConveyTaskTypeEnum.pick,
|
||||||
|
Location = stand.StandId,
|
||||||
|
TaskStatus = (int)ConveyTaskStatusEnum.create
|
||||||
|
});
|
||||||
|
if (pickTasks == default || pickTasks.Count < 1)
|
||||||
|
{
|
||||||
|
ConsoleLog.Error($"【异常】拣选站台{stand.StandId} 料箱:{code} 找不到对应任务");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var completeTime = DateTime.Now;
|
||||||
|
List<AppConveyTask> updateTasks = [];
|
||||||
|
foreach (var pickTask in pickTasks)
|
||||||
|
{
|
||||||
|
updateTasks.Add(new AppConveyTask()
|
||||||
|
{
|
||||||
|
TaskId = pickTask.TaskId,
|
||||||
|
TaskStatus = (int)ConveyTaskStatusEnum.arrive,
|
||||||
|
ArriveLocation = stand.StandId,
|
||||||
|
CompleteTime = completeTime,
|
||||||
|
Remark = "PLC上报料箱到达"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
conveyTaskDao.Update(updateTasks.ToArray()); // 更新表内拣选时间和状态
|
||||||
|
}
|
||||||
|
// 发送wms料箱到达
|
||||||
|
UploadPickStandRequest request = new()
|
||||||
|
{
|
||||||
|
Location = stand.StandId,
|
||||||
|
VehicleNo = code,
|
||||||
|
Remark = $"料箱:{code} 已经到达站台:{stand.StandId}"
|
||||||
|
};
|
||||||
|
var responseEntity = wmsWebApiPost.HttpPost<UploadPickStandRequest, WmsResponse>(request, CommonData.AppApiBaseInfos.GetAddress("UploadBoxArrive") ?? "", 2000);
|
||||||
|
if (responseEntity.IsSend) // 发送失败不处理,下一次循环在发送
|
||||||
|
{
|
||||||
|
// 只要发送成功则不再发送
|
||||||
|
ConsoleLog.Info($"拣选站台{stand.Area} 获得对应料箱:{code} 上报成功,WMS返回:{responseEntity.ResponseMsg}");
|
||||||
|
conveyOperation.ClearStandCodeStatus(stand.Area!);
|
||||||
|
//var result = responseEntity.ResponseEntity;
|
||||||
|
//if (result != null && result.Code == 0) // 上报成功
|
||||||
|
//{
|
||||||
|
// conveyOperation.ClearStandCodeStatus(stand.Area!);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
task.Start();
|
||||||
|
tasks.Add(task);
|
||||||
|
}
|
||||||
|
Task.WaitAll([.. tasks]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,23 +1,21 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
|
using LedSimple;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.ElTag.Atop;
|
using WcsMain.ElTag.Atop;
|
||||||
|
using WcsMain.ElTag.Atop.AtopEnum;
|
||||||
using WcsMain.ElTag.Atop.Entity;
|
using WcsMain.ElTag.Atop.Entity;
|
||||||
using WcsMain.Enum.TaskEnum;
|
using WcsMain.Enum.ElTag;
|
||||||
using WcsMain.EquipOperation.ElTag;
|
using WcsMain.EquipOperation.ElTag;
|
||||||
|
|
||||||
namespace WcsMain.Business.CirculationTask.ElTag;
|
namespace WcsMain.Business.CirculationTask.ElTag;
|
||||||
|
|
||||||
|
|
||||||
[Circulation]
|
[Circulation]
|
||||||
public class LightElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation, AppElTagBaseDao elTagBaseDao)
|
public class LightElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation, AppElTagLocationDao elTagBaseDao)
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppElTagTaskDao _tagTaskDao = tagTaskDao;
|
|
||||||
private readonly AtopOperation _atopOperation = atopOperation;
|
|
||||||
private readonly AppElTagBaseDao _elTagBaseDao = elTagBaseDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 点亮电子标签
|
/// 点亮电子标签
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -25,7 +23,7 @@ public class LightElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation,
|
||||||
[Circulation("点亮电子标签")]
|
[Circulation("点亮电子标签")]
|
||||||
public bool Light()
|
public bool Light()
|
||||||
{
|
{
|
||||||
List<AppElTagTask>? tasks = _tagTaskDao.Query(new AppElTagTask { TaskStatus = (int)ElTagTaskStatusEnum.NeedLight });
|
List<AppElTagTask>? tasks = tagTaskDao.Query(new AppElTagTask { TaskStatus = (int)ElTagTaskStatusEnum.NeedLight });
|
||||||
if (tasks == default)
|
if (tasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception("【异常】查询 电子标签 任务失败,数据库连接异常");
|
ConsoleLog.Exception("【异常】查询 电子标签 任务失败,数据库连接异常");
|
||||||
|
|
@ -47,7 +45,7 @@ public class LightElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation,
|
||||||
if(tagInfo == default)
|
if(tagInfo == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】电子标签:{tagTask.Location} 不存在,无法点亮");
|
ConsoleLog.Warning($"【警告】电子标签:{tagTask.Location} 不存在,无法点亮");
|
||||||
_tagTaskDao.Update(new AppElTagTask
|
tagTaskDao.Update(new AppElTagTask
|
||||||
{
|
{
|
||||||
TaskId = tagTask.TaskId,
|
TaskId = tagTask.TaskId,
|
||||||
TaskStatus = (int)ElTagTaskStatusEnum.Error,
|
TaskStatus = (int)ElTagTaskStatusEnum.Error,
|
||||||
|
|
@ -57,20 +55,44 @@ public class LightElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* 点亮标签 */
|
/* 点亮标签 */
|
||||||
var resultException = _atopOperation.ShowMsg(tagInfo.ControllerDisplayName, tagInfo.TagId, tagTask.NeedNum);
|
LedColor lEDColor = new Func<LedColor>(() =>
|
||||||
|
{
|
||||||
|
return tagTask.TaskType switch
|
||||||
|
{
|
||||||
|
(int)ElTagTaskTypeEnum.PICK => LedColor.Green,
|
||||||
|
(int)ElTagTaskTypeEnum.STOCK => LedColor.Blue,
|
||||||
|
_ => LedColor.Red,
|
||||||
|
};
|
||||||
|
;
|
||||||
|
}).Invoke();
|
||||||
|
var resultException = atopOperation.ShowMsg(tagInfo.ControllerDisplayName, tagInfo.TagId, tagTask.NeedNum, lEDColor);
|
||||||
if(resultException == default )
|
if(resultException == default )
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"点亮电子标签成功,点位:{tagTask.Location},数据:{tagTask.NeedNum},载具号:{tagTask.VehicleNo},标签号:{tagInfo.TagId}");
|
ConsoleLog.Success($"点亮电子标签成功,点位:{tagTask.Location},数据:{tagTask.NeedNum},载具号:{tagTask.VehicleNo},标签号:{tagInfo.TagId}");
|
||||||
_tagTaskDao.Update(new AppElTagTask
|
tagTaskDao.Update(new AppElTagTask
|
||||||
{
|
{
|
||||||
TaskId = tagTask.TaskId,
|
TaskId = tagTask.TaskId,
|
||||||
TaskStatus = (int)ElTagTaskStatusEnum.Lighting,
|
TaskStatus = (int)ElTagTaskStatusEnum.Lighting,
|
||||||
LightTime = DateTime.Now,
|
LightTime = DateTime.Now,
|
||||||
}); // 更新任务状态
|
}); // 更新任务状态
|
||||||
_elTagBaseDao.Update(new AppElTagBase { Location = tagTask.Location, TaskId = tagTask.TaskId, LastLightTime = DateTime.Now }); // 更新点位状态,绑定任务
|
elTagBaseDao.Update(new AppElTagLocation { Location = tagTask.Location, TaskId = tagTask.TaskId, LastLightTime = DateTime.Now }); // 更新点位状态,绑定任务
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ConsoleLog.Warning($"【警告】点亮电子标签失败,点位:{tagTask.Location},数据:{tagTask.NeedNum},载具号:{tagTask.VehicleNo},标签号:{tagInfo.TagId},异常信息:{resultException.Message}");
|
ConsoleLog.Warning($"【警告】点亮电子标签失败,点位:{tagTask.Location},数据:{tagTask.NeedNum},载具号:{tagTask.VehicleNo},标签号:{tagInfo.TagId},异常信息:{resultException.Message}");
|
||||||
|
tagTaskDao.Update(new AppElTagTask
|
||||||
|
{
|
||||||
|
TaskId = tagTask.TaskId,
|
||||||
|
TaskStatus = (int)ElTagTaskStatusEnum.Error,
|
||||||
|
ConfirmTime = DateTime.Now,
|
||||||
|
Remark = resultException.Message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void LightPickTask()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.ElTag.Atop.Entity;
|
using WcsMain.ElTag.Atop.Entity;
|
||||||
using WcsMain.Enum.TaskEnum;
|
using WcsMain.Enum.ElTag;
|
||||||
using WcsMain.EquipOperation.ElTag;
|
using WcsMain.EquipOperation.ElTag;
|
||||||
|
|
||||||
namespace WcsMain.Business.CirculationTask.ElTag;
|
namespace WcsMain.Business.CirculationTask.ElTag;
|
||||||
|
|
@ -18,13 +18,9 @@ namespace WcsMain.Business.CirculationTask.ElTag;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 熄灭电子标签
|
/// 熄灭电子标签
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Circulation]
|
//[Circulation]
|
||||||
public class OffElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation)
|
public class OffElTag(AppElTagTaskDao tagTaskDao)
|
||||||
{
|
{
|
||||||
private readonly AppElTagTaskDao _tagTaskDao = tagTaskDao;
|
|
||||||
private readonly AtopOperation _atopOperation = atopOperation;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检验任务组内任务是否全部确认,若全部确认则熄灭所有标签
|
/// 检验任务组内任务是否全部确认,若全部确认则熄灭所有标签
|
||||||
|
|
@ -34,7 +30,7 @@ public class OffElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation)
|
||||||
public bool CheckTaskIsConfirmAll()
|
public bool CheckTaskIsConfirmAll()
|
||||||
{
|
{
|
||||||
/* 查询已经确认的任务的任务组 */
|
/* 查询已经确认的任务的任务组 */
|
||||||
List<AppElTagTask>? tasks = _tagTaskDao.QueryRunningTask();
|
List<AppElTagTask>? tasks = tagTaskDao.QueryRunningTask();
|
||||||
if (tasks == default)
|
if (tasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception("【异常】查询 电子标签 任务失败,数据库连接异常");
|
ConsoleLog.Exception("【异常】查询 电子标签 任务失败,数据库连接异常");
|
||||||
|
|
@ -77,7 +73,7 @@ public class OffElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (offTasks.Count < 1) return;
|
if (offTasks.Count < 1) return;
|
||||||
_tagTaskDao.Update([.. offTasks]); // 更新状态为熄灭
|
tagTaskDao.Update([.. offTasks]); // 更新状态为熄灭
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@ namespace WcsMain.Business.CirculationTask;
|
||||||
/// 读取 PLC 的扫码
|
/// 读取 PLC 的扫码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//[Circulation]
|
//[Circulation]
|
||||||
public class ScanMethod(DataBaseData dataBaseData)
|
public class ScanMethod()
|
||||||
{
|
{
|
||||||
private readonly DataBaseData _dataBaseData = dataBaseData;
|
|
||||||
|
|
||||||
|
|
||||||
//private static string[]? _scanId;
|
//private static string[]? _scanId;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.Business.CommonAction;
|
using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
|
|
@ -16,10 +16,6 @@ namespace WcsMain.Business.CirculationTask.Stacker;
|
||||||
[Circulation()]
|
[Circulation()]
|
||||||
public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTaskDao, WCSTaskExecuteEvent wcsTaskEvent)
|
public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTaskDao, WCSTaskExecuteEvent wcsTaskEvent)
|
||||||
{
|
{
|
||||||
private readonly WCSTaskExecuteEvent _wcsTaskEvent = wcsTaskEvent;
|
|
||||||
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
|
||||||
private readonly StackerOperation _stackerOperation = stackerOperation;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PLC过账
|
/// PLC过账
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -27,8 +23,8 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
[Circulation("监控PLC地址,过账", 1000)]
|
[Circulation("监控PLC地址,过账", 1000)]
|
||||||
public bool CheckAccountTask()
|
public bool CheckAccountTask()
|
||||||
{
|
{
|
||||||
var openStackers = CommonData.AppStackers.Open();
|
var openStackers = CommonData.AppStackers.Open(); // 只获取开放的堆垛机
|
||||||
List<TaskFeedBackEntity>? taskFeedBackEntities = _stackerOperation.GetTaskFeedBackData(1, openStackers);
|
List<TaskFeedBackEntity>? taskFeedBackEntities = stackerOperation.GetTaskFeedBackData(20, openStackers);
|
||||||
if (taskFeedBackEntities == default || taskFeedBackEntities.Count < 1)
|
if (taskFeedBackEntities == default || taskFeedBackEntities.Count < 1)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -36,7 +32,7 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
foreach (TaskFeedBackEntity taskFeedBackEntity in taskFeedBackEntities)
|
foreach (TaskFeedBackEntity taskFeedBackEntity in taskFeedBackEntities)
|
||||||
{
|
{
|
||||||
if (taskFeedBackEntity.PlcId == 0) { continue; }
|
if (taskFeedBackEntity.PlcId == 0) { continue; }
|
||||||
List<AppWcsTask>? wcsTasks = _wcsTaskDao.Select(new AppWcsTask() { PlcId = taskFeedBackEntity.PlcId });
|
List<AppWcsTask>? wcsTasks = wcsTaskDao.Select(new AppWcsTask() { PlcId = taskFeedBackEntity.PlcId });
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】堆垛机过账查询任务数据失败,和数据库服务器连接中断");
|
ConsoleLog.Error($"【异常】堆垛机过账查询任务数据失败,和数据库服务器连接中断");
|
||||||
|
|
@ -46,7 +42,7 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
if (wcsTasks.Count < 1)
|
if (wcsTasks.Count < 1)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【提示】堆垛机过账区获取任务ID:{taskFeedBackEntity.PlcId},无关联任务");
|
ConsoleLog.Warning($"【提示】堆垛机过账区获取任务ID:{taskFeedBackEntity.PlcId},无关联任务");
|
||||||
_stackerOperation.ClearFeedBackData(taskFeedBackEntity); // 清除过账
|
stackerOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
continue; // 任务无数据
|
continue; // 任务无数据
|
||||||
}
|
}
|
||||||
var wcsTask = wcsTasks[0];
|
var wcsTask = wcsTasks[0];
|
||||||
|
|
@ -79,14 +75,14 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
/// <param name="wcsTask"></param>
|
/// <param name="wcsTask"></param>
|
||||||
private void CancelTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
private void CancelTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【提示】过账区反馈:PlcId:{taskFeedBackEntity.PlcId} 已经被取消,后续任务也一并取消,任务号:{wcsTask.TaskId}");
|
ConsoleLog.Warning($"【提示】过账区反馈:PlcId:{taskFeedBackEntity.PlcId} 已经被取消,后续任务也一并取消,任务号:{wcsTask.TaskId},箱号:{wcsTask.VehicleNo}");
|
||||||
string? cleanAccountErr = _stackerOperation.ClearFeedBackData(taskFeedBackEntity); // 清除过账
|
string? cleanAccountErr = stackerOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
if (!string.IsNullOrEmpty(cleanAccountErr))
|
if (!string.IsNullOrEmpty(cleanAccountErr))
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
ConsoleLog.Warning($"【警告】取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
||||||
}
|
}
|
||||||
/* 执行 WMS 任务异常动作 */
|
/* 执行 WMS 任务异常动作 */
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, "任务被PLC取消");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, "任务被PLC取消");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,14 +93,14 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
/// <param name="wcsTask"></param>
|
/// <param name="wcsTask"></param>
|
||||||
private void CompleteTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
private void CompleteTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
||||||
{
|
{
|
||||||
ConsoleLog.Tip($"【提示】过账区获取任务ID:{taskFeedBackEntity.PlcId},任务已经完成,任务号:{wcsTask.TaskId}");
|
ConsoleLog.Tip($"【提示】过账区获取任务ID:{taskFeedBackEntity.PlcId},任务已经完成,任务号:{wcsTask.TaskId},箱号:{wcsTask.VehicleNo}");
|
||||||
var cleanAccountErr = _stackerOperation.ClearFeedBackData(taskFeedBackEntity); // 清除过账
|
var cleanAccountErr = stackerOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
if (!string.IsNullOrEmpty(cleanAccountErr))
|
if (!string.IsNullOrEmpty(cleanAccountErr))
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】完成任务清除过账区发生异常,信息:{cleanAccountErr}");
|
ConsoleLog.Warning($"【警告】完成任务清除过账区发生异常,信息:{cleanAccountErr}");
|
||||||
}
|
}
|
||||||
/* 执行 WMS 任务完成动作 */
|
/* 执行 WMS 任务完成动作 */
|
||||||
_wcsTaskEvent.CompleteTaskEvent(wcsTask, "PLC上报完成");
|
wcsTaskEvent.CompleteTaskEvent(wcsTask, "PLC上报完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -116,14 +112,14 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
/// <param name="wcsTask"></param>
|
/// <param name="wcsTask"></param>
|
||||||
private void DoubleInFeedBackType(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
private void DoubleInFeedBackType(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[提示]过账区获取任务ID:{taskFeedBackEntity.PlcId},卸货位置有货,任务号:{wcsTask.TaskId}");
|
ConsoleLog.Warning($"[提示]过账区获取任务ID:{taskFeedBackEntity.PlcId},卸货位置有货,任务号:{wcsTask.TaskId},箱号:{wcsTask.VehicleNo}");
|
||||||
string? cleanAccountErr = _stackerOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
string? cleanAccountErr = stackerOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
if (!string.IsNullOrEmpty(cleanAccountErr))
|
if (!string.IsNullOrEmpty(cleanAccountErr))
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[警告]取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
ConsoleLog.Warning($"[警告]取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
||||||
}
|
}
|
||||||
/* 执行 WMS 任务异常动作 */
|
/* 执行 WMS 任务异常动作 */
|
||||||
_wcsTaskEvent.DoubleInTaskEvent(wcsTask, "卸货位置有货");
|
wcsTaskEvent.DoubleInTaskEvent(wcsTask, "卸货位置有货");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -133,14 +129,14 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
/// <param name="wcsTask"></param>
|
/// <param name="wcsTask"></param>
|
||||||
private void EmptyOutFeedBackType(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
private void EmptyOutFeedBackType(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[警告]过账区获取任务ID:{taskFeedBackEntity.PlcId},取货位置无货,任务号:{wcsTask.TaskId}");
|
ConsoleLog.Warning($"[警告]过账区获取任务ID:{taskFeedBackEntity.PlcId},取货位置无货,任务号:{wcsTask.TaskId},箱号:{wcsTask.VehicleNo}");
|
||||||
string? cleanAccountErr = _stackerOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
string? cleanAccountErr = stackerOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
if (!string.IsNullOrEmpty(cleanAccountErr))
|
if (!string.IsNullOrEmpty(cleanAccountErr))
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[警告]取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
ConsoleLog.Warning($"[警告]取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
||||||
}
|
}
|
||||||
/* 执行 WMS 任务异常动作 */
|
/* 执行 WMS 任务异常动作 */
|
||||||
_wcsTaskEvent.EmptyOutTaskEvent(wcsTask, "取货位置无货");
|
wcsTaskEvent.EmptyOutTaskEvent(wcsTask, "取货位置无货");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -152,7 +148,7 @@ public class CheckAccount(StackerOperation stackerOperation, AppWcsTaskDao wcsTa
|
||||||
private void OtherTaskFeedBackType(TaskFeedBackEntity taskFeedBackEntity)
|
private void OtherTaskFeedBackType(TaskFeedBackEntity taskFeedBackEntity)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[警告]过账区获取任务ID:{taskFeedBackEntity.PlcId},无法识别的过账类型:{taskFeedBackEntity.FeedBackType}");
|
ConsoleLog.Warning($"[警告]过账区获取任务ID:{taskFeedBackEntity.PlcId},无法识别的过账类型:{taskFeedBackEntity.FeedBackType}");
|
||||||
_stackerOperation.ClearFeedBackData(taskFeedBackEntity); // 清除过账
|
stackerOperation.ClearFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,14 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.Business.CommonAction;
|
using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.MixDao;
|
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.DataService;
|
using WcsMain.DataService;
|
||||||
using WcsMain.Enum.Stacker;
|
using WcsMain.Enum.Stacker;
|
||||||
using WcsMain.Enum.TaskEnum;
|
|
||||||
using WcsMain.EquipOperation.Convey;
|
using WcsMain.EquipOperation.Convey;
|
||||||
using WcsMain.EquipOperation.Entity.Stacker;
|
using WcsMain.EquipOperation.Entity.Stacker;
|
||||||
using WcsMain.EquipOperation.Stacker;
|
using WcsMain.EquipOperation.Stacker;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
using static Dm.net.buffer.ByteArrayBuffer;
|
|
||||||
|
|
||||||
namespace WcsMain.Business.CirculationTask.Stacker;
|
namespace WcsMain.Business.CirculationTask.Stacker;
|
||||||
|
|
||||||
|
|
@ -24,12 +21,6 @@ public class ExeTaskDoubleFork(
|
||||||
StackerOperation stackerOperation, AppWcsTaskDao wcsTaskDao, WCSTaskExecuteEvent wcsTaskEvent,
|
StackerOperation stackerOperation, AppWcsTaskDao wcsTaskDao, WCSTaskExecuteEvent wcsTaskEvent,
|
||||||
ConveyOperation conveyOperation, DataBaseData dataBaseData)
|
ConveyOperation conveyOperation, DataBaseData dataBaseData)
|
||||||
{
|
{
|
||||||
private readonly WCSTaskExecuteEvent _wcsTaskEvent = wcsTaskEvent;
|
|
||||||
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
|
||||||
private readonly StackerOperation _stackerOperation = stackerOperation;
|
|
||||||
private readonly ConveyOperation _conveyOperation = conveyOperation;
|
|
||||||
private readonly DataBaseData _dataBaseData = dataBaseData;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行堆垛机任务
|
/// 执行堆垛机任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -37,39 +28,34 @@ public class ExeTaskDoubleFork(
|
||||||
[Circulation("执行堆垛机任务")]
|
[Circulation("执行堆垛机任务")]
|
||||||
public bool ExecuteStackerTask()
|
public bool ExecuteStackerTask()
|
||||||
{
|
{
|
||||||
List<Task> tasks = [];
|
|
||||||
foreach (var stacker in CommonData.AppStackers.Open())
|
foreach (var stacker in CommonData.AppStackers.Open())
|
||||||
{
|
{
|
||||||
tasks.Add(Task.Factory.StartNew(() =>
|
var stackerUseStatus = stackerOperation.StackerCanUse(stacker.StackerId, out int plcId, out int spare1);
|
||||||
|
if (stackerUseStatus == StackerUseStatusEnum.Free)
|
||||||
{
|
{
|
||||||
var stackerUseStatus = _stackerOperation.StackerCanUse(stacker.StackerId, out int plcId, out int spare1);
|
/* 空闲时正常执行任务 */
|
||||||
if (stackerUseStatus == StackerUseStatusEnum.Free)
|
// 移库
|
||||||
{
|
bool exeMoveTask = ExecuteMoveTask(stacker.StackerId);
|
||||||
/* 空闲时正常执行任务 */
|
if (exeMoveTask) continue;
|
||||||
// 移库
|
// 出库
|
||||||
bool exeMoveTask = ExecuteMoveTask(stacker.StackerId);
|
bool exeOutTask = ExecuteOutTask(stacker.StackerId);
|
||||||
if (exeMoveTask) return;
|
if (exeOutTask) continue;
|
||||||
// 出库
|
// 入库
|
||||||
bool exeOutTask = ExecuteOutTask(stacker.StackerId);
|
bool exeInTask = ExecuteInTask(stacker.StackerId);
|
||||||
if (exeOutTask) return;
|
if (exeInTask) continue;
|
||||||
// 入库
|
// 拣选
|
||||||
bool exeInTask = ExecuteInTask(stacker.StackerId);
|
//bool exePickTask = ExecutePickTask(stacker.StackerId);
|
||||||
if (exeInTask) return;
|
//if (exePickTask) return;
|
||||||
// 拣选
|
}
|
||||||
//bool exePickTask = ExecutePickTask(stacker.StackerId);
|
if (stackerUseStatus == StackerUseStatusEnum.waitTask)
|
||||||
//if (exePickTask) return;
|
{
|
||||||
}
|
/* 重复入库时执行任务 */
|
||||||
if (stackerUseStatus == StackerUseStatusEnum.waitTask)
|
bool exeDoubleInTask = ExecuteDoubleInTask(stacker.StackerId, plcId, 1);
|
||||||
{
|
if (exeDoubleInTask) continue;
|
||||||
/* 重复入库时执行任务 */
|
exeDoubleInTask = ExecuteDoubleInTask(stacker.StackerId, spare1, 2);
|
||||||
bool exeDoubleInTask = ExecuteDoubleInTask(stacker.StackerId, plcId, 1);
|
if (exeDoubleInTask) continue;
|
||||||
if (exeDoubleInTask) return;
|
}
|
||||||
exeDoubleInTask = ExecuteDoubleInTask(stacker.StackerId, spare1, 2);
|
|
||||||
if (exeDoubleInTask) return;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
Task.WaitAll([.. tasks]);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,10 +69,10 @@ public class ExeTaskDoubleFork(
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
/* 检查入库站台是否允许取货 */
|
/* 检查入库站台是否允许取货 */
|
||||||
bool allowGetGoods = _conveyOperation.AllGetVehicle(stackerId.ToString());
|
bool allowGetGoods = conveyOperation.AllowGetVehicle(stackerId.ToString());
|
||||||
if(!allowGetGoods) return false; // 入库站台不允许取货
|
if(!allowGetGoods) return false; // 入库站台不允许取货
|
||||||
/* 读取入库站台的条码 */
|
/* 读取入库站台的条码 */
|
||||||
var codes = _conveyOperation.ReadConveyCode(stackerId.ToString());
|
var codes = conveyOperation.ReadAreaConveyCode(stackerId.ToString());
|
||||||
if(codes == default || codes.Count != 2) return false;
|
if(codes == default || codes.Count != 2) return false;
|
||||||
/* 构造任务数据 */
|
/* 构造任务数据 */
|
||||||
bool isWriteTask = false; // 指示是否写入任务
|
bool isWriteTask = false; // 指示是否写入任务
|
||||||
|
|
@ -97,17 +83,17 @@ public class ExeTaskDoubleFork(
|
||||||
if (forkStatus.Length <= i || forkStatus[i] != '1') continue; // 获取数据失败或者货叉未开启
|
if (forkStatus.Length <= i || forkStatus[i] != '1') continue; // 获取数据失败或者货叉未开启
|
||||||
var code = codes[i];
|
var code = codes[i];
|
||||||
if (string.IsNullOrEmpty(code)) continue; // 检查条码是否为空
|
if (string.IsNullOrEmpty(code)) continue; // 检查条码是否为空
|
||||||
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,入库位置:{i + 1} 返回:{code}");
|
//ConsoleLog.Warning($"{stackerId} 号堆垛机,入库位置:{i + 1} 返回:{code}");
|
||||||
if (code == "NoRead") // 检查条码是否为 NoRead
|
if (code == "NoRead") // 检查条码是否为 NoRead
|
||||||
{
|
{
|
||||||
/* 检查卸货站台是否允许卸货 */
|
/* 检查卸货站台是否允许卸货 */
|
||||||
bool allowSetGoods = _conveyOperation.AllSetVehicle(stackerId.ToString());
|
bool allowSetGoods = conveyOperation.AllowSetVehicle(stackerId.ToString());
|
||||||
if (!allowSetGoods) continue; // 出库站台不允许取货
|
if (!allowSetGoods) continue; // 出库站台不允许取货
|
||||||
/* 生成一个直接卸货出去的任务 */
|
/* 生成一个直接卸货出去的任务 */
|
||||||
int? plcId = _dataBaseData.GetNewPlcTaskId();
|
int? plcId = dataBaseData.GetNewPlcTaskId();
|
||||||
if(plcId == default || plcId == 0) continue;
|
if(plcId == default || plcId == 0) continue;
|
||||||
StackerPlcTask errTask = StackerPlcTask.DefaultErrTask((int)plcId!, (int)stackerId!, i + 1);
|
StackerPlcTask errTask = StackerPlcTask.DefaultErrTask((int)plcId!, (int)stackerId!, i + 1);
|
||||||
string WriteTaskErrText = _stackerOperation.WriteTask(errTask, i + 1);
|
string WriteTaskErrText = stackerOperation.WriteTask(errTask, i + 1);
|
||||||
if(string.IsNullOrEmpty(WriteTaskErrText)) // 写入成功
|
if(string.IsNullOrEmpty(WriteTaskErrText)) // 写入成功
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{errTask}");
|
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{errTask}");
|
||||||
|
|
@ -119,7 +105,7 @@ public class ExeTaskDoubleFork(
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var wcsTasks = _wcsTaskDao.Select(new AppWcsTask { VehicleNo = code, TaskStatus = (int)WcsTaskStatusEnum.create });
|
var wcsTasks = wcsTaskDao.Select(new AppWcsTask { VehicleNo = code, TaskStatus = (int)WcsTaskStatusEnum.create });
|
||||||
if(wcsTasks == default) // 查询任务失败
|
if(wcsTasks == default) // 查询任务失败
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception($"【警告】{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code} 查找任务失败,和数据库服务器连接中断");
|
ConsoleLog.Exception($"【警告】{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code} 查找任务失败,和数据库服务器连接中断");
|
||||||
|
|
@ -128,14 +114,14 @@ public class ExeTaskDoubleFork(
|
||||||
if(wcsTasks.Count < 1) // 没有任务
|
if(wcsTasks.Count < 1) // 没有任务
|
||||||
{
|
{
|
||||||
/* 检查卸货站台是否允许卸货 */
|
/* 检查卸货站台是否允许卸货 */
|
||||||
bool allowSetGoods = _conveyOperation.AllSetVehicle(stackerId.ToString());
|
bool allowSetGoods = conveyOperation.AllowSetVehicle(stackerId.ToString());
|
||||||
if (!allowSetGoods) continue; // 出库站台不允许取货
|
if (!allowSetGoods) continue; // 出库站台不允许取货
|
||||||
/* 生成一个直接卸货出去的任务 */
|
/* 生成一个直接卸货出去的任务 */
|
||||||
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code} 没有找到对应任务");
|
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code} 没有找到对应任务");
|
||||||
int? plcId = _dataBaseData.GetNewPlcTaskId();
|
int? plcId = dataBaseData.GetNewPlcTaskId();
|
||||||
if (plcId == default || plcId == 0) continue;
|
if (plcId == default || plcId == 0) continue;
|
||||||
StackerPlcTask errTask = StackerPlcTask.DefaultErrTask((int)plcId!, (int)stackerId!, i + 1, code.ToPlcVehicleNo());
|
StackerPlcTask errTask = StackerPlcTask.DefaultErrTask((int)plcId!, (int)stackerId!, i + 1, code.ToPlcVehicleNo());
|
||||||
string WriteTaskErrText = _stackerOperation.WriteTask(errTask, i + 1);
|
string WriteTaskErrText = stackerOperation.WriteTask(errTask, i + 1);
|
||||||
if (string.IsNullOrEmpty(WriteTaskErrText)) // 写入成功
|
if (string.IsNullOrEmpty(WriteTaskErrText)) // 写入成功
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{errTask}");
|
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{errTask}");
|
||||||
|
|
@ -153,18 +139,18 @@ public class ExeTaskDoubleFork(
|
||||||
if(destinationLocationInfo == default) // 任务终点错误,理论上此处不应该出现异常
|
if(destinationLocationInfo == default) // 任务终点错误,理论上此处不应该出现异常
|
||||||
{
|
{
|
||||||
/* 检查卸货站台是否允许卸货 */
|
/* 检查卸货站台是否允许卸货 */
|
||||||
bool allowSetGoods = _conveyOperation.AllSetVehicle(stackerId.ToString());
|
bool allowSetGoods = conveyOperation.AllowSetVehicle(stackerId.ToString());
|
||||||
if (!allowSetGoods) continue; // 出库站台不允许取货
|
if (!allowSetGoods) continue; // 出库站台不允许取货
|
||||||
/* 生成一个直接卸货出去的任务 */
|
/* 生成一个直接卸货出去的任务 */
|
||||||
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code} 无法识别的入库库位");
|
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code} 无法识别的入库库位");
|
||||||
int? plcId = _dataBaseData.GetNewPlcTaskId();
|
int? plcId = dataBaseData.GetNewPlcTaskId();
|
||||||
if (plcId == default || plcId == 0) continue;
|
if (plcId == default || plcId == 0) continue;
|
||||||
StackerPlcTask errTask = StackerPlcTask.DefaultErrTask((int)plcId!, (int)stackerId!, i + 1, code.ToPlcVehicleNo());
|
StackerPlcTask errTask = StackerPlcTask.DefaultErrTask((int)plcId!, (int)stackerId!, i + 1, code.ToPlcVehicleNo());
|
||||||
string WriteTaskErrText = _stackerOperation.WriteTask(errTask, i + 1);
|
string WriteTaskErrText = stackerOperation.WriteTask(errTask, i + 1);
|
||||||
if (string.IsNullOrEmpty(WriteTaskErrText)) // 写入成功
|
if (string.IsNullOrEmpty(WriteTaskErrText)) // 写入成功
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{errTask}");
|
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{errTask}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, "入库库位不正确");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, "入库库位不正确");
|
||||||
isWriteTask = true;
|
isWriteTask = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -174,16 +160,16 @@ public class ExeTaskDoubleFork(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* 判断冲突货位是否有任务 */
|
/* 判断冲突货位是否有任务 */
|
||||||
var runningWcsTasks = _wcsTaskDao.QueryTaskWithWcsLocation(destinationLocationInfo.InterveneLocation);
|
var runningWcsTasks = wcsTaskDao.QueryTaskWithWcsLocation(destinationLocationInfo.InterveneLocation);
|
||||||
if (runningWcsTasks == default) continue; // 查询失败
|
if (runningWcsTasks == default) continue; // 查询失败
|
||||||
if(runningWcsTasks.Count > 0) continue; // 存在冲突点位,等待
|
if(runningWcsTasks.Count > 0) continue; // 存在冲突点位,等待
|
||||||
/* 下发任务 */
|
/* 下发任务 */
|
||||||
StackerPlcTask stackerTask = wcsTask.ToStackerInTask((int)stackerId!, i + 1, destinationLocationInfo);
|
StackerPlcTask stackerTask = wcsTask.ToStackerInTask((int)stackerId!, i + 1, destinationLocationInfo);
|
||||||
string WriteStackerTaskErrText = _stackerOperation.WriteTask(stackerTask, i + 1);
|
string WriteStackerTaskErrText = stackerOperation.WriteTask(stackerTask, i + 1);
|
||||||
if (string.IsNullOrEmpty(WriteStackerTaskErrText)) // 写入成功
|
if (string.IsNullOrEmpty(WriteStackerTaskErrText)) // 写入成功
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{stackerTask}");
|
ConsoleLog.Success($"{stackerId} 号堆垛机,入库位置:{i + 1} 条码:{code},写入任务成功,{stackerTask}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask); // 任务开始
|
wcsTaskEvent.StartTaskEvent(wcsTask); // 任务开始
|
||||||
isWriteTask = true;
|
isWriteTask = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -193,8 +179,8 @@ public class ExeTaskDoubleFork(
|
||||||
}
|
}
|
||||||
if (isWriteTask)
|
if (isWriteTask)
|
||||||
{
|
{
|
||||||
string confirmResult = _stackerOperation.WriteTaskConfirm(stackerId); // 写入任务确认
|
string confirmResult = stackerOperation.WriteTaskConfirm(stackerId); // 写入任务确认
|
||||||
ConsoleLog.Info($"堆垛机入库任务写任务确认;信息:{(string.IsNullOrEmpty(confirmResult) ? "成功" : confirmResult)}");
|
ConsoleLog.Info($"堆垛机:{stackerId} 入库任务写任务确认;信息:{(string.IsNullOrEmpty(confirmResult) ? "成功" : confirmResult)}");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
return isWriteTask;
|
return isWriteTask;
|
||||||
|
|
@ -209,9 +195,9 @@ public class ExeTaskDoubleFork(
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
/* 检查出库站台是否可以卸货 */
|
/* 检查出库站台是否可以卸货 */
|
||||||
bool allowSetGoods = _conveyOperation.AllSetVehicle(stackerId.ToString());
|
bool allowSetGoods = conveyOperation.AllowSetVehicle(stackerId.ToString());
|
||||||
if (!allowSetGoods) return false; // 出库站台不允许取货
|
if (!allowSetGoods) return false; // 出库站台不允许取货
|
||||||
var wcsTasks = _wcsTaskDao.SelectOutTaskWithStacker((int)stackerId!);
|
var wcsTasks = wcsTaskDao.SelectOutTaskWithStacker((int)stackerId!);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception(string.Format("【异常】{0} 号堆垛机出库任务查询失败,与数据库连接异常", stackerId));
|
ConsoleLog.Exception(string.Format("【异常】{0} 号堆垛机出库任务查询失败,与数据库连接异常", stackerId));
|
||||||
|
|
@ -237,20 +223,20 @@ public class ExeTaskDoubleFork(
|
||||||
if (originLocationInfo == default) // 任务起点错误,理论上此处不应该出现异常
|
if (originLocationInfo == default) // 任务起点错误,理论上此处不应该出现异常
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,出库库位:{wcsTask.Origin} 条码:{wcsTask.VehicleNo} 无法识别的出库库位");
|
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,出库库位:{wcsTask.Origin} 条码:{wcsTask.VehicleNo} 无法识别的出库库位");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, "出库的库位不正确");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, "出库的库位不正确");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* 判断冲突货位是否有任务 */
|
/* 判断冲突货位是否有任务 */
|
||||||
var runningWcsTasks = _wcsTaskDao.QueryTaskWithWcsLocation(originLocationInfo.InterveneLocation);
|
var runningWcsTasks = wcsTaskDao.QueryTaskWithWcsLocation(originLocationInfo.InterveneLocation);
|
||||||
if (runningWcsTasks == default) continue; // 查询失败
|
if (runningWcsTasks == default) continue; // 查询失败
|
||||||
if (runningWcsTasks.Count > 0) continue; // 存在冲突点位,等待
|
if (runningWcsTasks.Count > 0) continue; // 存在冲突点位,等待
|
||||||
/* 下发任务 */
|
/* 下发任务 */
|
||||||
StackerPlcTask stackerTask = wcsTask.ToStackerOutTask((int)stackerId!, i + 1, originLocationInfo);
|
StackerPlcTask stackerTask = wcsTask.ToStackerOutTask((int)stackerId!, i + 1, originLocationInfo);
|
||||||
string WriteStackerTaskErrText = _stackerOperation.WriteTask(stackerTask, i + 1);
|
string WriteStackerTaskErrText = stackerOperation.WriteTask(stackerTask, i + 1);
|
||||||
if (string.IsNullOrEmpty(WriteStackerTaskErrText)) // 写入成功
|
if (string.IsNullOrEmpty(WriteStackerTaskErrText)) // 写入成功
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"{stackerId} 号堆垛机,出库位置:{i + 1} 条码:{wcsTask.VehicleNo},写入任务成功,{stackerTask}");
|
ConsoleLog.Success($"{stackerId} 号堆垛机,出库位置:{i + 1} 条码:{wcsTask.VehicleNo},写入任务成功,{stackerTask}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask); // 任务开始
|
wcsTaskEvent.StartTaskEvent(wcsTask); // 任务开始
|
||||||
writeTaskCount++;
|
writeTaskCount++;
|
||||||
isWriteTask = true;
|
isWriteTask = true;
|
||||||
}
|
}
|
||||||
|
|
@ -261,8 +247,8 @@ public class ExeTaskDoubleFork(
|
||||||
}
|
}
|
||||||
if (isWriteTask)
|
if (isWriteTask)
|
||||||
{
|
{
|
||||||
string confirmResult = _stackerOperation.WriteTaskConfirm(stackerId); // 写入任务确认
|
string confirmResult = stackerOperation.WriteTaskConfirm(stackerId); // 写入任务确认
|
||||||
ConsoleLog.Info($"堆垛机出库任务写任务确认;信息:{(string.IsNullOrEmpty(confirmResult) ? "成功" : confirmResult)}");
|
ConsoleLog.Info($"堆垛机:{stackerId}出库任务写任务确认;信息:{(string.IsNullOrEmpty(confirmResult) ? "成功" : confirmResult)}");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
return isWriteTask;
|
return isWriteTask;
|
||||||
|
|
@ -276,7 +262,7 @@ public class ExeTaskDoubleFork(
|
||||||
public bool ExecutePickTask(int? stackerId)
|
public bool ExecutePickTask(int? stackerId)
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
var wcsTasks = _wcsTaskDao.SelectPickOutTaskWithStacker((int)stackerId!);
|
var wcsTasks = wcsTaskDao.SelectPickOutTaskWithStacker((int)stackerId!);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机拣选任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机拣选任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -294,7 +280,7 @@ public class ExeTaskDoubleFork(
|
||||||
{
|
{
|
||||||
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
||||||
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StackerPlcTask stackerTask = new()
|
StackerPlcTask stackerTask = new()
|
||||||
|
|
@ -318,17 +304,17 @@ public class ExeTaskDoubleFork(
|
||||||
Weight = Convert.ToInt16(wcsTask.Weight),
|
Weight = Convert.ToInt16(wcsTask.Weight),
|
||||||
Code = wcsTask.PlcVehicleNo ?? 0,
|
Code = wcsTask.PlcVehicleNo ?? 0,
|
||||||
};
|
};
|
||||||
var writeStackerTaskErrText = _stackerOperation.WriteTask(stackerTask);
|
var writeStackerTaskErrText = stackerOperation.WriteTask(stackerTask);
|
||||||
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"堆垛机:{stackerId} 写入拣选任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
ConsoleLog.Success($"堆垛机:{stackerId} 写入拣选任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask);
|
wcsTaskEvent.StartTaskEvent(wcsTask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入拣选任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入拣选任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -342,7 +328,7 @@ public class ExeTaskDoubleFork(
|
||||||
public bool ExecuteMoveTask(int? stackerId)
|
public bool ExecuteMoveTask(int? stackerId)
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
var wcsTasks = _wcsTaskDao.SelectMoveTaskWithStacker((int)stackerId!);
|
var wcsTasks = wcsTaskDao.SelectMoveTaskWithStacker((int)stackerId!);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机移库任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机移库任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -369,20 +355,20 @@ public class ExeTaskDoubleFork(
|
||||||
if (originLocationInfo == default || destinationLocationInfo == default) // 任务起点终点错误,理论上此处不应该出现异常
|
if (originLocationInfo == default || destinationLocationInfo == default) // 任务起点终点错误,理论上此处不应该出现异常
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,移库库位:{wcsTask.Origin} 条码:{wcsTask.VehicleNo} 无法识别的库位");
|
ConsoleLog.Warning($"【警告】{stackerId} 号堆垛机,移库库位:{wcsTask.Origin} 条码:{wcsTask.VehicleNo} 无法识别的库位");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, "移库的库位不正确");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, "移库的库位不正确");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* 判断冲突货位是否有任务,起点终点都要判断 */
|
/* 判断冲突货位是否有任务,起点终点都要判断 */
|
||||||
var runningWcsTasks = _wcsTaskDao.QueryTaskWithWcsLocation(destinationLocationInfo.InterveneLocation, originLocationInfo.InterveneLocation);
|
var runningWcsTasks = wcsTaskDao.QueryTaskWithWcsLocation(destinationLocationInfo.InterveneLocation, originLocationInfo.InterveneLocation);
|
||||||
if (runningWcsTasks == default) continue; // 查询失败
|
if (runningWcsTasks == default) continue; // 查询失败
|
||||||
if (runningWcsTasks.Count > 0) continue; // 存在冲突点位,等待
|
if (runningWcsTasks.Count > 0) continue; // 存在冲突点位,等待
|
||||||
/* 下发任务 */
|
/* 下发任务 */
|
||||||
StackerPlcTask stackerTask = wcsTask.ToStackerMoveTask((int)stackerId!, originLocationInfo, destinationLocationInfo);
|
StackerPlcTask stackerTask = wcsTask.ToStackerMoveTask((int)stackerId!, originLocationInfo, destinationLocationInfo);
|
||||||
string WriteStackerTaskErrText = _stackerOperation.WriteTask(stackerTask, i + 1);
|
string WriteStackerTaskErrText = stackerOperation.WriteTask(stackerTask, i + 1);
|
||||||
if (string.IsNullOrEmpty(WriteStackerTaskErrText)) // 写入成功
|
if (string.IsNullOrEmpty(WriteStackerTaskErrText)) // 写入成功
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"{stackerId} 号堆垛机,移库位置:{i + 1} 条码:{wcsTask.VehicleNo},写入任务成功,{stackerTask}");
|
ConsoleLog.Success($"{stackerId} 号堆垛机,移库位置:{i + 1} 条码:{wcsTask.VehicleNo},写入任务成功,{stackerTask}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask); // 任务开始
|
wcsTaskEvent.StartTaskEvent(wcsTask); // 任务开始
|
||||||
writeTaskCount++;
|
writeTaskCount++;
|
||||||
isWriteTask = true;
|
isWriteTask = true;
|
||||||
}
|
}
|
||||||
|
|
@ -393,8 +379,8 @@ public class ExeTaskDoubleFork(
|
||||||
}
|
}
|
||||||
if (isWriteTask)
|
if (isWriteTask)
|
||||||
{
|
{
|
||||||
string confirmResult = _stackerOperation.WriteTaskConfirm(stackerId); // 写入任务确认
|
string confirmResult = stackerOperation.WriteTaskConfirm(stackerId); // 写入任务确认
|
||||||
ConsoleLog.Info($"堆垛机移库任务写任务确认;信息:{(string.IsNullOrEmpty(confirmResult) ? "成功" : confirmResult)}");
|
ConsoleLog.Info($"堆垛机:{stackerId}移库任务写任务确认;信息:{(string.IsNullOrEmpty(confirmResult) ? "成功" : confirmResult)}");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
return isWriteTask;
|
return isWriteTask;
|
||||||
|
|
@ -412,7 +398,7 @@ public class ExeTaskDoubleFork(
|
||||||
{
|
{
|
||||||
if (stackerId == default || plcId == 0) return false;
|
if (stackerId == default || plcId == 0) return false;
|
||||||
/* 查找这个PlcId对应的wms任务 */
|
/* 查找这个PlcId对应的wms任务 */
|
||||||
List<AppWcsTask>? doubleInTasks = _wcsTaskDao.Select(new AppWcsTask { PlcId = plcId });
|
List<AppWcsTask>? doubleInTasks = wcsTaskDao.Select(new AppWcsTask { PlcId = plcId });
|
||||||
if (doubleInTasks == default)
|
if (doubleInTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务检验失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务检验失败,与数据库连接异常");
|
||||||
|
|
@ -424,7 +410,7 @@ public class ExeTaskDoubleFork(
|
||||||
/* 判断这个任务是否出现卸货位置有货 */
|
/* 判断这个任务是否出现卸货位置有货 */
|
||||||
if(doubleTask.TaskStatus != (int)WcsTaskStatusEnum.doubleIn) { return false; } // 没有重复入库不执行下面方法
|
if(doubleTask.TaskStatus != (int)WcsTaskStatusEnum.doubleIn) { return false; } // 没有重复入库不执行下面方法
|
||||||
/* 查找这个任务的新任务 */
|
/* 查找这个任务的新任务 */
|
||||||
List<AppWcsTask>? newTasks = _wcsTaskDao.Select(new AppWcsTask { TaskId = doubleTask.TaskId, TaskType = (int)WcsTaskTypeEnum.newTaskForDoubleIn, TaskStatus = (int)WcsTaskStatusEnum.create });
|
List<AppWcsTask>? newTasks = wcsTaskDao.Select(new AppWcsTask { TaskId = doubleTask.TaskId, TaskType = (int)WcsTaskTypeEnum.newTaskForDoubleIn, TaskStatus = (int)WcsTaskStatusEnum.create });
|
||||||
if (newTasks == default)
|
if (newTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务新任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务新任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -438,26 +424,26 @@ public class ExeTaskDoubleFork(
|
||||||
{
|
{
|
||||||
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
||||||
ConsoleLog.Warning($"【警告】任务号:{newTask.TaskId},Plc任务号:{newTask.PlcId} 无法执行,新终点存在异常");
|
ConsoleLog.Warning($"【警告】任务号:{newTask.TaskId},Plc任务号:{newTask.PlcId} 无法执行,新终点存在异常");
|
||||||
_wcsTaskEvent.ErrTaskEvent(newTask, $"新终点存在异常");
|
wcsTaskEvent.ErrTaskEvent(newTask, $"新终点存在异常");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/* 判断冲突货位是否有任务 */
|
/* 判断冲突货位是否有任务 */
|
||||||
var runningWcsTasks = _wcsTaskDao.QueryTaskWithWcsLocation(destinationLocationInfo.InterveneLocation);
|
var runningWcsTasks = wcsTaskDao.QueryTaskWithWcsLocation(destinationLocationInfo.InterveneLocation);
|
||||||
if (runningWcsTasks == default) return false; // 查询失败
|
if (runningWcsTasks == default) return false; // 查询失败
|
||||||
if (runningWcsTasks.Count > 0) return false; // 存在冲突点位,等待
|
if (runningWcsTasks.Count > 0) return false; // 存在冲突点位,等待
|
||||||
/* 下发任务 */
|
/* 下发任务 */
|
||||||
StackerPlcTask stackerTask = newTask.ToStackerInTask((int)stackerId!, forkId, destinationLocationInfo);
|
StackerPlcTask stackerTask = newTask.ToStackerInTask((int)stackerId!, forkId, destinationLocationInfo);
|
||||||
var writeStackerTaskErrText = _stackerOperation.WriteTask(stackerTask);
|
var writeStackerTaskErrText = stackerOperation.WriteTask(stackerTask);
|
||||||
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"堆垛机:{stackerId} 写入重复入库新任务成功,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination}");
|
ConsoleLog.Success($"堆垛机:{stackerId} 写入重复入库新任务成功,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination}");
|
||||||
_wcsTaskEvent.StartTaskEvent(newTask);
|
wcsTaskEvent.StartTaskEvent(newTask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入重复入库新任务失败,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination},异常信息:{writeStackerTaskErrText}");
|
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入重复入库新任务失败,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination},异常信息:{writeStackerTaskErrText}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(newTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
wcsTaskEvent.ErrTaskEvent(newTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.Business.CommonAction;
|
using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
|
|
@ -17,10 +17,6 @@ namespace WcsMain.Business.CirculationTask.Stacker;
|
||||||
//[Circulation(tags: ["stacker"])]
|
//[Circulation(tags: ["stacker"])]
|
||||||
public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcsTaskDao, WCSTaskExecuteEvent wcsTaskEvent)
|
public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcsTaskDao, WCSTaskExecuteEvent wcsTaskEvent)
|
||||||
{
|
{
|
||||||
private readonly WCSTaskExecuteEvent _wcsTaskEvent = wcsTaskEvent;
|
|
||||||
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
|
||||||
private readonly StackerOperation _stackerOperation = stackerOperation;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行堆垛机任务
|
/// 执行堆垛机任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -30,7 +26,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
{
|
{
|
||||||
foreach (var stacker in CommonData.AppStackers.Open())
|
foreach (var stacker in CommonData.AppStackers.Open())
|
||||||
{
|
{
|
||||||
var stackerUseStatus = _stackerOperation.StackerCanUse(stacker.StackerId, out int plcId, out int _);
|
var stackerUseStatus = stackerOperation.StackerCanUse(stacker.StackerId, out int plcId, out int _);
|
||||||
if (stackerUseStatus == StackerUseStatusEnum.Free)
|
if (stackerUseStatus == StackerUseStatusEnum.Free)
|
||||||
{
|
{
|
||||||
/* 空闲时正常执行任务 */
|
/* 空闲时正常执行任务 */
|
||||||
|
|
@ -69,7 +65,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
private bool ExecuteInTask(int? stackerId)
|
private bool ExecuteInTask(int? stackerId)
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
var wcsTasks = _wcsTaskDao.SelectInTaskWithStacker((int)stackerId!); // 此处方法内已经判断状态
|
var wcsTasks = wcsTaskDao.SelectInTaskWithStacker((int)stackerId!); // 此处方法内已经判断状态
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机入库任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机入库任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -87,7 +83,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
{
|
{
|
||||||
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
||||||
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StackerPlcTask stackerTask = new()
|
StackerPlcTask stackerTask = new()
|
||||||
|
|
@ -111,17 +107,17 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
Weight = Convert.ToInt16(wcsTask.Weight),
|
Weight = Convert.ToInt16(wcsTask.Weight),
|
||||||
Code = wcsTask.PlcVehicleNo ?? 0,
|
Code = wcsTask.PlcVehicleNo ?? 0,
|
||||||
};
|
};
|
||||||
var writeStackerTaskErrText = _stackerOperation.WriteTask(stackerTask);
|
var writeStackerTaskErrText = stackerOperation.WriteTask(stackerTask);
|
||||||
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"堆垛机:{stackerId} 写入入库任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
ConsoleLog.Success($"堆垛机:{stackerId} 写入入库任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask);
|
wcsTaskEvent.StartTaskEvent(wcsTask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入入库任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入入库任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +130,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
public bool ExecuteOutTask(int? stackerId)
|
public bool ExecuteOutTask(int? stackerId)
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
var wcsTasks = _wcsTaskDao.SelectOutTaskWithStacker((int)stackerId!);
|
var wcsTasks = wcsTaskDao.SelectOutTaskWithStacker((int)stackerId!);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机出库任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机出库任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -152,7 +148,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
{
|
{
|
||||||
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
||||||
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StackerPlcTask stackerTask = new()
|
StackerPlcTask stackerTask = new()
|
||||||
|
|
@ -176,17 +172,17 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
Weight = Convert.ToInt16(wcsTask.Weight),
|
Weight = Convert.ToInt16(wcsTask.Weight),
|
||||||
Code = wcsTask.PlcVehicleNo ?? 0,
|
Code = wcsTask.PlcVehicleNo ?? 0,
|
||||||
};
|
};
|
||||||
var writeStackerTaskErrText = _stackerOperation.WriteTask(stackerTask);
|
var writeStackerTaskErrText = stackerOperation.WriteTask(stackerTask);
|
||||||
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"堆垛机:{stackerId} 写入出库任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
ConsoleLog.Success($"堆垛机:{stackerId} 写入出库任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask);
|
wcsTaskEvent.StartTaskEvent(wcsTask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入出库任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入出库任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -200,7 +196,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
public bool ExecutePickTask(int? stackerId)
|
public bool ExecutePickTask(int? stackerId)
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
var wcsTasks = _wcsTaskDao.SelectPickOutTaskWithStacker((int)stackerId!);
|
var wcsTasks = wcsTaskDao.SelectPickOutTaskWithStacker((int)stackerId!);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机拣选任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机拣选任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -218,7 +214,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
{
|
{
|
||||||
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
||||||
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StackerPlcTask stackerTask = new()
|
StackerPlcTask stackerTask = new()
|
||||||
|
|
@ -242,17 +238,17 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
Weight = Convert.ToInt16(wcsTask.Weight),
|
Weight = Convert.ToInt16(wcsTask.Weight),
|
||||||
Code = wcsTask.PlcVehicleNo ?? 0,
|
Code = wcsTask.PlcVehicleNo ?? 0,
|
||||||
};
|
};
|
||||||
var writeStackerTaskErrText = _stackerOperation.WriteTask(stackerTask);
|
var writeStackerTaskErrText = stackerOperation.WriteTask(stackerTask);
|
||||||
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"堆垛机:{stackerId} 写入拣选任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
ConsoleLog.Success($"堆垛机:{stackerId} 写入拣选任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask);
|
wcsTaskEvent.StartTaskEvent(wcsTask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入拣选任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入拣选任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -266,7 +262,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
public bool ExecuteMoveTask(int? stackerId)
|
public bool ExecuteMoveTask(int? stackerId)
|
||||||
{
|
{
|
||||||
if (stackerId == default) return false;
|
if (stackerId == default) return false;
|
||||||
var wcsTasks = _wcsTaskDao.SelectMoveTaskWithStacker((int)stackerId!);
|
var wcsTasks = wcsTaskDao.SelectMoveTaskWithStacker((int)stackerId!);
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机移库任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机移库任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -282,7 +278,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
{
|
{
|
||||||
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
||||||
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
ConsoleLog.Warning($"【警告】任务号:{wcsTask.TaskId},Plc任务号:{wcsTask.PlcId} 无法执行,起点或者终点存在异常");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"起点或者终点存在异常");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StackerPlcTask stackerTask = new()
|
StackerPlcTask stackerTask = new()
|
||||||
|
|
@ -306,17 +302,17 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
Weight = Convert.ToInt16(wcsTask.Weight),
|
Weight = Convert.ToInt16(wcsTask.Weight),
|
||||||
Code = wcsTask.PlcVehicleNo ?? 0,
|
Code = wcsTask.PlcVehicleNo ?? 0,
|
||||||
};
|
};
|
||||||
var writeStackerTaskErrText = _stackerOperation.WriteTask(stackerTask);
|
var writeStackerTaskErrText = stackerOperation.WriteTask(stackerTask);
|
||||||
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"堆垛机:{stackerId} 写入移库任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
ConsoleLog.Success($"堆垛机:{stackerId} 写入移库任务成功,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination}");
|
||||||
_wcsTaskEvent.StartTaskEvent(wcsTask);
|
wcsTaskEvent.StartTaskEvent(wcsTask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入移库任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入移库任务失败,箱号:{wcsTask.VehicleNo},PlcId:{wcsTask.PlcId};{wcsTask.Origin} => {wcsTask.Destination},异常信息:{writeStackerTaskErrText}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -332,7 +328,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
{
|
{
|
||||||
if (stackerId == default || plcId == 0) return false;
|
if (stackerId == default || plcId == 0) return false;
|
||||||
/* 查找这个PlcId对应的wms任务 */
|
/* 查找这个PlcId对应的wms任务 */
|
||||||
List<AppWcsTask>? doubleInTasks = _wcsTaskDao.Select(new AppWcsTask { PlcId = plcId });
|
List<AppWcsTask>? doubleInTasks = wcsTaskDao.Select(new AppWcsTask { PlcId = plcId });
|
||||||
if (doubleInTasks == default)
|
if (doubleInTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务检验失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务检验失败,与数据库连接异常");
|
||||||
|
|
@ -342,7 +338,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
if (doubleInTasks.Count == 0) return false; // 找不到对应的PlcId的任务
|
if (doubleInTasks.Count == 0) return false; // 找不到对应的PlcId的任务
|
||||||
var doubleTask = doubleInTasks[0];
|
var doubleTask = doubleInTasks[0];
|
||||||
/* 查找这个任务的新任务 */
|
/* 查找这个任务的新任务 */
|
||||||
List<AppWcsTask>? newTasks = _wcsTaskDao.Select(new AppWcsTask { TaskId = doubleTask.TaskId, TaskType = (int)TaskTypeEnum.newTaskForDoubleIn, TaskStatus = (int)WmsTaskStatusEnum.create });
|
List<AppWcsTask>? newTasks = wcsTaskDao.Select(new AppWcsTask { TaskId = doubleTask.TaskId, TaskType = (int)TaskTypeEnum.newTaskForDoubleIn, TaskStatus = (int)WmsTaskStatusEnum.create });
|
||||||
if (newTasks == default)
|
if (newTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务新任务查询失败,与数据库连接异常");
|
ConsoleLog.Error($"【异常】{stackerId} 号堆垛机重复入库任务新任务查询失败,与数据库连接异常");
|
||||||
|
|
@ -356,7 +352,7 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
{
|
{
|
||||||
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
// 已经在接口内做了检查,按道理此处不会出错。直接返回异常,任务直接取消
|
||||||
ConsoleLog.Warning($"【警告】任务号:{newTask.TaskId},Plc任务号:{newTask.PlcId} 无法执行,新终点存在异常");
|
ConsoleLog.Warning($"【警告】任务号:{newTask.TaskId},Plc任务号:{newTask.PlcId} 无法执行,新终点存在异常");
|
||||||
_wcsTaskEvent.ErrTaskEvent(newTask, $"新终点存在异常");
|
wcsTaskEvent.ErrTaskEvent(newTask, $"新终点存在异常");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
StackerPlcTask stackerTask = new()
|
StackerPlcTask stackerTask = new()
|
||||||
|
|
@ -380,17 +376,17 @@ public class ExecuteWcsTask(StackerOperation stackerOperation, AppWcsTaskDao wcs
|
||||||
Weight = Convert.ToInt16(newTask.Weight),
|
Weight = Convert.ToInt16(newTask.Weight),
|
||||||
Code = newTask.PlcVehicleNo ?? 0,
|
Code = newTask.PlcVehicleNo ?? 0,
|
||||||
};
|
};
|
||||||
var writeStackerTaskErrText = _stackerOperation.WriteTask(stackerTask);
|
var writeStackerTaskErrText = stackerOperation.WriteTask(stackerTask);
|
||||||
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
if (string.IsNullOrEmpty(writeStackerTaskErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"堆垛机:{stackerId} 写入重复入库新任务成功,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination}");
|
ConsoleLog.Success($"堆垛机:{stackerId} 写入重复入库新任务成功,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination}");
|
||||||
_wcsTaskEvent.StartTaskEvent(newTask);
|
wcsTaskEvent.StartTaskEvent(newTask);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入重复入库新任务失败,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination},异常信息:{writeStackerTaskErrText}");
|
ConsoleLog.Warning($"【警告】堆垛机:{stackerId} 写入重复入库新任务失败,箱号:{newTask.VehicleNo},PlcId:{newTask.PlcId};新目的地:{newTask.Destination},异常信息:{writeStackerTaskErrText}");
|
||||||
_wcsTaskEvent.ErrTaskEvent(newTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
wcsTaskEvent.ErrTaskEvent(newTask, $"写入任务失败,异常信息:{writeStackerTaskErrText}");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
71
WcsMain/Business/CirculationTask/Stacker/RecordErr.cs
Normal file
71
WcsMain/Business/CirculationTask/Stacker/RecordErr.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
using CirculateTool.Attribute;
|
||||||
|
using WcsMain.ApiServe.Controllers.Dto.WcsDto.Stacker;
|
||||||
|
using WcsMain.ApiServe.Factory;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
using WcsMain.DataService;
|
||||||
|
using WcsMain.EquipOperation.Stacker;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.CirculationTask.Stacker;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 本类主要用于采集堆垛机报警信息
|
||||||
|
/// </summary>
|
||||||
|
[Circulation]
|
||||||
|
public class RecordErr(StackerOperation stackerOperation, AppErrRecorDao errRecorDao, DataBaseData dataBaseData)
|
||||||
|
{
|
||||||
|
|
||||||
|
Dictionary<int, short> errData = []; // 用于存储故障
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采集堆垛机报警信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Circulation("采集堆垛机报警信息", 1000)]
|
||||||
|
public bool RecordErrMethod()
|
||||||
|
{
|
||||||
|
List<AppStacker> stackers = CommonData.AppStackers.Open();
|
||||||
|
if (stackers.Count < 1) return true;
|
||||||
|
foreach (AppStacker stacker in stackers)
|
||||||
|
{
|
||||||
|
/* 获取堆垛机状态 */
|
||||||
|
var (errMsg, stackerInfo) = stackerOperation.GetStackerInfo((int)stacker.StackerId!);
|
||||||
|
if (string.IsNullOrEmpty(errMsg) && stackerInfo != default)
|
||||||
|
{
|
||||||
|
short errCode = stackerInfo.ErrCode;
|
||||||
|
if (errCode != 0) // 有故障
|
||||||
|
{
|
||||||
|
bool isGet = errData.TryGetValue((int)stacker.StackerId, out short oldErrCode);
|
||||||
|
if(!isGet || oldErrCode != errCode) // 发生了一个新故障
|
||||||
|
{
|
||||||
|
AddStackerErr($"Stacker{stacker.StackerId}", errCode); // 添加故障
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errData[(int)stacker.StackerId] = errCode; // 添加或者更新值
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录新故障
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="equipmentId"></param>
|
||||||
|
/// <param name="errNo"></param>
|
||||||
|
private void AddStackerErr(string equipmentId, short errNo)
|
||||||
|
{
|
||||||
|
ConsoleLog.Error($"【报警】堆垛机设备:{equipmentId},发生新报警:{errNo}");
|
||||||
|
errRecorDao.Insert(new AppErrRecord
|
||||||
|
{
|
||||||
|
RecordId = dataBaseData.GetNewUUID2(),
|
||||||
|
Area = "S",
|
||||||
|
ErrNo = errNo,
|
||||||
|
EquipmentId = equipmentId,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
Remark = ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
using CirculateTool.Attribute;
|
||||||
|
using WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.EquipOperation.Stacker;
|
||||||
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
|
||||||
|
namespace WcsMain.Business.CirculationTask.Stacker;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传堆垛机可用状态给wms
|
||||||
|
/// </summary>
|
||||||
|
[Circulation]
|
||||||
|
public class UploadStackerStatus(StackerOperation stackerOperation, WmsWebApiPost wmsWebApiPost)
|
||||||
|
{
|
||||||
|
List<int?> StackerNotOpen = [];
|
||||||
|
|
||||||
|
[Circulation("上传堆垛机报错状态给WMS")]
|
||||||
|
public bool Uplaod()
|
||||||
|
{
|
||||||
|
List<UploadStackerStatusRequest> uploadStackerStatusRequests = []; // 需要上报给WMS的状态
|
||||||
|
var allStackers = CommonData.AppStackers;
|
||||||
|
foreach (var stacker in allStackers)
|
||||||
|
{
|
||||||
|
if(!StackerNotOpen.Contains(stacker.StackerId))
|
||||||
|
{
|
||||||
|
/* 检查堆垛机是否开放 */
|
||||||
|
var canUse = stacker.StackerStatus;
|
||||||
|
if (canUse == null || canUse == 0)
|
||||||
|
{
|
||||||
|
StackerNotOpen.Add(stacker.StackerId);
|
||||||
|
uploadStackerStatusRequests.Add(new UploadStackerStatusRequest
|
||||||
|
{
|
||||||
|
Equipment = stacker.StackerId,
|
||||||
|
Error = 1,
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 检查设备是否可用 ---- 从设备通讯拉取 */
|
||||||
|
Thread.Sleep(200);
|
||||||
|
var (errMsg, stackerInfo) = stackerOperation.GetStackerInfo((int)stacker.StackerId!);
|
||||||
|
if (!string.IsNullOrEmpty(errMsg) || stackerInfo == null) // 报错
|
||||||
|
{
|
||||||
|
uploadStackerStatusRequests.Add(new UploadStackerStatusRequest
|
||||||
|
{
|
||||||
|
Equipment = stacker.StackerId,
|
||||||
|
Error = 1,
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int canUse2 = (stackerInfo.ErrCode == 0 && stackerInfo.ControlModel == Enum.Stacker.StackerControlModeEnum.online && stackerInfo.StackerStatus != Enum.Stacker.StackerStatusEnum.offline) ? 1 : 0;
|
||||||
|
uploadStackerStatusRequests.Add(new UploadStackerStatusRequest
|
||||||
|
{
|
||||||
|
Equipment = stacker.StackerId,
|
||||||
|
Error = canUse2 == 0 ? 1 : 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 上报 WMS
|
||||||
|
wmsWebApiPost.HttpPost<List<UploadStackerStatusRequest>, WmsResponse>(uploadStackerStatusRequests, CommonData.AppApiBaseInfos.GetAddress("uploadStackerStatus") ?? "", time: 500, executeAction: false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.Business.CommonAction;
|
using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
|
@ -14,9 +14,6 @@ namespace WcsMain.Business.CirculationTask.StackerConvey;
|
||||||
[Circulation]
|
[Circulation]
|
||||||
public class CheckAccount(AppWcsTaskDao wcsTaskDao, StackerConveyOperation stackerConveyOperation, WCSTaskExecuteEvent wcsTaskEvent)
|
public class CheckAccount(AppWcsTaskDao wcsTaskDao, StackerConveyOperation stackerConveyOperation, WCSTaskExecuteEvent wcsTaskEvent)
|
||||||
{
|
{
|
||||||
private readonly WCSTaskExecuteEvent _wcsTaskEvent = wcsTaskEvent;
|
|
||||||
private readonly StackerConveyOperation _stackerConveyOperation = stackerConveyOperation;
|
|
||||||
private readonly AppWcsTaskDao _wcsTaskDao = wcsTaskDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PLC过账
|
/// PLC过账
|
||||||
|
|
@ -25,12 +22,12 @@ public class CheckAccount(AppWcsTaskDao wcsTaskDao, StackerConveyOperation stack
|
||||||
[Circulation("监控PLC地址,过账", 1000)]
|
[Circulation("监控PLC地址,过账", 1000)]
|
||||||
public bool CheckAccountTask()
|
public bool CheckAccountTask()
|
||||||
{
|
{
|
||||||
List<TaskFeedBackEntity>? taskFeedBackEntities = _stackerConveyOperation.GetConveyTaskFeedBackData(20);
|
List<TaskFeedBackEntity>? taskFeedBackEntities = stackerConveyOperation.GetConveyTaskFeedBackData(20);
|
||||||
if (taskFeedBackEntities == default || taskFeedBackEntities.Count < 1) {return true; }
|
if (taskFeedBackEntities == default || taskFeedBackEntities.Count < 1) {return true; }
|
||||||
foreach (TaskFeedBackEntity taskFeedBackEntity in taskFeedBackEntities)
|
foreach (TaskFeedBackEntity taskFeedBackEntity in taskFeedBackEntities)
|
||||||
{
|
{
|
||||||
if (taskFeedBackEntity.PlcId == 0) { continue; }
|
if (taskFeedBackEntity.PlcId == 0) { continue; }
|
||||||
List<AppWcsTask>? wcsTasks = _wcsTaskDao.Select(new AppWcsTask() { PlcId = taskFeedBackEntity.PlcId });
|
List<AppWcsTask>? wcsTasks = wcsTaskDao.Select(new AppWcsTask() { PlcId = taskFeedBackEntity.PlcId });
|
||||||
if (wcsTasks == default)
|
if (wcsTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error($"【异常】库前输送过账查询任务数据失败,和数据库服务器连接中断");
|
ConsoleLog.Error($"【异常】库前输送过账查询任务数据失败,和数据库服务器连接中断");
|
||||||
|
|
@ -40,7 +37,7 @@ public class CheckAccount(AppWcsTaskDao wcsTaskDao, StackerConveyOperation stack
|
||||||
if (wcsTasks.Count < 1)
|
if (wcsTasks.Count < 1)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【提示】库前输送过账区获取任务ID:{taskFeedBackEntity.PlcId},无关联任务");
|
ConsoleLog.Warning($"【提示】库前输送过账区获取任务ID:{taskFeedBackEntity.PlcId},无关联任务");
|
||||||
_stackerConveyOperation.ClearFeedBackData(taskFeedBackEntity); // 清除过账
|
stackerConveyOperation.ClearFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
continue; // 任务无数据
|
continue; // 任务无数据
|
||||||
}
|
}
|
||||||
var wcsTask = wcsTasks[0];
|
var wcsTask = wcsTasks[0];
|
||||||
|
|
@ -67,13 +64,13 @@ public class CheckAccount(AppWcsTaskDao wcsTaskDao, StackerConveyOperation stack
|
||||||
private void CancelTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
private void CancelTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"【提示】库前输送过账区获取任务ID:{taskFeedBackEntity.PlcId},任务已经被取消,后续任务也一并取消,任务号:{wcsTask.TaskId}");
|
ConsoleLog.Warning($"【提示】库前输送过账区获取任务ID:{taskFeedBackEntity.PlcId},任务已经被取消,后续任务也一并取消,任务号:{wcsTask.TaskId}");
|
||||||
string? cleanAccountErr = _stackerConveyOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
string? cleanAccountErr = stackerConveyOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
if (!string.IsNullOrEmpty(cleanAccountErr))
|
if (!string.IsNullOrEmpty(cleanAccountErr))
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[警告]取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
ConsoleLog.Warning($"[警告]取消任务清除过账区发生异常,信息:{cleanAccountErr}");
|
||||||
}
|
}
|
||||||
/* 执行 WMS 任务异常动作 */
|
/* 执行 WMS 任务异常动作 */
|
||||||
_wcsTaskEvent.ErrTaskEvent(wcsTask, "任务被PLC取消");
|
wcsTaskEvent.ErrTaskEvent(wcsTask, "任务被PLC取消");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,13 +81,13 @@ public class CheckAccount(AppWcsTaskDao wcsTaskDao, StackerConveyOperation stack
|
||||||
private void CompleteTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
private void CompleteTask(TaskFeedBackEntity taskFeedBackEntity, AppWcsTask wcsTask)
|
||||||
{
|
{
|
||||||
ConsoleLog.Tip($"[提示]过账区获取任务ID:{taskFeedBackEntity.PlcId},任务已经完成,任务号:{wcsTask.TaskId}");
|
ConsoleLog.Tip($"[提示]过账区获取任务ID:{taskFeedBackEntity.PlcId},任务已经完成,任务号:{wcsTask.TaskId}");
|
||||||
string? cleanAccountErr = _stackerConveyOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
string? cleanAccountErr = stackerConveyOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
if (!string.IsNullOrEmpty(cleanAccountErr))
|
if (!string.IsNullOrEmpty(cleanAccountErr))
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[警告]完成任务清除过账区发生异常,信息:{cleanAccountErr}");
|
ConsoleLog.Warning($"[警告]完成任务清除过账区发生异常,信息:{cleanAccountErr}");
|
||||||
}
|
}
|
||||||
/* 执行 WMS 任务完成动作 */
|
/* 执行 WMS 任务完成动作 */
|
||||||
_wcsTaskEvent.CompleteTaskEvent(wcsTask, "PLC上报完成");
|
wcsTaskEvent.CompleteTaskEvent(wcsTask, "PLC上报完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,7 +99,7 @@ public class CheckAccount(AppWcsTaskDao wcsTaskDao, StackerConveyOperation stack
|
||||||
private void OtherTaskFeedBackType(TaskFeedBackEntity taskFeedBackEntity)
|
private void OtherTaskFeedBackType(TaskFeedBackEntity taskFeedBackEntity)
|
||||||
{
|
{
|
||||||
ConsoleLog.Warning($"[警告]过账区获取任务ID:{taskFeedBackEntity.PlcId},无法识别的过账类型:{taskFeedBackEntity.FeedBackType}");
|
ConsoleLog.Warning($"[警告]过账区获取任务ID:{taskFeedBackEntity.PlcId},无法识别的过账类型:{taskFeedBackEntity.FeedBackType}");
|
||||||
_stackerConveyOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
stackerConveyOperation.ResetFeedBackData(taskFeedBackEntity); // 清除过账
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
|
|
||||||
namespace WcsMain.Business.CirculationTask.StackerConvey;
|
namespace WcsMain.Business.CirculationTask.StackerConvey;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
using CirculateTool;
|
using CirculateTool.Attribute;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.DataService;
|
using WcsMain.DataService;
|
||||||
using WcsMain.Enum.TaskEnum;
|
|
||||||
using WcsMain.Business.CommonAction;
|
using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.StaticData;
|
using WcsMain.StaticData;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using WcsMain.DataBase.MixDao;
|
||||||
|
using WcsMain.Enum.Stacker;
|
||||||
|
using WcsMain.Enum.TaskEnum;
|
||||||
|
|
||||||
namespace WcsMain.Business.CirculationTask.TaskData;
|
namespace WcsMain.Business.CirculationTask.TaskData;
|
||||||
|
|
||||||
|
|
@ -14,12 +17,8 @@ namespace WcsMain.Business.CirculationTask.TaskData;
|
||||||
/// WMS任务解析类
|
/// WMS任务解析类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Circulation()]
|
[Circulation()]
|
||||||
public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsTaskStatus, DataBaseData dataBaseData)
|
public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsTaskStatus, DataBaseData dataBaseData, TaskDao taskDao)
|
||||||
{
|
{
|
||||||
private readonly DataBaseData _dataBaseData = dataBaseData;
|
|
||||||
private readonly SendWmsTaskStatus _sendWmsTaskStatus = sendWmsTaskStatus;
|
|
||||||
private readonly AppWmsTaskDao _wmsTaskDao = wmsTaskDao;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解析WMS任务
|
/// 解析WMS任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -27,7 +26,7 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
[Circulation("解析WMS任务,转换为WCS任务")]
|
[Circulation("解析WMS任务,转换为WCS任务")]
|
||||||
public bool ResolveTask()
|
public bool ResolveTask()
|
||||||
{
|
{
|
||||||
List<AppWmsTask>? needResolveTask = _wmsTaskDao.Select(new AppWmsTask() { TaskStatus = (int)WmsTaskStatusEnum.create });
|
List<AppWmsTask>? needResolveTask = wmsTaskDao.Select(new AppWmsTask() { TaskStatus = (int)WmsTaskStatusEnum.create });
|
||||||
if (needResolveTask == default)
|
if (needResolveTask == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Error("【异常】解析Wms任务时拉取任务列表失败,与数据库连接中断");
|
ConsoleLog.Error("【异常】解析Wms任务时拉取任务列表失败,与数据库连接中断");
|
||||||
|
|
@ -46,10 +45,18 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
private void ResolveTask(AppWmsTask wmsTask)
|
private void ResolveTask(AppWmsTask wmsTask)
|
||||||
{
|
{
|
||||||
/* 校验起点终点是否在点位表 */
|
/* 校验起点终点是否在点位表 */
|
||||||
bool checkResult = CommonData.AppLocations.ExistWmsLocation(wmsTask.Origin, wmsTask.Destination);
|
if (wmsTask.TaskType == (int)WmsTaskTypeEnum.inTask)
|
||||||
if(!checkResult)
|
|
||||||
{
|
{
|
||||||
_wmsTaskDao.Update(new()
|
wmsTask.Origin = string.IsNullOrEmpty(wmsTask.Origin)? "R" : wmsTask.Origin;
|
||||||
|
}
|
||||||
|
if (wmsTask.TaskType == (int)WmsTaskTypeEnum.outTask)
|
||||||
|
{
|
||||||
|
wmsTask.Destination = string.IsNullOrEmpty(wmsTask.Destination) ? "C" : wmsTask.Destination;
|
||||||
|
}
|
||||||
|
bool checkResult = CommonData.AppLocations.ExistWmsLocation(wmsTask.Origin, wmsTask.Destination);
|
||||||
|
if (!checkResult)
|
||||||
|
{
|
||||||
|
wmsTaskDao.Update(new()
|
||||||
{
|
{
|
||||||
TaskId = wmsTask.TaskId,
|
TaskId = wmsTask.TaskId,
|
||||||
TaskStatus = (int)WmsTaskStatusEnum.err,
|
TaskStatus = (int)WmsTaskStatusEnum.err,
|
||||||
|
|
@ -58,17 +65,12 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
});
|
});
|
||||||
if(wmsTask.CreatePerson == StaticString.WMS)
|
if(wmsTask.CreatePerson == StaticString.WMS)
|
||||||
{
|
{
|
||||||
_sendWmsTaskStatus.SendTaskErr(wmsTask.TaskId, "不受支持的起点或终点");
|
sendWmsTaskStatus.SendTaskErr(wmsTask.TaskId, "不受支持的起点或终点");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* 解析任务转换为WCS任务,一般根据项目,此处自定义规则 */
|
/* 解析任务转换为WCS任务,一般根据项目,此处自定义规则 */
|
||||||
List<AppWcsTask>? wcsTasks = TransToWcsTask(wmsTask);
|
TransToWcsTask(wmsTask);
|
||||||
if(wcsTasks == default || wcsTasks.Count < 1)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -78,20 +80,25 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="task"></param>
|
/// <param name="task"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private List<AppWcsTask>? TransToWcsTask(AppWmsTask task)
|
private void TransToWcsTask(AppWmsTask task)
|
||||||
{
|
{
|
||||||
return task.TaskType switch
|
switch (task.TaskType)
|
||||||
{
|
{
|
||||||
// 入库
|
case (int)WmsTaskTypeEnum.inTask:// 入库
|
||||||
(int)WmsTaskTypeEnum.inTask => TransInTaskToWcsTask(task)?.ToList(),
|
TransInTaskToWcsTask(task);
|
||||||
// 出库
|
break;
|
||||||
(int)WmsTaskTypeEnum.outTask => TransOutTaskToWcsTask(task)?.ToList(),
|
case (int)WmsTaskTypeEnum.outTask:// 出库
|
||||||
// 移库
|
TransOutTaskToWcsTask(task);
|
||||||
(int)WmsTaskTypeEnum.moveTask => TransMoveTaskToWcsTask(task)?.ToList(),
|
break;
|
||||||
// 拣选
|
case (int)WmsTaskTypeEnum.moveTask:// 移库
|
||||||
(int)WmsTaskTypeEnum.pick => TransPickTaskToWcsTask(task)?.ToList(),
|
TransMoveTaskToWcsTask(task);
|
||||||
// 其他任务,未识别的任务类型,直接报错
|
break;
|
||||||
_ => TransOtherTaskToWcsTask(task)?.ToList(),
|
case (int)WmsTaskTypeEnum.pick:// 拣选
|
||||||
|
TransPickTaskToWcsTask(task);
|
||||||
|
break;
|
||||||
|
default: // 其他任务,未识别的任务类型,直接报错
|
||||||
|
TransOtherTaskToWcsTask(task);
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,21 +107,22 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wmsTask"></param>
|
/// <param name="wmsTask"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<AppWcsTask>? TransInTaskToWcsTask(AppWmsTask wmsTask)
|
private void TransInTaskToWcsTask(AppWmsTask wmsTask)
|
||||||
{
|
{
|
||||||
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
||||||
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
||||||
if (wcsOrigin == default || wcsDestination == default) { yield break; }
|
if (wcsOrigin == default || wcsDestination == default) { return; }
|
||||||
int? plcId = _dataBaseData.GetNewPlcTaskId();
|
int? plcId = dataBaseData.GetNewPlcTaskId();
|
||||||
if(plcId == default) { yield break; }
|
if(plcId == default) { return; }
|
||||||
AppWcsTask wcsTask = new()
|
AppWcsTask wcsTask = new()
|
||||||
{
|
{
|
||||||
PlcId = plcId,
|
PlcId = plcId,
|
||||||
TaskId = wmsTask.TaskId,
|
TaskId = wmsTask.TaskId,
|
||||||
TaskType = (int)WcsTaskTypeEnum.inTask,
|
TaskType = (int)WcsTaskTypeEnum.inTask,
|
||||||
|
TaskSort = 1,
|
||||||
TaskStatus = (int)WcsTaskStatusEnum.create,
|
TaskStatus = (int)WcsTaskStatusEnum.create,
|
||||||
|
TaskCategory = (int)TaskCategoryEnum.stacker,
|
||||||
Origin = wcsOrigin!.WcsLocation,
|
Origin = wcsOrigin!.WcsLocation,
|
||||||
|
|
||||||
Destination = wcsDestination.WcsLocation,
|
Destination = wcsDestination.WcsLocation,
|
||||||
VehicleNo = wmsTask.VehicleNo,
|
VehicleNo = wmsTask.VehicleNo,
|
||||||
PlcVehicleNo = wmsTask.VehicleNo.ToPlcVehicleNo(),
|
PlcVehicleNo = wmsTask.VehicleNo.ToPlcVehicleNo(),
|
||||||
|
|
@ -125,7 +133,15 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
CreatePerson = wmsTask.CreatePerson,
|
CreatePerson = wmsTask.CreatePerson,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
};
|
};
|
||||||
yield return wcsTask;
|
/* 插入新任务同时更新 wms 任务为排队中 */
|
||||||
|
string? errMessage = taskDao.CreateWcsTask(wcsTask);
|
||||||
|
if(string.IsNullOrWhiteSpace(errMessage))
|
||||||
|
{
|
||||||
|
ConsoleLog.Info($"【提示】任务:{wmsTask.TaskId} 已经进入队列");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】任务:{wmsTask.TaskId} 无法处理,异常信息:{errMessage}");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -133,19 +149,21 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wmsTask"></param>
|
/// <param name="wmsTask"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<AppWcsTask>? TransOutTaskToWcsTask(AppWmsTask wmsTask)
|
private void TransOutTaskToWcsTask(AppWmsTask wmsTask)
|
||||||
{
|
{
|
||||||
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
||||||
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
||||||
if (wcsOrigin == default || wcsDestination == default) { yield break; }
|
if (wcsOrigin == default || wcsDestination == default) { return; }
|
||||||
int? plcId = _dataBaseData.GetNewPlcTaskId();
|
int? plcId = dataBaseData.GetNewPlcTaskId();
|
||||||
if (plcId == default) { yield break; }
|
if (plcId == default) { return; }
|
||||||
AppWcsTask wcsTask = new()
|
AppWcsTask wcsTask = new()
|
||||||
{
|
{
|
||||||
PlcId = plcId,
|
PlcId = plcId,
|
||||||
TaskId = wmsTask.TaskId,
|
TaskId = wmsTask.TaskId,
|
||||||
TaskType = (int)WcsTaskTypeEnum.outTask,
|
TaskType = (int)WcsTaskTypeEnum.outTask,
|
||||||
|
TaskSort = 1,
|
||||||
TaskStatus = (int)WcsTaskStatusEnum.create,
|
TaskStatus = (int)WcsTaskStatusEnum.create,
|
||||||
|
TaskCategory = (int)TaskCategoryEnum.stacker,
|
||||||
Origin = wcsOrigin.WcsLocation,
|
Origin = wcsOrigin.WcsLocation,
|
||||||
Destination = wcsDestination.WcsLocation,
|
Destination = wcsDestination.WcsLocation,
|
||||||
VehicleNo = wmsTask.VehicleNo,
|
VehicleNo = wmsTask.VehicleNo,
|
||||||
|
|
@ -157,7 +175,15 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
CreatePerson = wmsTask.CreatePerson,
|
CreatePerson = wmsTask.CreatePerson,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
};
|
};
|
||||||
yield return wcsTask;
|
/* 插入新任务同时更新 wms 任务为排队中 */
|
||||||
|
string? errMessage = taskDao.CreateWcsTask(wcsTask);
|
||||||
|
if (string.IsNullOrWhiteSpace(errMessage))
|
||||||
|
{
|
||||||
|
ConsoleLog.Info($"【提示】任务:{wmsTask.TaskId} 已经进入队列");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】任务:{wmsTask.TaskId} 无法处理,异常信息:{errMessage}");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -165,19 +191,21 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wmsTask"></param>
|
/// <param name="wmsTask"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<AppWcsTask>? TransPickTaskToWcsTask(AppWmsTask wmsTask)
|
private void TransPickTaskToWcsTask(AppWmsTask wmsTask)
|
||||||
{
|
{
|
||||||
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
||||||
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
||||||
if (wcsOrigin == default || wcsDestination == default) { yield break; }
|
if (wcsOrigin == default || wcsDestination == default) { return; }
|
||||||
int? plcId = _dataBaseData.GetNewPlcTaskId();
|
int? plcId = dataBaseData.GetNewPlcTaskId();
|
||||||
if (plcId == default) { yield break; }
|
if (plcId == default) { return; }
|
||||||
AppWcsTask wcsTask = new()
|
AppWcsTask wcsTask = new()
|
||||||
{
|
{
|
||||||
PlcId = plcId,
|
PlcId = plcId,
|
||||||
TaskId = wmsTask.TaskId,
|
TaskId = wmsTask.TaskId,
|
||||||
TaskType = (int)WcsTaskTypeEnum.pick,
|
TaskType = (int)WcsTaskTypeEnum.pick,
|
||||||
|
TaskSort = 1,
|
||||||
TaskStatus = (int)WcsTaskStatusEnum.create,
|
TaskStatus = (int)WcsTaskStatusEnum.create,
|
||||||
|
TaskCategory = (int)TaskCategoryEnum.stacker,
|
||||||
Origin = wcsOrigin.WcsLocation,
|
Origin = wcsOrigin.WcsLocation,
|
||||||
Destination = wcsDestination.WcsLocation,
|
Destination = wcsDestination.WcsLocation,
|
||||||
VehicleNo = wmsTask.VehicleNo,
|
VehicleNo = wmsTask.VehicleNo,
|
||||||
|
|
@ -189,7 +217,15 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
CreatePerson = wmsTask.CreatePerson,
|
CreatePerson = wmsTask.CreatePerson,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
};
|
};
|
||||||
yield return wcsTask;
|
/* 插入新任务同时更新 wms 任务为排队中 */
|
||||||
|
string? errMessage = taskDao.CreateWcsTask(wcsTask);
|
||||||
|
if (string.IsNullOrWhiteSpace(errMessage))
|
||||||
|
{
|
||||||
|
ConsoleLog.Info($"【提示】任务:{wmsTask.TaskId} 已经进入队列");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】任务:{wmsTask.TaskId} 无法处理,异常信息:{errMessage}");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -197,13 +233,13 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wmsTask"></param>
|
/// <param name="wmsTask"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<AppWcsTask>? TransMoveTaskToWcsTask(AppWmsTask wmsTask)
|
private void TransMoveTaskToWcsTask(AppWmsTask wmsTask)
|
||||||
{
|
{
|
||||||
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
AppLocation? wcsOrigin = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Origin);
|
||||||
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
AppLocation? wcsDestination = CommonData.AppLocations.DetailWithWmsLocation(wmsTask.Destination);
|
||||||
if (wcsOrigin == default || wcsDestination == default) { yield break; }
|
if (wcsOrigin == default || wcsDestination == default) { return; }
|
||||||
int? plcId = _dataBaseData.GetNewPlcTaskId();
|
int? plcId = dataBaseData.GetNewPlcTaskId();
|
||||||
if (plcId == default) { yield break; }
|
if (plcId == default) { return; }
|
||||||
AppWcsTask wcsTask = new()
|
AppWcsTask wcsTask = new()
|
||||||
{
|
{
|
||||||
PlcId = plcId,
|
PlcId = plcId,
|
||||||
|
|
@ -211,6 +247,7 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
TaskType = (int)WcsTaskTypeEnum.moveTask,
|
TaskType = (int)WcsTaskTypeEnum.moveTask,
|
||||||
TaskSort = 1,
|
TaskSort = 1,
|
||||||
TaskStatus = (int)WcsTaskStatusEnum.create,
|
TaskStatus = (int)WcsTaskStatusEnum.create,
|
||||||
|
TaskCategory = (int)TaskCategoryEnum.stacker,
|
||||||
Origin = wcsOrigin.WcsLocation,
|
Origin = wcsOrigin.WcsLocation,
|
||||||
Destination = wcsDestination.WcsLocation,
|
Destination = wcsDestination.WcsLocation,
|
||||||
VehicleNo = wmsTask.VehicleNo,
|
VehicleNo = wmsTask.VehicleNo,
|
||||||
|
|
@ -222,7 +259,15 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
CreatePerson = wmsTask.CreatePerson,
|
CreatePerson = wmsTask.CreatePerson,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
};
|
};
|
||||||
yield return wcsTask;
|
/* 插入新任务同时更新 wms 任务为排队中 */
|
||||||
|
string? errMessage = taskDao.CreateWcsTask(wcsTask);
|
||||||
|
if (string.IsNullOrWhiteSpace(errMessage))
|
||||||
|
{
|
||||||
|
ConsoleLog.Info($"【提示】任务:{wmsTask.TaskId} 已经进入队列");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】任务:{wmsTask.TaskId} 无法处理,异常信息:{errMessage}");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -230,8 +275,8 @@ public class ResolveWmsTask(AppWmsTaskDao wmsTaskDao, SendWmsTaskStatus sendWmsT
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wmsTask"></param>
|
/// <param name="wmsTask"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<AppWcsTask>? TransOtherTaskToWcsTask(AppWmsTask wmsTask)
|
private List<AppWcsTask>? TransOtherTaskToWcsTask(AppWmsTask _)
|
||||||
{
|
{
|
||||||
yield break;
|
return default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user