/// <summary> /// 取消任务 /// </summary> /// <param name="index"></param> /// <param name="result"></param> /// <returns></returns> public bool DoCancelIndex(int index, out string result) { if (index == 0 || index == 0) { result = "任务ID,车ID不能为零"; return(false); } NDCItem item = Items.Find(c => { return(c._mTask.NDCINDEX == index); }); if (item == null) { item = TempItems.Find(c => { return(c._mTask.NDCINDEX == index); }); } if (item == null) { result = "找不到任务Index:" + index + "任务."; return(false); } item.CancleFromSystem = true; DoDeleteOrder(index + ""); result = "取消成功"; return(true); }
/// <summary> /// 更新B消息 /// </summary> /// <param name="message"></param> internal override void UpdateItem(Message_b message) { try { NDCItem ndcItem = Items.Find(c => { return c._mTask.NDCINDEX == message.Index; }); if (ndcItem == null) { ndcItem = TempItems.Find(c => { return c._mTask.NDCINDEX == message.Index; }); if (ndcItem != null) { ndcItem._mTask.IKEY = message.IKEY; }else { ndcItem = new NDCItem(); ndcItem._mTask.IKEY = message.IKEY; ndcItem._mTask.NDCINDEX = message.Index; TempItems.Add(ndcItem); } } ndcItem.SetBMessage(message); if (ndcItem.TaskInfo != "") { //Console.WriteLine(ndcItem.TaskInfo); log.LOG(ndcItem.TaskInfo); } CheckStatus(ndcItem, message); _NoticeUpdate(ndcItem); } catch (Exception e) { //Console.WriteLine(e.Message); log.LOG(e.Message); } }
/// <summary> /// 绑定临时任务和最终任务信息 /// </summary> /// <param name="item"></param> private void MatchTempInfo(NDCItem item) { try { if (item._mTask.TASKID == 0 && item._mTask.NDCINDEX != -1) { NDCItem tempItem = TempItems.Find(c => { return(c._mTask.IKEY == item._mTask.IKEY && c._mTask.NDCLOADSITE == item._mTask.NDCLOADSITE && c._mTask.NDCUNLOADSITE == item._mTask.NDCUNLOADSITE); }); if (tempItem != null) { NDCItem i = Items.Find(c => c._mTask.IKEY == tempItem._mTask.IKEY); if (i != null) { i._mTask.NDCINDEX = tempItem._mTask.NDCINDEX; i.CARRIERID = tempItem.CARRIERID; i.DirectStatus = tempItem.DirectStatus; i.Magic = tempItem.Magic; i.Status = tempItem.Status; TempItems.Remove(tempItem); item = i; } } } if (item._mTask.TASKID != 0 && item._mTask.NDCINDEX != 0) { try { if (item.PLCStatus != NDCPlcStatus.Unloaded && item._mTask.PAUSE && item.Magic == 11) { //不做操作,挂起的任务异常结束就不通知WCS了 } else { _NoticeWcsMagic(item._mTask.TASKID, item.CARRIERID + "", item.Magic); } _sqlControl.UpdateNdcItem(item); return; } catch (Exception e) { Console.WriteLine(e.Message); } } _sqlControl.UpdateNdcItem(item); } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// 重新读取装货点,卸货点对应NDC实际使用信息 /// </summary> public void DoReadSQL() { try { _sqlControl.ReadWcsNdcSite(out loadStaDic, out unLoadStaDic); _sqlControl.ReadNDCServerAndIKEY(out IPaddress, out Port, out Ikey); if (_sqlControl.ReadUnFinishTask(out List <WCS_NDC_TASK> list)) { foreach (var i in list) { NDCItem item = Items.Find(c => { return(c._mTask.TASKID == i.TASKID && c._mTask.IKEY == i.IKEY); }); if (item == null) { item = new NDCItem() { _mTask = i }; Items.Add(item); _NoticeUpdate(item); } } } if (_sqlControl.ReadTempTask(out List <WCS_NDC_TASK_TEMP> tlist)) { foreach (WCS_NDC_TASK_TEMP t in tlist) { NDCItem item = TempItems.Find(c => { return(c._mTask.IKEY == t.IKEY && c._mTask.NDCINDEX == t.NDCINDEX); }); if (item != null) { item.CARRIERID = t.CARRIERID; } else { item = new NDCItem(); item.CARRIERID = t.CARRIERID; item._mTask.NDCINDEX = t.NDCINDEX; item._mTask.IKEY = t.IKEY; TempItems.Add(item); } } } } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// 更新S消息 /// </summary> /// <param name="message"></param> internal override void UpdateItem(Message_s message) { try { //找出被挂起的任务的重定向站点,重新重定向任务 if (message.Magic == 32) //32 Carwash sends this request { //TODO Carwash 重定向 DoCarWashReDirect(message); return; } NDCItem ndcItem = Items.Find(c => { return(c._mTask.NDCINDEX == message.Index); }); if (ndcItem == null) { ndcItem = TempItems.Find(c => { return(c._mTask.NDCINDEX == message.Index); }); if (ndcItem != null) { ndcItem.CARRIERID = message.CarrierNumber; } else { ndcItem = new NDCItem(); ndcItem.CARRIERID = message.CarrierNumber; ndcItem._mTask.NDCINDEX = message.Index; TempItems.Add(ndcItem); } } ndcItem.SetSMessage(message); if (ndcItem.StatusInfo != "") { Console.WriteLine(ndcItem.StatusInfo); log.LOG(ndcItem.StatusInfo); } CheckMagic(ndcItem, message); _NoticeUpdate(ndcItem); } catch (Exception e) { Console.WriteLine(e.Message); log.LOG(e.Message); } }
/// <summary> /// Gets a reference to the specified item in the player's temporary inventory. This can be used to access other information about the item. /// </summary> /// <param name="name">The name of the item.</param> /// <returns>A reference to the specified temporary item.</returns> public ItemBase GetTempItemByName(string name) => TempItems.Find(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));