123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- 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;
- /// <summary>
- /// 自定义订单号前缀
- /// </summary>
- public string StrCustomPrefix
- {
- get
- {
- _strCustomPrefix = this.lblCustomPrefix.Text.Trim();
- return _strCustomPrefix;
- }
- set
- {
- _strCustomPrefix = value;
- this.lblCustomPrefix.Text = value;
- }
- }
- private LYFZ.Model.Model_ErpOrder _modelOrder;
- /// <summary>
- /// 当前选中的订单
- /// </summary>
- public LYFZ.Model.Model_ErpOrder modelOrder
- {
- get { return _modelOrder; }
- set { _modelOrder = value; }
- }
- private bool _IsShowSinceOrderNumber;
- /// <summary>
- /// 是否显示自定义订单号
- /// </summary>
- public bool IsShowSinceOrderNumber
- {
- get { return _IsShowSinceOrderNumber; }
- set { _IsShowSinceOrderNumber = value; }
- }
- /// <summary>
- /// 套系价格限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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; }
- }
- /// <summary>
- /// 自定义单号限制输入
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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; }
- }
- /// <summary>
- /// 套系金额离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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 = ""; }
- }
- }
- /// <summary>
- /// 检查和创建新的取件方式
- /// </summary>
- 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);
- }
- }
- /// <summary>
- /// 订单类别设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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); }
- }
- /// <summary>
- /// 设置自己义单号和订单号是否显示
- /// </summary>
- /// <param name="obj"></param>
- 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;
- }
- /// <summary>
- /// 获取订单资料
- /// </summary>
- 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;
- }
- /// <summary>
- /// 设置订单资料
- /// </summary>
- 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;
- }
- }
- }
- }
|