Example #1
0
        private void FmMOReport_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cardNo))
            {
                throw new Exception("流转卡号不能为空!");
            }
            else if (!dal.Exists(cardNo))
            {
                throw new Exception("流转卡号[" + cardNo + "] 不存在!");
            }

            this.cardM = dal.GetCardMain(cardNo);
            this.LoadData();
        }
Example #2
0
        private void FmMOReport_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cardNo))
            {
                throw new Exception("流转卡号不能为空!");
            }
            else if (!dal.Exists(cardNo))
            {
                throw new Exception("流转卡号[" + cardNo + "] 不存在!");
            }

            this.card = rep.GetCard(cardNo);

            if (card.M.bClosed)
            {
                throw new Exception("当前流转卡已经关闭!");
            }
            else if (card.M.bPause)
            {
                throw new Exception("当前流转卡已经暂停,不能继续!");
            }

            this.LoadData();
        }
Example #3
0
        /// <summary>
        /// 添加流转卡
        /// </summary>
        private void txt_CardNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                var cardNo = (sender as TextBox).Text.Trim();

                if (string.IsNullOrEmpty(cardNo))
                {
                    throw new Exception("流转卡号不能为空!");
                }
                else if (!dal.Exists(cardNo))
                {
                    throw new Exception("流转卡号[" + cardNo + "] 不存在!");
                }
                else if (listCard.Find(x => x.M.CardNo == cardNo) != null)
                {
                    throw new Exception("卡号已经添加!");
                }

                var card = dal.Get(cardNo);

                if (card.M.bClosed)
                {
                    throw new Exception("当前流转卡已经关闭!");
                }
                else if (card.M.bPause)
                {
                    throw new Exception("当前流转卡暂停,不能继续!");
                }
                else if (card.M.curOperationId != operationId)
                {
                    throw new Exception("流转卡:[" + card.M.CardNo + "] 当前工序与所选工序不匹配!");
                }
                else if (card.M.curOperation.EQId != 0 && card.M.curOperation.EQId != eqId)
                {
                    if (MsgBox.ShowYesNoMsg("流转卡:[" + card.M.CardNo + "] 当前设定设备与所选设备不匹配,是否选择!") != DialogResult.Yes)
                    {
                        return;
                    }
                }

                //流转卡
                listCard.Insert(0, card);

                //iStatus = 0 : 未推送需求
                if (!new MaterialRequestDAL().ExistCard(cardNo, card.M.curOperation.RouterId))
                {
                    //过滤当前工序材料
                    var materials = card.ZJList.Where(x => x.RouterId == card.M.curOperation.RouterId).ToList();

                    materials.ForEach(m =>
                    {
                        listMReq.Add(new MaterialRequest
                        {
                            bMerge       = false,
                            CardChildId  = m.AutoID,
                            CardNo       = m.CardNo,
                            cComUnitName = m.cComUnitName,
                            cInvCode     = m.cInvCode,
                            cInvName     = m.cInvName,
                            cInvStd      = m.cInvStd,
                            iQuantity    = m.iQuantity,
                            iReqQuantity = m.iQuantity,
                            operationId  = m.OperationId,
                            OpName       = m.OpName
                        });
                    });
                }


                var listCardM = listCard.Select((x, y) =>
                {
                    return(x.M);
                }).ToList();

                BindingList <CardMain> blist = new BindingList <CardMain>(listCardM);
                this.gridControl2.DataSource = blist;

                //材料汇总
                this.cb_bSum_Click(null, null);

                this.txt_CardNo.Clear();
            }
        }
Example #4
0
        //加载流转卡数据
        private void LoadCardData(string cardNo)
        {
            if (!dal.Exists(cardNo))
            {
                throw new Exception("找不到流转卡: " + cardNo);
            }

            card = dal.Get(cardNo);

            if (card == null)
            {
                MsgBox.ShowInfoMsg("找不到流转卡: " + cardNo);
                return;
            }

            if (card.M.curOperation == null)
            {
                MsgBox.ShowInfoMsg("当前工序为空!");
                return;
            }

            //istatus = 1 物料需求标识
            if (card.M.curOperation.iStatus == 0)
            {
                dal.SetOperationStatus(1, card.M.curOperation.AutoId);
                card.M.curOperation.iStatus = 1;
            }

            UIBinding <CardMain> .UIDataBinding(pnl_Main, card.M);

            UIBinding <CardDetail> .UIDataBinding(lbl_dStartDate, "dStartDate", card.M.curOperation);

            list_children.Items.Clear();

            foreach (CardChildren c in card.ZJList)
            {
                ListViewItem item = new ListViewItem(c.OpName.ToString());
                item.SubItems.Add(c.cInvCode);
                item.SubItems.Add(c.cInvName);
                item.SubItems.Add(c.cInvStd);
                item.SubItems.Add(c.iQuantity.ToString());
                item.SubItems.Add(c.rQuantity.ToString());
                item.Tag = c;
                list_children.Items.Add(item);
            }

            switch (card.M.curOperation.iStatus)
            {
            case 1:
                lbl_Status.Text = "材料准备";
                break;

            case 2:
                lbl_Status.Text = "材料确认";
                break;

            case 3:
                lbl_Status.Text = "已开工";
                break;

            case 4:
                lbl_Status.Text = "已报检";
                break;

            case 5:
                lbl_Status.Text = "已检验";
                break;

            case 6:
                lbl_Status.Text = "已完工";
                break;
            }

            this.SetBtnGo(BtnGo);
            //this.SetBtnBack(btnBack);
            this.btnBack.Visible = card.M.curOperation.iStatus > 1;

            lbl_bQuality.Text = card.M.curOperation.bQuality ? "是" : "否";
            lbl_bChild.Text   = card.M.bChild ? "是" : "否";
            lbl_QmR.Text      = new QmCardOPDAL().HaveQmReport(card.M.curOperation) ? "已报检" : "未报检";

            #region 加载共享文件列表

            FileExpControl ctrl = new FileExpControl(cardNo);
            ctrl.Parent = groupPanel2;
            ctrl.Dock   = DockStyle.Fill;
            ctrl.Show();

            #endregion
        }