예제 #1
0
        //检查此Rcard所属栈板下Rcard在同一垛位下
        private bool CheckRcardIsInTheSameStack(string pallet, string stackCode)
        {
            InventoryFacade   inventoryFacade   = new InventoryFacade(this.DataProvider);
            PackageFacade     packageFacade     = new PackageFacade(this.DataProvider);
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);

            object[] pallet2RCardList = packageFacade.GetPallet2RCardListByPallet(pallet);
            if (pallet2RCardList == null)
            {
                return(true);
            }

            for (int i = 0; i < pallet2RCardList.Length; i++)
            {
                string           cartonCode       = string.Empty;
                SimulationReport simulationReport = (SimulationReport)dataCollectFacade.GetLastSimulationReport(((Pallet2RCard)pallet2RCardList[i]).RCard);
                if (simulationReport != null)
                {
                    cartonCode = simulationReport.CartonCode;
                }

                object[] stack2RcardList = inventoryFacade.QueryStacktoRcardByRcardAndCarton(((Pallet2RCard)pallet2RCardList[i]).RCard, cartonCode);
                if (stack2RcardList != null && !((StackToRcard)stack2RcardList[0]).StackCode.Equals(stackCode))
                {
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_RCARD_IS_NOT_INSAME_STACK:" + ((StackToRcard)stack2RcardList[0]).StackCode));
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Undo时更新Simulation数据
        /// </summary>
        private void UndoNGSimulation(Simulation simulation, bool isNG, OnWIP wip)
        {
            // 更新Simulation
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            lastAction        = wip.Action;

            simulation.LastAction = lastAction;
            string[] actionList = simulation.ActionList.Split(';');
            simulation.ActionList    = string.Join(";", actionList, 0, actionList.Length - 2) + ";";
            simulation.ProductStatus = wip.ActionResult;
            if (isNG == true)
            {
                simulation.NGTimes = simulation.NGTimes - 1;
            }
            simulation.IsComplete = FormatHelper.BooleanToString(false);
            //simulation.RunningCardSequence = wip.RunningCardSequence;		// 保留测试信息
            dataCollectFacade.UpdateSimulation(simulation);
            // 更新SimulationReport
            SimulationReport simulationReport = (SimulationReport)dataCollectFacade.GetLastSimulationReport(simulation.RunningCard);

            simulationReport.LastAction = lastAction;
            simulationReport.Status     = wip.ActionResult;
            if (isNG == true)
            {
                simulationReport.NGTimes = simulationReport.NGTimes - 1;
            }
            simulationReport.IsComplete = FormatHelper.BooleanToString(false);
            //simulationReport.RunningCardSequence = wip.RunningCardSequence;		// 保留测试信息
            dataCollectFacade.UpdateSimulationReport(simulationReport);
        }
예제 #3
0
        protected void cmdScrap_ServerClick(object sender, System.EventArgs e)
        {
            ArrayList selected = this.gridHelper.GetCheckedRows();

            string rcard  = string.Empty;
            string mocode = this.txtMoCodeQuery.Text.Trim();

            this.DataProvider.BeginTransaction();
            try
            {
                SimulationReport  simulationReport;
                DataCollectFacade dcf             = new DataCollectFacade(this.DataProvider);
                InventoryFacade   inventoryFacade = new InventoryFacade(this.DataProvider);
                DBDateTime        currentDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

                foreach (GridRecord row in selected)
                {
                    rcard            = row.Items.FindItemByKey("RunningCard").Value.ToString();
                    simulationReport = dcf.GetLastSimulationReport(rcard);

                    if (simulationReport == null)
                    {
                        throw new Exception("$NoProductInfo $CS_Param_ID=" + rcard);
                    }

                    if (simulationReport.IsComplete == "1")
                    {
                        throw new Exception("$CS_ERROR_PRODUCT_ALREADY_COMPLETE $CS_Param_ID=" + rcard);
                    }

                    //在库不能拆解
                    object[] stackToRcards = inventoryFacade.QueryStacktoRcardByRcardAndCarton(simulationReport.RunningCard, simulationReport.CartonCode);

                    if (stackToRcards != null)
                    {
                        throw new Exception("$CS_ERROR_PRODUCT_ALREADY_IN_Storge $CS_Param_ID=" + rcard);
                    }
                    //end

                    this._MOFacade.DoScrap(simulationReport, currentDateTime, this.GetUserCode());

                    //拆Carton和栈板
                    Messages msg = new Messages();
                    msg.AddMessages(dcf.RemoveFromCarton(simulationReport.RunningCard, this.GetUserCode()));
                    msg.AddMessages(dcf.RemoveFromPallet(simulationReport.RunningCard, this.GetUserCode(), true));
                }

                this.DataProvider.CommitTransaction();

                this.gridHelper.RequestData();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                ExceptionManager.Raise(this.GetType(), "$Error_RCardScrapError", ex);
            }
        }
예제 #4
0
        //Process Running Card
        private void ProcessRCard(string rcard)
        {
            //根据当前序列号获取最新序列号
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            OQCFacade         _OQCFacade        = new OQCFacade(this.DataProvider);
            string            sourceRCard       = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty);

            object objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourceRCard);

            if (objSimulationReport != null)
            {
                // Added By hi1/venus.Feng on 20081127 for Hisense Version : 如果没有Carton信息,则不能进行移转

                if (string.IsNullOrEmpty((objSimulationReport as Domain.DataCollect.SimulationReport).CartonCode))
                {
                    ClearRCardInfo();
                    ucMessage.Add(new UserControl.Message(MessageType.Error
                                                          , "$Error_RCardNoCartonInfo $CS_Param_ID =" + rcard));
                    txtRCard.TextFocus(true, true);
                }
                else
                {
                    //add by andy xin 判断包装转移判断RCARD是否在TBLLOT2CARD中有
                    object lot2Card = _OQCFacade.GetOQCLot2Card((objSimulationReport as Domain.DataCollect.SimulationReport).RunningCard, (objSimulationReport as Domain.DataCollect.SimulationReport).MOCode, "", "");
                    if (lot2Card != null)
                    {
                        OQCLot oqcLot = _OQCFacade.GetOQCLot((lot2Card as OQCLot2Card).LOTNO, OQCFacade.Lot_Sequence_Default) as OQCLot;
                        if (!(oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting ||
                              oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing))
                        {
                            ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_In_OQC"));
                            this.txtRCard.TextFocus(true, true);
                            return;
                        }
                    }


                    DisplayRCardInfo(objSimulationReport as Domain.DataCollect.SimulationReport);
                }
                // End Added
            }
            else
            {
                ClearRCardInfo();
                ucMessage.Add(new UserControl.Message(MessageType.Error
                                                      , "$NoSimulation $CS_Param_ID =" + rcard));
                txtRCard.TextFocus(true, true);
            }
        }
