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; /// /// 套系赠送商品ID(用于检查是否修改过套系商品) /// public string PgmID { get { return _PgmID; } set { _PgmID = value; } } /// /// 服务编号 /// public string ServiceNumber { get { return _ServiceNumber; } set { _ServiceNumber = value; } } /// /// 服务成本价 /// public string ServiceCostPrice { get { return _ServiceCostPrice; } set { _ServiceCostPrice = value; } } /// /// 服务单位 /// public string ServiceUnit { get { return _ServiceUnit; } set { _ServiceUnit = value; } } /// /// 订单服务ID /// 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; } /// /// 订单编号 /// public string StrNumber = ""; /// /// 相片集合 /// ImageList mlistImage = new ImageList(); /// /// 登录者员工ID /// string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; LYFZ.ComponentLibrary.ListViewColumnSorter lvwColumnSorter; private EnumPublic.OrderType _OrdType; /// /// 订单类型 /// 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; /// /// 是否能点击工具箱 /// public bool IsClickToolbox { get { return _isClickToolbox; } set { _isClickToolbox = value; } } private List _StrGroupList = new List(); /// /// 组的list /// public List StrGroupList { get { return _StrGroupList; } set { _StrGroupList = value; this.GroupChange(); } } /// /// 拍摄次数组变更 /// void GroupChange() { List GroupList = new List(); for (int i = 0; i < this.StrGroupList.Count; i++) { GroupList.Add(this.StrGroupList[i]); } if (this.listViewData_Service.Groups["未分组"] == null) { this.CreateDefaultGroup(); } List DeleteGroup = new List(); List ChangeItemList = new List(); 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]); } } /// /// 创建默认分组 /// 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; } } /// /// 获取当前列表 /// /// 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; } /// /// 获取列表详情数据 /// /// 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; } /// /// 上移 /// /// /// 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(); } } } /// /// 下移 /// /// /// 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 拖放事件 /// /// 点击开始拖放 /// /// /// 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); } } } /// /// 拖放时去入控件时间 /// /// /// void listViewData_Service_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Move; } /// /// 拖放完成操作后 /// /// /// 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 /// /// 删除全部服务 /// /// /// 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 StrList = new List(); 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,不能删除"); } } } /// /// 删除服务 /// /// /// void btnServiceDelete_Click(object sender, EventArgs e) { List StrList = new List(); 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(); } /// /// 删除数据 /// public void DeleteSightByNotAction() { List StrList = new List(); 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; } /// /// 服务工具箱 /// /// /// 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); } } /// /// 获取套系服务总价 /// /// public decimal GetServiceAoumnt() { return Convert.ToDecimal(this.txt_H.Tag); } /// /// 列表点击 /// /// /// void listViewData_Service_Click(object sender, EventArgs e) { this.txtText.Visible = false; } /// /// 右键显示菜单 /// /// /// 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(); } } /// /// 右键菜单选择事件 /// /// /// 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; } } } /// /// 双击编辑子项 /// /// /// 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; } } } } /// /// 文本框控件离开事件 /// /// /// 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; } /// /// 文本框输入限制 /// /// /// 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; } } } /// /// 点击排序 /// /// /// 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; } } } /// /// 窗体大小发生变化 /// /// /// 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; } /// /// 设置订单服务资料 /// /// public void SetOrderServiceValue(List 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(); } /// /// 设置订单服务资料 /// /// 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); } /// /// 设置订单服务资料 /// /// 要绑定的数据源 /// 提供绑定查询的产品服务数据 /// 是否为活动套系 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; } /// /// 绑定服务列表的数据信息 /// /// public void GetOrderServiceValueData(Api_ErpOrderModel erpOrder) { erpOrder.OrderServiceData=new List(); 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); } } /// /// 获取订单商品资料 /// /// /// /// 是否检测无数据提示:true为提示(如用于保存订单);false为不提示(如用于保存意向订单) /// public List 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 mlist = new List(); List clist = new List(); 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; } /// /// 移除礼包的项目 /// public void RemovePackageItem() { if (this.listViewData_Service.Items.Count > 0) { List listItem = new List(); 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]); } } } /// /// 是否能操作 /// /// 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; } } /// /// 获取商品总价 /// 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; } } }