예제 #1
0
        private void ControlForm(bool enable)
        {
            panelAsile.IsEnabled    = enable;
            panelTray.IsEnabled     = enable;
            btnCancel.IsEnabled     = enable;
            btnViewResult.IsEnabled = enable;

            switch (m_TestType)
            {
            case "0":    // 单货道测试
                if (!enable)
                {
                    btnAsileTest_Begin.IsEnabled     = btnAsileTest_Stop.IsEnabled =
                        btnWholeTest_Begin.IsEnabled = enable;
                    currentGoodsWay.SetSecondText(m_Testing);
                }
                else
                {
                    btnAsileTest_Begin.IsEnabled = btnWholeTest_Begin.IsEnabled = true;
                    btnAsileTest_Stop.IsEnabled  = false;
                }

                break;

            //case "1":// 托盘测试
            //    btnAsileTest_Stop.IsEnabled = !enable;
            //    btnAsileTest_Begin.IsEnabled = btnWholeTest_Begin.IsEnabled = enable;
            //    break;

            default:    // 托盘测试或整机测试
                btnAsileTest_Stop.IsEnabled  = !enable;
                btnAsileTest_Begin.IsEnabled = btnWholeTest_Begin.IsEnabled = enable;
                break;
            }
        }
예제 #2
0
 /// <summary>
 /// 重置产品库存到默认值
 /// </summary>
 /// <param name="i"></param>
 private void ResetProductInventory(int i)
 {
     if (currentGoodsWay != null)
     {
         currentGoodsWay.SetSecondText(m_Title_StockNum.Replace("{N}", i.ToString()));
     }
     tnProductInventory.Text = i.ToString();
     tnProductInventory.Tag  = i;
 }
예제 #3
0
        /// <summary>
        /// 创建货道
        /// </summary>
        private void CreateAsile(List <AsileModel> products)
        {
            panelAsile.Children.Clear();

            int index = 0;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    GoodsWayProduct productControl = new GoodsWayProduct()
                    {
                        HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                        VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                        Margin = new Thickness(5)
                    };
                    productControl.SetBackBackGroud(App.Current.Resources["AsileNormal"] as Brush);
                    productControl.SetCheckBackGround(App.Current.Resources["AsileTest"] as Brush);
                    Grid.SetRow(productControl, i);
                    Grid.SetColumn(productControl, j);
                    panelAsile.Children.Add(productControl);

                    productControl.MouseLeftButtonUp += (GoodsWayChecked);

                    if (index < products.Count)
                    {
                        productControl.SetCurrentGoodsWayProduct(products[index]);
                        productControl.SetOneText(products[index].PaCode);

                        productControl.SetSecondText(GetAsileStatus(products[index].PaStatus));
                    }
                    else
                    {
                        productControl.SetNoGoods(m_NoGoodsTitle);
                    }
                    index++;
                }
            }

            m_AsileCount = panelAsile.Children.Count;

            if (!m_IsTrdOper)
            {
                if (products.Count == 0)
                {
                    btnAsileTest_Begin.IsEnabled = btnAsileTest_Stop.IsEnabled = false;
                }
                else
                {
                    btnAsileTest_Begin.IsEnabled = true;
                    btnAsileTest_Stop.IsEnabled  = false;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 创建货道
        /// </summary>
        private void CreateAsile(List <AsileModel> products)
        {
            panelAsile.Children.Clear();

            int index = 0;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    GoodsWayProduct productControl = new GoodsWayProduct()
                    {
                        HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                        VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                        Margin = new Thickness(5)
                    };

                    Grid.SetRow(productControl, i);
                    Grid.SetColumn(productControl, j);
                    panelAsile.Children.Add(productControl);

                    productControl.MouseLeftButtonUp += (GoodsWayChecked);

                    if (index < products.Count)
                    {
                        productControl.SetCurrentGoodsWayProduct(products[index]);
                        productControl.SetOneText(products[index].PaCode +
                                                  "【" + m_Title_SpringNum + products[index].SpringNum + "】");
                        productControl.SetSecondText(m_Title_StockNum.Replace("{N}", products[index].SurNum.ToString()));
                        if (index == 0)
                        {
                            productControl.IsDefaultCheck(true);
                            GoodsWayChecked(productControl, null);
                        }
                    }
                    else
                    {
                        productControl.SetNoGoods(m_Title_NoGoodsTitle);
                    }
                    index++;
                }
            }

            if (products.Count == 0)
            {
                btnTrayFull.IsEnabled = false;
            }
            else
            {
                btnTrayFull.IsEnabled = true;
            }
        }