예제 #5
0
        private Domain.TS.TS GetNewTS(string runningCard, string partItemCode, string partRunningCard, string userCode)
        {
            SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider);
            ShiftModelFacade    shiftModelFacade    = new ShiftModelFacade(this.DataProvider);
            ModelFacade         modelFacade         = new ModelFacade(this.DataProvider);
            TSFacade            tsFacade            = new TSFacade(this.DataProvider);
            DataCollectFacade   dataCollectFacade   = new DataCollectFacade(this.DataProvider);

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

            DBDateTime       dbDateTime     = FormatHelper.GetNowDBDateTime(this.DataProvider);
            SimulationReport lastSimulation = dataCollectFacade.GetLastSimulationReport(sourceRCard);

            if (lastSimulation == null)
            {
                return(null);
            }

            Domain.TS.TS newTS = tsFacade.CreateNewTS();

            newTS.TSId                  = Guid.NewGuid().ToString();
            newTS.RunningCard           = partRunningCard;
            newTS.RunningCardSequence   = dataCollectFacade.GetMaxRCardSequenceFromTS(partRunningCard) + 100;
            newTS.TranslateCard         = partRunningCard;
            newTS.TranslateCardSequence = newTS.RunningCardSequence;
            newTS.SourceCard            = partRunningCard;
            newTS.SourceCardSequence    = newTS.RunningCardSequence;
            newTS.CardType              = CardType.CardType_Part;
            newTS.ReplacedRunningCard   = " ";

            newTS.ItemCode = partItemCode;
            Model model = (Model)modelFacade.GetModelByItemCode(partItemCode);

            if (model == null)
            {
                Parameter parameter = (Parameter)systemSettingFacade.GetParameter("PING", "DEFAULT_MODEL_CODE");
                if (parameter != null)
                {
                    newTS.ModelCode = parameter.ParameterAlias.Trim().ToUpper();
                }
            }
            else
            {
                newTS.ModelCode = model.ModelCode;
            }

            newTS.MOCode               = lastSimulation.MOCode;
            newTS.FromRouteCode        = lastSimulation.RouteCode;
            newTS.FromOPCode           = lastSimulation.OPCode;
            newTS.FromResourceCode     = lastSimulation.ResourceCode;
            newTS.FromSegmentCode      = lastSimulation.SegmentCode;
            newTS.FromStepSequenceCode = lastSimulation.StepSequenceCode;
            newTS.FromShiftTypeCode    = lastSimulation.ShiftTypeCode;
            newTS.MOSeq = lastSimulation.MOSeq;

            TimePeriod tp = (TimePeriod)shiftModelFacade.GetTimePeriod(newTS.FromShiftTypeCode, dbDateTime.DBTime);

            if (tp != null)
            {
                newTS.FromTimePeriodCode = tp.TimePeriodCode;
                newTS.FromShiftCode      = tp.ShiftCode;
                newTS.FromShiftDay       = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime);
            }

            newTS.FromUser = userCode;
            newTS.FromDate = dbDateTime.DBDate;
            newTS.FormTime = dbDateTime.DBTime;

            newTS.MaintainUser = userCode;
            newTS.MaintainDate = dbDateTime.DBDate;
            newTS.MaintainTime = dbDateTime.DBTime;

            newTS.TSTimes           = tsFacade.GetMaxTSTimes(partRunningCard) + 1;
            newTS.FromInputType     = TSSource.TSSource_TS;
            newTS.TSStatus          = TSStatus.TSStatus_New;
            newTS.TransactionStatus = TransactionStatus.TransactionStatus_NO;

            return(newTS);
        }
예제 #6
0
        /// <summary>
        /// 序列号转换采集,只支持分板,不支持合板
        /// </summary>
        /// <param name="domainDataProvider"></param>
        /// <param name="iD"></param>
        /// <param name="actionType"></param>
        /// <param name="resourceCode"></param>
        /// <param name="userCode"></param>
        /// <param name="product"></param>
        /// <param name="datas1">转换后的ID组</param>
        /// <param name="datas2">NULL</param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            // Added by Icyer 2006/10/08
            if (((SplitIDActionEventArgs)actionEventArgs).IsUndo == true)
            {
                return(this.UndoExecute((SplitIDActionEventArgs)actionEventArgs));
            }
            // Added end

            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((SplitIDActionEventArgs)actionEventArgs).SplitedIDs == null || ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length == 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                ActionOnLineHelper helper            = new ActionOnLineHelper(this.DataProvider);
                DataCollectFacade  dataCollectFacade = new DataCollectFacade(this.DataProvider);

                //laura:  GetLastSimulation into NowSimulation
                string sourcCard = actionEventArgs.ProductInfo.LastSimulation.RunningCard.ToUpper();

                //GetLastSimulation 是获取当前open工单中的一笔,GetSimulation 是获取所有simulation中mdate 最晚的一笔。
                Simulation objSimulation = dataCollectFacade.GetSimulation(sourcCard) as Simulation;
                if (objSimulation == null)
                {
                    throw new Exception("rcard in simulation not existed!");
                }
                actionEventArgs.ProductInfo.NowSimulation = objSimulation;

                //laura:  GetLastSimulationReport into NowSimulationReport
                SimulationReport objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourcCard) as SimulationReport;
                if (objSimulationReport == null)
                {
                    throw new Exception("rcard in simulationreport not existed!");
                }
                actionEventArgs.ProductInfo.NowSimulationReport = objSimulationReport;

                //laura:  如果需要,补充 ProductInfo 信息
                //to-do...

                //
                actionEventArgs.ProductInfo.NowSimulation.IDMergeRule           = 1; //actionEventArgs.ProductInfo.NowSimulation.IDMergeRule/((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length;
                actionEventArgs.ProductInfo.NowSimulation.TranslateCard         = actionEventArgs.ProductInfo.LastSimulation.RunningCard;
                actionEventArgs.ProductInfo.NowSimulation.TranslateCardSequence = actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence;
                actionEventArgs.ProductInfo.NowSimulation.NGTimes = actionEventArgs.ProductInfo.LastSimulation.NGTimes;

                for (int i = 0; i < ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length; i++)
                {
                    //修改SIMULATION
                    //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                    //暂时不考虑线外工序
                    if (actionEventArgs.ProductInfo.NowSimulation.RouteCode != "" && dataCollectFacade.OPIsMORouteLastOP(
                            actionEventArgs.ProductInfo.NowSimulation.MOCode
                            , actionEventArgs.ProductInfo.NowSimulation.RouteCode
                            , actionEventArgs.ProductInfo.NowSimulation.OPCode))
                    {
                        actionEventArgs.ProductInfo.NowSimulation.IsComplete  = "1";
                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                    }
                    //End Laws Lu
                    actionEventArgs.ProductInfo.NowSimulation.RunningCard = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString();
                    /* added by jessie lee,如果是 序列号转换 */
                    if (string.Compare((actionEventArgs as SplitIDActionEventArgs).IDMergeType, IDMergeType.IDMERGETYPE_IDMERGE, true) == 0)
                    {
                        /* 转换到同一张工单 */
                        if ((actionEventArgs as SplitIDActionEventArgs).UpdateSimulation)
                        {
                            actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence
                                = (actionEventArgs as SplitIDActionEventArgs).ExistIMEISeq + 10;
                        }
                        else
                        {
                            actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                        }
                    }
                    else
                    {
                        /* 不是 序列号转换 */
                        actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                    }
                    actionEventArgs.ProductInfo.NowSimulation.MOSeq = actionEventArgs.ProductInfo.LastSimulation.MOSeq;     // Added by Icyer 2007/07/03

                    //messages.AddMessages(helper.Execute(actionEventArgs));
                    //messages.AddMessages(helper.Execute(actionEventArgs, true,false));  //线外工序,不用 insert tblonwip。

                    if (messages.IsSuccess())
                    {
                        //#region 将ID添加到MO2RCARDLINK范围表内
                        DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                        //MOFacade _MOFacade = new MOFacade(this.DataProvider);
                        //MO2RCARDLINK mo2cardlink = new MO2RCARDLINK();
                        //mo2cardlink.MOCode = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        //mo2cardlink.RCard = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                        //mo2cardlink.MDate = dbDateTime.DBDate;
                        //mo2cardlink.MUser = actionEventArgs.UserCode;
                        //mo2cardlink.MTime = dbDateTime.DBTime;
                        //mo2cardlink.PrintTimes = 0;
                        //mo2cardlink.LastPrintUSER = "";
                        //mo2cardlink.LastPrintDate = 0;
                        //mo2cardlink.LastPrintTime = 0;
                        //_MOFacade.AddMO2RCardLink(mo2cardlink);
                        //#endregion

                        #region 将ID添加到SplitBoard
                        SplitBoard splitBorad = new SplitBoard();
                        splitBorad.Seq           = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                        splitBorad.Mocode        = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        splitBorad.Rcard         = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                        splitBorad.Modelcode     = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                        splitBorad.Itemcode      = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                        splitBorad.Opcode        = actionEventArgs.ProductInfo.NowSimulation.OPCode;
                        splitBorad.Rescode       = actionEventArgs.ResourceCode;
                        splitBorad.Routecode     = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
                        splitBorad.Scard         = actionEventArgs.ProductInfo.NowSimulation.SourceCard;
                        splitBorad.Segcode       = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                        splitBorad.Shiftcode     = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                        splitBorad.Shifttypecode = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                        splitBorad.Sscode        = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                        splitBorad.Tpcode        = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                        splitBorad.Muser         = actionEventArgs.UserCode;
                        splitBorad.Mdate         = dbDateTime.DBDate;
                        splitBorad.Mtime         = dbDateTime.DBTime;
                        dataCollectFacade.AddSplitBoard(splitBorad);
                        #endregion
                    }
                }
                //}
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
예제 #7
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);
            }
        }
