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; /// /// 当前选择的档期 /// 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( "每日最大取件量设置成功!" ); } } /// /// 主订单号 /// public string OrdNumber; /// /// 副订单号 /// public string OrdViceNumber; /// /// 是否保存 /// public bool IsSave = false; /// /// 首次运行 true是,false不是 /// bool IsFirstRun = true; /// /// 重新安排 /// bool IsUpdateAnPai = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_TakePiecesClientAnPaiUpdate ); /// /// 窗体加载事件 /// /// /// 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 dateTimeList = new List(); 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(); /// /// 保存 /// /// /// void btnSave_Click( object sender, EventArgs e ) { if ( !CheckSystemConfigDataControl() ) { return; } if ( this.dgvData.Rows.Count > 0 ) { List clist = new List(); DateTime strTime = SDateTime.Now; string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; List cameraParameterList = new List(); 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; } } } /// /// 列表事件双击 /// /// /// 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; } /// /// 按回车键 /// /// /// void lstTextQuery_KeyDown( object sender, KeyEventArgs e ) { if ( e.KeyCode == Keys.Enter ) { this.lstTextQuery_MouseDoubleClick( this, null ); } } /// /// 输入值变化 /// /// /// void txtTextQuery_EventTextBoxEx_TextChanged( object sender, EventArgs e ) { if ( !this.IsFirstRun ) { if ( this.txtTextQuery.Text.Trim() == "" ) { this.lstTextQuery.Visible = true; } } } /// /// 点击输入框 /// /// /// void txtTextQuery_Enter( object sender, EventArgs e ) { this.txtTextQuery_EventTextBoxEx_TextChanged( null, null ); } /// /// 查询 /// /// /// void btnQuery_Click( object sender, EventArgs e ) { LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery, cameraType: Model.CameraType.取件客人); } /// /// 按键盘上的下健时 /// /// /// 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.取件客人); } } /// /// 查询文本框离开事件 /// /// /// void txtTextQuery_Leave( object sender, EventArgs e ) { if ( !this.lstTextQuery.Focused ) { this.lstTextQuery.Visible = false; } } /// /// 拍照名称 /// /// /// void cmbtreevPhotographName_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e ) { this.OrdViceNumber = this.cmbtreevPhotographName.Tag.ToString().Trim(); this.DataRemind(); } string StrOrderType = ""; /// /// 查询获取订单信息 /// 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; } } } } /// /// 设计加载的项 /// /// /// /// 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); } /// /// 加载当日已预约的客人 /// /// 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; } } } /// /// 暂存预约选择的档期数据 /// Dictionary TimeTemplateKeyValues = new Dictionary(); Model.CameraOrderType GetCameraOrderType() { return (Model.CameraOrderType)Convert.ToInt32(this.StrOrderType); } /// /// 列表列双击事件 /// /// /// 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 dateTimes = GetDateTime(); List 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(); } } } /// /// 选择门店 /// /// /// 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 = ""; } } } } } /// /// 时间控件离开事件 /// /// /// 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; } /// /// 日期控件失去焦点 /// /// /// 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; } /// /// 取件人离开事件 /// /// /// 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; } } /// /// 备注控件离开事件 /// /// /// 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; } /// /// 列表列点击事件(右键) /// /// /// 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 ); } } } /// /// 获取预约门店ID /// /// List GetSelectShopID() { List shopIDlist = new List(); 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; } /// /// 获取预约日期 /// /// List GetDateTime() { List dateTimelist = new List(); 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; } /// /// 右键菜单选择项事件 /// /// /// 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 dateTimes = GetDateTime(); List 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"; } } } } } }