Пример #1
0
 private void InitModel()
 {
     try
     {
         ShelfInfo shelfInfo = new ShelfInfo("line_1_1");
         shelfInfo.Model       = line_1_1;
         shelfInfo.ShelfOffSet = new Point3D(0, 0, 0);
         shelf_Info.Add(shelfInfo.ModelName, shelfInfo);
         for (int i = 1; i <= modelPosition.ShelfColumnNum; i++)   //column
         {
             for (int j = 1; j <= modelPosition.ShelfLineNum; j++) //line
             {
                 if (i == 1 && j == 1)
                 {
                     continue;
                 }
                 ModelVisual3D cloneModelShelf = new ModelVisual3D();
                 cloneModelShelf.Content = line_1_1.Content.Clone();
                 RootGeometryContainer.Children.Add(cloneModelShelf);
                 shelfInfo             = new ShelfInfo("line_" + j + "_" + i);
                 shelfInfo.Model       = cloneModelShelf;
                 shelfInfo.ShelfOffSet = new Point3D(modelPosition.ShelfDistance_Column * (i - 1), modelPosition.ShelfDistance_Line[j], 0);
                 shelf_Info.Add(shelfInfo.ModelName, shelfInfo);
             }
         }
     }
     catch (Exception ex)
     {
         HintEvent(string.Format("WareHouseModel_InitModel has exception:" + ex.ToString()));
     }
 }
Пример #2
0
 public static ShelfInfoDto MapToDto(ShelfInfo ShelfInfo)
 {
     return(new ShelfInfoDto
     {
         Name = ShelfInfo.Name,
         Description = ShelfInfo.Description
     });
 }
Пример #3
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                if (bsMain.Filter.Trim().Length != 0)
                {
                    DialogResult result = MessageBox.Show("重新读入数据请选择'是(Y)',清除过滤条件请选择'否(N)'", "询问", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    switch (result)
                    {
                    case DialogResult.No:
                        DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn.RemoveFilter(dgvMain);
                        return;

                    case DialogResult.Cancel:
                        return;
                    }
                }

                btnRefresh.Enabled = false;
                btnChart.Enabled   = false;

                pnlProgress.Top     = (pnlMain.Height - pnlProgress.Height) / 3;
                pnlProgress.Left    = (pnlMain.Width - pnlProgress.Width) / 2;
                pnlProgress.Visible = true;
                Application.DoEvents();
                url = configUtil.GetConfig("URL")["URL"];
                Task task = new Task(url);
                try
                {
                    task.Getshelf();
                    task.GetShelf += new Task.GetShelfEventHandler(delegate(bool isSuccess, string msg, ShelfInfo[] shelfInfo)
                    {
                        if (shelfInfo != null)
                        {
                            //bsMain.DataSource = shelfInfo;
                            cellTable = new DataTable();
                            cellTable.Columns.Add("ShelfCode");
                            cellTable.Columns.Add("ShelfName");
                            cellTable.Columns.Add("CellCode");
                            cellTable.Columns.Add("CellName");
                            cellTable.Columns.Add("ProductCode");
                            cellTable.Columns.Add("ProductName");
                            cellTable.Columns.Add("QuantityTiao", typeof(decimal));
                            cellTable.Columns.Add("QuantityJian", typeof(decimal));
                            cellTable.Columns.Add("WareCode");
                            cellTable.Columns.Add("WareName");
                            cellTable.Columns.Add("IsActive");
                            cellTable.Columns.Add("RowNum");
                            cellTable.Columns.Add("ColNum");
                            cellTable.Columns.Add("Shelf");
                            foreach (ShelfInfo shelf in shelfInfo)
                            {
                                this.ShelfInfo     = shelf;
                                DataRow dr         = cellTable.NewRow();
                                dr["ShelfCode"]    = shelf.ShelfCode;
                                dr["ShelfName"]    = shelf.ShelfName;
                                dr["CellCode"]     = shelf.CellCode;
                                dr["CellName"]     = shelf.CellName;
                                dr["ProductCode"]  = shelf.ProductCode;
                                dr["ProductName"]  = shelf.ProductName;
                                dr["QuantityTiao"] = shelf.QuantityTiao;
                                dr["QuantityJian"] = shelf.QuantityJian;
                                dr["WareCode"]     = shelf.WareCode;
                                dr["WareName"]     = shelf.WareName;
                                dr["IsActive"]     = shelf.IsActive;
                                dr["RowNum"]       = shelf.RowNum;
                                dr["ColNum"]       = shelf.ColNum;
                                dr["Shelf"]        = shelf.Shelf;
                                cellTable.Rows.Add(dr);
                            }
                            if (cellTable.Rows.Count > 0)
                            {
                                btnChart.Enabled    = true;
                                pnlProgress.Visible = false;
                                btnRefresh.Enabled  = true;
                            }
                            bsMain.DataSource = cellTable;
                        }
                        else
                        {
                            bsMain.DataSource = null;
                        }
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show("读取数据失败,原因:" + ex.Message, "消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception exp)
            {
                THOKUtil.ShowInfo("读入数据失败,原因:" + exp.Message);
            }
        }
Пример #4
0
        public void UpdateShelfInfo(ShelfInfoDto shelfInfoDto)
        {
            ShelfInfo = new ShelfInfo(shelfInfoDto);

            ModifiedDateTime = CreatedDateTime;
        }