Exemplo n.º 1
0
        /// <summary>
        /// 輸入機台/序號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbEquipOrCompLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                //清除資料
                _QCTable.Rows.Clear();

                string equipmentName = "";

                //檢查是否有輸入機台/序號
                ttbEquipOrCompLot.Must(lblEquipOrCompLot);

                #region 檢查輸入的內容在MES_QC_INSP_OBJ.ITEM1是否有符合的資料,如果沒有,則檢查機台
                var QCDataObjList = QCInspectionObjectInfoEx.GetDataListByComponentLot(ttbEquipOrCompLot.Text);

                if (QCDataObjList.Count == 0)
                {
                    var QCDataList = QCInspectionInfoEx.GetDataListByEquip(ttbEquipOrCompLot.Text, _QCType);

                    if (QCDataList.Count == 0)
                    {
                        //找不到檢驗資料!!
                        throw new Exception(RuleMessage.Error.C00038());
                    }
                    else
                    {
                        //取得檢驗機台名稱
                        equipmentName = QCDataList[0].EquipmentName;
                    }
                }
                else
                {
                    //取得檢驗機台名稱
                    equipmentName = InfoCenter.GetBySID <QCInspectionInfo>(QCDataObjList[0].QC_INSP_SID).EquipmentName;
                }
                #endregion

                #region 檢查機台是否存在
                _EquipData = EquipmentInfo.GetEquipmentByName(equipmentName);

                if (_EquipData == null)
                {
                    //請輸入正確的機台/序號!
                    throw new Exception(RuleMessage.Error.C10066());
                }
                #endregion

                #region 檢查機台狀態是否為WaitReceiveFAI/WaitReceivePPK
                string currentState = "WaitReceive" + _QCType;

                //如果傳入參數是FAI,則必須檢查機台狀態
                if (_QCType == CustomizeFunction.QCType.FAI.ToCimesString())
                {
                    if (_EquipData.CurrentState != currentState)
                    {
                        //[00902]機台狀態不是{0},不可使用{1}規則!
                        throw new Exception(TextMessage.Error.T00902(currentState, _ProgramInformationBlock.ProgramRight));
                    }
                }
                #endregion

                #region 顯示檢驗清單
                //取得檢驗主檔
                var qcInspectionDataList = QCInspectionInfoEx.GetDataListByEquip(equipmentName, _QCType);

                if (qcInspectionDataList.Count == 0)
                {
                    //機台:{0},查無任何檢驗資料。
                    throw new Exception(RuleMessage.Error.C10053(equipmentName));
                }

                qcInspectionDataList.ForEach(qcData =>
                {
                    //只有狀態為WaitReceivePPK/WaitReceiveFAI/WaitReceivePQC才可以加入清單
                    if (qcData.Status == currentState)
                    {
                        //取得檢驗明細
                        var QCInspectionObjList = QCInspectionObjectInfo.GetInspectionObjects(qcData);

                        QCInspectionObjList.ForEach(qcObjData =>
                        {
                            var row          = _QCTable.NewRow();
                            row["Equipment"] = qcData.EquipmentName;
                            row["Device"]    = qcData.DeviceName;
                            row["SN"]        = qcObjData.ItemName1;
                            row["Status"]    = qcData.PassFlag == "Y" ? "PASS" : GetUIResource("WaitQC");
                            row["QCINSPSID"] = qcData.ID;

                            _QCTable.Rows.Add(row);
                        });
                    }
                });

                if (_QCTable.Rows.Count == 0)
                {
                    //機台:{0},查無任何檢驗資料。
                    throw new Exception(RuleMessage.Error.C10053(equipmentName));
                }

                gvQC.SetDataSource(_QCTable, true);

                #endregion

                btnOK.Enabled     = true;
                btnReject.Enabled = true;
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbEquipOrCompLot);
                HandleError(ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 輸入機台/序號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbEquipOrCompLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                //清除資料
                _QCTable.Rows.Clear();

                string currentState = "Wait" + _QCType;

                string equipmentName = "";

                //檢查是否有輸入機台/序號
                ttbEquipOrCompLot.Must(lblEquipOrCompLot);

                #region 檢查輸入的內容在MES_QC_INSP_OBJ.ITEM1是否有符合的資料,如果沒有,則檢查機台
                var QCDataObjList = QCInspectionObjectInfoEx.GetDataListByComponentLot(ttbEquipOrCompLot.Text);

                if (QCDataObjList.Count == 0)
                {
                    var QCInspectionDataList = QCInspectionInfoEx.GetDataListByEquip(ttbEquipOrCompLot.Text, _QCType);

                    if (QCInspectionDataList.Count == 0)
                    {
                        //找不到檢驗資料!!
                        throw new Exception(RuleMessage.Error.C00038());
                    }
                    else
                    {
                        //取得檢驗機台名稱
                        equipmentName = QCInspectionDataList[0].EquipmentName;
                    }

                    #region 取得檢驗清單
                    //string currentState = "WaitPPK";

                    QCInspectionDataList.ForEach(qcData =>
                    {
                        //只有狀態為WaitPPK才可以加入清單
                        if (qcData.Status == currentState)
                        {
                            //取得檢驗明細
                            var QCInspectionObjList = QCInspectionObjectInfo.GetInspectionObjects(qcData);

                            QCInspectionObjList.ForEach(qcObjData =>
                            {
                                var row          = _QCTable.NewRow();
                                row["Equipment"] = qcData.EquipmentName;
                                row["Device"]    = qcData.DeviceName;
                                row["SN"]        = qcObjData.ItemName1;
                                row["Status"]    = qcData.PassFlag == "Y" ? "PASS" : GetUIResource("WaitQC");
                                row["QCINSPSID"] = qcData.ID;

                                _QCTable.Rows.Add(row);
                            });
                        }
                    });
                    #endregion
                }
                else
                {
                    //取得檢驗主檔
                    var QCInspectionData = InfoCenter.GetBySID <QCInspectionInfo>(QCDataObjList[0].QC_INSP_SID).ChangeTo <QCInspectionInfoEx>();

                    //確認檢驗主檔狀態是否為WaitPPK
                    if (QCInspectionData.Status != currentState)
                    {
                        //序號:{0} 檢驗主檔狀態為{1},不可以執行
                        throw new Exception(RuleMessage.Error.C10100(ttbEquipOrCompLot.Text, QCInspectionData.Status));
                    }

                    //取得檢驗機台名稱
                    equipmentName = QCInspectionData.EquipmentName;

                    //取得檢驗資料
                    var row = _QCTable.NewRow();
                    row["Equipment"] = QCInspectionData.EquipmentName;
                    row["Device"]    = QCInspectionData.DeviceName;
                    row["SN"]        = QCDataObjList[0].ItemName1;
                    row["Status"]    = QCInspectionData.PassFlag == "Y" ? "PASS" : GetUIResource("WaitQC");
                    row["QCINSPSID"] = QCInspectionData.ID;

                    _QCTable.Rows.Add(row);
                }
                #endregion

                #region 檢查機台是否存在
                _EquipData = EquipmentInfo.GetEquipmentByName(equipmentName);

                if (_EquipData == null)
                {
                    //請輸入正確的機台/序號!
                    throw new Exception(RuleMessage.Error.C10066());
                }
                #endregion

                if (_QCTable.Rows.Count == 0)
                {
                    //機台:{0},查無任何檢驗資料。
                    throw new Exception(RuleMessage.Error.C10053(equipmentName));
                }

                //顯示檢驗清單
                gvQC.SetDataSource(_QCTable, true);

                btnOK.Enabled = true;

                //設置初始勾選狀態
                CheckBox ckbSelectAll = gvQC.HeaderRow.FindControl("ckbSelectAll") as CheckBox;
                ckbSelectAll.Checked = true;
                ckbSelectAll_CheckedChanged(null, EventArgs.Empty);
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbEquipOrCompLot);
                HandleError(ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 輸入機台/序號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbEquipOrCompLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                QCInspectionInfoEx QCInspectionData = new QCInspectionInfoEx();

                //檢查是否有輸入機台/序號
                ttbEquipOrCompLot.Must(lblEquipOrCompLot);

                #region 檢查輸入的內容在MES_QC_INSP_OBJ.ITEM1是否有符合的資料,如果沒有,則檢查機台
                var QCDataObjList = QCInspectionObjectInfoEx.GetDataListByComponentLot(ttbEquipOrCompLot.Text);
                if (QCDataObjList.Count == 0)
                {
                    var QCDataList = QCInspectionInfoEx.GetDataListByEquip(ttbEquipOrCompLot.Text, CustomizeFunction.QCType.PPK.ToCimesString());

                    if (QCDataList.Count == 0)
                    {
                        //請輸入正確的機台/序號!
                        throw new Exception(RuleMessage.Error.C10066());
                    }

                    //取得檢驗主檔資訊
                    QCInspectionData = QCDataList[0];
                }
                else
                {
                    //取得檢驗主檔資訊
                    QCInspectionData = InfoCenter.GetBySID <QCInspectionInfo>(QCDataObjList[0].QC_INSP_SID).ChangeTo <QCInspectionInfoEx>();
                }

                //檢查機台資料及狀態
                CheckEquipCurrentState(QCInspectionData.EquipmentName);

                #endregion

                #region 查詢相同的BatchID的檢驗主檔清單
                _QCInspectionDataList = QCInspectionInfoEx.GetDataListByBatchID(QCInspectionData.BatchID);
                if (_QCInspectionDataList.Count == 0)
                {
                    //檢驗單號:{0} 查無相同的BatchID
                    throw new Exception(RuleMessage.Error.C10110(QCInspectionData.InspectionNo));
                }
                #endregion

                //設置機台名稱
                ttbEquip.Text = QCInspectionData.EquipmentName;

                //取得不重複的料號清單
                var deviceList = _QCInspectionDataList.FindAll(p => p.Status == CustomizeFunction.QCStatus.PPK.ToCimesString()).Select(p => p.DeviceName).Distinct().ToList();
                //var deviceList = _QCInspectionDataList.Select(p => p.DeviceName).Distinct().ToList();

                #region 設置料號資料(DropDownList)

                //清除資料
                ddlDevice.Items.Clear();

                //加入清單
                foreach (var deviceName in deviceList)
                {
                    ddlDevice.Items.Add(new ListItem(deviceName, deviceName));
                }

                if (ddlDevice.Items.Count != 1)
                {
                    ddlDevice.Items.Insert(0, "");
                }
                else
                {
                    ddlDevice.SelectedIndex = 0;
                    ddlDevice_SelectedIndexChanged(null, EventArgs.Empty);
                }
                #endregion
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbEquipOrCompLot);
                HandleError(ex);
            }
        }