예제 #8
0
        /// <summary>
        /// 维修完成
        /// </summary>
        /// <param name="actionEventArgs"></param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //检查res在不在OPTS中
                // Modified By Hi1/Venus.Feng on 20080711 for Hisense Version : 对于自动作Reflow的动作来讲,不再Check Resource是否在回流的工序中
                if (((TSActionEventArgs)actionEventArgs).IgnoreResourceInOPTS != true)
                {
                    messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs));
                }
                // End Modified

                if (messages.IsSuccess())
                {
                    TSFacade tsFacade = new TSFacade(this.DataProvider);
                    //					if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard))
                    //					{
                    //						messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS"));
                    //					}
                    //					if(messages.IsSuccess())
                    //					{

                    //Laws Lu,2005/09/16,修改	逻辑调整P4.8
                    object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard);



                    if (obj == null)
                    {
                        messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS"));
                        //messages.Add(new Message(MessageType.Error,"$CSError_Card_TSStatus_IsNot_TS"));
                    }
                    else
                    {
                        Domain.TS.TS ts = (Domain.TS.TS)obj;



                        if (ts.TSStatus == TSStatus.TSStatus_Scrap ||
                            ts.TSStatus == TSStatus.TSStatus_Split ||
                            ts.TSStatus == TSStatus.TSStatus_Reflow ||
                            ts.TSStatus == TSStatus.TSStatus_Confirm)
                        {
                            messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                        }


                        if (messages.IsSuccess())
                        {
                            //2006/11/17,Laws Lu add get DateTime from db Server
                            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                            DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);

                            //修改 Karron Qiu,2005-9-26
                            if (ts.FromInputType == TS.TSFacade.TSSource_OnWIP)//线上.必须是回流或者报废
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Please_Select_Reflow_OR_Scrap"));//请选择回流或者报废
                                }
                            }
                            else if (ts.FromInputType == TS.TSFacade.TSSource_TS)//离线. 不能回流
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Offline_Cannot_Reflow"));//离线不能回流
                                }
                            }
                            else if (ts.FromInputType == TS.TSFacade.TSSource_RMA)//RMA. 不能回流
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_RMATS_Cannot_Reflow"));//RMA不能回流
                                }
                            }



                            //Laws Lu,2005/11/09,新增	记录ShiftDay
                            BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider);
                            Domain.BaseSetting.Resource res       = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode);
                            //onwip.SegmentCode				= productInfo.NowSimulationReport.SegmentCode;

                            BaseSetting.ShiftModelFacade  shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider);
                            Domain.BaseSetting.TimePeriod period     = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow));

                            int shiftDay = 0;
                            if (period == null)
                            {
                                throw new Exception("$OutOfPerid");
                            }

                            if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING)
                            {
                                if (period.TimePeriodBeginTime < period.TimePeriodEndTime)
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else if (Web.Helper.FormatHelper.TOTimeInt(dtNow) < period.TimePeriodBeginTime)
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow);
                                }
                            }
                            else
                            {
                                shiftDay = FormatHelper.TODateInt(dtNow);
                            }

                            #region 报废
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Scrap)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS || ts.TSStatus == TSStatus.TSStatus_Confirm)
                                {
                                    ts.TSStatus       = TSStatus.TSStatus_Scrap;
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;
                                    ts.TSUser         = actionEventArgs.UserCode;

                                    ts.TSDate = shiftDay;
                                    ts.TSTime = FormatHelper.TOTimeInt(dtNow);

                                    //added by jessie lee, 2005/11/24,
                                    //新增报废原因
                                    ts.ScrapCause   = (actionEventArgs as TSActionEventArgs).ScrapCause;
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.MaintainDate = ts.TSDate;
                                    ts.MaintainTime = ts.TSTime;

                                    //TODO:Laws Lu,2005/11/09,需要优化
                                    tsFacade.UpdateTS(ts);

                                    //added by alex,2010/11/09
                                    BenQGuru.eMES.OQC.OQCFacade oqcFacade = new BenQGuru.eMES.OQC.OQCFacade(this.DataProvider);
                                    OQCLot2Card oqcLot2Card = oqcFacade.GetLastOQCLot2CardByRCard(actionEventArgs.RunningCard) as OQCLot2Card;
                                    if (oqcLot2Card != null)
                                    {
                                        oqcLot2Card.Status = "SCRAP";
                                        oqcFacade.UpdateOQCLot2Card(oqcLot2Card);
                                    }

                                    MOFacade moFAC = new MOFacade(this._domainDataProvider);

                                    if (ts.FromInputType == TSFacade.TSSource_OnWIP)
                                    {
                                        //Laws Lu,2005/08/19,新增
                                        //Laws Lu,2005/08/25,修改	处理报废时,更新工单的报废数量
                                        doAction(actionEventArgs);
                                    }
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS_OR_Confirm"));
                                }
                            }
                            #endregion

                            #region 完成
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS)
                                {
                                    ts.TSStatus = TSStatus.TSStatus_Complete;

                                    ts.TSTimes = 1;

                                    //added by jessie lee, 2005/11/24,
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.TSUser       = actionEventArgs.UserCode;
                                    ts.MaintainDate = FormatHelper.TODateInt(dtNow);
                                    ts.MaintainTime = FormatHelper.TOTimeInt(dtNow);
                                    //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode
                                    ts.TSDate         = shiftDay;
                                    ts.TSTime         = FormatHelper.TOTimeInt(dtNow);
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;


                                    tsFacade.UpdateTS(ts);

                                    // Added by Icyer 2006/11/07, KeyPart维修完成
                                    if (ts.CardType == CardType.CardType_Part && ts.FromInputType == TSFacade.TSSource_TS)
                                    {
                                        DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                                        SimulationReport  simRpt            = dataCollectFacade.GetLastSimulationReport(ts.RunningCard);
                                        if (simRpt != null && simRpt.Status == ProductStatus.NG)
                                        {
                                            simRpt.Status = ProductStatus.GOOD;
                                            dataCollectFacade.UpdateSimulationReport(simRpt);
                                        }
                                    }
                                    // Added end
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                                }
                            }
                            #endregion

                            #region 回流
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS)
                                {
                                    ts.TSStatus     = TSStatus.TSStatus_Reflow;
                                    ts.ReflowMOCode = ((TSActionEventArgs)actionEventArgs).MOCode;
                                    //ts.ReflowResourceCode = ((TSActionEventArgs)actionEventArgs).ItemCode ;
                                    ts.ReflowRouteCode = ((TSActionEventArgs)actionEventArgs).RouteCode;
                                    ts.ReflowOPCode    = ((TSActionEventArgs)actionEventArgs).OPCode;

                                    //added by jessie lee, 2005/11/24,
                                    //added by jessie lee, 2005/11/24,
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.TSUser       = actionEventArgs.UserCode;
                                    ts.MaintainDate = FormatHelper.TODateInt(dtNow);
                                    ts.MaintainTime = FormatHelper.TOTimeInt(dtNow);

                                    //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode
                                    ts.TSDate         = shiftDay;
                                    ts.TSTime         = FormatHelper.TOTimeInt(dtNow);
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;

                                    tsFacade.UpdateTSReflowStatus(ts);
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
예제 #9
0
        private void ucBtnOK_Click(object sender, System.EventArgs e)
        {
            if (this.ucLERunningCard.Value.Trim() == string.Empty)
            {
                //Laws Lu,2005/08/11,新增焦点设置
                ucLERunningCard.TextFocus(true, true);
                return;
            }

            this.ucMessage.Add(string.Format("<< {0}", this.ucLERunningCard.Value.Trim().ToUpper()));

            // 输入分板前产品序列号
            if (this._currSequence == 0)
            {
                #region 工单、序列号匹配
                _runningCardList = new ArrayList();

                if (this.txtMoCode.Checked)
                {
                    if (string.IsNullOrEmpty(txtMoCode.Value.ToUpper().Trim()))
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_MOCode"));
                        this.ucLERunningCard.Value = "";

                        //Laws Lu,2005/08/11,新增焦点设置
                        txtMoCode.Focus();
                        return;
                    }
                }

                //Laws Lu,2005/10/19,新增	缓解性能问题
                //Laws Lu,2006/12/25 修改	减少Open/Close的次数
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true;
                //added by jessie lee, 2005/11/29
                #region 判断转换前序列号是否符合条件
                //长度检查
                if (bCardTransLenULE.Checked)
                {
                    if (bCardTransLenULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int len = 0;
                    try
                    {
                        len = int.Parse(bCardTransLenULE.Value.Trim());
                    }
                    catch
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_BeforeCardTransLen_Should_be_Integer"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (len != this.ucLERunningCard.Value.Trim().Length)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_BeforeCardTransLen_Not_Correct"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }

                //首字符串检查
                if (bCardTransLetterULE.Checked)
                {
                    if (bCardTransLetterULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_FLetter_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int index = ucLERunningCard.Value.Trim().IndexOf(bCardTransLetterULE.Value.Trim());
                    if (index != 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Transfer_FLetter_NotCompare"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }
                #endregion

                #region 取得分板比例,从工单和SMT是否是打叉板得到分板比例,若不是,带出工单的分版比例

                simReport = _DataCollectFacade.GetLastSimulationReport(this.ucLERunningCard.Value.Trim().ToUpper());
                if (simReport == null)
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_ID_Not_Exist"));
                    this.ucLERunningCard.Value = "";
                    this.ucLERunningCard.TextFocus(true, true);
                    return;
                }
                else
                {
                    if (simReport.IsComplete != "1")
                    {
                        //完工后才可以分板,故注释。
                        //主要应用于以下业务情况:
                        //序列号 s1 通过两张工单 mo1, mo2 完成。s1 经过第一张工单 mo1 完工后,需要进行分板 s1--> s1-1, s1-2,
                        //分板后再用 s1-1, s1-2 进行第二张工单 mo2 的归属生产。
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_NO_COMPLETE"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (txtMoCode.Checked)
                    {
                        if (string.Compare(txtMoCode.Value.ToUpper().Trim(), simReport.MOCode, true) != 0)
                        {
                            this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$RCARD_NOT_IN_MO"));
                            ucLERunningCard.TextFocus(true, true);
                            return;
                        }
                    }

                    int rcardCount = _DataCollectFacade.GetSplitBoardCount(this.ucLERunningCard.Value.Trim().ToUpper());

                    if (rcardCount > 0)
                    {
                        //已经分板的序列号就不可以在分了
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_SPLITE"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }


                SMTFacade smtFacade = new SMTFacade(this.DataProvider);
                object    objsmtrel = smtFacade.GetSMTRelationQty(this.ucLERunningCard.Value.Trim().ToUpper(), simReport.MOCode);
                if (objsmtrel != null)
                {
                    Smtrelationqty smtrel = (Smtrelationqty)objsmtrel;
                    this.txtIDMergeValue.Text = Convert.ToString(smtrel.Relationqtry);
                }
                else
                {
                    MOFacade mofacade = new MOFacade(this.DataProvider);
                    object   objMO    = mofacade.GetMO(simReport.MOCode);
                    if (objMO != null)
                    {
                        MO mo = (MO)objMO;
                        this.txtIDMergeValue.Text = Convert.ToString(mo.IDMergeRule);
                    }
                    else
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_MO_Not_Exit"));
                        txtMoCode.Focus();
                        txtMoCode.SelectAll();
                        return;
                    }
                }
                #endregion

                #region 判断分板前序列号是否存在


                int mergeRule = 1;
                try
                {
                    mergeRule = System.Int32.Parse(this.txtIDMergeValue.Text.ToUpper().Trim());
                }
                catch
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_IDMerge_Should_be_Integer"));//分板比例必须为整数
                    //Laws Lu,2005/08/11,新增焦点设置
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }

                if (mergeRule <= 0)
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_IDMerge_Should_Over_Zero"));//分板比例必须大于零
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }
                this._mergeRule = mergeRule;
                #endregion

                #endregion
            }
            else
            {
                //added by jessie lee, 2005/11/29
                #region 判断转换后序列号是否符合条件
                //长度检查
                if (aCardTransLenULE.Checked)
                {
                    if (aCardTransLenULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int len = 0;
                    try
                    {
                        len = int.Parse(aCardTransLenULE.Value.Trim());
                    }
                    catch
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_AfterCardTransLen_Should_be_Integer"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    if (len != this.ucLERunningCard.Value.Trim().Length)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_AfterCardTransLen_Not_Correct"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }

                //首字符串检查
                if (aCardTransLetterULE.Checked)
                {
                    if (aCardTransLetterULE.Value.Trim().Length == 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_FLetter_Empty"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }

                    int index = ucLERunningCard.Value.Trim().IndexOf(aCardTransLetterULE.Value.Trim());
                    if (index != 0)
                    {
                        this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_After_Card_Transfer_FLetter_NotCompare"));
                        ucLERunningCard.TextFocus(true, true);
                        return;
                    }
                }
                #endregion

                #region 判断分板后序列号是否重复
                if (this._runningCardList.Contains(this.ucLERunningCard.Value.Trim().ToUpper()))
                {
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$Error_CS_Merge_ID_Exist"));//转换后产品序列号重复
                    this.ucLERunningCard.Value = "";

                    //Laws Lu,2005/08/11,新增焦点设置
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }
                #endregion


                int rcardCount = _DataCollectFacade.GetSplitBoardCount(this.ucLERunningCard.Value.Trim().ToUpper());

                if (rcardCount > 0)
                {
                    //已经分板的序列号就不可以在分了
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_SPLITE"));
                    this.ucMessage.AddBoldText(string.Format(">>$CS_Please_Input_Merge_ID {0}/{1}", this._currSequence.ToString(), this._mergeRule.ToString()));//请输入转换后产品序列号
                    ucLERunningCard.TextFocus(true, true);
                    return;
                }


                this._runningCardList.Add(this.ucLERunningCard.Value.Trim().ToUpper());
            }

            if (this._currSequence < this._mergeRule)
            {
                this._currSequence++;

                this.txtIDMergeValue.Enabled = false;
                this.ucMessage.AddBoldText(string.Format(">>$CS_Please_Input_Merge_ID {0}/{1}", this._currSequence.ToString(), this._mergeRule.ToString())); //请输入转换后产品序列号
            }
            else if (this._currSequence == this._mergeRule)                                                                                                  // 达到分板比例,写入数据库
            {
                try
                {
                    this.DataProvider.BeginTransaction();
                    int        tempCount  = 1;
                    DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                    foreach (string strRcard in _runningCardList)
                    {
                        #region 将ID添加到SplitBoard
                        SplitBoard splitBorad = new SplitBoard();
                        splitBorad.Seq           = tempCount;
                        splitBorad.Mocode        = simReport.MOCode;
                        splitBorad.Rcard         = strRcard;
                        splitBorad.Modelcode     = simReport.ModelCode;
                        splitBorad.Itemcode      = simReport.ItemCode;
                        splitBorad.Opcode        = simReport.OPCode;
                        splitBorad.Rescode       = ApplicationService.Current().ResourceCode;
                        splitBorad.Routecode     = simReport.RouteCode;
                        splitBorad.Scard         = simReport.SourceCard;
                        splitBorad.Segcode       = simReport.SegmentCode;
                        splitBorad.Shiftcode     = simReport.ShiftCode;
                        splitBorad.Shifttypecode = simReport.ShiftTypeCode;
                        splitBorad.Sscode        = simReport.StepSequenceCode;
                        splitBorad.Tpcode        = simReport.TimePeriodCode;
                        splitBorad.Muser         = ApplicationService.Current().UserCode;
                        splitBorad.Mdate         = dbDateTime.DBDate;
                        splitBorad.Mtime         = dbDateTime.DBTime;
                        _DataCollectFacade.AddSplitBoard(splitBorad);
                        tempCount++;
                        #endregion
                    }
                    this.DataProvider.CommitTransaction();

                    this.ucMessage.Add(new UserControl.Message(MessageType.Success, ">>$CS_SplitID_CollectSuccess"));//产品序列号转换采集成功
                    //added by jessie lee, 2005/11/29,
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    this.ucMessage.Add(new UserControl.Message(MessageType.Error, ">>$CS_SplitID_CollectSuccess"));//产品序列号转换采集成功
                }


                this.initInput();
            }

            this.ucLERunningCard.Value = "";

            //Laws Lu,2005/08/11,新增焦点设置
            if (!aCardTransLetterULE.Checked)
            {
                ucLERunningCard.TextFocus(true, true);
            }
            else
            {
                ucLERunningCard.TextFocus(true, true);
            }
        }
예제 #10
0
        //check for carton capacity if overload
        private bool CheckTargetCarton(string tagCarton)
        {
            bool bResult = true;

            m_NeedAddNewCarton = false;
            object obj = (new Package.PackageFacade(DataProvider)).GetCARTONINFO(tagCarton);

            if (tagCarton == txtCurrentCarton.Value.ToUpper().Trim())
            {
                ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_TAG_CARTON_EQUAL_CUR_CARTON $CS_CARTON_NO =" + tagCarton));
                bResult = false;
            }

            #region OQC检验
            //Added by lisa@2012-8-29
            //检查目标小箱是否已经在OQC处理过程中
            OQCFacade  _OQCFacade   = new OQCFacade(this.DataProvider);
            Lot2Carton lot2carton   = _OQCFacade.GetLot2CartonByCartonNo(tagCarton) as Lot2Carton;
            OQCLot     oqcCartonLot = null;
            if (lot2carton != null)
            {
                oqcCartonLot = _OQCFacade.GetOQCLot(lot2carton.OQCLot, OQCFacade.Lot_Sequence_Default) as OQCLot;
                if (oqcCartonLot != null && !(oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting ||
                                              oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing))
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_In_OQC"));
                    this.txtRCard.TextFocus(false, true);
                    return(false);
                }
            }

            //检查当前Rcard所在箱和目标箱的OQC状态是否一致,或者都不在OQC中,或者都是OQC判过,或者都是OQC判退
            DataCollectFacade dataCollectFacade   = new DataCollectFacade(this.DataProvider);
            string            sourceRCard         = dataCollectFacade.GetSourceCard(txtRCard.Value.Trim().ToUpper(), string.Empty);
            object            objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourceRCard);
            string            currentlotno        = (objSimulationReport as Domain.DataCollect.SimulationReport).LOTNO;

            OQCLot oqcRcardLot = null;

            if (!string.IsNullOrEmpty(currentlotno))
            {
                oqcRcardLot = _OQCFacade.GetOQCLot(currentlotno.Trim(), OQCFacade.Lot_Sequence_Default) as OQCLot;
            }

            if (!(oqcCartonLot == null && oqcRcardLot == null))
            {
                if (oqcCartonLot == null)
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_CARTON_OQC_NOT_SAME"));
                    this.txtRCard.TextFocus(false, true);
                    return(false);
                }
                if (oqcRcardLot == null)
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_CARTON_OQC_NOT_SAME"));
                    this.txtRCard.TextFocus(false, true);
                    return(false);
                }
                if (oqcCartonLot.LOTStatus != oqcRcardLot.LOTStatus)
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_CARTON_OQC_NOT_SAME"));
                    this.txtRCard.TextFocus(false, true);
                    return(false);
                }
            }

            #endregion

            if (obj == null)
            {
                //ucMessage.Add(new UserControl.Message(MessageType.Error,"$CS_CARTON_NOT_EXIST $CS_CARTON_NO =" + tagCarton));
                bResult            = false;
                m_NeedAddNewCarton = true;
            }
            else
            {
                Domain.Package.CARTONINFO carton = obj as Domain.Package.CARTONINFO;
                if (carton.COLLECTED >= carton.CAPACITY)
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FILL_OUT $CS_CARTON_NO =" + tagCarton));
                    bResult = false;
                }
            }

            return(bResult);
        }
