Example #1
0
        private void textBox_PlanNo_Last_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                var planId = this.textBox_PlanNo_Last.Text.Trim();

                using (_dbcontext = new FlowManageSystemEntities())
                {
                    orderRepositoy = new OrderRepository(_dbcontext);

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

                    var order  = orderRepositoy.getOrderByPlanNo(planId);
                    var snMin  = order.SnMin;
                    var snMax  = order.SnMax;
                    var needDo = order.OnLineQuantity;

                    //根据SN范围查询已经做了测试的
                    using (_opwayDbContext = new ATSDATABASEEntities())
                    {
                        opwayDataRepository = new OpwayDataRepository(_opwayDbContext);


                        //拿到已做的数量更新界面
                        var count = 0;
                        if (this.cBox_LastUndo.Checked == true)
                        {
                            var listFinishedSn = opwayDataRepository.GetLastTestFinishedSN(snMin, snMax);
                            var AllList        = SnHelper.GetSnlist(snMin, needDo);
                            count = listFinishedSn.Count();
                            //更新界面未做的SN
                            this.ltBox_LastUndo.DataSource = AllList.Except(listFinishedSn).ToList();
                        }
                        else
                        {
                            count = opwayDataRepository.GetLastTestCount(snMin, snMax);
                        }
                        this.lbLastTestFinished.Text = count.ToString();
                    }
                }
            }
        }
Example #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();
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// 订单入库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox_Storage_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (!RegexHelper.regExpNumber.IsMatch(this.textBox_StorageNumber.Text.Trim()))
                {
                    MessageBox.Show("入库数量应该是数字");
                    return;
                }
                //从界面获取计划单号   和 入库数量
                var planId       = this.textBox_Storage.Text.Trim();
                var StorageCount = Convert.ToInt32(this.textBox_StorageNumber.Text);

                using (_dbcontext = new FlowManageSystemEntities())
                {
                    orderRepositoy = new OrderRepository(_dbcontext);

                    //判断计划单号是否存在
                    if (!orderRepositoy.PlanNoExist(planId))
                    {
                        MessageBox.Show("当前计划单号在数据库不存在,请检查!");
                        return;
                    }

                    //获取当前订单生产模块个数
                    var order   = orderRepositoy.getOrderByPlanNo(planId);
                    var count   = order.OnLineQuantity;
                    var dbCount = order.OrderStorageCount;

                    //入库数量不能大于订单要求做的数量
                    if (count < StorageCount)
                    {
                        MessageBox.Show("当前订单数量: " + count + " 入库数量:" + StorageCount + "请检查错误!");
                        return;
                    }


                    //不允许重复入库
                    if (dbCount != null)
                    {
                        MessageBox.Show("当前订单已入库!!!入库数量:" + dbCount);
                        return;
                    }

                    //获取实际测试个数
                    using (_opwayDbContext = new ATSDATABASEEntities())
                    {
                        var snMin = order.SnMin;
                        var snMax = order.SnMax;

                        opwayDataRepository = new OpwayDataRepository(_opwayDbContext);
                        if (opwayDataRepository.GetLastTestCount(snMin, snMax) < StorageCount)
                        {
                            MessageBox.Show("入库数量不能大于终测通过的数量!!!");
                            return;
                        }
                    }


                    //检查通过  进行入库
                    try
                    {
                        orderRepositoy.OrderStorage(planId, StorageCount);
                        orderRepositoy.SaveChanges();

                        MessageBox.Show("入库成功!");
                        this.textBox_Storage.Text       = "";
                        this.textBox_StorageNumber.Text = "";
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("发生异常:" + ex.Message);
                    }
                }
            }
        }