Exemplo n.º 1
0
        private void cmdQuery_ServerClick(object sender, System.EventArgs e, bool checkAfterSave)
        {
            if (!CheckQueryCondition())
            {
                return;
            }
            ChearUI();

            string strPauseCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPauseCode.Text.Trim()));

            PauseFacade objFacade = new PauseFacade(this.DataProvider);
            object      objPause  = objFacade.GetPause(strPauseCode);

            if (objPause == null && checkAfterSave == false)
            {
                //Message:停发通知单不存在
                WebInfoPublish.Publish(this, "$CS_PAUSE_NOT_EXIST", this.languageComponent1);
                this.txtPauseCode.Focus();
                return;
            }

            if (((Pause)objPause).Status.EndsWith(PauseStatus.status_cancel) && checkAfterSave == false)
            {
                //Message:该停发通知单已经关闭
                WebInfoPublish.Publish(this, "$CS_PAUSE_IN_CANCEL", this.languageComponent1);
                this.txtPauseCode.Focus();
                return;
            }

            this.txtPauseReason.Text = ((Pause)objPause).PauseReason;

            this.RequestData(strPauseCode);
        }
Exemplo n.º 2
0
        private object[] LoadDataSource()
        {
            string strPauseCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPauseCode.Text.Trim()));

            PauseFacade objFacade = new PauseFacade(this.DataProvider);
            object      objPause  = objFacade.GetPause(strPauseCode);

            if (objPause == null || ((Pause)objPause).Status.EndsWith(PauseStatus.status_cancel))
            {
                return(null);
            }


            return(this.LoadDataSource(1, int.MaxValue));
        }
Exemplo n.º 3
0
        private object[] LoadDataSource(int inclusive, int exclusive)
        {
            string strPauseCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPauseCode.Text.Trim()));

            PauseFacade objFacade = new PauseFacade(this.DataProvider);
            object      objPause  = objFacade.GetPause(strPauseCode);

            if (objPause == null || ((Pause)objPause).Status.EndsWith(PauseStatus.status_cancel))
            {
                return(null);
            }


            return(objFacade.GetNotCancelPause2RcardList(FormatHelper.CleanString(strPauseCode),
                                                         inclusive,
                                                         exclusive));
        }
