public ItemCard(Model ReadySS, ABaseMode CallObj) : base(ReadySS, CallObj) { CurrentMode = Mode.ItemCard; OldMode = CallObj; try { Item = (CallObj as RefillLayout).Item; } catch { Item = (CallObj as ControlCollect).Item; } if (!Item.Selected) { //нет товара, значит достанем последний товар DataTable MyRemainItems = (CallObj as RefillLayout).RemainItems; Item.FoundID(MyRemainItems.Rows[0]["Item"].ToString()); } } // ItemCard (constructor)
} // RefillSet_ReactionSCItem //---------------------------------- /// <summary> /// /// </summary> /// <returns></returns> private ABaseMode Refresh() { DocAP.Refresh(); if (RobotWaiting) { CurrentAction = ActionSet.Waiting; return(Negative("1С не ответила! (флаг ожидания)")); } string TextQuery = "select top 1 " + "DocAP.$АдресПеремещение.Адрес0 as Adress0, " + "DocAP.$АдресПеремещение.Адрес1 as Adress1, " + "DocAP.$АдресПеремещение.Количество as Amount, " + "DocAP.$АдресПеремещение.Товар as Item, " + "DocAP.lineno_ as lineno_ " + "from DT$АдресПеремещение as DocAP (nolock) " + "where " + "DocAP.$АдресПеремещение.Дата1 = :EmptyDate " + "and DocAP.iddoc = :iddoc " + "and DocAP.$АдресПеремещение.Количество > 0 "; SQL1S.QuerySetParam(ref TextQuery, "iddoc", DocAP.ID); DataTable DT; SS.ExecuteWithReadNew(TextQuery, out DT); if (DT.Rows.Count == 0) { return(JumpTo(new RefillSetComplete(SS, this))); } //Всасываем все говно в наши объекты Adress0.FoundID(DT.Rows[0]["Adress0"].ToString()); Adress1.FoundID(DT.Rows[0]["Adress1"].ToString()); Amount = (int)(decimal)DT.Rows[0]["Amount"]; Item = new RefItem(SS); //Есть бага в объекте ARef, поэтому пересоздаем Item.FoundID(DT.Rows[0]["Item"].ToString()); lineno_ = (short)DT.Rows[0]["lineno_"]; CurrentAction = ActionSet.ScanAdress; return(Positive(SS.WhatUNeed(CurrentAction))); } // Refresh
/// <summary> /// /// </summary> /// <param name="key"></param> protected override void ReactionKeyDo(Keys key) { if ((Helper.IsGreenKey(key) || key == Keys.Enter) && (GoodsCC.Rows.Count > 0)) { Item = new RefItem(SS); Item.FoundID(GoodsCC.Rows[IndexTableItem]["ID"].ToString()); JumpTo(new ItemCard(SS, this)); } else if (key == Keys.Escape) { if (ControlCC == null) { SS.OnReport(new ReportEventArgs("Задача выбрана...")); JumpTo(new ChoiseWork(SS, this)); } else { GoodsCC.Clear(); ControlCC = null; LabelControlCC = null; Item = new RefItem(SS); Positive("Ожидание команды"); return; } } else if (key == Keys.Up) { if (GoodsCC.Rows.Count == 0) { IndexTableItem = 0; return; } if (IndexTableItem > 0) { IndexTableItem--; } else { IndexTableItem = GoodsCC.Rows.Count - 1; } Positive(); return; } else if (key == Keys.Down) { if (GoodsCC.Rows.Count == 0) { IndexTableItem = 0; return; } if (IndexTableItem < GoodsCC.Rows.Count - 1) { IndexTableItem++; } else { IndexTableItem = 0; } Positive(); return; } } // ReactionKeyDo