using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using LYFZ.ComponentLibrary; using LYFZ.Helper; namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm { public partial class FilmsSelectionReservationQuerySmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.FilmsSelectionReservationQuerySmallForm { public FilmsSelectionReservationQuerySmallForm() { this.Shown += FilmsSelectionReservationQuerySmallForm_Shown; this.Load += FilmsSelectionReservationQuerySmallForm_Load; this.cmbQueryText.KeyDown += cmbTextQuery_KeyDown; this.btnQuery.Click += btnQuery_Click; this.rdoAll.Click += rdoAll_Click; this.rdoNo.Click += rdoNo_Click; this.rdoOK.Click += rdoOK_Click; this.chkXiuOK.Click += chkXiuOK_Click; this.chkPaiOK.Click += chkPaiOK_Click; this.chkWedding.Click += chkWedding_Click; this.chkKids.Click += chkKids_Click; this.chkPortrait.Click += chkPortrait_Click; this.btnReservation.Click += btnReservation_Click; this.btnSameDate.Click += btnSameDate_Click; this.btnClose.Click += btnClose_Click; this.Resize += FilmsSelectionReservationQuerySmallForm_Resize; this.dgvData.CellDoubleClick += dgvData_CellDoubleClick; this.dgvData.ColumnHeaderMouseClick += dgvData_ColumnHeaderMouseClick; this.dgvData.CellMouseDown += dgvData_CellMouseDown; } LYFZ.BLL.BLL_ErpOrderDigital dbll = new BLL.BLL_ErpOrderDigital(); /// /// 是否保存 /// public bool IsSaveed = false; /// /// 员工编号 /// string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; /// /// 窗体加载事件 /// /// /// void FilmsSelectionReservationQuerySmallForm_Shown(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetSystemVersion(this.chkPortrait, this.chkWedding, this.chkKids); this.PublicFunctionRows(); if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_FilmsSelectionClientAnPai)) { this.btnSameDate.Enabled = false; } } /// /// 窗体加载事件 /// /// /// void FilmsSelectionReservationQuerySmallForm_Load(object sender, EventArgs e) { if (this.dgvData.Columns.Count <= 0) { string strColumn = "订单号,订单类型,客户姓名,客户电话,客户性别,婚期,接单人,套系名称,套系价格,拍摄名称,拍照状态,初修状态,选片状态,选片师,选片时间,录入,录入时间"; this.dgvData.DataColumns(strColumn, LYFZ.Software.MainBusiness.CommonLogical.CacheData.StrOrderReportHideField); } } /// /// 回车 /// /// /// void cmbTextQuery_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { this.btnQuery_Click(this, null); } } /// /// 查询 /// /// /// void btnQuery_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// 全部 /// /// /// void rdoAll_Click(object sender, EventArgs e) { this.rdoNo.Checked = false; this.rdoOK.Checked = false; this.PublicFunctionRows(); } /// /// 未拍 /// /// /// void rdoNo_Click(object sender, EventArgs e) { this.rdoAll.Checked = false; this.rdoOK.Checked = false; this.PublicFunctionRows(); } /// /// 已选 /// /// /// void rdoOK_Click(object sender, EventArgs e) { this.rdoAll.Checked = false; this.rdoNo.Checked = false; this.PublicFunctionRows(); } /// /// 已拍 /// /// /// void chkXiuOK_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// 已修改 /// /// /// void chkPaiOK_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// 婚纱版 /// /// /// void chkWedding_Click(object sender, EventArgs e) { if (this.chkWedding.Checked) { this.chkPortrait.Checked = false; this.chkKids.Checked = false; this.chkWedding.Checked = true; } this.PublicFunctionRows(); } /// /// 儿童版 /// /// /// void chkKids_Click(object sender, EventArgs e) { if (this.chkKids.Checked) { this.chkPortrait.Checked = false; this.chkKids.Checked = true; this.chkWedding.Checked = false; } this.PublicFunctionRows(); } /// /// 写真版 /// /// /// void chkPortrait_Click(object sender, EventArgs e) { if (this.chkPortrait.Checked) { this.chkPortrait.Checked = true; this.chkKids.Checked = false; this.chkWedding.Checked = false; } this.PublicFunctionRows(); } /// /// 预约 /// /// /// void btnReservation_Click(object sender, EventArgs e) { if (this.dgvData.Rows.Count > 0) { if (this.dgvData.CurrentRow != null) { if (this.dgvData.CurrentRow.Index >= 0) { LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.FilmsSelectionReservationSmallForm frm = new FilmsSelectionReservationSmallForm(); frm.OrdViceNumber = this.dgvData.CurrentRow.Cells["Ordv_ViceNumber"].Value.ToString().Trim(); frm.ShowDialog(); if (frm.IsSave) { this.IsSaveed = frm.IsSave; PublicFunctionRows(); } } else { MessageBoxCustom.Show("请选择你要安排的客人"); return; } } else { MessageBoxCustom.Show("请选择你要安排的客人"); return; } } } /// /// 同一日期 /// /// /// void btnSameDate_Click(object sender, EventArgs e) { if (this.dgvData.Rows.Count > 0) { if (this.dgvData.SelectedRows.Count > 1) { List mlist = new List(); bool isFurn = false; string StrWhere = " Ordv_ViceNumber in ("; for (int i = 0; i < this.dgvData.SelectedRows.Count; i++) { if (this.dgvData.SelectedRows[i].Visible) { StrWhere += "'" + this.dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim() + "',"; isFurn = true; } } StrWhere = StrWhere.TrimEnd(',') + ")"; System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(delegate() { mlist = dbll.GetModelList(strWhere: StrWhere); })); t.Start(); LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.UnityArrangeWorkSuperSmallForm frm = new SuperSmallForm.UnityArrangeWorkSuperSmallForm(); frm.UnityArrangeWorkType = LYFZ.EnumPublic.EnumUnityArrangeWorkType.选片客人; frm.ShowDialog(); if (frm.IsSaveed) { string strName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; DateTime StrTime = SDateTime.Now; List clist = new List(); if (MessageBoxCustom.Show("您确定要保存安排吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } while (isFurn) { if (mlist.Count > 0) { isFurn = false; } } for (int i = 0; i < this.dgvData.SelectedRows.Count; i++) { if (this.dgvData.SelectedRows[i].Visible) { for (int j = 0; j < mlist.Count; j++) { if (mlist[j].Ordv_ViceNumber.Trim() == this.dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim()) { LYFZ.Model.Model_ErpOrderDigital model = mlist[j]; //LYFZ.Model.Model_ErpOrderDigital model = dbll.GetModel("Ordv_ViceNumber", this.dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim()); if (frm.UnityArrangeWorkModel.IsDateTime) { this.dgvData.SelectedRows[i].Cells["选片时间"].Value = frm.UnityArrangeWorkModel.StrDateTime; model.Ordv_ReservationFilmSelectionTime = Convert.ToDateTime(frm.UnityArrangeWorkModel.StrDateTime); } if (frm.UnityArrangeWorkModel.IsFilmSelectionName) { this.dgvData.SelectedRows[i].Cells["选片师"].Value = frm.UnityArrangeWorkModel.FilmSelectionName; model.Ordv_ReservationFilmSelectionName = frm.UnityArrangeWorkModel.FilmSelectionTag; } model.Ordv_FilmSelectionDispatcher = strName; model.Ordv_FilmSelectionDispatchTime = StrTime; model.Ordv_UpdateDateTime = StrTime; model.Ordv_UpdateName = strName; clist.Add(dbll.GetUpdateCommandInfo(model)); mlist.RemoveAt(j); break; } } } } if (clist.Count > 0) { if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0) { this.IsSaveed = true; MessageBoxCustom.Show("保存成功"); } else { MessageBoxCustom.Show("保存失败"); } } } } else { MessageBoxCustom.Show("请选择多条数据进行安排"); return; } } } /// /// 关闭 /// /// /// void btnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 窗体大小发生变化 /// /// /// void FilmsSelectionReservationQuerySmallForm_Resize(object sender, EventArgs e) { switch (this.panelPortrait.Location.Y) { case 3: this.flowLayoutPanel1.Height = 36; break; case 37: this.flowLayoutPanel1.Height = 70; break; } } /// /// 数据列表双击事件 /// /// /// void dgvData_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (this.dgvData.Rows.Count > 0) { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { this.btnReservation_Click(null, null); } } } /// /// 右键菜单 /// /// /// void dgvData_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (e.RowIndex == -1) { this.dgvData.conMenu.Items.Clear(); ToolStripMenuItem item = new ToolStripMenuItem(); item.Text = "设置标题"; item.Tag = "SetColumnShow"; item.Name = "SetColumnShow"; this.dgvData.conMenu.Items.Add(item); // this.dgvData.conMenu.Show(MousePosition.X, MousePosition.Y);//弹出操作菜单 this.dgvData.conMenu.ItemClicked -= dgvData_DataGridViewConMenu_ItemClicked; this.dgvData.conMenu.ItemClicked += dgvData_DataGridViewConMenu_ItemClicked; // this.dgvData.conMenu.Show(); if (!this.dgvData.conMenu.Visible) { this.dgvData.conMenu.Show(MousePosition.X, MousePosition.Y);//弹出操作菜单 } } } } /// /// 右键菜单选择项事件 /// /// /// void dgvData_DataGridViewConMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { ToolStripItem item = e.ClickedItem; if (item.Name.Trim() == "SetColumnShow") { if (LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ShowDataGridViewSetColumn(this.dgvData, StrEnabled: "选片时间,选片师")) { this.PublicFunctionRows(); } } } /// /// 点击列标头排序 /// /// /// void dgvData_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Left) { string StrColumnName = this.dgvData.Columns[e.ColumnIndex].Name.Trim(); if (StrColumnName == this.StrCurrentClickField || string.IsNullOrEmpty(this.StrCurrentClickField)) { if (this.StrSortOrder == "ASC") { this.StrSortOrder = "DESC"; } else { this.StrSortOrder = "ASC"; } } else { this.StrSortOrder = "DESC"; } if (!StrColumnName.Equals("订单号"))//this.dgvData.StrValueNullColumn.Trim().IndexOf(StrColumnName) == -1) { this.StrSortField = StrColumnName + " " + this.StrSortOrder + ",Ord_CreateDateTime,Ordv_DigitalNumber"; } else { this.StrSortField = "Ord_CreateDateTime " + this.StrSortOrder + ",Ordv_DigitalNumber"; } this.StrCurrentClickField = StrColumnName; this.PublicFunctionRows(); } } /// /// 当前点击的字段 /// string StrCurrentClickField = ""; /// /// 排序字段 /// string StrSortField = "Ord_CreateDateTime ASC,Ordv_DigitalNumber"; /// /// 排序顺序 /// string StrSortOrder = "ASC"; /// /// 创建行 /// void PublicFunctionRows() { this.dgvData.dgvCurrentColumnOriginalSet = "Ord_Number,Ordv_ViceNumber,订单号,客户姓名,客户性别,客户电话,订单类型,接单人,套系名称,套系价格,婚期,拍摄名称,拍照状态,初修状态,选片状态,选片师,选片时间,安排人员,安排时间"; string StrGuidName = LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0027.ToString().Trim(); this.dgvData.dgvFixedHideColumn = "Ord_Number,Ordv_ViceNumber"; this.dgvData.dgvGuidName = StrGuidName; this.dgvData.dgvUserEmployeeID = this.StrUserID; this.dgvData.StrValueNullColumn = "订单号,客户姓名,客户性别,客户电话,订单类型,接单人,套系名称,套系价格,婚期"; Dictionary dictColumns = LYFZ.DAL.DAL_GridViewDisplayIndex.GetGridViewShowColumns(this.StrUserID, StrGuidName, this.dgvData.dgvCurrentColumnOriginalSet); this.dgvData.dictShowColumName = dictColumns; string StrQueryCondition = this.GetWhereStr(); int intTopCount = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize(); Hashtable htData = LYFZ.ComponentLibrary.DataGridOrderView.GetData_CameraControlBookFilmSelectionNot(this.dgvData, dictColumns, StrQueryCondition, intTopCount, this.StrSortField); this.dataGridViewStatisticsCount1.CurrenQuantity = Convert.ToInt32(htData["CurrentCount"]); this.dataGridViewStatisticsCount1.TotalQuantity = Convert.ToInt32(htData["TotalCount"]); } /// /// 返回要操作的条件 /// /// string GetWhereStr() { string StrWhere = ""; StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetQueryTextQueryCondition(this.cmbQueryText.Text.Trim()); if (rdoNo.Checked) { StrWhere += " and Ordv_FilmSelectionStatus ='0'"; } if (rdoOK.Checked) { StrWhere += " and Ordv_FilmSelectionStatus ='1'"; } if (chkPaiOK.Checked) { StrWhere += " and Ords_PhotographStatus ='OK'"; } if (chkXiuOK.Checked) { StrWhere += " and Ordv_EarlyRepairStatus ='2'"; } StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetVersionQuerySQL(this.chkPortrait, this.chkWedding, this.chkKids); return StrWhere; } } }