Exemplo n.º 4
0
        private void txtPauseCode_Leave(object sender, EventArgs e)
        {
            PauseFacade objFacade = new PauseFacade(this.DataProvider);

            if (this.txtPauseCode.Value.Trim().Length != 0)
            {
                object objPause = objFacade.GetPause(FormatHelper.CleanString(this.txtPauseCode.Value.Trim()));
                if (objPause != null)
                {
                    this.txtPauseReason.Value    = ((Pause)objPause).PauseReason;
                    this.txtPauseReason.ReadOnly = true;
                }
                else
                {
                    this.txtPauseReason.ReadOnly = false;
                }
            }
            else
            {
                this.txtPauseReason.ReadOnly = false;
            }
        }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.gridInfo.Rows.Count == 0)
            {
                //表格中没有数据
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_GRID_NO_RECORD"));
                return;
            }

            ////检查是否有选中的数据
            //
            bool blnIsSelected = false;

            for (int i = 0; i < this.gridInfo.Rows.Count; i++)
            {
                if (this.gridInfo.Rows[i].Cells["checked"].Value.ToString().ToLower().Equals("true"))
                {
                    blnIsSelected = true;
                    break;
                }

                for (int j = 0; j < this.gridInfo.Rows[i].ChildBands[0].Rows.Count; j++)
                {
                    if (this.gridInfo.Rows[i].ChildBands[0].Rows[j].Cells["checked"].Value.ToString().ToLower().Equals("true"))
                    {
                        blnIsSelected = true;
                        break;
                    }
                    else
                    {
                        for (int m = 0; m < this.gridInfo.Rows[i].ChildBands[0].Rows[j].ChildBands[0].Rows.Count; m++)
                        {
                            if (this.gridInfo.Rows[i].ChildBands[0].Rows[j].ChildBands[0].Rows[m].Cells["checked"].Value.ToString().ToLower().Equals("true"))
                            {
                                blnIsSelected = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (!blnIsSelected)
            {
                //Message:请至少选中一笔记录
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_CHOOSE_ONE_RECORD_AT_LEAST"));
                return;
            }


            if (this.txtPauseCode.Value.Trim().Length == 0)
            {
                //Message:请输入停发通知单
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_INPUT_PAUSE_CODE"));
                this.txtPauseCode.TextFocus(true, true);
                return;
            }

            string strPauseCode = FormatHelper.CleanString(this.txtPauseCode.Value.Trim());

            if (this.txtPauseReason.Value.Trim().Length == 0)
            {
                //Message:请输入停发原因
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_INPUT_PAUSE_REASON"));
                this.txtPauseReason.TextFocus(true, true);
                return;
            }

            string strPauseReason = FormatHelper.CleanString(this.txtPauseReason.Value.Trim());

            PauseFacade objFacade = new PauseFacade(this.DataProvider);

            object objPause = objFacade.GetPause(strPauseCode);

            if (objPause != null)
            {
                if (((Pause)objPause).Status.Equals(PauseStatus.status_cancel))
                {
                    //Message:停发通知单已经关闭,请输入停发通知单
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PAUSE_IN_CANCEL,$CS_INPUT_PAUSE_CODE"));
                    this.txtPauseCode.TextFocus(false, true);
                    return;
                }

                if (!((Pause)objPause).Status.Equals(PauseStatus.status_pause))
                {
                    //Message:停发通知单状态错误
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PAUSE_STATUS_ERROR " + ((Pause)objPause).Status));
                    this.txtPauseCode.TextFocus(false, true);
                    return;
                }
            }



            ////Message:确定把所选择的序列号加入该停发通知单内?
            //
            if (MessageBox.Show(UserControl.MutiLanguages.ParserMessage("$CS_ADD_RCARD_TO_PAUSE") + "?", UserControl.MutiLanguages.ParserMessage("$CS_CONFIRM"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                Pause pause = new Pause();
                pause.PauseCode    = strPauseCode;
                pause.PauseReason  = strPauseReason;
                pause.CancelReason = " ";
                pause.Status       = PauseStatus.status_pause;
                pause.PUser        = ApplicationService.Current().LoginInfo.UserCode;
                pause.PDate        = dbDateTime.DBDate;
                pause.PTime        = dbDateTime.DBTime;
                pause.CancelUser   = "******";
                //pause.CancelDate = dbDateTime.DBDate;
                //pause.CancelTime = dbDateTime.DBTime;
                pause.MaintainUser = ApplicationService.Current().LoginInfo.UserCode;
                pause.MaintainDate = dbDateTime.DBDate;
                pause.MaintainTime = dbDateTime.DBTime;

                IList <Pause2Rcard> pause2RcardList = new List <Pause2Rcard>();

                for (int i = 0; i < this.gridInfo.Rows.Count; i++)
                {
                    for (int j = 0; j < this.gridInfo.Rows[i].ChildBands[0].Rows.Count; j++)
                    {
                        for (int m = 0; m < this.gridInfo.Rows[i].ChildBands[0].Rows[j].ChildBands[0].Rows.Count; m++)
                        {
                            if (this.gridInfo.Rows[i].ChildBands[0].Rows[j].ChildBands[0].Rows[m].Cells["checked"].Value.ToString().ToLower().Equals("true"))
                            {
                                string rcard = this.gridInfo.Rows[i].ChildBands[0].Rows[j].ChildBands[0].Rows[m].Cells["rcard"].Value.ToString();

                                if (objFacade.CheckExistPause2Rcard(strPauseCode, rcard))
                                {
                                    ////Message: 已经存在停发资料
                                    //
                                    ApplicationRun.GetInfoForm().Add(
                                        new UserControl.Message(MessageType.Error, "$CS_ALREADY_EXIST_PAUSE2RCARD $CS_Param_RunSeq=" + rcard));
                                    return;
                                }


                                Pause2Rcard objPause2Rcard = new Pause2Rcard();
                                objPause2Rcard.PauseCode    = strPauseCode;
                                objPause2Rcard.SerialNo     = rcard;
                                objPause2Rcard.ItemCode     = this.gridInfo.Rows[i].ChildBands[0].Rows[j].ChildBands[0].Rows[m].Cells["itemcode"].Value.ToString();
                                objPause2Rcard.CancelSeq    = " ";
                                objPause2Rcard.BOM          = this.gridInfo.Rows[i].Cells["bom"].Value.ToString();
                                objPause2Rcard.MOCode       = this.gridInfo.Rows[i].ChildBands[0].Rows[j].ChildBands[0].Rows[m].Cells["mocode"].Value.ToString();
                                objPause2Rcard.Status       = PauseStatus.status_pause;
                                objPause2Rcard.CancelReason = " ";
                                objPause2Rcard.PUser        = ApplicationService.Current().LoginInfo.UserCode;
                                objPause2Rcard.PDate        = dbDateTime.DBDate;
                                objPause2Rcard.PTime        = dbDateTime.DBTime;
                                objPause2Rcard.CancelUser   = "******";
                                objPause2Rcard.MaintainUser = ApplicationService.Current().LoginInfo.UserCode;
                                objPause2Rcard.MaintainDate = dbDateTime.DBDate;
                                objPause2Rcard.MaintainTime = dbDateTime.DBTime;

                                pause2RcardList.Add(objPause2Rcard);
                            }
                        }
                    }
                }

                objFacade.PauseRcard(pause, pause2RcardList);

                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Success, "$CS_Save_Success"));

                this.m_dsPauseInfo.Clear();
                this.m_dtDetail.Clear();
                this.m_dtHead.Clear();
                this.txtPauseReason.Value = "";
                this.txtPauseCode.TextFocus(true, true);
            }
        }