Ejemplo n.º 1
0
        protected void ttbWorkOrderLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                ClearField();
                string workorderLot = ttbWorkOrderLot.Text.Trim();
                if (workorderLot.IsNullOrEmpty())
                {
                    return;
                }

                _LotDatas = LotInfoEx.GetLotListByWorkOrderLot(workorderLot);
                if (_LotDatas.Count == 0)
                {
                    // [00060] 工件清單沒有資料可顯示!
                    throw new RuleCimesException(TextMessage.Error.T00060(lblLotList.Text));
                }

                var judgeOperation = WpcExClassItemInfo.GetInfoByClass("SAIJudgeOperation").Find(p => p.Remark01 == _LotDatas[0].Process);
                if (judgeOperation == null)
                {
                    //找不到待判站資訊,請至系統資料維護增加資訊,屬性:{0}
                    throw new Exception(RuleMessage.Error.C10014(_LotDatas[0].Process));
                }
                _JudgeOperation = judgeOperation.Remark02;

                _LotDatas = _LotDatas.OrderBy(p => p.OperationSequence).ThenBy(p => p.ComponentLot).ToList();

                var lotTemp = _LotDatas.FindAll(p => p.OperationName != _JudgeOperation);

                var enabled = true;
                lotTemp.ForEach(lot => {
                    if (lot.Status != "WaitMerge")
                    {
                        enabled = false;
                    }
                });
                btnOK.Enabled = enabled;
                //gvWorkpiece.SetDataSource(_LotDatas, true);
                gvWorkpiece.DataSource = _LotDatas;
                gvWorkpiece.DataBind();
            }
            catch (Exception ex)
            {
                AjaxFocus(ttbWorkOrderLot);
                HandleError(ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 輸入工件序號
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ttbCompLot_TextChanged(object sender, EventArgs e)
        {
            try
            {
                decimal haveMergeQty = 0;
                decimal mergeQty     = 0;
                decimal notMergeQty  = 0;

                //確認工件序號是否有輸入
                ttbCompLot.Must(lblCompLot);

                //確認工件序號是否存在
                var lotList = LotInfoEx.GetLotListByComponentLot(ttbCompLot.Text);
                if (lotList.Count == 0)
                {
                    //工件序號:{0} 不存在!!
                    throw new Exception(RuleMessage.Error.C10047(ttbCompLot.Text));
                }

                var compLotData = lotList[0];

                //確認狀態是否為WAIT
                if (compLotData.Status != LotDefaultStatus.Wait.ToString())
                {
                    //狀態為{0},不可執行
                    throw new Exception(RuleMessage.Error.C10003(compLotData.Status));
                }

                //確認批號執行規則是否與程式相同
                //if (compLotData.CurrentRuleName != _ProgramInformationBlock.ProgramRight)
                //{
                //    //該批號作業為XXXX,不為此功能,請遵循作業規範
                //    throw new Exception(RuleMessage.Error.C10004(compLotData.CurrentRuleName));
                //}

                //取得小工單資料
                var workOrderLot = CSTWorkOrderLotInfo.GetWorkOrderLotDataByWorkOrderLot(compLotData.WorkOrderLot);
                if (workOrderLot == null)
                {
                    // [00030]{0}:{1}不存在!
                    throw new Exception(TextMessage.Error.T00030(lblWOLot.Text, compLotData.WorkOrderLot));
                }

                //取得相同小工單的工件序號清單資料
                var sameWOLotList = LotInfoEx.GetLotListByWorkOrderLot(compLotData.WorkOrderLot);

                #region 取得相同工作站、UDC08等於Y及狀態為Wait的工件序號清單
                var autoTypeLotList = sameWOLotList.FindAll(lot => lot.UserDefineColumn08 == "Y");

                _MergeLotDataList = autoTypeLotList.FindAll(lot => lot.OperationName == compLotData.OperationName && lot.Status == LotDefaultStatus.Wait.ToString());

                //計算可合併數量
                _MergeLotDataList.ForEach(lot => { mergeQty += lot.Quantity; });
                #endregion

                #region 取得不可合併的工件序號清單
                var notMergeLotDataList = autoTypeLotList.FindAll(lot => (lot.OperationName == compLotData.OperationName && lot.Status == LotDefaultStatus.Wait.ToString()) == false);

                //計算不可合併數量
                notMergeLotDataList.ForEach(lot => { notMergeQty += lot.Quantity; });
                #endregion

                #region 取得已合併的工件序號清單
                var haveMergeLotDataList = sameWOLotList.FindAll(lot => lot.UserDefineColumn08 == "N");

                //計算已合併數量
                haveMergeLotDataList.ForEach(lot => { haveMergeQty += lot.Quantity; });
                #endregion

                //取得流程清單
                GetRoute(compLotData);

                //顯示介面資料
                ttbOperation.Text    = compLotData.OperationName;
                ttbWOLot.Text        = compLotData.WorkOrderLot;
                ttbWOQty.Text        = workOrderLot.Quantity.ToString();
                ttbMergeQty.Text     = mergeQty.ToString();
                ttbNotMergeQty.Text  = notMergeQty.ToString();
                ttbHaveMergeQty.Text = haveMergeQty.ToString();

                gvMergeCompLot.SetDataSource(_MergeLotDataList, true);
                gvNotMergeCompLot.SetDataSource(notMergeLotDataList, true);

                btnOK.Enabled = true;
            }
            catch (Exception ex)
            {
                ClearField();
                AjaxFocus(ttbCompLot);
                HandleError(ex);
            }
        }