<point>[important]可用初版
This commit is contained in:
parent
99d6668cf2
commit
579852e4bd
|
|
@ -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,41 @@
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 电子标签确认按钮按下请求数据
|
||||||
|
/// </summary>
|
||||||
|
public class ElTagComfirmButtonClickRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
[JsonProperty("taskGroup")]
|
||||||
|
public string? TaskGroup { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("taskType")]
|
||||||
|
public int? TaskType { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("vehicleNo")]
|
||||||
|
public string? VehicleNo { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("orderId")]
|
||||||
|
public string? OrderId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("taskId")]
|
||||||
|
public string? TaskId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("location")]
|
||||||
|
public string? Location { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("goodsId")]
|
||||||
|
public string? GoodsId { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("goodsName")]
|
||||||
|
public string? GoodsName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("needNum")]
|
||||||
|
public int? NeedNum { get; set; }
|
||||||
|
|
||||||
|
[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; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,12 @@ 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>
|
||||||
|
|
@ -17,8 +23,8 @@ public class UploadPickStandRequest
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拣选站台
|
/// 拣选站台
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("pickStand")]
|
[JsonProperty("location")]
|
||||||
public string? PickStand { get; set; }
|
public string? Location { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备注
|
/// 备注
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class ConveyService(DataBaseData dataBaseData, AppConveyTaskDao conveyTas
|
||||||
public WmsApiResponse DisposeVehicle(DisposeVehicleRequest request)
|
public WmsApiResponse DisposeVehicle(DisposeVehicleRequest request)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(request.Location)) return WmsApiResponseFactory.RequestErr("存在必填项未填");
|
if(string.IsNullOrEmpty(request.Location)) return WmsApiResponseFactory.RequestErr("存在必填项未填");
|
||||||
var writeResult = conveyOperation.DisposeVehicle(request.Location);
|
var writeResult = conveyOperation.AllowPickStandGo(request.Location, 2);
|
||||||
if(string.IsNullOrEmpty(writeResult)) return WmsApiResponseFactory.Success();
|
if(string.IsNullOrEmpty(writeResult)) return WmsApiResponseFactory.Success();
|
||||||
return WmsApiResponseFactory.Fail(writeResult);
|
return WmsApiResponseFactory.Fail(writeResult);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,19 +44,18 @@ public class PickStandButton(AppConveyStandDao conveyStandDao, ConveyOperation c
|
||||||
{
|
{
|
||||||
int pickButtonStatus = conveyOperation.GetAllowPickStandGo(pickStand.StandId!);
|
int pickButtonStatus = conveyOperation.GetAllowPickStandGo(pickStand.StandId!);
|
||||||
if (pickButtonStatus != 1) return;
|
if (pickButtonStatus != 1) return;
|
||||||
ConsoleLog.Info($"【提示】拣选站:{pickStand.StandId} 按钮已经按下");
|
//ConsoleLog.Info($"【提示】拣选站:{pickStand.StandId} 按钮已经按下");
|
||||||
conveyOperation.AllowPickStandGo(pickStand.StandId!, 2);
|
//conveyOperation.AllowPickStandGo(pickStand.StandId!, 2);
|
||||||
ConsoleLog.Success($"{pickStand.StandId}按钮按下,调试阶段直接放行");
|
//ConsoleLog.Success($"{pickStand.StandId}按钮按下,调试阶段直接放行");
|
||||||
return;
|
//return;
|
||||||
// 发送wms按钮按下
|
// 发送wms按钮按下
|
||||||
UploadPickStandRequest request = new UploadPickStandRequest()
|
ConceyButtonClickRequest request = new()
|
||||||
{
|
{
|
||||||
PickStand = pickStand.StandId,
|
Location = pickStand.StandId,
|
||||||
VehicleNo = "",
|
VehicleNo = "",
|
||||||
Remark = "按钮按下上报"
|
Remark = "按钮按下上报"
|
||||||
};
|
};
|
||||||
var responseEntity = wmsWebApiPost.HttpPost<UploadPickStandRequest, WmsResponse>(request,
|
var responseEntity = wmsWebApiPost.HttpPost<ConceyButtonClickRequest, WmsResponse>(request, CommonData.AppApiBaseInfos.GetAddress("UploadPickStandButtonMethod") ?? "", 2000);
|
||||||
CommonData.AppApiBaseInfos.GetAddress("UploadPickStandButtonMethod") ?? "", 5000);
|
|
||||||
if (!responseEntity.IsSend) return; // 发送失败不处理,下一次循环在发送
|
if (!responseEntity.IsSend) return; // 发送失败不处理,下一次循环在发送
|
||||||
// 只要发送成功则不再发送
|
// 只要发送成功则不再发送
|
||||||
ConsoleLog.Info( $"拣选站:{pickStand.StandId} 按钮已经按下上报成功,WMS返回:{responseEntity.ResponseMsg}");
|
ConsoleLog.Info( $"拣选站:{pickStand.StandId} 按钮已经按下上报成功,WMS返回:{responseEntity.ResponseMsg}");
|
||||||
|
|
|
||||||
|
|
@ -32,22 +32,26 @@ public class ReadScanCode(AppRouterMethodDao routerMethodDao, ConveyOperation co
|
||||||
List<Task> tasks = [];
|
List<Task> tasks = [];
|
||||||
foreach(AppRouterMethod router in routers)
|
foreach(AppRouterMethod router in routers)
|
||||||
{
|
{
|
||||||
(var readErrText, var scanOk, var code) = conveyOperation.ReadScanInfo(router.Area);
|
|
||||||
if(!string.IsNullOrEmpty(readErrText))
|
|
||||||
{
|
|
||||||
ConsoleLog.Exception($"【异常】读取扫码:{router.Area} 数据异常,信息:{readErrText}");
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
return true; // 不读了,估计网断了
|
|
||||||
}
|
|
||||||
if(scanOk != (int)TrueFalseEnum.TRUE) { continue; }
|
|
||||||
tasks.Add(Task.Factory.StartNew(() =>
|
tasks.Add(Task.Factory.StartNew(() =>
|
||||||
{
|
{
|
||||||
historyConveyDataHander.GetData("-", code, router.Area ?? "");
|
(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);
|
string clearErrText = conveyOperation.ClearScanStatus(router.Area);
|
||||||
if(!string.IsNullOrEmpty(clearErrText))
|
if (!string.IsNullOrEmpty(clearErrText))
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception($"【异常】扫码:{router.Area} 清理读码信号异常,信息:{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 });
|
scanRecordDao.Insert(new AppScanRecord() { RecordId = dataBaseData.GetNewUUID2(), ScanId = router.Area, Code = code, ScanTime = DateTime.Now });
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c
|
||||||
List<Task> tasks = [];
|
List<Task> tasks = [];
|
||||||
foreach (AppConveyStand stand in _pickStands)
|
foreach (AppConveyStand stand in _pickStands)
|
||||||
{
|
{
|
||||||
Thread.Sleep(20);
|
|
||||||
Task task = new(() =>
|
Task task = new(() =>
|
||||||
{
|
{
|
||||||
string code = conveyOperation.ReadStandCode(stand.StandId!);
|
string code = conveyOperation.ReadStandCode(stand.StandId!);
|
||||||
|
|
@ -69,19 +68,22 @@ public class UploadBoxArrive(AppConveyStandDao conveyStandDao, ConveyOperation c
|
||||||
{
|
{
|
||||||
TaskId = pickTask.TaskId,
|
TaskId = pickTask.TaskId,
|
||||||
TaskStatus = (int)ConveyTaskStatusEnum.arrive,
|
TaskStatus = (int)ConveyTaskStatusEnum.arrive,
|
||||||
|
ArriveLocation = stand.StandId,
|
||||||
CompleteTime = DateTime.Now,
|
CompleteTime = DateTime.Now,
|
||||||
Remark = "PLC上报料箱到达"
|
Remark = "PLC上报料箱到达"
|
||||||
});
|
});
|
||||||
|
//return; // 测试
|
||||||
|
|
||||||
// 发送wms料箱到达
|
// 发送wms料箱到达
|
||||||
UploadPickStandRequest request = new()
|
UploadPickStandRequest request = new()
|
||||||
{
|
{
|
||||||
PickStand = stand.StandId,
|
Location = stand.StandId,
|
||||||
VehicleNo = pickTask.VehicleNo,
|
VehicleNo = pickTask.VehicleNo,
|
||||||
Remark = ""
|
Remark = ""
|
||||||
};
|
};
|
||||||
|
|
||||||
var responseEntity = wmsWebApiPost.HttpPost<UploadPickStandRequest, WmsResponse>(request,
|
var responseEntity = wmsWebApiPost.HttpPost<UploadPickStandRequest, WmsResponse>(request,
|
||||||
CommonData.AppApiBaseInfos.GetAddress("UploadBoxArrive") ?? "", 5000);
|
CommonData.AppApiBaseInfos.GetAddress("UploadBoxArrive") ?? "", 2000);
|
||||||
if (responseEntity.IsSend) // 发送失败不处理,下一次循环在发送
|
if (responseEntity.IsSend) // 发送失败不处理,下一次循环在发送
|
||||||
{
|
{
|
||||||
// 只要发送成功则不再发送
|
// 只要发送成功则不再发送
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,13 @@ public class LightElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation,
|
||||||
/* 点亮标签 */
|
/* 点亮标签 */
|
||||||
LedColor lEDColor = new Func<LedColor>(() =>
|
LedColor lEDColor = new Func<LedColor>(() =>
|
||||||
{
|
{
|
||||||
switch (tagTask.TaskType)
|
return tagTask.TaskType switch
|
||||||
{
|
{
|
||||||
case (int)ElTagTaskTypeEnum.PICK:
|
(int)ElTagTaskTypeEnum.PICK => LedColor.Green,
|
||||||
return LedColor.Green;
|
(int)ElTagTaskTypeEnum.STOCK => LedColor.Blue,
|
||||||
case (int)ElTagTaskTypeEnum.STOCK:
|
_ => LedColor.Red,
|
||||||
return LedColor.Blue;
|
|
||||||
default:
|
|
||||||
return LedColor.Red;
|
|
||||||
};
|
};
|
||||||
|
;
|
||||||
}).Invoke();
|
}).Invoke();
|
||||||
var resultException = atopOperation.ShowMsg(tagInfo.ControllerDisplayName, tagInfo.TagId, tagTask.NeedNum, lEDColor);
|
var resultException = atopOperation.ShowMsg(tagInfo.ControllerDisplayName, tagInfo.TagId, tagTask.NeedNum, lEDColor);
|
||||||
if(resultException == default )
|
if(resultException == default )
|
||||||
|
|
@ -81,6 +79,13 @@ public class LightElTag(AppElTagTaskDao tagTaskDao, AtopOperation atopOperation,
|
||||||
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
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,19 +35,19 @@ public class LoginGetData(WmsWebApiPost wmsWebApiPost) : IBaseGetData
|
||||||
public void ReadSuccess(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
public void ReadSuccess(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
||||||
{
|
{
|
||||||
/* 发送 WMS 请求入库 */
|
/* 发送 WMS 请求入库 */
|
||||||
//ApplyInRequest applyInRequest = new(area, msg, msg);
|
ApplyInRequest applyInRequest = new(area, msg, msg);
|
||||||
//var postResult = wmsWebApiPost.HttpPost<ApplyInRequest, WmsResponse>(applyInRequest, CommonData.AppApiBaseInfos.GetAddress("ApplyEnterApiAddress") ?? "");
|
var postResult = wmsWebApiPost.HttpPost<ApplyInRequest, WmsResponse>(applyInRequest, CommonData.AppApiBaseInfos.GetAddress("ApplyEnterApiAddress") ?? "", 2000);
|
||||||
//if(!postResult.IsSend || postResult.ResponseEntity == default)
|
if (!postResult.IsSend || postResult.ResponseEntity == default)
|
||||||
//{
|
{
|
||||||
// ConsoleLog.Exception($"【异常】注册口:{area} 箱码:{msg} 请求入库发生异常,异常信息:{postResult.RequestException}");
|
ConsoleLog.Exception($"【异常】注册口:{area} 箱码:{msg} 请求入库发生异常,异常信息:{postResult.RequestException}");
|
||||||
// return;
|
return;
|
||||||
//}
|
}
|
||||||
//if( postResult.ResponseEntity.Code == 0)
|
if (postResult.ResponseEntity.Code == 0)
|
||||||
//{
|
{
|
||||||
// ConsoleLog.Success($"注册口:{area} 箱码:{msg} 请求入库成功 {postResult.ResponseEntity.Message}");
|
ConsoleLog.Success($"注册口:{area} 箱码:{msg} 请求入库成功 {postResult.ResponseEntity.Message}");
|
||||||
// return;
|
return;
|
||||||
//}
|
}
|
||||||
//ConsoleLog.Warning($"【警告】注册口:{area} 箱码:{msg} 请求入库失败,信息:{postResult.ResponseEntity.Message}");
|
ConsoleLog.Warning($"【警告】注册口:{area} 箱码:{msg} 请求入库失败,信息:{postResult.ResponseEntity.Message}");
|
||||||
//return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using WcsMain.Business.Convey.HistoryDataHandler.HisGetData.I;
|
using WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
using WcsMain.Business.Convey.HistoryDataHandler.HisGetData.I;
|
||||||
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.DataService;
|
using WcsMain.DataService;
|
||||||
|
|
@ -6,6 +8,7 @@ using WcsMain.Enum.Convey;
|
||||||
using WcsMain.EquipOperation.Convey;
|
using WcsMain.EquipOperation.Convey;
|
||||||
using WcsMain.EquipOperation.Entity;
|
using WcsMain.EquipOperation.Entity;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
|
||||||
namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
||||||
|
|
||||||
|
|
@ -15,7 +18,7 @@ namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
||||||
/// <param name="conveyOperation"></param>
|
/// <param name="conveyOperation"></param>
|
||||||
/// <param name="dataBaseData"></param>
|
/// <param name="dataBaseData"></param>
|
||||||
/// <param name="conveyTaskDao"></param>
|
/// <param name="conveyTaskDao"></param>
|
||||||
public class Pick1StandOutC3(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao) : IBaseGetData
|
public class Pick1StandOutC3(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao, WmsWebApiPost wmsWebApiPost) : IBaseGetData
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -49,6 +52,51 @@ public class Pick1StandOutC3(ConveyOperation conveyOperation, DataBaseData dataB
|
||||||
public void ReadSuccess(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
public void ReadSuccess(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
||||||
{
|
{
|
||||||
int plcId = dataBaseData.GetNewPlcTaskId() ?? StaticData.StaticInt.ErrPlcId; // 获取一个 plcId
|
int plcId = dataBaseData.GetNewPlcTaskId() ?? StaticData.StaticInt.ErrPlcId; // 获取一个 plcId
|
||||||
|
// 调用注册查看有没有剩余任务
|
||||||
|
RequestBackRequest applyInRequest = new(msg);
|
||||||
|
var postResult = wmsWebApiPost.HttpPost<RequestBackRequest, WmsResponse>(applyInRequest, CommonData.AppApiBaseInfos.GetAddress("RequestBackRequest") ?? "", 2000);
|
||||||
|
if (!postResult.IsSend || postResult.ResponseEntity == default)
|
||||||
|
{
|
||||||
|
ConsoleLog.Exception($"【异常】拣选站台出口:{area} 箱码:{msg} 请求入库发生异常,异常信息:{postResult.RequestException}");
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Go); // 连接中断一区环线运行
|
||||||
|
string errText = conveyOperation.WriteTask(area, plcTask);
|
||||||
|
if (string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"一区出口:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (postResult.ResponseEntity.Code == 0)
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"拣选站台出口:{area} 箱码:{msg} 请求入库成功 {postResult.ResponseEntity.Message}");
|
||||||
|
// 给通行信号,同时将未完成的拣选任务全部结束
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.RightMove);
|
||||||
|
string errText = conveyOperation.WriteTask(area, plcTask);
|
||||||
|
if (string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"一区出口:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】一区出口:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
|
}
|
||||||
|
// 更新拣选站台任务
|
||||||
|
List<AppConveyTask>? notCompleteConveyTasks = conveyTaskDao.Query(new AppConveyTask { VehicleNo = msg, TaskStatus = (int)ConveyTaskStatusEnum.create });
|
||||||
|
if (notCompleteConveyTasks != null && notCompleteConveyTasks.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var notCompleteConveyTask in notCompleteConveyTasks)
|
||||||
|
{
|
||||||
|
notCompleteConveyTask.TaskStatus = (int)ConveyTaskStatusEnum.arrive;
|
||||||
|
notCompleteConveyTask.ArriveLocation = "一区回库口自动完成";
|
||||||
|
notCompleteConveyTask.CompleteTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
conveyTaskDao.Update([.. notCompleteConveyTasks]); // 更新任务状态
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* 判断条码有没有拣选任务 */
|
/* 判断条码有没有拣选任务 */
|
||||||
List<AppConveyTask>? conveyTasks = conveyTaskDao.Query(new AppConveyTask { VehicleNo = msg, TaskStatus = (int)ConveyTaskStatusEnum.create });
|
List<AppConveyTask>? conveyTasks = conveyTaskDao.Query(new AppConveyTask { VehicleNo = msg, TaskStatus = (int)ConveyTaskStatusEnum.create });
|
||||||
if (conveyTasks == default)
|
if (conveyTasks == default)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using WcsMain.Business.Convey.HistoryDataHandler.HisGetData.I;
|
using WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
using WcsMain.Business.Convey.HistoryDataHandler.HisGetData.I;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
|
|
@ -7,6 +8,7 @@ using WcsMain.Enum.Convey;
|
||||||
using WcsMain.EquipOperation.Convey;
|
using WcsMain.EquipOperation.Convey;
|
||||||
using WcsMain.EquipOperation.Entity;
|
using WcsMain.EquipOperation.Entity;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.Plugins;
|
||||||
|
|
||||||
namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
||||||
|
|
||||||
|
|
@ -16,7 +18,7 @@ namespace WcsMain.Business.Convey.HistoryDataHandler.HisGetData;
|
||||||
/// <param name="conveyOperation"></param>
|
/// <param name="conveyOperation"></param>
|
||||||
/// <param name="dataBaseData"></param>
|
/// <param name="dataBaseData"></param>
|
||||||
/// <param name="conveyTaskDao"></param>
|
/// <param name="conveyTaskDao"></param>
|
||||||
public class Pick2StandOutC4(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao) : IBaseGetData
|
public class Pick2StandOutC4(ConveyOperation conveyOperation, DataBaseData dataBaseData, AppConveyTaskDao conveyTaskDao, WmsWebApiPost wmsWebApiPost) : IBaseGetData
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -50,6 +52,51 @@ public class Pick2StandOutC4(ConveyOperation conveyOperation, DataBaseData dataB
|
||||||
public void ReadSuccess(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
public void ReadSuccess(string? disPlayName, string msg, string? area, AppRouterMethod routerMethodData)
|
||||||
{
|
{
|
||||||
int plcId = dataBaseData.GetNewPlcTaskId() ?? StaticData.StaticInt.ErrPlcId; // 获取一个 plcId
|
int plcId = dataBaseData.GetNewPlcTaskId() ?? StaticData.StaticInt.ErrPlcId; // 获取一个 plcId
|
||||||
|
// 调用注册查看有没有剩余任务
|
||||||
|
RequestBackRequest applyInRequest = new(msg);
|
||||||
|
var postResult = wmsWebApiPost.HttpPost<RequestBackRequest, WmsResponse>(applyInRequest, CommonData.AppApiBaseInfos.GetAddress("RequestBackRequest") ?? "", 2000);
|
||||||
|
if (!postResult.IsSend || postResult.ResponseEntity == default)
|
||||||
|
{
|
||||||
|
ConsoleLog.Exception($"【异常】拣选站台出口:{area} 箱码:{msg} 请求入库发生异常,异常信息:{postResult.RequestException}");
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Go); // 连接中断一区环线运行
|
||||||
|
string errText = conveyOperation.WriteTask(area, plcTask);
|
||||||
|
if (string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"二区出口:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】二区出口:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (postResult.ResponseEntity.Code == 0)
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"拣选站台出口:{area} 箱码:{msg} 请求入库成功 {postResult.ResponseEntity.Message}");
|
||||||
|
// 给通行信号,同时将未完成的拣选任务全部结束
|
||||||
|
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.RightMove);
|
||||||
|
string errText = conveyOperation.WriteTask(area, plcTask);
|
||||||
|
if (string.IsNullOrEmpty(errText))
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"二区出口:{area} 箱码:{msg},写入PLC成功,{plcTask}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConsoleLog.Warning($"【警告】二区出口:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
|
}
|
||||||
|
// 更新拣选站台任务
|
||||||
|
List<AppConveyTask>? notCompleteConveyTasks = conveyTaskDao.Query(new AppConveyTask { VehicleNo = msg, TaskStatus = (int)ConveyTaskStatusEnum.create });
|
||||||
|
if (notCompleteConveyTasks != null && notCompleteConveyTasks.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var notCompleteConveyTask in notCompleteConveyTasks)
|
||||||
|
{
|
||||||
|
notCompleteConveyTask.TaskStatus = (int)ConveyTaskStatusEnum.arrive;
|
||||||
|
notCompleteConveyTask.ArriveLocation = "二区回库口自动完成";
|
||||||
|
notCompleteConveyTask.CompleteTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
conveyTaskDao.Update([.. notCompleteConveyTasks]); // 更新任务状态
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* 判断条码有没有拣选任务 */
|
/* 判断条码有没有拣选任务 */
|
||||||
List<AppConveyTask>? conveyTasks = conveyTaskDao.Query(new AppConveyTask { VehicleNo = msg, TaskStatus = (int)ConveyTaskStatusEnum.create });
|
List<AppConveyTask>? conveyTasks = conveyTaskDao.Query(new AppConveyTask { VehicleNo = msg, TaskStatus = (int)ConveyTaskStatusEnum.create });
|
||||||
if (conveyTasks == default)
|
if (conveyTasks == default)
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class StackerInErr(ConveyOperation conveyOperation, DataBaseData dataBase
|
||||||
ConsoleLog.Warning($"【警告】入库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
ConsoleLog.Warning($"【警告】入库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ConveyRouterEnum router = (ConveyRouterEnum)(locationDetail.TunnelNo ?? 0);
|
ConveyRouterEnum router = (ConveyRouterEnum)(6 - locationDetail.TunnelNo ?? 0);
|
||||||
ConsoleLog.Success($"入库分流:{area} 箱码:{msg} 终点:{wcsTask.Destination} 巷道:{locationDetail.TunnelNo}");
|
ConsoleLog.Success($"入库分流:{area} 箱码:{msg} 终点:{wcsTask.Destination} 巷道:{locationDetail.TunnelNo}");
|
||||||
ConveyPLCTask plcTaskOk = new(plcId, (short)router);
|
ConveyPLCTask plcTaskOk = new(plcId, (short)router);
|
||||||
string errTextOk = conveyOperation.WriteTask(area, plcTaskOk);
|
string errTextOk = conveyOperation.WriteTask(area, plcTaskOk);
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public class StackerInSpliter(ConveyOperation conveyOperation, DataBaseData data
|
||||||
ConsoleLog.Warning($"【警告】入库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
ConsoleLog.Warning($"【警告】入库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ConveyRouterEnum router = (ConveyRouterEnum)(locationDetail.TunnelNo ?? 0);
|
ConveyRouterEnum router = (ConveyRouterEnum)(6 - locationDetail.TunnelNo ?? 0);
|
||||||
ConsoleLog.Success($"入库分流:{area} 箱码:{msg} 终点:{wcsTask.Destination} 巷道:{locationDetail.TunnelNo}");
|
ConsoleLog.Success($"入库分流:{area} 箱码:{msg} 终点:{wcsTask.Destination} 巷道:{locationDetail.TunnelNo}");
|
||||||
ConveyPLCTask plcTaskOk = new(plcId, (short)router);
|
ConveyPLCTask plcTaskOk = new(plcId, (short)router);
|
||||||
string errTextOk = conveyOperation.WriteTask(area, plcTaskOk);
|
string errTextOk = conveyOperation.WriteTask(area, plcTaskOk);
|
||||||
|
|
|
||||||
|
|
@ -351,39 +351,6 @@ public class AppWmsTaskDao
|
||||||
return result.Data ? string.Empty : result.ErrorMessage;
|
return result.Data ? string.Empty : result.ErrorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 完成任务 ---- 完成最后一个任务
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="wcsTaskUpdateEntity"></param>
|
|
||||||
/// <param name="wmsTaskUpdateEntity"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string CompleteTaskWithTaskInfo(AppWcsTask wcsTaskUpdateEntity, AppWmsTask wmsTaskUpdateEntity)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
需要执行的操作
|
|
||||||
1、完成WMS任务表状态
|
|
||||||
2、删除WCS任务表数据
|
|
||||||
*/
|
|
||||||
var result = CommonTool.DbServe.Ado.UseTran(() =>
|
|
||||||
{
|
|
||||||
// -- 更新wms任务状态
|
|
||||||
CommonTool.DbServe
|
|
||||||
.Updateable(wmsTaskUpdateEntity)
|
|
||||||
.IgnoreColumns(ignoreAllNullColumns: true)
|
|
||||||
.ExecuteCommand();
|
|
||||||
// -- 更新wcs任务表状态
|
|
||||||
CommonTool.DbServe
|
|
||||||
.Updateable(wcsTaskUpdateEntity)
|
|
||||||
.IgnoreColumns(ignoreAllNullColumns: true)
|
|
||||||
.ExecuteCommand();
|
|
||||||
// -- 备份WCS任务表
|
|
||||||
CommonTool.DbServe.Ado.ExecuteCommand(
|
|
||||||
$"insert into tbl_app_wcs_task_bak select * from tbl_app_wcs_task where task_id = '{wmsTaskUpdateEntity.TaskId}'");
|
|
||||||
// -- 删除WCS任务表
|
|
||||||
CommonTool.DbServe.Deleteable<AppWcsTask>().Where(w => w.TaskId == wmsTaskUpdateEntity.TaskId).ExecuteCommand();
|
|
||||||
});
|
|
||||||
return result.Data ? string.Empty : result.ErrorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using WcsMain.Common;
|
using System.Threading.Tasks;
|
||||||
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.Enum.Stacker;
|
using WcsMain.Enum.Stacker;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
|
|
@ -183,16 +185,24 @@ public class TaskDao
|
||||||
.ExecuteCommand();
|
.ExecuteCommand();
|
||||||
if (wcsTask.IsLastTask())
|
if (wcsTask.IsLastTask())
|
||||||
{
|
{
|
||||||
/* 更新WMS任务表状态 */
|
// -- 更新wms任务状态
|
||||||
CommonTool.DbServe.Updateable(new AppWmsTask
|
CommonTool.DbServe
|
||||||
{
|
.Updateable(new AppWmsTask()
|
||||||
TaskId = wcsTask.TaskId,
|
{ TaskId = wcsTask.TaskId, TaskStatus = (int)WmsTaskStatusEnum.complete, EndTime = DateTime.Now, TaskMsg = msg })
|
||||||
TaskStatus = (int)WmsTaskStatusEnum.complete,
|
.IgnoreColumns(ignoreAllNullColumns: true)
|
||||||
EndTime = dateTime,
|
.ExecuteCommand();
|
||||||
TaskMsg = msg
|
// -- 更新wcs任务表状态
|
||||||
})
|
CommonTool.DbServe
|
||||||
.IgnoreColumns(ignoreAllNullColumns: true)
|
.Updateable(new AppWcsTask()
|
||||||
.ExecuteCommand();
|
{ TaskId = wcsTask.TaskId, TaskStatus = (int)WcsTaskStatusEnum.complete, Remark = msg, CompleteTime = DateTime.Now })
|
||||||
|
.UpdateColumns(u => new { u.TaskStatus, u.Remark, u.CompleteTime }).WhereColumns(w => new { w.TaskId })
|
||||||
|
.ExecuteCommand();
|
||||||
|
// -- 备份WCS任务表
|
||||||
|
CommonTool.DbServe.Ado.ExecuteCommand(
|
||||||
|
$"insert into tbl_app_wcs_task_bak select * from tbl_app_wcs_task where task_id = '{wcsTask.TaskId}'");
|
||||||
|
// -- 删除WCS任务表
|
||||||
|
CommonTool.DbServe.Deleteable<AppWcsTask>().Where(w => w.TaskId == wcsTask.TaskId).ExecuteCommand();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result.Data ? string.Empty : result.ErrorException.Message;
|
return result.Data ? string.Empty : result.ErrorException.Message;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using WcsMain.ApiClient.DataEntity.WmsEntity;
|
||||||
|
using WcsMain.Common;
|
||||||
using WcsMain.DataBase.Dao;
|
using WcsMain.DataBase.Dao;
|
||||||
using WcsMain.DataBase.TableEntity;
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.ElTag.Atop.AtopEnum;
|
using WcsMain.ElTag.Atop.AtopEnum;
|
||||||
|
|
@ -6,6 +8,7 @@ using WcsMain.ElTag.Atop.Entity;
|
||||||
using WcsMain.Enum.ElTag;
|
using WcsMain.Enum.ElTag;
|
||||||
using WcsMain.EquipOperation.ElTag;
|
using WcsMain.EquipOperation.ElTag;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
|
using WcsMain.Plugins;
|
||||||
using WcsMain.WcsAttribute.AutoFacAttribute;
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
namespace WcsMain.ElTag.Atop;
|
namespace WcsMain.ElTag.Atop;
|
||||||
|
|
@ -14,13 +17,9 @@ namespace WcsMain.ElTag.Atop;
|
||||||
/// 电子标签收到数据的数据处理类
|
/// 电子标签收到数据的数据处理类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Component]
|
[Component]
|
||||||
public class BaseOprDataHandler(AppElTagLocationDao tagBaseDao, AppElTagTaskDao tagTaskDao, AtopOperation atopOperation)
|
public class BaseOprDataHandler(AppElTagLocationDao tagBaseDao, AppElTagTaskDao tagTaskDao, AtopOperation atopOperation, WmsWebApiPost wmsWebApiPost)
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly AppElTagLocationDao _tagBaseDao = tagBaseDao;
|
|
||||||
private readonly AppElTagTaskDao _tagTaskDao = tagTaskDao;
|
|
||||||
private readonly AtopOperation _atopOperation = atopOperation;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 收到数据时的处理方法
|
/// 收到数据时的处理方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -59,11 +58,11 @@ public class BaseOprDataHandler(AppElTagLocationDao tagBaseDao, AppElTagTaskDao
|
||||||
{
|
{
|
||||||
// _atopOperation.ShowMsgOnly(tcpServe.ControllerDisplayName, tcpServe.TagId, tcpServe.Data); // 重新点亮标签,仅显示字符
|
// _atopOperation.ShowMsgOnly(tcpServe.ControllerDisplayName, tcpServe.TagId, tcpServe.Data); // 重新点亮标签,仅显示字符
|
||||||
/* 找出这个标签最新点亮的那条记录 */
|
/* 找出这个标签最新点亮的那条记录 */
|
||||||
List<AppElTagLocation>? eltags = _tagBaseDao.Query(new AppElTagLocation { ControllerDisplayName = tcpServe.ControllerDisplayName, TagId = tcpServe.TagId });
|
List<AppElTagLocation>? eltags = tagBaseDao.Query(new AppElTagLocation { ControllerDisplayName = tcpServe.ControllerDisplayName, TagId = tcpServe.TagId });
|
||||||
if(eltags == default)
|
if(eltags == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception($"【异常】电子标签确认查询数据库标签信息失败,与数据库服务器连连接中断,控制器:{tcpServe.ControllerDisplayName},标签号:{tcpServe.TagId},数据:{tcpServe.Data}");
|
ConsoleLog.Exception($"【异常】电子标签确认查询数据库标签信息失败,与数据库服务器连连接中断,控制器:{tcpServe.ControllerDisplayName},标签号:{tcpServe.TagId},数据:{tcpServe.Data}");
|
||||||
_atopOperation.ShowMsg(tcpServe.ControllerDisplayName, tcpServe.TagId, tcpServe.Data); // 重新点亮标签
|
atopOperation.ShowMsg(tcpServe.ControllerDisplayName, tcpServe.TagId, tcpServe.Data); // 重新点亮标签
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(eltags.Count < 1)
|
if(eltags.Count < 1)
|
||||||
|
|
@ -81,11 +80,11 @@ public class BaseOprDataHandler(AppElTagLocationDao tagBaseDao, AppElTagTaskDao
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* 获取该任务号对应的任务 */
|
/* 获取该任务号对应的任务 */
|
||||||
List<AppElTagTask>? tagTasks = _tagTaskDao.Query(new AppElTagTask { TaskId = taskId });
|
List<AppElTagTask>? tagTasks = tagTaskDao.Query(new AppElTagTask { TaskId = taskId });
|
||||||
if(tagTasks == default)
|
if(tagTasks == default)
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception($"【异常】电子标签确认查询数据库任务失败,与数据库服务器连连接中断,控制器:{tcpServe.ControllerDisplayName},标签号:{tcpServe.TagId},数据:{tcpServe.Data}");
|
ConsoleLog.Exception($"【异常】电子标签确认查询数据库任务失败,与数据库服务器连连接中断,控制器:{tcpServe.ControllerDisplayName},标签号:{tcpServe.TagId},数据:{tcpServe.Data}");
|
||||||
_atopOperation.ShowMsg(tcpServe.ControllerDisplayName, tcpServe.TagId, tcpServe.Data); // 重新点亮标签
|
atopOperation.ShowMsg(tcpServe.ControllerDisplayName, tcpServe.TagId, tcpServe.Data); // 重新点亮标签
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tagTasks.Count < 1)
|
if (tagTasks.Count < 1)
|
||||||
|
|
@ -96,12 +95,37 @@ public class BaseOprDataHandler(AppElTagLocationDao tagBaseDao, AppElTagTaskDao
|
||||||
var tagTask = tagTasks[0]; // 获取到的任务
|
var tagTask = tagTasks[0]; // 获取到的任务
|
||||||
int pickNum = Regex.Replace(tcpServe.Data!, "\\D", "").IsNumber() ? Convert.ToInt32(tcpServe.Data) : -1;
|
int pickNum = Regex.Replace(tcpServe.Data!, "\\D", "").IsNumber() ? Convert.ToInt32(tcpServe.Data) : -1;
|
||||||
/* 更新任务状态为确认 */
|
/* 更新任务状态为确认 */
|
||||||
_tagTaskDao.Update(new AppElTagTask() { TaskId = tagTask.TaskId, ConfirmTime = DateTime.Now, TaskStatus = (int)ElTagTaskStatusEnum.Confirm, PickNum = pickNum, Remark = "标签确认", OffTime = DateTime.Now });
|
tagTaskDao.Update(new AppElTagTask() { TaskId = tagTask.TaskId, ConfirmTime = DateTime.Now, TaskStatus = (int)ElTagTaskStatusEnum.Confirm, PickNum = pickNum, Remark = "标签确认", OffTime = DateTime.Now });
|
||||||
/* 更新绑定的库位信息为空 */
|
/* 更新绑定的库位信息为空 */
|
||||||
_tagBaseDao.ResetLocation(eltag.Location!);
|
tagBaseDao.ResetLocation(eltag.Location!);
|
||||||
ConsoleLog.Success($"电子标签确认按钮按下,标签任务号:{tagTask.TaskId} 已经确认,箱号:{tagTask.VehicleNo},拣选数量:{tagTask.NeedNum}({pickNum}) 控制器:{tcpServe.ControllerDisplayName},标签号:{tcpServe.TagId},数据:{tcpServe.Data}");
|
ConsoleLog.Success($"电子标签确认按钮按下,标签任务号:{tagTask.TaskId} 已经确认,箱号:{tagTask.VehicleNo},拣选数量:{tagTask.NeedNum}({pickNum}) 控制器:{tcpServe.ControllerDisplayName},标签号:{tcpServe.TagId},数据:{tcpServe.Data}");
|
||||||
/* 发送WMS电子标签任务完成 */
|
/* 发送WMS电子标签任务完成 */
|
||||||
// [TODO]
|
ElTagComfirmButtonClickRequest elTagComfirmButtonClickRequest = new()
|
||||||
|
{
|
||||||
|
TaskGroup = tagTask.TaskGroup,
|
||||||
|
TaskType = tagTask.TaskType,
|
||||||
|
VehicleNo = tagTask.VehicleNo,
|
||||||
|
OrderId = tagTask.OrderId,
|
||||||
|
TaskId = tagTask.TaskId,
|
||||||
|
Location = tagTask.Location,
|
||||||
|
GoodsId = tagTask.GoodsId,
|
||||||
|
GoodsName = tagTask.GoodsName,
|
||||||
|
NeedNum = tagTask.NeedNum,
|
||||||
|
ConfirmNum = pickNum
|
||||||
|
};
|
||||||
|
var postResult = wmsWebApiPost.HttpPost<ElTagComfirmButtonClickRequest, WmsResponse>(elTagComfirmButtonClickRequest, CommonData.AppApiBaseInfos.GetAddress("GetETaskFeedBack") ?? "", 2000);
|
||||||
|
if (!postResult.IsSend || postResult.ResponseEntity == default)
|
||||||
|
{
|
||||||
|
ConsoleLog.Exception($"【异常】电子标签按钮按下:标签任务号:{tagTask.TaskId} 已经确认,箱号:{tagTask.VehicleNo},拣选数量:{tagTask.NeedNum}({pickNum}) 请求WMS发生异常,异常信息:{postResult.RequestException}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (postResult.ResponseEntity.Code == 0)
|
||||||
|
{
|
||||||
|
ConsoleLog.Success($"电子标签按钮按下:标签任务号:{tagTask.TaskId} 已经确认,箱号:{tagTask.VehicleNo},拣选数量:{tagTask.NeedNum}({pickNum}) 请求WMS成功 {postResult.ResponseEntity.Message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ConsoleLog.Warning($"【警告】电子标签按钮按下:标签任务号:{tagTask.TaskId} 已经确认,箱号:{tagTask.VehicleNo},拣选数量:{tagTask.NeedNum}({pickNum}) 请求WMS失败,信息:{postResult.ResponseEntity.Message}");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,17 +66,20 @@ public class ConnectOprServe(AppTcpDao tcpDao, BaseOprDataHandler baseOprDataHan
|
||||||
/// <param name="tcpServe"></param>
|
/// <param name="tcpServe"></param>
|
||||||
public void ConnectSuccess(TcpServeConnectionData tcpServe)
|
public void ConnectSuccess(TcpServeConnectionData tcpServe)
|
||||||
{
|
{
|
||||||
ConsoleLog.Success($"电子标签:{tcpServe.TcpServe!.TcpIp} 连接成功");
|
Task.Factory.StartNew(() =>
|
||||||
_atopOperation.BlinkingAll(tcpServe);
|
|
||||||
/* 点亮数据库中正在点亮的标签 */
|
|
||||||
List<AppElTagTask>? tasks = _tagTaskDao.Query(new AppElTagTask { TaskStatus = (int)ElTagTaskStatusEnum.Lighting });
|
|
||||||
if (tasks == default)
|
|
||||||
{
|
{
|
||||||
ConsoleLog.Exception("【异常】查询 电子标签 任务失败,数据库连接异常");
|
ConsoleLog.Success($"电子标签:{tcpServe.TcpServe!.TcpIp} 连接成功");
|
||||||
Thread.Sleep(5000);
|
_atopOperation.BlinkingAll(tcpServe);
|
||||||
return;
|
/* 点亮数据库中正在点亮的标签 */
|
||||||
}
|
List<AppElTagTask>? tasks = _tagTaskDao.Query(new AppElTagTask { TaskStatus = (int)ElTagTaskStatusEnum.Lighting });
|
||||||
tasks.ForEach(LightTask);
|
if (tasks == default)
|
||||||
|
{
|
||||||
|
ConsoleLog.Exception("【异常】查询 电子标签 任务失败,数据库连接异常");
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tasks.ForEach(LightTask);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -178,18 +178,6 @@ public class ConveyOperation
|
||||||
public string WriteTask(string? equipmentId, int plcId, short router) => WriteTask(equipmentId, new ConveyPLCTask(plcId, router));
|
public string WriteTask(string? equipmentId, int plcId, short router) => WriteTask(equipmentId, new ConveyPLCTask(plcId, router));
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 释放指定位置的箱子
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="conveyId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string DisposeVehicle(string? conveyId)
|
|
||||||
{
|
|
||||||
if (!CommonData.IsConnectPlc || CommonTool.Siemens == default) return "PLC尚未连接。";
|
|
||||||
var (writeResult, _) = CommonTool.Siemens.WritePlcWhithName($"箱式线释放{conveyId}", (short)1);
|
|
||||||
return writeResult.Success ? string.Empty : writeResult.Message ?? "写入失败,未知原因";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取拣选站台释放的信号
|
/// 读取拣选站台释放的信号
|
||||||
|
|
@ -218,122 +206,4 @@ public class ConveyOperation
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取箱式线出库站台状态
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="standId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool GetOutConveyStatus(string? standId)
|
|
||||||
{
|
|
||||||
if (!CommonData.IsConnectPlc || CommonTool.Siemens == default)
|
|
||||||
{
|
|
||||||
// 未连接PLC
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var readGoodsExistResult = CommonTool.Siemens.ReadBoolWithName($"站台货物检测{standId}");
|
|
||||||
if (!readGoodsExistResult.Success || readGoodsExistResult.Value) // 读取失败,或者有货 就不允许出库
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var readAGVExistResult = CommonTool.Siemens.ReadBoolWithName($"站台AGV检测{standId}");
|
|
||||||
if (!readAGVExistResult.Success || readAGVExistResult.Value) // 读取失败,或者有AGV 就不允许出库
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!readGoodsExistResult.Value && !readAGVExistResult.Value) // 无货并且没有AGV才能出库
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 10.40.200.210
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取入库站台状态 --- 是否可以入库
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="standId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool GetInConveyStatus(string? standId)
|
|
||||||
{
|
|
||||||
if (!CommonData.IsConnectPlc || CommonTool.Siemens == default)
|
|
||||||
{
|
|
||||||
// 未连接PLC
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(standId)) { return false; }
|
|
||||||
if (standId.StartsWith('P'))
|
|
||||||
{
|
|
||||||
var readGoodsNeedIn = CommonTool.Siemens.ReadBoolWithName($"站台请求入库{standId}");
|
|
||||||
if (!readGoodsNeedIn.Success || !readGoodsNeedIn.Value) // 读取失败,或者没有货 就不允许入库
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
var readGoodsExistResult = CommonTool.Siemens.ReadBoolWithName($"站台货物检测{standId}");
|
|
||||||
if (!readGoodsExistResult.Success || !readGoodsExistResult.Value) // 读取失败,或者没有货 就不允许入库
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var readAGVExistResult = CommonTool.Siemens.ReadBoolWithName($"站台AGV检测{standId}");
|
|
||||||
if (!readAGVExistResult.Success || readAGVExistResult.Value) // 读取失败,或者有AGV 就不允许入库
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (readGoodsExistResult.Value && !readAGVExistResult.Value) // 有货并且没有AGV才能入库
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取箱式线拣选站台状态
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="standId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool GetPickConveyStatus(string? standId)
|
|
||||||
{
|
|
||||||
if (!CommonData.IsConnectPlc || CommonTool.Siemens == default)
|
|
||||||
{
|
|
||||||
// 未连接PLC
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var readGoodsExistResult = CommonTool.Siemens.ReadBoolWithName($"站台货物检测{standId}");
|
|
||||||
if (!readGoodsExistResult.Success) // 读取失败,或者有货 就不允许出库
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !readGoodsExistResult.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取输送机箱子号
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stackerId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string GetStandCode(int stackerId)
|
|
||||||
{
|
|
||||||
if (!CommonData.IsConnectPlc || CommonTool.Siemens == default)
|
|
||||||
{
|
|
||||||
// 未连接PLC
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
var readResult1 = CommonTool.Siemens.ReadStringWithName($"箱式线入库载具号{stackerId}", 10, Encoding.ASCII);
|
|
||||||
if (!readResult1.Success)
|
|
||||||
{
|
|
||||||
// 读取失败
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
// 返回读取到的任务号
|
|
||||||
return Regex.Replace(readResult1.Value ?? "", "\\W", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -68,6 +68,7 @@ public class AtopOperation
|
||||||
return new Exception("必须的值为空,无法发送电子标签");
|
return new Exception("必须的值为空,无法发送电子标签");
|
||||||
}
|
}
|
||||||
byte[] elTagData = TagSendInfo.ShowValue(Convert.ToByte(tagId), value);
|
byte[] elTagData = TagSendInfo.ShowValue(Convert.ToByte(tagId), value);
|
||||||
|
if (CommonTool.OprTcpClient == default) return new Exception("电子标签连接不存在");
|
||||||
var sendResult = CommonTool.OprTcpClient.Send(elTagData, controllerDisplayName); // 显示字符
|
var sendResult = CommonTool.OprTcpClient.Send(elTagData, controllerDisplayName); // 显示字符
|
||||||
//CommonTool.OprTcpClient.Send(TagSendInfo.SetValueKeepAlive(Convert.ToByte(tagId)), controllerDisplayName); // 使标签确认后仍然显示字符
|
//CommonTool.OprTcpClient.Send(TagSendInfo.SetValueKeepAlive(Convert.ToByte(tagId)), controllerDisplayName); // 使标签确认后仍然显示字符
|
||||||
CommonTool.OprTcpClient.Send(TagSendInfo.LedColor(Convert.ToByte(tagId), ledColor), controllerDisplayName); // 显示颜色
|
CommonTool.OprTcpClient.Send(TagSendInfo.LedColor(Convert.ToByte(tagId), ledColor), controllerDisplayName); // 显示颜色
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
using ApiTool;
|
using ApiTool;
|
||||||
using WcsMain.Business.CommonAction;
|
using WcsMain.Business.CommonAction;
|
||||||
using WcsMain.Common;
|
using WcsMain.Common;
|
||||||
|
using WcsMain.DataBase.Dao;
|
||||||
|
using WcsMain.DataBase.TableEntity;
|
||||||
using WcsMain.ExtendMethod;
|
using WcsMain.ExtendMethod;
|
||||||
using WcsMain.WcsAttribute.AutoFacAttribute;
|
using WcsMain.WcsAttribute.AutoFacAttribute;
|
||||||
|
|
||||||
|
|
@ -17,4 +19,5 @@ public class WmsWebApiPost : WebApiPost
|
||||||
SetResponseAction(wmsApiResponseAction.WMSApiResponse);
|
SetResponseAction(wmsApiResponseAction.WMSApiResponse);
|
||||||
SetBaseUrl(CommonData.AppApiBaseInfos.GetAddress("WmsBaseApiAddress") ?? "");
|
SetBaseUrl(CommonData.AppApiBaseInfos.GetAddress("WmsBaseApiAddress") ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ builder.Services.AddCors(options =>
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.WebHost.UseUrls(CommonData.Settings.UseUrls ?? ["http://*:890"]); // 地址请在 appSettings.json 里面配置,这里是默认值
|
builder.WebHost.UseUrls(CommonData.Settings.UseUrls ?? ["http://*:18990"]); // 地址请在 appSettings.json 里面配置,这里是默认值
|
||||||
|
|
||||||
// 使用 autoFac 替换注入容器
|
// 使用 autoFac 替换注入容器
|
||||||
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
"ApiOnly": false,
|
"ApiOnly": false,
|
||||||
"Language": "zh-CN"
|
"Language": "zh-CN"
|
||||||
},
|
},
|
||||||
"UseUrls": [ "http://*:890" ]
|
"UseUrls": [ "http://*:18990" ]
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user