Example #1
0
        private BenQGuru.eMES.Domain.TS.TSErrorCode GetTSErrorCode(RMADetial rmadetial, Domain.TS.TS ts)
        {
            if (_TSModelFacade == null)
            {
                _TSModelFacade = new TSModelFacade(this.DataProvider);
            }
            object objEcg = _TSModelFacade.GetErrorCodeGroup2ErrorCodeByecCode(rmadetial.Errorcode);


            Domain.TS.TSErrorCode tsErrorCode = new Domain.TS.TSErrorCode();
            tsErrorCode.ErrorCode = rmadetial.Errorcode;
            if (objEcg != null)
            {
                tsErrorCode.ErrorCodeGroup = (objEcg as Domain.TSModel.ErrorCodeGroup2ErrorCode).ErrorCodeGroup;
            }
            else
            {
                tsErrorCode.ErrorCodeGroup = " ";
            }
            tsErrorCode.ItemCode            = rmadetial.Itemcode;
            tsErrorCode.TSId                = ts.TSId;
            tsErrorCode.RunningCard         = rmadetial.Rcard;
            tsErrorCode.RunningCardSequence = ts.RunningCardSequence;
            tsErrorCode.ModelCode           = ts.ModelCode;
            tsErrorCode.MOCode              = "";
            tsErrorCode.MaintainUser        = this.GetUserCode();
            tsErrorCode.MaintainDate        = FormatHelper.TODateInt(DateTime.Now);
            tsErrorCode.MaintainTime        = FormatHelper.TOTimeInt(DateTime.Now);
            return(tsErrorCode);
        }
Example #2
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();
        }