예제 #11
0
        //Process Carton NO
        private void ProcessCarton(string cartonno)
        {
            DataCollectFacade dcf   = new DataCollectFacade(DataProvider);
            string            rCard = txtRCard.Value.Trim().ToUpper();

            rCard = dcf.GetSourceCard(rCard, string.Empty);

            //箱号为空时,表示序列号从旧箱中移除
            if (cartonno == String.Empty)
            {
                #region RCARD 从 Carton中移出
                if (DialogResult.OK == MessageBox.Show(this, MutiLanguages.ParserString("$CS_Confirm_Transfer_1") + " " + txtRCard.Value.Trim().ToUpper() + " "
                                                       + MutiLanguages.ParserString("$CS_Confirm_Transfer_2") + txtCurrentCarton.Value.Trim().ToUpper() + " " + MutiLanguages.ParserString("$CS_Confirm_Transfer_3"), MutiLanguages.ParserString("$ShowConfirm"), MessageBoxButtons.OKCancel))
                {
                    InventoryFacade materialDCF = new InventoryFacade(DataProvider);

                    object objSimulationReport = dcf.GetLastSimulationReport(rCard);

                    //在制品存在
                    if (objSimulationReport != null)
                    {
                        Domain.DataCollect.SimulationReport sim = objSimulationReport as Domain.DataCollect.SimulationReport;

                        sim.CartonCode = String.Empty;
                        PackageFacade pf = new PackageFacade(DataProvider);

                        #region 移出操作
                        DataProvider.BeginTransaction();
                        try
                        {
                            dcf.RemoveFromCarton(sim.RunningCard, ApplicationService.Current().UserCode);
                            //dcf.RemoveFromPallet2RCard(sim.RunningCard);
                            DataProvider.CommitTransaction();

                            ucMessage.Add(new UserControl.Message(MessageType.Success
                                                                  , "$CS_RCARD_BREAK_FROM_CARTON_SUCCESS $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                            txtRCard.TextFocus(true, true);
                            txtCartonNO.Value = String.Empty;
                            ClearRCardInfo();
                        }
                        catch (Exception ex)
                        {
                            DataProvider.RollbackTransaction();
                            ucMessage.Add(new UserControl.Message(ex));

                            txtCartonNO.TextFocus(true, true);
                        }
                        finally
                        {
                            (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
                        }
                        #endregion
                    }
                    else//在制品不存在
                    {
                        ucMessage.Add(new UserControl.Message(MessageType.Error
                                                              , "$NoSimulation $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                        ClearRCardInfo();
                        txtRCard.TextFocus(true, true);
                    }
                }
                #endregion
            }
            else
            {
                #region RCARD 从当前Carton移转到另外一个Carton
                InventoryFacade materialDCF = new InventoryFacade(DataProvider);
                //ActionOnLineHelper onlineHelper = new ActionOnLineHelper(DataProvider);

                if (!CheckTargetCarton(cartonno))
                {
                    if (!m_NeedAddNewCarton)
                    {
                        txtCartonNO.TextFocus(true, true);
                        return;
                    }
                }
                string sourceCard          = dcf.GetSourceCard(txtRCard.Value.Trim().ToUpper(), string.Empty);
                object objSimulationReport = dcf.GetLastSimulationReport(sourceCard);

                if (objSimulationReport != null)
                {
                    Domain.DataCollect.SimulationReport simulationReport = objSimulationReport as Domain.DataCollect.SimulationReport;

                    simulationReport.CartonCode = cartonno.Trim().ToUpper();
                    Package.PackageFacade pf = new BenQGuru.eMES.Package.PackageFacade(DataProvider);

                    #region 移转操作
                    DataProvider.BeginTransaction();
                    try
                    {
                        //Add By Bernard @ 2010-11-01
                        string moCode           = txtMoCode.Value.Trim().ToUpper();
                        string oldCartonno      = txtCurrentCarton.Value.Trim().ToUpper();
                        bool   m_HasCartonAdded = false;
                        //end

                        //包装箱不存在,为CartonInfo表增加一个包装箱信息
                        if (m_NeedAddNewCarton)
                        {
                            DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                            BenQGuru.eMES.Domain.Package.CARTONINFO newCarton = new BenQGuru.eMES.Domain.Package.CARTONINFO();

                            newCarton.CARTONNO    = cartonno.Trim().ToUpper();
                            newCarton.CAPACITY    = ((new ItemFacade(DataProvider)).GetItem(simulationReport.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item).ItemCartonQty;
                            newCarton.COLLECTED   = 0;
                            newCarton.EATTRIBUTE1 = "";
                            newCarton.PKCARTONID  = System.Guid.NewGuid().ToString().ToUpper();
                            newCarton.MUSER       = ApplicationService.Current().UserCode;
                            newCarton.MDATE       = currentDateTime.DBDate;
                            newCarton.MTIME       = currentDateTime.DBTime;
                            pf.AddCARTONINFO(newCarton);

                            //0.向tblcarton2rcard表增加一个包装箱 Add By Bernard @ 2010-11-01
                            Carton2RCARD newCarton2RCard = new Carton2RCARD();
                            newCarton2RCard.CartonCode  = cartonno.Trim().ToUpper();
                            newCarton2RCard.Rcard       = rCard;
                            newCarton2RCard.MUser       = ApplicationService.Current().UserCode;
                            newCarton2RCard.MDate       = currentDateTime.DBDate;
                            newCarton2RCard.MTime       = currentDateTime.DBTime;
                            newCarton2RCard.Eattribute1 = "";
                            newCarton2RCard.MOCode      = moCode;
                            pf.AddCarton2RCARD(newCarton2RCard);
                            m_HasCartonAdded = true;
                            //end
                        }

                        //1.判断新箱与旧箱内产品工单代码是否一致 Add By Bernard @ 2010-11-01
                        object oldObj = pf.GetCarton2RCARD(oldCartonno, rCard);
                        //modified by lisa @20120829
                        //string newMOCode = moCode;
                        object[] newObj    = pf.GetCarton2RCARDByCartonNO(FormatHelper.CleanString(this.txtCartonNO.Value.Trim()));
                        string   newMOCode = ((Carton2RCARD)newObj[0]).MOCode;
                        //end add
                        string oldMOCode = ((Carton2RCARD)oldObj).MOCode;

                        if (oldMOCode == newMOCode)        //工单代码一致
                        {
                            if (m_HasCartonAdded == false) //箱号没有新增,则向Carton2RCard新增一条记录
                            {
                                DBDateTime   currentDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                                Carton2RCARD carton2rcard    = new Carton2RCARD();
                                carton2rcard.Rcard       = rCard;
                                carton2rcard.CartonCode  = cartonno;
                                carton2rcard.MOCode      = moCode;
                                carton2rcard.MUser       = ApplicationService.Current().UserCode;
                                carton2rcard.MDate       = currentDateTime.DBDate;
                                carton2rcard.MTime       = currentDateTime.DBTime;
                                carton2rcard.Eattribute1 = "";
                                pf.AddCarton2RCARD(carton2rcard);
                            }
                            //end

                            dcf.RemoveFromCarton(simulationReport.RunningCard, ApplicationService.Current().UserCode);

                            pf.UpdateCollected(cartonno.Trim().ToUpper());

                            Domain.DataCollect.Simulation simulation = (Domain.DataCollect.Simulation)dcf.GetSimulation(simulationReport.RunningCard);

                            if (simulation != null)
                            {
                                simulation.CartonCode = cartonno.Trim().ToUpper();
                                dcf.UpdateSimulation(simulation);
                            }

                            dcf.UpdateSimulationReport(simulationReport);

                            //记log
                            pf.addCarton2RCARDLog(cartonno, simulationReport.RunningCard, ApplicationService.Current().UserCode);
                            //end
                        }
                        else//新旧包装箱工单代码不一致 Add By Bernard @ 2010-11-01
                        {
                            if (m_HasCartonAdded == true)
                            {
                                //删除CartonInfo表新增加的包装箱
                                CARTONINFO cartoninfo = new CARTONINFO();
                                cartoninfo.CARTONNO = cartonno;
                                pf.DeleteCARTONINFO(cartoninfo);

                                //删除旧Carton2RCARD表新增加的箱号
                                Carton2RCARD carton2rcard = new Carton2RCARD();
                                carton2rcard.Rcard      = rCard;
                                carton2rcard.CartonCode = cartonno;
                                pf.DeleteCarton2RCARD(carton2rcard);
                            }
                            else
                            {
                                DataProvider.RollbackTransaction();
                                ucMessage.Add(new UserControl.Message(MessageType.Error,
                                                                      "$CS_CARTON_NO :" + cartonno + "$CS_Which_MOCode_With_RCard :" + rCard + "$CS_For_Carton_No's_MOCode_Is_Different"));
                                txtCartonNO.TextFocus(true, true);
                                return;
                            }
                        }
                        //end

                        DataProvider.CommitTransaction();

                        ucMessage.Add(new UserControl.Message(MessageType.Success
                                                              , "$CS_RCARD_TRANSFER_CARTON_SUCCESS $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                        txtRCard.TextFocus(true, true);
                        txtCartonNO.Value = String.Empty;
                        ClearRCardInfo();
                    }
                    catch (Exception ex)
                    {
                        DataProvider.RollbackTransaction();
                        ucMessage.Add(new UserControl.Message(ex));

                        txtCartonNO.TextFocus(true, true);
                    }
                    finally
                    {
                        (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection();
                    }
                    #endregion
                }
                else
                {
                    ucMessage.Add(new UserControl.Message(MessageType.Error, "$NoSimulation $CS_Param_ID =" + txtRCard.Value.Trim().ToUpper()));

                    ClearRCardInfo();
                    txtRCard.TextFocus(true, true);
                }

                #endregion
            }
        }
예제 #12
0
파일: FDown.cs 프로젝트: windygu/.net-wms
        private void ucLabelEditRcard_TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (string.IsNullOrEmpty(this.ucLabelEditDown.Value.Trim()))
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditDown.Value + ";" + this.ucLabelEditDown.Value,
                                                       new UserControl.Message(MessageType.Error, "$CS_PleaseInputDownReason"), false);
                    this.ucLabelEditDown.TextFocus(false, true);
                    return;
                }

                if (string.IsNullOrEmpty(this.ucLabelEditRcard.Value.Trim()))
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditRcard.Value + ";" + this.ucLabelEditRcard.Value,
                                                       new UserControl.Message(MessageType.Error, "$CS_PleaseInputID"), false);
                    this.ucLabelEditRcard.TextFocus(false, true);
                    return;
                }

                //检查事件号是否超出最大范围
                if (!this.CheckDownCodeLimits())
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, "" + ": " + this.ucLabelEditDownCode.Value,
                                                       new UserControl.Message(MessageType.Error, "$CS_DownCode_Out_Of_Limit"), true);
                    return;
                }


                if (_dataCollectFacade == null)
                {
                    _dataCollectFacade = new DataCollectFacade(this.DataProvider);
                }

                //清除序列号中的特殊字符
                string RunningCard = FormatHelper.CleanString(this.ucLabelEditRcard.Value.Trim().ToUpper());

                //根据当前序列号获取产品最原始的序列号
                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                string            sourceRCard       = dataCollectFacade.GetSourceCard(RunningCard, string.Empty);

                //判断序列号在生产信息中是否存在,同时获取rcard
                object objectRcard = _dataCollectFacade.GetRcardFromSimulationReport(sourceRCard);
                if (objectRcard == null)
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditRcard.Value + ";" + this.ucLabelEditRcard.Value,
                                                       new UserControl.Message(MessageType.Error, "$CS_RcardInput_Wrong $NoProductInfo"), false);
                    this.ucLabelEditRcard.TextFocus(false, true);
                    return;
                }

                //判断序列号在生产信息中是否存在,同时获取simulation
                object objectSimulationReport = _dataCollectFacade.GetLastSimulationReport(((SimulationReport)objectRcard).RunningCard.Trim().ToUpper());
                if (objectSimulationReport == null)
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditRcard.Value + ";" + this.ucLabelEditRcard.Value,
                                                       new UserControl.Message(MessageType.Error, "$CS_RcardInput_Wrong $NoProductInfo"), false);
                    this.ucLabelEditRcard.TextFocus(false, true);
                    return;
                }

                //判断序列号在此事件号中是否重负
                object objectDown = _dataCollectFacade.GetDown(FormatHelper.CleanString(this.ucLabelEditDownCode.Value.ToUpper()), ((SimulationReport)objectRcard).RunningCard.Trim().ToUpper());
                if (objectDown != null)
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditRcard.Value + ";" + this.ucLabelEditRcard.Value,
                                                       new UserControl.Message(MessageType.Error, "$Error_CS_ID_Already_Exist_INHERE"), false);
                    this.ucLabelEditRcard.TextFocus(false, true);
                    return;
                }

                //判断序列号在其他事件号中是否存在
                object[] objectDownList = _dataCollectFacade.QueryDownByRcard(((SimulationReport)objectRcard).RunningCard.Trim().ToUpper());
                if (objectDownList != null)
                {
                    for (int i = 0; i < objectDownList.Length; i++)
                    {
                        if (((Down)objectDownList[i]).DownCode != this.ucLabelEditDownCode.Value && ((Down)objectDownList[i]).DownStatus == DownStatus.DownStatus_Down)
                        {
                            ApplicationRun.GetInfoForm().AddEx(this._FunctionName, RunningCard + ";" + RunningCard,
                                                               new UserControl.Message(MessageType.Error, "$Error_CS_ID_Already_Exist_INOther :" + ((Down)objectDownList[0]).DownCode), false);
                            this.ucLabelEditRcard.TextFocus(false, true);
                            return;
                        }
                    }
                }

                //下地号与下地原因没有关系,新建下地号
                object[] objectDowns = _dataCollectFacade.QueryDown(FormatHelper.CleanString(this.ucLabelEditDownCode.Value.ToUpper()), FormatHelper.CleanString(this.ucLabelEditDown.Value.Trim().ToUpper()));
                if (objectDowns == null)
                {
                    this.ToCreateDownCode();
                }

                //检查事件号是否超出最大范围
                if (!this.CheckDownCodeLimits())
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, "" + ": " + this.ucLabelEditDownCode.Value,
                                                       new UserControl.Message(MessageType.Error, "$CS_DownCode_Out_Of_Limit"), true);
                    return;
                }

                BaseSetting.BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                object     objectRes     = baseModelFacade.GetResource(ApplicationService.Current().ResourceCode.ToUpper());
                string     SSCode        = ((Domain.BaseSetting.Resource)objectRes).StepSequenceCode;
                DBDateTime NowDBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

                this.DataProvider.BeginTransaction();
                try
                {
                    Down NewDown = _dataCollectFacade.CreateNewDown();

                    NewDown.DownCode      = FormatHelper.CleanString(this.ucLabelEditDownCode.Value.Trim());
                    NewDown.RCard         = ((SimulationReport)objectRcard).RunningCard.Trim().ToUpper();
                    NewDown.MOCode        = ((SimulationReport)objectSimulationReport).MOCode;
                    NewDown.ModelCode     = ((SimulationReport)objectSimulationReport).ModelCode;
                    NewDown.ItemCode      = ((SimulationReport)objectSimulationReport).ItemCode;
                    NewDown.SSCode        = SSCode.Trim().ToUpper();
                    NewDown.ResCode       = ApplicationService.Current().ResourceCode;
                    NewDown.DownStatus    = DownStatus.DownStatus_Down;
                    NewDown.DownReason    = FormatHelper.CleanString(this.ucLabelEditDown.Value.Trim());
                    NewDown.DownDate      = NowDBDateTime.DBDate;
                    NewDown.DownShiftDate = NowDBDateTime.DBDate;
                    NewDown.DownTime      = NowDBDateTime.DBTime;
                    NewDown.DownBy        = ApplicationService.Current().UserCode;
                    NewDown.UPReason      = string.Empty;
                    NewDown.ORGID         = GlobalVariables.CurrentOrganizations.First().OrganizationID;
                    NewDown.UPBY          = string.Empty;
                    NewDown.MaintainUser  = ApplicationService.Current().UserCode;
                    NewDown.MaintainDate  = NowDBDateTime.DBDate;
                    NewDown.MaintainTime  = NowDBDateTime.DBTime;
                    NewDown.EAttribute1   = string.Empty;

                    _dataCollectFacade.AddDown(NewDown);
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditRcard.Value + ";" + this.ucLabelEditRcard.Value,
                                                       new UserControl.Message(ex), false);
                }
                finally
                {
                    this.DataProvider.CommitTransaction();
                    this.ucLblEditNumber.Value = Convert.ToString(System.Int32.Parse(this.ucLblEditNumber.Value.Trim()) + 1);
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditRcard.Value + ";" + this.ucLabelEditRcard.Value,
                                                       new UserControl.Message(MessageType.Success, "$CS_DownIsSuccess $CS_Param_RunSeq:" + ((SimulationReport)objectRcard).RunningCard.Trim().ToUpper()), false);
                }
                //同步Grid
                this.QueryORUpdateGrid();
                this.ucLabelEditRcard.TextFocus(false, true);
            }
        }
