Exemple #1
0
 private void _helper_DomainObjectToExportRow(object sender, EventArgs e)
 {
     if ((e as DomainObjectToExportRowEventArgsNew).DomainObject != null)
     {
         OQCLot2Card obj = (e as DomainObjectToExportRowEventArgsNew).DomainObject as OQCLot2Card;
         (e as DomainObjectToExportRowEventArgsNew).ExportRow =
             new string[] {
             obj.RunningCard,
             obj.MOCode,
             obj.ItemCode,
             FormatHelper.ToDateString(obj.MaintainDate),
             FormatHelper.ToTimeString(obj.MaintainTime)
         };
     }
 }
Exemple #2
0
 private void _helper_DomainObjectToGridRow(object sender, EventArgs e)
 {
     if ((e as DomainObjectToGridRowEventArgsNew).DomainObject != null)
     {
         OQCLot2Card obj = (e as DomainObjectToGridRowEventArgsNew).DomainObject as OQCLot2Card;
         DataRow     row = this.DtSource.NewRow();
         row["RunningCard"]    = GetRCardLink(obj.RunningCard.ToString());
         row["MOCode"]         = obj.MOCode;
         row["ItemCode"]       = obj.ItemCode;
         row["CollectionDate"] = FormatHelper.ToDateString(obj.MaintainDate);
         row["CollectionTime"] = FormatHelper.ToTimeString(obj.MaintainTime);
         (e as DomainObjectToGridRowEventArgsNew).GridRow = row;
         //    new UltraGridRow( new object[]{
         //                                      obj.RunningCard,
         //                                      obj.MOCode,
         //                                      obj.ItemCode,
         //                                      FormatHelper.ToDateString(obj.MaintainDate),
         //                                      FormatHelper.ToTimeString(obj.MaintainTime)
         //                                  }
         //    );
         //this.cmdQuery_Click(null, null);
     }
 }
