예제 #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)
            { }
        }