예제 #13
0
        private void ucButtonOK_Click(object sender, EventArgs e)
        {
            //获取产品原始的序列号
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            sourceOldRCard    = dataCollectFacade.GetSourceCard(this.ucLabelEditOldRCard.Value.Trim().ToUpper(), string.Empty);
            string            sourceNewRCard    = dataCollectFacade.GetSourceCard(this.ucLabelEditNewRCard.Value.Trim().ToUpper(), string.Empty);

            //check OldRcard Is Empty
            if (string.IsNullOrEmpty(this.ucLabelEditOldRCard.Value.Trim()))
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditOldRCard.Value + ":" + this.ucLabelEditOldRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_OLDRCARD_ISNULL"), true);
                this.ucLabelEditOldRCard.TextFocus(true, true);
                return;
            }

            //Check OldRcard Is Exist in ProductInfo
            Object ObjectSimulationOld = dataCollectFacade.GetLastSimulationReport(FormatHelper.CleanString(sourceOldRCard.Trim().ToUpper()));

            if (ObjectSimulationOld == null)
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditOldRCard.Value + ":" + this.ucLabelEditOldRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_OLDRCARD_IS_NOT_EXIT"), true);
                this.ucLabelEditOldRCard.TextFocus(false, true);
                return;
            }

            //Check NewRcard Is Empty
            if (string.IsNullOrEmpty(this.ucLabelEditNewRCard.Value.Trim()))
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditNewRCard.Value + ":" + this.ucLabelEditNewRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_newIDisNull"), true);
                this.ucLabelEditNewRCard.TextFocus(false, true);
                return;
            }

            //Compare NewRcard and OldRcard Is  Same
            if (this.ucLabelEditNewRCard.Value.Trim() == this.ucLabelEditOldRCard.Value.Trim())
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditNewRCard.Value + ":" + this.ucLabelEditNewRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_SAMERCARD"), true);
                this.ucLabelEditNewRCard.TextFocus(false, true);
                return;
            }

            //Check OldRcard Is Not Exist in ProductInfo
            Object ObjectSimulationNew = dataCollectFacade.GetLastSimulationReport(FormatHelper.CleanString(sourceNewRCard.Trim().ToUpper()));

            if (ObjectSimulationNew != null)
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditNewRCard.Value + ":" + this.ucLabelEditNewRCard.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_NEWRCARD_IS_PRODUCTINFO"), true);
                this.ucLabelEditNewRCard.TextFocus(false, true);
                return;
            }

            //Check ChangeReason is Empty
            if (string.IsNullOrEmpty(this.ucLabelEditReason.Value.Trim()))
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.ucLabelEditReason.Value + ":" + this.ucLabelEditReason.Value,
                                                   new UserControl.Message(MessageType.Error, "$CS_INPUT_CHANGEREASON"), true);
                this.ucLabelEditReason.TextFocus(false, true);
                return;
            }

            BaseSetting.BaseModelFacade baseModelFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);

            string OldRcard      = FormatHelper.CleanString(this.ucLabelEditOldRCard.Value.Trim().ToUpper());
            string NewRcard      = FormatHelper.CleanString(this.ucLabelEditNewRCard.Value.Trim().ToUpper());
            string OutPutResoult = string.Empty;

            ProcedureCondition procedureCondition = new ProcedureCondition("CHANGERCARD",
                                                                           new ProcedureParameter[] {
                new ProcedureParameter("i_FromRCard", typeof(string), 40, DirectionType.Input, OldRcard),
                new ProcedureParameter("i_ToRCard", typeof(string), 40, DirectionType.Input, NewRcard),
                new ProcedureParameter("o_Result", typeof(string), 40, DirectionType.Output, OutPutResoult)
            });

            this.DataProvider.BeginTransaction();
            try
            {
                baseModelFacade.DoRCardChange(ref procedureCondition);

                if (procedureCondition.Parameters[2].Value.ToString().Length == 2)
                {
                    DBDateTime  DBDateTime     = FormatHelper.GetNowDBDateTime(this.DataProvider);
                    RCardChange NewRCardChange = baseModelFacade.CreateNewRCardChange();

                    NewRCardChange.RCardFrom    = OldRcard;
                    NewRCardChange.RCardTo      = NewRcard;
                    NewRCardChange.Reason       = FormatHelper.CleanString(this.ucLabelEditReason.Value.Trim());
                    NewRCardChange.MaintainUser = ApplicationService.Current().UserCode;
                    NewRCardChange.MaintainDate = DBDateTime.DBDate;
                    NewRCardChange.MaintainTime = DBDateTime.DBTime;
                    NewRCardChange.EAttribute1  = string.Empty;

                    baseModelFacade.AddRCardChange(NewRCardChange);

                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, procedureCondition.Parameters[2].Value.ToString(),
                                                       new UserControl.Message(MessageType.Success, "$CS_RCARDCHANGE_SUCCESS"), true);
                    this.ucLabelEditNewRCard.Value = string.Empty;
                    this.ucLabelEditReason.Value   = string.Empty;
                }
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, "", new UserControl.Message(ex), true);
            }
            finally
            {
                this.DataProvider.CommitTransaction();
            }

            if (procedureCondition.Parameters[2].Value.ToString().Length > 2)
            {
                ApplicationRun.GetInfoForm().AddEx(this._FunctionName, procedureCondition.Parameters[2].Value.ToString(),
                                                   new UserControl.Message(MessageType.Error, "$CS_RCARDCHANGE_WRONG"), true);
            }
            this.ucLabelEditOldRCard.TextFocus(false, true);
        }
