private void btnSave_Click(object sender, RoutedEventArgs e) { string strAsilePrice = tbAsilePrice_Value.Text; string strSpringNum = tbSpringNum_Value.Text; string strAsileKind = "0"; string strSellModel = "0"; BusinessEnum.AsileSellModel asileSellModel = BusinessEnum.AsileSellModel.Normal; if (rbStop.IsChecked == true) { strAsileKind = "1"; } if (rdbSellModel_Gift.IsChecked == true) { strSellModel = "1"; asileSellModel = BusinessEnum.AsileSellModel.Gift; } #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 检查是否需要修改 bool blnIsSave = false; if ((currentGoodsWay.CurrentGoodsWayProduct.SellPrice != dblAsilePrice.ToString()) || (currentGoodsWay.CurrentGoodsWayProduct.SpringNum.ToString() != strSpringNum) || (currentGoodsWay.CurrentGoodsWayProduct.PaKind != strAsileKind) || (currentGoodsWay.CurrentGoodsWayProduct.SellModel != asileSellModel)) { blnIsSave = true; } #endregion if (blnIsSave) { ControlAsile(false); btnCancel.IsEnabled = false; DispatcherHelper.DoEvents(); PubHelper.p_BusinOper.AsileOper.Asile_Temp.PaCode = currentGoodsWay.CurrentGoodsWayProduct.PaCode; PubHelper.p_BusinOper.AsileOper.Asile_Temp.SellPrice = dblAsilePrice.ToString(); PubHelper.p_BusinOper.AsileOper.Asile_Temp.SpringNum = Convert.ToInt32(strSpringNum); PubHelper.p_BusinOper.AsileOper.Asile_Temp.PaKind = strAsileKind; PubHelper.p_BusinOper.AsileOper.Asile_Temp.PaStatus = strSellModel; InitOper(); m_OperType = "0"; // 启动保存操作线程 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.UpdateAsileInfo(currentGoodsWay.CurrentGoodsWayProduct.PaCode, //// dblAsilePrice.ToString(), strSpringNum, strAsileKind, strSellModel); if (m_OperResult) { currentGoodsWay.CurrentGoodsWayProduct.SellPrice = dblAsilePrice.ToString(); currentGoodsWay.CurrentGoodsWayProduct.SpringNum = Convert.ToInt32(strSpringNum); SetAsileInfo(currentGoodsWay); PubHelper.p_IsRefreshAsile = true; 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; } }
/// <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 }