/// <summary> /// 货道中的产品选中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GoodsWayChecked(object sender, MouseButtonEventArgs e) { if (CheckIsTesting()) { return; } var goodsWay = (sender as GoodsWayProduct); if (goodsWay == currentGoodsWay) { return; } if (goodsWay != null) { if (currentGoodsWay != null) { currentGoodsWay.ToNormal(); } goodsWay.ToCheck(); currentGoodsWay = goodsWay; } if (currentGoodsWay.CurrentGoodsWayProduct != null) { btnTest.IsEnabled = true; m_AsileCode = currentGoodsWay.CurrentGoodsWayProduct.PaCode; } else { btnTest.IsEnabled = false; m_AsileCode = string.Empty; } }
/// <summary> /// 货道中的产品选中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AsileButtonChecked(object sender, MouseButtonEventArgs e) { var goodsWay = (sender as GoodsWayProduct); if (goodsWay == currentGoodsWay) { return; } if (goodsWay != null) { if (currentGoodsWay != null) { currentGoodsWay.ToNormal(); } goodsWay.ToCheck(); currentGoodsWay = goodsWay; } ShowAsileInfo(); if (currentGoodsWay.CurrentGoodsWayProduct != null) { ControlAsile(true); } else { ControlAsile(false); } }
/// <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; } } }
/// <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; } }
/// <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 + "】"); }
/// <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; }
/// <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 GoodsWayChecked(object sender, MouseButtonEventArgs e) { if (CheckIsTesting()) { return; } var goodsWay = (sender as GoodsWayProduct); if (goodsWay == currentGoodsWay) { return; } if (goodsWay != null) { if (currentGoodsWay != null) { currentGoodsWay.ToNormal(); } goodsWay.ToCheck(); currentGoodsWay = goodsWay; } if (currentGoodsWay.CurrentGoodsWayProduct != null) { ////ResetProductInventory(currentGoodsWay.CurrentGoodsWayProduct.SurNum); ////btnSave.IsEnabled = true; // 开始单货道测试 m_TestType = "0"; tbAsileTest.Text = m_Title_SingleTest; m_TestCode = currentGoodsWay.CurrentGoodsWayProduct.PaCode; tbNowAsileCode.Text = m_TestCode; Thread TrdAsileTest = new Thread(new ThreadStart(AsileTestTrd)); TrdAsileTest.IsBackground = true; TrdAsileTest.Start(); } }
/// <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 }
/// <summary> /// 创建货道 /// </summary> private void CreateAsile(List <AsileModel> products) { panelAsile.Children.Clear(); int index = 0; string strOneText = 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) }; Grid.SetRow(productControl, i); Grid.SetColumn(productControl, j); panelAsile.Children.Add(productControl); productControl.MouseLeftButtonUp += (AsileButtonChecked); if (index < products.Count) { productControl.SetCurrentGoodsWayProduct(products[index]); SetAsileInfo(productControl); ////if (string.IsNullOrEmpty(products[index].McdName)) ////{ //// strOneText = products[index].PaCode; ////} ////else ////{ //// strOneText = products[index].PaCode + "【" + products[index].McdName + "】"; ////} ////productControl.SetOneText(strOneText); ////productControl.SetSecondText(PubHelper.p_BusinOper.MoneyIntToString(products[index].SellPrice)); if (index == 0) { productControl.IsDefaultCheck(true); AsileButtonChecked(productControl, null); } } else { productControl.SetNoGoods(m_Title_NoGoodsTitle); } index++; } } if (products.Count == 0) { ControlAsile(false); } else { ControlAsile(true); } }
/// <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; }
/// <summary> /// 货道中的产品选中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GoodsWayChecked(object sender, MouseButtonEventArgs e) { var goodsWay = (sender as GoodsWayProduct); if (goodsWay == currentGoodsWay) { return; } if (goodsWay != null) { if (currentGoodsWay != null) { currentGoodsWay.ToNormal(); } goodsWay.ToCheck(); currentGoodsWay = goodsWay; } if (currentGoodsWay.CurrentGoodsWayProduct != null) { bdFillUpNumArea.Background = new SolidColorBrush(Colors.White); ResetProductInventory(currentGoodsWay.CurrentGoodsWayProduct.SurNum); btnDelete.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_REDUCE_NORMAL)); tbBatch_Value.Text = currentGoodsWay.CurrentGoodsWayProduct.PiCi; tbMaxValidDate_Value.Text = currentGoodsWay.CurrentGoodsWayProduct.MaxValidDate; tbProductDate_Value.Text = currentGoodsWay.CurrentGoodsWayProduct.ProductDate; tbBatch_Value.IsEnabled = tbMaxValidDate_Value.IsEnabled = tbProductDate_Value.IsEnabled = true; btnSave.IsEnabled = btnTrayFull.IsEnabled = true; int intSurNum = currentGoodsWay.CurrentGoodsWayProduct.SurNum; // 当前货道库存 int intSpringNum = currentGoodsWay.CurrentGoodsWayProduct.SpringNum; // 当前货道弹簧圈数 if (intSurNum < intSpringNum) { #region 当前货道的库存小于货道弹簧圈数 if ((intSpringNum >= 1) && (intSurNum == 0)) { btnAdd.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_ADD_NORMAL)); btnDelete.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_REDUCE_GRAY)); btnAdd.IsEnabled = true; btnDelete.IsEnabled = false; } else { btnAdd.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_ADD_NORMAL)); btnDelete.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_REDUCE_NORMAL)); btnAdd.IsEnabled = btnDelete.IsEnabled = true; } #endregion } else { btnAdd.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_ADD_GRAY)); btnDelete.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_REDUCE_NORMAL)); btnAdd.IsEnabled = false; btnDelete.IsEnabled = true; } } else { bdFillUpNumArea.Background = new SolidColorBrush(Color.FromRgb(209, 204, 204)); btnDelete.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_REDUCE_GRAY)); btnAdd.Source = new BitmapImage(new Uri(SkinHelper.FILEPATH_ADD_GRAY)); btnSave.IsEnabled = btnTrayFull.IsEnabled = false; tbBatch_Value.Text = tbMaxValidDate_Value.Text = tbProductDate_Value.Text = string.Empty; tbBatch_Value.IsEnabled = tbMaxValidDate_Value.IsEnabled = tbProductDate_Value.IsEnabled = false; } }