Exemple #1
0
        private void ucButtonSave_Click(object sender, System.EventArgs e)
        {
            if (!_ListHelper.IsDirty)
            {
                return;
            }

            if (_AddTSErrorCodeWhenSave)
            {
                try
                {
                    this.DataProvider.BeginTransaction();

                    _TSFacade.AddTSErrorCode(_CurrentTS, _ListHelper.AddList);
                    _TSFacade.DeleteTSErrorCode(_CurrentTS, _ListHelper.DeleteList);
                    _TSFacade.DeleteTSErrorCode(_CurrentTS.TSId, string.Empty, _DefaultErrorCode.ParameterAlias);

                    this.DataProvider.CommitTransaction();
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();

                    this.ShowMessage(ex);

                    return;
                }

                this.ShowMessage(new UserControl.Message(MessageType.Success, "$CS_Save_Success"));
            }
            else
            {
                _SelectedTSErrorCode = _ListHelper.AddList;
            }

            _ListHelper.Clear();

            this.Close();
        }
Exemple #2
0
        private Messages DropLoadedParts(string rcard)
        {
            Messages msg = new Messages();

            ActionOnLineHelper onLine            = new ActionOnLineHelper(DataProvider);
            MaterialFacade     materialFacade    = new MaterialFacade(this.DataProvider);
            ItemFacade         itemFacade        = new ItemFacade(this.DataProvider);
            DataCollectFacade  dataCollectFacade = new DataCollectFacade(this.DataProvider);
            TSFacade           tsFacade          = new TSFacade(this.DataProvider);

            string sourceRCard = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty);

            ProductInfo product = GetProduct(sourceRCard);

            if (product == null || product.LastSimulation == null)
            {
                msg.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
                return(msg);
            }

            // Marked By HI1/Venus.Feng on 20081013 for Hisense Version : GOOD can do drop

            /*
             * if (product.LastSimulation.ProductStatus != ProductStatus.NG)
             * {
             *  msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_NG"));
             *  return msg;
             * }
             */
            // End Marked

            msg.Add(new UserControl.Message(rcard));

            //获取所有需要拆解或者替换的Parts
            ArrayList partsToUnload = new ArrayList();

            for (int i = 0; i < this.ultraGridLoadedPart.Rows.Count; i++)
            {
                if (ultraGridLoadedPart.Rows[i].Cells[0].Text.ToLower() == "true")
                {
                    InnoObject innoObject = new InnoObject();

                    innoObject.LineIndex  = i;
                    innoObject.MCard      = ultraGridLoadedPart.Rows[i].Cells["PackedNo"].Text;
                    innoObject.MCardType  = ultraGridLoadedPart.Rows[i].Cells["MCardType"].Text;
                    innoObject.ItemIndex  = partsToUnload.Count + 1;
                    innoObject.MItemCode  = ultraGridLoadedPart.Rows[i].Cells["ItemCode"].Text;
                    innoObject.MOCode     = ultraGridLoadedPart.Rows[i].Cells["MOCode"].Text;
                    innoObject.Qty        = 1;
                    innoObject.NewBarcode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(ultraGridLoadedPart.Rows[i].Cells["NewBarcode"].Text.Trim()));

                    partsToUnload.Add(innoObject);
                }
            }

            //对于需要替换的Parts,需要做类似上料中的解析和检查
            for (int i = 0; i < partsToUnload.Count; i++)
            {
                InnoObject innoObject = (InnoObject)partsToUnload[i];

                if (innoObject.NewBarcode.Trim().Length > 0)
                {
                    //抓取物料的设定
                    Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(innoObject.MItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    if (material == null)
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_NotFound"));
                        return(msg);
                    }

                    string barcode = innoObject.NewBarcode.Trim();

                    //模拟一个OPBOMDetail
                    OPBOMDetail detailTemp = new OPBOMDetail();
                    detailTemp.OPBOMItemControlType = material.MaterialControlType;
                    detailTemp.OPBOMParseType       = material.MaterialParseType;
                    detailTemp.OPBOMCheckType       = material.MaterialCheckType;
                    detailTemp.CheckStatus          = material.CheckStatus;
                    detailTemp.SerialNoLength       = material.SerialNoLength;
                    detailTemp.NeedVendor           = material.NeedVendor;
                    detailTemp.OPBOMSourceItemCode  = innoObject.MItemCode;
                    detailTemp.OPBOMItemCode        = innoObject.MItemCode;
                    detailTemp.OPBOMItemQty         = 1;


                    MINNO newMINNO = new MINNO();
                    newMINNO.MOCode    = innoObject.MOCode.Trim();
                    newMINNO.MItemCode = material.MaterialCode.Trim();

                    Messages collectMessage = dataCollectFacade.GetMINNOByBarcode(detailTemp, barcode, newMINNO.MOCode, null, false, false, out newMINNO);

                    if (collectMessage.IsSuccess())
                    {
                        innoObject.NewLotNo          = newMINNO.LotNO;
                        innoObject.NewPCBA           = newMINNO.PCBA;
                        innoObject.NewBIOS           = newMINNO.BIOS;
                        innoObject.NewVersion        = newMINNO.Version;
                        innoObject.NewVendorItemCode = newMINNO.VendorItemCode;
                        innoObject.NewVendorCode     = newMINNO.VendorCode;
                        innoObject.NewDateCode       = newMINNO.DateCode;
                    }
                    else
                    {
                        msg.AddMessages(collectMessage);
                        return(msg);
                    }
                }
            }

            try
            {
                this.DataProvider.BeginTransaction();

                //更新试流单
                //下料中处理tbltry,tbltry2rcard
                for (int i = 0; i < partsToUnload.Count; i++)
                {
                    InnoObject innoObject = (InnoObject)partsToUnload[i];

                    TryEventArgs tryEventArgs = new TryEventArgs(
                        ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode,
                        product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.MCard, string.Empty, false, false);

                    msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs));
                    if (!msg.IsSuccess())
                    {
                        DataProvider.RollbackTransaction();
                        return(msg);
                    }
                }

                //更新试流单
                //上料中处理tbltry,tbltry2rcard
                for (int i = 0; i < partsToUnload.Count; i++)
                {
                    InnoObject innoObject = (InnoObject)partsToUnload[i];
                    if (innoObject.NewBarcode.Trim().Length > 0)
                    {
                        TryEventArgs tryEventArgs = new TryEventArgs(
                            ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode,
                            product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.NewBarcode, string.Empty, true, true);

                        msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs));
                        if (!msg.IsSuccess())
                        {
                            DataProvider.RollbackTransaction();
                            return(msg);
                        }
                    }
                }

                //检查新上料是否在TS中而不可用
                for (int i = 0; i < partsToUnload.Count; i++)
                {
                    InnoObject innoObject = (InnoObject)partsToUnload[i];
                    if (innoObject.NewBarcode.Trim().Length > 0)
                    {
                        if (!tsFacade.RunningCardCanBeClollected(innoObject.NewBarcode.Trim(), CardType.CardType_Part))
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + innoObject.NewBarcode.Trim()));
                            DataProvider.RollbackTransaction();
                            return(msg);
                        }
                    }
                }

                //拆解或者替换处理tblonwipitem,tblsimulationreport
                DropMaterialEventArgs dropMaterialEventArgs = new DropMaterialEventArgs(ActionType.DataCollectAction_DropMaterial, product.LastSimulation.RunningCard,
                                                                                        ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode,
                                                                                        product);
                dropMaterialEventArgs.OnwipItems = partsToUnload.ToArray();

                msg.AddMessages(onLine.ActionWithTransaction(dropMaterialEventArgs));
                if (!msg.IsSuccess())
                {
                    DataProvider.RollbackTransaction();
                    return(msg);
                }

                //针对拆解下的物料,做TS相关的动作
                for (int i = 0; i < partsToUnload.Count; i++)
                {
                    InnoObject innoObject = (InnoObject)partsToUnload[i];

                    if (_TSList[innoObject.LineIndex] != null)
                    {
                        if (_TSErrorCodeList[innoObject.LineIndex] == null)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Select_ErrorCode"));
                            DataProvider.RollbackTransaction();
                            return(msg);
                        }

                        Domain.TS.TS oldTS = (Domain.TS.TS)tsFacade.QueryLastTSByRunningCard(innoObject.MCard);
                        if (oldTS != null)
                        {
                            if (oldTS.TSStatus == TSStatus.TSStatus_New ||
                                oldTS.TSStatus == TSStatus.TSStatus_Confirm ||
                                oldTS.TSStatus == TSStatus.TSStatus_TS)
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTS"));
                                DataProvider.RollbackTransaction();
                                return(msg);
                            }
                            else if (oldTS.TSStatus != TSStatus.TSStatus_Reflow &&
                                     oldTS.TSStatus != TSStatus.TSStatus_Split &&
                                     oldTS.TSStatus != TSStatus.TSStatus_Complete &&
                                     oldTS.TSStatus != TSStatus.TSStatus_Scrap)
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_WrongTSStatus"));
                                DataProvider.RollbackTransaction();
                                return(msg);
                            }
                        }

                        Domain.TS.TS newTS = (Domain.TS.TS)_TSList[innoObject.LineIndex];
                        tsFacade.AddTS(newTS);
                        foreach (TSErrorCode tsErrorCode in (TSErrorCode[])_TSErrorCodeList[innoObject.LineIndex])
                        {
                            tsErrorCode.RunningCard         = newTS.RunningCard;
                            tsErrorCode.RunningCardSequence = newTS.RunningCardSequence;
                            tsErrorCode.ItemCode            = newTS.ItemCode;
                            tsErrorCode.ModelCode           = newTS.ModelCode;
                            tsErrorCode.MOCode       = newTS.MOCode;
                            tsErrorCode.MOSeq        = newTS.MOSeq;
                            tsErrorCode.MaintainUser = newTS.MaintainUser;
                            tsErrorCode.MaintainDate = newTS.MaintainDate;
                            tsErrorCode.MaintainTime = newTS.MaintainTime;

                            tsFacade.AddTSErrorCode(tsErrorCode);
                        }
                    }
                }

                if (!msg.IsSuccess())
                {
                    DataProvider.RollbackTransaction();
                    return(msg);
                }

                if (msg.IsSuccess())
                {
                    DataProvider.CommitTransaction();
                }
                else
                {
                    DataProvider.RollbackTransaction();
                }
            }
            catch (Exception e)
            {
                this.DataProvider.RollbackTransaction();
                msg.Add(new UserControl.Message(e));
            }

            return(msg);
        }
Exemple #3
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();
        }