Exemple #3
0
        public Messages GenerateLot(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                string itemCode = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                string rCard    = actionEventArgs.ProductInfo.NowSimulation.RunningCard;
                string moCode   = actionEventArgs.ProductInfo.NowSimulation.MOCode;

                ItemFacade      itemFacade      = new ItemFacade(this.DataProvider);
                BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                OQCFacade       oqcFacade       = new OQCFacade(this.DataProvider);

                object item = itemFacade.GetItem(itemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                if (item == null)
                {
                    messages.Add(new Message(MessageType.Error, "$Error_ItemCode_NotExist $Domain_ItemCode=" + itemCode));
                    return(messages);
                }
                //if (((Item)item).CheckItemOP == null || ((Item)item).CheckItemOP.Trim().Length == 0)
                //{
                //    messages.Add(new Message(MessageType.Error, "$Error_NoItemGenerateLotOPCode $Domain_ItemCode=" + itemCode));
                //    return messages;
                //}

                DBDateTime currentDBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                OQCLot     lot;

                // Resource auto generate lotno for ReworkSheet
                Resource res = actionEventArgs.ProductInfo.Resource;
                if (res == null)
                {
                    res = (Resource)baseModelFacade.GetResource(actionEventArgs.ResourceCode);
                    actionEventArgs.ProductInfo.Resource = res;
                }

                ReworkFacade reworkFacade = new ReworkFacade(this.DataProvider);
                ReworkRange  reworkRange  = null;
                OQCLot       currentLot   = (OQCLot)oqcFacade.GetLatestOQCLot(actionEventArgs.RunningCard);
                if (currentLot != null && currentLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject)
                {
                    reworkRange = (ReworkRange)reworkFacade.GetLatestReworkRange(actionEventArgs.RunningCard);
                }

                //产生新批的情况有两种
                //情况一:返工Res(Res.ReworkRouteCode不为空),RCard有当前的返工需求单,且此返工需求单要求自动产生新批(ReworkSheet.AutoLot等于Y)
                //情况二:其他情况,当前工序为Item的产生批工序(当前工序等于Item.CheckItemOP)
                //
                if (res != null && res.ReworkRouteCode != null && res.ReworkRouteCode.Trim().Length > 0 &&
                    reworkRange != null && reworkRange.ReworkCode != null && reworkRange.ReworkCode.Trim().Length > 0)
                {
                    object      reworkSheet = reworkFacade.GetReworkSheet(reworkRange.ReworkCode);
                    ReworkSheet rs          = reworkSheet as ReworkSheet;

                    if (rs.AutoLot != null && string.Compare(rs.AutoLot, "Y", true) == 0 &&
                        rs.LotList != null && rs.LotList.Trim().Length > 0)
                    {
                        //Get rework lot by oldlotno (reworkcode=oldlotno=lotlist)
                        object rLot = oqcFacade.GetOQCLotByOldLotNo(rs.LotList);
                        if (rLot == null)
                        {
                            lot = this.CreateNewLot(actionEventArgs, (Item)item, currentDBDateTime, true, rs.LotList);
                        }
                        else
                        {
                            lot = rLot as OQCLot;
                        }
                    }
                    else
                    {
                        return(messages);
                    }
                }
                else
                {
                    if (string.Compare(((Item)item).CheckItemOP, actionEventArgs.ProductInfo.NowSimulation.OPCode, true) != 0)
                    {
                        return(messages);
                    }

                    // GetLot2Card By RCard+LotStatus
                    if (oqcFacade.IsCardUsedByAnyLot(rCard, moCode, itemCode))
                    {
                        return(messages);
                    }
                    else
                    {
                        lot = this.CreateNewLot(actionEventArgs, (Item)item, currentDBDateTime, false, "");
                    }
                }

                object oldLot2Card = oqcFacade.GetOQCLot2Card(actionEventArgs.ProductInfo.NowSimulation.RunningCard,
                                                              actionEventArgs.ProductInfo.NowSimulation.MOCode, lot.LOTNO, lot.LotSequence);
                if (oldLot2Card != null)
                {
                    //messages.Add(new Message(MessageType.Error, "$Error_IDHasExistedInOtherOQCLotNO $CS_LotNo=" + lot.LOTNO));
                    return(messages);
                }

                actionEventArgs.ProductInfo.NowSimulation.LOTNO       = lot.LOTNO;
                actionEventArgs.ProductInfo.NowSimulationReport.LOTNO = lot.LOTNO;
                DataCollectFacade dataCollect = new DataCollectFacade(this.DataProvider);
                dataCollect.UpdateSimulation(actionEventArgs.ProductInfo.NowSimulation);
                dataCollect.UpdateSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);

                OQCLot2Card oqcLot2Card = oqcFacade.CreateNewOQCLot2Card();
                oqcLot2Card.ItemCode            = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                oqcLot2Card.CollectType         = "pcs";
                oqcLot2Card.LOTNO               = lot.LOTNO;
                oqcLot2Card.LotSequence         = OQCFacade.Lot_Sequence_Default;
                oqcLot2Card.MaintainUser        = actionEventArgs.UserCode;
                oqcLot2Card.MaintainDate        = currentDBDateTime.DBDate;
                oqcLot2Card.MaintainTime        = currentDBDateTime.DBTime;
                oqcLot2Card.MOCode              = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                oqcLot2Card.ModelCode           = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                oqcLot2Card.OPCode              = actionEventArgs.ProductInfo.NowSimulation.OPCode;
                oqcLot2Card.ResourceCode        = actionEventArgs.ProductInfo.NowSimulation.ResourceCode;
                oqcLot2Card.RouteCode           = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
                oqcLot2Card.RunningCard         = actionEventArgs.ProductInfo.NowSimulation.RunningCard;
                oqcLot2Card.RunningCardSequence = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                oqcLot2Card.SegmnetCode         = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                oqcLot2Card.ShiftCode           = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                oqcLot2Card.ShiftTypeCode       = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                oqcLot2Card.Status              = actionEventArgs.ProductInfo.NowSimulationReport.Status;
                oqcLot2Card.StepSequenceCode    = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                oqcLot2Card.TimePeriodCode      = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                //oqcLot2Card.EAttribute1 = actionEventArgs.ProductInfo.NowSimulation.CartonCode;
                oqcLot2Card.EAttribute1 = ""; //现在这里只能是空,后面Carton包装时候会更新为CartonCode
                oqcLot2Card.MOSeq       = actionEventArgs.ProductInfo.NowSimulation.MOSeq;

                oqcFacade.AddOQCLot2Card(oqcLot2Card);

                // Added By Hi1/Venus.Feng on 20081027 for Hisense Version : Add Frozen by lot logic
                if (lot.FrozenStatus == FrozenStatus.STATUS_FRONZEN)
                {
                    Frozen frozen = new Frozen();
                    frozen.RCard        = actionEventArgs.ProductInfo.NowSimulation.RunningCard;
                    frozen.EAttribute1  = "";
                    frozen.FrozenBy     = lot.FrozenBy;
                    frozen.FrozenDate   = lot.FrozenDate;
                    frozen.FrozenReason = lot.FrozenReason;

                    int      seq            = 0;
                    object[] oldFrozenRCard = oqcFacade.QueryFrozen(frozen.RCard, frozen.RCard,
                                                                    string.Empty, string.Empty, string.Empty, string.Empty,
                                                                    -1, -1, -1, -1, int.MinValue, int.MaxValue);

                    if (oldFrozenRCard != null)
                    {
                        foreach (Frozen f in oldFrozenRCard)
                        {
                            seq = Math.Max(seq, f.FrozenSequence);
                        }
                    }

                    frozen.FrozenSequence = seq + 1;
                    frozen.FrozenStatus   = FrozenStatus.STATUS_FRONZEN;
                    frozen.FrozenTime     = lot.FrozenTime;
                    frozen.ItemCode       = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                    frozen.LotNo          = lot.LOTNO;
                    frozen.LotSequence    = Convert.ToInt32(lot.LotSequence);
                    frozen.MaintainDate   = currentDBDateTime.DBDate;
                    frozen.MaintainTime   = currentDBDateTime.DBTime;
                    frozen.MaintainUser   = actionEventArgs.UserCode;
                    frozen.MOCode         = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                    frozen.ModelCode      = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                    frozen.UnfrozenBy     = "";
                    frozen.UnfrozenDate   = 0;
                    frozen.UnfrozenReason = "";
                    frozen.UnfrozenTime   = 0;

                    oqcFacade.AddFrozen(frozen);
                }
                // End Added

                //Update tbloqclot.lotsize++
                lot.LotSize = 1;
                oqcFacade.UpdateOQCLotSize(lot);
            }
            catch (Exception ex)
            {
                messages.Add(new Message(ex));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
        public Messages Execute(ActionEventArgs oqcLotAddIDEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                ActionOQCHelper    oqcHelper   = new ActionOQCHelper(this.DataProvider);
                OQCFacade          oqcFacade   = new OQCFacade(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(oqcLotAddIDEventArgs));

                if (messages.IsSuccess())
                {
                    if (((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation == null)
                    {
                        throw new Exception("$System_Error");
                    }

                    #region update FQCLotSize
                    object obj = oqcFacade.GetOQCLot(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                    if (obj == null)
                    {
                        throw new Exception("$Error_OQCLotNotExisted");
                    }
                    OQCLot oqcLot = obj as OQCLot;
                    oqcLot.LotSize = 1;                    //oqcFacade.GetOQCLotSizeFromOQCLot2Card( ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO);
                    //TODO:Laws Lu,2005/10/17,需要修改	更新数量

                    oqcFacade.UpdateOQCLotSize(oqcLot);
                    #endregion

                    #region OQCADDID 自身的检查
                    #region 只是forcase工具使用,真实的情况是从前台已经产生
                    object objOQCLot = oqcFacade.GetOQCLot(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                    if (objOQCLot == null)
                    {
                        OQCLot newOQCLot = oqcFacade.CreateNewOQCLot();
                        newOQCLot.LOTNO        = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO));
                        newOQCLot.AcceptSize   = 0;
                        newOQCLot.AcceptSize1  = 0;
                        newOQCLot.AcceptSize2  = 0;
                        newOQCLot.AQL          = 0;
                        newOQCLot.AQL1         = 0;
                        newOQCLot.AQL2         = 0;
                        newOQCLot.LotSequence  = OQCFacade.Lot_Sequence_Default;
                        newOQCLot.OQCLotType   = "oqclottype_normal";
                        newOQCLot.LotSize      = 0;
                        newOQCLot.LOTStatus    = OQCLotStatus.OQCLotStatus_Initial;
                        newOQCLot.LOTTimes     = 0;
                        newOQCLot.MaintainUser = oqcLotAddIDEventArgs.UserCode;
                        newOQCLot.RejectSize   = 0;
                        newOQCLot.RejectSize1  = 0;
                        newOQCLot.RejectSize2  = 0;
                        newOQCLot.SampleSize   = 0;
                        oqcFacade.AddOQCLot(newOQCLot);
                    }
                    #endregion


                    //检查批的状态
                    if (!oqcHelper.IsOQCLotComplete(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO))
                    {
                        //Write off by Laws Lu/2006/05/25
//						//是否同一ItemCode
//						if( oqcHelper.IsRemixItemCode( ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ItemCode,((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO))
//						{
//							throw new Exception("$Error_RemixItemCode");
//						}
                        //End Write off

                        //是否混单
                        if (!((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).IsRemixMO)
                        {
                            //如除了正准备的工单号外,还有其他的工单存在则报错
                            if (oqcHelper.IsRemixMOCode(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO, ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOCode))
                            {
                                throw new Exception("$Error_RemixMO");
                            }
                        }
                        //一个ID只能属于一个批(reject,pass状态除外)
                        if (!(oqcHelper.IsIDHasOnlyOQCLotNo(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).RunningCard, ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOCode, ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO)))
                        {
                            throw new Exception("$Error_IDHasExistedInOtherOQCLotNO");
                        }
                        //检查完工数量
                        if (((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).IsCheckOQCLotMaxSize)
                        {
                            if (oqcHelper.GetIDCountInOQCLotNo(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO) >= ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotMaxSize)
                            {
                                throw new Exception("$Error_OQClotQtyExceedMaxQty");
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("$Error_OQCLotNOHasComplete");
                    }
                    #endregion
                    string cartonno = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;

                    oqcLotAddIDEventArgs.ProductInfo.NowSimulation.LOTNO = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).OQCLotNO;

                    //oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;
                    // Added by Icyer 2006/06/07
                    string oldCartonNo = oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode;
                    if (cartonno != string.Empty)
                    {
                        oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;
                    }
                    // Added end
                    //是否该产品是否属于wip的其他站
                    messages.AddMessages(dataCollect.Execute(oqcLotAddIDEventArgs));

                    DBDateTime dbDateTime;
                    //Laws Lu,2006/11/13 uniform system collect date
                    if (oqcLotAddIDEventArgs.ProductInfo.WorkDateTime != null)
                    {
                        dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                        oqcLotAddIDEventArgs.ProductInfo.WorkDateTime = dbDateTime;
                    }
                    else
                    {
                        dbDateTime = oqcLotAddIDEventArgs.ProductInfo.WorkDateTime;
                    }

                    if (messages.IsSuccess())
                    {
                        if (cartonno != string.Empty && cartonno != oldCartonNo)
                        {
                            //Laws Lu,2006/05/27	包装到Carton
                            Package.PackageFacade pf = new BenQGuru.eMES.Package.PackageFacade(DataProvider);

                            object objCarton = pf.GetCARTONINFO(cartonno);

                            if (objCarton != null)
                            {
                                BenQGuru.eMES.Domain.Package.CARTONINFO carton = objCarton as BenQGuru.eMES.Domain.Package.CARTONINFO;

                                /* added by jessie lee, 20006/6/20
                                 * Power0086:达到最大包装数量时及时提示 */
                                if (carton.CAPACITY == carton.COLLECTED + 1)
                                {
                                    messages.Add(new UserControl.Message(MessageType.Normal, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"));
                                }
                                //Laws Lu,2006/06/22 modify cancle exception and use message
                                if (carton.CAPACITY <= carton.COLLECTED)
                                {
                                    messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FILL_OUT"));
                                }
                                else
                                {
                                    pf.UpdateCollected((carton as BenQGuru.eMES.Domain.Package.CARTONINFO).CARTONNO);
                                }
                            }
                            else if (cartonno != String.Empty)
                            {
                                //Laws Lu,2006/06/22	modify check if carton exist
                                object objExistCTN = pf.GetExistCARTONINFO(cartonno);

                                if (objExistCTN != null)
                                {
                                    messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"));
                                }
                                else
                                {
                                    BenQGuru.eMES.Domain.Package.CARTONINFO carton = new BenQGuru.eMES.Domain.Package.CARTONINFO();

                                    carton.CAPACITY   = ((new ItemFacade(DataProvider)).GetItem(oqcLotAddIDEventArgs.ProductInfo.NowSimulation.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item).ItemCartonQty;
                                    carton.COLLECTED  = 1 /** oqcLotAddIDEventArgs.ProductInfo.NowSimulation.IDMergeRule*/;
                                    carton.PKCARTONID = System.Guid.NewGuid().ToString().ToUpper();
                                    carton.CARTONNO   = cartonno;
                                    carton.MUSER      = oqcLotAddIDEventArgs.UserCode;



                                    carton.MDATE = dbDateTime.DBDate;
                                    carton.MTIME = dbDateTime.DBTime;
                                    //carton.

                                    //joe song 20060630 Carton Memo
                                    carton.EATTRIBUTE1 = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonMemo;

                                    if (carton.CAPACITY == 0)                                   //Get carton capacity by item
                                    {
                                        messages.Add(new UserControl.Message(MessageType.Error
                                                                             , "$CS_PLEASE_MAINTEIN_ITEMCARTON $CS_Param_ID =" + oqcLotAddIDEventArgs.RunningCard));
                                    }
                                    else
                                    {
                                        pf.AddCARTONINFO(carton);
                                    }
                                }
                            }
                            //End
                        }
                    }

                    if (messages.IsSuccess())
                    {
                        //填写对应的runningcard 到OQCLotNO
                        #region add OQCLot2Card
                        OQCLot2Card oqcLot2Card = oqcFacade.CreateNewOQCLot2Card();
                        oqcLot2Card.ItemCode            = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ItemCode;
                        oqcLot2Card.CollectType         = oqcLotAddIDEventArgs.CollectType;
                        oqcLot2Card.LOTNO               = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO;
                        oqcLot2Card.LotSequence         = OQCFacade.Lot_Sequence_Default;
                        oqcLot2Card.MaintainUser        = oqcLotAddIDEventArgs.UserCode;
                        oqcLot2Card.MaintainDate        = dbDateTime.DBDate;
                        oqcLot2Card.MaintainTime        = dbDateTime.DBTime;
                        oqcLot2Card.MOCode              = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOCode;
                        oqcLot2Card.ModelCode           = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ModelCode;
                        oqcLot2Card.OPCode              = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.OPCode;
                        oqcLot2Card.ResourceCode        = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ResourceCode;
                        oqcLot2Card.RouteCode           = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.RouteCode;
                        oqcLot2Card.RunningCard         = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.RunningCard;
                        oqcLot2Card.RunningCardSequence = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.RunningCardSequence;
                        oqcLot2Card.SegmnetCode         = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.SegmentCode;
                        oqcLot2Card.ShiftCode           = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.ShiftCode;
                        oqcLot2Card.ShiftTypeCode       = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.ShiftTypeCode;
                        oqcLot2Card.Status              = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.Status;
                        oqcLot2Card.StepSequenceCode    = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.StepSequenceCode;
                        oqcLot2Card.TimePeriodCode      = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.TimePeriodCode;
                        //oqcLot2Card.EAttribute1 =  (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;
                        oqcLot2Card.EAttribute1 = oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode;                    // Added by Icyer 2006/06/08
                        oqcLot2Card.MOSeq       = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOSeq; // Added by Icyer 2007/07/02    增加 MOSeq 栏位

                        oqcFacade.AddOQCLot2Card(oqcLot2Card);
                        #endregion
                        //AMOI  MARK  START  20050806 增加按资源统计产量
                        #region 填写统计报表 按资源统计
                        //ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                        //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
                        //    ,oqcLotAddIDEventArgs.ActionType,oqcLotAddIDEventArgs.ProductInfo));
                        #endregion
                        //AMOI  MARK  END
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Exemple #5
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);
        }
Exemple #6
0
        private bool InputRcard(string rcard)
        {
            InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);
            DataTable       dtInfo          = inventoryFacade.GetSimulationReportInfo(rcard, packRcard);

            if (dtInfo == null)
            {
                //该序列号不存在
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_RCARD_IS_NOT_EXIT"));
                return(false);
            }

            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            string            sourceRcard       = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty);

            ////使用目标垛位栈板
            //
            if (this.rdoUseTPallet.Checked)
            {
                ////check目标垛位栈板的,产品,公司别,产品档次,是否和序列号的栈板一致
                //
                //获取源栈板信息
                object[] objOriRcardTOStackPalletList = inventoryFacade.GetRcardToStackPallet("", "", sourceRcard);
                object[] objTarStackToRcardList       = inventoryFacade.GetStackToRcardInfoByPallet(this.txtUseTPallet.Value.Trim());

                if (objOriRcardTOStackPalletList == null)
                {
                    //Message:产品序列号不存在垛位中
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_RCARD_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                ////CHeck 序列号对应的栈板和目标栈板是否相同
                //
                if (((RcardToStackPallet)objOriRcardTOStackPalletList[0]).PalletCode.Equals(this.txtUseTPallet.Value.Trim()))
                {
                    //Message:源栈板和目标栈板相同
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLETNO_SAME_AS_TARPALLET"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) && CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                                                                           ((RcardToStackPallet)objOriRcardTOStackPalletList[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                string             strErrorMessage = string.Empty;
                RcardToStackPallet objOri          = (RcardToStackPallet)objOriRcardTOStackPalletList[0];
                StackToRcard       objTar          = (StackToRcard)objTarStackToRcardList[0];
                if (objOri.ItemCode != objTar.ItemCode)
                {
                    strErrorMessage = strErrorMessage + "itemcode";
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_ITEM_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.ItemCode + " $CS_ORIGINAL=" + objOri.ItemCode));
                }

                if (objOri.Company != objTar.Company)
                {
                    strErrorMessage = strErrorMessage + "companycode";
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_COMPANY_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.Company + " $CS_ORIGINAL=" + objOri.Company));
                }

                if (strErrorMessage != string.Empty)
                {
                    return(false);
                }

                ////更新该产品序列号的源栈板为目标栈板
                //
                inventoryFacade.UpdateOriPalletStackToTargetPalletByRcard(objOri,
                                                                          this.txtUseTPallet.Value.Trim(),
                                                                          this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                          this.ucLabelEditStock.Value.Trim(),
                                                                          ApplicationService.Current().LoginInfo.UserCode);
                //Load Grid
                this.LoadGrid(objOriRcardTOStackPalletList, this.ucLabelEditStock.Value.Trim(), this.txtUseTPallet.Value.Trim());
            }

            ////使用新栈板
            //
            if (this.rdoUseNPallet.Checked)
            {
                ////获取源序列号对应的垛位资料
                //
                object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet("", "", sourceRcard);

                if (rcardToStackPallet == null)
                {
                    //Message:产品序列号不存在垛位中
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_RCARD_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                ////CHeck 序列号对应的栈板和目标栈板是否相同
                //
                if (((RcardToStackPallet)rcardToStackPallet[0]).PalletCode.Equals(this.txtUseNPallet.Value.Trim()))
                {
                    //Message:序列号对应的栈板和目标栈板是否相同
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLETNO_IN_RCARD_SAME_AS_TARPALLET"));
                    return(false);
                }

                //获取源栈板信息
                object[] objOriRcardTOStackPalletList = inventoryFacade.GetRcardToStackPallet("", "", sourceRcard);

                if (objOriRcardTOStackPalletList == null)
                {
                    //Message:产品序列号不存在垛位中
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_RCARD_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) &&
                    CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                        ((RcardToStackPallet)objOriRcardTOStackPalletList[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                //检查栈板容量是否满
                if (!inventoryFacade.CheckStackCapacity(this.ucLabelComboxINVType.SelectedItemValue.ToString().Trim().ToUpper(),
                                                        this.ucLabelEditStock.Value.Trim().ToUpper()))
                {
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_CAPACITY_FULL"));
                    return(false);
                }


                string      lotNo       = " ";
                OQCFacade   oqcFacade   = new OQCFacade(this.DataProvider);
                OQCLot2Card oqcLot2Card = (OQCLot2Card)oqcFacade.GetLastOQCLot2CardByRCard(sourceRcard);

                if (oqcLot2Card != null)
                {
                    lotNo = oqcLot2Card.LOTNO;
                }

                ////更新该产品序列号的源栈板为新栈板
                //
                inventoryFacade.UpdateOriPalletStackToNewPalletByRcard(rcardToStackPallet[0],
                                                                       this.txtUseNPallet.Value.Trim(),
                                                                       this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                       this.ucLabelEditStock.Value.Trim(),
                                                                       ApplicationService.Current().LoginInfo.UserCode,
                                                                       ApplicationService.Current().ResourceCode,
                                                                       lotNo);

                //Load Grid
                this.LoadGrid(rcardToStackPallet, this.ucLabelEditStock.Value.Trim(), this.txtUseNPallet.Value.Trim());
            }

            return(true);
        }
Exemple #7
0
        private bool InputPallet(string palletCode)
        {
            ////Check 栈板是否存在
            //
            PackageFacade objFacade = new PackageFacade(this.DataProvider);
            object        pallet    = objFacade.GetPallet(palletCode);

            if (pallet == null)
            {
                //Message:该栈板不存在
                ApplicationRun.GetInfoForm().Add(
                    new UserControl.Message(MessageType.Error, "$CS_PALLETNO_IS_NOT_EXIT"));
                return(false);
            }


            InventoryFacade inventoryFacade = new InventoryFacade(this.DataProvider);

            ////使用原栈板
            //
            if (this.rdoUseOPallet.Checked)
            {
                ////Check 栈板在目标垛位中已经存在
                //
                object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet(this.ucLabelEditStock.Value, palletCode, "");

                if (rcardToStackPallet != null)
                {
                    //Message:栈板在目标垛位中已经存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_EXIST_IN_TAR_STACK"));
                    return(false);
                }

                ////获取源栈板的垛位资料
                //
                object[] rcardToStackPalletList = inventoryFacade.GetRcardToStackPallet("", palletCode, "");

                if (rcardToStackPalletList == null)
                {
                    //Message:源栈板对应的垛位信息不存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) &&
                    CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                        ((RcardToStackPallet)rcardToStackPalletList[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                ////根据源栈板的Rcard更新StackToRcard
                //
                inventoryFacade.UpdatePalletStackByWholePallet(rcardToStackPalletList,
                                                               this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                               this.ucLabelEditStock.Value.Trim(),
                                                               ApplicationService.Current().LoginInfo.UserCode);

                //Load Grid
                this.LoadGrid(rcardToStackPalletList, this.ucLabelEditStock.Value.Trim(), palletCode);
            }

            ////使用目标垛位栈板
            //
            if (this.rdoUseTPallet.Checked)
            {
                if (palletCode.Equals(this.txtUseTPallet.Value.Trim()))
                {
                    //Message:源栈板和目标栈板相同
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLETNO_SAME_AS_TARPALLET"));
                    return(false);
                }

                ////check目标垛位栈板的,产品,公司别,产品档次,是否和序列号的栈板一致
                //
                //获取源栈板信息
                object[] objOriStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(palletCode);
                object[] objTarStackToRcardList = inventoryFacade.GetStackToRcardInfoByPallet(this.txtUseTPallet.Value.Trim());

                if (objOriStackToRcardList == null)
                {
                    //Message:源栈板对应的垛位信息不存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) &&
                    CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                        ((StackToRcard)objOriStackToRcardList[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                string       strErrorMessage = string.Empty;
                StackToRcard objOri          = (StackToRcard)objOriStackToRcardList[0];
                StackToRcard objTar          = (StackToRcard)objTarStackToRcardList[0];
                if (objOri.ItemCode != objTar.ItemCode)
                {
                    strErrorMessage = strErrorMessage + "itemcode";
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_ITEM_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.ItemCode + " $CS_ORIGINAL=" + objOri.ItemCode));
                }

                if (objOri.Company != objTar.Company)
                {
                    strErrorMessage = strErrorMessage + "companycode";
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_COMPANY_NOT_SAME_IN_PALLET_TWO $CS_TARGET=" + objTar.Company + " $CS_ORIGINAL=" + objOri.Company));
                }

                if (strErrorMessage != string.Empty)
                {
                    return(false);
                }

                ////获取源栈板的垛位资料
                //
                object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet("", palletCode, "");

                ////把原栈板更新为目标栈板
                //
                inventoryFacade.UpdateOriPalletStackToTargetPallet(rcardToStackPallet,
                                                                   this.txtUseTPallet.Value.Trim(),
                                                                   this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                   this.ucLabelEditStock.Value.Trim(),
                                                                   ApplicationService.Current().LoginInfo.UserCode);

                //Load Grid
                this.LoadGrid(rcardToStackPallet, this.ucLabelEditStock.Value.Trim(), this.txtUseTPallet.Value.Trim());
            }

            ////使用新栈板
            //
            if (this.rdoUseNPallet.Checked)
            {
                if (palletCode.Equals(this.txtUseNPallet.Value.Trim()))
                {
                    //Message:源栈板和目标栈板相同
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLETNO_SAME_AS_TARPALLET"));
                    return(false);
                }


                ////获取源栈板的垛位资料
                //
                object[] rcardToStackPallet = inventoryFacade.GetRcardToStackPallet("", palletCode, "");

                if (rcardToStackPallet == null)
                {
                    //Message:源栈板对应的垛位信息不存在
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_PALLET_IS_NOT_EXIST_IN_ORI_STACK"));
                    return(false);
                }

                if (inventoryFacade.CheckStackIsOnlyAllowOneItem(ucLabelEditStock.Value.ToString()) && CheckStackItemError(this.ucLabelEditStock.Value.Trim(), this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                                                                           ((RcardToStackPallet)rcardToStackPallet[0]).ItemCode))
                {
                    //Message:目标垛位的物料和当前物料不一致
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_ITEM_DIFF"));
                    return(false);
                }

                //检查栈板容量是否满
                if (!inventoryFacade.CheckStackCapacity(this.ucLabelComboxINVType.SelectedItemValue.ToString().Trim().ToUpper(),
                                                        this.ucLabelEditStock.Value.Trim().ToUpper()))
                {
                    ApplicationRun.GetInfoForm().Add(
                        new UserControl.Message(MessageType.Error, "$CS_STACK_CAPACITY_FULL"));
                    return(false);
                }


                string            lotNo             = " ";
                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                SimulationReport  simulationReport  = (SimulationReport)dataCollectFacade.GetRcardFromSimulationReport(((RcardToStackPallet)rcardToStackPallet[0]).SerialNo);
                if (simulationReport != null)
                {
                    OQCFacade   oqcFacade   = new OQCFacade(this.DataProvider);
                    OQCLot2Card oqcLot2Card = (OQCLot2Card)oqcFacade.GetLastOQCLot2CardByRCard(simulationReport.RunningCard);

                    if (oqcLot2Card != null)
                    {
                        lotNo = oqcLot2Card.LOTNO;
                    }
                }

                //把原栈板更新为新栈板
                inventoryFacade.UpdateOriPalletStackToNewPallet(rcardToStackPallet,
                                                                this.txtUseNPallet.Value.Trim(),
                                                                this.ucLabelComboxINVType.SelectedItemValue.ToString(),
                                                                this.ucLabelEditStock.Value.Trim(),
                                                                ApplicationService.Current().LoginInfo.UserCode,
                                                                ApplicationService.Current().ResourceCode,
                                                                lotNo);

                //Load Grid
                this.LoadGrid(rcardToStackPallet, this.ucLabelEditStock.Value.Trim(), this.txtUseNPallet.Value.Trim());
            }

            return(true);
        }