예제 #5
0
        /// <summary>
        /// 创建货道
        /// </summary>
        private void CreateAsile(List <AsileModel> products)
        {
            panelAsile.Children.Clear();

            int index = 0;

            string strLeftRightCodeNum = string.Empty;

            ////string strLeftRightNumsTitle = string.Empty;
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    GoodsWayProduct productControl = new GoodsWayProduct()
                    {
                        HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                        VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                        Margin = new Thickness(5)
                    };
                    productControl.SetBackBackGroud(App.Current.Resources["AsileNormal"] as Brush);
                    productControl.SetCheckBackGround(App.Current.Resources["AsileTest"] as Brush);
                    Grid.SetRow(productControl, i);
                    Grid.SetColumn(productControl, j);
                    panelAsile.Children.Add(productControl);

                    productControl.MouseLeftButtonUp += (GoodsWayChecked);

                    if (index < products.Count)
                    {
                        productControl.SetCurrentGoodsWayProduct(products[index]);
                        productControl.SetOneText(products[index].PaCode);

                        string strVendBoxCode  = products[index].VendBoxCode;
                        int    intVendBoxIndex = PubHelper.p_BusinOper.AsileOper.GetVendBoxIndex(strVendBoxCode);
                        strLeftRightCodeNum = PubHelper.p_BusinOper.AsileOper.UpDown_GetLeftRightCodeNum(strVendBoxCode,
                                                                                                         products[index].PaId.Substring(1, 1), PubHelper.p_BusinOper.AsileOper.VendBoxList[intVendBoxIndex].SellGoodsType,
                                                                                                         PubHelper.p_BusinOper.ConfigInfo.UpDownLeftRightNum_Left,
                                                                                                         PubHelper.p_BusinOper.ConfigInfo.UpDownLeftRightNum_Center,
                                                                                                         PubHelper.p_BusinOper.ConfigInfo.UpDownLeftRightNum_Right).ToString();
                        productControl.SetSecondText(strLeftRightCodeNum);
                    }
                    else
                    {
                        productControl.SetNoGoods(m_NoGoodsTitle);
                    }
                    index++;
                }
            }
        }
        private void SetAsileInfo(GoodsWayProduct asileInfo)
        {
            string strOneText = string.Empty;

            if (string.IsNullOrEmpty(asileInfo.CurrentGoodsWayProduct.McdCode))
            {
                strOneText = asileInfo.CurrentGoodsWayProduct.PaCode;
            }
            else
            {
                strOneText = asileInfo.CurrentGoodsWayProduct.PaCode +
                             " " + asileInfo.CurrentGoodsWayProduct.McdName;// +"】";
            }
            asileInfo.SetOneText(strOneText);
            asileInfo.SetSecondText(PubHelper.p_BusinOper.MoneyIntToString(asileInfo.CurrentGoodsWayProduct.SellPrice) +
                                    "【" + asileInfo.CurrentGoodsWayProduct.SpringNum + "】");
        }
예제 #7
0
        /// <summary>
        /// 创建货道
        /// </summary>
        private void CreateAsile(List <AsileModel> products)
        {
            panelAsile.Children.Clear();

            int index = 0;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    GoodsWayProduct productControl = new GoodsWayProduct()
                    {
                        HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                        VerticalAlignment   = System.Windows.VerticalAlignment.Stretch,
                        Margin = new Thickness(5)
                    };
                    ////productControl.SetBackBackGroud(App.Current.Resources["AsileNormal"] as Brush);
                    ////productControl.SetCheckBackGround(App.Current.Resources["AsileTest"] as Brush);
                    Grid.SetRow(productControl, i);
                    Grid.SetColumn(productControl, j);
                    panelAsile.Children.Add(productControl);

                    ////////productControl.MouseLeftButtonUp += (GoodsWayChecked);

                    if (index < products.Count)
                    {
                        productControl.SetCurrentGoodsWayProduct(products[index]);
                        productControl.SetOneText(products[index].PaCode +
                                                  "【" + m_Title_SaleNum + "  " + products[index].SaleNum + "】");

                        productControl.SetSecondText(m_Title_SaleMoney + "  " +
                                                     PubHelper.p_BusinOper.MoneyIntToString(products[index].SaleMoney.ToString()));
                    }
                    else
                    {
                        productControl.SetNoGoods(m_NoGoodsTitle);
                    }
                    index++;
                }
            }

            m_AsileCount = panelAsile.Children.Count;
        }
