Beispiel #1
0
        private void btnAddOrder_Click(object sender, EventArgs e)
        {
            try
            {
                var currentSchedule = DS_Schedule.Current as Schedule;
                var currentDevice   = DS_BDevice.Current as BeamCutDevice;
                var currentLine     = DS_Line.Current as ProductionLine;

                if (MessageBox.Show($"Do you really want to add PO: {currentSchedule.PoNumber} to device: {currentDevice.Name}",
                                    "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return;
                }

                BDeviceOrder BDeviceOrder = new BDeviceOrder
                {
                    AddPeople_Id      = CurrentUser.id,
                    BeamCutDevice_Id  = currentDevice.id,
                    PoNumber          = currentSchedule.PoNumber,
                    PoQty             = currentSchedule.Quantity,
                    ProductionLine_Id = currentLine.id,
                    Schedule_Id       = currentSchedule.id,
                    OrderDate         = DateTime.Now,
                };

                var orders = BeamCutQuery.AddNewOrder(BDeviceOrder);
                if (orders != null)
                {
                    MachineProgressViewer.UpdateOrderViewer(orders);
                }
            }
            catch (Exception ex)
            { }
        }
Beispiel #2
0
        private void lbBDevice_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                cbxOrderDate.Items.Clear();

                var device = DS_BDevice.Current as BeamCutDevice;

                if (device != null)
                {
                    device = BeamCutQuery.GetDeviceOrders(device.id);
                    var orderGroup = device.BDeviceOrders.GroupBy(i => i.Date);
                    foreach (var item in orderGroup)
                    {
                        cbxOrderDate.Items.Add(item.Key);
                    }
                }

                MachineProgressViewer = new MachineProgressViewer(device);
                if (!OrderLoader.IsDisposed)
                {
                    OrderLoader.Controls.Clear();
                }
                OrderLoader.Controls.Add(MachineProgressViewer);
                MachineProgressViewer.Dock = DockStyle.Fill;

                var orders = BeamCutQuery.GetBDeviceOrders(device.id, cbxOrderDate.Text);

                if (orders != null)
                {
                    MachineProgressViewer.UpdateOrderViewer(orders);
                }
            }
            catch (Exception ex)
            { }
        }