示例#1
0
        public ActionResult AjaxView()
        {
            var model = new ProduceModel();

            model.Produce          = _produceDa.GetItemById(ArrId.FirstOrDefault());
            model.CategoryRecipe   = _produceDa.GetCategoryRecipe(model.Produce.ProductId);
            model.RequestWareItems = _produceDa.GetDetail(model.Produce.ID);

            return(View(model));
        }
示例#2
0
        public async Task <ActionResult> ListItems()
        {
            var model = new ProduceModel()
            {
                ListItems = _produceDa.GetListSimpleByRequest(Request),
                PageHtml  = _produceDa.GridHtmlPage
            };

            return(View(model));
        }
示例#3
0
        public async Task <ActionResult> ListItems(decimal todayCode)
        {
            var mode = new ProduceModel()
            {
                //get product order confirmed
                RequestWareItems = _requestWareDa.GetSummary(todayCode),
                // get product_detail from order
                CategorysDetail = _storageWareHouseDa.GetSummaryDetailConfirmed(todayCode).ToList()
            };

            //get detail

            return(PartialView(mode));
        }
示例#4
0
        /// <summary>生产消息</summary>
        /// <param name="job">作业</param>
        /// <param name="topic">主题</param>
        /// <param name="messages">消息集合</param>
        /// <param name="option">消息选项</param>
        /// <returns></returns>
        public override Int32 Produce(String job, String topic, String[] messages, MessageOption option = null)
        {
            if (topic.IsNullOrEmpty() || messages == null || messages.Length < 1)
            {
                return(0);
            }

            var model = new ProduceModel
            {
                Job      = job,
                Topic    = topic,
                Messages = messages,
            };

            if (option != null)
            {
                model.DelayTime = option.DelayTime;
                model.Unique    = option.Unique;
            }

            return(Ant.Produce(model));
        }
        private ProduceModel BuildProduceModel(ProduceQuantityForTicket produceQuantity)
        {
            var produceName = produceQuantity.ProduceName + " (" + produceQuantity.ProduceCode + ") " + produceQuantity.ItemBrand;

            if (!string.IsNullOrEmpty(produceQuantity.ItemPackType))
            {
                produceName += " - " + produceQuantity.ItemPackType;
            }
            if (!string.IsNullOrEmpty(produceQuantity.ItemPackSize))
            {
                produceName += " - " + produceQuantity.ItemPackSize;
            }

            var produceModel = new ProduceModel
            {
                ProduceName = produceName,
                //ExpectedQuantity = 12,
                QtyAvailable = (decimal)produceQuantity.TicketItemQuantity,
                // QtyStock= (decimal)produceQuantity.RemainingQuantity
            };

            return(produceModel);
        }
示例#6
0
        public Int32 Produce(ProduceModel model)
        {
            var messages = model?.Messages?.Distinct().ToArray();

            if (messages == null || messages.Length == 0)
            {
                return(0);
            }

            var app = _App;

            // 去重过滤
            if (model.Unique)
            {
                messages = AppMessage.Filter(app.ID, model.Topic, messages);
                if (messages.Length == 0)
                {
                    return(0);
                }
            }

            var ms = new List <AppMessage>();

            var total = 0;
            var now   = DateTime.Now;
            // 延迟需要基于任务开始时间,而不能用使用当前时间,防止回头跑数据时无法快速执行
            var dTime = now.AddSeconds(model.DelayTime);

            var jb   = Job.FindByAppIDAndName(app.ID, model.Job);
            var snow = AppMessage.Meta.Factory.Snow;

            foreach (var item in messages)
            {
                var jm = new AppMessage
                {
                    Id    = snow.NewId(),
                    AppID = app.ID,
                    JobID = jb == null ? 0 : jb.ID,
                    Topic = model.Topic,
                    Data  = item,
                };

                jm.CreateTime = jm.UpdateTime = now;

                // 雪花Id直接指定消息在未来的消费时间
                if (model.DelayTime > 0)
                {
                    jm.Id         = snow.NewId(dTime);
                    jm.UpdateTime = dTime;
                }

                ms.Add(jm);
            }

            // 记录消息积压数
            total = ms.BatchInsert();

            // 增加消息数
            if (total < 0)
            {
                total = messages.Length;
            }
            if (total > 0)
            {
                var job2 = app.Jobs?.FirstOrDefault(e => e.Topic == model.Topic);
                if (job2 != null)
                {
                    job2.MessageCount += total;
                    job2.SaveAsync();
                }

                app.MessageCount += total;
                app.SaveAsync();
            }

            return(total);
        }
示例#7
0
 /// <summary>生产消息</summary>
 /// <param name="model">模型</param>
 /// <returns></returns>
 public Int32 Produce(ProduceModel model) => Invoke <Int32>(nameof(Produce), model);