예제 #8
0
        /// <summary>
        /// 设置托盘库存
        /// </summary>
        /// <param name="type">类型 0:托盘补满 1:按照设置的数量进行托盘设置</param>
        private void SetTrayStockNum(string type)
        {
            ControlSet(false);

            // 确定要补满
            string mcdCode = string.Empty;
            bool   result  = false;

            result = PubHelper.p_BusinOper.PutGoods(m_VendBoxCode, "2", type,
                                                    currentTrayIndex.ToString(), tnProductInventory.Text, out mcdCode);
            if (result)
            {
                PubHelper.p_IsRefreshAsile = true;

                #region 更新该托盘内的所有货道库存

                int intAsileCount = panelAsile.Children.Count;
                for (int asileIndex = 0; asileIndex < intAsileCount; asileIndex++)
                {
                    GoodsWayProduct productControl = (GoodsWayProduct)panelAsile.Children[asileIndex];
                    if (productControl.CurrentGoodsWayProduct != null)
                    {
                        productControl.SetSecondText(m_Title_StockNum.Replace("{N}", productControl.CurrentGoodsWayProduct.SurNum.ToString()));
                    }
                }

                #endregion

                PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperSuc"), PubHelper.MsgType.Ok);
            }
            else
            {
                PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperFail"), PubHelper.MsgType.Ok);
            }

            ControlSet(true);
        }
        /// <summary>
        /// 按钮—托盘设置价格
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSetTray_Click(object sender, RoutedEventArgs e)
        {
            if (!PubHelper.CheckIsManager1Purview("10"))
            {
                return;
            }

            string strAsilePrice = tbAsilePrice_Value.Text;

            #region 检查数据有效性

            string _errInfo = string.Empty;
            if (!PubHelper.CheckInputPrice(strAsilePrice, out _errInfo))
            {
                // 金额格式错误
                PubHelper.ShowMsgInfo(_errInfo, PubHelper.MsgType.Ok);
                return;
            }

            double dblAsilePrice = Convert.ToDouble(strAsilePrice) * PubHelper.p_BusinOper.ConfigInfo.DecimalNum;

            #endregion

            #region 保存托盘价格

            string strAskInfo = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AsileCfg_TrayAsk");
            strAskInfo = strAskInfo.Replace("{N}", PubHelper.p_BusinOper.ChangeTray((currentTrayIndex + 1).ToString()));
            strAskInfo = strAskInfo.Replace("{K}", strAsilePrice);

            PubHelper.ShowMsgInfo(strAskInfo, PubHelper.MsgType.YesNo);
            if (PubHelper.p_MsgResult)
            {
                ControlAsile(false);
                btnCancel.IsEnabled = false;
                DispatcherHelper.DoEvents();

                PubHelper.p_BusinOper.AsileOper.Asile_Temp.TrayIndex = currentTrayIndex;
                PubHelper.p_BusinOper.AsileOper.Asile_Temp.SellPrice = dblAsilePrice.ToString();

                InitOper();
                m_OperType = "1";
                // 启动保存操作线程
                Thread TrdOper = new Thread(new ThreadStart(OperTrd));
                TrdOper.IsBackground = true;
                TrdOper.Start();

                int delayTime = 0;
                while (!m_IsOper)
                {
                    Thread.Sleep(50);
                    delayTime++;
                    if (delayTime > 200)
                    {
                        break;
                    }
                }

                ////bool result = PubHelper.p_BusinOper.UpdateTrayPrice(currentTrayIndex.ToString(),
                ////    dblAsilePrice.ToString(), m_VendBoxCode);
                if (m_OperResult)
                {
                    PubHelper.p_IsRefreshAsile = true;

                    currentGoodsWay.CurrentGoodsWayProduct.SellPrice = dblAsilePrice.ToString();

                    #region 更新该托盘内的所有货道价格

                    int intAsileCount = panelAsile.Children.Count;
                    for (int asileIndex = 0; asileIndex < intAsileCount; asileIndex++)
                    {
                        GoodsWayProduct productControl = (GoodsWayProduct)panelAsile.Children[asileIndex];
                        if (productControl.CurrentGoodsWayProduct != null)
                        {
                            productControl.SetSecondText(PubHelper.p_BusinOper.MoneyIntToString(dblAsilePrice.ToString()) +
                                                         "【" + productControl.CurrentGoodsWayProduct.SpringNum + "】");
                        }
                    }

                    #endregion

                    PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperSuc"), PubHelper.MsgType.Ok);
                }
                else
                {
                    PubHelper.ShowMsgInfo(PubHelper.p_LangOper.GetStringBundle("Pub_OperFail"), PubHelper.MsgType.Ok);
                }

                ControlAsile(true);
                btnCancel.IsEnabled = true;
            }

            #endregion
        }
