Exemplo n.º 1
0
        private object GetEditObject()
        {
            if (_facade == null)
            {
                _facade = new BenQGuru.eMES.MOModel.RMAFacade(base.DataProvider);
            }
            if (this.ValidateInput())
            {
                object  obj     = (RMABill)this._facade.GetRMABill(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtRMABillEidt.Text)));
                RMABill rmaBill = (RMABill)obj;
                if (obj != null)
                {
                    rmaBill.Memo         = FormatHelper.CleanString(this.txtMemoEdit.Text, 200);
                    rmaBill.MaintainUser = this.GetUserCode();
                }
                else
                {
                    rmaBill              = new RMABill();
                    rmaBill.Memo         = FormatHelper.CleanString(this.txtMemoEdit.Text, 200);
                    rmaBill.RMABillCode  = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtRMABillEidt.Text, 40));
                    rmaBill.MaintainUser = this.GetUserCode();
                }


                return(rmaBill);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        protected void cmdDelete_ServerClick(object sender, System.EventArgs e)
        {
            if (_facade == null)
            {
                _facade = new BenQGuru.eMES.MOModel.RMAFacade(base.DataProvider);
            }
            //已经关闭或结案的RMA不能新增行项目

            ArrayList array = this.gridHelper.GetCheckedRows();

            if (array.Count > 0)
            {
                ArrayList items = new ArrayList(array.Count);

                foreach (GridRecord row in array)
                {
                    RMABill rmaBill = (RMABill)this.GetEditObject(row);
                    if (rmaBill != null)
                    {
                        if (rmaBill.Status != RMABillStatus.Initial)
                        {
                            WebInfoPublish.Publish(this, "$BS_RMABillStatus_CannotDelete", this.languageComponent1);
                            this.RequestData();
                            return;
                        }
                        items.Add(rmaBill);
                    }
                }
                _facade.DeleteRMABill((RMABill[])items.ToArray(typeof(RMABill)));
            }

            this.buttonHelper.PageActionStatusHandle(PageActionType.Delete);
            this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize);
            this.RequestData();
        }
Exemplo n.º 3
0
        private string[] FormatExportRecord(object obj)
        {
            RMABill rb = obj as RMABill;


            return(new string[] {
                rb.RMABillCode,
                this.languageComponent1.GetString(rb.Status),
                rb.Memo,
                rb.GetDisplayText("MaintainUser"),
                FormatHelper.ToDateString(rb.MaintainDate),
                FormatHelper.ToTimeString(rb.MaintainTime)
            });
        }
Exemplo n.º 4
0
        protected DataRow GetGridRow(object obj)
        {
            RMABill rb = obj as RMABill;

            //return new Infragistics.WebUI.UltraWebGrid.UltraGridRow(
            //    new object[]{
            //                    false,
            //                    rb.RMABillCode.ToString(),
            //                    this.languageComponent1.GetString( rb.Status.ToString() ),
            //                    rb.Memo,
            //                    rb.GetDisplayText("MaintainUser"),
            //                     FormatHelper.ToDateString(rb.MaintainDate),
            //                     FormatHelper.ToTimeString(rb.MaintainTime)
            //                });
            DataRow row = this.DtSource.NewRow();

            row["RMABillCode"] = rb.RMABillCode.ToString();
            row["Status"]      = this.languageComponent1.GetString(rb.Status.ToString());
            row["Memo"]        = rb.Memo;
            row["MUSER"]       = rb.GetDisplayText("MaintainUser");
            row["MDATE"]       = FormatHelper.ToDateString(rb.MaintainDate);
            row["MTIME"]       = FormatHelper.ToTimeString(rb.MaintainTime);
            return(row);
        }
