Esempio n. 1
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);
        }
Esempio n. 2
0
        private void ucLabelEditRcard_TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                dtSource.Clear();
                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                //转换成起始序列号
                string sourceCard = dataCollectFacade.GetSourceCard(this.ucLabelEditRcard.Value.ToString().ToUpper().Trim(), string.Empty);
                //end
                object objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourceCard);
                if (objSimulationReport != null)
                {
                    SimulationReport simulationReport = objSimulationReport as SimulationReport;
                    if (simulationReport.IsComplete.Equals("1"))
                    {
                        ucMessageInfo.AddEx(null, this.ucLabelEditRcard.Value, new UserControl.Message(MessageType.Error, "$Error_RunningCard_IsCompelete"), true);
                        this.ucLabelEditRcard.TextFocus(false, true);
                        return;
                    }
                    this.ucLabelEditItemCode.Value = simulationReport.ItemCode;
                    this.ucLabelEditOp.Value       = simulationReport.OPCode;
                    this.ucLabelEditRout.Value     = simulationReport.RouteCode;
                    object objMo   = moFacade.GetMO(simulationReport.MOCode);
                    object objItem = itemFacade.GetItem(simulationReport.ItemCode, ((MO)objMo).OrganizationID);
                    this.ucLabelEditName.Value = ((Item)objItem).ItemName;
                    object[] objOperation = null;
                    if (simulationReport.Status.Equals("GOOD"))
                    {
                        objOperation = itemFacade.QueryItemRoute2Operation(simulationReport.ItemCode, simulationReport.RouteCode);
                        CheckNextOp(simulationReport.MOCode, simulationReport.RouteCode, simulationReport.OPCode);
                    }
                    if (simulationReport.Status.Equals("NG"))
                    {
                        TSFacade tsFacade = new TSFacade(this.DataProvider);
                        object   objTs    = tsFacade.QueryLastTSByRunningCard(sourceCard);
                        if (objTs != null)
                        {
                            string refRouteCode = ((Domain.TS.TS)objTs).ReflowRouteCode;
                            string refOpCode    = ((Domain.TS.TS)objTs).ReflowOPCode;
                            if (refRouteCode == string.Empty || refOpCode == string.Empty)
                            {
                                objOperation = itemFacade.QueryItemRoute2Operation(simulationReport.ItemCode, simulationReport.RouteCode);
                                CheckNextOp(simulationReport.MOCode, simulationReport.RouteCode, simulationReport.OPCode);
                            }
                            else
                            {
                                this.ucLabelEditOp.Value = ((Domain.TS.TS)objTs).ConfirmOPCode;
                                objOperation             = itemFacade.QueryItemRoute2Operation(simulationReport.ItemCode, refRouteCode);
                                BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                                object          objOP2Res       = baseModelFacade.GetOperationByResource(ApplicationService.Current().ResourceCode);
                                string          opCode2Res      = string.Empty;
                                if (objOP2Res != null)
                                {
                                    opCode2Res = ((Operation2Resource)objOP2Res).OPCode;
                                }
                                _NextOP = refOpCode;
                                if (opCode2Res != refOpCode)
                                {
                                    string opDesc = ((Operation)baseModelFacade.GetOperation(refOpCode)).OPDescription;
                                    ucMessageInfo.AddEx(null, this.ucLabelEditRcard.Value, new UserControl.Message(MessageType.Error, "$Error_Please_Send_Rcard_To " + opDesc + " $CS_Param_OPCode"), true);
                                }
                            }
                        }
                    }

                    if (objOperation != null)
                    {
                        foreach (Operation operation in objOperation)
                        {
                            DataRow dr = dtSource.NewRow();
                            dr["opCode"]        = operation.OPCode;
                            dr["opDescription"] = operation.OPDescription;
                            dtSource.Rows.Add(dr);
                        }
                        ultraGridHead.DataSource = dtSource;
                    }
                }
                else
                {
                    this.ucLabelEditItemCode.Value = "";
                    this.ucLabelEditOp.Value       = "";
                    this.ucLabelEditRout.Value     = "";
                    this.ucLabelEditName.Value     = "";
                    ucMessageInfo.AddEx(null, this.ucLabelEditRcard.Value, new UserControl.Message(MessageType.Error, "$Error_ProductInfo_IS_Null"), true);
                }
                this.ucLabelEditRcard.TextFocus(false, true);
            }
        }
Esempio n. 3
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();
            }
        }
Esempio n. 4
0
        private void QueryPicsNG()
        {
            Messages msg = new Messages();

            this.imageListPicsNG.Images.Clear();
            this.listPicsNG.Items.Clear();
            if (_tsFacade == null)
            {
                _tsFacade = new TSFacade(this.DataProvider);
            }
            if (string.IsNullOrEmpty(this.txtRcard.Text))
            {
                return;
            }

            object obj    = _tsFacade.QueryLastTSByRunningCard(this.txtRcard.Text);
            int    imgnum = 0;

            if (obj != null)
            {
                Domain.TS.TS ts = (Domain.TS.TS)obj;
                if (ts.TSStatus == TSStatus.TSStatus_Complete)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_TS_Completed"));
                    ApplicationRun.GetInfoForm().Add(msg);
                }
                else
                {
                    EsopPicsNGFacade m_EsopPicsNGFacade = new EsopPicsNGFacade(this.DataProvider);
                    object[]         objPicsNG          = m_EsopPicsNGFacade.QueryEsopPicsNG(this.txtRcard.Text, ts.TSId);
                    if (objPicsNG != null && objPicsNG.Length > 0)
                    {
                        string filaPath = "";
                        if (_facade == null)
                        {
                            _facade = new SystemSettingFacade(this.DataProvider);
                        }
                        object parameter = _facade.GetParameter("PUBLISHESOPPICSDIRPATH", "PUBLISHEOPSPICSDIRPATHGROUP");

                        if (parameter != null)
                        {
                            //服务器目录路径
                            filaPath = ((Domain.BaseSetting.Parameter)parameter).ParameterAlias;
                        }

                        foreach (Esoppicsng picNG in objPicsNG)
                        {
                            string fileName = filaPath + "TS/" + picNG.Picsname + ".jpg";

                            try
                            {
                                WebClient wc = new WebClient();
                                wc.Credentials = CredentialCache.DefaultCredentials;
                                // wc.DownloadData(fileName);
                                Stream fs = wc.OpenRead(fileName);
                                this.imageListPicsNG.Images.Add(Image.FromStream(fs));
                                ListViewItem lvi = new ListViewItem();
                                // lvi.Text = pic.Picfullname;         //图片名称
                                lvi.ImageIndex = imgnum; //这里是Listview每项显示的图片
                                lvi.Tag        = picNG;  //这里绑定不显示的数据
                                this.listPicsNG.Items.Add(lvi);
                                fs.Flush();
                                fs.Close();
                                imgnum++;
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                        if (this.imageListPicsNG.Images.Count > 0)
                        {
                            this.imageListPicsNG.ColorDepth = ColorDepth.Depth32Bit;
                            Size size = new Size();
                            size.Width  = 100;
                            size.Height = 82;
                            this.imageListPicsNG.ImageSize = size;
                            this.listPicsNG.LargeImageList = this.imageListPicsNG;
                            this.listPicsNG.MultiSelect    = false;
                        }
                    }
                    else
                    {
                        msg.Add(new UserControl.Message(MessageType.Success, "$File_Not_Exist"));
                        ApplicationRun.GetInfoForm().Add(msg);
                    }
                }
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Error, "$CS_TS_Not_Exist"));
                ApplicationRun.GetInfoForm().Add(msg);
            }
        }