예제 #14
0
        /// <summary>
        /// 成品入库检查
        /// </summary>
        /// <returns>true/false</returns>
        private bool CheckStackAndRcardInfo(string rcard, string stackCode, string itemCode, string palletCode, string companyCode, string storageCode)
        {
            DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);
            SimulationReport  report   = dcFacade.GetLastSimulationReport(rcard);

            if (report != null)
            {
                if (!report.ItemCode.Equals(itemCode))
                {
                    //Message:产品序列号所对应的物料与输入物料不对应
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PRODUCT_ITEM_NOT_SAME $ITEM_CODE=" + report.ItemCode));
                    return(false);
                }
            }


            ////Check从垛位使用状况的页面带过来的垛位和库位
            //if (!this.CheckSelecetedStackAndStorage(this.SelectedStorage, this.SelectedStack, Convert.ToString(this.ucLabelComboxINVType.SelectedItemValue)))
            //{
            //    return false;
            //}
            //else
            //{
            //Check序列号对应的料号是否和垛位的不一样
            InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);

            object[] objStackToRcards = inventoryFacade.GetAnyStack2RCardByStack(stackCode);

            if (objStackToRcards != null)
            {
                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(stackCode) && !((StackToRcard)objStackToRcards[0]).ItemCode.Equals(itemCode))
                {
                    //垛位的料号和当前产品的料号不一至
                    //ucMessage1.AddEx(this._FunctionName, this.opsetPackObject.CheckedItem.DisplayText + ": " + this.txtRCard.Value + ";料号:" + this.txtItemCode.Value, new UserControl.Message(MessageType.Error, "$CS_STACK_AND_PRODUCT_ITEM_NOT_SAME"), true);
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_AND_PRODUCT_ITEM_NOT_SAME $ITEM_CODE=" + itemCode));
                    return(false);
                }
            }

            //Check 序列号是否已经入过库
            object objStarckToRcard = inventoryFacade.GetStackToRcard(rcard);

            if (objStarckToRcard != null)
            {
                //序列号重复入库
                //ucMessage1.AddEx(this._FunctionName, "序列号" + ": " + this.txtRCard.Value, new UserControl.Message(MessageType.Error, "$CS_SERIAL_EXIST"), true);
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_SERIAL_EXIST $SERIAL_NO=" + rcard));
                return(false);
            }
            //}

            //Check 序列号是否已经在其他栈板上
            PackageFacade objPFFacade     = new PackageFacade(this.DataProvider);
            object        objPallet2RCard = objPFFacade.GetPallet2RCardByRCard(rcard);

            if (objPallet2RCard != null)
            {
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_RCARD_EXIST_IN_PALLET " + ((Pallet2RCard)objPallet2RCard).PalletCode));
                return(false);
            }

            //Check栈板(如果入栈板,而且栈板在系统中已经存在)的公司别,产品别和产品等级是否和当前的一致
            if (palletCode.Length > 0)
            {
                object[] objStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(palletCode);
                if (objStackToRcardList != null)
                {
                    string       strErrorMessage = string.Empty;
                    StackToRcard obj             = (StackToRcard)objStackToRcardList[0];
                    if (obj.ItemCode != itemCode)
                    {
                        strErrorMessage = strErrorMessage + "itemcode";
                        ApplicationRun.GetInfoForm().Add(
                            new UserControl.Message(MessageType.Error, "$CS_ITEM_NOT_SAME_IN_PALLET=" + obj.ItemCode));
                    }

                    if (obj.Company != companyCode)
                    {
                        strErrorMessage = strErrorMessage + "companycode";
                        ApplicationRun.GetInfoForm().Add(
                            new UserControl.Message(MessageType.Error, "$CS_COMPANY_NOT_SAME_IN_PALLET=" + obj.Company));
                    }

                    //if (obj.ItemGrade != itemGrade)
                    //{
                    //    //ApplicationRun.GetInfoForm().Add(
                    //    //new UserControl.Message(MessageType.Error, "$CS_RCARD_EXIST_IN_PALLET" + ((Pallet2RCard)objPallet2RCard).PalletCode));
                    //    //return false;
                    //    strErrorMessage = strErrorMessage + "itemgrade";
                    //    ApplicationRun.GetInfoForm().Add(
                    //    new UserControl.Message(MessageType.Error, "$CS_ITEMGRADE_NOT_SAME_IN_PALLET=" + obj.ItemGrade));
                    //}

                    if (strErrorMessage != string.Empty)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!inventoryFacade.CheckStackCapacity(storageCode, stackCode))
                    {
                        ApplicationRun.GetInfoForm().Add(
                            new UserControl.Message(MessageType.Error, "$CS_STACK_CAPACITY_FULL"));
                        return(false);
                    }
                }
            }

            //Check 出库的产品和当前选择的产品不一致
            object[] outTransList = inventoryFacade.GetInvOutTransaction(rcard, "");

            if (outTransList != null)
            {
                if (!((InvOutTransaction)outTransList[0]).ItemCode.Equals(itemCode))
                {
                    //Message:出库的产品:XXXXXXXXXXX和当前选择的产品不一致,是否继续使用当前选择的产品
                    if (MessageBox.Show(UserControl.MutiLanguages.ParserMessage("$CS_OUT_INV_ITEM_NOT_SAME") + "=" + ((InvOutTransaction)outTransList[0]).ItemCode + "," + UserControl.MutiLanguages.ParserMessage("$CS_OUT_INV_ITEM_NOT_SAME_ASK") + "?", UserControl.MutiLanguages.ParserMessage("$CS_CONFIRM"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            if (!this.CheckRule(rcard))
            {
                return(false);
            }


            return(true);
        }