123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- 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 CameraControlQuerySmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.CameraControlQuerySmallForm
- {
- LYFZ.BLL.BLL_ErpOrdersPhotography opbll = new BLL.BLL_ErpOrdersPhotography();
- public CameraControlQuerySmallForm()
- {
- this.Shown += CameraControlQuerySmallForm_Shown;
- this.Load += CameraControlQuerySmallForm_Load;
- this.btnQuery.Click += btnQuery_Click;
- this.btnConditionQuery.Click += btnConditionQuery_Click;
- this.rdoShotAll.Click += rdoShotAll_Click;
- this.rdoShotNo.Click += rdoShotNo_Click;
- this.rdoShotIn.Click += rdoShotIn_Click;
- this.rdoShotOK.Click += rdoShotOK_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.dgvData.CellDoubleClick += dgvData_CellDoubleClick;
- this.dgvData.ColumnHeaderMouseClick += dgvData_ColumnHeaderMouseClick;
- this.dgvData.CellMouseDown += dgvData_CellMouseDown;
- this.cmbtreevTextQuery.ComboBoxTree_NodeMouseClick += cmbtreevTextQuery_ComboBoxTree_NodeMouseClick;
- this.Resize += CameraControlQuerySmallForm_Resize;
- }
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- ///
- /// </summary>
- private Dictionary<string, string> DictData = new Dictionary<string, string>();
- /// <summary>
- /// 员工编号
- /// </summary>
- string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void CameraControlQuerySmallForm_Shown(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_PhotographClientAnPai))
- { this.btnSameDate.Enabled = false; }
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void CameraControlQuerySmallForm_Load(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetSystemVersion(this.chkPortrait, this.chkWedding, this.chkKids);
- if (this.dgvData.Columns.Count <= 0)
- {
- string strColumn = "订单号,订单类型,客户姓名,客户电话,客户性别,套系类别,客户来源,套系名称,套系价格,婚期,接单人,套系名称,套系价格,订单日期,拍摄名称,拍摄状态,摄影时间,摄影师,摄影助理,化妆师,化妆助理,引导师,备注";
- this.dgvData.DataColumns(strColumn, LYFZ.Software.MainBusiness.CommonLogical.CacheData.StrOrderReportHideField);
- }
- DataTable tbl = new LYFZ.BLL.BLL_ErpTheScenery().GetAllList().Tables[0];
- TreeNode root = null;
- for (int i = 0; i < tbl.Rows.Count; i++)
- {
- if (i == 0)
- {
- root = new TreeNode();
- root.Text = "";
- root.Tag = "";
- root.Name = "";
- this.cmbtreevTextQuery.Nodes.Add(root);
- }
- root = new TreeNode();
- root.Text = tbl.Rows[i]["Tsc_Name"].ToString().Trim();
- root.Tag = tbl.Rows[i]["Tsc_Name"].ToString().Trim();
- root.Name = tbl.Rows[i]["Tsc_Name"].ToString().Trim();
- this.cmbtreevTextQuery.Nodes.Add(root);
- }
- }
- /// <summary>
- /// 查询条件选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevTextQuery_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- { this.PublicFunctionRows(); }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- { this.PublicFunctionRows(); }
- /// <summary>
- /// 条件查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnConditionQuery_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.ConditionQuerySuperSmallForm frm = new SuperSmallForm.ConditionQuerySuperSmallForm();
- frm.ShowDialog();
- if (frm.DictDataArray.Count > 0)
- {
- this.DictData = frm.DictDataArray;
- this.PublicFunctionRows();
- }
- }
- /// <summary>
- /// 全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void rdoShotAll_Click(object sender, EventArgs e)
- {
- this.rdoShotIn.Checked = false;
- this.rdoShotNo.Checked = false;
- this.rdoShotOK.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 未拍
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void rdoShotNo_Click(object sender, EventArgs e)
- {
- this.rdoShotIn.Checked = false;
- this.rdoShotAll.Checked = false;
- this.rdoShotOK.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 拍照中
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void rdoShotIn_Click(object sender, EventArgs e)
- {
- this.rdoShotNo.Checked = false;
- this.rdoShotAll.Checked = false;
- this.rdoShotOK.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 已拍
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void rdoShotOK_Click(object sender, EventArgs e)
- {
- this.rdoShotNo.Checked = false;
- this.rdoShotAll.Checked = false;
- this.rdoShotIn.Checked = false;
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 婚纱版
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkWedding_Click(object sender, EventArgs e)
- {
- if (this.chkWedding.Checked)
- { this.chkPortrait.Checked = false; this.chkWedding.Checked = true; this.chkKids.Checked = false; }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 儿童版
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkKids_Click(object sender, EventArgs e)
- {
- if (this.chkKids.Checked)
- { this.chkPortrait.Checked = false; this.chkWedding.Checked = false; this.chkKids.Checked = true; }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 写真版
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void chkPortrait_Click(object sender, EventArgs e)
- {
- if (this.chkPortrait.Checked)
- { this.chkPortrait.Checked = true; this.chkWedding.Checked = false; this.chkKids.Checked = false; }
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 预约
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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.PhotographedReservationSmallForm frm = new PhotographedReservationSmallForm();
- frm.OrdNumber = this.dgvData.CurrentRow.Cells["Ord_Number"].Value.ToString().Trim();
- frm.ShowDialog();
- if (frm.IsSave)
- { this.IsSaveed = frm.IsSave; this.PublicFunctionRows(); }
- }
- else { MessageBoxCustom.Show("请选择你要安排的客人"); return; }
- }
- else { MessageBoxCustom.Show("请选择你要安排的客人"); return; }
- }
- }
- /// <summary>
- /// 同一日期
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSameDate_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (this.dgvData.SelectedRows.Count > 1)
- {
- List<LYFZ.Model.Model_ErpOrdersPhotography> mlist = new List<Model.Model_ErpOrdersPhotography>();
- bool isFurn = false;
- string StrWhere = " ID in (";
- for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- {
- if (this.dgvData.SelectedRows[i].Visible)
- {
- StrWhere += "'" + this.dgvData.SelectedRows[i].Cells["PID"].Value.ToString().Trim() + "',";
- isFurn = true;
- }
- }
- StrWhere = StrWhere.TrimEnd(',') + ")";
- System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
- {
- mlist = opbll.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<CommandInfo> clist = new List<CommandInfo>();
- 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].ID == Convert.ToInt32(this.dgvData.SelectedRows[i].Cells["PID"].Value))
- {
- //LYFZ.Model.Model_ErpOrdersPhotography model = opbll.GetModel(Convert.ToInt32(this.dgvData.SelectedRows[i].Cells["PID"].Value));
- LYFZ.Model.Model_ErpOrdersPhotography model = mlist[j];
- if (frm.UnityArrangeWorkModel.IsDateTime)
- {
- this.dgvData.SelectedRows[i].Cells["摄影时间"].Value = frm.UnityArrangeWorkModel.StrDateTime;
- model.Ordpg_ReservationPhotographyTime = Convert.ToDateTime(frm.UnityArrangeWorkModel.StrDateTime);
- }
- if (frm.UnityArrangeWorkModel.IsPhotographerName)
- {
- this.dgvData.SelectedRows[i].Cells["摄影师"].Value = frm.UnityArrangeWorkModel.PhotographerName;
- model.Ordpg_ReservationPhotographyName = frm.UnityArrangeWorkModel.PhotographerTag;
- }
- if (frm.UnityArrangeWorkModel.IsPhotographyAssistantName)
- {
- this.dgvData.SelectedRows[i].Cells["摄影助理"].Value = frm.UnityArrangeWorkModel.PhotographyAssistantName;
- model.Ordpg_ReservationPhotographyAssistant = frm.UnityArrangeWorkModel.PhotographyAssistantTag;
- }
- if (frm.UnityArrangeWorkModel.IsMakeupArtistName)
- {
- this.dgvData.SelectedRows[i].Cells["化妆师"].Value = frm.UnityArrangeWorkModel.MakeupArtistName;
- model.Ordpg_ReservationMakeupArtist = frm.UnityArrangeWorkModel.MakeupArtistTag;
- }
- if (frm.UnityArrangeWorkModel.IsMakeupAssistantName)
- {
- this.dgvData.SelectedRows[i].Cells["化妆助理"].Value = frm.UnityArrangeWorkModel.MakeupAssistantName;
- model.Ordpg_ReservationMakeupAssistant = frm.UnityArrangeWorkModel.MakeupAssistantTag;
- }
- if (frm.UnityArrangeWorkModel.IsBootDivisionName)
- {
- this.dgvData.SelectedRows[i].Cells["引导师"].Value = frm.UnityArrangeWorkModel.BootDivisionName;
- model.Ordpg_ReservationBootDivision = frm.UnityArrangeWorkModel.BootDivisionTag;
- }
- if (frm.UnityArrangeWorkModel.IsBootDivisionAssistantName)
- {
- this.dgvData.SelectedRows[i].Cells["引导助理"].Value = frm.UnityArrangeWorkModel.BootDivisionAssistantName;
- model.Ordpg_ReservationBootDivisionAssistant = frm.UnityArrangeWorkModel.BootDivisionAssistantTag;
- }
- model.Ordpg_DispatchTime = StrTime;
- model.Ordpg_Dispatcher = strName;
- model.Ordpg_UpdateDateTime = StrTime;
- model.Ordpg_UpdateName = strName;
- clist.Add(opbll.GetUpdateCommandInfo(model));
- mlist.RemoveAt(j);
- break;
- }
- }
- }
- }
- if (clist.Count > 0)
- {
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- { MessageBoxCustom.Show("保存成功"); IsSaveed = true; }
- else
- { MessageBoxCustom.Show("保存失败"); }
- }
- }
- }
- else
- { MessageBoxCustom.Show("请选择多条数据进行安排"); return; }
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnClose_Click(object sender, EventArgs e)
- { this.Close(); }
- /// <summary>
- /// 窗体大小发生变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void CameraControlQuerySmallForm_Resize(object sender, EventArgs e)
- {
- switch (this.panelPortrait.Location.Y)
- {
- case 3: this.flowLayoutPanel2.Height = 36; break;
- case 37: this.flowLayoutPanel2.Height = 70; break;
- }
- }
- /// <summary>
- /// 数据列表双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
- { this.btnReservation_Click(this, null); }
- }
- }
- /// <summary>
- /// 右键菜单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);//弹出操作菜单
- }
- }
- }
- }
- /// <summary>
- /// 右键菜单选择项事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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(); }
- }
- }
- /// <summary>
- /// 点击列标头排序
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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();
- }
- }
- /// <summary>
- /// 当前点击的字段
- /// </summary>
- string StrCurrentClickField = "";
- /// <summary>
- /// 排序字段
- /// </summary>
- string StrSortField = "Ord_CreateDateTime ASC,Ordv_DigitalNumber";
- /// <summary>
- /// 排序顺序
- /// </summary>
- string StrSortOrder = "ASC";
- /// <summary>
- /// 创建行
- /// </summary>
- void PublicFunctionRows()
- {
- this.dgvData.dgvCurrentColumnOriginalSet = "PID,Ord_Number,Ordv_ViceNumber,订单号,客户姓名,客户性别,客户电话,订单类型,接单人,套系名称,套系价格,婚期,订单日期,拍摄名称,拍摄状态,摄影时间,摄影师,摄影助理,化妆师,化妆助理,引导师,引导助理,备注";
- string StrGuidName = LYFZ.EnumPublic.dgvGuidName.E_FormAll_A0026.ToString().Trim();
- this.dgvData.dgvFixedHideColumn = "PID,Ord_Number,Ordv_ViceNumber";
- this.dgvData.dgvGuidName = StrGuidName;
- this.dgvData.dgvUserEmployeeID = this.StrUserID;
- this.dgvData.StrValueNullColumn = "订单号,客户姓名,客户性别,客户电话,订单类型,接单人,套系名称,套系价格,婚期,订单日期";
- Dictionary<string, string> 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_CameraControlBookPhotographedNot(this.dgvData, dictColumns, StrQueryCondition, intTopCount, this.StrSortField);
- this.dataGridViewStatisticsCount1.CurrenQuantity = Convert.ToInt32(htData["CurrentCount"]);
- this.dataGridViewStatisticsCount1.TotalQuantity = Convert.ToInt32(htData["TotalCount"]);
- }
- /// <summary>
- /// 返回要操作的条件
- /// </summary>
- /// <returns></returns>
- string GetWhereStr()
- {
- string StrWhere = "";
- if (this.rdoShotNo.Checked)
- { StrWhere += " and Ordpg_PhotographyStatus = '0'"; }
- else if (this.rdoShotOK.Checked)
- { StrWhere += " and Ordpg_PhotographyStatus = '1'"; }
- else if (this.rdoShotIn.Checked)
- { StrWhere += " and Ordpg_PhotographyStatus = '2'"; }
- if (this.DictData.Count > 0)
- {
- if (this.DictData.ContainsKey("Sights") && this.DictData["Sights"].Length > 0)//景点
- { this.cmbtreevTextQuery.Text = DictData["Sights"].Trim(); }
- if (this.DictData.ContainsKey("OrderStartTime") && this.DictData["OrderStartTime"].Length > 0)//订单时间
- { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Ord_CreateDateTime", DictData["OrderStartTime"].Trim(), DictData["OrderEndTime"].Trim()); }
- if (this.DictData.ContainsKey("MarriageStartTime") && this.DictData["MarriageStartTime"].Length > 0)//婚期
- { StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("GregorianCalendar_DayForMarriage", DictData["MarriageStartTime"].Trim(), DictData["MarriageEndTime"].Trim()); }
- }
- if (this.cmbtreevTextQuery.Text.Trim() != "")
- { StrWhere += " and Ordpg_Sights = '" + this.cmbtreevTextQuery.Text.Trim() + "'"; }
- StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetVersionQuerySQL(this.chkPortrait, this.chkWedding, this.chkKids);
- this.DictData.Clear();
- return StrWhere;
- }
- }
- }
|