1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372 |
- using LYFZ.Software.MainBusiness.DoorCityProcess;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Data.SqlClient;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm
- {
- public partial class TakePiecesReservationSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.TakePiecesReservationSmallForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpOrderProductList opbll = new BLL.BLL_ErpOrderProductList();
- LYFZ.BLL.BLL_ErpOrderWorkAnPaiRecord ordwr = new BLL.BLL_ErpOrderWorkAnPaiRecord();
- LYFZ.BLL.BLL_ErpSystemConfigure scbll = new LYFZ.BLL.BLL_ErpSystemConfigure();
- public TakePiecesReservationSmallForm()
- {
- this.Shown += TakePiecesReservationSmallForm_Shown;
- this.btnSave.Click += btnSave_Click;
- this.lstTextQuery.MouseDoubleClick += lstTextQuery_MouseDoubleClick;
- this.lstTextQuery.KeyDown += lstTextQuery_KeyDown;
- this.txtTextQuery.EventTextBoxEx_TextChanged += txtTextQuery_EventTextBoxEx_TextChanged;
- this.txtTextQuery.Enter += txtTextQuery_Enter;
- this.txtTextQuery.KeyDown += txtTextQuery_KeyDown;
- this.txtTextQuery.Leave += txtTextQuery_Leave;
- this.cmbtreevStoreName.Leave += cmbtreevStoreName_Leave;
- this.cmbtreevStoreName.IsNodeMouseClick = true;
- this.cmbtreevStoreName.AfterSelectLevelFirstNode = true;
- this.dgvData.CellDoubleClick += dgvData_CellDoubleClick;
- this.mskdgv.Leave += mskdgv_Leave;
- this.cmbtreevdgv.Leave += cmbtreevdgv_Leave;
- this.dtpcdgv.Leave += dtpcdgv_Leave;
- this.txtdgv.Leave += txtdgv_Leave;
- this.btnQuery.Click += btnQuery_Click;
- this.dgvData.DataGridViewConMenu_ItemClicked += dgvData_DataGridViewConMenu_ItemClicked;
- this.dgvData.CellMouseDown += dgvData_CellMouseDown;
- this.cmbtreevPhotographName.ComboBoxTree_NodeMouseClick += cmbtreevPhotographName_ComboBoxTree_NodeMouseClick;
- this.btn_PickUpSetting.Click += btn_PickUpSetting_Click;
- //this.tb_MaxPickUpCount.EventTextBoxEx_TextChanged += tb_MaxPickUpCount_EventTextBoxEx_TextChanged;
- BindSystemConfigData();
- if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- this.labelEx2.Hide();
- this.tb_MaxPickUpCount.Hide();
- this.btn_PickUpSetting.Hide();
- }
- else
- {
- this.labelEx2.Show();
- this.tb_MaxPickUpCount.Show();
- this.btn_PickUpSetting.Show();
- }
- }
- Model.CameraTimeTemplate currentSelectCameraTime = null;
- /// <summary>
- /// 当前选择的档期
- /// </summary>
- public Model.CameraTimeTemplate CurrentSelectCameraTime { get => currentSelectCameraTime; set => currentSelectCameraTime = value; }
- //设置
- void btn_PickUpSetting_Click( object sender, EventArgs e )
- {
- LYFZ.Model.Model_ErpSystemConfigure model = scbll.GetModel( "Sconfig_Code", "DayRemindByPickUp" );
- if ( MessageBoxCustom.Show( "是否设置客人每日最大取件量提醒?", "提示", MessageBoxButtons.YesNo ) == System.Windows.Forms.DialogResult.Yes )
- {
- if ( model == null || model.ID == 0 )
- {
- model = new Model.Model_ErpSystemConfigure();
- }
- model.Sconfig_Code = "DayRemindByPickUp";
- model.Sconfig_Name = "每日最大取件量";
- model.Sconfig_Value = tb_MaxPickUpCount.Text;
- model.Sconfig_IsEnabled = true;
- model.Sconfig_Remark = "当日预约取件客人超过多少时提醒";
- model.Sconfig_Type = "";
- model.Sconfig_Order = 1;
- model.Sconfig_CreateDatetime = SDateTime.Now;
- model.Sconfig_CreateName = "";
- if ( model.ID == 0 )
- {
- scbll.Add( model );
- }
- else
- {
- scbll.Update( model );
- }
- MessageBoxCustom.Show( "每日最大取件量设置成功!" );
- }
- }
- /// <summary>
- /// 主订单号
- /// </summary>
- public string OrdNumber;
- /// <summary>
- /// 副订单号
- /// </summary>
- public string OrdViceNumber;
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSave = false;
- /// <summary>
- /// 首次运行 true是,false不是
- /// </summary>
- bool IsFirstRun = true;
- /// <summary>
- /// 重新安排
- /// </summary>
- bool IsUpdateAnPai = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_TakePiecesClientAnPaiUpdate );
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void TakePiecesReservationSmallForm_Shown( object sender, EventArgs e )
- {
- if (this.currentSelectCameraTime != null)
- {
- this.lbSelectDateInfo.Text = this.currentSelectCameraTime.GetCameraTimeInfo(LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(this.currentSelectCameraTime.DayTemplate.ShopID), String.Format("{0} {1}", this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd(), this.currentSelectCameraTime.CameraTime));
- }
- else
- {
- this.lbSelectDateInfo.Text = "";
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindStoreNameALL( this.cmbtreevStoreName, IsShowAllText: false );
- if ( !LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_TakePiecesClientAnPai ) )
- {
- this.btnSave.Enabled = false;
- }
- #region 预约查询
- if ( !string.IsNullOrEmpty( this.OrdNumber ) )
- {
- this.panelEx3.Visible = false;
- this.panelEx2.Height = this.panelEx1.Size.Height - 4;
- this.GetOrdNumberGetData();
- }
- this.panelEx2.Visible = true;
- #endregion
- this.DataRemind();
- this.IsFirstRun = false;
- }
- void BindSystemConfigData()
- {
- if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- this.tb_MaxPickUpCount.Text = "999999999";
- }
- else
- {
- LYFZ.Model.Model_ErpSystemConfigure model = scbll.GetModel( "Sconfig_Code", "DayRemindByPickUp" );
- if ( model.ID > 0 && !string.IsNullOrEmpty( model.Sconfig_Value ) )
- {
- this.tb_MaxPickUpCount.Text = model.Sconfig_Value;
- }
- }
-
- }
- bool CheckSystemConfigDataControl()
- {
- bool b = true;
- if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- return true;
- }
- else
- {
- LYFZ.Model.Model_ErpSystemConfigure model = scbll.GetModel( "Sconfig_Code", "DayRemindByPickUp" );
- if ( model.ID > 0 && !string.IsNullOrEmpty( model.Sconfig_Value ) )
- {
- List<string> dateTimeList = new List<string>();
- var dgvRowList = this.dgvData.Rows;
- foreach ( DataGridViewRow dr in dgvRowList )
- {
- string datatime = dr.Cells["取件日期"].Value.ToString().Trim();
- if ( string.IsNullOrEmpty( datatime ) )
- {
- continue;
- }
- if ( !dateTimeList.Contains( datatime ) )
- {
- dateTimeList.Add( datatime );
- }
- }
- DataTable pickUpData = opbll.GetProductPickUpData( dateTimeList, OrdNumber );
- string infoData = "";
- foreach ( string dr in dateTimeList )
- {
- DataRow[] drList = pickUpData.Select( " dataTime = '" + dr + "' " );
- if ( drList.Length >= Convert.ToInt32( model.Sconfig_Value ) && Convert.ToInt32( model.Sconfig_Value ) > 0 )
- {
- infoData += "" + dr + "已预约取件" + drList.Length + "个订单 ,已经达到单日最高取件数" + model.Sconfig_Value + " \r\n";
- b = false;
- }
- }
- if ( !string.IsNullOrEmpty( infoData ) )
- {
- MessageBoxCustom.Show( infoData );
- }
- }
- }
- return b;
- }
- LYFZ.BLL.ReservationTimeData timeDataBll = new BLL.ReservationTimeData();
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSave_Click( object sender, EventArgs e )
- {
- if ( !CheckSystemConfigDataControl() )
- {
- return;
- }
- if ( this.dgvData.Rows.Count > 0 )
- {
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- DateTime strTime = SDateTime.Now;
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- List<Model.ReservtionParameter> cameraParameterList = new List<Model.ReservtionParameter>();
- for ( int i = 0; i < this.dgvData.Rows.Count; i++ )
- {
- if ( this.dgvData.Rows[i].Tag != null )
- {
- LYFZ.Model.Model_ErpOrderProductList model = opbll.GetModel( Convert.ToInt32( this.dgvData.Rows[i].Cells["ID"].Value ) );
- if ( string.IsNullOrEmpty( model.OPlist_ViceNumber ) )
- {
- model.OPlist_ViceNumber = this.OrdViceNumber;
- }
- DateTime updataTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
- if (!String.IsNullOrEmpty(Convert.ToString(this.dgvData.Rows[i].Cells["取件日期"].Tag)) && !String.IsNullOrEmpty(Convert.ToString(this.dgvData.Rows[i].Cells["取件时间"].Tag)))
- {
- updataTime = Convert.ToDateTime(this.dgvData.Rows[i].Cells["取件日期"].Tag + " " + this.dgvData.Rows[i].Cells["取件时间"].Tag);
- }
- else if (!String.IsNullOrEmpty(Convert.ToString(this.dgvData.Rows[i].Cells["取件日期"].Tag)) && String.IsNullOrEmpty(Convert.ToString(this.dgvData.Rows[i].Cells["取件时间"].Tag)))
- {
- updataTime = Convert.ToDateTime(this.dgvData.Rows[i].Cells["取件日期"].Tag);
- }
- if ( this.dgvData.Rows[i].Cells["取件日期"].Value.ToString().Trim() != "" && this.dgvData.Rows[i].Cells["取件时间"].Value.ToString().Trim() != "" )
- {
- model.OPlist_ReservationTakeTime = Convert.ToDateTime( this.dgvData.Rows[i].Cells["取件日期"].Value + " " + this.dgvData.Rows[i].Cells["取件时间"].Value );
- }
- else if ( this.dgvData.Rows[i].Cells["取件日期"].Value.ToString().Trim() != "" )
- {
- model.OPlist_ReservationTakeTime = Convert.ToDateTime( this.dgvData.Rows[i].Cells["取件日期"].Value );
- }
- else { model.OPlist_ReservationTakeTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime(); }
- if ( this.dgvData.Rows[i].Cells["取件人"].Tag != null )
- {
- model.OPlist_ReservationTakeName = this.dgvData.Rows[i].Cells["取件人"].Tag.ToString().Trim();
- }
- else
- {
- model.OPlist_ReservationTakeName = "";
- }
- //// if (string.IsNullOrEmpty(model.OPlist_ReservationTakeDividedShop))
- //{ model.OPlist_ReservationTakeDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); }
- if ( this.dgvData.Rows[i].Cells["取件门店"].Tag != null )
- {
- model.OPlist_ReservationTakeDividedShop = this.dgvData.Rows[i].Cells["取件门店"].Tag.ToString();
- }
- else
- {
- model.OPlist_ReservationTakeDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- }
- model.OPlist_ExpeditedTime = model.OPlist_ReservationTakeTime;
- model.OPlist_ArrangeTime = strTime;
- model.OPlist_ArrangeNmae = strUserID;
- model.OPlist_ArrangeRemark = this.dgvData.Rows[i].Cells["预约说明"].Value.ToString().Trim();
- model.OPlist_UpdateDateTime = strTime;
- model.OPlist_UpdateName = strUserID;
- clist.Add( opbll.GetUpdateCommandInfo( model ) );
- #region 设置模板预约
- cameraParameterList.Add(new Model.ReservtionParameter
- {
- ShopID = model.OPlist_ReservationTakeDividedShop
- ,
- DayDate = this.dgvData.Rows[i].Cells["取件日期"].Value.ToString().Trim()
- ,
- Time = this.dgvData.Rows[i].Cells["取件时间"].Value.ToString().Trim()
- ,
- VID = model.ID.ToString()
- });
- #endregion
- LYFZ.Model.Model_ErpOrderProductList modelnew = opbll.GetModel( Convert.ToInt32( this.dgvData.Rows[i].Cells["ID"].Value ) );
- if ( !modelnew.OPlist_ReservationTakeName.Equals( model.OPlist_ReservationTakeName ) ||
- !modelnew.OPlist_ReservationTakeTime.Equals( model.OPlist_ReservationTakeTime ) ||
- !modelnew.OPlist_ReservationTakeDividedShop.Equals( model.OPlist_ReservationTakeDividedShop ) )
- {
- string storaRecord = "";
- if ( this.dgvData.Rows[i].Cells["取件门店"].Value.ToString().Trim() != "" )
- {
- storaRecord = "门店:" + this.dgvData.Rows[i].Cells["取件门店"].Value.ToString().Trim() + " ";
- }
- LYFZ.Model.Model_ErpOrderWorkAnPaiRecord modelRecord = new Model.Model_ErpOrderWorkAnPaiRecord();
- modelRecord.Ordwr_Number = "OWPR_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
- modelRecord.Ordwr_WorkNumber = model.ID.ToString().Trim();
- modelRecord.Ordwr_OrdNumber = model.OPlist_OrderNumber;
- modelRecord.Ordwr_ViceNumber = model.OPlist_ViceNumber;
- modelRecord.Ordwr_ModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排取件客人.ToString();
- modelRecord.Ordwr_UpdateOrderName = model.OPlist_PickupName;
- modelRecord.Ordwr_UpdateAgoPerson = model.OPlist_ArrangeNmae;
- modelRecord.Ordwr_UpdateAgoTime = model.OPlist_ArrangeTime;
- modelRecord.Ordwr_UpdateAgoData = storaRecord + "取件时间:" +
- ((updataTime != model.OPlist_ReservationTakeTime && LYFZ.BLL.OtherCommonModel.DateTimeToString(updataTime) != "") ? "原日期" + updataTime + " 修改为日期" +
- LYFZ.BLL.OtherCommonModel.DateTimeToString(model.OPlist_ReservationTakeTime) : LYFZ.BLL.OtherCommonModel.DateTimeToString(model.OPlist_ReservationTakeTime))
- + " 取件师:" + LYFZ.BLL.BLL_ErpOrderView.GetUserName( model.OPlist_ReservationTakeName );
- modelRecord.Ordwr_CreateDatetime = strTime;
- modelRecord.Ordwr_CreateName = strUserID;
- clist.Add( ordwr.GetAddCommandInfo( modelRecord ) );
- }
- }
- }
- if ( clist.Count > 0 )
- {
- string retErrorMsg = "";
- if (!this.timeDataBll.UpdateReservationTimeDataCommandInfoList(OrdNumber, this.txtOrderNumber.Text, Model.CameraType.取件客人, this.GetCameraOrderType(), cameraParameterList, ref clist, ref retErrorMsg))
- {
- MessageBoxCustom.Show(String.Format("保存预约失败:{0}", retErrorMsg));
- return;
- }
- if ( MessageBoxCustom.Show( "您确定要保存此操作吗?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.Yes )
- {
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran( clist ) > 0 )
- {
- this.IsSave = true;
- MessageBoxCustom.Show( "保存成功" );
- }
- else
- {
- MessageBoxCustom.Show( "保存失败" );
- }
- }
- }
- else
- {
- MessageBoxCustom.Show( "没有做任何修改!无须保存" ); return;
- }
- }
- }
- /// <summary>
- /// 列表事件双击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void lstTextQuery_MouseDoubleClick( object sender, MouseEventArgs e )
- {
- if ( lstTextQuery.Items.Count > 0 )
- {
- if ( ((ListItem)this.lstTextQuery.SelectedItem) != null )
- {
- this.OrdNumber = ((ListItem)this.lstTextQuery.SelectedItem).StrValue.ToString().Trim();
- this.GetOrdNumberGetData();
- this.DataRemind();
- this.txtTextQuery.Text = ((ListItem)this.lstTextQuery.SelectedItem).StrText;
- }
- }
- this.lstTextQuery.Visible = false;
- }
- /// <summary>
- /// 按回车键
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void lstTextQuery_KeyDown( object sender, KeyEventArgs e )
- {
- if ( e.KeyCode == Keys.Enter )
- {
- this.lstTextQuery_MouseDoubleClick( this, null );
- }
- }
- /// <summary>
- /// 输入值变化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtTextQuery_EventTextBoxEx_TextChanged( object sender, EventArgs e )
- {
- if ( !this.IsFirstRun )
- {
- if ( this.txtTextQuery.Text.Trim() == "" )
- {
- this.lstTextQuery.Visible = true;
- }
- }
- }
- /// <summary>
- /// 点击输入框
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtTextQuery_Enter( object sender, EventArgs e )
- {
- this.txtTextQuery_EventTextBoxEx_TextChanged( null, null );
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click( object sender, EventArgs e )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery, cameraType: Model.CameraType.取件客人);
- }
- /// <summary>
- /// 按键盘上的下健时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtTextQuery_KeyDown( object sender, KeyEventArgs e )
- {
- if ( e.KeyCode == Keys.Down || e.KeyCode == Keys.Up )
- {
- if (this.lstTextQuery.Items.Count > 0)
- {
- this.lstTextQuery.SelectedIndex = 0; this.lstTextQuery.Focus();
- }
- }
- else if ( e.KeyCode == Keys.Enter )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery, cameraType: Model.CameraType.取件客人);
- }
- }
- /// <summary>
- /// 查询文本框离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtTextQuery_Leave( object sender, EventArgs e )
- {
- if ( !this.lstTextQuery.Focused )
- {
- this.lstTextQuery.Visible = false;
- }
- }
- /// <summary>
- /// 拍照名称
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevPhotographName_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e )
- {
- this.OrdViceNumber = this.cmbtreevPhotographName.Tag.ToString().Trim();
- this.DataRemind();
- }
- string StrOrderType = "";
- /// <summary>
- /// 查询获取订单信息
- /// </summary>
- void GetOrdNumberGetData()
- {
- string StrTableName = "select Ord_DividedShop," +
- "Ordv_ViceNumber," +
- "Ordv_ReservationFilmSelectionName," +
- "Ordv_ReservationFilmSelectionTime," +
- "Cus_Name," +
- "Cus_Sex_cs," +
- "Ord_SinceOrderNumber," +
- "Ord_SeriesName," +
- "Ord_SeriesPrice," +
- "Ordv_IntoRegisterQuantity," +
- "Ordv_IntoBottomQuantity," +
- "Ord_Type," +
- "Ord_OrderPersonName," +
- "Ordpg_Sights ,Ordpg_Sights as Ords_SightsName " +
- "from tb_ErpOrder " +
- "Left Join tb_ErpOrderDigital ON Ord_Number = Ordv_Number " +
- "Left Join tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber " +
- "Left Join [tb_ErpOrdersPhotography] on Ordpg_ViceNumber = Ordv_ViceNumber " +
- "Where Ordv_Number = '" + this.OrdNumber + "' Order By Ordv_DigitalNumber";
- DataTable tbl = orbll.GetView_Custom( StrTableName ).Tables[0];
- if ( tbl.Rows.Count > 0 )
- {
- if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
- {
- if (this.currentSelectCameraTime != null)
- {
- if (tbl.Rows[0]["Ord_Type"].ToString().Trim() != this.currentSelectCameraTime.DayTemplate.OrderType.ToString())
- {
- MessageBoxCustom.Show(this.currentSelectCameraTime.GetPromptInfo());
- this.OrdNumber = "";
- this.OrdViceNumber = "";
- return;
- }
- }
- }
- this.txtOrderNumber.Text = tbl.Rows[0]["Ord_SinceOrderNumber"].ToString().Trim();
- this.txtSeriesName.Text = tbl.Rows[0]["Ord_SeriesName"].ToString().Trim();
- this.txtOrdersPerson.Text = tbl.Rows[0]["Ord_OrderPersonName"].ToString().Trim();
- this.SetClientData( tbl.Rows[0]["Cus_Name"].ToString().Trim(), tbl.Rows[0]["Cus_Sex_cs"].ToString().Trim(), tbl.Rows[0]["Ord_Type"].ToString().Trim() );
- //LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.SetClientData(this.txtName1, this.txtName2, lblName1, lblName2, tbl.Rows[0]["Ord_Type"].ToString().Trim(), tbl.Rows[0]["Cus_Name"].ToString().Trim(), tbl.Rows[0]["Cus_Sex_cs"].ToString().Trim(), -23);
- this.StrOrderType = tbl.Rows[0]["Ord_Type"].ToString().Trim();
- if (this.StrOrderType == "1")
- {
- this.labelEx10.Show();
- this.cmbtreevPhotographName.Show();
- }
- else {
- this.labelEx10.Hide();
- this.cmbtreevPhotographName.Hide();
- }
- this.cmbtreevPhotographName.Nodes.Clear();
- TreeNode root = null;
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- root = new TreeNode();
- root.Name = tbl.Rows[i]["Ordv_ViceNumber"].ToString().Trim();
- root.Text = tbl.Rows[i]["Ords_SightsName"].ToString().Trim();
- root.Tag = tbl.Rows[i]["Ordv_ViceNumber"].ToString().Trim();
- this.cmbtreevPhotographName.Nodes.Add( root );
- }
- this.cmbtreevPhotographName.TagFindText( tbl.Rows[0]["Ordv_ViceNumber"].ToString().Trim() );
- this.OrdViceNumber = tbl.Rows[0]["Ordv_ViceNumber"].ToString().Trim();
- this.tx_serial_price.Text = tbl.Rows[0]["Ord_SeriesPrice"].ToString().Trim();
- this.tx_rdrc.Text = string.Format( "{0}\\{1}", tbl.Rows[0]["Ordv_IntoBottomQuantity"].ToString().Trim(), tbl.Rows[0]["Ordv_IntoRegisterQuantity"].ToString().Trim() );
-
- if ( tbl.Rows[0]["Ord_DividedShop"].ToString().Trim() != LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID() )
- {
- if ( MessageBoxCustom.Show( "'" + tbl.Rows[0]["Ord_SinceOrderNumber"].ToString().Trim() + "'订单不属于本店所开,是否要继续安排?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.No )
- {
- return;
- }
- }
- }
- }
- /// <summary>
- /// 设计加载的项
- /// </summary>
- /// <param name="StrName"></param>
- /// <param name="StrSex"></param>
- /// <param name="StrOrderType"></param>
- void SetClientData( string StrName, string StrSex, string StrOrderType )
- {
- string[] StrNameArray = StrName.Trim().Split( '/' );
- string[] StrSexArray = StrSex.Trim().Split( '/' );
- if ( StrOrderType.Trim() == "0" )
- {
- if ( StrNameArray.Length > 1 )
- {
- if ( StrSexArray[0].Trim() == "男" )
- {
- lblName1.Text = "男宾姓名:";
- }
- else if ( StrSexArray[0].Trim() == "女" )
- {
- lblName1.Text = "女宾姓名:";
- }
- txtName1.Text = StrNameArray[0].Trim();
- if ( StrSexArray[1].Trim() == "男" )
- {
- lblName2.Text = "男宾姓名:";
- }
- else if ( StrSexArray[1].Trim() == "女" )
- {
- lblName2.Text = "女宾姓名:";
- }
- txtName2.Text = StrNameArray[1].Trim();
- }
- else
- {
- lblName1.Text = "男宾姓名:";
- lblName2.Text = "女宾姓名:";
- if ( StrSexArray[0].Trim() == "男" )
- {
- txtName1.Text = StrNameArray[0].Trim();
- }
- else if ( StrSexArray[0].Trim() == "女" )
- {
- txtName2.Text = StrNameArray[0].Trim();
- }
- }
- }
- else if ( StrOrderType.Trim() == "1" )
- {
- lblName1.Text = "宝贝姓名:";
- lblName2.Text = "家长姓名:";
- txtName1.Text = StrNameArray[0].Trim();
- if (StrNameArray.Length > 1)
- {
- txtName2.Text = StrNameArray[1].Trim();
- }
- else
- {
- txtName2.Text = StrNameArray[0].Trim();
- }
-
- }
- else if ( StrOrderType.Trim() == "2" )
- {
- lblName1.Text = "客户姓名:";
- lblName2.Text = "客户性别:";
- txtName1.Text = StrNameArray[0].Trim();
- txtName2.Text = StrSexArray[0].Trim();
- }
- else if ( StrOrderType.Trim() == "3" )
- {
- lblName1.Text = "客户姓名:";
- lblName2.Text = "客户性别:";
- txtName1.Text = StrNameArray[0].Trim();
- txtName2.Text = StrSexArray[0].Trim();
- }
- //lblName1.Location = new Point(596, lblName1.Location.Y);
- //lblName2.Location = new Point(764, lblName1.Location.Y);
- }
- /// <summary>
- /// 加载当日已预约的客人
- /// </summary>
- /// <param name="StrType"></param>
- void DataRemind()
- {
- string strWhere = "";
- int strTop = -1;
- if ( !string.IsNullOrEmpty( this.OrdViceNumber ) )
- {
- if ( this.StrOrderType == "1" )
- {
- strWhere = " And ((OPlist_OrderNumber ='" + this.OrdNumber + "' and OPlist_ViceNumber = '') or OPlist_ViceNumber = '" + this.OrdViceNumber + "' )";
- }
- else
- {
- strWhere = " And OPlist_OrderNumber ='" + this.OrdNumber + "'";
- }
- }
- else
- {
- strTop = 0;
- }
- string strColumnName = "tb_ErpOrderProductList.ID, OPlist_ViceNumber, OPlist_ProdNumber AS 商品编号, OPlist_ProdName AS 商品名称, dbo.fn_CheckTakePiecesStatus(OPlist_PickupStatus) AS 取件状态, dbo.fn_CheckIsExpedited(OPlist_IsExpedited) AS 加急,Company_Name AS 取件门店,Company_DividedShop AS 门店编号, dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(OPlist_ReservationTakeTime)) AS 取件日期, dbo.fn_CheckDateTimeReturn_Time(dbo.fn_CheckDateTime(OPlist_ReservationTakeTime)) AS 取件时间, OPlist_ReservationTakeName AS 取件人,User_Name AS 取件师, OPlist_ArrangeRemark AS 预约说明";
- DataTable tbl = orbll.GetView_Custom( "tb_ErpOrderProductList Left Join tb_ErpUser on User_EmployeeID = OPlist_ReservationTakeName Left Join tb_ErpCompanyInfo on Company_DividedShop = OPlist_ReservationTakeDividedShop", StrWhere: " OPlist_Type = '2'" + strWhere, filedOrder: "OPlist_ViceNumber ASC", ShowColumnName: strColumnName, TopCount: strTop ).Tables[0];
- if ( this.dgvData.Columns.Count <= 0 )
- {
- for ( int i = 0; i < tbl.Columns.Count; i++ )
- {
- if ( tbl.Columns[i].ColumnName.Trim() != "取件师" && tbl.Columns[i].ColumnName.Trim() != "门店编号" )
- {
- DataGridViewColumn dca = new DataGridViewColumn();
- dca.HeaderText = tbl.Columns[i].ColumnName.Trim();
- dca.Name = tbl.Columns[i].ColumnName.Trim();
- if ( dca.Name.Trim() == "ID" || dca.Name.Trim() == "OPlist_ViceNumber" )
- {
- dca.Visible = false;
- }
- dca.ReadOnly = true;
- this.dgvData.Columns.Add( dca );
- }
- }
- }
- this.dgvData.Rows.Clear();
- if ( !string.IsNullOrEmpty( this.OrdViceNumber ) )
- {
- DataGridViewCell cellShopID = null;
- DataGridViewCell cellDate = null;
- DataGridViewCell cellTime = null;
- for ( int i = 0; i < tbl.Rows.Count; i++ )
- {
- DataGridViewRow dgvl = new DataGridViewRow();
- DataGridViewCell cell = null;
- for ( int j = 0; j < this.dgvData.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- switch ( this.dgvData.Columns[j].Name.Trim() )
- {
- case "取件人":
- cell.Value = tbl.Rows[i]["取件师"].ToString().Trim();
- cell.Tag = tbl.Rows[i]["取件人"].ToString().Trim();
- break;
- case "取件门店":
- cellShopID = cell;
- cell.Value = tbl.Rows[i][this.dgvData.Columns[j].Name].ToString().Trim();
- cell.Tag = tbl.Rows[i]["门店编号"].ToString().Trim();
- if (cell.Value == null)
- {
- cell.Value = "";
- }
- if (cell.Value.ToString() == "")
- {
- cell.Value = LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID());
- cell.Tag = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- }
- break;
- case "取件日期":
- case "取件时间":
- cell.Value = tbl.Rows[i][this.dgvData.Columns[j].Name].ToString().Trim();
- cell.Tag = tbl.Rows[i][this.dgvData.Columns[j].Name].ToString().Trim();
- if (this.dgvData.Columns[j].Name.Trim() == "取件日期")
- {
- cellDate = cell;
- }
- else if (this.dgvData.Columns[j].Name.Trim() == "取件时间")
- {
- cellTime = cell;
- }
- break;
- default: cell.Value = tbl.Rows[i][this.dgvData.Columns[j].Name.Trim()].ToString().Trim(); break;
- }
- dgvl.Cells.Add( cell );
- }
- if (this.currentSelectCameraTime != null && cellShopID != null && cellDate != null && cellTime != null)
- {
- string photographedDate = "";
- if (cellDate.Tag != null)
- {
- photographedDate = cellDate.Tag.ToString();
- }
- string pTime = "";
- if (cellTime.Tag != null)
- {
- pTime = cellTime.Tag.ToString();
- }
- if (String.IsNullOrWhiteSpace(photographedDate) || String.IsNullOrWhiteSpace(pTime))
- {
- cellShopID.Value = LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(this.currentSelectCameraTime.DayTemplate.ShopID);
- cellShopID.Tag = this.currentSelectCameraTime.DayTemplate.ShopID;
- cellDate.Value = this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd();
- cellDate.Tag = this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd();
- cellTime.Value = this.currentSelectCameraTime.CameraTime;
- cellTime.Tag = this.currentSelectCameraTime.CameraTime;
- dgvl.Tag = "1";
- }
- }
- this.dgvData.Rows.Add( dgvl );
- }
- DataTable dt = orbll.GetView_Custom( "tb_ErpOrderDigital Left Join CView_OrderPickupStatusVice on OPlist_ViceNumber = Ordv_ViceNumber", StrWhere: "Ordv_ViceNumber = '" + this.OrdViceNumber + "'", ShowColumnName: "取件状态" ).Tables[0];
- if ( dt.Rows[0]["取件状态"].ToString().Trim() == "OK" )
- {
- string StrMaengd = "订单取件已完成";
- StrMaengd = "'" + this.cmbtreevPhotographName.Text.Trim() + "'取件已完成!";
- MessageBoxCustom.Show( StrMaengd );
- this.btnSave.Enabled = false;
- }
- else
- {
- this.btnSave.Enabled = true;
- }
- }
- }
- /// <summary>
- /// 暂存预约选择的档期数据
- /// </summary>
- Dictionary<int, Model.CameraTimeTemplate> TimeTemplateKeyValues = new Dictionary<int, Model.CameraTimeTemplate>();
- Model.CameraOrderType GetCameraOrderType()
- {
- return (Model.CameraOrderType)Convert.ToInt32(this.StrOrderType);
- }
- /// <summary>
- /// 列表列双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellDoubleClick( object sender, DataGridViewCellEventArgs e )
- {
- if ( e.RowIndex >= 0 )
- {
- this.txtdgv.Visible = false;
- this.mskdgv.Visible = false;
- this.dtpcdgv.Visible = false;
- this.cmbtreevdgv.Visible = false;
- DataTable dt = orbll.GetView_Custom( "tb_ErpOrderProductList", StrWhere: "ID = '" + this.dgvData.Rows[e.RowIndex].Cells["ID"].Value + "'", ShowColumnName: "OPlist_ReservationTakeDividedShop,OPlist_ReservationTakeName,OPlist_ReservationTakeTime,OPlist_ArrangeRemark" ).Tables[0];
- if ( this.dgvData.Columns[e.ColumnIndex].Name == "取件门店" )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ReservationTakeDividedShop"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- DataGridViewCell cell = this.dgvData.Rows[e.RowIndex].Cells[e.ColumnIndex];
- Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
- this.cmbtreevStoreName.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y );
- this.cmbtreevStoreName.Size = rect.Size;
- this.cmbtreevStoreName.Visible = true;
- this.mskdgv.Visible = false;
- this.cmbtreevdgv.Visible = false;
- this.txtdgv.Visible = false;
- this.dtpcdgv.Visible = false;
- this.cmbtreevStoreName.TextFindTag( cell.Value.ToString().Trim() );
- this.cmbtreevStoreName.StrKey = "F";
- this.cmbtreevStoreName.Focus();
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "取件日期" )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ReservationTakeTime"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
- Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
- this.dtpcdgv.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y );
- this.dtpcdgv.Size = rect.Size;
- this.dtpcdgv.DateValue = LYFZ.Command.Command_Validate.DateTimeToString( cell.Value );
- this.dtpcdgv.Visible = true;
- this.dtpcdgv.Focus();
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "取件时间" )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ReservationTakeTime"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ReservationTakeTime"].ToString(), "HH:mm" ) != "00:00" && !IsUpdateAnPai )
- {
- return;
- }
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule|| !LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
- Rectangle rect = this.dgvData.GetCellDisplayRectangle(cell.ColumnIndex, cell.RowIndex, true);
- this.mskdgv.Location = new Point(rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y);
- this.mskdgv.Size = rect.Size;
- this.mskdgv.Visible = true;
- this.mskdgv.Text = (String)cell.Value;
- this.mskdgv.Focus();
- }
- else
- {
- //选择时间
- DateTime dayDate = SDateTime.Now;
- string shopID = "";
- List<DateTime> dateTimes = GetDateTime();
- List<string> selectShopIDs = GetSelectShopID();
- if (dateTimes.Count > 0)
- {
- dayDate = dateTimes[0];
- }
- if (selectShopIDs.Count > 0)
- {
- shopID = selectShopIDs[0];
- }
- if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
- {
- if (selectShopIDs.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择要预约的门店");
- return;
- }
- }
- if (dateTimes.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择取件日期");
- return;
- }
- Model.CameraTimeTemplate cameraTime = PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.取件客人, this.GetCameraOrderType());
- if (cameraTime != null)
- {
- DataGridViewCell cell = this.dgvData.Rows[e.RowIndex].Cells[e.ColumnIndex];
- cell.Value = cameraTime.CameraTime;
- if (TimeTemplateKeyValues.ContainsKey(e.RowIndex))
- {
- this.TimeTemplateKeyValues.Remove(e.RowIndex);
- }
- this.TimeTemplateKeyValues.Add(e.RowIndex, cameraTime);
- this.dgvData.Rows[e.RowIndex].Tag = "1";
- }
- }
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "取件人" )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ReservationTakeName"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
- frm.StrTime = this.dgvData.CurrentRow.Cells["取件日期"].Value.ToString().Trim();
- frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.取件师;
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- this.dgvData.CurrentRow.Cells[e.ColumnIndex].Value = frm.StrPersonName;
- this.dgvData.CurrentRow.Cells[e.ColumnIndex].Tag = frm.StrPersonNumber;
- this.dgvData.CurrentRow.Tag = "1";
- }
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "预约说明" )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ArrangeRemark"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
- Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
- this.txtdgv.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y - 1 );
- this.txtdgv.Size = rect.Size;
- this.txtdgv.Text = cell.Value.ToString();
- this.txtdgv.Tag = "BZ";
- this.txtdgv.Visible = true;
- this.txtdgv.Focus();
- }
- }
- }
- /// <summary>
- /// 选择门店
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevStoreName_Leave( object sender, EventArgs e )
- {
- if ( this.cmbtreevStoreName.StrKey != null )
- {
- if ( this.cmbtreevStoreName.StrKey.ToString().Trim() == "F" )
- {
- if ( this.cmbtreevStoreName.Text.Trim() != "" )
- {
- this.dgvData.CurrentRow.Cells["取件门店"].Value = this.cmbtreevStoreName.Text.Trim();
- this.dgvData.CurrentRow.Cells["取件门店"].Tag = this.cmbtreevStoreName.Tag;
- }
- else
- {
- this.dgvData.CurrentRow.Cells["取件门店"].Value = "";
- this.dgvData.CurrentRow.Cells["取件门店"].Tag = null;
- }
- this.dgvData.CurrentRow.Tag = "1";
- }
- this.cmbtreevStoreName.Visible = false;
- if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- if (TimeTemplateKeyValues.ContainsKey(this.dgvData.CurrentRow.Index))
- {
- if (TimeTemplateKeyValues[this.dgvData.CurrentRow.Index].DayTemplate.ShopID != this.cmbtreevStoreName.Tag.ToString())
- {
- this.dgvData.CurrentRow.Cells["取件时间"].Value = "";
- this.TimeTemplateKeyValues.Remove(this.dgvData.CurrentRow.Index);
- }
- }
- else
- {
- if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
- {
- this.dgvData.CurrentRow.Cells["取件时间"].Value = "";
- }
- }
- }
- }
- }
- /// <summary>
- /// 时间控件离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void mskdgv_Leave( object sender, EventArgs e )
- {
- if ( this.mskdgv.Text.Trim() != ":" )
- {
- try
- {
- DateTime strts = Convert.ToDateTime( SDateTime.Now.ToString( "yyyy-MM-dd" ) + " " + this.mskdgv.Text.Trim() );
- this.dgvData.CurrentRow.Cells["取件时间"].Value = this.mskdgv.Text.Trim();
- }
- catch
- {
- MessageBoxCustom.Show( "不是有效的时间格式" ); this.mskdgv.Text = ""; this.mskdgv.Focus(); return;
- }
- }
- else
- {
- this.dgvData.CurrentRow.Cells["取件时间"].Value = "";
- }
- this.dgvData.CurrentRow.Tag = "1";
- this.mskdgv.Visible = false;
- }
- /// <summary>
- /// 日期控件失去焦点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dtpcdgv_Leave( object sender, EventArgs e )
- {
- if ( this.dgvData.CurrentCell.ColumnIndex == this.dgvData.Columns["取件日期"].Index )
- {
- if ( this.dtpcdgv.DateValue.Trim() != "" )
- {
- if ( !string.IsNullOrEmpty( this.dgvData.CurrentRow.Cells["取件人"].Value.ToString().Trim() ) )
- {
- if ( this.dgvData.CurrentRow.Cells["取件人"].Tag != null )
- {
- if ( LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetRestPerson( this.dtpcdgv.DateValue.Trim(), this.dgvData.CurrentRow.Cells["取件人"].Tag.ToString().Trim() ) )
- {
- MessageBoxCustom.Show( this.dgvData.CurrentRow.Cells["取件人"].Value.ToString().Trim() + " '" + this.dtpcdgv.DateValue.Trim() + "'休息,不能安排工作!" );
- this.dtpcdgv.DateValue = "";
- this.dtpcdgv.Focus();
- return;
- }
- }
- }
- this.dgvData.CurrentRow.Cells["取件日期"].Value = this.dtpcdgv.DateValue.Trim();
- }
- else
- {
- this.dgvData.CurrentRow.Cells["取件日期"].Value = "";
- }
- this.dgvData.CurrentRow.Tag = "1";
- }
- this.dtpcdgv.Text = "";
- this.dtpcdgv.Visible = false;
- }
- /// <summary>
- /// 取件人离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevdgv_Leave( object sender, EventArgs e )
- {
- if ( this.cmbtreevdgv.StrKey != null )
- {
- if ( this.cmbtreevdgv.StrKey.ToString().Trim() == "QJ" )
- {
- if ( this.cmbtreevdgv.Text.Trim() != "" )
- {
- this.dgvData.CurrentRow.Cells["取件人"].Value = this.cmbtreevdgv.Text.Trim();
- this.dgvData.CurrentRow.Cells["取件人"].Tag = this.cmbtreevdgv.Tag;
- }
- else
- {
- this.dgvData.CurrentRow.Cells["取件人"].Value = "";
- this.dgvData.CurrentRow.Cells["取件人"].Tag = null;
- }
- this.dgvData.CurrentRow.Tag = "1";
- }
- this.cmbtreevdgv.Visible = false;
- }
- }
- /// <summary>
- /// 备注控件离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtdgv_Leave( object sender, EventArgs e )
- {
- if ( this.txtdgv.Tag.ToString().Trim() == "BZ" )
- {
- this.dgvData.CurrentRow.Cells["预约说明"].Value = this.txtdgv.Text.Trim();
- this.dgvData.CurrentRow.Tag = "1";
- }
- this.txtdgv.Visible = false;
- }
- /// <summary>
- /// 列表列点击事件(右键)
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellMouseDown( object sender, DataGridViewCellMouseEventArgs e )
- {
- if ( e.Button == MouseButtons.Right )
- {
- this.mskdgv.Visible = false;
- this.dtpcdgv.Visible = false;
- this.cmbtreevdgv.Visible = false;
- ToolStripMenuItem item = null;
- if ( e.ColumnIndex == this.dgvData.Columns["取件日期"].Index )
- {
- //弹出操作菜单
- item = new ToolStripMenuItem();
- item.Text = "清空值";
- item.Tag = "StrDate";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "选择日期";
- item.Tag = "StrDate";
- this.dgvData.conMenu.Items.Add( item );
- }
- else if ( e.ColumnIndex == this.dgvData.Columns["取件时间"].Index )
- {
- //弹出操作菜单
- item = new ToolStripMenuItem();
- item.Text = "清空值";
- item.Tag = "StrTime";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "选择时间";
- item.Tag = "StrTime";
- this.dgvData.conMenu.Items.Add( item );
- }
- else if ( e.ColumnIndex == this.dgvData.Columns["取件人"].Index )
- {
- //弹出操作菜单
- item = new ToolStripMenuItem();
- item.Text = "清空值";
- item.Tag = "STrCmbTreeV";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "选择人员";
- item.Tag = "STrCmbTreeV";
- this.dgvData.conMenu.Items.Add( item );
- }
- }
- }
- /// <summary>
- /// 获取预约门店ID
- /// </summary>
- /// <returns></returns>
- List<string> GetSelectShopID()
- {
- List<string> shopIDlist = new List<string>();
- foreach (DataGridViewRow dataGridView in this.dgvData.SelectedRows)
- {
- if (dataGridView.Cells["取件门店"].Tag != null)
- {
- string shopID = dataGridView.Cells["取件门店"].Tag.ToString();
- if (!shopIDlist.Any(s => s.ToLower() == shopID.ToLower()))
- {
- shopIDlist.Add(shopID);
- }
- }
- }
- if (shopIDlist.Count > 1)
- {
- MessageBoxCustom.Show("不能同时预约不同门店的摄控时间");
- }
- return shopIDlist;
- }
- /// <summary>
- /// 获取预约日期
- /// </summary>
- /// <returns></returns>
- List<DateTime> GetDateTime()
- {
- List<DateTime> dateTimelist = new List<DateTime>();
- foreach (DataGridViewRow dataGridView in this.dgvData.SelectedRows)
- {
- if (dataGridView.Cells["取件日期"].Value != null)
- {
- string dateTimeString = dataGridView.Cells["取件日期"].Value.ToString();
- if (!String.IsNullOrWhiteSpace(dateTimeString))
- {
- if (!dateTimelist.Any(d => d.ToYYYY_MM_dd().ToLower() == dateTimeString.ToLower()))
- {
- dateTimelist.Add(Convert.ToDateTime(dateTimeString));
- }
- }
- }
- }
- if (dateTimelist.Count > 1)
- {
- MessageBoxCustom.Show("不能同时预约不同日期的摄控时间");
- }
- return dateTimelist;
- }
- /// <summary>
- /// 右键菜单选择项事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_DataGridViewConMenu_ItemClicked( object sender, ToolStripItemClickedEventArgs e )
- {
- ToolStripItem item = e.ClickedItem;
- string strID = "";
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- strID += "'" + this.dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() + "',";
- }
- DataTable dt = orbll.GetView_Custom( "tb_ErpOrderProductList", StrWhere: "ID in (" + strID.TrimEnd( ',' ) + ")", ShowColumnName: "ID,OPlist_ReservationTakeName,OPlist_ReservationTakeTime,OPlist_ArrangeRemark" ).Tables[0];
- dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] };
- if ( item.Tag.ToString().Trim() == "StrDate" )
- {
- if ( item.Text.Trim() == "选择日期" )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetDateSuperSmallForm frm = new SuperSmallForm.GetDateSuperSmallForm();
- frm.ShowDialog();
- if ( frm.IsOK )
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["OPlist_ReservationTakeTime"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["取件日期"].Value = frm.StrValue;
- if (TimeTemplateKeyValues.ContainsKey(this.dgvData.SelectedRows[i].Index))
- {
- if (TimeTemplateKeyValues[this.dgvData.SelectedRows[i].Index].DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd() != frm.StrValue.Trim())
- {
- this.dgvData.SelectedRows[i].Cells["取件时间"].Value = "";
- this.TimeTemplateKeyValues.Remove(this.dgvData.SelectedRows[i].Index);
- }
- }
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- else
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["OPlist_ReservationTakeTime"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["取件日期"].Value = "";
- if (TimeTemplateKeyValues.ContainsKey(this.dgvData.SelectedRows[i].Index))
- {
- this.dgvData.SelectedRows[i].Cells["取件时间"].Value = "";
- this.TimeTemplateKeyValues.Remove(this.dgvData.SelectedRows[i].Index);
- }
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- else if ( item.Tag.ToString().Trim() == "StrTime" )
- {
- if ( item.Text.Trim() == "选择时间" )
- {
- /* LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetTimeSuperSmallForm frm = new SuperSmallForm.GetTimeSuperSmallForm();
- frm.ShowDialog();
- if ( frm.IsOK )
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["OPlist_ReservationTakeTime"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ReservationTakeTime"].ToString(), "HH:mm" ) != "00:00" && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["取件时间"].Value = frm.StrValue; this.dgvData.SelectedRows[i].Tag = "1";
- }
- }*/
- DateTime dayDate = SDateTime.Now;
- string shopID = "";
- List<DateTime> dateTimes = GetDateTime();
- List<string> selectShopIDs = GetSelectShopID();
- if (dateTimes.Count > 0)
- {
- dayDate = dateTimes[0];
- }
- if (selectShopIDs.Count > 0)
- {
- shopID = selectShopIDs[0];
- }
- if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
- {
- if (selectShopIDs.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择要预约的门店");
- return;
- }
- }
- if (dateTimes.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择取件日期");
- return;
- }
- Model.CameraTimeTemplate cameraTime =PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.取件客人, this.GetCameraOrderType());
- if (cameraTime != null)
- {
- for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- {
- DataRow dtRow = dt.Rows.Find(dt.Rows[0]["ID"]);
- if (!string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(dtRow["OPlist_ReservationTakeTime"].ToString())) && LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[0]["OPlist_ReservationTakeTime"].ToString(), "HH:mm") != "00:00" && !IsUpdateAnPai)
- {
- return;
- }
- if (TimeTemplateKeyValues.ContainsKey(this.dgvData.SelectedRows[i].Index))
- {
- this.TimeTemplateKeyValues.Remove(this.dgvData.SelectedRows[i].Index);
- }
- this.TimeTemplateKeyValues.Add(this.dgvData.SelectedRows[i].Index, cameraTime);
- this.dgvData.SelectedRows[i].Cells["取件时间"].Value = cameraTime.CameraTime;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- else
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["OPlist_ReservationTakeTime"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["OPlist_ReservationTakeTime"].ToString(), "HH:mm" ) != "00:00" && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["取件时间"].Value = "";
- if (TimeTemplateKeyValues.ContainsKey(this.dgvData.SelectedRows[i].Index))
- {
- this.TimeTemplateKeyValues.Remove(this.dgvData.SelectedRows[i].Index);
- }
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- else if ( item.Tag.ToString().Trim() == "STrCmbTreeV" )
- {
- if ( item.Text.Trim() == "选择人员" )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
- frm.StrTime = this.dgvData.CurrentRow.Cells["取件日期"].Value.ToString().Trim();
- frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.取件师;
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["OPlist_ReservationTakeName"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["取件人"].Value = frm.StrPersonName;
- this.dgvData.SelectedRows[i].Cells["取件人"].Tag = frm.StrPersonNumber;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- this.dgvData.CurrentRow.Tag = "1";
- }
- }
- else
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["OPlist_ReservationTakeName"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["取件人"].Value = "";
- this.dgvData.SelectedRows[i].Cells["取件人"].Tag = null;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- }
- }
- }
|