Exemple #1
0
        // カートンラベルの一括プリントアウト(クリック版)
        private void btnPrintCarton_Click(object sender, EventArgs e)
        {
            // セルの選択範囲が2列以上の場合は、メッセージの表示のみでプロシージャを抜ける
            if (dgvPallet.Columns.GetColumnCount(DataGridViewElementStates.Selected) >= 2)
            {
                MessageBox.Show("Please select only carton id column.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                return;
            }
            // 列名が正しい場合のみ、処理を行う
            if (dgvPallet.Columns[dgvPallet.CurrentCell.ColumnIndex].Name != "pallet_id")
            {
                MessageBox.Show("Please select only pallet id column.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                return;
            }

            // キャンセル済みトレーを選択している場合は、印刷しない
            foreach (DataGridViewCell cell in dgvPallet.SelectedCells)
            {
                if (dgvPallet["cl_user", cell.RowIndex].Value.ToString() != string.Empty)
                {
                    MessageBox.Show(cell.Value.ToString() + " has been canceled already.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                    return;
                }
            }

            // 選択セルを配列に格納、およびメッセージ用文字列を生成し、一括プリントを行う
            string[] palletlist = { };
            string   message    = string.Empty;
            int      i          = 0;

            foreach (DataGridViewCell cell in dgvPallet.SelectedCells)
            {
                if (dgvPallet["cl_user", cell.RowIndex].Value.ToString() == string.Empty)
                {
                    i += 1;
                    Array.Resize(ref palletlist, i);
                    palletlist[i - 1] = cell.Value.ToString();
                    message           = message + Environment.NewLine + cell.Value.ToString();
                }
            }
            if (message == string.Empty)
            {
                MessageBox.Show("No carton id was selected.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            TfSato tfs = new TfSato();

            for (int j = 0; j < palletlist.Length; j++)
            {
                //tfs.printStart("palletPega", palletlist[j], 0);
            }
        }
Exemple #2
0
        // サブプロシージャ:モジュールの登録、充填モード
        private void registerModuleRefillMode()
        {
            string trayCurrent = txtTrayId.Text;

            //モジュールテーブルの補充前レコードを一旦削除し、トレーテーブルの更新履歴を追加する
            bool res1 = updateTrayIdAndDeleteModule(trayCurrent, txtLoginDept.Text, txtLoginName.Text);

            if (!res1)
            {
                MessageBox.Show("An error happened in the tray id updating process.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            //モジュールテーブルへ、データテーブルのレコードを一括登録する
            TfSQL tf   = new TfSQL();
            bool  res2 = tf.sqlMultipleInsertModule(dtModule, trayCurrent);

            if (res2)
            {
                //ラベルのプリントアウト
                TfSato tfs = new TfSato();
                tfs.printStart("tray", txtTrayId.Text, dtLot, string.Empty, dtpRegisterDate.Value, string.Empty, string.Empty, 1, string.Empty);

                //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                this.RefreshEvent(this, new EventArgs());
                this.Focus();
                MessageBox.Show("Tray ID: " + trayCurrent + Environment.NewLine +
                                "and its modules were updated.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //ユーザーによるメッセージボックス確認後の処理
                formAddMode    = false;
                formRefillMode = false;
                updateDataGridViews(dtModule, ref dgvModule);

                //閉じるボタンみ有効として、閉じることを促す
                cmbBinShift.Enabled        = false;
                txtModuleId.Enabled        = false;
                btnRegisterTray.Enabled    = false;
                btnDeleteSelection.Enabled = false;
                btnChangeCapacity.Enabled  = false;
            }
        }
Exemple #3
0
        // サブプロシージャ:モジュールの登録、通常モード
        private void registerModuleNormalMode()
        {
            // 2016.08.10 FUJII  トレーIDの新規採番プロシージャ「GetNewTrayId」を、トランザクション処理バージョンへ変更
            //トレーIDの新規採番
            //string trayNew = getNewTrayId(txtLoginDept.Text, txtLoginName.Text, VBS.Mid(maxLot, 8, 1), cmbBinShift.Text);
            TfSQL  tf      = new TfSQL();
            string trayNew = tf.sqlGetNewTrayId(txtLoginDept.Text, txtLoginName.Text, VBS.Mid(maxLot, 8, 1), cmbBinShift.Text, maxLot, dtLot, ref registerDate);

            if (trayNew == string.Empty)
            {
                MessageBox.Show("An error happened in the tray id issuing process.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            //モジュールテーブルへ、データテーブルのレコードを一括登録する
            bool res = tf.sqlMultipleInsertModule(dtModule, trayNew);

            if (res)
            {
                //ラベルのプリントアウト
                TfSato tfs = new TfSato();
                tfs.printStart("tray", trayNew, dtLot, string.Empty, dtpRegisterDate.Value, string.Empty, string.Empty, 1, string.Empty);

                //登録済みの状態を表示
                txtTrayId.Text        = trayNew;
                dtpRegisterDate.Value = registerDate;

                //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                this.RefreshEvent(this, new EventArgs());
                this.Focus();
                MessageBox.Show("Tray ID: " + trayNew + Environment.NewLine +
                                "and its modules were registered.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //ユーザーによるメッセージボックス確認後の処理
                txtTrayId.Text   = String.Empty;
                txtModuleId.Text = String.Empty;
                dtModule.Clear();
                capacity = 24;
                updateDataGridViews(dtModule, ref dgvModule);
            }
        }
Exemple #4
0
        // ビューモードで再印刷を行う
        private void btnPrint_Click(object sender, EventArgs e)
        {
            TfSato tfs = new TfSato();

            tfs.printStart("tray", txtTrayId.Text, dtLot, string.Empty, dtpRegisterDate.Value, string.Empty, string.Empty, 1, string.Empty);
        }
Exemple #5
0
        // 登録ボタン押下時、各種確認、ボックスIDの発行、シリアルの登録、バーコードラベルのプリントを行う
        private void btnRegisterTray_Click(object sender, EventArgs e)
        {
            if (getOkCount(dtTray) != dtTray.Rows.Count)
            {
                MessageBox.Show("Tray is not 13.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            if (txtLoginDept.Text != "MFG")
            {
                //閲覧モードの場合は、プリントアウト
                if (!formAddMode)
                {
                    string pack = txtPackId.Text;
                    TfSato tfs  = new TfSato();

                    // ビンAか、ビンBか、ユーザーに選択させる
                    //DialogResult binResult = MessageBox.Show("Please click YES for Bin A, NO for Bin B.", "Print Option",
                    //    MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                    //string userBin = (binResult == DialogResult.Yes) ? "A" : "B";
                    string userBin = cmbBatch.Text;

                    // ペガトロン用か否か、ユーザーに選択させる
                    DialogResult result = MessageBox.Show("Do you print Pegatoron label also?", "Print Option", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                    if (result == DialogResult.Yes)
                    {
                        //tfs.printStart("packCartonInternal", pack, dtLot, cmbBatch.Text, dtpRegisterDate.Value, "Pack", "Fox", 1, userBin);
                        tfs.printStart("packCartonPega", pack, dtLot, cmbBatch.Text, dtpRegisterDate.Value, "Pack", "Pega", 1, userBin);
                    }
                    else
                    {
                        tfs.printStart("packCartonInternal", pack, dtLot, cmbBatch.Text, dtpRegisterDate.Value, "Pack", "Fox", 1, userBin);
                    }
                    return;
                }
            }

            //以下追加モードの場合の処理

            // 2016.08.22 FUJII  パックIDの新規採番プロシージャ「getNewPackId」を、トランザクション処理バージョンへ変更
            //if (cmbBatch.Text == string.Empty)
            //{
            //    MessageBox.Show("Please select Batch.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
            //    return;
            //}

            // 登録処理中は、閉じるボタンを除き、すべてのコントロールを無効にする
            cmbBatch.Enabled           = false;
            txtTrayId.Enabled          = false;
            btnRegisterPack.Enabled    = false;
            btnDeleteSelection.Enabled = false;

            //パックIDの新規採番
            string packNew = txtPackId.Text; // パック内容変更の処理も同ボタンで行うため、テキストボックスの既存IDを保持する

            if (formAddMode)
            {
                TfSQL tf0 = new TfSQL();
                packNew = tf0.sqlGetNewPackId(maxLot, cmbBatch.Text, txtLoginName.Text, dtLot, ref registerDate);
                if (packNew == string.Empty)
                {
                    MessageBox.Show("An error happened in the pack id issuing process.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                txtPackId.Text = packNew;
            }

            if (txtLoginDept.Text == "MFG")
            {
                // ビンAか、ビンBか、ユーザーに選択させる
                string pack = txtPackId.Text;
                TfSato tfs  = new TfSato();
                //DialogResult binResult = MessageBox.Show("Please click YES for Bin A, NO for Bin B.", "Print Option",
                //    MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                //string userBin = (binResult == DialogResult.Yes) ? "A" : "B";
                string userBin = cmbBatch.Text;
                tfs.printStart("packCartonInternal", pack, dtLot, cmbBatch.Text, dtpRegisterDate.Value, "Pack", "Non", 1, userBin);
                if (!formAddMode)
                {
                    return;
                }
            }

            //トレーテーブルのフィールドPACKID、その他を更新する
            TfSQL tf1 = new TfSQL();
            bool  res = tf1.sqlMultipleUpdateTrayInPack(dtTray, packNew);

            if (res)
            {
                //登録済みの状態を表示
                txtPackId.Text        = packNew;
                dtpRegisterDate.Value = registerDate;

                //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                this.RefreshEvent(this, new EventArgs());
                this.Focus();
                MessageBox.Show("Pack ID: " + packNew + Environment.NewLine +
                                "and its trays were registered.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //ユーザーによるメッセージボックス確認後の処理
                txtPackId.Text = String.Empty;
                txtTrayId.Text = String.Empty;
                dtTray.Clear();
                capacity = 13;
                updateDataGridViews(dtTray, ref dgvTray, false);
            }
        }
        // 登録ボタン押下時、各種確認、ボックスIDの発行、シリアルの登録、バーコードラベルのプリントを行う
        private void btnRegisterTray_Click(object sender, EventArgs e)
        {
            //閲覧モードの場合は、プリントアウト
            if (!formAddMode)
            {
                string pallet = txtPallet.Text;
                TfSato tfs    = new TfSato();

                // ビンAか、ビンBか、ユーザーに選択させる
                //DialogResult binResult = MessageBox.Show("Please click YES for Bin A, NO for Bin B.", "Print Option",
                //    MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                //string userBin = (binResult == DialogResult.Yes) ? "A" : "B";
                string userBin = txtBatch.Text;

                // ペガトロン用か否か、ユーザーに選択させる
                DialogResult result = MessageBox.Show("Do you print Pegatoron label also?", "Print Option", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    //tfs.printStart("packCartonInternal", pallet, dtLot, txtBatch.Text, dtpRegisterDate.Value, "Pallet", "Fox", 2, userBin);
                    tfs.printStart("packCartonPega", pallet, dtLot, txtBatch.Text, dtpRegisterDate.Value, "Pallet", "Pega", 1, userBin);
                }
                else
                {
                    tfs.printStart("packCartonInternal", pallet, dtLot, txtBatch.Text, dtpRegisterDate.Value, "Pallet", "Fox", 2, userBin);
                }
                return;
            }

            //複数のバッチが混入している場合は、警告する
            if (txtBatch.Text == "Error")
            {
                MessageBox.Show("You can not register 2 batches in a pallet.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // 登録処理中は、閉じるボタンを除き、すべてのコントロールを無効にする
            txtCarton.Enabled          = false;
            btnRegisterPallet.Enabled  = false;
            btnDeleteSelection.Enabled = false;

            // パレットIDの新規採番
            // 2016.08.22 FUJII  パレットIDの新規採番プロシージャ「getNewPalletId」を、トランザクション処理バージョンへ変更
            // string palletNew = getNewPalletId(txtBatch.Text, txtLoginName.Text);
            TfSQL  tf        = new TfSQL();
            string palletNew = tf.sqlGetNewPalletId(maxLot, txtBatch.Text, txtLoginName.Text, dtLot, ref registerDate);

            if (palletNew == string.Empty)
            {
                MessageBox.Show("An error happened in the pallet id issuing process.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            //パックテーブルのフィールドCARTONID、その他を更新する
            bool res = tf.sqlMultipleUpdateCartonOnPallet(dtCarton, palletNew);

            if (res)
            {
                //登録済みの状態を表示
                txtPallet.Text        = palletNew;
                dtpRegisterDate.Value = registerDate;

                //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                this.RefreshEvent(this, new EventArgs());
                this.Focus();
                MessageBox.Show("Pallet ID: " + palletNew + Environment.NewLine +
                                "and its cartons were registered.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //ユーザーによるメッセージボックス確認後の処理
                txtPallet.Text = String.Empty;
                txtCarton.Text = String.Empty;
                dtCarton.Clear();
                updateDataGridViews(dtCarton, ref dgvCarton, false);
            }
        }