Exemplo n.º 1
0
        /// <summary>
        /// Add PCB into Box
        /// </summary>
        /// <param name="boxid"></param>
        private void AddPcbToBox(string boxid)
        {
            gridControlData.DataSource = null;
            string addPcb = txtAddPCB.Text.Trim();
            if (!string.IsNullOrEmpty(addPcb))
            {
                if (_iqcService.CheckPcbExitsOnBoxOrShipCurrent(addPcb, _shippings))
                {
                    var ship = _iqcService.GetShippingById(addPcb);
                    if (ship == null)
                    {
                        var shipping = new Shipping()
                        {
                            ID = Guid.NewGuid(),
                            Operator = txtOperatorCode.Text,
                            Model = _currentModel.ModelID,
                            WorkingOder = txtWorkingOrder.Text,
                            Quantity = 1,
                            BoxID = boxid,
                            ProductID = addPcb,
                            PO_NO = txtPO.Text,
                            MacAddress = txtAddPCB.Text,
                            DateCheck = DateTime.Now,
                        };
                        _shippings.Add(shipping);

                        gridControlData.DataSource = _shippings;
                        lblCountPCB.Text = _shippings.Count.ToString(CultureInfo.InvariantCulture);
                        lblRemains.Text = (int.Parse(lblRemains.Text) - 1).ToString(CultureInfo.InvariantCulture);

                        if (_shippings.Count == _currentModel.Quantity)
                        {
                            gridControlData.DataSource = _shippings;
                            InsertOrUpdatePo(_currentModel.ModelID, _currentModel.ModelName, txtPO.Text);
                            splashScreenManager2.ShowWaitForm();
                            foreach (var log in _shippings)
                            {
                                _iqcService.InsertShipping(txtOperatorCode.Text, _currentModel.ModelID, txtWorkingOrder.Text, 1, txtPO.Text, txtBoxID.Text, log.ProductID, log.MacAddress);
                            }
                            _iqcService.UpdateRemainsForPo(_currentPo.PO_NO, _currentPo.ModelID, int.Parse(lblRemains.Text));
                            splashScreenManager2.CloseWaitForm();

                            EnableTextControls(true);
                            VisibleControlAddPcb(false);
                            txtBoxID.ResetText();
                            txtBoxID.Focus();
                            lblCountPCB.Text = @"0";
                            gridControlData.DataSource = null;
                            _shippings = new List<Shipping>();
                        }
                    }
                    else
                    {
                        gridControlData.Refresh();
                        gridControlData.DataSource = _shippings;
                        MessageBoxHelper.ShowMessageBoxError($"PCB {txtAddPCB.Text} đã được xuất trước đó.\n" +
                                                             $"Box: {ship.BoxID}\n" +
                                                             $"Ngày xuất: {ship.DateCheck}");
                        txtAddPCB.SelectAll();
                    }
                }
                else
                {
                    gridControlData.Refresh();
                    gridControlData.DataSource = _shippings;
                    MessageBoxHelper.ShowMessageBoxError($"PCB {txtAddPCB.Text} đã được nhập trong Box rồi. Vui lòng kiểm tra lại!");
                    txtAddPCB.SelectAll();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get all PCB in Box
        /// </summary>
        private void GetAll(string boxId)
        {
            if (!_iqcService.CheckBoxExits(boxId))
            {
                splashScreenManager1.ShowWaitForm();
                var logs = _oqcService.GetLogsByBoxId(boxId).ToList();
                if (logs.Any())
                { 
                    foreach (var log in logs)
                    {
                        var shipping = new Shipping()
                        {
                            Operator = txtOperatorCode.Text,
                            Model = _currentModel.ModelID,
                            WorkingOder = txtWorkingOrder.Text,
                            Quantity = 1,
                            BoxID = txtBoxID.Text,
                            ProductID = log.ProductionID,
                            PO_NO = txtPO.Text,
                            MacAddress = log.MacAddress,
                            DateCheck = DateTime.Now.Date
                        };

                        if (CheckModels(shipping.ProductID))
                        {
                            _shippings.Add(shipping);
                        }
                        else
                        {
                            _pcbError.Add(shipping);
                        }
                    }
                    if (_pcbError.Any())
                    {
                        gridControlData.DataSource = _shippings;
                        splashScreenManager1.CloseWaitForm();
                        MessageBoxHelper.ShowMessageBoxError($"Box [{boxId}] có {logs.Count} PCB\n" +
                                                             $"Có {_pcbError.Count} PCB không dành cho Model [{txtModel.Text}].\n" +
                                                             "Vui lòng kiểm tra lại!");
                        //EnableTextControls(false);
                        //VisibleControlAddPcb(true);
                        txtBoxID.SelectAll();
                        txtBoxID.Focus();
                    }
                    else
                    {
                        GetQtyPoAndRemainsByWorkingOderAndPoNo(_currentModel.ModelID, txtPO.EditValue.ToString());
                        lblCountPCB.Text = _shippings.Count.ToString(CultureInfo.InvariantCulture);
                        lblRemains.Text = (_currentPo.QuantityRemain - _shippings.Count).ToString(CultureInfo.InvariantCulture);
                        Thread.Sleep(200);
                        // Nếu số lượng đủ thì thực hiện lưu vào csdl
                        if (_shippings.Count == _currentModel.Quantity)
                        {
                            gridControlData.DataSource = _shippings;
                            splashScreenManager1.CloseWaitForm();
                            splashScreenManager2.ShowWaitForm();
                            foreach (var log in _shippings)
                            {
                                _iqcService.InsertShipping(txtOperatorCode.Text, _currentModel.ModelID, txtWorkingOrder.Text, 1, txtPO.Text, txtBoxID.Text, log.ProductID, log.MacAddress);
                            }
                            _iqcService.UpdateRemainsForPo(_currentPo.PO_NO, _currentPo.ModelID, int.Parse(lblRemains.Text));
                            splashScreenManager2.CloseWaitForm();
                            InsertOrUpdatePo(_currentModel.ModelID, _currentModel.ModelName, txtPO.Text);
                            gridControlData.DataSource = null;
                            _shippings = new List<Shipping>();
                            txtBoxID.Focus();
                            txtBoxID.Text = string.Empty;
                            lblCountPCB.Text = @"0";
                        }
                        else
                        {
                            if (_shippings.Count > _currentModel.Quantity)
                            {
                                int count = _shippings.Count - _currentModel.Quantity;
                                gridControlData.Refresh();
                                gridControlData.DataSource = _shippings;
                                splashScreenManager1.CloseWaitForm();
                                MessageBoxHelper.ShowMessageBoxError($"Vui lòng kiểm tra lại Box [{boxId}]\n." +
                                                                     $"Số lượng lớn hơn quy định {count} PCB!");
                                txtBoxID.SelectAll();

                            }
                            else
                            {
                                gridControlData.Refresh();
                                gridControlData.DataSource = _shippings;
                                splashScreenManager1.CloseWaitForm();
                                MessageBoxHelper.ShowMessageBoxWaring($"Số lượng trong Box [{boxId}] chưa đủ. Vui lòng nhập thêm!");
                                VisibleControlAddPcb(true);
                                EnableTextControls(false);
                            }
                        } 
                    }

                }
                else
                {
                    splashScreenManager1.CloseWaitForm();
                    if (XtraMessageBox.Show("Vui lòng bắn từng PCB vào Box [" + boxId + "]!", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        EnableTextControls(false);
                        VisibleControlAddPcb(true);
                        txtAddPCB.Focus();
                    }
                    else
                    {
                        DialogResult = DialogResult.No;
                        txtBoxID.SelectAll();
                    }
                }
            }
            else
            {
                Ultils.EditTextErrorMessage(txtBoxID, $"Box [{boxId}] đã được nhập trước đó. Vui lòng kiểm tra lại!");
                txtBoxID.Text = string.Empty;
            }
            
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add PCB into Box
        /// </summary>
        /// <param name="boxid"></param>
        private void AddPcbToBox(string boxid)
        {
            splashScreenLoadData.ShowWaitForm();
            gridControlData.DataSource = null;
            if (!string.IsNullOrEmpty(txtAddPCB.Text))
            {
                if (_iqcService.CheckPcbExitsOnBoxOrShipCurrent(txtAddPCB.Text, _shippings))
                {
                    var shippings = _iqcService.GetShippingById(txtAddPCB.Text.Trim());
                    if (shippings == null)
                    {
                        var shipping = new Shipping()
                        {
                            ID = Guid.NewGuid(),
                            Operator = txtOperatorCode.Text,
                            Model = gridLookUpEditModelID.EditValue.ToString(),
                            WorkingOder = txtWorkingOrder.Text,
                            Quantity = 1,
                            BoxID = boxid,
                            ProductID = txtAddPCB.Text,
                            MacAddress = txtAddPCB.Text,
                            DateCheck = DateTime.Now,
                        };

                        if (_currentPo.QuantityRemain <= 0)
                        {
                            MessageBox.Show(@"Không thể nhập thêm cho PO này. Remain = 0\nVui lòng lưu lại dữ liệu!", @"Error Remains!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            ResetControls();

                        }
                        else
                        {
                            _shippings.Add(shipping);
                            gridControlData.DataSource = _shippings;
                            lblCountPCB.Text = _shippings.Count.ToString(CultureInfo.InvariantCulture);
                            lblRemains.Text = (int.Parse(lblRemains.Text) - 1).ToString(CultureInfo.InvariantCulture);
                            EnabledButonSave(true);
                            splashScreenLoadData.CloseWaitForm();
                            txtAddPCB.Text = string.Empty;
                        }
                    }
                    else
                    {
                        gridControlData.Refresh();
                        gridControlData.DataSource = _shippings;
                        splashScreenLoadData.CloseWaitForm();
                        MessageBoxHelper.ShowMessageBoxError($"PCB {txtAddPCB.Text} đã được xuất trước đó.\n" +
                                                             $"Box: {shippings.BoxID}\nN" +
                                                             $"Ngày xuất: {shippings.DateCheck}");
                        txtAddPCB.SelectAll();
                    }
                }
                else
                {
                    gridControlData.Refresh();
                    gridControlData.DataSource = _shippings;
                    splashScreenLoadData.CloseWaitForm();
                    MessageBoxHelper.ShowMessageBoxError($"PCB {txtAddPCB.Text} đã được nhập trong Box rồi. Vui lòng kiểm tra lại!");
                    txtAddPCB.SelectAll();
                }
            }
        }