コード例 #1
0
        //对单个的ID进行对立
        private Messages AddSingleIDIntoCartonAndTry(string rcard, Messages messages, IAction action, ActionOnLineHelper actionOnLineHelper)
        {
            //转换成起始序列号
            string sourceCard = _face.GetSourceCard(rcard.Trim().ToUpper(), string.Empty);
            //end

            Messages newMessages = actionOnLineHelper.GetIDInfo(sourceCard);
            string   cartonNo    = FormatHelper.CleanString(this.ucLabelCartonNo.Value);

            ProductInfo product = (ProductInfo)newMessages.GetData().Values[0];

            if (product.LastSimulation == null)
            {
                newMessages.Add(new UserControl.Message(new Exception("$Error_LastSimulation_IsNull!")));
                return(newMessages);
            }
            if (newMessages.IsSuccess())
            {
                CartonPackEventArgs cartonPackEventArgs = new CartonPackEventArgs(ActionType.DataCollectAction_Carton,
                                                                                  sourceCard, ApplicationService.Current().UserCode,
                                                                                  ApplicationService.Current().ResourceCode,
                                                                                  FormatHelper.CleanString(""),
                                                                                  cartonNo,
                                                                                  product);

                newMessages.AddMessages(action.Execute(cartonPackEventArgs));
            }
            if (newMessages.IsSuccess())
            {
                PackageFacade packageFacade = new PackageFacade(this.DataProvider);
                packageFacade.addCarton2RCARD(cartonNo, sourceCard, ApplicationService.Current().UserCode, product.LastSimulation.MOCode);
                //记log
                packageFacade.addCarton2RCARDLog(cartonNo, sourceCard, ApplicationService.Current().UserCode);
            }

            return(newMessages);
        }