Merge branch 'master' of http://47.95.120.53:8083/r/WCSNet6
| | |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "StoreTime", ColumnDescription = "存储期至")] |
| | | public DateTime? StoreTime { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 抽检标记 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "InsPectMark", ColumnDescription = "抽检标记", Length = 3)] |
| | | public string? InsPectMark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 零箱标记 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "BitBoxMark", ColumnDescription = "零箱标记", Length = 3)] |
| | | public string? BitBoxMark { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 箱码 |
| | | /// </summary> |
| | |
| | | [SugarColumn(ColumnName = "EndLotFlag", ColumnDescription = "结批标识", Length = 3)] |
| | | public string? EndLotFlag { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 总件数 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "QtyCount", ColumnDescription = "总件数")] |
| | | public int? QtyCount { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 第几件 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "QtyOrd", ColumnDescription = "第几件")] |
| | | public int? QtyOrd { get; set; } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 状态 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "Status", ColumnDescription = "状态", Length = 3)] |
| | | public string? Status { get; set; } |
| | | |
| | | } |
| | |
| | | public List<ResponseTasksModel> TaskList { get; set; } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 返回赋码系统响应参数 |
| | | /// </summary> |
| | | public class ResponseFuMaModel |
| | | { |
| | | /// <summary> |
| | | /// 状态码 0成功 -1:失败 |
| | | /// </summary> |
| | | public string Success { get; set; } |
| | | /// <summary> |
| | | /// 提示信息 |
| | | /// </summary> |
| | | public string Message { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 赋码系统推送箱码信息 |
| | | /// </summary> |
| | | public class FumaBoxInfoInput |
| | | { |
| | | /// <summary> |
| | | /// 箱码 |
| | | /// </summary> |
| | | public string BoxNo { get; set; } |
| | | /// <summary> |
| | | /// 单据号 |
| | | /// </summary> |
| | | public string OrderNo { get; set; } |
| | | /// <summary> |
| | | /// 物料编码 |
| | | /// </summary> |
| | | public string SkuNo { get; set; } |
| | | /// <summary> |
| | | /// 物料名称 |
| | | /// </summary> |
| | | public string SkuName { get; set; } |
| | | /// <summary> |
| | | /// 物料规格 |
| | | /// </summary> |
| | | public string Standard { get; set; } |
| | | /// <summary> |
| | | /// 批次号 |
| | | /// </summary> |
| | | public string LotNo { get; set; } |
| | | /// <summary> |
| | | /// 数量 |
| | | /// </summary> |
| | | public decimal Qty { get; set; } |
| | | /// <summary> |
| | | /// 满箱数量 |
| | | /// </summary> |
| | | public decimal FullQty { get; set; } |
| | | /// <summary> |
| | | /// 供货商批次 |
| | | /// </summary> |
| | | public string SupplierLot { get; set; } |
| | | /// <summary> |
| | | /// 是否抽检箱 0否 1是 |
| | | /// </summary> |
| | | public string InsPectMark { get; set; } |
| | | /// <summary> |
| | | /// 是否零箱 0否 1是 |
| | | /// </summary> |
| | | public string BitBoxMark { get; set; } |
| | | /// <summary> |
| | | /// 质检状态 0待检(默认) 1合格 2不合格 |
| | | /// </summary> |
| | | public string InspectStatus { get; set; } |
| | | /// <summary> |
| | | /// 生产日期 |
| | | /// </summary> |
| | | public string ProductionTime { get; set; } |
| | | /// <summary> |
| | | /// 失效日期 |
| | | /// </summary> |
| | | public string ExpirationTime { get; set; } |
| | | /// <summary> |
| | | /// 储存期至 |
| | | /// </summary> |
| | | public string StoreTime { get; set; } |
| | | /// <summary> |
| | | /// 来源 固定值[赋码] |
| | | /// </summary> |
| | | public string Origin { get; set; } |
| | | /// <summary> |
| | | /// 结批标识 0/空:否 1:是 |
| | | /// </summary> |
| | | public string EndBatchMark { get; set; } |
| | | /// <summary> |
| | | /// 箱内明细 |
| | | /// </summary> |
| | | public List<BoxList> DelistList { get; set; } |
| | | |
| | | } |
| | | |
| | | public class BoxList |
| | | { |
| | | /// <summary> |
| | | /// 盒码 |
| | | /// </summary> |
| | | public string BoxNo2 { get; set; } |
| | | /// <summary> |
| | | /// 支码集合 |
| | | /// </summary> |
| | | public List<BoxList2> DelistList2 { get; set; } |
| | | } |
| | | |
| | | public class BoxList2 |
| | | { |
| | | /// <summary> |
| | | /// 支码 |
| | | /// </summary> |
| | | public string BoxNo3 { get; set; } |
| | | /// <summary> |
| | | /// 数量 |
| | | /// </summary> |
| | | public decimal Qty { get; set; } |
| | | /// <summary> |
| | | /// 总件数 |
| | | /// </summary> |
| | | public int? QtyCount { get; set; } |
| | | /// <summary> |
| | | /// 第几件 |
| | | /// </summary> |
| | | public int? QtyOrd { get; set; } |
| | | } |
| | | |
| | |
| | | using Elastic.Clients.Elasticsearch; |
| | | using DocumentFormat.OpenXml.Presentation; |
| | | using Elastic.Clients.Elasticsearch; |
| | | using Furion.Logging; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// WCS接受赋码系统推送的箱码信息 |
| | | /// </summary> |
| | | /// <param name="models">箱码信息</param> |
| | | /// <returns>反馈信息</returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public ResponseFuMaModel AddHttpBoxInfo(FumaBoxInfoInput models) |
| | | { |
| | | |
| | | try |
| | | { |
| | | string str = JsonConvert.SerializeObject(models); |
| | | Log.Information("接收赋码推送的箱码信息:"+str); |
| | | if (models.Origin != "赋码") |
| | | { |
| | | throw new Exception("来源未识别"); |
| | | } |
| | | var num = _db.Queryable<WcsBoxInfo>().Where(m=>m.BoxNo == models.BoxNo && m.IsDelete == false).ToList(); |
| | | var type = "add"; |
| | | if (num.Count>0) |
| | | { |
| | | //WCS存在箱码信息,更新箱码信息(需判断箱码是否已组盘入库) |
| | | var num2 = num.Count(m => m.Status != "0" || !string.IsNullOrWhiteSpace(m.PalletNo)); |
| | | if (num2 > 0) |
| | | { |
| | | throw new Exception("该箱已入盘入库,不可更新信息"); |
| | | } |
| | | type = "edit"; |
| | | } |
| | | |
| | | if (models.DelistList.Count == 0) |
| | | { |
| | | throw new Exception("盒码集合不能为空"); |
| | | } |
| | | |
| | | var listBox = new List<WcsBoxInfo>(); |
| | | foreach (var item in models.DelistList) |
| | | { |
| | | var level = "3"; |
| | | if (string.IsNullOrWhiteSpace(item.BoxNo2)) |
| | | { |
| | | level = "2"; |
| | | } |
| | | if (item.DelistList2.Count == 0) |
| | | { |
| | | throw new Exception("值码集合不能为空"); |
| | | } |
| | | //二级码 |
| | | foreach (var item2 in item.DelistList2) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(models.ProductionTime) || string.IsNullOrWhiteSpace(models.ExpirationTime)) |
| | | { |
| | | throw new Exception("生产日期或失效日期不能为空"); |
| | | } |
| | | DateTime proTime; |
| | | DateTime expTime; |
| | | var isValid = DateTime.TryParse(models.ProductionTime, out proTime); |
| | | var isValid2 = DateTime.TryParse(models.ExpirationTime, out expTime); |
| | | if (!isValid || !isValid2) |
| | | { |
| | | throw new Exception("生产日期或失效日期格式错误"); |
| | | }; |
| | | |
| | | var boxAdd = new WcsBoxInfo() |
| | | { |
| | | BoxNo = models.BoxNo, |
| | | //OrderNo = models.OrderNo, |
| | | SkuNo = models.SkuNo, |
| | | SkuName = models.SkuName, |
| | | Standard = models.Standard, |
| | | LotNo = models.LotNo, |
| | | Qty = item2.Qty, |
| | | FullQty = models.FullQty, |
| | | //SupplierLot = models.SupplierLot, |
| | | InsPectMark = models.InsPectMark, |
| | | BitBoxMark = models.BitBoxMark, |
| | | //InspectStatus = models.InspectStatus, |
| | | ProductionTime = proTime, |
| | | ExpirationTime = expTime, |
| | | StoreTime = DateTime.Parse(models.StoreTime), |
| | | EndLotFlag = string.IsNullOrWhiteSpace(models.EndBatchMark) ? "0" : models.EndBatchMark, |
| | | |
| | | BoxNo2 = item.BoxNo2, |
| | | BoxNo3 = item2.BoxNo3, |
| | | QtyCount = item2.QtyCount, |
| | | QtyOrd = item2.QtyOrd, |
| | | |
| | | Status = "0", |
| | | Level = level, |
| | | |
| | | IsDelete = false |
| | | }; |
| | | listBox.Add(boxAdd); |
| | | } |
| | | |
| | | } |
| | | _db.Insertable(listBox).ExecuteCommand(); |
| | | if (type == "edit") |
| | | { |
| | | //gen |
| | | _db.Deleteable(num).ExecuteCommand(); |
| | | return new ResponseFuMaModel() { Success = "0", Message = "更新成功" }; |
| | | } |
| | | return new ResponseFuMaModel() { Success = "0", Message = "插入成功" }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new ResponseFuMaModel() { Success = "-1", Message = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public static PLCUtil GetPlcIp(string startStation) |
| | | { |
| | | startStation = startStation.PadLeft(3, '0'); |
| | | string strIp = ""; |
| | | var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065","033","039","044" ,"051","059"}; |
| | | var conveyList2 = new List<string>() { "205", "234", "252", "254", "260", "262", "270", "272", "278", "280", "288", "290", "294", "301", "307", "309", "315", "317", "325", "327", "331", "337" }; |
| | |
| | | /// <returns>跺机联机</returns> |
| | | public static string GetRoadwayByStation(string StationNum) |
| | | { |
| | | StationNum = StationNum.PadLeft(3, '0'); |
| | | |
| | | string value = ""; |
| | | var conveyList1 = new List<string>() { "147", "145", "252", "254", "401", "402", }; |
| | | var conveyList2 = new List<string>() { "139", "137", "260", "262", "405", "406", }; |
| | |
| | | namespace WCS.Application; |
| | | public static class PLCService |
| | | { |
| | | private static readonly object OLock = new object(); |
| | | |
| | | private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId); |
| | | |
| | |
| | | } |
| | | } |
| | | // 根据箱内品种号获取码躲绑定工位及对应的分道号 |
| | | var checkTaskInfo = _db.Queryable<WcsCheckTask>().First(w => w.SkuNo == boxInfo.SkuNo && w.SkuName == boxInfo.SkuName && w.LotNo == boxInfo.LotNo); |
| | | var checkTaskInfo = _db.Queryable<WcsCheckTask>().First(w => w.SkuNo == boxInfo.SkuNo && w.SkuName == boxInfo.SkuName && w.LotNo == boxInfo.LotNo && w.Status == "1"); |
| | | if (checkTaskInfo == null) |
| | | { |
| | | // 绑定信息为null写入剔除通道号 |
| | |
| | | case "40": |
| | | // 请求组托,申请入库 |
| | | { |
| | | // 根据工位号,获取托盘号 |
| | | var checkTaskMedel = _db.Queryable<WcsCheckTask>().First(m => m.Port == modDevice.StationNum && m.IsDelete == false); |
| | | // 根据工位号获取 托盘线该工位号的配置信息 |
| | | var numModel = PLCTaskAction.plcDevices.First(m => m.StationNum == modDevice.StationNum && m.IsDelete == false && m.DeviceType == DeviceTypeEnum.Business && m.PlcId != modDevice.PlcId); |
| | | var posModel = PLCTaskAction.plcPositions.First(m => m.DeviceId == numModel.Id && m.Text == "目的工位" && m.IsDelete == false); |
| | | if (checkTaskMedel == null) |
| | | lock (OLock) |
| | | { |
| | | Log.Error(string.Format("组托失败根据码垛工位{0},获取托盘号失败!", modDevice.StationNum)); |
| | | |
| | | // 写入交互工位目标地址 |
| | | var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, "234"); |
| | | if (retVal.IsSucceed) |
| | | // 根据工位号,获取托盘号 |
| | | var checkTaskMedel = _db.Queryable<WcsCheckTask>().First(m => m.Port == modDevice.StationNum && m.IsDelete == false); |
| | | // 根据工位号获取 托盘线该工位号的配置信息 |
| | | var numModel = PLCTaskAction.plcDevices.First(m => m.StationNum == modDevice.StationNum && m.IsDelete == false && m.DeviceType == DeviceTypeEnum.Business && m.PlcId != modDevice.PlcId); |
| | | var posModel = PLCTaskAction.plcPositions.First(m => m.DeviceId == numModel.Id && m.Text == "目的工位" && m.IsDelete == false); |
| | | if (checkTaskMedel == null) |
| | | { |
| | | // 写入组托回复流程字 |
| | | retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | // 码垛工位托盘号 |
| | | string palletNo = checkTaskMedel.PalletNo; |
| | | |
| | | // 是否演示模式 |
| | | if (PLCTaskAction.boDemo) |
| | | { |
| | | // 直接箱wms申请巷道 |
| | | var http = new HttpService(); |
| | | string TaskNo = "", EndLocate = ""; |
| | | string strMsg = http.RequestRoadWay(palletNo, modDevice.StationNum, "1", "2", ref EndLocate, ref TaskNo); |
| | | if (strMsg.Contains("-1")) |
| | | { |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0};原因{1}", modDevice.StationNum, strMsg)); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | // 获取入库任务信息 |
| | | var taskModel = _db.Queryable<WcsTask>().First(m => m.TaskNo == TaskNo && m.IsDelete == false && (m.Status == TaskStatusEnum.Wait || m.Status == TaskStatusEnum.Doing)); |
| | | if (taskModel != null) |
| | | { |
| | | // 获取入库取货工位 |
| | | string endLocatVlue = PLCCommon.RoadwayToStationNum(taskModel.EndRoadway, "2"); |
| | | |
| | | var listResult = new List<Result>(); |
| | | |
| | | // 写入托盘输送线码垛工位 目的工位、任务号,写入交互流程组托成功 执行入库{若需要可以写入任务号等等其他信息} |
| | | listResult.Add(plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, endLocatVlue)); // 目标工位 |
| | | var modPosTask = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务号" && s.IsDelete == false); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTask.PosType, numModel.DbNumber, modPosTask.PlcPos, TaskNo)); |
| | | var modPosTaskType = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务类型" && s.IsDelete == false); |
| | | var taskTypeStr = (int)taskModel.TaskType; |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTaskType.PosType, numModel.DbNumber, modPosTaskType.PlcPos, taskTypeStr.ToString())); |
| | | |
| | | if (listResult.All(s => s.IsSucceed)) |
| | | { |
| | | // 写入组托回复流程字 |
| | | var retVal1 = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | if (retVal1.IsSucceed) |
| | | { |
| | | // 将入库任务由正在执行改为正在执行 |
| | | taskModel.Status = TaskStatusEnum.Doing; |
| | | _db.Updateable(taskModel).ExecuteCommand(); |
| | | |
| | | // 插入任务明细 |
| | | var modInsertTaskMonitor = new WcsTaskMonitor() |
| | | { |
| | | TaskNo = TaskNo, |
| | | PlcId = modDevice.Id, |
| | | PlcName = modDevice.Text, |
| | | InteractiveMsg = $"写入指令50:申请巷道成功", |
| | | PalletNo = palletNo, |
| | | Status = TaskStatusEnum.Complete, |
| | | StartLocat = modDevice.StationNum, |
| | | EndLocat = strMsg, |
| | | }; |
| | | // 插入交互日志 |
| | | _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | } |
| | | } |
| | | |
| | | //// 写入托盘输送线码垛工位 目的工位,写入交互流程组托成功 执行入库{若需要可以写入任务号等等其他信息} |
| | | //var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, endLocatVlue); |
| | | //if (retVal.IsSucceed) |
| | | //{ |
| | | // // 写入码垛交互-组托回复流程字 |
| | | // retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | |
| | | // // 将入库任务由正在执行改为正在执行 |
| | | // taskModel.Status = TaskStatusEnum.Doing; |
| | | // _db.Updateable(taskModel).ExecuteCommand(); |
| | | //} |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 根据托盘号,将组托信息插入boxinfolog表 并删除boxinfo表数据 |
| | | var boxInfoList = await _db.Queryable<WcsBoxInfo>().Where(w => w.IsDelete == false && w.PalletNo == palletNo).ToListAsync(); |
| | | if (boxInfoList.Count <= 0) |
| | | { |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0},箱码信息不存在", modDevice.StationNum)); |
| | | Log.Error(string.Format("组托失败根据码垛工位{0},获取托盘号失败!", modDevice.StationNum)); |
| | | |
| | | // 写入交互工位目标地址 |
| | | var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, "234"); |
| | | if (retVal.IsSucceed) |
| | | if (retVal.IsSucceed) |
| | | { |
| | | // 写入组托回复流程字 |
| | | retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | } |
| | | break; |
| | | } |
| | | string sqlStr = $"insert into WCSBoxInfoLog select * from WCSBoxInfo where IsDelete=0 and PalletNo='{palletNo}'"; |
| | | int insertCount = _db.Ado.ExecuteCommand(sqlStr); |
| | | if (insertCount > 0) |
| | | |
| | | // 码垛工位托盘号 |
| | | string palletNo = checkTaskMedel.PalletNo; |
| | | |
| | | // 是否演示模式 |
| | | if (PLCTaskAction.boDemo) |
| | | { |
| | | // 组托成功后将信息存到log表 |
| | | string sqlStr2 = $"delete from WCSBoxInfoLog where IsDelete=0 and PalletNo='{palletNo}'"; |
| | | _db.Ado.ExecuteCommand(sqlStr2); |
| | | } |
| | | // 向WMS申请巷道 |
| | | var http = new HttpService(); |
| | | string TaskNo = "", EndLocate = ""; |
| | | string strMsg = http.BindRequestRoadWay(checkTaskMedel.OrderNo,palletNo, checkTaskMedel.BoxCount.ToDecimal(),"0", checkTaskMedel.SkuNo, checkTaskMedel.LotNo, "","", boxInfoList, |
| | | modDevice.StationNum, "1", "2", ref EndLocate, ref TaskNo); |
| | | if (strMsg.Contains("-1")) |
| | | { |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0};原因{1}", modDevice.StationNum, strMsg)); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | // 获取入库任务信息 |
| | | var taskModel = _db.Queryable<WcsTask>().First(m => m.TaskNo == TaskNo && m.IsDelete == false && m.Status == TaskStatusEnum.Wait); |
| | | if (taskModel != null) |
| | | // 直接箱wms申请巷道 |
| | | var http = new HttpService(); |
| | | string TaskNo = "", EndLocate = ""; |
| | | string strMsg = http.RequestRoadWay(palletNo, modDevice.StationNum, "1", "2", ref EndLocate, ref TaskNo); |
| | | if (strMsg.Contains("-1")) |
| | | { |
| | | // 获取入库取货工位 |
| | | string endLocatVlue = PLCCommon.RoadwayToStationNum(taskModel.EndRoadway, "2"); |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0};原因{1}", modDevice.StationNum, strMsg)); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | // 获取入库任务信息 |
| | | var taskModel = _db.Queryable<WcsTask>().First(m => m.TaskNo == TaskNo && m.IsDelete == false && (m.Status == TaskStatusEnum.Wait || m.Status == TaskStatusEnum.Doing)); |
| | | if (taskModel != null) |
| | | { |
| | | // 获取入库取货工位 |
| | | string endLocatVlue = PLCCommon.RoadwayToStationNum(taskModel.EndRoadway, "2"); |
| | | |
| | | var listResult = new List<Result>(); |
| | | // 写入托盘输送线码垛工位 目的工位、任务号,写入交互流程组托成功 执行入库{若需要可以写入任务号等等其他信息} |
| | | listResult.Add(plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, endLocatVlue)); // 目标工位 |
| | | var modPosTask = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务号" && s.IsDelete == false); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTask.PosType, numModel.DbNumber, modPosTask.PlcPos, TaskNo)); |
| | | var modPosTaskType = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务类型" && s.IsDelete == false); |
| | | var taskTypeStr = (int)taskModel.TaskType; |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTaskType.PosType, numModel.DbNumber, modPosTaskType.PlcPos, taskTypeStr.ToString())); |
| | | var listResult = new List<Result>(); |
| | | |
| | | if (listResult.All(s => s.IsSucceed)) |
| | | // 写入托盘输送线码垛工位 目的工位、任务号,写入交互流程组托成功 执行入库{若需要可以写入任务号等等其他信息} |
| | | listResult.Add(plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, endLocatVlue)); // 目标工位 |
| | | var modPosTask = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务号" && s.IsDelete == false); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTask.PosType, numModel.DbNumber, modPosTask.PlcPos, TaskNo)); |
| | | var modPosTaskType = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务类型" && s.IsDelete == false); |
| | | var taskTypeStr = (int)taskModel.TaskType; |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTaskType.PosType, numModel.DbNumber, modPosTaskType.PlcPos, taskTypeStr.ToString())); |
| | | |
| | | if (listResult.All(s => s.IsSucceed)) |
| | | { |
| | | // 写入组托回复流程字 |
| | | var retVal1 = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | if (retVal1.IsSucceed) |
| | | { |
| | | // 将入库任务由正在执行改为正在执行 |
| | | taskModel.Status = TaskStatusEnum.Doing; |
| | | _db.Updateable(taskModel).ExecuteCommand(); |
| | | |
| | | // 插入任务明细 |
| | | var modInsertTaskMonitor = new WcsTaskMonitor() |
| | | { |
| | | TaskNo = TaskNo, |
| | | PlcId = modDevice.Id, |
| | | PlcName = modDevice.Text, |
| | | InteractiveMsg = $"写入指令50:申请巷道成功", |
| | | PalletNo = palletNo, |
| | | Status = TaskStatusEnum.Complete, |
| | | StartLocat = modDevice.StationNum, |
| | | EndLocat = strMsg, |
| | | }; |
| | | // 插入交互日志 |
| | | _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | } |
| | | } |
| | | |
| | | //// 写入托盘输送线码垛工位 目的工位,写入交互流程组托成功 执行入库{若需要可以写入任务号等等其他信息} |
| | | //var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, endLocatVlue); |
| | | //if (retVal.IsSucceed) |
| | | //{ |
| | | // // 写入码垛交互-组托回复流程字 |
| | | // retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | |
| | | // // 将入库任务由正在执行改为正在执行 |
| | | // taskModel.Status = TaskStatusEnum.Doing; |
| | | // _db.Updateable(taskModel).ExecuteCommand(); |
| | | //} |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 根据托盘号,将组托信息插入boxinfolog表 并删除boxinfo表数据 |
| | | var boxInfoList = _db.Queryable<WcsBoxInfo>().Where(w => w.IsDelete == false && w.PalletNo == palletNo).ToList(); |
| | | if (boxInfoList.Count <= 0) |
| | | { |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0},箱码信息不存在", modDevice.StationNum)); |
| | | |
| | | // 写入交互工位目标地址 |
| | | var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, "234"); |
| | | if (retVal.IsSucceed) |
| | | { |
| | | // 写入组托回复流程字 |
| | | var retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | if (retVal.IsSucceed) |
| | | { |
| | | // 将入库任务由正在执行改为正在执行 |
| | | taskModel.Status = TaskStatusEnum.Doing; |
| | | _db.Updateable(taskModel).ExecuteCommand(); |
| | | retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | } |
| | | break; |
| | | } |
| | | string sqlStr = $"insert into WCSBoxInfoLog select * from WCSBoxInfo where IsDelete=0 and PalletNo='{palletNo}'"; |
| | | int insertCount = _db.Ado.ExecuteCommand(sqlStr); |
| | | if (insertCount > 0) |
| | | { |
| | | // 组托成功后将信息存到log表 |
| | | string sqlStr2 = $"delete from WCSBoxInfoLog where IsDelete=0 and PalletNo='{palletNo}'"; |
| | | _db.Ado.ExecuteCommand(sqlStr2); |
| | | } |
| | | // 向WMS申请巷道 |
| | | var http = new HttpService(); |
| | | string TaskNo = "", EndLocate = ""; |
| | | string strMsg = http.BindRequestRoadWay(checkTaskMedel.OrderNo,palletNo, checkTaskMedel.BoxCount.ToDecimal(),"0", checkTaskMedel.SkuNo, checkTaskMedel.LotNo, "","", boxInfoList, |
| | | modDevice.StationNum, "1", "2", ref EndLocate, ref TaskNo); |
| | | if (strMsg.Contains("-1")) |
| | | { |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0};原因{1}", modDevice.StationNum, strMsg)); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | // 获取入库任务信息 |
| | | var taskModel = _db.Queryable<WcsTask>().First(m => m.TaskNo == TaskNo && m.IsDelete == false && m.Status == TaskStatusEnum.Wait); |
| | | if (taskModel != null) |
| | | { |
| | | // 获取入库取货工位 |
| | | string endLocatVlue = PLCCommon.RoadwayToStationNum(taskModel.EndRoadway, "2"); |
| | | |
| | | // 插入任务明细 |
| | | var modInsertTaskMonitor = new WcsTaskMonitor() |
| | | var listResult = new List<Result>(); |
| | | // 写入托盘输送线码垛工位 目的工位、任务号,写入交互流程组托成功 执行入库{若需要可以写入任务号等等其他信息} |
| | | listResult.Add(plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, endLocatVlue)); // 目标工位 |
| | | var modPosTask = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务号" && s.IsDelete == false); |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTask.PosType, numModel.DbNumber, modPosTask.PlcPos, TaskNo)); |
| | | var modPosTaskType = PLCTaskAction.plcPositions.First(s => s.DeviceId == numModel.Id && s.Text == "任务类型" && s.IsDelete == false); |
| | | var taskTypeStr = (int)taskModel.TaskType; |
| | | listResult.Add(plcConn.SetPlcDBValue(modPosTaskType.PosType, numModel.DbNumber, modPosTaskType.PlcPos, taskTypeStr.ToString())); |
| | | |
| | | if (listResult.All(s => s.IsSucceed)) |
| | | { |
| | | // 写入组托回复流程字 |
| | | var retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | if (retVal.IsSucceed) |
| | | { |
| | | TaskNo = TaskNo, |
| | | PlcId = modDevice.Id, |
| | | PlcName = modDevice.Text, |
| | | InteractiveMsg = $"写入指令50:申请巷道成功", |
| | | PalletNo = palletNo, |
| | | Status = TaskStatusEnum.Complete, |
| | | StartLocat = modDevice.StationNum, |
| | | EndLocat = strMsg, |
| | | }; |
| | | // 插入交互日志 |
| | | _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | // 将入库任务由正在执行改为正在执行 |
| | | taskModel.Status = TaskStatusEnum.Doing; |
| | | _db.Updateable(taskModel).ExecuteCommand(); |
| | | |
| | | // 插入任务明细 |
| | | var modInsertTaskMonitor = new WcsTaskMonitor() |
| | | { |
| | | TaskNo = TaskNo, |
| | | PlcId = modDevice.Id, |
| | | PlcName = modDevice.Text, |
| | | InteractiveMsg = $"写入指令50:申请巷道成功", |
| | | PalletNo = palletNo, |
| | | Status = TaskStatusEnum.Complete, |
| | | StartLocat = modDevice.StationNum, |
| | | EndLocat = strMsg, |
| | | }; |
| | | // 插入交互日志 |
| | | _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | HubUtil.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自动结批 |
| | | /// 自动结批 并 解绑分道 |
| | | /// </summary> |
| | | /// <param name="lotNo">批次号</param> |
| | | /// <param name="plcConn">Plc连接</param> |
| | | /// <param name="status">是否解绑分道 0:解绑 1:绑定</param> |
| | | /// <param name="status">是否解绑分道 0:解绑 1:绑定</param> |
| | | private static void AutoEndLot(string lotNo,PLCUtil plcConn,string status) |
| | | { |
| | | try |
| | |
| | | foreach (var item in checkTaskList) |
| | | { |
| | | #region#给PLC写入结批批次号 |
| | | // 写入结批信号 |
| | | var ret = plcConn.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "1"); |
| | | // 分道解绑,抓箱品种写入0 |
| | | var ret1 = plcConn.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PlcPos, "0"); |
| | | if (ret.IsSucceed) |
| | | { |
| | | //写入流程字成功后更新分拣任务 liudl 最后一托盘申请完入库才可清空 |
| | |
| | | //item.SkuName = ""; |
| | | //item.BoxType = ""; |
| | | //item.Qty = 0; |
| | | //item.PZNo = ""; |
| | | item.PZNo = ""; |
| | | item.Status = status; // 绑定分道 0:解绑 1:绑定 |
| | | |
| | | //更新分拣任务 |
| | |
| | | } |
| | | if (!modPlcUtil.Connected) |
| | | { |
| | | Thread.Sleep(10000); |
| | | Thread.Sleep(1000); |
| | | modPlcUtil.Open(); |
| | | continue; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | Thread.Sleep(50000); |
| | | Thread.Sleep(1000); |
| | | } |
| | | catch (OperationCanceledException) |
| | | { |
| | |
| | | HubUtil.PublicPlcConn(modPlc); |
| | | } |
| | | } |
| | | Thread.Sleep(1000); |
| | | Thread.Sleep(10000); |
| | | } |
| | | } |
| | | catch (OperationCanceledException) |
| | |
| | | [DisplayName("任务强制结批")] |
| | | public async Task CloseTaskForPLC(CloseTaskPLCInput input) |
| | | { |
| | | if (PLCTaskAction.boDemo) |
| | | { |
| | | //演示模式 |
| | | var checkTaskList2 = await _wcsCheckTaskRep.Context.Queryable<WcsCheckTask>().FirstAsync(w => w.Port == "208"); |
| | | // 注释:演示模式不绑定分道。liudl 2024-10-30 |
| | | //if (PLCTaskAction.boDemo) |
| | | //{ |
| | | // //演示模式 |
| | | // var checkTaskList2 = await _wcsCheckTaskRep.Context.Queryable<WcsCheckTask>().FirstAsync(w => w.Port == "208"); |
| | | |
| | | var deviceInfo = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(w => w.StationNum == "208"); |
| | | if (deviceInfo == null) |
| | | { |
| | | throw Oops.Bah($"找不到工位号:208的码垛工位信息"); |
| | | } |
| | | var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == deviceInfo.PlcId); |
| | | if (modPlc == null) |
| | | { |
| | | throw Oops.Bah($"找不到工位号:208的设备信息"); |
| | | } |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | // var deviceInfo = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(w => w.StationNum == "208"); |
| | | // if (deviceInfo == null) |
| | | // { |
| | | // throw Oops.Bah($"找不到工位号:208的码垛工位信息"); |
| | | // } |
| | | // var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == deviceInfo.PlcId); |
| | | // if (modPlc == null) |
| | | // { |
| | | // throw Oops.Bah($"找不到工位号:208的设备信息"); |
| | | // } |
| | | // PLCUtil modUtil = new PLCUtil(modPlc); |
| | | |
| | | var ret = modUtil.SetPlcDBValue(checkTaskList2.PosTypeLot, checkTaskList2.DbNumber, checkTaskList2.PosLot, "1"); |
| | | return; |
| | | } |
| | | // var ret = modUtil.SetPlcDBValue(checkTaskList2.PosTypeLot, checkTaskList2.DbNumber, checkTaskList2.PosLot, "1"); |
| | | // return; |
| | | //} |
| | | |
| | | // 正常模式 |
| | | if (string.IsNullOrWhiteSpace(input.lotNo)) |
| | |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | if (modUtil.Connected) |
| | | { |
| | | var ret = modUtil.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "1"); |
| | | var ret = modUtil.SetPlcDBValue(item.PosTypeLot, item.DbNumber, item.PosLot, "0"); // 解绑分道 |
| | | if (ret.IsSucceed) |
| | | { |
| | | //写入流程字成功后更新分拣任务 |
| | |
| | | /// 楼层 |
| | | /// </summary> |
| | | public string Layer { get; set; } |
| | | /// <summary> |
| | | /// 事件结果 true/false |
| | | /// </summary> |
| | | public string FuncName { get; set; } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | #region 工作台操作 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 手动操作PLC锁定写入工位信息 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "WriteLocationInfo")] |
| | | [DisplayName("手动操作PLC锁定写入工位信息")] |
| | | public async Task WriteLocationInfo(WcsDeviceUpInfo input) |
| | | { |
| | | WcsPlc modPlc; |
| | | string DbNum = "";// DB块 |
| | | |
| | | if (string.IsNullOrWhiteSpace(input.LocatNo))//如果工位为空 |
| | | { |
| | | throw Oops.Bah("工位不能为空"); |
| | | } |
| | | var plcList = await _wcsPlcRep.Context.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.IsDelete == false).ToListAsync(); |
| | | switch (input.Layer) |
| | | { |
| | | case "1": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "1层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = ""; |
| | | break; |
| | | case "2": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "2层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = "DB91"; |
| | | break; |
| | | case "3": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "3层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = ""; |
| | | break; |
| | | default: |
| | | throw Oops.Bah("楼层信息错误"); |
| | | } |
| | | |
| | | var device = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(s => s.PlcId == modPlc.Id && s.StationNum == input.LocatNo && s.IsDelete == false && s.DeviceType == DeviceTypeEnum.Show); |
| | | if (device == null) |
| | | { |
| | | throw Oops.Bah("当前楼层未查询到该工位信息"); |
| | | } |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | |
| | | switch (input.TypeName) |
| | | { |
| | | case "suoding": // 锁定 |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48.0", input.LocatNo); |
| | | break; |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | modUtil.Close(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取工位上信息 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ApiDescriptionSettings(Name = "GetLocationInfo")] |
| | | [DisplayName("获取工位上信息")] |
| | | public async Task<WcsDeviceUpInfo> GetLocationInfo(WcsDeviceUpInfo input) |
| | | { |
| | | WcsPlc modPlc; |
| | | string DbNum = "";// DB块 |
| | | |
| | | if (string.IsNullOrWhiteSpace(input.LocatNo))//如果工位为空 |
| | | { |
| | | throw Oops.Bah("工位不能为空"); |
| | | } |
| | | var plcList = await _wcsPlcRep.Context.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.IsDelete == false).ToListAsync(); |
| | | switch (input.Layer) |
| | | { |
| | | case "1": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "1层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = ""; |
| | | break; |
| | | case "2": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "2层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = "DB1100"; |
| | | break; |
| | | case "3": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "3层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = ""; |
| | | break; |
| | | default: |
| | | throw Oops.Bah("楼层信息错误"); |
| | | } |
| | | |
| | | var device = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(s => s.PlcId == modPlc.Id && s.StationNum == input.LocatNo && s.IsDelete == false && s.DeviceType == DeviceTypeEnum.Show); |
| | | if (device == null) |
| | | { |
| | | throw Oops.Bah("当前楼层未查询到该工位信息"); |
| | | } |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | WcsDeviceUpInfo data = new WcsDeviceUpInfo(); |
| | | data.FuncName = ""; |
| | | data.Layer = ""; |
| | | data.LocatNo = input.LocatNo; |
| | | data.TypeName = ""; |
| | | var (result2, value2) = modUtil.GetPlcDBValue(PLCDataTypeEnum.String, DbNum, "4"); |
| | | data.PalletNo = value2; |
| | | var (result3, value3) = modUtil.GetPlcDBValue(PLCDataTypeEnum.String, DbNum, "14"); |
| | | data.TaskNo = value3; |
| | | var (result4, value4) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "34"); |
| | | data.StartLoction = value4.ToString(); |
| | | var (result5, value5) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "36"); |
| | | data.EndLoction = value5.ToString(); |
| | | |
| | | var (result6, value6) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "38"); |
| | | data.StartPai = value6.ToString(); |
| | | var (result7, value7) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "40"); |
| | | data.StartLie = value7.ToString(); |
| | | var (result8, value8) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "42"); |
| | | data.StartCeng = value8.ToString(); |
| | | |
| | | |
| | | var (result9, value9) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "44"); |
| | | data.EndPai = value9.ToString(); |
| | | var (result10, value10) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "46"); |
| | | data.EndLie = value10.ToString(); |
| | | var (result11, value11) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48"); |
| | | data.EndCeng = value11.ToString(); |
| | | |
| | | modUtil.Close(); |
| | | return data; |
| | | } |
| | | /// <summary> |
| | | /// 手动操作PLC信息 |
| | | /// </summary> |
| | |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "2层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = "91"; |
| | | DbNum = "DB91"; |
| | | break; |
| | | case "3": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "3层托盘输送线"); |
| | |
| | | { |
| | | throw Oops.Bah("当前楼层未查询到该工位信息"); |
| | | } |
| | | |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | |
| | | |
| | | // true : 手动模式 false:自动模式 |
| | | var (result, value) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.4"); |
| | | if (result.IsSucceed) |
| | | { |
| | | if (input.TypeName != "shoudong" && value.ToString().ToLower() != "false") |
| | | if (input.TypeName != "shoudong" && value.ToString().ToLower() == "false" && input.TypeName != "huifu" && input.TypeName != "UpTask" ) |
| | | { |
| | | throw Oops.Bah("当前为自动模式,请先切换为手动模式"); |
| | | } |
| | |
| | | { |
| | | throw Oops.Bah("读取PLC手自动值失败"); |
| | | } |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48.0", input.LocatNo); |
| | | |
| | | switch (input.TypeName) |
| | | { |
| | | case "zidong": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.4", "true"); |
| | | break; |
| | | case "shoudong": |
| | | case "zidong": // 自动 |
| | | //modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48.0", input.LocatNo); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.4", "false"); |
| | | break; |
| | | case "huifu": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "47.0", "true"); |
| | | case "shoudong": // 手动 |
| | | //modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48.0", input.LocatNo); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.4", "true"); |
| | | break; |
| | | case "1diandong": |
| | | case "huifu": // 报警恢复 |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "47.0", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "47.0", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | |
| | | break; |
| | | case "1diandong": // 1点动 |
| | | if(input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.7", "true"); |
| | |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "1liandong": |
| | | case "1liandong": // 1联动 |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "51.3", "true"); |
| | |
| | | } |
| | | break; |
| | | case "UpTask": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.0", "true"); |
| | | var (result1, value2) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.0"); |
| | | if (result.IsSucceed) |
| | | { |
| | | if (value2 == true) |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.0", "false"); |
| | | } |
| | | else |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.0", "true"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("读取PLC值失败"); |
| | | } |
| | | |
| | | |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "2层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到{input.Layer}楼层PLC信息"); |
| | | DbNum = "91"; |
| | | TaskDbNum = "1101"; |
| | | DbNum = "DB91"; |
| | | TaskDbNum = "DB1100"; |
| | | break; |
| | | case "3": |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "3层托盘输送线"); |
| | |
| | | } |
| | | |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | var (result, value) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.0"); |
| | | if (result.IsSucceed) |
| | | { |
| | | if (value.ToString().ToLower() != "false") |
| | | { |
| | | throw Oops.Bah("请先切换为更改任务模式"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("读取PLC手自动值失败"); |
| | | } |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48.0", input.LocatNo); |
| | | //var (result, value) = modUtil.GetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.0"); |
| | | //if (result.IsSucceed) |
| | | //{ |
| | | // if (value.ToString().ToLower() != "false") |
| | | // { |
| | | // throw Oops.Bah("请先切换为更改任务模式"); |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // throw Oops.Bah("读取PLC手自动值失败"); |
| | | //} |
| | | //modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, DbNum, "48.0", input.LocatNo); |
| | | switch (input.TypeName) |
| | | { |
| | | case "writeTask": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.String, TaskDbNum, "4", input.PalletNo); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.String, TaskDbNum, "14", input.TaskNo); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "34", input.StartLoction); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "36", input.EndLoction); |
| | | //modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "34", input.StartLoction); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, TaskDbNum, "36.0", input.EndLoction); |
| | | |
| | | |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "38", input.StartPai); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "40", input.StartLie); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "42", input.StartCeng); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, TaskDbNum, "38", input.StartPai); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, TaskDbNum, "40", input.StartLie); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, TaskDbNum, "42", input.StartCeng); |
| | | |
| | | |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "44", input.EndPai); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "46", input.EndLie); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Int, TaskDbNum, "48", input.EndCeng); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, TaskDbNum, "44", input.EndPai); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, TaskDbNum, "46", input.EndLie); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Short, TaskDbNum, "48", input.EndCeng); |
| | | |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.3", "true"); |
| | | Thread.Sleep(1000); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.3", "false"); |
| | | break; |
| | | case "writeTaskDelete": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.2", "true"); |
| | | Thread.Sleep(1000); |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "50.2", "false"); |
| | | break; |
| | | |
| | | default: |
| | |
| | | modPlc = plcList.FirstOrDefault(m => m.Text == "2层托盘输送线"); |
| | | if (modPlc == null) |
| | | throw Oops.Bah($"未查询到2楼层PLC信息"); |
| | | DbNum = "91"; |
| | | DbNum = "DB91"; |
| | | PLCUtil modUtil = new PLCUtil(modPlc); |
| | | switch (input.Type) |
| | | { |
| | | case "TwoPalletStart": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.0", "true"); |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.0", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.0", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "OnePalletStop": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.1", "true"); |
| | | case "TwoPalletStop": |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.1", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.1", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "TwoMaStart": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.0", "true"); |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.0", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.0", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "TwoMaStop": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.1", "true"); |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.1", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.1", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "TwoMaTwoStart": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.2", "true"); |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.2", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.2", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "TwoMaTwoStop": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.3", "true"); |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.3", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.3", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "TwoBoxStart": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.2", "true"); |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.2", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.2", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | case "TwoBoxStop": |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.3", "true"); |
| | | |
| | | if (input.FuncName == "true") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.3", "true"); |
| | | } |
| | | else if (input.FuncName == "false") |
| | | { |
| | | modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.3", "false"); |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Bah("事件结果错误"); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | CloseTaskForPLC='/api/WcsCheckTask/CloseTaskForPLC', |
| | | |
| | | |
| | | GetLocationInfo = '/api/wcsDevice/GetLocationInfo', |
| | | WriteLocationInfo = '/api/wcsDevice/WriteLocationInfo', |
| | | WriteInfo = '/api/wcsDevice/WriteInfo', |
| | | WriteTaskInfo = '/api/wcsDevice/WriteTaskInfo', |
| | | WriteStartStop = '/api/wcsDevice/WriteStartStop', |
| | | } |
| | | // 增加设备信息 |
| | | export const WriteLocationInfo = (params?: any) => |
| | | request({ |
| | | url: Api.WriteLocationInfo, |
| | | method: 'post', |
| | | data: params, |
| | | }); |
| | | // 增加设备信息 |
| | | export const GetLocationInfo = (params?: any) => |
| | | request({ |
| | | url: Api.GetLocationInfo, |
| | | method: 'post', |
| | | data: params, |
| | | }); |
| | | // 增加设备信息 |
| | | export const WriteInfo = (params?: any) => |
| | | request({ |
| | | url: Api.WriteInfo, |
| | |
| | | <div > |
| | | <el-form label-position="right" label-width="40px" style=""> |
| | | <el-form-item label="工位"> |
| | | <el-input v-model="stationValue.LocatNo" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input id="locaText" :disabled="lockInputStatus" v-model="stationValue.locatNo" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-button @click="textLock(stationValue)">{{lockText}}</el-button> |
| | | <el-button @click="write('zidong',stationValue)">自动</el-button> |
| | | <el-button @click="write('shoudong',stationValue)">手动</el-button> |
| | | <el-button @click="write('huifu',stationValue)">报警恢复</el-button> |
| | | <el-button @mousedown="writeDown('huifu',stationValue)" @mouseup="writeUp('huifu',stationValue)">报警恢复</el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button size="large" @mousedown="writeDown('1diandong',stationValue)" @mouseup="writeUp('1diandong',stationValue)">1点动</el-button> |
| | | <el-button size="large" @mousedown="writeDown('2diandong',stationValue)" @mouseup="writeUp('2diandong',stationValue)">2点动</el-button> |
| | | <el-button size="large" @mousedown="writeDown('3diandong',stationValue)" @mouseup="writeUp('3diandong',stationValue)">3点动</el-button> |
| | | <el-button size="large" @mousedown="writeDown('4diandong',stationValue)" @mouseup="writeUp('4diandong',stationValue)">4点动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('1diandong',stationValue)" @mouseup="writeUp('1diandong',stationValue)">1点动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('2diandong',stationValue)" @mouseup="writeUp('2diandong',stationValue)">2点动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('3diandong',stationValue)" @mouseup="writeUp('3diandong',stationValue)">3点动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('4diandong',stationValue)" @mouseup="writeUp('4diandong',stationValue)">4点动</el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button size="large" @mousedown="writeDown('1liandong',stationValue)" @mouseup="writeUp('1liandong',stationValue)">1联动</el-button> |
| | | <el-button size="large" @mousedown="writeDown('2liandong',stationValue)" @mouseup="writeUp('2liandong',stationValue)">2联动</el-button> |
| | | <el-button size="large" @mousedown="writeDown('3liandong',stationValue)" @mouseup="writeUp('3liandong',stationValue)">3联动</el-button> |
| | | <el-button size="large" @mousedown="writeDown('4liandong',stationValue)" @mouseup="writeUp('4liandong',stationValue)">4联动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('1liandong',stationValue)" @mouseup="writeUp('1liandong',stationValue)">1联动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('2liandong',stationValue)" @mouseup="writeUp('2liandong',stationValue)">2联动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('3liandong',stationValue)" @mouseup="writeUp('3liandong',stationValue)">3联动</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('4liandong',stationValue)" @mouseup="writeUp('4liandong',stationValue)">4联动</el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button size="large" @mousedown="writeDown('yizaisheng',stationValue)" @mouseup="writeUp('yizaisheng',stationValue)">移栽上升</el-button> |
| | | <el-button size="large" @mousedown="writeDown('fanzhuansheng',stationValue)" @mouseup="writeUp('fanzhuansheng',stationValue)">翻转机上升</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('yizaisheng',stationValue)" @mouseup="writeUp('yizaisheng',stationValue)">移栽上升</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('fanzhuansheng',stationValue)" @mouseup="writeUp('fanzhuansheng',stationValue)">翻转机上升</el-button> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button size="large" @mousedown="writeDown('yizaijiang',stationValue)" @mouseup="writeUp('yizaijiang',stationValue)">移栽下降</el-button> |
| | | <el-button size="large" @mousedown="writeDown('fanzhuanjiang',stationValue)" @mouseup="writeUp('fanzhuanjiang',stationValue)">翻转机下降</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('yizaijiang',stationValue)" @mouseup="writeUp('yizaijiang',stationValue)">移栽下降</el-button> |
| | | <el-button size="large" :disabled="lockStatus" @mousedown="writeDown('fanzhuanjiang',stationValue)" @mouseup="writeUp('fanzhuanjiang',stationValue)">翻转机下降</el-button> |
| | | </el-form-item> |
| | | |
| | | </el-form> |
| | |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="任务号" > |
| | | <el-input v-model="stationValue.TaskNo" style="width: 200px; "></el-input> |
| | | <el-input v-model="stationValue.taskNo" style="width: 200px; "></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="托盘号"> |
| | | <el-input v-model="stationValue.PalletNo" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.palletNo" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="起始工位"> |
| | | <el-input v-model="stationValue.StartLoction" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.startLoction" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="目标工位"> |
| | | <el-input v-model="stationValue.EndLoction" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.endLoction" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="起始排"> |
| | | <el-input v-model="stationValue.StartPai" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.startPai" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="起始列"> |
| | | <el-input v-model="stationValue.StartLie" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.startLie" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="起始层"> |
| | | <el-input v-model="stationValue.StartCeng" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.startCeng" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="目标排"> |
| | | <el-input v-model="stationValue.EndPai" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.endPai" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="目标列"> |
| | | <el-input v-model="stationValue.EndLie" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.endLie" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="目标层"> |
| | | <el-input v-model="stationValue.EndCeng" style="width: 200px; margin-right: 10px;"></el-input> |
| | | <el-input v-model="stationValue.endCeng" style="width: 200px; margin-right: 10px;"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | |
| | | <script lang="ts" setup> |
| | | import { ref, reactive, onMounted } from 'vue'; |
| | | import { listStatus, listPosition } from '/@/api/wcs/wcsPlc'; |
| | | import { WriteInfo,WriteTaskInfo } from '/@/api/wcs/wcsDevice'; |
| | | import { GetLocationInfo,WriteLocationInfo,WriteInfo,WriteTaskInfo } from '/@/api/wcs/wcsDevice'; |
| | | import { signalR } from './signalR'; |
| | | import { cellsDataLine, cellsDataOne, cellsDataTwo, cellsDataThree } from './data'; |
| | | import { ElMessage } from "element-plus"; |
| | | |
| | | // export default{ |
| | | |
| | | // } |
| | | const state = ref<any>({}); |
| | | const stackers = ref<any>({}); |
| | | const conveyors = ref<any>({}); |
| | | |
| | | |
| | | const lockText = ref("锁定"); |
| | | const lockStatus = ref(true); |
| | | const lockInputStatus = ref(false); |
| | | |
| | | const stationValue = ref<any>({ |
| | | LocatNo: '',//工位 |
| | | Layer:'',//楼层 |
| | | TypeName:'',//操作类型名称 |
| | | FuncName:'',//事件结果 true/false |
| | | locatNo: '',//工位 |
| | | layer:'',//楼层 |
| | | typeName:'',//操作类型名称 |
| | | funcName:'',//事件结果 true/false |
| | | |
| | | TaskNo:'', |
| | | PalletNo:'', |
| | | StartLoction:'', |
| | | EndLoction:'', |
| | | StartPai:'', |
| | | StartLie:'', |
| | | StartCeng:'', |
| | | EndPai:'', |
| | | EndLie:'', |
| | | EndCeng:'', |
| | | taskNo:'', |
| | | palletNo:'', |
| | | startLoction:'', |
| | | endLoction:'', |
| | | startPai:'', |
| | | startLie:'', |
| | | startCeng:'', |
| | | endPai:'', |
| | | endLie:'', |
| | | endCeng:'', |
| | | }); |
| | | |
| | | |
| | | |
| | | // 查询状态 |
| | | const handleQuery = async () => { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | const textLock = async (row: any) => { |
| | | if(lockText.value == "锁定"){ |
| | | lockStatus.value=false; |
| | | lockInputStatus.value=true; |
| | | lockText.value ="解锁"; |
| | | if (floorStates.value.isPlain1 == false) { |
| | | row.layer = 1; |
| | | }else if(floorStates.value.isPlain2 == false){ |
| | | row.layer = 2; |
| | | } |
| | | else if(floorStates.value.isPlain3 == false){ |
| | | row.layer = 3; |
| | | } |
| | | row.typeName = "suoding"; |
| | | |
| | | console.log(row); |
| | | var res = await WriteLocationInfo(row); |
| | | var res2 = await GetLocationInfo(row); |
| | | let rowData = JSON.parse(JSON.stringify(res2.data.result)); |
| | | stationValue.value = res2.data.result; |
| | | // stationValue.value = { |
| | | // locatNo: '',//工位 |
| | | // layer:'',//楼层 |
| | | // typeName:'',//操作类型名称 |
| | | // funcName:null,//事件结果 true/false |
| | | |
| | | // taskNo:'', |
| | | // palletNo:'', |
| | | // startLoction:'', |
| | | // endLoction:'', |
| | | // startPai:'', |
| | | // startLie:'', |
| | | // startCeng:'', |
| | | // endPai:'', |
| | | // endLie:'', |
| | | // endCeng:'', |
| | | // } |
| | | |
| | | |
| | | console.log(res2.data.result); |
| | | console.log(rowData); |
| | | |
| | | }else{ |
| | | lockStatus.value=true; |
| | | lockInputStatus.value=false; |
| | | lockText.value ="锁定"; |
| | | } |
| | | |
| | | } |
| | | |
| | | const write = async (type: string,row: any) => { |
| | | if (lockStatus.value == false) { |
| | | ElMessage.success("请先锁定"); |
| | | return; |
| | | } |
| | | if (floorStates.value.isPlain1 == false) { |
| | | row.Layer = 1; |
| | | row.layer = 1; |
| | | }else if(floorStates.value.isPlain2 == false){ |
| | | row.Layer = 2; |
| | | row.layer = 2; |
| | | } |
| | | else if(floorStates.value.isPlain3 == false){ |
| | | row.Layer = 3; |
| | | row.layer = 3; |
| | | } |
| | | row.TypeName = type; |
| | | row.typeName = type; |
| | | |
| | | console.log(row); |
| | | var res = await WriteInfo(row); |
| | |
| | | } |
| | | |
| | | const writeDown = async (type: string,row: any) => { |
| | | if (lockStatus.value == false) { |
| | | ElMessage.success("请先锁定"); |
| | | return; |
| | | } |
| | | if (floorStates.value.isPlain1 == false) { |
| | | row.Layer = 1; |
| | | row.layer = 1; |
| | | }else if(floorStates.value.isPlain2 == false){ |
| | | row.Layer = 2; |
| | | row.layer = 2; |
| | | } |
| | | else if(floorStates.value.isPlain3 == false){ |
| | | row.Layer = 3; |
| | | row.layer = 3; |
| | | } |
| | | row.TypeName = type; |
| | | row.FuncName = "true"; |
| | | row.typeName = type; |
| | | row.funcName = "true"; |
| | | var res = await WriteInfo(row); |
| | | console.log(type+"按下事件"); |
| | | |
| | | // ElMessage.success(res.data.result); |
| | | } |
| | | const writeUp = async (type: string,row: any) => { |
| | | if (lockStatus.value == false) { |
| | | ElMessage.success("请先锁定"); |
| | | return; |
| | | } |
| | | if (floorStates.value.isPlain1 == false) { |
| | | row.Layer = 1; |
| | | row.layer = 1; |
| | | }else if(floorStates.value.isPlain2 == false){ |
| | | row.Layer = 2; |
| | | row.layer = 2; |
| | | } |
| | | else if(floorStates.value.isPlain3 == false){ |
| | | row.Layer = 3; |
| | | row.layer = 3; |
| | | } |
| | | row.TypeName = type; |
| | | row.FuncName = "false"; |
| | | row.typeName = type; |
| | | row.funcName = "false"; |
| | | var res = await WriteInfo(row); |
| | | console.log(type+"抬起事件"); |
| | | |
| | |
| | | |
| | | const writeTaskInfo = async (type: string,row: any) => { |
| | | if (floorStates.value.isPlain1 == false) { |
| | | row.Layer = 1; |
| | | row.layer = 1; |
| | | }else if(floorStates.value.isPlain2 == false){ |
| | | row.Layer = 2; |
| | | row.layer = 2; |
| | | } |
| | | else if(floorStates.value.isPlain3 == false){ |
| | | row.Layer = 3; |
| | | row.layer = 3; |
| | | } |
| | | row.TypeName = type; |
| | | row.typeName = type; |
| | | var res = await WriteTaskInfo(row); |
| | | console.log(type+"抬起事件"); |
| | | |
| | |
| | | <el-collapse-item title="仓库二层" name="2"> |
| | | <el-card class="box-card" shadow="hover"> |
| | | <el-text style="margin-right: 15px;">托盘输送</el-text> |
| | | <el-button @click="write('TwoPalletStart','2')">启动</el-button> |
| | | <el-button @click="write('TwoPalletStop','2')">停止</el-button> |
| | | <el-button @mousedown="writeDown('TwoPalletStart','2')" @mouseup="writeUp('TwoPalletStart','2')">启动</el-button> |
| | | <el-button @mousedown="writeDown('TwoPalletStop','2')" @mouseup="writeUp('TwoPalletStop','2')">停止</el-button> |
| | | </el-card> |
| | | <el-card class="box-card" shadow="hover" style="margin-top: 3px;"> |
| | | <el-text style="margin-right: 15px;">码跺机器人1</el-text> |
| | | <el-button @click="write('TwoMaStart','2')">启动</el-button> |
| | | <el-button @click="write('TwoMaStop','2')">停止</el-button> |
| | | <el-button @mousedown="writeDown('TwoMaStart','2')" @mouseup="writeUp('TwoMaStart','2')">启动</el-button> |
| | | <el-button @mousedown="writeDown('TwoMaStop','2')" @mouseup="writeUp('TwoMaStop','2')">停止</el-button> |
| | | </el-card> |
| | | |
| | | <el-card class="box-card" shadow="hover" style="margin-top: 3px;"> |
| | | <el-text style="margin-right: 15px;">码跺机器人2</el-text> |
| | | <el-button @click="write('TwoMaTwoStart','2')">启动</el-button> |
| | | <el-button @click="write('TwoMaTwoStop','2')">停止</el-button> |
| | | <el-button @mousedown="writeDown('TwoMaTwoStart','2')" @mouseup="writeUp('TwoMaTwoStart','2')">启动</el-button> |
| | | <el-button @mousedown="writeDown('TwoMaTwoStop','2')" @mouseup="writeUp('TwoMaTwoStop','2')">停止</el-button> |
| | | </el-card> |
| | | <el-card class="box-card" shadow="hover" style="margin-top: 3px;"> |
| | | <el-text style="margin-right: 15px;">件箱输送</el-text> |
| | | <el-button @click="write('TwoBoxStart','2')">启动</el-button> |
| | | <el-button @click="write('TwoBoxStop','2')">停止</el-button> |
| | | <el-button @mousedown="writeDown('TwoBoxStart','2')" @mouseup="writeUp('TwoBoxStart','2')">启动</el-button> |
| | | <el-button @mousedown="writeDown('TwoBoxStop','2')" @mouseup="writeUp('TwoBoxStop','2')">停止</el-button> |
| | | </el-card> |
| | | </el-collapse-item> |
| | | </el-collapse> |
| | |
| | | console.log(res.data.result); |
| | | // ElMessage.success(res.data.result); |
| | | } |
| | | |
| | | const writeDown = async (type: string,layer: string) => { |
| | | |
| | | var data={ |
| | | Type:type, |
| | | Layer: layer, |
| | | FuncName : "true" |
| | | } |
| | | var res = await WriteStartStop(data); |
| | | console.log(type+"按下事件"); |
| | | |
| | | } |
| | | const writeUp = async (type: string,layer: string) => { |
| | | |
| | | var data={ |
| | | Type:type, |
| | | Layer: layer, |
| | | FuncName : "false" |
| | | } |
| | | var res = await WriteStartStop(data); |
| | | console.log(type+"抬起事件"); |
| | | |
| | | } |
| | | |
| | | </script> |
| | | |
| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> |
| | | <el-form-item label="任务号"> |
| | | <el-input v-model="queryParams.taskNo" clearable="" placeholder="请输入任务号" /> |
| | | <el-input v-model="queryParams.taskNo" clearable="" placeholder=" " /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI"> |
| | |
| | | </template> |
| | | <el-form :model="queryParams2" ref="queryForm2" labelWidth="90"> |
| | | <el-row> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10"> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="10" :xl="8" class="mb10"> |
| | | <el-form-item label="任务号"> |
| | | <el-input v-model="queryParams2.taskNo" clearable="" placeholder="请输入任务号"style="width: 130px;" /> |
| | | <el-input v-model="queryParams2.taskNo" clearable="" placeholder="请输入任务号" style="width: 130px;" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" style="margin-left: 20px;"> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="10" :xl="8" class="mb10" style="margin-left: 20px;"> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="ele-Search" @click="handleQuery2"> 查询 |
| | | </el-button> |
| | |
| | | :deep(.el-input-number) { |
| | | width: 100%; |
| | | } |
| | | |
| | | /* :deep(.el-input__inner) |
| | | { |
| | | width: 50%; |
| | | } */ |
| | | </style> |