Compare commits
3 Commits
14ff462b79
...
875090c8f6
| Author | SHA1 | Date | |
|---|---|---|---|
| 875090c8f6 | |||
| 1986f6dc06 | |||
| 6a5b4a640e |
|
|
@ -28,4 +28,13 @@ public class ConveyController(ConveyService conveyService) : ControllerBase
|
|||
[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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,5 +39,4 @@ public class WmsTaskController(WmsTaskService wmsTaskService) : ControllerBase
|
|||
/// <returns></returns>
|
||||
[HttpPost("setStackerTaskNewDestination")]
|
||||
public WmsApiResponse GetStackerTaskNewDestination([FromBody] GetStackerTaskNewDestinationRequest request) => wmsTaskService.GetStackerTaskNewDestination(request);
|
||||
|
||||
}
|
||||
|
|
@ -70,4 +70,49 @@ public class ConveyService(DataBaseData dataBaseData, AppConveyTaskDao conveyTas
|
|||
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("没有找到匹配的记录");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using WcsMain.Business.CommonAction;
|
|||
using WcsMain.Common;
|
||||
using WcsMain.DataBase.Dao;
|
||||
using WcsMain.DataBase.TableEntity;
|
||||
using WcsMain.Enum.Convey;
|
||||
using WcsMain.Enum.Stacker;
|
||||
using WcsMain.ExtendMethod;
|
||||
using WcsMain.Plugins;
|
||||
|
|
@ -28,7 +29,7 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
|||
/// <returns></returns>
|
||||
public WmsApiResponse<List<GetStackerRequest>> GetStackerTask(List<GetStackerRequest> request)
|
||||
{
|
||||
if (request.Count < 1 || request.Count > 20) return WmsApiResponseFactory.RequestErr<List<GetStackerRequest>>(null, "请求的任务数量只能在 1 至 20 范围内");
|
||||
if (request.Count < 1 || request.Count > 26) return WmsApiResponseFactory.RequestErr<List<GetStackerRequest>>(null, "请求的任务数量只能在 1 至 26 范围内");
|
||||
List<GetStackerRequest> errRequest = []; // 存放错误的请求
|
||||
/* 插入库存信息 */ // ---- 库存由WMS管理,数据库表也无需操作
|
||||
List<AppWmsTask> wmsTasks = [];
|
||||
|
|
@ -173,13 +174,5 @@ public class WmsTaskService(WmsTaskAction wmsTaskAction, AppWmsTaskDao wmsTaskDa
|
|||
//
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -16,6 +16,8 @@ namespace WcsMain.Business.CommonAction;
|
|||
public class SendWmsTaskStatus(AppWmsTaskDao wmsTaskDao, WmsWebApiPost wmsWebApiPost)
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送 WMS 任务异常
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -128,11 +128,15 @@ public class StackerOutC1(ConveyOperation conveyOperation, DataBaseData dataBase
|
|||
return;
|
||||
}
|
||||
else // 两个地区都存在任务
|
||||
{
|
||||
// 比对两个区的箱子数量
|
||||
var readResult_1 = CommonTool.Siemens.ReadInt16WithName($"数量1");
|
||||
var readResult_2 = CommonTool.Siemens.ReadInt16WithName($"数量2");
|
||||
ConsoleLog.Info($"前区箱子数量{readResult_1.Value},后区箱子数量{readResult_2.Value}");
|
||||
if (readResult_1.Value >= readResult_2.Value)//前区数量多去后区
|
||||
{
|
||||
ConsoleLog.Info($"出库分流:{area} 箱码:{msg} 存在 1~5 站台任务且存在 6~9 区域任务");
|
||||
Random random = new();
|
||||
var id = random.Next(0, 100);
|
||||
ConveyPLCTask plcTask = new(plcId, id < Convert.ToInt32(CommonData.AppConfig.Pick2Lv) ? (short)ConveyRouterEnum.Move : (short)ConveyRouterEnum.Go);
|
||||
ConveyPLCTask plcTask = new(plcId, (short)ConveyRouterEnum.Move);
|
||||
string errText = conveyOperation.WriteTask(area, plcTask);
|
||||
if (string.IsNullOrEmpty(errText))
|
||||
{
|
||||
|
|
@ -141,6 +145,34 @@ public class StackerOutC1(ConveyOperation conveyOperation, DataBaseData dataBase
|
|||
}
|
||||
ConsoleLog.Warning($"【警告】出库分流:{area} 箱码:{msg},写入PLC失败,{plcTask},信息:{errText}");
|
||||
return ;
|
||||
}
|
||||
else//后区数量多去前区
|
||||
{
|
||||
ConsoleLog.Info($"出库分流:{area} 箱码:{msg} 存在 1~5 站台任务且存在 6~9 区域任务");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
//ConsoleLog.Info($"出库分流:{area} 箱码:{msg} 存在 1~5 站台任务且存在 6~9 区域任务");
|
||||
//Random random = new();
|
||||
//var id = random.Next(0, 100);
|
||||
//ConveyPLCTask plcTask = new(plcId, id < Convert.ToInt32(CommonData.AppConfig.Pick2Lv) ? (short)ConveyRouterEnum.Move : (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;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,44 @@ public class AppConveyTaskDao
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除数据,以主键为条件
|
||||
/// </summary>
|
||||
/// <param name="appConveyTask"></param>
|
||||
/// <returns></returns>
|
||||
public int Delete(AppConveyTask appConveyTask)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sqlFuc = CommonTool.DbServe.Deleteable(appConveyTask);
|
||||
return sqlFuc.ExecuteCommand();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_ = ex;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据箱号和点位删除任务
|
||||
/// </summary>
|
||||
/// <param name="appConveyTask"></param>
|
||||
/// <returns></returns>
|
||||
public int VehicledDelete(AppConveyTask appConveyTask)
|
||||
{
|
||||
try
|
||||
{
|
||||
var deleteResult = CommonTool.DbServe.Deleteable<AppConveyTask>().Where(it => it.VehicleNo == appConveyTask.VehicleNo && it.Location == appConveyTask.Location).ExecuteCommand();
|
||||
return deleteResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_ = ex;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class AtopOperation
|
|||
/// <param name="ledColor"></param>
|
||||
/// <param name="ledStatus"></param>
|
||||
/// <returns></returns>
|
||||
public Exception? ShowMsg(string? controllerDisplayName, int? tagId, string? value, LedColor ledColor = LedColor.Green, LedStatus ledStatus = LedStatus._0_5secblinking)
|
||||
public Exception? ShowMsg(string? controllerDisplayName, int? tagId, string? value, LedColor ledColor = LedColor.Green, LedStatus ledStatus = LedStatus.LEDOn)
|
||||
{
|
||||
if (controllerDisplayName == default || tagId == default || value == default)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user