using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using LYFZ.Model.API; namespace LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls { public partial class OrderInfoTwoControlsEx : LYFZ.Software.UI.DoorCityProcess.SetCustomControls.OrderInfoTwoControlsEx { public OrderInfoTwoControlsEx(object obj = null) { this.txtSinceOrderNumber.ImeMode = System.Windows.Forms.ImeMode.Disable; this.txtTaoXiPrice.KeyPress += txtTaoXiPrice_KeyPress; this.txtSinceOrderNumber.KeyPress += txtSinceOrderNumber_KeyPress; this.txtTaoXiPrice.Leave += txtTaoXiPrice_Leave; this.btnOrderClsssSet.Click += btnOrderClsssSet_Click; //this.btn_PickUpSet.Click += btn_PickUpSet_Click; //CheckAndCreatePickUpClass(); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGAHBFDGCABAJIH", this.cmbtreevOrderClass); //LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAQJFS", this.cmbtreevPickup); this.SetOrderPanel(obj); } //void btn_PickUpSet_Click(object sender, EventArgs e) //{ // LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet(); // frm.TypeName = "AAAAQJFS"; // frm.Version = "Version"; // if (frm.ShowDialog() == DialogResult.OK) // { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAQJFS", this.cmbtreevPickup); } //} private string _strCustomPrefix; /// /// 自定义订单号前缀 /// public string StrCustomPrefix { get { _strCustomPrefix = this.lblCustomPrefix.Text.Trim(); return _strCustomPrefix; } set { _strCustomPrefix = value; this.lblCustomPrefix.Text = value; } } private LYFZ.Model.Model_ErpOrder _modelOrder; /// /// 当前选中的订单 /// public LYFZ.Model.Model_ErpOrder modelOrder { get { return _modelOrder; } set { _modelOrder = value; } } private bool _IsShowSinceOrderNumber; /// /// 是否显示自定义订单号 /// public bool IsShowSinceOrderNumber { get { return _IsShowSinceOrderNumber; } set { _IsShowSinceOrderNumber = value; } } /// /// 套系价格限制输入 /// /// /// void txtTaoXiPrice_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToString(e.KeyChar) == ".") { if (this.txtTaoXiPrice.Text.Trim().IndexOf('.') != -1 || string.IsNullOrEmpty(this.txtTaoXiPrice.Text.Trim())) { e.Handled = true; } return; } else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b') { e.Handled = true; } } /// /// 自定义单号限制输入 /// /// /// void txtSinceOrderNumber_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToString(e.KeyChar) == "-" || Convert.ToString(e.KeyChar) == "_") { } else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar) && !Char.IsLetterOrDigit(e.KeyChar)) { e.Handled = true; } } /// /// 套系金额离开事件 /// /// /// void txtTaoXiPrice_Leave(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtTaoXiPrice.Text.Trim())) { try { if (!LYFZ.Command.Command_Validate.IsNumeric(this.txtTaoXiPrice.Text.Trim())) { this.txtTaoXiPrice.Text = ""; } } catch { this.txtTaoXiPrice.Text = ""; } } } /// /// 检查和创建新的取件方式 /// void CheckAndCreatePickUpClass() { LYFZ.BLL.BLL_ErpSystemCategory bllCategory = new BLL.BLL_ErpSystemCategory(); Model.Model_ErpSystemCategory model = new Model.Model_ErpSystemCategory(); DataTable dt = bllCategory.GetList(" Sc_ClassCode = 'AAAAQJFS' ").Tables[0]; if(dt.Rows.Count==0) { model.Sc_ClassCode = "AAAAQJFS"; model.Sc_ClassName = "取件方式"; model.Sc_ClassParentID = 0; model.Sc_IsReadOnly = true; model.Sc_IsDisable = false; model.Sc_IsDelete = true; model.Sc_IsEnabledURL = false; bllCategory.Add(model); } } /// /// 订单类别设置 /// /// /// void btnOrderClsssSet_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet(); frm.TypeName = "BFAGAHBFDGCABAJIH"; frm.Version = "Version"; if (frm.ShowDialog() == DialogResult.OK) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGAHBFDGCABAJIH", this.cmbtreevOrderClass); } } /// /// 设置自己义单号和订单号是否显示 /// /// public void SetOrderPanel(object obj) { if (obj != null) { Hashtable htData = (Hashtable)obj; this.lblCustomPrefix.Text = htData["StrPrefix"].ToString().Trim(); this.txtOrderNumber.Text = htData["IsOrderNumber"].ToString(); this.panelOrderNumber.Visible = false; if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim())) { this.panelSinceOrderNumber.Visible = true; } else { this.panelSinceOrderNumber.Visible = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsCustomOrderNumber; } this.IsShowSinceOrderNumber = this.panelSinceOrderNumber.Visible; } } public void BindApiData(Api_ErpOrderModel erpModel) { erpModel.strOrderClass = this.cmbtreevOrderClass.Text; erpModel.bIsShowSinceOrderNumber = this.IsShowSinceOrderNumber; if (this.IsShowSinceOrderNumber) { erpModel.SinceOrderNumber = this.txtSinceOrderNumber.Text; } erpModel.strRemark = this.txtRemark.Text; erpModel.strHotelInfo = ""; erpModel.strParentTaoXiName = "服务套系"; erpModel.strTaoXiName = "服务套系"; if (this.txtTaoXiPrice.Text.Trim() == "") { erpModel.strTaoXiPrice = "0"; } else { erpModel.strTaoXiPrice = this.txtTaoXiPrice.Text.Trim(); } //erpModel.strPickUpType = this.cmbtreevPickup.Text; //erpModel.strPickUpTypeCode = this.cmbtreevPickup.Tag == null ? "" : (this.cmbtreevPickup.Tag).ToString(); //erpModel.IsMagess = this.IsMagess; } /// /// 获取订单资料 /// public LYFZ.Model.Model_ErpOrder GetOrderValue(string StrNewOrderNumber, string StrOrderType, string StrLovedStyle, string StrCustomerSource, string StrClass, string StrInfoID, DateTime StrTime, string StrUserID, bool IsMagess = true) { if (IsMagess) { if (this.IsShowSinceOrderNumber) { if (this.txtSinceOrderNumber.Text.Trim() == "") { MessageBoxCustom.Show("自定单号不能为空!"); return null; } } if (this.txtTaoXiPrice.Text.Trim() == "") { MessageBoxCustom.Show("套系价格不能为空!"); return null; } } if (this.txtRemark.Text.Trim().Length > 300) { MessageBoxCustom.Show("订单备注不能超过300字!"); return null; } LYFZ.Model.Model_ErpOrder model = null; if (this.modelOrder != null) { model = this.modelOrder; model.Ord_Number = this.txtOrderNumber.Text.Trim(); model.Ord_UpdateDateTime = StrTime; model.Ord_UpdateName = StrUserID; } else { model = new Model.Model_ErpOrder(); //model.ID = -1; model.Ord_Number = StrNewOrderNumber; model.Ord_Type = StrOrderType; model.Ord_CreateDateTime = StrTime; model.Ord_CreateName = StrUserID; } //model.Ord_SinceOrderNumber = ""; if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsCustomOrderNumber) { string strCustomNumber = this.txtSinceOrderNumber.Text; if (this.lblCustomPrefix.Tag != null) { if ((bool)this.lblCustomPrefix.Tag) { strCustomNumber = this.lblCustomPrefix.Text + strCustomNumber; } } model.Ord_SinceOrderNumber = strCustomNumber; DataTable tblCount = new DataTable(); if (!string.IsNullOrEmpty(model.Ord_Number)) { tblCount = new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpOrder", StrWhere: "Ord_SinceOrderNumber = '" + model.Ord_SinceOrderNumber + "' and Ord_Number != '" + model.Ord_Number.Trim() + "'", ShowColumnName: "ID").Tables[0]; } else { tblCount = new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpOrder", StrWhere: "Ord_SinceOrderNumber = '" + model.Ord_SinceOrderNumber + "' ", ShowColumnName: "ID").Tables[0]; } if (tblCount.Rows.Count > 0) { MessageBoxCustom.Show("自定义单已被使用,不能重复使用!"); return null; } } else { //if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim())) //{ model.Ord_SinceOrderNumber = this.lblCustomPrefix.Text + this.txtSinceOrderNumber.Text; } //else //{ model.Ord_SinceOrderNumber = StrNewOrderNumber; } model.Ord_SinceOrderNumber = this.modelOrder.Ord_SinceOrderNumber; } if (model.Ord_DividedShop == null || string.IsNullOrEmpty(model.Ord_DividedShop.Trim())) { model.Ord_DividedShop = StrInfoID; } model.Ord_Class = StrClass; if (StrClass == "1" && string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(model.Ord_SaveOrderDateTime))) { model.Ord_SaveOrderDateTime = StrTime; } model.Ord_CustomerSource = StrCustomerSource; model.Ord_LovedStyle = StrLovedStyle; model.Ord_PhotographyCategory = "服务套系"; model.Ord_SeriesName = "服务套系"; if (this.txtTaoXiPrice.Text.Trim() == "") { model.Ord_SeriesPrice = 0; } else { model.Ord_SeriesPrice = Convert.ToDecimal(this.txtTaoXiPrice.Text.Trim()); } model.Ord_OrderClass = this.cmbtreevOrderClass.Text.Trim(); model.Ord_Remark = this.txtRemark.Text; model.Ord_HotelInfo = ""; return model; } /// /// 设置订单资料 /// public void SetOrderValue(LYFZ.Model.Model_ErpOrder model) { string StrCustomNumber = model.Ord_SinceOrderNumber; //if (!string.IsNullOrEmpty(this.lblCustomPrefix.Text.Trim())) //{ // if (!string.IsNullOrEmpty(model.Ord_SinceOrderNumber)) // { // if (model.Ord_SinceOrderNumber.IndexOf(this.lblCustomPrefix.Text.Trim()) != -1) // { StrCustomNumber = model.Ord_SinceOrderNumber.Substring(this.lblCustomPrefix.Text.Trim().Length, model.Ord_SinceOrderNumber.Length - this.lblCustomPrefix.Text.Trim().Length); }// model.Ord_SinceOrderNumber.Replace(this.lblCustomPrefix.Text.Trim(), ""); } // } //} if (!string.IsNullOrEmpty(StrCustomNumber)) { this.lblCustomPrefix.Visible = false; this.txtSinceOrderNumber.Location = new Point(84, 0); this.txtSinceOrderNumber.Width = 200; this.lblCustomPrefix.Tag = false; } else { this.lblCustomPrefix.Tag = true; } this.txtSinceOrderNumber.Text = StrCustomNumber; if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim())) { this.txtSinceOrderNumber.ReadOnly = true; } if (!string.IsNullOrEmpty(this.txtSinceOrderNumber.Text.Trim())) { this.panelOrderNumber.Visible = true; } this.txtOrderNumber.Text = model.Ord_Number; string strSeriesName = model.Ord_SeriesName.Trim(); if (strSeriesName == "") { strSeriesName = model.Ord_PhotographyCategory.Trim(); } this.cmbtreevOrderClass.TextFindTag(model.Ord_OrderClass); //this.cmbtreevPickup.TextFindTag(model.Ord_PickUpType); this.txtTaoXiPrice.Text = model.Ord_SeriesPrice.ToString(); this.txtRemark.Text = model.Ord_Remark; this.modelOrder = model; if (!model.Ord_Number.Equals(model.Ord_SinceOrderNumber)) { this.panelSinceOrderNumber.Visible = true; this.IsShowSinceOrderNumber = this.panelSinceOrderNumber.Visible; this.Height = 158; } } } }