Exemplo n.º 1
0
        /// <summary>
        /// 选择不同的订单时  获取已经领取的物料数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OrderGridView_SelectionChanged(object sender, EventArgs e)
        {
            var id = (this.OrderGridView.CurrentRow.DataBoundItem as OrderPlacing).OrderId;

            //通过Id 获取已经领料的数量
            using (_dbcontext = new FlowManageSystemEntities())
            {
                collectionRepository = new CollectionRepository(_dbcontext);

                if (collectionRepository.IsOrderCollectionExist(id))
                {
                    this.lbMaterialCount.Text = collectionRepository.GetCurrentOrderCollectionInfo(id).ToString();
                }
                else
                {
                    this.lbMaterialCount.Text = "0";
                }
            }
        }
Exemplo n.º 2
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();
                    }
                }
            }
        }