Beispiel #1
0
        public MessageResult MultipleAssemblePage(int[] ids)
        {
            var failedIds = new List <int>();

            foreach (var id in ids)
            {
                var page = PageRepository.GetPagePropertiesById(id);
                if (page.PageTemplate.SiteIsDotNet)
                {
                    new AssemblePageController(id, QPContext.CurrentDbConnectionString).Assemble();
                    AssembleRepository.UpdatePageStatus(id, QPContext.CurrentUserId);
                }
                else
                {
                    var token   = _qp7Service.Authenticate();
                    var message = _qp7Service.AssemblePage(id, token);
                    if (!string.IsNullOrEmpty(message))
                    {
                        failedIds.Add(id);
                    }
                }
            }

            return(failedIds.Any()
                ? MessageResult.Error(SiteStrings.AssemblePagesError + string.Join(", ", failedIds), failedIds.ToArray())
                : null);
        }
Beispiel #2
0
        public MultistepActionStepResult Step(int step)
        {
            var context = HttpContext.Session.GetValue <AssemblePagesCommandContext>(HttpContextSession.AssemblePagesCommandProcessingContext);

            var pages = context.Pages
                        .Skip(step * ItemsPerStep)
                        .Take(ItemsPerStep)
                        .ToArray();

            if (pages.Any())
            {
                foreach (var page in pages)
                {
                    if (IsDotNet)
                    {
                        new AssemblePageController(page.Id, QPContext.CurrentDbConnectionString).Assemble();
                        AssembleRepository.UpdatePageStatus(page.Id, QPContext.CurrentUserId);
                    }
                    else
                    {
                        var result = QP7Service.AssemblePage(page.Id, context.QP7Token);

                        if (!string.IsNullOrEmpty(result))
                        {
                            var pagesForResult = new List <PageInfo>();

                            if (context.MissedPages.ContainsKey(result))
                            {
                                pagesForResult = context.MissedPages[result];
                            }
                            else
                            {
                                context.MissedPages[result] = pagesForResult;
                            }

                            pagesForResult.Add(page);
                        }
                    }
                }
            }

            var pageCount = context.MissedPages.Sum(rp => rp.Value.Count);
            var info      = new StringBuilder();

            if (pageCount > 0)
            {
                info.AppendFormat(SiteStrings.AssemblePagesResult, pageCount);
                foreach (var item in context.MissedPages)
                {
                    info.AppendFormat(" \"{0}\" : [{1}]", item.Key, string.Join(", ", item.Value.Select(p => string.Format(PageTemplate, p.Template, p.Name))));
                }
            }

            return(new MultistepActionStepResult {
                ProcessedItemsCount = pages.Length, AdditionalInfo = info.ToString()
            });
        }
Beispiel #3
0
        internal void Setup()
        {
            var templateIds = AssembleRepository.GetSiteTemplatesId(SiteId);

            _itemCount = templateIds.Count();

            HttpContext.Current.Session[HttpContextSession.AssembleTemplatesCommandProcessingContext] = new AssembleTemplatesCommandContext
            {
                TemplateIds = templateIds.ToArray()
            };
        }
Beispiel #4
0
        public MessageResult AssemblePage(int id)
        {
            var page = PageRepository.GetPagePropertiesById(id);

            if (page.PageTemplate.SiteIsDotNet)
            {
                new AssemblePageController(id, QPContext.CurrentDbConnectionString).Assemble();
                AssembleRepository.UpdatePageStatus(id, QPContext.CurrentUserId);
                return(null);
            }

            return(MessageResult.Error(SiteStrings.ShouldBeDotNet));
        }
        internal void Setup()
        {
            var templateIds = AssembleRepository.GetSiteTemplatesId(SiteId);

            _itemCount = templateIds.Count();

            HttpContext.Session.SetValue(
                HttpContextSession.AssembleTemplatesCommandProcessingContext,
                new AssembleTemplatesCommandContext
            {
                TemplateIds = templateIds.ToList()
            });
        }
        public MultistepActionStepResult Step(int step)
        {
            var notificationIds = SiteOrTemplate ? AssembleRepository.GetSiteFormatId(AssemblingEntityId) : AssembleRepository.GetTemplateFormatId(AssemblingEntityId);

            if (notificationIds.Any())
            {
                foreach (var id in notificationIds)
                {
                    new AssembleFormatController(id, AssembleMode.Notification, QPContext.CurrentDbConnectionString).Assemble();
                }
            }

            return(new MultistepActionStepResult {
                ProcessedItemsCount = 1
            });
        }
Beispiel #7
0
        internal void Setup()
        {
            IEnumerable <PageInfo> pagesIds = SiteOrTemplate ? AssembleRepository.GetSitePages(AssemblingEntityIdId) : AssembleRepository.GetTemplatePages(AssemblingEntityIdId);

            _itemCount = pagesIds.Count();

            QP7Token token = null;

            if (!IsDotNet)
            {
                token = QP7Service.Authenticate();
            }

            HttpContext.Current.Session[HttpContextSession.AssemblePagesCommandProcessingContext] = new AssemblePagesCommandContext
            {
                Pages       = pagesIds.ToArray(),
                QP7Token    = token,
                MissedPages = new Dictionary <string, List <PageInfo> >()
            };
        }
