1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396 |
- 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 class SetCustomControls_ServiceColumnHeaderModel
- {
- private string _PgmID = "";
- private string _ServiceNumber;
- private string _ServiceCostPrice;
- private string _ServiceUnit;
- private string _ServiceOrderID;
- /// <summary>
- /// 套系赠送商品ID(用于检查是否修改过套系商品)
- /// </summary>
- public string PgmID
- {
- get { return _PgmID; }
- set { _PgmID = value; }
- }
- /// <summary>
- /// 服务编号
- /// </summary>
- public string ServiceNumber
- {
- get { return _ServiceNumber; }
- set { _ServiceNumber = value; }
- }
- /// <summary>
- /// 服务成本价
- /// </summary>
- public string ServiceCostPrice
- {
- get { return _ServiceCostPrice; }
- set { _ServiceCostPrice = value; }
- }
- /// <summary>
- /// 服务单位
- /// </summary>
- public string ServiceUnit
- {
- get { return _ServiceUnit; }
- set { _ServiceUnit = value; }
- }
- /// <summary>
- /// 订单服务ID
- /// </summary>
- public string ServiceOrderID
- {
- get { return _ServiceOrderID; }
- set { _ServiceOrderID = value; }
- }
- }
- public partial class OrderServiceControlsEx : LYFZ.Software.UI.DoorCityProcess.SetCustomControls.OrderServiceControlsEx
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpOrderDigital orvbll = new BLL.BLL_ErpOrderDigital();
- LYFZ.BLL.BLL_ErpWeddingService wsbll = new BLL.BLL_ErpWeddingService();
- public bool bUpgrade = false;
- public OrderServiceControlsEx()
- {
- this.btnUp.Click += btnUp_Click;
- this.btnDown.Click += btnDown_Click;
- this.btnServiceAllDelete.Click += btnServiceAllDelete_Click;
- this.btnServiceDelete.Click += btnServiceDelete_Click;
- this.btnServiceToolbox.Click += btnServiceToolbox_Click;
- this.listViewData_Service.Click += listViewData_Service_Click;
- this.listViewData_Service.MouseDown += listViewData_Service_MouseDown;
- this.listViewData_Service.MouseDoubleClick += listViewData_Service_MouseDoubleClick;
- this.listViewData_Service.ItemDrag += listViewData_Service_ItemDrag;
- this.listViewData_Service.DragEnter += listViewData_Service_DragEnter;
- this.listViewData_Service.DragDrop += listViewData_Service_DragDrop;
- this.listViewData_Service.ColumnClick += listViewData_Service_ColumnClick;
- this.listViewData_Service.Resize += listViewData_Service_Resize;
- this.txtText.KeyPress += txtText_KeyPress;
- this.txtText.Leave += txtText_Leave;
- this.IsClickToolbox = false;
- this.listViewData_Service.View = View.Details;
- this.listViewData_Service.GridLines = true;
- string[] StrColumns = "服务名称,服务价格,来源,服务数量,备注".Split(',');
- int SurplusCount = 230 + 100 * 2 + 70 + 23;
- for (int i = 0; i < StrColumns.Length; i++)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = StrColumns[i].Trim();
- switch (StrColumns[i].Trim())
- {
- case "服务名称": ch.Width = 230; break;
- case "来源": ch.Width = 70; break;
- case "备注": ch.Width = this.listViewData_Service.Width - SurplusCount; break;
- default: ch.Width = 100; break;
- }
- switch (StrColumns[i].Trim())
- {
- case "服务价格":
- ch.TextAlign = HorizontalAlignment.Right;
- break;
- case "服务数量":
- case "来源":
- ch.TextAlign = HorizontalAlignment.Center;
- break;
- default:
- ch.TextAlign = HorizontalAlignment.Left;
- break;
- }
- this.listViewData_Service.Columns.Add(ch);
- }
- this.mlistImage.ImageSize = new Size(25, 25);
- this.mlistImage.ColorDepth = ColorDepth.Depth32Bit;
- this.listViewData_Service.SmallImageList = mlistImage;
- lvwColumnSorter = new ComponentLibrary.ListViewColumnSorter();
- this.listViewData_Service.ListViewItemSorter = lvwColumnSorter;
- }
- /// <summary>
- /// 订单编号
- /// </summary>
- public string StrNumber = "";
- /// <summary>
- /// 相片集合
- /// </summary>
- ImageList mlistImage = new ImageList();
- /// <summary>
- /// 登录者员工ID
- /// </summary>
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- LYFZ.ComponentLibrary.ListViewColumnSorter lvwColumnSorter;
- private EnumPublic.OrderType _OrdType;
- /// <summary>
- /// 订单类型
- /// </summary>
- public EnumPublic.OrderType OrdType
- {
- set
- {
- _OrdType = value;
- if (this.OrdType == EnumPublic.OrderType.儿童订单)
- {
- this.btnDown.Visible = false;
- this.btnUp.Visible = false;
- this.listViewData_Service.AllowDrop = false;
- }
- else
- {
- this.btnDown.Visible = true;
- this.btnUp.Visible = true;
- this.listViewData_Service.AllowDrop = true;
- }
- if (this.OrdType == EnumPublic.OrderType.服务订单)
- { this.IsClickToolbox = true; }
- }
- get { return _OrdType; }
- }
- private bool _isClickToolbox;
- /// <summary>
- /// 是否能点击工具箱
- /// </summary>
- public bool IsClickToolbox
- {
- get { return _isClickToolbox; }
- set { _isClickToolbox = value; }
- }
- private List<string> _StrGroupList = new List<string>();
- /// <summary>
- /// 组的list
- /// </summary>
- public List<string> StrGroupList
- {
- get { return _StrGroupList; }
- set
- {
- _StrGroupList = value;
- this.GroupChange();
- }
- }
- /// <summary>
- /// 拍摄次数组变更
- /// </summary>
- void GroupChange()
- {
- List<string> GroupList = new List<string>();
- for (int i = 0; i < this.StrGroupList.Count; i++)
- { GroupList.Add(this.StrGroupList[i]); }
- if (this.listViewData_Service.Groups["未分组"] == null)
- { this.CreateDefaultGroup(); }
- List<ListViewGroup> DeleteGroup = new List<ListViewGroup>();
- List<ListViewItem> ChangeItemList = new List<ListViewItem>();
- if (GroupList.Count > 0)
- {
- for (int i = 0; i < this.listViewData_Service.Groups.Count; i++)
- {
- if (this.listViewData_Service.Groups[i].Header.Trim() != "未分组")
- {
- bool IsFind = false;
- for (int j = 0; j < GroupList.Count; j++)
- {
- if (this.listViewData_Service.Groups[i].Header.Trim() == GroupList[j].Trim())
- { GroupList.RemoveAt(j); IsFind = true; break; }
- }
- if (!IsFind)
- {
- for (int j = 0; j < this.listViewData_Service.Groups[i].Items.Count; j++)
- { ChangeItemList.Add(this.listViewData_Service.Groups[i].Items[j]); }
- DeleteGroup.Add(this.listViewData_Service.Groups[i]);
- }
- }
- }
- ListViewGroup man_lvg = null;
- for (int i = 0; i < GroupList.Count; i++)
- {
- man_lvg = new ListViewGroup();
- man_lvg.Name = GroupList[i].Trim();
- man_lvg.Header = GroupList[i].Trim();
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Service.Groups.Add(man_lvg);
- }
- }
- else
- {
- for (int i = 0; i < this.listViewData_Service.Groups.Count; i++)
- {
- if (this.listViewData_Service.Groups[i].Header.Trim() != "未分组")
- {
- for (int j = 0; j < this.listViewData_Service.Groups[i].Items.Count; j++)
- { ChangeItemList.Add(this.listViewData_Service.Groups[i].Items[j]); }
- DeleteGroup.Add(this.listViewData_Service.Groups[i]);
- }
- }
- }
- for (int i = 0; i < ChangeItemList.Count; i++)
- { ((ListViewItem)ChangeItemList[i]).Group = this.listViewData_Service.Groups["未分组"]; }
- for (int i = 0; i < DeleteGroup.Count; i++)
- { this.listViewData_Service.Groups.Remove(DeleteGroup[i]); }
- }
- /// <summary>
- /// 创建默认分组
- /// </summary>
- void CreateDefaultGroup()
- {
- if (this.listViewData_Service.Groups["未分组"] == null)
- {
- ListViewGroup man_lvg = new ListViewGroup();
- man_lvg.Name = "未分组";
- man_lvg.Header = "未分组";
- man_lvg.HeaderAlignment = HorizontalAlignment.Left;
- this.listViewData_Service.Groups.Add(man_lvg);
- this.listViewData_Service.ShowGroups = true;
- }
- }
- /// <summary>
- /// 获取当前列表
- /// </summary>
- /// <returns></returns>
- public DataTable GetListViewData()
- {
- DataTable NewTable = new DataTable();
- NewTable.Columns.Add("PgmID", typeof(string));
- for (int i = 0; i < this.listViewData_Service.Columns.Count; i++)
- {
- NewTable.Columns.Add(this.listViewData_Service.Columns[i].Text.Trim(), typeof(string));
- }
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- if (string.IsNullOrEmpty(this.listViewData_Service.Items[i].SubItems["来源"].Text.Trim()))
- {
- DataRow newRow = NewTable.NewRow();
- for (int j = 0; j < this.listViewData_Service.Columns.Count; j++)
- {
- if (j == 0)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.Items[i].Tag;
- newRow["PgmID"] = ColumnModel.PgmID;
- newRow[this.listViewData_Service.Columns[j].Text.Trim()] = this.listViewData_Service.Items[i].Text.Trim();
- }
- else
- { newRow[this.listViewData_Service.Columns[j].Text.Trim()] = this.listViewData_Service.Items[i].SubItems[this.listViewData_Service.Columns[j].Text.Trim()].Text.Trim(); }
- }
- NewTable.Rows.Add(newRow);
- }
- }
- return NewTable;
- }
- /// <summary>
- /// 获取列表详情数据
- /// </summary>
- /// <returns></returns>
- public string GetOrderServiceContentDetails()
- {
- string StrContentDetails = "";
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- { StrContentDetails += "名称:" + this.listViewData_Service.Items[i].Text.Trim() + " 套数:" + this.listViewData_Service.Items[i].SubItems["服务数量"].Text.Trim() + " ;"; }
- return StrContentDetails;
- }
- /// <summary>
- /// 上移
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnUp_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Service.Items.Count > 0 && this.listViewData_Service.SelectedItems.Count > 0)
- {
- int selectionIdx = this.listViewData_Service.SelectedIndices[0];
- if (selectionIdx > 0)
- {
- ListViewItem lvItem = new ListViewItem();
- ListViewItem.ListViewSubItem ListSubItem = null;
- for (int i = 0; i < this.listViewData_Service.Columns.Count; i++)
- {
- if (i == 0)
- {
- lvItem.ImageKey = this.listViewData_Service.SelectedItems[0].ImageKey;
- lvItem.Text = this.listViewData_Service.SelectedItems[0].Text;
- lvItem.Tag = this.listViewData_Service.SelectedItems[0].Tag;
- }
- else
- {
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = this.listViewData_Service.Columns[i].Text.Trim();
- ListSubItem.Text = this.listViewData_Service.SelectedItems[0].SubItems[this.listViewData_Service.Columns[i].Text.Trim()].Text.Trim();
- lvItem.SubItems.Add(ListSubItem);
- }
- }
- this.listViewData_Service.Items.Remove(this.listViewData_Service.SelectedItems[0]);
- this.listViewData_Service.Items.Insert(selectionIdx - 1, lvItem);
- this.listViewData_Service.Items[selectionIdx - 1].Selected = true;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Service);
- this.listViewData_Service.Select();
- }
- }
- }
- /// <summary>
- /// 下移
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDown_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Service.Items.Count > 0 && this.listViewData_Service.SelectedItems.Count > 0)
- {
- int selectionIdx = this.listViewData_Service.SelectedIndices[0];
- if (selectionIdx < (this.listViewData_Service.Items.Count - 1))
- {
- ListViewItem lvItem = new ListViewItem();
- ListViewItem.ListViewSubItem ListSubItem = null;
- for (int i = 0; i < this.listViewData_Service.Columns.Count; i++)
- {
- if (i == 0)
- {
- lvItem.ImageKey = this.listViewData_Service.SelectedItems[0].ImageKey;
- lvItem.Text = this.listViewData_Service.SelectedItems[0].Text;
- lvItem.Tag = this.listViewData_Service.SelectedItems[0].Tag;
- }
- else
- {
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = this.listViewData_Service.Columns[i].Text.Trim();
- ListSubItem.Text = this.listViewData_Service.SelectedItems[0].SubItems[this.listViewData_Service.Columns[i].Text.Trim()].Text.Trim();
- lvItem.SubItems.Add(ListSubItem);
- }
- }
- this.listViewData_Service.Items.Remove(this.listViewData_Service.SelectedItems[0]);
- this.listViewData_Service.Items.Insert(selectionIdx + 1, lvItem);
- this.listViewData_Service.Items[selectionIdx + 1].Selected = true;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Service);
- this.listViewData_Service.Select();
- }
- }
- }
- #region 拖放事件
- /// <summary>
- /// 点击开始拖放
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_ItemDrag(object sender, ItemDragEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- if (this.listViewData_Service.SelectedIndices[0] > -1)
- { this.listViewData_Service.DoDragDrop(this.listViewData_Service.Items[this.listViewData_Service.SelectedIndices[0]], DragDropEffects.Move); }
- }
- }
- /// <summary>
- /// 拖放时去入控件时间
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_DragEnter(object sender, DragEventArgs e)
- {
- e.Effect = DragDropEffects.Move;
- }
- /// <summary>
- /// 拖放完成操作后
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_DragDrop(object sender, DragEventArgs e)
- {
- Point p = this.listViewData_Service.PointToClient(new Point(e.X, e.Y));
- int selectionIdx = 0;
- ListViewHitTestInfo ItemHit = this.listViewData_Service.HitTest(p.X, p.Y);
- if (ItemHit.Item != null)
- { selectionIdx = ItemHit.Item.Index; }
- else
- { selectionIdx = this.listViewData_Service.Items.Count - 1; }
- if (selectionIdx < 0) return;
- if (e.Data.GetDataPresent(typeof(ListViewItem)))
- {
- ListViewItem lvItem = new ListViewItem();
- ListViewItem.ListViewSubItem ListSubItem = null;
- for (int i = 0; i < this.listViewData_Service.Columns.Count; i++)
- {
- if (i == 0)
- {
- lvItem.ImageKey = this.listViewData_Service.SelectedItems[0].ImageKey;
- lvItem.Text = this.listViewData_Service.SelectedItems[0].Text;
- lvItem.Tag = this.listViewData_Service.SelectedItems[0].Tag;
- }
- else
- {
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = this.listViewData_Service.Columns[i].Text.Trim();
- ListSubItem.Text = this.listViewData_Service.SelectedItems[0].SubItems[this.listViewData_Service.Columns[i].Text.Trim()].Text.Trim();
- lvItem.SubItems.Add(ListSubItem);
- }
- }
- this.listViewData_Service.Items.Remove(this.listViewData_Service.SelectedItems[0]);
- this.listViewData_Service.Items.Insert(selectionIdx, lvItem);
- this.listViewData_Service.Items[selectionIdx].Selected = true;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Service);
- this.listViewData_Service.Select();
- }
- }
- #endregion
- /// <summary>
- /// 删除全部服务
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnServiceAllDelete_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Service.Items.Count > 0)
- {
- if (MessageBoxCustom.Show("是否要全部删除", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- bool IsFind = false;
- DataTable tbl = orbll.GetView_Custom("tb_ErpWeddingService", StrWhere: "Ws_Number = '" + this.StrNumber + "'", ShowColumnName: "ID,Ws_Status").Tables[0];
- tbl.PrimaryKey = new DataColumn[] { tbl.Columns["ID"] };
- List<ListViewItem> StrList = new List<ListViewItem>();
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- if (string.IsNullOrEmpty(this.listViewData_Service.Items[i].SubItems["来源"].Text.Trim()))
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.Items[0].Tag;
- if (string.IsNullOrEmpty(ColumnModel.ServiceOrderID))
- { StrList.Add(this.listViewData_Service.Items[i]); continue; }
- else
- {
- bool IsTrue = false;
- DataRow dataRow = tbl.Rows.Find(ColumnModel.ServiceOrderID.Trim());
- if (dataRow != null)
- {
- if (dataRow["Ws_Status"].ToString().Trim() == "1")
- { IsTrue = true; IsFind = true; continue; }
- }
- if (!IsTrue)
- { StrList.Add(this.listViewData_Service.Items[i]); }
- }
- }
- }
- for (int i = 0; i < StrList.Count; i++)
- { this.listViewData_Service.Items.Remove(StrList[i]); }
- this.GetShowAmount();
- if (IsFind)
- { MessageBoxCustom.Show("未删除服务已OK,不能删除"); }
- }
- }
- /// <summary>
- /// 删除服务
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnServiceDelete_Click(object sender, EventArgs e)
- {
- List<ListViewItem> StrList = new List<ListViewItem>();
- if (!string.IsNullOrEmpty(this.StrNumber))
- {
- if (MessageBoxCustom.Show("是否要删除?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- bool IsFind = false;
- DataTable tbl = new DataTable();
- if (!string.IsNullOrEmpty(this.StrNumber))
- {
- tbl = orbll.GetView_Custom("tb_ErpWeddingService", StrWhere: "Ws_Number = '" + this.StrNumber + "'", ShowColumnName: "ID,Ws_Status").Tables[0];
- tbl.PrimaryKey = new DataColumn[] { tbl.Columns["ID"] };
- }
- for (int i = 0; i < this.listViewData_Service.SelectedItems.Count; i++)
- {
- if (string.IsNullOrEmpty(this.listViewData_Service.SelectedItems[i].SubItems["来源"].Text.Trim()))
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.SelectedItems[i].Tag;
- if (string.IsNullOrEmpty(ColumnModel.ServiceOrderID.Trim()))
- { StrList.Add(this.listViewData_Service.SelectedItems[i]); }
- else
- {
- bool IsTrue = false;
- if (tbl.Rows.Count > 0)
- {
- DataRow dtRow = tbl.Rows.Find(ColumnModel.ServiceOrderID.Trim());
- if (dtRow["Ws_Status"].ToString().Trim() == "1")
- { IsFind = true; IsTrue = true; }
- }
- if (!IsTrue)
- { StrList.Add(this.listViewData_Service.SelectedItems[i]); }
- }
- }
- }
- for (int i = 0; i < StrList.Count; i++)
- { this.listViewData_Service.Items.Remove(StrList[i]); }
- if (IsFind)
- {
- if (this.listViewData_Service.SelectedItems.Count > 1)
- { MessageBoxCustom.Show("未删除服务已OK,不能删除!"); }
- else
- { MessageBoxCustom.Show("此服务已OK,不能删除!"); }
- }
- }
- else
- {
- for (int i = 0; i < this.listViewData_Service.SelectedItems.Count; i++)
- {
- if (string.IsNullOrEmpty(this.listViewData_Service.SelectedItems[i].SubItems["来源"].Text.Trim()))
- { StrList.Add(this.listViewData_Service.SelectedItems[i]); }
- }
- for (int i = 0; i < StrList.Count; i++)
- { this.listViewData_Service.Items.Remove(StrList[i]); }
- }
- this.GetShowAmount();
- }
- /// <summary>
- /// 删除数据
- /// </summary>
- public void DeleteSightByNotAction()
- {
- List<ListViewItem> StrList = new List<ListViewItem>();
- DataTable tbl = new DataTable();
- if (!string.IsNullOrEmpty(this.StrNumber))
- {
- tbl = orbll.GetView_Custom("tb_ErpWeddingService", StrWhere: "Ws_Number = '" + this.StrNumber + "'", ShowColumnName: "ID,Ws_Status").Tables[0];
- tbl.PrimaryKey = new DataColumn[] { tbl.Columns["ID"] };
- }
- if (!string.IsNullOrEmpty(this.StrNumber))
- {
- foreach (ListViewItem item in this.listViewData_Service.Items)
- {
- if (MessageBoxCustom.Show("是否要删除?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- //for (int i = 0; i < this.listViewData_Service.SelectedItems.Count; i++)
- //{
- if (string.IsNullOrEmpty(item.SubItems["来源"].Text.Trim()))
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)item.Tag;
- if (string.IsNullOrEmpty(ColumnModel.ServiceOrderID.Trim()))
- { StrList.Add(item); }
- else
- {
- bool IsTrue = false;
- if (tbl.Rows.Count > 0)
- {
- DataRow dtRow = tbl.Rows.Find(ColumnModel.ServiceOrderID.Trim());
- if (dtRow["Ws_Status"].ToString().Trim() == "1")
- {
- //IsFind = true;
- IsTrue = true;
- }
- }
- if (!IsTrue)
- { StrList.Add(item); }
- }
- }
- //}
- }
- }
-
- for (int i = 0; i < StrList.Count; i++)
- { this.listViewData_Service.Items.Remove(StrList[i]); }
- this.GetShowAmount();
- this.bUpgrade = true;
- }
- /// <summary>
- /// 服务工具箱
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnServiceToolbox_Click(object sender, EventArgs e)
- {
- if (!this.IsClickToolbox)
- { MessageBoxCustom.Show("请先选择套系名称!"); return; }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxListViewSamllForm frm = new SetSmallForm.ToolboxListViewSamllForm();
- frm.LoadType = "婚庆服务";
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.SetOrderServiceValue(frm.mlist, frm.mlist_SmallImage); }
- }
- /// <summary>
- /// 获取套系服务总价
- /// </summary>
- /// <returns></returns>
- public decimal GetServiceAoumnt()
- { return Convert.ToDecimal(this.txt_H.Tag); }
- /// <summary>
- /// 列表点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_Click(object sender, EventArgs e)
- { this.txtText.Visible = false; }
- /// <summary>
- /// 右键显示菜单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- LYFZ.ComponentLibrary.ContextMenuStripEx contextmenu = new ComponentLibrary.ContextMenuStripEx();
- contextmenu.Name = "Source";
- contextmenu.ItemClicked += contextmenu_ItemClicked;
- //弹出操作菜单
- contextmenu.Items.Clear();
- contextmenu.Show(MousePosition.X, MousePosition.Y);
- if (this.listViewData_Service.Groups.Count > 0)
- {
- for (int i = 0; i < this.listViewData_Service.Groups.Count; i++)
- {
- if (this.listViewData_Service.Groups[i].Header.Trim() != "未分组")
- {
- ToolStripMenuItem item = new ToolStripMenuItem();
- item.Text = this.listViewData_Service.Groups[i].Header.Trim();
- item.Name = "GroupBy";
- contextmenu.Items.Add(item);
- }
- }
- ToolStripSeparator tools = new ToolStripSeparator();
- contextmenu.Items.Add(tools);
- }
- if (this.listViewData_Service.SelectedItems.Count > 0)
- {
- ToolStripMenuItem item = new ToolStripMenuItem();
- item.Text = "放大(" + this.listViewData_Service.SelectedItems[0].Text.Trim() + ")";
- item.Name = "ZoomView";
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.SelectedItems[0].Tag;
- item.Tag = ColumnModel.ServiceNumber.Trim();
- contextmenu.Items.Add(item);
- }
- contextmenu.Show();
- }
- }
- /// <summary>
- /// 右键菜单选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void contextmenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- ToolStripItem item = e.ClickedItem;
- if (!string.IsNullOrEmpty(item.Text.Trim()))
- {
- switch (item.Name.Trim())
- {
- case "ZoomView":
- DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: "Prod_Number = '" + item.Tag.ToString().Trim() + "'", ShowColumnName: "Prod_Thumbnail").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()))
- {
- LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
- frm.FrmImage = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString()));
- frm.ShowDialog();
- }
- else
- { MessageBoxCustom.Show("产品未上传相片!"); return; }
- }
- break;
- case "GroupBy":
- string StrMages = "";
- for (int i = 0; i < this.listViewData_Service.SelectedItems.Count; i++)
- {
- bool IsFind = false;
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.SelectedItems[i].Tag;
- if (!string.IsNullOrEmpty(ColumnModel.ServiceOrderID.Trim()))
- {
- DataTable dt = orbll.GetView_Custom("tb_ErpWeddingService", StrWhere: "ID = '" + ColumnModel.ServiceOrderID.Trim() + "'", ShowColumnName: "Ws_ProdName,Ws_Status").Tables[0];
- if (dt.Rows[0]["Ws_Status"].ToString().Trim() == "1")
- {
- StrMages += dt.Rows[0]["Ws_ProdName"].ToString().Trim() + ",";
- IsFind = true;
- }
- }
- if (!IsFind)
- { this.listViewData_Service.Groups[item.Text.Trim()].Items.Add(this.listViewData_Service.SelectedItems[i]); }
- }
- if (!string.IsNullOrEmpty(StrMages.Trim()))
- { MessageBoxCustom.Show("服务:" + StrMages.TrimEnd(',') + "。服务已完成,不能移动分组!"); }
- //for (int i = 0; i < this.listViewData_Service.SelectedItems.Count; i++)
- //{ this.listViewData_Service.Groups[item.Text.Trim()].Items.Add(this.listViewData_Service.SelectedItems[i]); }
- break;
- }
- }
- }
- /// <summary>
- /// 双击编辑子项
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- this.listViewData_Service_Click(this, null);
- ListViewHitTestInfo info = listViewData_Service.HitTest(e.X, e.Y);
- if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.SelectedItems[0].Tag;
- DataTable tbl = orbll.GetView_Custom("tb_ErpWeddingService", StrWhere: "ID = '" + ColumnModel.ServiceOrderID + "'", ShowColumnName: "Ws_Status").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- if (tbl.Rows[0]["Ws_Status"].ToString().Trim() == "1")
- { MessageBoxCustom.Show("此服务已经服务完成,不能修改!"); return; }
- }
- Rectangle rect = info.SubItem.Bounds;
- switch (info.SubItem.Name.Trim())
- {
- case "服务价格":
- if (this.OrdType == EnumPublic.OrderType.婚庆订单 || this.OrdType == EnumPublic.OrderType.服务订单)
- {
- if (!string.IsNullOrEmpty(this.listViewData_Service.SelectedItems[0].SubItems["来源"].Text.Trim()))
- { return; }
- this.txtText.Location = new Point(rect.Location.X + this.listViewData_Service.Location.X + 3, rect.Location.Y + this.listViewData_Service.Location.Y + 2);
- this.txtText.Size = rect.Size;
- this.txtText.Visible = true;
- this.txtText.Tag = info.SubItem.Name.Trim();
- this.txtText.Text = info.SubItem.Text.Trim();
- this.txtText.Focus();
- }
- break;
- case "备注":
- case "服务数量":
- if (info.SubItem.Name.Trim() == "备注")
- { this.txtText.MaxLength = 400; }
- else
- {
- if (!string.IsNullOrEmpty(this.listViewData_Service.SelectedItems[0].SubItems["来源"].Text.Trim()))
- { return; }
- else
- { this.txtText.MaxLength = 3; }
- }
- this.txtText.Location = new Point(rect.Location.X + this.listViewData_Service.Location.X + 3, rect.Location.Y + this.listViewData_Service.Location.Y + 2);
- this.txtText.Size = rect.Size;
- this.txtText.Visible = true;
- this.txtText.Tag = info.SubItem.Name.Trim();
- this.txtText.Text = info.SubItem.Text.Trim();
- this.txtText.Focus();
- break;
- }
- }
- else
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.SelectedItems[0].Tag;
- DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: "Prod_Number = '" + ColumnModel.ServiceNumber.Trim() + "'", ShowColumnName: "Prod_Thumbnail").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- if (!string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()))
- {
- LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic();
- frm.FrmImage = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString()));
- frm.ShowDialog();
- }
- else
- { MessageBoxCustom.Show("产品未上传相片!"); return; }
- }
- }
- }
- /// <summary>
- /// 文本框控件离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtText_Leave(object sender, EventArgs e)
- {
- try
- {
- if (this.txtText.Tag != null)
- {
- string StrText = "";
- switch (this.txtText.Tag.ToString().Trim())
- {
- case "服务价格":
- if (!string.IsNullOrEmpty(this.txtText.Text.Trim()))
- {
- if (LYFZ.Command.Command_Validate.IsNumeric(this.txtText.Text.Trim()))
- { StrText = this.txtText.Text.Trim(); }
- }
- this.listViewData_Service.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = StrText == "" ? "0.00" : StrText;
- GetShowAmount();
- break;
- case "服务数量":
- if (!string.IsNullOrEmpty(this.txtText.Text.Trim()))
- {
- if (LYFZ.Command.Command_Validate.IsNumberSign(this.txtText.Text.Trim()))
- {
- if (this.txtText.Text.Trim() == "0")
- { StrText = "1"; }
- else
- { StrText = this.txtText.Text.Trim(); }
- }
- }
- this.listViewData_Service.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = StrText == "" ? "1" : StrText;
- GetShowAmount();
- break;
- case "备注":
- this.listViewData_Service.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = this.txtText.Text.Trim();
- break;
- }
- }
- }
- catch
- { }
- this.txtText.Visible = false;
- }
- /// <summary>
- /// 文本框输入限制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtText_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (this.txtText.Tag != null)
- {
- switch (this.txtText.Tag.ToString().Trim())
- {
- case "服务价格":
- if (Convert.ToString(e.KeyChar) == ".")
- {
- string StrValue = this.txtText.Text.Trim();
- if (StrValue.IndexOf('.') != -1)
- { e.Handled = true; }
- }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- break;
- case "服务数量":
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- break;
- }
- }
- }
- /// <summary>
- /// 点击排序
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_ColumnClick(object sender, ColumnClickEventArgs e)
- {
- this.listViewData_Service_Click(this, null);
- // 检查点击的列是不是现在的排序列.
- if (e.Column == lvwColumnSorter.SortColumn)
- {
- // 重新设置此列的排序方法.
- if (lvwColumnSorter.Order == SortOrder.Ascending)
- { lvwColumnSorter.Order = SortOrder.Descending; }
- else
- { lvwColumnSorter.Order = SortOrder.Ascending; }
- }
- else
- {
- // 设置排序列,默认为正向排序
- lvwColumnSorter.SortColumn = e.Column;
- lvwColumnSorter.Order = SortOrder.Ascending;
- }
- // 用新的排序方法对ListView排序
- this.listViewData_Service.Sort();
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- if ((i % 2) > 0)
- { this.listViewData_Service.Items[i].BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { this.listViewData_Service.Items[i].BackColor = System.Drawing.Color.PowderBlue; }
- }
- }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Service_Resize(object sender, EventArgs e)
- {
- int CountWidth = 0;
- for (int i = 0; i < this.listViewData_Service.Columns.Count; i++)
- {
- if (i > 0)
- { CountWidth += this.listViewData_Service.Columns[i].Width; }
- }
- this.listViewData_Service.Columns[0].Width = this.listViewData_Service.Width - CountWidth - 23;
- }
- /// <summary>
- /// 设置订单服务资料
- /// </summary>
- /// <param name="mlist"></param>
- public void SetOrderServiceValue(List<LYFZ.Model.Model_ErpProduct> mlist, ImageList mlist_SmallImage)
- {
- for (int i = 0; i < mlist_SmallImage.Images.Keys.Count; i++)
- {
- if (!this.mlistImage.Images.Keys.Contains(mlist_SmallImage.Images.Keys[i].Trim()))
- { this.mlistImage.Images.Add(mlist_SmallImage.Images.Keys[i].Trim(), mlist_SmallImage.Images[mlist_SmallImage.Images.Keys[i].Trim()]); }
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = null;
- for (int i = 0; i < mlist.Count; i++)
- {
- ListViewItem lvItem = new ListViewItem();
- ColumnModel = new SetCustomControls_ServiceColumnHeaderModel();
- ColumnModel.ServiceNumber = mlist[i].Prod_Number.Trim();
- ColumnModel.ServiceCostPrice = mlist[i].Prod_CostPrice.ToString().Trim();
- ColumnModel.ServiceUnit = mlist[i].Prod_Unit.ToString().Trim();
- ColumnModel.ServiceOrderID = "";
- lvItem.Tag = ColumnModel;
- lvItem.ImageKey = mlist[i].Prod_Number.Trim();
- lvItem.Text = mlist[i].Prod_Name.Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服务价格";
- ListSubItem.Text = mlist[i].Prod_SalesPrice.ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "来源";
- ListSubItem.Text = "";
- 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 = "";
- lvItem.SubItems.Add(ListSubItem);
- if ((this.listViewData_Service.Items.Count % 2) > 0)
- { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
- if (this.listViewData_Service.Groups.Count > 0)
- { this.listViewData_Service.Groups["未分组"].Items.Add(lvItem); }
- this.listViewData_Service.Items.Add(lvItem);
- }
- this.GetShowAmount();
- }
- /// <summary>
- /// 设置订单服务资料
- /// </summary>
- /// <param name="mlist"></param>
- public void SetOrderServiceValue(string StrOrdNumber, bool IsActivity, string StrSeriesName)
- {
- if (this.bUpgrade)
- {
- DeleteSightByNotAction();
- }
- else
- {
- this.listViewData_Service.Groups.Clear();
- this.listViewData_Service.Items.Clear();
- }
- if (this.OrdType == EnumPublic.OrderType.儿童订单)
- { this.GroupChange(); }
- if (!string.IsNullOrEmpty(StrSeriesName))
- { this.IsClickToolbox = true; }
- string StrTableName = "(select tb_ErpWeddingService.ID,Ws_ProdNumber,Ws_OrderByNumber,Ws_ProdName,Ws_ProdSoldPrice,Ws_ProdQuantity,Ws_ProdCostPrice,Ws_Number,Ws_Unit,Prod_Unit,Prod_Thumbnail,Ws_OpenOrderRemark,Ws_OpenOrderSource," +
- "case when Ws_ViceNumber = '' or Ws_ViceNumber is null then '未分组' else (select top 1 Ordpg_Sights from tb_ErpOrdersPhotography where Ordpg_ViceNumber = Ws_ViceNumber) end AS Ordpg_Sights" +
- " from tb_ErpWeddingService Left Join tb_ErpProduct on Prod_Number = Ws_ProdNumber) AS tb";
- DataTable dt = orbll.GetView_Custom(StrTableName, StrWhere: "Ws_Number = '" + StrOrdNumber + "'", ShowColumnName: "*", filedOrder: "Ws_OrderByNumber ASC").Tables[0];
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = null;
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetProductImage(dt.Rows[i]["Prod_Thumbnail"].ToString().Trim());
- if (!this.mlistImage.Images.Keys.Contains(dt.Rows[i]["Ws_ProdNumber"].ToString().Trim()))
- { this.mlistImage.Images.Add(dt.Rows[i]["Ws_ProdNumber"].ToString().Trim(), img); }
- ListViewItem lvItem = new ListViewItem();
- ColumnModel = new SetCustomControls_ServiceColumnHeaderModel();
- ColumnModel.ServiceNumber = dt.Rows[i]["Ws_ProdNumber"].ToString().Trim();
- ColumnModel.ServiceCostPrice = dt.Rows[i]["Ws_ProdCostPrice"].ToString().Trim();
- if (string.IsNullOrEmpty(dt.Rows[i]["Ws_Unit"].ToString().Trim()))
- { ColumnModel.ServiceUnit = dt.Rows[i]["Prod_Unit"].ToString().Trim(); }
- else
- { ColumnModel.ServiceUnit = dt.Rows[i]["Ws_Unit"].ToString().Trim(); }
- ColumnModel.ServiceOrderID = dt.Rows[i]["ID"].ToString().Trim();
- lvItem.Tag = ColumnModel;
- lvItem.ImageKey = dt.Rows[i]["Ws_ProdNumber"].ToString().Trim();
- lvItem.Text = dt.Rows[i]["Ws_ProdName"].ToString().Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服务价格";
- ListSubItem.Text = dt.Rows[i]["Ws_ProdSoldPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "来源";
- ListSubItem.Text = dt.Rows[i]["Ws_OpenOrderSource"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服务数量";
- ListSubItem.Text = dt.Rows[i]["Ws_ProdQuantity"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "备注";
- ListSubItem.Text = dt.Rows[i]["Ws_OpenOrderRemark"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- if ((this.listViewData_Service.Items.Count % 2) > 0)
- { lvItem.BackColor = System.Drawing.Color.PapayaWhip; }
- else
- { lvItem.BackColor = System.Drawing.Color.PowderBlue; }
- if (this.listViewData_Service.Groups.Count > 0)
- {
- if (!string.IsNullOrEmpty(dt.Rows[i]["Ordpg_Sights"].ToString().Trim()) && this.listViewData_Service.Groups[dt.Rows[i]["Ordpg_Sights"].ToString().Trim()] != null)
- { this.listViewData_Service.Groups[dt.Rows[i]["Ordpg_Sights"].ToString().Trim()].Items.Add(lvItem); }
- else
- { this.listViewData_Service.Groups["未分组"].Items.Add(lvItem); }
- }
- this.listViewData_Service.Items.Add(lvItem);
- }
- GetShowAmount();
- GetIsActivity(IsActivity);
- }
- /// <summary>
- /// 设置订单服务资料
- /// </summary>
- /// <param name="mlist">要绑定的数据源</param>
- /// <param name="dsSet">提供绑定查询的产品服务数据</param>
- /// <param name="IsActivity">是否为活动套系</param>
- public string SetOrderServiceValue(DataRow[] dtRows, bool IsActivity, LYFZ.EnumPublic.EnumPackagesType PackagesType)
- {
- string StrDeleteProduct = "";
- if (PackagesType == EnumPublic.EnumPackagesType.AAAAAAB)
- {
- if (this.bUpgrade)
- {
- DeleteSightByNotAction();
- }
- else
- {
- this.listViewData_Service.Items.Clear();
- this.listViewData_Service.Groups.Clear();
- }
- //this.listViewData_Service.Items.Clear();
- //this.listViewData_Service.Groups.Clear();
- }
- else
- { this.RemovePackageItem(); }
- if (this.OrdType == EnumPublic.OrderType.儿童订单)
- { this.GroupChange(); }
- this.IsClickToolbox = true;
- for (int i = 0; i < dtRows.Length; i++)
- {
- if (!string.IsNullOrEmpty(dtRows[i]["Prod_Number"].ToString().Trim()))
- {
- Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetProductImage(dtRows[i]["Prod_Thumbnail"].ToString().Trim());
- this.mlistImage.Images.Add(dtRows[i]["Prod_Number"].ToString().Trim(), img);
- ListViewItem lvItem = new ListViewItem();
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = new SetCustomControls_ServiceColumnHeaderModel();
- ColumnModel.PgmID = dtRows[i]["PgmID"].ToString().Trim();
- ColumnModel.ServiceNumber = dtRows[i]["Prod_Number"].ToString().Trim();
- ColumnModel.ServiceCostPrice = dtRows[i]["Prod_CostPrice"].ToString().Trim();
- ColumnModel.ServiceUnit = dtRows[i]["Prod_Unit"].ToString().Trim();
- ColumnModel.ServiceOrderID = "";
- lvItem.Tag = ColumnModel;
- lvItem.ImageKey = dtRows[i]["Prod_Number"].ToString().Trim();
- lvItem.Text = dtRows[i]["Prod_Name"].ToString().Trim();
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服务价格";
- ListSubItem.Text = dtRows[i]["Prod_SalesPrice"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "来源";
- ListSubItem.Text = dtRows[i]["TaoXiNameSource"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "服务数量";
- ListSubItem.Text = dtRows[i]["Pgm_Quantity"].ToString().Trim();
- lvItem.SubItems.Add(ListSubItem);
- ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = "备注";
- ListSubItem.Text = "";
- lvItem.SubItems.Add(ListSubItem);
- if (this.listViewData_Service.Groups.Count > 0)
- {
- if (!string.IsNullOrEmpty(dtRows[i]["Pgm_ProductGroupName"].ToString().Trim()))
- { this.listViewData_Service.Groups[dtRows[i]["Pgm_ProductGroupName"].ToString().Trim()].Items.Add(lvItem); }
- else
- { this.listViewData_Service.Groups["未分组"].Items.Add(lvItem); }
- }
- this.listViewData_Service.Items.Add(lvItem);
- }
- else
- { StrDeleteProduct += dtRows[i]["Pgm_ProductNumber"].ToString().Trim() + ","; }
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData_Service);
- if (StrDeleteProduct.Trim() != "")
- { StrDeleteProduct = "有服务已删除,已删除服务编号为:" + StrDeleteProduct.TrimEnd(',') + ";"; }
- if (PackagesType == EnumPublic.EnumPackagesType.AAAAAAB)
- { this.GetIsActivity(IsActivity); }
- this.GetShowAmount();
- return StrDeleteProduct;
- }
- /// <summary>
- /// 绑定服务列表的数据信息
- /// </summary>
- /// <param name="erpOrder"></param>
- public void GetOrderServiceValueData(Api_ErpOrderModel erpOrder)
- {
- erpOrder.OrderServiceData=new List<Api_ServiceModel>();
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.Items[i].Tag;
- Api_ServiceModel model = new Api_ServiceModel()
- {
- PgmID = ColumnModel.PgmID,
- ServiceCostPrice = ColumnModel.ServiceCostPrice,
- ServiceNumber = ColumnModel.ServiceNumber,
- ServiceOrderID = ColumnModel.ServiceOrderID,
- ServiceUnit = ColumnModel.ServiceUnit,
- ServiceName = this.listViewData_Service.Items[i].Text.Trim(),
- SerNumber = this.listViewData_Service.Items[i].SubItems["服务数量"].Text,
- Source = this.listViewData_Service.Items[i].SubItems["来源"].Text,
- strRank = this.listViewData_Service.Items[i].SubItems["备注"].Text.Trim(),
- GroupName = this.listViewData_Service.Items[i].Group==null?"": this.listViewData_Service.Items[i].Group.Header.ToString(),
- ServicePrice = this.listViewData_Service.Items[i].SubItems["服务价格"].Text
- };
- erpOrder.OrderServiceData.Add(model);
- }
- }
- /// <summary>
- /// 获取订单商品资料
- /// </summary>
- /// <param name="SightsViceNumberList"></param>
- /// <param name="IsContinue"></param>
- /// <param name="IsMagess">是否检测无数据提示:true为提示(如用于保存订单);false为不提示(如用于保存意向订单)</param>
- /// <returns></returns>
- public List<Helper.CommandInfo> GetOrderServiceValue(DateTime strTime, ref bool IsContinue, string StrOrdNumber, string Marriage, Hashtable htGroupList, string MarriageLunar = "0")
- {
- string DateMarriage = "";
- if (Marriage != "")
- {
- if (MarriageLunar.Trim() == "1")
- {
- if (string.IsNullOrEmpty(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetLunarCalendarToSolarCalendar(Marriage)))
- {
- MessageBoxCustom.Show("婚期日期:农历不存在" + Marriage + "此日期!");
- IsContinue = true;
- return null;
- }
- DateMarriage = Convert.ToDateTime(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetLunarCalendarToSolarCalendar(Marriage)).ToString("yyyy-MM-dd");
- }
- else
- { DateMarriage = Convert.ToDateTime(Marriage).ToString("yyyy-MM-dd"); }
- }
- List<LYFZ.Model.Model_ErpWeddingService> mlist = new List<Model.Model_ErpWeddingService>();
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- LYFZ.Model.Model_ErpWeddingService model = null;
- DataTable Old_tbl = wsbll.GetList("Ws_Number='" + StrOrdNumber + "'").Tables[0];
- Old_tbl.PrimaryKey = new DataColumn[] { Old_tbl.Columns["ID"] };
- bool IsNotGroup = false;
- DataTable dtMarriage = orbll.GetView_Custom("select Cus_DayForMarriage,Cus_DayForMarriageLunar from tb_ErpCustomerGroup Left Join tb_ErpCustomerGroupMembers on GP_CustomerGroupID = GM_CustomerGroupID Left Join tb_ErpCustomer on Cus_CustomerNumber = GM_CustomerID Where GM_Master =1 and GP_OrderNumber = 'QT16102400006'").Tables[0];
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.Items[i].Tag;
- if (!string.IsNullOrEmpty(ColumnModel.ServiceOrderID))
- {
- #region
- DataRow dtRow = Old_tbl.Rows.Find(ColumnModel.ServiceOrderID.Trim());
- if (dtRow != null)
- {
- model = wsbll.DataRowToModel(dtRow);
- if (model.Ws_Status.Trim() != "1")
- {
- bool IsFind = false;
- if (this.listViewData_Service.Groups.Count > 0)
- {
- if (this.listViewData_Service.Items[i].Group.Header.Trim() != "未分组")
- {
- if (htGroupList.Count > 0)
- {
- if (htGroupList.ContainsKey(this.listViewData_Service.Items[i].Group.Header.Trim()))
- {
- model.Ws_ViceNumber = htGroupList[this.listViewData_Service.Items[i].Group.Header.Trim()].ToString().Trim();
- IsFind = true;
- }
- }
- }
- else
- { IsNotGroup = true; }
- }
- if (!IsFind)
- { model.Ws_ViceNumber = StrOrdNumber + "_001"; }
- model.Ws_OpenOrderRemark = this.listViewData_Service.Items[i].SubItems["备注"].Text.Trim();
- }
- Old_tbl.Rows.Remove(dtRow);
- }
- if (model == null)
- { MessageBoxCustom.Show("数据出错,重新点击保存试试!"); IsContinue = true; return null; }
- #endregion
- }
- else
- {
- #region
- model = new Model.Model_ErpWeddingService();
- bool IsFind = false;
- if (this.listViewData_Service.Groups.Count > 0)
- {
- if (this.listViewData_Service.Items[i].Group.Header.Trim() != "未分组")
- {
- if (htGroupList.Count > 0)
- {
- if (htGroupList.ContainsKey(this.listViewData_Service.Items[i].Group.Header.Trim()))
- {
- IsFind = true;
- model.Ws_ViceNumber = htGroupList[this.listViewData_Service.Items[i].Group.Header.Trim()].ToString().Trim();
- }
- }
- }
- else
- { IsNotGroup = true; }
- }
- if (!IsFind)
- { model.Ws_ViceNumber = StrOrdNumber + "_001"; }
- model.Ws_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Ws_ProdName = this.listViewData_Service.Items[i].Text.Trim();
- model.Ws_ProdNumber = ColumnModel.ServiceNumber;
- model.Ws_ProdCostPrice = Convert.ToDecimal(ColumnModel.ServiceCostPrice);
- model.Ws_OpenOrderSource = this.listViewData_Service.Items[i].SubItems["来源"].Text.Trim();
- model.Ws_Remark = "";
- model.Ws_Serviceman1 = "";
- model.Ws_Serviceman2 = "";
- model.Ws_Status = "0";
- model.Ws_Type = "1";
- model.Ws_UpdateName = "";
- model.Ws_WeddingDispatcher = "";
- model.Ws_OpenOrderRemark = this.listViewData_Service.Items[i].SubItems["备注"].Text.Trim();
- model.Ws_ReservationServiceDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- #endregion
- }
- if (!string.IsNullOrEmpty(DateMarriage))
- {
- if (Convert.ToDateTime(DateMarriage) > LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime())
- {
- if (model.Ws_Status == "0")
- {
- if (dtMarriage.Rows.Count > 0 && model.Ws_WeddingDate != null && dtMarriage.Rows[0]["Cus_DayForMarriage"].ToString().Trim().Length > 0)
- {
- if (Convert.ToDateTime(dtMarriage.Rows[0]["Cus_DayForMarriage"]).ToString("yyyy-MM-dd") != Convert.ToDateTime(model.Ws_WeddingDate).ToString("yyyy-MM-dd"))
- {
- model.Ws_WeddingDate = Convert.ToDateTime(DateMarriage);
- model.Ws_WeddingDateLunar = "0";
- }
- }
- else
- {
- model.Ws_WeddingDate = Convert.ToDateTime(DateMarriage);
- model.Ws_WeddingDateLunar = "0";
- }
- }
- }
- }
- model.Ws_OrderByNumber = (i + 1);
- model.Ws_UpdateDateTime = strTime;
- model.Ws_Number = StrOrdNumber;
- model.Ws_ProdQuantity = Convert.ToInt32(this.listViewData_Service.Items[i].SubItems["服务数量"].Text);
- model.Ws_Unit = ColumnModel.ServiceUnit;
- model.Ws_ProdSoldPrice = Convert.ToDecimal(this.listViewData_Service.Items[i].SubItems["服务价格"].Text);
- if (model.ID > 0)
- { clist.Add(wsbll.GetUpdateCommandInfo(model)); }
- else
- { clist.Add(wsbll.GetAddCommandInfo(model)); }
- mlist.Add(model);
- }
- for (int i = 0; i < Old_tbl.Rows.Count; i++)
- { clist.Add(wsbll.GetDeleteCommandInfo("ID", "=", Old_tbl.Rows[i]["ID"].ToString().Trim())); }
- if (IsNotGroup)
- {
- if (MessageBoxCustom.Show("订单服务有未分组所属拍摄次数,若继续保存则会默认识别为第一次拍摄,是否要继续保存?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- IsContinue = true;
- return null;
- }
- }
- return clist;
- }
- /// <summary>
- /// 移除礼包的项目
- /// </summary>
- public void RemovePackageItem()
- {
- if (this.listViewData_Service.Items.Count > 0)
- {
- List<ListViewItem> listItem = new List<ListViewItem>();
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- if (!string.IsNullOrEmpty(this.listViewData_Service.Items[i].SubItems["来源"].Text.Trim()))
- { listItem.Add(this.listViewData_Service.Items[i]); }
- }
- for (int i = 0; i < listItem.Count; i++)
- { this.listViewData_Service.Items.Remove(listItem[i]); }
- }
- }
- /// <summary>
- /// 是否能操作
- /// </summary>
- /// <param name="IsActivity"></param>
- void GetIsActivity(bool IsActivity)
- {
- this.btnServiceAllDelete.Enabled = !IsActivity;
- this.btnServiceDelete.Enabled = !IsActivity;
- this.btnServiceToolbox.Enabled = !IsActivity;
- if (IsActivity && LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ChangeActiveContent)
- {
- this.btnServiceAllDelete.Enabled = IsActivity;
- this.btnServiceDelete.Enabled = IsActivity;
- this.btnServiceToolbox.Enabled = IsActivity;
- }
- }
- /// <summary>
- /// 获取商品总价
- /// </summary>
- public void GetShowAmount()
- {
- //总价相加
- decimal decTotalPrice = 0;
- decimal decTotalCostPrice = 0;
- for (int i = 0; i < this.listViewData_Service.Items.Count; i++)
- {
- int IntCount = Convert.ToInt32(this.listViewData_Service.Items[i].SubItems["服务数量"].Text);
- if (!string.IsNullOrEmpty(this.listViewData_Service.Items[i].SubItems["服务价格"].Text.Trim()))
- { decTotalPrice += Convert.ToDecimal(this.listViewData_Service.Items[i].SubItems["服务价格"].Text) * IntCount; }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.SetCustomControls_ServiceColumnHeaderModel ColumnModel = (SetCustomControls_ServiceColumnHeaderModel)this.listViewData_Service.Items[i].Tag;
- if (ColumnModel.ServiceCostPrice.Length > 0)
- { decTotalCostPrice += Convert.ToDecimal(ColumnModel.ServiceCostPrice) * IntCount; }
- }
- this.txt_H.Text = "服务总价(" + decTotalPrice + ")";
- this.txt_H.Tag = decTotalCostPrice;
- }
- }
- }
|