/// <summary> /// 创建寄存排 /// </summary> /// <param name="parentNode"></param> public void CreateRegion(TreeListNode parentNode) { Frm_Region frm_1 = new Frm_Region(); RG01 rg01 = unitOfWork1.GetObjectByKey <RG01>(parentNode.GetValue("RG001").ToString()); frm_1.swapdata["parent"] = rg01; frm_1.swapdata["bobject"] = this; frm_1.swapdata["parentNode"] = parentNode; frm_1.swapdata["session"] = unitOfWork1; if (frm_1.ShowDialog() == DialogResult.OK) { RG01 newRegion = frm_1.swapdata["newdata"] as RG01; xpCollection_rg01.Add(newRegion); TreeListNode newNode = treeList1.FindNodeByKeyID(newRegion.RG001); newNode.SelectImageIndex = 3; newNode.ImageIndex = 3; CreateRegion_mode0(newRegion, newNode); treeList1.SetFocusedNode(newNode); DrawGrid(newNode); b_update = true; } frm_1.Dispose(); }
/// <summary> /// 创建子节点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNode node = treeList1.FocusedNode; string nodeType = node.Level.ToString(); int i_image_Index = 0; if (nodeType == "3") //最末级节点,退出 { XtraMessageBox.Show("不能在末级节点创建!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (nodeType != "2") //非寄存排 { RG01 rg01 = new RG01(unitOfWork1); rg01.RG001 = MiscAction.GetEntityPK("RG01"); if (nodeType == "0") { rg01.RG002 = "1"; //寄存堂 i_image_Index = 1; } else if (nodeType == "1") { rg01.RG002 = "2"; //寄存室 i_image_Index = 2; } rg01.RG003 = this.GetSuggestName(node, rg01.RG002); rg01.RG009 = node.GetValue("RG001").ToString(); rg01.STATUS = "1"; xpCollection_rg01.Add(rg01); TreeListNode newNode = treeList1.FindNodeByKeyID(rg01.RG001); newNode.SelectImageIndex = i_image_Index; newNode.ImageIndex = i_image_Index; treeList1.SetFocusedNode(newNode); treeList1.ShowEditor(); b_update = true; } if (nodeType == "2") //创建寄存排 { this.CreateRegion(node); } }
private void sb_ok_Click(object sender, EventArgs e) { string rg003 = string.Empty; int rg010 = 0; //起始号位 //int rg011 ; //终止号位 int rg020; //层数 int rg021; //每层号位数 ///输入校验 if (String.IsNullOrEmpty(txt_rg003.Text)) { txt_rg003.Focus(); txt_rg003.ErrorText = "请输入寄存排名字!"; return; } else { rg003 = txt_rg003.Text; } if (string.IsNullOrEmpty(txt_rg020.Text)) { txt_rg020.Focus(); txt_rg020.ErrorText = "请输入层数!"; return; } else { rg020 = int.Parse(txt_rg020.Text); } if (string.IsNullOrEmpty(txt_rg021.Text)) { txt_rg021.Focus(); txt_rg021.ErrorText = "请输入每层号位数!"; return; } else { rg021 = int.Parse(txt_rg021.Text); } if (string.IsNullOrEmpty(txt_rg010.Text)) { txt_rg010.Focus(); txt_rg010.ErrorText = "请输入起始号位!"; return; } else { rg010 = int.Parse(txt_rg010.Text); } ////////////////// 校验结束 /////////////////////////// RG01 rg01 = new RG01(unitOfWork); rg01.RG001 = MiscAction.GetEntityPK("RG01"); rg01.RG002 = "3"; rg01.RG003 = rg003; rg01.RG010 = rg010; rg01.RG020 = rg020; rg01.RG021 = rg021; rg01.RG030 = combo_rg030.SelectedIndex.ToString(); rg01.RG033 = combo_rg033.SelectedIndex.ToString(); rg01.RG009 = parentNode.GetValue("RG001").ToString(); rg01.STATUS = "1"; this.swapdata["newdata"] = rg01; DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// 制造新排-传统方式 /// </summary> /// <param name="newrow"></param> /// <param name="newNode"></param> private void CreateRegion_mode0(RG01 newRegion, TreeListNode newNode) { ///创建层 LY01 ly01 = null; BI01 bi01 = null; int startbit = int.Parse(newRegion.RG010.ToString()); int layerIndex; int colIndex; string rg030 = newRegion.RG030.ToString(); //起始位置 bool flag = true; if (rg030 == "0" || rg030 == "2") //左上或右上 { layerIndex = int.Parse(newRegion.RG020.ToString()); } else { layerIndex = 1; } for (int i = 1; i <= int.Parse(newRegion.RG020.ToString()); i++) //rg020层数 { ly01 = new LY01(unitOfWork1); ly01.LY001 = MiscAction.GetEntityPK("LY01"); ly01.RG001 = newRegion.RG001; ly01.LY002 = i; xpCollection_ly01.Add(ly01); if ((rg030 == "0" || rg030 == "1") && flag) //左上或左下 { colIndex = 1; } else if ((rg030 == "2" || rg030 == "3") && !flag) { colIndex = 1; } else { colIndex = int.Parse(newRegion.RG021.ToString()); } ///创建号位 for (int j = 1; j <= int.Parse(newRegion.RG021.ToString()); j++) //rg021每层号位数 { bi01 = new BI01(unitOfWork1); bi01.BI001 = MiscAction.GetEntityPK("BI01"); bi01.RG001 = newRegion.RG001; bi01.BI020 = newNode.ParentNode.GetValue("RG001").ToString(); //寄存室编号 bi01.BI030 = newNode.ParentNode.ParentNode.GetValue("RG001").ToString(); //寄存楼编号 bi01.BI002 = startbit + j - 1; //号位数字编号 //bi01.BI003 = (startbit + j - 1).ToString().PadLeft(4, '0'); //号位文字描述 bi01.BI003 = (startbit + j - 1).ToString(); //号位文字描述 bi01.BI005 = layerIndex; //层号 bi01.BI008 = colIndex; //列数. bi01.BI009 = 0; //价格 bi01.BI007 = "0"; //价格锁 bi01.STATUS = "9"; //状态-空闲 xpCollection_bi01.Add(bi01); //RG033 排列顺序 0-顺序 1-蛇形 if (newRegion.RG033 == "0") { if (rg030 == "0" || rg030 == "1") //左上或左下 { if (colIndex >= newRegion.RG021) { colIndex = 1; } else { colIndex++; } } else { if (colIndex <= 1) { colIndex = 1; } else { colIndex--; } } } else { if ((rg030 == "0" || rg030 == "1") && flag) //左上或左下 { if (colIndex >= newRegion.RG021) { colIndex = newRegion.RG021; } else { colIndex++; } } else if ((rg030 == "0" || rg030 == "1") && !flag) { if (colIndex <= 1) { colIndex = 1; } else { colIndex--; } } else if ((rg030 == "2" || rg030 == "3") && flag) { if (colIndex <= 1) { colIndex = 1; } else { colIndex--; } } else if ((rg030 == "2" || rg030 == "3") && !flag) { if (colIndex >= newRegion.RG021) { colIndex = newRegion.RG021; } else { colIndex++; } } } } //startbit += newRegion.RG021; startbit = int.Parse(newRegion.RG010.ToString()); if (newRegion.RG033 == "1") { flag = !flag; } if (rg030 == "0" || rg030 == "2") //左上或右上 { layerIndex--; } else { layerIndex++; } } }