123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735 |
- using LYFZ.Software.MainBusiness.Dresses.DressView;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.Dresses.SetSmallForm
- {
- public partial class DressOpenOrdePreselectedSmallForm : LYFZ.Software.UI.Dresses.SetSmallForm.DressOpenOrdePreselectedSmallForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpDressFrom sfbll = new BLL.BLL_ErpDressFrom();
- LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL.BLL_ErpCustomer();
- LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
- LYFZ.BLL.BLL_ErpDressSaleRentalOrder dsrobll = new BLL.BLL_ErpDressSaleRentalOrder();
- LYFZ.BLL.BLL_ErpDressSaleRentalDetail dsrdbll = new BLL.BLL_ErpDressSaleRentalDetail();
- List<UCDressCustomer> dressCustomerList = new List<UCDressCustomer>();
- public DressOpenOrdePreselectedSmallForm()
- {
- this.Load += DressOpenOrdePreselectedFormMain_Load;
- this.Shown += DressOpenOrdePreselectedFormMain_Shown;
- this.btn_AddCustomer.Click+=btn_AddCustomer_Click;
- this.btnNewOrder.Click += btnNewOrder_Click;
- this.btnTurnRent.Click += btnTurnRent_Click;
- this.btnTurnSale.Click += btnTurnSale_Click;
- this.btnSaveed.Click += btnSaveed_Click;
- this.btnCloseed.Click += btnCloseed_Click;
-
- this.btnDressDelete.Click += btnDressDelete_Click;
- this.btnDressToolbox.Click += btnDressToolbox_Click;
- this.FormClosing += DressOpenOrderFormMain_FormClosing;
- this.FormClosed += DressOpenOrderFormMain_FormClosed;
- }
- private void btn_AddCustomer_Click(object sender, EventArgs e)
- {
- UCDressCustomer ucdressCustomer = new UCDressCustomer();
- panel_CustomerItem.Controls.Add(ucdressCustomer);
- ucdressCustomer.Location = new Point(0, dressCustomerList.Count*120);
- ucdressCustomer.buttonForm1.Click += buttonForm1_Click;
- dressCustomerList.Add(ucdressCustomer);
- ucdressCustomer.StrOrderNumber = this.StrOrderNumber;
- ucdressCustomer.IsUpdateClientData = this.IsUpdateClientData;
-
- SetPanelItemHeight();
- }
- public void SetPanelItemHeight()
- {
- int height = 0;
- foreach(var item in dressCustomerList)
- {
- height += 120;
- }
- panel_CustomerItem.Size = new System.Drawing.Size(panel_CustomerItem.Size.Width, height);
-
- }
- void buttonForm1_Click(object sender, EventArgs e)
- {
- if(MessageBoxCustom.Show("确定删除当前联系人信息?","提示", MessageBoxButtons.YesNo)
- == System.Windows.Forms.DialogResult.Yes)
- {
- dressCustomerList.Remove((UCDressCustomer)(((Control)sender).Parent));
- panel_CustomerItem.Controls.Remove(((Control)sender).Parent);
- SetPanelItemHeight();
- }
- }
- public string AutoNumber = "";
- public string SysNumber = "";
- /// <summary>
- /// 订单号
- /// </summary>
- public string StrOrderNumber = "";
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 相片集合
- /// </summary>
- ImageList mlistImage = new ImageList();
- /// <summary>
- /// 是否能修改客户资料
- /// </summary>
- bool IsUpdateClientData = true;
- /// <summary>
- /// 登录都编号
- /// </summary>
- string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- /// <summary>
- /// 登录都姓名
- /// </summary>
- string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
- /// <summary>
- /// 用于排序的类
- /// </summary>
- LYFZ.ComponentLibrary.ListViewColumnSorter lvwColumnSorter;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DressOpenOrdePreselectedFormMain_Load(object sender, EventArgs e)
- {
- this.listViewData.View = View.Details;
- this.listViewData.GridLines = true;
- panel_CustomerItem.Padding = new Padding(18, 0, 0, 0);
- string[] StrColumns = ("礼服编号,礼服名称,礼服尺寸,礼服数量,出租价格,出售价格").Split(',');
- for (int i = 0; i < StrColumns.Length; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = StrColumns[i].Trim();
- ch.Width = (this.listViewData.Width - 23) / 6;
- if (StrColumns[i].Trim() == "出租价格" || StrColumns[i].Trim() == "出售价格")
- { ch.TextAlign = HorizontalAlignment.Right; }
- else if (StrColumns[i].Trim() == "礼服数量")
- { ch.TextAlign = HorizontalAlignment.Center; }
- else
- { ch.TextAlign = HorizontalAlignment.Left; }
- this.listViewData.Columns.Add(ch);
- }
- this.mlistImage.ImageSize = new Size(25, 25);
- this.mlistImage.ColorDepth = ColorDepth.Depth32Bit;
- this.listViewData.SmallImageList = mlistImage;
- lvwColumnSorter = new ComponentLibrary.ListViewColumnSorter();
- this.listViewData.ListViewItemSorter = lvwColumnSorter;
- UCDressCustomer ucdressCustomer = new UCDressCustomer();
- ucdressCustomer.BindShowAndHideDelete(false);
- panel_CustomerItem.Controls.Add(ucdressCustomer);
- dressCustomerList.Add(ucdressCustomer);
- ucdressCustomer.StrOrderNumber = this.StrOrderNumber;
- ucdressCustomer.IsUpdateClientData = this.IsUpdateClientData;
- SetPanelItemHeight();
-
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DressOpenOrdePreselectedFormMain_Shown(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevOrderPerson, IsFirstNodeNull: true, IsShowResign: false, IsShowAdmin: false);
- if (!string.IsNullOrEmpty(this.StrOrderNumber))
- {
- this.txtOrderNumber.Text = this.StrOrderNumber;
-
- this.OpenOrderData();
- }
- else
- {
- this.btnTurnRent.Visible = false;
- this.btnTurnSale.Visible = false;
- this.txtOrderNumber.Text = LYFZ.BLL.BLL_ErpOrder.GenerateNewDressNumber(LYFZ.EnumPublic.EnumDressOrderType.预选);
- this.txtEnterName.Text = this.StrUserName;
- this.txtCreateDateTime.Text = SDateTime.Now.ToString("yyyy-MM-dd");
- this.btnSaveed.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Rental);
- }
- this.TopMost = false;
- SysNumber = this.StrOrderNumber;
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber)
- {
- txtOrderNumber.ReadOnly = false;
- }
-
- }
- /// <summary>
- /// 打开订单数据
- /// </summary>
- void OpenOrderData()
- {
- DataTable dtOrder = orbll.GetView_Custom("tb_ErpDressSaleRentalOrder Left Join tb_ErpUser on User_EmployeeID = Dsro_HandledName", StrWhere: "Dsro_Number = '" + this.StrOrderNumber + "'", ShowColumnName: "Dsro_Number,Dsro_CreateName,User_Name,Dsro_CreateDateTime,Dsro_Remark,Dsro_CustomerNumber,Dsro_AutoNumber").Tables[0];
- if (dtOrder.Rows.Count > 0)
- {
- //this.btnClientSelect.Visible = false;
- //this.txtClientName.Width = this.txtClientQQ.Width;
- this.cmbtreevOrderPerson.TagFindText(dtOrder.Rows[0]["Dsro_CreateName"]);
- this.txtEnterName.Text = dtOrder.Rows[0]["User_Name"].ToString().Trim();
- this.txtCreateDateTime.Text = LYFZ.Command.Command_Validate.DateTimeToString(dtOrder.Rows[0]["Dsro_CreateDateTime"]);
- this.txtRemark.Text = dtOrder.Rows[0]["Dsro_Remark"].ToString().Trim();
- this.txtOrderNumber.Text = dtOrder.Rows[0]["Dsro_AutoNumber"].ToString().Trim();
- this.txtOrderNumber.Tag = dtOrder.Rows[0]["Dsro_AutoNumber"].ToString().Trim();
- if (string.IsNullOrEmpty(this.txtOrderNumber.Text))
- {
- this.txtOrderNumber.Text = dtOrder.Rows[0]["Dsro_Number"].ToString().Trim();
- this.txtOrderNumber.Tag = dtOrder.Rows[0]["Dsro_Number"].ToString().Trim();
- }
- //this.GetClientData(dtOrder.Rows[0]["Dsro_CustomerNumber"].ToString().Trim());
- string[] customerList = dtOrder.Rows[0]["Dsro_CustomerNumber"].ToString().Trim().Split(',');
- if (customerList.Length>1)
- {
- for (int i = 1; i < customerList.Length;i++ )
- {
- UCDressCustomer ucdressCustomer = new UCDressCustomer();
- ucdressCustomer.Location = new Point(0, dressCustomerList.Count * 120);
- panel_CustomerItem.Controls.Add(ucdressCustomer);
- ucdressCustomer.buttonForm1.Click += buttonForm1_Click;
- dressCustomerList.Add(ucdressCustomer);
- ucdressCustomer.StrOrderNumber = this.StrOrderNumber;
- ucdressCustomer.IsUpdateClientData = this.IsUpdateClientData;
- SetPanelItemHeight();
- }
- }
- for (int i = 0; i < customerList.Length; i++)
- {
- dressCustomerList[i].GetClientData(customerList[i]);
- dressCustomerList[i].ReBindOrderNumber();
- }
-
- this.IsUpdateClientData = false;
- DataTable dt = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail Left Join tb_ErpDressFrom on Dsfm_DressNumber = Dsrd_DressNumber", StrWhere: "Dsrd_Number = '" + this.StrOrderNumber + "'", ShowColumnName: "tb_ErpDressSaleRentalDetail.ID,Dsrd_DressNumber,Dsfm_DressCustomNumber,Dsrd_DressName,Dsfm_DressSize,Dsrd_CostPrice,Dsrd_RentPrice,Dsrd_SalePrice,Dsfm_DressPhotoNames").Tables[0];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- string[] StrArrayList = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim().Split('|');
- if (!this.mlistImage.Images.Keys.Contains(dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim()))
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- { this.mlistImage.Images.Add(dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim(), img); }));
- }
- catch
- { }
- }
- ListViewItem lvItem = new ListViewItem();
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = new DressOpenOrderRentSaleFormMain_ColumnHeaderModel();
- modelColumn.StrDressNumber = dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim();
- modelColumn.StrCostPrice = dt.Rows[i]["Dsrd_CostPrice"].ToString().Trim();
- modelColumn.StrDressPhotoNames = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim();
- modelColumn.ID = Convert.ToInt32(dt.Rows[i]["ID"]);
- lvItem.Tag = modelColumn;
- lvItem.ImageKey = dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim();
- lvItem.Text = dt.Rows[i]["Dsfm_DressCustomNumber"].ToString().Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "礼服名称";
- ListSubItem.Text = dt.Rows[i]["Dsrd_DressName"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "礼服尺寸";
- ListSubItem.Text = dt.Rows[i]["Dsfm_DressSize"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "礼服数量";
- ListSubItem.Text = "1";
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "出租价格";
- ListSubItem.Text = dt.Rows[i]["Dsrd_RentPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "出售价格";
- ListSubItem.Text = dt.Rows[i]["Dsrd_SalePrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- this.listViewData.Items.Add(lvItem);
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData);
- }
- }
- }
-
- /// <summary>
- /// 新订单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnNewOrder_Click(object sender, EventArgs e)
- {
- if (MessageBoxCustom.Show("重置后将清空所有数据,您确定要重置新订单吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- this.IsGoForm = true;
- this.Close();
- }
- }
- /// <summary>
- /// 转为出租订单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnTurnRent_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.StrOrderNumber))
- { MessageBoxCustom.Show("订单未保存,不能直接转为出租订单!"); return; }
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleSmallForm frm = new SetSmallForm.DressOpenOrderRentSaleSmallForm();
- frm.StrOrderNumber = this.StrOrderNumber;
- frm.LoadType = "出租";
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.BringToFront();
- frm.Show();
- this.isClose = false;
- this.Hide();
- }
- /// <summary>
- /// 转为出售订单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnTurnSale_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.StrOrderNumber))
- { MessageBoxCustom.Show("订单未保存,不能直接转为出售订单!"); return; }
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleSmallForm frm = new SetSmallForm.DressOpenOrderRentSaleSmallForm();
- frm.StrOrderNumber = this.StrOrderNumber;
- frm.LoadType = "出售";
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.BringToFront();
- frm.Show();
- this.isClose = false;
- this.Hide();
- }
- Hashtable htData_del = new Hashtable();
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSaveed_Click(object sender, EventArgs e)
- {
- LYFZ.Model.Model_ErpDressSaleRentalOrder DressRentalModel = null;
- LYFZ.Model.Model_ErpDressSaleRentalDetail DressRentalDetailModel = null;
- #region 判断输入框不能为空
- if (string.IsNullOrEmpty(this.txtOrderNumber.Text.Trim()))
- { MessageBoxCustom.Show("单号不能为空!"); return; }
- if (string.IsNullOrEmpty(this.cmbtreevOrderPerson.Text.Trim()))
- { MessageBoxCustom.Show("销售人员不能为空!"); return; }
- foreach(var item in dressCustomerList)
- {
- LYFZ.Command.Result result = item.CheckCustomerData();
- if(!result.Status)
- {
- return ;
- }
- }
- #endregion
- DateTime StrTime = SDateTime.Now;
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- string StrClientNumber = "";
- string StrClientName = "";
- string StrClientTelephone = "";
- #region 客户
- foreach (var item in dressCustomerList)
- {
- LYFZ.Command.Result result = item.SaveCustomerData(ref StrClientName, ref StrClientTelephone);
- if(result.Status)
- {
- if (!string.IsNullOrEmpty(StrClientNumber))
- {
- StrClientNumber += ",";
- }
- StrClientNumber += result.StatusMsg;
- clist.AddRange(((LYFZ.Command.Result<List<Helper.CommandInfo>>)result).clist);
- }
- else
- {
- return;
- }
- }
- #endregion
- /*#region 客户
- string StrClientNumber = "";
- if (this.txtClientName.Tag != null)
- { StrClientNumber = this.txtClientName.Tag.ToString().Trim(); }
- else
- {
- if (ctbll.Exists("Cus_Telephone", StrTelephone) == true)//判断手机存在
- { MessageBoxCustom.Show("客户手机已经存在"); return; }
- LYFZ.Model.Model_ErpCustomer model = new Model.Model_ErpCustomer();
- model.Cus_CustomerNumber = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMMddHHmmssfff") + "1";//获取新编号
- model.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Cus_CustomizeNumber = "";
- model.Cus_Type = "订单客户";
- model.Cus_ServiceType = "Clothing";
- model.Cus_Name = this.txtClientName.Text.ToString().Trim();
- model.Cus_Telephone = this.txtClientTelephone.Text.ToString().Trim();
- model.Cus_QQ = this.txtClientQQ.Text.ToString().Trim();
- model.Cus_Address = this.txtClientAddress.Text.ToString().Trim();
- model.Cus_WorkUnit = this.txtClientWorkUnit.Text.ToString().Trim();
- model.Cus_Birthday = this.txtClientBirthday.StrValue.Trim();
- if (this.chkClientBirthdayLunar.Checked == true)
- { model.Cus_BirthdayLunar = "1"; }
- else
- { model.Cus_BirthdayLunar = "0"; }
- model.Cus_DayForMarriage = this.txtClientDayForMarriage.StrValue.ToString();
- if (this.chkClientDayForMarriageLunar.Checked == true)
- { model.Cus_DayForMarriageLunar = "1"; }
- else
- { model.Cus_DayForMarriageLunar = "0"; }
- model.Cus_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime();
- model.Cus_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- clist.Add(ctbll.GetAddCommandInfo(model));
- StrClientNumber = model.Cus_CustomerNumber;
- }
- #endregion*/
- #region 检查自定义单号是否存在
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber)
- {
- DataTable tbl = orbll.GetView_Custom("tb_ErpDressSaleRentalOrder", StrWhere: "Dsro_AutoNumber = '" + this.txtOrderNumber.Text + "'", ShowColumnName: "ID").Tables[0];
- if (string.IsNullOrEmpty(StrOrderNumber))
- {
- if (tbl.Rows.Count > 0)
- {
- MessageBoxCustom.Show("自定义单号重复!"); return;
- }
- }
- else
- {
- if (this.txtOrderNumber.Text == (this.txtOrderNumber.Tag == null ? "" : this.txtOrderNumber.Tag.ToString()))
- {
- if (tbl.Rows.Count > 1)
- {
- MessageBoxCustom.Show("自定义单号重复!"); return;
- }
- }
- else
- {
- if (tbl.Rows.Count > 0)
- {
- MessageBoxCustom.Show("自定义单号重复!"); return;
- }
- }
- }
- }
- #endregion
- #region 检测订单号是否有存在
- if (string.IsNullOrEmpty(SysNumber))
- {
- bool IsFind = true;
- while (IsFind)
- {
- if (string.IsNullOrEmpty(SysNumber))
- {
- SysNumber = LYFZ.BLL.BLL_ErpOrder.GenerateNewDressNumber(LYFZ.EnumPublic.EnumDressOrderType.出租);
- if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber)
- {
- this.txtOrderNumber.Text = SysNumber;
- }
- }
- DataTable tbl = orbll.GetView_Custom("tb_ErpDressSaleRentalOrder", StrWhere: "Dsro_Number = '" + SysNumber + "'", ShowColumnName: "ID").Tables[0];
- if (tbl.Rows.Count <= 0)
- { IsFind = false; }
- else
- { //this.txtOrderNumber.Text
- SysNumber= LYFZ.BLL.BLL_ErpOrder.GenerateNewDressNumber(LYFZ.EnumPublic.EnumDressOrderType.出租);
- if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber)
- {
- this.txtOrderNumber.Text = SysNumber;
- }
- }
- }
- }
- #endregion
- #region 礼服预选订单
- if (!string.IsNullOrEmpty(StrOrderNumber))
- {
- DressRentalModel = dsrobll.GetModel("Dsro_Number", this.StrOrderNumber);
- DressRentalModel.Dsro_UpdateDateTime = StrTime;
- DressRentalModel.Dsro_UpdateName = this.StrUserID;
- DressRentalModel.Dsro_CustomerNumber = StrClientNumber;
- }
- else
- {
- DressRentalModel = new Model.Model_ErpDressSaleRentalOrder();
- DressRentalModel.Dsro_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- DressRentalModel.Dsro_Number = SysNumber;
- DressRentalModel.Dsro_AutoNumber = this.txtOrderNumber.Text.Trim();
- DressRentalModel.Dsro_CustomerNumber = StrClientNumber;
- DressRentalModel.Dsro_CreateDateTime = StrTime;
- DressRentalModel.Dsro_CreateName = this.cmbtreevOrderPerson.Tag.ToString().Trim();
- DressRentalModel.Dsro_HandledName = this.StrUserID;
- }
- DressRentalModel.Dsro_CustomerName = StrClientName;
- DressRentalModel.Dsro_CustomerTelephone = StrClientTelephone;
- DressRentalModel.Dsro_Type = "2";
- DressRentalModel.Dsro_Amount = 0;
- DressRentalModel.Dsro_MortgageAmount = 0;
- DressRentalModel.Dsro_AutoNumber = this.txtOrderNumber.Text.Trim();
- DressRentalModel.Dsro_Remark = this.txtRemark.Text.Trim();
- if (!string.IsNullOrEmpty(StrOrderNumber))
- { clist.Add(dsrobll.GetUpdateCommandInfo((DressRentalModel))); }
- else
- { clist.Add(dsrobll.GetAddCommandInfo((DressRentalModel))); }
- #endregion
- #region 预选礼服详情表
- foreach (DictionaryEntry item in htData_del)
- {
- clist.Add(dsrdbll.GetDeleteCommandInfo("ID", "=", item.Key.ToString().Trim()));
- }
- for (int i = 0; i < this.listViewData.Items.Count; i++)
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumns = (DressOpenOrderRentSaleFormMain_ColumnHeaderModel)this.listViewData.Items[i].Tag;
- if (modelColumns.ID <= 0)
- {
- DressRentalDetailModel = new Model.Model_ErpDressSaleRentalDetail();
- DressRentalDetailModel.Dsrd_Number = DressRentalModel.Dsro_Number;
- DressRentalDetailModel.Dsrd_DressNumber = this.listViewData.Items[i].ImageKey.ToString().Trim();
- DressRentalDetailModel.Dsrd_DressName = this.listViewData.Items[i].SubItems["礼服名称"].Text.Trim();
- DressRentalDetailModel.Dsrd_SaleRentalQuantity = Convert.ToInt32(this.listViewData.Items[i].SubItems["礼服数量"].Text.Trim());
- DressRentalDetailModel.Dsrd_CostPrice = Convert.ToDecimal(modelColumns.StrCostPrice);
- DressRentalDetailModel.Dsrd_SalePrice = Convert.ToDecimal(this.listViewData.Items[i].SubItems["出售价格"].Text.Trim());
- DressRentalDetailModel.Dsrd_RentPrice = Convert.ToDecimal(this.listViewData.Items[i].SubItems["出租价格"].Text.Trim());
- DressRentalDetailModel.Dsrd_CreateDateTime = StrTime;
- DressRentalDetailModel.Dsrd_CreateName = StrUserID;
- DressRentalDetailModel.Dsrd_BackTime = Convert.ToDateTime(null);
- DressRentalDetailModel.Dsrd_BackRemark = "";
- DressRentalDetailModel.Dsrd_BackStatus = "3";
- clist.Add(dsrdbll.GetAddCommandInfo(DressRentalDetailModel));
- }
- }
- #endregion
- if (clist.Count > 0)
- {
- if (MessageBoxCustom.Show("您确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- this.IsSaveed = true;
- this.StrOrderNumber = SysNumber;
- this.btnTurnRent.Visible = true;
- this.btnTurnSale.Visible = true;
- MessageBoxCustom.Show("保存成功!");
- for (int i = 0; i < this.listViewData.Items.Count; i++)
- { this.listViewData.Items[i].ForeColor = Color.Black; }
- }
- else
- { MessageBoxCustom.Show("保存失败!"); }
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCloseed_Click(object sender, EventArgs e)
- {
- isClose = false;
- if (!isClose)
- {
- if (MessageBoxCustom.Show("你确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- }
- this.Close();
- }
-
- /// <summary>
- /// 移除礼服
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDressDelete_Click(object sender, EventArgs e)
- {
- if (this.listViewData.Items.Count > 0)
- {
- if (MessageBoxCustom.Show("删除后无法找回,您确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- List<ListViewItem> delItem = new List<ListViewItem>();
- for (int i = 0; i < this.listViewData.SelectedItems.Count; i++)
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = (DressOpenOrderRentSaleFormMain_ColumnHeaderModel)this.listViewData.SelectedItems[i].Tag;
- if (modelColumn.ID > 0)
- { this.htData_del[modelColumn.ID] = this.listViewData.SelectedItems[i].ImageKey.ToString().Trim(); }
- delItem.Add(this.listViewData.SelectedItems[i]);
- }
- for (int i = 0; i < delItem.Count; i++)
- { this.listViewData.Items.Remove(delItem[i]); }
- }
- }
- /// <summary>
- /// 礼服工具箱
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDressToolbox_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.ToolboxDressSamllForm frm = new ToolboxDressSamllForm();
- frm.WindowState = FormWindowState.Maximized;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- List<string> frmList = frm.listSelect;
- for (int i = 0; i < this.listViewData.Items.Count; i++)
- {
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = (DressOpenOrderRentSaleFormMain_ColumnHeaderModel)this.listViewData.Items[i].Tag;
- if (frmList.Contains(modelColumn.StrDressNumber.Trim()))
- { frmList.Remove(modelColumn.StrDressNumber.Trim()); }
- }
- if (frmList.Count > 0)
- {
- string StrWhere = "";
- for (int i = 0; i < frmList.Count; i++)
- { StrWhere += "'" + frmList[i].Trim() + "',"; }
- StrWhere = "Dsfm_DressNumber in (" + StrWhere.TrimEnd(',') + ")";
- DataTable dt = orbll.GetView_Custom("tb_ErpDressFrom", StrWhere: StrWhere, ShowColumnName: "Dsfm_DressNumber,Dsfm_DressCustomNumber,Dsfm_DressName,Dsfm_DressSize,Dsfm_CostPrice,Dsfm_RentPrice,Dsfm_SalePrice,Dsfm_DressPhotoNames").Tables[0];
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- string[] StrArrayList = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim().Split('|');
- if (!this.mlistImage.Images.Keys.Contains(dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim()))
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim());
- try
- {
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- { this.mlistImage.Images.Add(dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim(), img); }));
- }
- catch
- { }
- }
- ListViewItem lvItem = new ListViewItem();
- lvItem.ForeColor = Color.Red;
- LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = new DressOpenOrderRentSaleFormMain_ColumnHeaderModel();
- modelColumn.StrDressNumber = dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim();
- modelColumn.StrCostPrice = dt.Rows[i]["Dsfm_CostPrice"].ToString().Trim();
- modelColumn.StrDressPhotoNames = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim();
- modelColumn.ID = 0;
- lvItem.Tag = modelColumn;
- lvItem.ImageKey = dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim();
- lvItem.Text = dt.Rows[i]["Dsfm_DressCustomNumber"].ToString().Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "礼服名称";
- ListSubItem.Text = dt.Rows[i]["Dsfm_DressName"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "礼服尺寸";
- ListSubItem.Text = dt.Rows[i]["Dsfm_DressSize"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "礼服数量";
- ListSubItem.Text = "1";
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "出租价格";
- ListSubItem.Text = dt.Rows[i]["Dsfm_RentPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "出售价格";
- ListSubItem.Text = dt.Rows[i]["Dsfm_SalePrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- this.listViewData.Items.Add(lvItem);
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData);
- }
- }
- }
- }
-
- /// <summary>
- /// 关闭窗体前判断是否提示
- /// </summary>
- private bool isClose = true;
- /// <summary>
- /// 关闭是否要跳转
- /// </summary>
- bool IsGoForm = false;
- /// <summary>
- /// 关闭窗体前事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DressOpenOrderFormMain_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (!this.IsGoForm)
- {
- if (this.isClose)
- {
- if (MessageBoxCustom.Show("你确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { e.Cancel = true; }
- }
- }
- }
- /// <summary>
- /// 关闭窗体后事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void DressOpenOrderFormMain_FormClosed(object sender, FormClosedEventArgs e)
- {
- if (this.IsGoForm)
- {
- this.Hide();
- LYFZ.Software.MainBusiness.Dresses.DressOpenOrderFirstFormMain frm = new DressOpenOrderFirstFormMain();
- frm.StartPosition = FormStartPosition.CenterScreen;
- frm.TopMost = true;
- frm.Show();
- }
- }
- }
- }
|