Beispiel #8
0
        public MessageResult AssemblePage(int id)
        {
            var page = PageRepository.GetPagePropertiesById(id);

            if (page.PageTemplate.SiteIsDotNet)
            {
                new AssemblePageController(id, QPContext.CurrentDbConnectionString).Assemble();
                AssembleRepository.UpdatePageStatus(id, QPContext.CurrentUserId);
            }
            else
            {
                var token   = _qp7Service.Authenticate();
                var message = _qp7Service.AssemblePage(id, token);

                if (!string.IsNullOrEmpty(message))
                {
                    return(MessageResult.Error(message));
                }
            }

            return(null);
        }
Beispiel #9
0
        private void textBox_searchPlanOrder_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                var planId = this.textBox_searchPlanOrder.Text.Trim();

                using (var dbContext = new FlowManageSystemEntities())
                {
                    orderRepositoy = new OrderRepository(dbContext);

                    collectionRepository = new CollectionRepository(dbContext);

                    assembleRepository = new AssembleRepository(dbContext);

                    if (!orderRepositoy.PlanNoExist(planId))
                    {
                        MessageBox.Show("计划单号不存在,请输入正确的单号!!!");
                        return;
                    }

                    //更新界面--订单相关信息
                    var order   = orderRepositoy.getOrderByPlanNo(planId);
                    var orderId = order.OrderId;

                    this.lbOrderDate.Text       = order.OrderDate.ToShortDateString();
                    this.lbPlanOnlineDate.Text  = order.PlannedLaunchDate.ToShortDateString();
                    this.lbDemandDate.Text      = order.CustomDemandDate.ToShortDateString();
                    this.lbPlanStorageDate.Text = order.PlanStorageDate.ToShortDateString();

                    //更新界面--领料相关信息
                    if (collectionRepository.IsOrderCollectionExist(orderId))
                    {
                        var collectionInfo = collectionRepository.GetCurrentOrderCollectionInfo(orderId);

                        this.lbCollectionCount.Text = collectionInfo.Item1.ToString();
                        this.lbCollectionTime.Text  = collectionInfo.Item2.ToString();
                    }
                    else
                    {
                        this.lbCollectionCount.Text = "未领取物料";
                        this.lbCollectionTime.Text  = "";
                    }

                    //更新界面--组装相关信息
                    if (assembleRepository.IsOrderAssembleExist(orderId))
                    {
                        var collectionInfo = assembleRepository.GetCurrentOrderAssembleInfo(orderId);
                        this.lbAssembleCount.Text = collectionInfo.Item1.ToString();
                        this.lbAssembleTime.Text  = collectionInfo.Item2.ToString();
                    }
                    else
                    {
                        this.lbCollectionCount.Text = "未开始组装";
                        this.lbCollectionTime.Text  = "";
                    }

                    //初调相关信息  //终测相关信息
                    using (_opwayDbContext = new ATSDATABASEEntities())
                    {
                        opwayDataRepository = new OpwayDataRepository(_opwayDbContext);

                        var snMin = order.SnMin;
                        var snMax = order.SnMax;

                        this.lbFirstTestCount.Text = opwayDataRepository.GetFirstTestCount(snMin, snMax).ToString();

                        this.lbFInishedTestCount.Text = opwayDataRepository.GetLastTestCount(snMin, snMax).ToString();
                    }
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// 当前盒完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox_BoxNumber_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (!RegexHelper.regExpNumber.IsMatch(this.textBox_DoNumber.Text))
                {
                    MessageBox.Show("完成的数量应该是数字");
                    return;
                }

                byte doNumber = Convert.ToByte(this.textBox_DoNumber.Text);

                DialogResult dialogResult = MessageBox.Show("当前盒完成数量:" + doNumber, "询问", MessageBoxButtons.OKCancel);

                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }

                using (_dbcontext = new FlowManageSystemEntities())
                {
                    orderBoxRepository = new OrderBoxRepository(_dbcontext);

                    var boxNumber = this.textBox_BoxNumber.Text.Trim();

                    //通过盒号找到订单号
                    var id = orderBoxRepository.GetOrderId(boxNumber);

                    List <string> boxNumbersNeedFinished = null;

                    //根据订单号 找到需要完成的所有盒号
                    if (id != 0)
                    {
                        boxNumbersNeedFinished = orderBoxRepository.GetOrderIdBoxes(id);
                    }
                    else                      //不存在当前盒号 直接退出
                    {
                        MessageBox.Show("不存在的盒号,请联系下单人员,检查是否下单错误!");
                        return;
                    }

                    //根据id找到订单记录
                    orderRepositoy = new OrderRepository(_dbcontext);

                    //设置界面显示当前计划单号
                    var order = orderRepositoy.getOrderByOrderId(id);
                    this.lbPlanNo.Text = order.PlanNo;

                    assembleRepository = new AssembleRepository(_dbcontext);
                    //设置界面已组装好的数量
                    this.lbDoNo.Text = assembleRepository.GetAssembleCount(id).ToString();

                    //获取已完成的盒号
                    var hasFinished = assembleRepository.GetAssembleFinishedBoxNo(id);

                    //在组装完成前 判断是否重复扫
                    if (hasFinished.Contains(this.textBox_BoxNumber.Text.Trim()))
                    {
                        MessageBox.Show("此盒已完成,勿重复扫!");
                        this.textBox_BoxNumber.Select();
                        return;
                    }
                    assembleRepository.assembleOneBox(id, boxNumber, doNumber);
                    assembleRepository.SaveChanges();

                    //获取已完成的盒号
                    hasFinished = assembleRepository.GetAssembleFinishedBoxNo(id);
                    //设置界面ListBox绑定
                    unFinishedBoxes.Clear();
                    boxNumbersNeedFinished.Except(hasFinished).ToList().ForEach(o => unFinishedBoxes.Add(o));
                }
            }
        }