Exemplo n.º 5
0
        protected void cmdClose_ServerClick(object sender, EventArgs e)
        {
            /* 下发的时候需要 */
            if (_facade == null)
            {
                _facade = new BenQGuru.eMES.MOModel.RMAFacade(base.DataProvider);
            }
            if (_TSFacade == null)
            {
                _TSFacade = new TSFacade(this.DataProvider);
            }
            if (_DataCollectFacade == null)
            {
                _DataCollectFacade = new DataCollectFacade(this.DataProvider);
            }

            ArrayList array = this.gridHelper.GetCheckedRows();

            if (array.Count > 0)
            {
                ArrayList items = new ArrayList(array.Count);

                foreach (GridRecord row in array)
                {
                    RMABill rmaBill = (RMABill)this.GetEditObject(row);
                    if (rmaBill != null)
                    {
                        if (rmaBill.Status != RMABillStatus.Opened)
                        {
                            WebInfoPublish.PublishInfo(this, "$BS_RMABillStatus_CannotClose $RMABillCode:" + rmaBill.RMABillCode, this.languageComponent1);
                            return;
                        }

                        object[] objs = _facade.QueryRMADetail(rmaBill.RMABillCode);
                        if (objs == null || objs.Length == 0)
                        {
                            WebInfoPublish.PublishInfo(this, "$BS_RMABillDetail_NOT_EXIST $RMABillCode:" + rmaBill.RMABillCode, this.languageComponent1);
                            return;
                        }
                        foreach (RMADetial rmaDetial in objs)
                        {
                            if (rmaDetial.Handelcode == "ts")
                            {
                                object objTs = _TSFacade.QueryLastTSByRunningCard(rmaDetial.Rcard);
                                if (objTs != null)
                                {
                                    //处理方式为维修的,则序列号必须为维修完成(tblts.tsstatus_complete)或者报废(tblts.tsstatus_scrap)
                                    if (!((objTs as Domain.TS.TS).TSStatus == TSStatus.TSStatus_Complete || (objTs as Domain.TS.TS).TSStatus == TSStatus.TSStatus_Scrap))
                                    {
                                        WebInfoPublish.PublishInfo(this, "$RCAR_MUST_TSCOMPLETE_TSSCRAP $RCARD:" + rmaDetial.Rcard, this.languageComponent1);
                                        return;
                                    }
                                }
                            }
                            else if (rmaDetial.Handelcode == "rework")
                            {
                                object objsimRepot = _DataCollectFacade.GetLastSimulationReportByRMA(rmaDetial.Rcard, rmaDetial.Rmabillcode);
                                if (objsimRepot != null)
                                {
                                    if ((objsimRepot as Domain.DataCollect.SimulationReport).IsComplete != "1")
                                    {
                                        WebInfoPublish.PublishInfo(this, "$CS_RCARD_IS_NOT_FINISHED $RCARD:" + rmaDetial.Rcard, this.languageComponent1);
                                        return;
                                    }
                                }
                                else
                                {
                                    //还未做返工
                                    WebInfoPublish.PublishInfo(this, "$RCARD_NOT_DO_REWORK $RCARD:" + rmaDetial.Rcard, this.languageComponent1);
                                    return;
                                }
                            }
                        }

                        items.Add(rmaBill);
                    }
                }


                //放在事务中处理
                this.DataProvider.BeginTransaction();

                foreach (RMABill rmabill in items)
                {
                    // Update RMA Status
                    rmabill.Status = RMABillStatus.Closed;
                    _facade.UpdateRMABill(rmabill);
                }

                this.DataProvider.CommitTransaction();

                RequestData();
            }
        }
Exemplo n.º 6
0
        protected void cmdDistribution_ServerClick(object sender, EventArgs e)
        {
            /* 下发的时候需要 */
            if (_facade == null)
            {
                _facade = new BenQGuru.eMES.MOModel.RMAFacade(base.DataProvider);
            }

            ArrayList array = this.gridHelper.GetCheckedRows();

            if (array.Count > 0)
            {
                ArrayList items = new ArrayList(array.Count);

                foreach (GridRecord row in array)
                {
                    RMABill rmaBill = (RMABill)this.GetEditObject(row);
                    if (rmaBill != null)
                    {
                        if (rmaBill.Status != RMABillStatus.Initial)
                        {
                            WebInfoPublish.PublishInfo(this, "$BS_RMABillStatus_CannotOpened $RMABillCode:" + rmaBill.RMABillCode, this.languageComponent1);
                            return;
                        }

                        object[] objs = _facade.QueryRMADetail(rmaBill.RMABillCode);
                        if (objs == null || objs.Length == 0)
                        {
                            WebInfoPublish.PublishInfo(this, "$BS_RMABillDetail_NOT_EXIST $RMABillCode:" + rmaBill.RMABillCode, this.languageComponent1);
                            return;
                        }

                        items.Add(rmaBill);
                    }
                }

                if (_TSFacade == null)
                {
                    _TSFacade = new TSFacade(this.DataProvider);
                }
                //放在事务中处理
                this.DataProvider.BeginTransaction();

                foreach (RMABill rmabill in items)
                {
                    // Update RMA Status
                    rmabill.Status = RMABillStatus.Opened;
                    _facade.UpdateRMABill(rmabill);

                    object[] objs = _facade.QueryRMADetail(rmabill.RMABillCode);
                    if (objs != null || objs.Length != 0)
                    {
                        foreach (RMADetial detial in objs)
                        {
                            //如果该序列号的处理方式为维修的,需要往TBLTS和TBLTSERRORCODE插入数据
                            if (detial.Handelcode == "ts")
                            {
                                //Insert TS
                                Domain.TS.TS ts = this.GetTS(detial);
                                _TSFacade.AddTS(ts);

                                Domain.TS.TSErrorCode tsErrorCode = this.GetTSErrorCode(detial, ts);
                                _TSFacade.AddTSErrorCode(tsErrorCode);
                            }
                        }
                    }
                }

                this.DataProvider.CommitTransaction();
            }
            //InitViewPanel();

            this.RequestData();
        }