FrmPosResult.cs 3.9 KB
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OnlineStore.XLRStore
{
    public partial class FrmPosResult : Form
    {
        public FrmPosResult()
        {
            boxEquip = StoreManager.XLRStore.boxEquip;
            DrawerResults = PosDebugResultManager.DrawerResults;
            InitializeComponent();
            LoadDrawerList();
        }
        List<DrawerResult> DrawerResults;
        BoxEquip boxEquip;
        protected Dictionary<string, UCStatusPanel> DrawerControlList = new Dictionary<string, UCStatusPanel>();
        private void LoadDrawerList()
        {
            this.tlpDrawerA.RowStyles.Clear();
            this.tlpDrawerA.ColumnStyles.Clear();
            this.tlpDrawerA.RowCount = boxEquip.Config.Drawer_Rows;
            this.tlpDrawerA.ColumnCount = boxEquip.Config.Drawer_Columns;
            string cid = boxEquip.Config.CID;
            for (int rowindex = 0; rowindex < boxEquip.Config.Drawer_Rows; rowindex++)
            {
                tlpDrawerA.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
                for (int colindex = 0; colindex < boxEquip.Config.Drawer_Columns; colindex++)
                {
                    tlpDrawerA.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
                    UCStatusPanel control = new UCStatusPanel();
                    control.ControlName = $"{cid}AA{(rowindex+1).ToString("00")}{(colindex+1).ToString("00")}";
                    control.Click += Control_Click;
                    this.tlpDrawerA.Controls.Add(control, colindex, rowindex);
                    DrawerControlList.Add(control.ControlName, control);
                }
            }

            this.tlpDrawerB.RowStyles.Clear();
            this.tlpDrawerB.ColumnStyles.Clear();
            this.tlpDrawerB.RowCount = boxEquip.Config.Drawer_Rows;
            this.tlpDrawerB.ColumnCount = boxEquip.Config.Drawer_Columns;
            for (int rowindex = 0; rowindex < boxEquip.Config.Drawer_Rows; rowindex++)
            {
                tlpDrawerB.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
                for (int colindex = 0; colindex < boxEquip.Config.Drawer_Columns; colindex++)
                {
                    tlpDrawerB.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
                    UCStatusPanel control = new UCStatusPanel();
                    control.ControlName = $"{cid}BB{(rowindex+1).ToString("00")}{(colindex+1).ToString("00")}";
                    control.Click += Control_Click;
                    this.tlpDrawerB.Controls.Add(control, colindex, rowindex);
                    DrawerControlList.Add(control.ControlName, control);
                }
            }

            this.tlpPos.RowStyles.Clear();
            this.tlpPos.ColumnStyles.Clear();
            this.tlpPos.AutoScroll = true;
            this.tlpPos.RowCount = boxEquip.Config.Cols_In_Drawer;
            this.tlpPos.ColumnCount = boxEquip.Config.Rows_In_Drawer;
            for (int rowindex = 0; rowindex < boxEquip.Config.Cols_In_Drawer; rowindex++)
            {
                tlpPos.RowStyles.Add(new RowStyle(SizeType.Absolute, 38));
                for (int colindex = 0; colindex < boxEquip.Config.Rows_In_Drawer; colindex++)
                {
                    tlpPos.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 87));
                    UCStatusPanel control = new UCStatusPanel();
                    control.ControlName = $"{(colindex+1).ToString("00")}{(rowindex+1).ToString("00")}";
                    this.tlpPos.Controls.Add(control, colindex, rowindex);
                }
            }
            this.SuspendLayout();
        }

        private void Control_Click(object sender, EventArgs e)
        {
            throw new NotImplementedException();
        }
    }
}