예제 #10
0
        /// <summary>
        /// 货道测试工作主线程
        /// </summary>
        private void AsileTestTrd()
        {
            int intErrCode = 0;

            m_IsTrdOper = true;

            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                ControlForm(false);
            }));

            switch (m_TestType)
            {
            case "0":    // 单货道测试
                m_TestTotalNum++;
                intErrCode = PubHelper.p_BusinOper.TestAsile(m_TestCode);
                this.tbTitle.Dispatcher.Invoke(new Action(() =>
                {
                    tbTestTotalNum.Text = m_TestTotalNum.ToString();
                    if (intErrCode == 0)
                    {
                        currentGoodsWay.SetSecondText(m_Title_AsileNormal);
                    }
                    else
                    {
                        currentGoodsWay.SetSecondText(m_Title_AsileFail_Code.Replace("{N}", intErrCode.ToString()));
                    }
                }));

                break;

            case "1":    // 托盘测试
            case "2":    // 整机测试
                if (m_TestType == "2")
                {
                    this.tbTitle.Dispatcher.Invoke(new Action(() =>
                    {
                        m_TrayCount = panelTray.Children.Count;
                    }));
                }
                bool blnAsileIsNull = false;    // 货道格子是否为空 False:不为空 True:为空
                for (int trayIndex = 0; trayIndex < m_TrayCount; trayIndex++)
                {
                    if (m_IsStopTest)
                    {
                        break;
                    }

                    if (m_TestType == "2")
                    {
                        this.tbTitle.Dispatcher.Invoke(new Action(() =>
                        {
                            var palletButton       = panelTray.Children[trayIndex] as RadioButton;
                            palletButton.IsChecked = true;
                        }));

                        if (m_IsLoopTest)
                        {
                            // 整机测试做循环测试
                            if (trayIndex == m_TrayCount - 1)
                            {
                                trayIndex = -1;
                            }
                        }
                    }

                    Thread.Sleep(200);
                    for (int asileIndex = 0; asileIndex < m_AsileCount; asileIndex++)
                    {
                        if (m_IsStopTest)
                        {
                            break;
                        }
                        blnAsileIsNull = true;
                        m_TestTotalNum++;
                        this.tbTitle.Dispatcher.Invoke(new Action(() =>
                        {
                            GoodsWayProduct productControl = (GoodsWayProduct)panelAsile.Children[asileIndex];
                            if (productControl.CurrentGoodsWayProduct != null)
                            {
                                blnAsileIsNull = false;
                                if (currentGoodsWay != null)
                                {
                                    currentGoodsWay.ToNormal();
                                }
                                //
                                currentGoodsWay = productControl;
                                currentGoodsWay.ToCheck();

                                m_TestCode          = currentGoodsWay.CurrentGoodsWayProduct.PaCode;
                                tbNowAsileCode.Text = m_TestCode;
                                currentGoodsWay.SetSecondText(m_Testing);
                            }
                        }));
                        if (m_TestType == "1")
                        {
                            // 如果是托盘循环测试
                            if (m_IsLoopTest)
                            {
                                if (asileIndex == m_AsileCount - 1)
                                {
                                    asileIndex = -1;
                                }
                            }
                        }

                        if (!blnAsileIsNull)
                        {
                            intErrCode = PubHelper.p_BusinOper.TestAsile(m_TestCode);
                            this.tbTitle.Dispatcher.Invoke(new Action(() =>
                            {
                                tbTestTotalNum.Text = m_TestTotalNum.ToString();
                                if (intErrCode == 0)
                                {
                                    currentGoodsWay.SetSecondText(m_Title_AsileNormal);
                                }
                                else
                                {
                                    currentGoodsWay.SetSecondText(m_Title_AsileFail_Code.Replace("{N}", intErrCode.ToString()));
                                }
                            }));
                        }
                    }
                }

                break;
            }

            this.tbTitle.Dispatcher.Invoke(new Action(() =>
            {
                ControlForm(true);
            }));

            m_IsTrdOper = false;
        }