123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837 |
- 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.Software.MainBusiness.DoorCityProcess;
- namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm
- {
- public partial class FilmsSelectionReservationSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.FilmsSelectionReservationSmallForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
- LYFZ.BLL.BLL_ErpSystemConfigure scbll = new LYFZ.BLL.BLL_ErpSystemConfigure();
- LYFZ.BLL.BLL_ErpOrderWorkAnPaiRecord ordwr = new BLL.BLL_ErpOrderWorkAnPaiRecord();
- public FilmsSelectionReservationSmallForm()
- {
- this.Shown += FilmsSelectionReservationSmallForm_Shown;
- this.dtpcdgv.Leave += dtpcdgv_Leave;
- this.dtpcdgv.ValueChanged += Dtpcdgv_ValueChanged;
- 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.btnQuery.Click += btnQuery_Click;
- this.btnSet.Click += btnSet_Click;
- this.btnSelectPerson.Click += btnSelectPerson_Click;
- this.cmbtreevPhotographName.ComboBoxTree_NodeMouseClick += cmbtreevPhotographName_ComboBoxTree_NodeMouseClick;
- this.cmbtreevStoreName.ComboBoxTree_NodeMouseClick += cmbtreevStoreName_ComboBoxTree_NodeMouseClick;
- if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
- {
- this.mskdgv.ReadOnly = true;
- }
- else {
- this.mskdgv.ReadOnly = false;
- }
- this.btnSelectTime.Click += BtnSelectTime_Click;
- if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- this.btnSelectTime.Show();
- this.labelEx13.Hide();
- this.txtOrderQuantity.Hide();
- this.btnSet.Hide();
- }
- else {
- this.btnSelectTime.Hide();
- this.mskdgv.ReadOnly = false;
- this.labelEx13.Show();
- this.txtOrderQuantity.Show();
- this.btnSet.Show();
- }
- }
- Model.CameraTimeTemplate currentSelectCameraTime = null;
- /// <summary>
- /// 当前选择的档期
- /// </summary>
- public Model.CameraTimeTemplate CurrentSelectCameraTime { get => currentSelectCameraTime; set => currentSelectCameraTime = value; }
- private void Dtpcdgv_ValueChanged(object sender, EventArgs e)
- {
- if (this.currentSelectCameraTime != null)
- {
- this.mskdgv.Text = "";
- }
- if (this.TimeTemplateKeyValue != null)
- {
- if (this.dtpcdgv.DateValue != this.TimeTemplateKeyValue.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd())
- {
- this.mskdgv.Text = "";
- this.TimeTemplateKeyValue = null;
- }
- }
- }
- private void cmbtreevStoreName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- string tempShopID = "";
- if (!String.IsNullOrWhiteSpace(this.cmbtreevStoreName.Text))
- {
- if (this.cmbtreevStoreName.Tag != null)
- {
- tempShopID = this.cmbtreevStoreName.Tag.ToString();
- }
- }
- if (this.TimeTemplateKeyValue != null)
- {
- if (tempShopID != this.TimeTemplateKeyValue.DayTemplate.ShopID)
- {
- this.mskdgv.Text = "";
- this.TimeTemplateKeyValue = null;
- }
- }
- }
- Model.CameraTimeTemplate TimeTemplateKeyValue = null;
- private void BtnSelectTime_Click(object sender, EventArgs e)
- {
- DateTime dayDate = SDateTime.Now;
- string shopID = "";
- if (!String.IsNullOrWhiteSpace(dtpcdgv.DateValue))
- {
- dayDate = Convert.ToDateTime(dtpcdgv.DateValue);
- }
- if (this.cmbtreevStoreName.Tag!=null)
- {
- shopID = this.cmbtreevStoreName.Tag.ToString();
- }
- if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
- {
- if (String.IsNullOrWhiteSpace(this.cmbtreevStoreName.Text))
- {
- MessageBoxCustom.Show("需要先选择要预约的门店");
- return;
- }
- }
- if (String.IsNullOrWhiteSpace(dtpcdgv.DateValue))
- {
- MessageBoxCustom.Show("需要先选择拍照日期");
- return;
- }
- Model.CameraTimeTemplate cameraTime =PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.选片客人, this.GetCameraOrderType());
- if (cameraTime != null)
- {
- this.TimeTemplateKeyValue = cameraTime;
- this.mskdgv.Text = cameraTime.CameraTime;
- }
- }
- public int OrderType = 0;
- /// <summary>
- /// 主订单号
- /// </summary>
- public string OrdNumber = "";
- /// <summary>
- /// 数码编号
- /// </summary>
- public string OrdViceNumber = "";
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSave = false;
- /// <summary>
- /// 首次运行 true是,false不是
- /// </summary>
- bool IsFirstRun = true;
- Model.CameraOrderType GetCameraOrderType()
- {
- return (Model.CameraOrderType)OrderType;
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void FilmsSelectionReservationSmallForm_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 );
- this.btnSet.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_AnPaiQuantitySet );
- #region 获取数据
- this.GetDayRemind();
- #endregion
- #region 预约查询
- if ( this.OrdViceNumber.Length > 0 || this.OrdNumber.Length > 0 )
- {
- this.panelEx3.Visible = false;
- this.panelEx4.Height = this.panelEx1.Size.Height - 4;
- this.cmbtreevPhotographName.Enabled = false;
- this.GetOrdNumberGetData();
- this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_FilmsSelectionClientAnPaiUpdate );
- }
- else
- {
- LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.SetClientData( this.lblName1, this.lblName2 );
- this.DataRemind();
- this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_FilmsSelectionClientAnPai );
- }
- this.panelEx2.Visible = true;
- #endregion
- this.IsFirstRun = false;
- }
- /// <summary>
- /// 获取每日可安排订单量
- /// </summary>
- void GetDayRemind()
- {
- if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- this.txtOrderQuantity.Text = "9999999";
- }
- else
- {
- LYFZ.Model.Model_ErpSystemConfigure model = scbll.GetModel("Sconfig_Code", "DayRemind");
- if (model.ID > 0 && !string.IsNullOrEmpty(model.Sconfig_Value))
- {
- string[] StrArray = model.Sconfig_Value.Trim().Split('|');
- this.txtOrderQuantity.Text = StrArray[1].Trim();
- }
- }
-
- }
- /// <summary>
- /// 日期离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dtpcdgv_Leave( object sender, EventArgs e )
- {
- if ( !string.IsNullOrEmpty( this.dtpcdgv.DateValue.Trim() ) && !string.IsNullOrEmpty( this.txtSelectionFilmName.Text.Trim() ) )
- {
- if ( LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetRestPerson( this.dtpcdgv.DateValue.Trim(), this.txtSelectionFilmName.Tag.ToString().Trim() ) )
- {
- MessageBoxCustom.Show( this.txtSelectionFilmName.Text.Trim() + " '" + this.dtpcdgv.DateValue.Trim() + "'休息,不能安排工作!" );
- this.dtpcdgv.DateValue = "";
- return;
- }
- }
- if (this.currentSelectCameraTime != null)
- {
- if (this.dtpcdgv.DateValue.Trim() == "")
- {
- this.mskdgv.Text = "";
- }
- }
- this.DataRemind( this.dtpcdgv.DateValue.Trim() );
- }
- /// <summary>
- /// 拍照名称
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevPhotographName_ComboBoxTree_NodeMouseClick( object sender, TreeNodeMouseClickEventArgs e )
- {
- DataTable tbl = orbll.GetView_Custom( "tb_ErpOrderDigital Left Join tb_ErpOrderDigitalStatus on Ords_ViceNumber = Ordv_ViceNumber", StrWhere: "Ordv_ViceNumber = '" + this.cmbtreevPhotographName.Tag.ToString().Trim() + "'", ShowColumnName: "Ordv_ReservationFilmSelectionTime,Ordv_ReservationFilmSelectionName,Ords_ProductPickupStatus,Ordv_ReservationFilmSelectionDividedShop,Ordv_IntoBottomQuantity,Ordv_IntoRegisterQuantity").Tables[0];
- this.dtpcdgv.DateValue = LYFZ.Command.Command_Validate.DateTimeToString( tbl.Rows[0]["Ordv_ReservationFilmSelectionTime"] );
- string Strtime = LYFZ.Command.Command_Validate.DateTimeToString( tbl.Rows[0]["Ordv_ReservationFilmSelectionTime"], "HH:mm" );
- this.mskdgv.Text = Strtime == "00:00" ? "" : Strtime;
- this.txtSelectionFilmName.Text = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName( tbl.Rows[0]["Ordv_ReservationFilmSelectionName"] );
- this.txtSelectionFilmName.Tag = tbl.Rows[0]["Ordv_ReservationFilmSelectionName"].ToString().Trim();
- if (tbl.Rows[0]["Ordv_ReservationFilmSelectionDividedShop"]!=null&&!String.IsNullOrWhiteSpace(tbl.Rows[0]["Ordv_ReservationFilmSelectionDividedShop"].ToString().Trim()))
- {
- this.cmbtreevStoreName.TextFindTag(LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(tbl.Rows[0]["Ordv_ReservationFilmSelectionDividedShop"].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]["Ordv_ReservationFilmSelectionName"].ToString().Trim().Length > 0 || LYFZ.BLL.OtherCommonModel.DateTimeToString( tbl.Rows[0]["Ordv_ReservationFilmSelectionName"] ).Trim().Length > 0 )
- {
- this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_FilmsSelectionClientAnPaiUpdate );
- }
- else
- {
- this.btnSave.Enabled = true;
- }
- if ( tbl.Rows[0]["Ords_ProductPickupStatus"].ToString().Trim() == "OK" )
- {
- MessageBoxCustom.Show( "'" + this.cmbtreevPhotographName.Text.Trim() + "'取件已完成!" );
- this.cmbtreevPhotographName.SetTextAndTag_ValueNull();
- }
- if (this.currentSelectCameraTime != null)
- {
- if (String.IsNullOrWhiteSpace(this.dtpcdgv.Text) || String.IsNullOrWhiteSpace(this.mskdgv.Text))
- {
- this.cmbtreevStoreName.TextFindTag(LYFZ.DAL.DAL_ErpCompanyInfo.ToShopIDToShopName(this.currentSelectCameraTime.DayTemplate.ShopID));
- this.dtpcdgv.DateValue = this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd();
- this.mskdgv.Text = this.currentSelectCameraTime.CameraTime;
- }
- }
- }
- 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 ( this.txtOrderNumber.Text.Trim() != "" )
- {
- if ( this.dtpcdgv.DateValue.Trim() != "" )
- {
- if ( this.mskdgv.Text.Trim() != ":" )
- {
- try { DateTime ssa = Convert.ToDateTime( SDateTime.Now.ToString( "yyyy-MM-dd" ) + " " + this.mskdgv.Text ); }
- catch { MessageBoxCustom.Show( "选片时间不是有效时间格式" ); this.mskdgv.Text = ""; return; }
- }
- }
- if (!LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- if (this.dgvData.Rows.Count >= Convert.ToInt32(this.txtOrderQuantity.Text))
- {
- if (!LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetMagess())
- {
- return;
- }
- }
- else if (MessageBoxCustom.Show("您确定要保存此操作吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- return;
- }
- }
- else {
- if (MessageBoxCustom.Show("您确定要保存此操作吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- return;
- }
- }
- List<Model.ReservtionParameter> cameraParameterList = new List<Model.ReservtionParameter>();
- DateTime StrTime = SDateTime.Now;
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- List<LYFZ.Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- LYFZ.Model.Model_ErpOrderDigital model = new Model.Model_ErpOrderDigital();
- LYFZ.Model.Model_ErpOrderDigital modelnew = new Model.Model_ErpOrderDigital();
- if ( this.cmbtreevPhotographName.Nodes.Count >= 1 )
- {
- if ( this.cmbtreevPhotographName.Text.Trim().Length <= 0 )
- {
- MessageBoxCustom.Show( "请选择要安排的拍摄名称" ); return;
- }
- model = odbll.GetModel( "Ordv_ViceNumber", this.cmbtreevPhotographName.Tag.ToString().Trim() );
- modelnew = odbll.GetModel( "Ordv_ViceNumber", this.cmbtreevPhotographName.Tag.ToString().Trim() );
- }
- else
- {
- model = odbll.GetModel( "Ordv_Number", this.OrdNumber );
- modelnew = odbll.GetModel( "Ordv_Number", this.OrdNumber );
- }
- if ( !string.IsNullOrEmpty( this.txtSelectionFilmName.Text.Trim() ) )
- {
- model.Ordv_ReservationFilmSelectionName = this.txtSelectionFilmName.Tag.ToString().Trim();
- }
- else
- {
- model.Ordv_ReservationFilmSelectionName = "";
- }
- if ( this.dtpcdgv.DateValue.Trim() != "" && this.mskdgv.Text.Trim() != ":" )
- {
- model.Ordv_ReservationFilmSelectionTime = Convert.ToDateTime( this.dtpcdgv.DateValue.Trim() + " " + this.mskdgv.Text.Trim() + ":00" );
- }
- else if ( this.dtpcdgv.DateValue.Trim() != "" )
- {
- model.Ordv_ReservationFilmSelectionTime = Convert.ToDateTime( this.dtpcdgv.DateValue.Trim() ); this.mskdgv.Text = "";
- }
- else
- {
- model.Ordv_ReservationFilmSelectionTime = null; this.mskdgv.Text = "";
- }
- ////if (string.IsNullOrEmpty(model.Ordv_ReservationFilmSelectionDividedShop))
- //{ model.Ordv_ReservationFilmSelectionDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); }
- if ( !string.IsNullOrEmpty( this.cmbtreevStoreName.Tag.ToString().Trim() ) )
- {
- model.Ordv_ReservationFilmSelectionDividedShop = this.cmbtreevStoreName.Tag.ToString().Trim();
- }
- else
- {
- model.Ordv_ReservationFilmSelectionDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- }
- model.Ordv_FilmSelectionDispatchTime = StrTime;
- model.Ordv_FilmSelectionDispatcher = strUserID;
- clist.Add( odbll.GetUpdateCommandInfo( model ) );
- #region 设置模板预约
- cameraParameterList.Add(new Model.ReservtionParameter
- {
- ShopID = model.Ordv_ReservationFilmSelectionDividedShop
- ,
- DayDate = this.dtpcdgv.DateValue.Trim()
- ,
- Time = this.mskdgv.Text.Trim()
- ,
- VID = model.Ordv_ViceNumber
- });
-
- #endregion
- if ( !modelnew.Ordv_ReservationFilmSelectionName.Equals( model.Ordv_ReservationFilmSelectionName ) ||
- !modelnew.Ordv_ReservationFilmSelectionTime.Equals( model.Ordv_ReservationFilmSelectionTime ) ||
- !modelnew.Ordv_ReservationFilmSelectionDividedShop.Equals( model.Ordv_ReservationFilmSelectionDividedShop ) )
- {
- string storaRecord = "";
- if ( !string.IsNullOrEmpty( this.cmbtreevStoreName.Tag.ToString().Trim() ) )
- {
- storaRecord = "门店:" + this.cmbtreevStoreName.Text.Trim() + " ";
- }
- LYFZ.Model.Model_ErpOrderWorkAnPaiRecord modelRecord = new Model.Model_ErpOrderWorkAnPaiRecord();
- modelRecord.Ordwr_Number = "OWPR_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
- modelRecord.Ordwr_WorkNumber = model.Ordv_ViceNumber;
- modelRecord.Ordwr_OrdNumber = model.Ordv_Number;
- modelRecord.Ordwr_ViceNumber = model.Ordv_ViceNumber;
- modelRecord.Ordwr_ModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排选片客人.ToString();
- DataTable dtName = orbll.GetView_Custom( "tb_ErpOrderDigitalStatus", StrWhere: "Ords_ViceNumber = '" + model.Ordv_ViceNumber + "'", ShowColumnName: "Ords_SightsName" ).Tables[0];
- if ( dtName.Rows.Count > 0 )
- {
- modelRecord.Ordwr_UpdateOrderName = dtName.Rows[0]["Ords_SightsName"].ToString().Trim();
- }
- else
- {
- modelRecord.Ordwr_UpdateOrderName = "";
- }
- modelRecord.Ordwr_UpdateAgoPerson = model.Ordv_FilmSelectionDispatcher;
- modelRecord.Ordwr_UpdateAgoTime = model.Ordv_FilmSelectionDispatchTime;
- modelRecord.Ordwr_UpdateAgoData = storaRecord + "选片时间:" + LYFZ.BLL.OtherCommonModel.DateTimeToString( model.Ordv_ReservationFilmSelectionTime ) + " 选片师:" + LYFZ.BLL.BLL_ErpOrderView.GetUserName( model.Ordv_ReservationFilmSelectionName );
- modelRecord.Ordwr_CreateDatetime = StrTime;
- modelRecord.Ordwr_CreateName = strUserID;
- clist.Add( ordwr.GetAddCommandInfo( modelRecord ) );
- }
- if ( clist.Count > 0 )
- {
- string retErrorMsg = "";
- if (!this.timeDataBll.UpdateReservationTimeDataCommandInfoList(model.Ordv_Number, this.txtOrderNumber.Text, Model.CameraType.选片客人, this.GetCameraOrderType(), cameraParameterList, ref clist, ref retErrorMsg))
- {
- MessageBoxCustom.Show(String.Format("保存预约失败:{0}", retErrorMsg));
- return;
- }
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran( clist ) > 0 )
- {
- this.IsSave = true;
- if ( model.Ordv_ReservationFilmSelectionTime != null && !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( model.Ordv_ReservationFilmSelectionTime ) ) )
- {
- Model.SMSParameters sparameters = new Model.SMSParameters();
- LYFZ.BLL.BLL_SMSTemplates smsTemplates = new BLL.BLL_SMSTemplates();
- sparameters.OrderNumber = this.OrdNumber;
- sparameters.AppointmentPhotographingTime = Convert.ToDateTime( model.Ordv_ReservationFilmSelectionTime );
- try
- {
- smsTemplates.GenerateEventSMS( EnumPublic.SmsSendEvent.客人预约选片后X分钟, sparameters );
- }
- catch { }
- }
- MessageBoxCustom.Show( "保存成功" );
- this.FilmsSelectionReservationSmallForm_Shown( this, null );
- }
- else
- {
- MessageBoxCustom.Show( "保存失败" ); return;
- }
- }
- }
- }
- /// <summary>
- /// 选择工作人员
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSelectPerson_Click( object sender, EventArgs e )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
- frm.StrTime = this.dtpcdgv.DateValue;
- frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.选片师;
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- this.txtSelectionFilmName.Text = frm.StrPersonName;
- this.txtSelectionFilmName.Tag = frm.StrPersonNumber;
- }
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSet_Click( object sender, EventArgs e )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.ControlSetSuperSmallForm frm = new SuperSmallForm.ControlSetSuperSmallForm();
- frm.enumControlSet = SuperSmallForm.ControlSetSuperSmallForm.ControlSet.选片客人;
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- this.GetDayRemind();
- }
- }
- /// <summary>
- /// 加载当日已预约的客人
- /// </summary>
- /// <param name="StrTime"></param>
- /// <param name="StrType"></param>
- void DataRemind( string StrTime = "" )
- {
- string StrWhere = "";
- if ( !string.IsNullOrEmpty( this.OrdNumber ) )
- {
- StrWhere += " and Ordv_ViceNumber != '" + this.OrdViceNumber + "'";
- }
- int Top = 0;
- if ( StrTime != "" )
- {
- Top = -1;
- StrWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime( "Ordv_ReservationFilmSelectionTime", StrTime, StrTime );
- }
- StrWhere += " And Ordv_ReservationFilmSelectionDividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID() + "' ";
- DataTable dt = LYFZ.BLL.BLL_ErpOrderView.GetData_CameraControlBookFilmSelectionRemind( StrWhere, Top );
- this.dgvData.Rows.Clear();
- if ( this.dgvData.Columns.Count <= 0 )
- {
- this.dgvData.DataColumns( dt.Columns, strHideField: "Ordv_ViceNumber" );
- this.dgvData.Columns["订单号"].Width = 110;
- this.dgvData.Columns["选片时间"].Width = 110;
- }
- for ( int i = 0; i < dt.Rows.Count; i++ )
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- for ( int j = 0; j < dt.Columns.Count; j++ )
- {
- cell = new DataGridViewTextBoxCell();
- if ( dt.Columns[j].ColumnName.Trim().Equals( "选片时间" ) )
- {
- cell.Value = LYFZ.BLL.OtherCommonModel.DateTimeToString( dt.Rows[i][dt.Columns[j].ColumnName.Trim()] );
- }
- else
- {
- cell.Value = dt.Rows[i][dt.Columns[j].ColumnName.Trim()].ToString().Trim();
- }
- dgvr.Cells.Add( cell );
- }
- this.dgvData.Rows.Add( dgvr );
- }
- if (!LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook())
- {
- if ( !this.btnSet.Enabled )
- {
- if ( this.dgvData.Rows.Count >= Convert.ToInt32( this.txtOrderQuantity.Text ) )
- {
- MessageBoxCustom.Show( "今日订单的安排已满,若要继续安排需要授权!" );
- }
- }
- }
- }
- /// <summary>
- /// 列表事件双击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void lstTextQuery_MouseDoubleClick( object sender, MouseEventArgs e )
- {
- if ( this.lstTextQuery.Items.Count > 0 )
- {
- if ( ((ListItem)this.lstTextQuery.SelectedItem) != null )
- {
- this.OrdNumber = ((ListItem)this.lstTextQuery.SelectedItem).StrValue.ToString().Trim();
- this.OrdViceNumber = "";
- this.GetOrdNumberGetData();
- 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="StrNumber"></param>
- void GetOrdNumberGetData()
- {
- string StrWhere = " Where ";
- if ( this.OrdViceNumber.Length > 0 )
- {
- StrWhere += "Ordv_ViceNumber = '" + this.OrdViceNumber + "'";
- }
- else
- {
- StrWhere += "Ord_Number = '" + this.OrdNumber + "'";
- }
- string StrTableName = "select Ord_DividedShop," +
- "Ord_Number," +
- "Ordv_ViceNumber, " +
- "Company_Name," +
- "Company_DividedShop," +
- "Ordv_ReservationFilmSelectionName," +
- "Ordv_ReservationFilmSelectionTime," +
- "Cus_Name," +
- "Cus_Sex_cs," +
- "Ord_SinceOrderNumber," +
- "Ord_SeriesName," +
- "Ord_SeriesPrice," +
- "Ordv_IntoRegisterQuantity," +
- "Ordv_IntoBottomQuantity," +
- "Ord_Type," +
- "Ord_OrderPersonName," +
- "Ords_SightsName," +
- "Ords_ProductPickupStatus " +
- "from tb_ErpOrderDigital " +
- "Left Join tb_ErpOrder ON Ord_Number = Ordv_Number " +
- "Left join tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber " +
- "Left join OrderPhotographyData on OrderPhotographyData.Ords_ViceNumber = Ordv_ViceNumber " +
- "Left join OrderDigital on OrderDigital.Ords_ViceNumber = Ordv_ViceNumber " +
- "Left Join tb_ErpCompanyInfo on Company_DividedShop = Ordv_ReservationFilmSelectionDividedShop " + StrWhere + " Order By Ordv_DigitalNumber";
- StrTableName = @"with OrderPhotographyData as (
- select distinct
- Ordpg_Number,
- Ordpg_ViceNumber as Ords_ViceNumber,
- STUFF(
- (
- SELECT ',' + Ordpg_Sights
- FROM[dbo].tb_ErpOrdersPhotography
- WHERE Ordpg_ViceNumber = A.Ordpg_ViceNumber
- FOR XML PATH('')
- )
- ,1,1,''
- )AS Ords_SightsName
- from
- tb_ErpOrdersPhotography as A
- group by Ordpg_Number,Ordpg_ViceNumber,Ordpg_PhotographyStatus,Ordpg_PhotographyTime
- )
- ,asOrderProductPickupStatus as
- (
- select
- max(OPlist_OrderNumber) as orderNumber,
- max(convert(varchar(50),OPlist_IsExpedited)) as IsExpedited,
- max(OPlist_ExpeditedTime) as ExpeditedTime,
-
- OPlist_ViceNumber as VOrderNumber,
- sum(CONVERT(int,[OPlist_PickupStatus])) as PickupStatus,
- count(id) productCount
- from [tb_ErpOrderProductList]
- where OPlist_Type ='2'
- group by OPlist_ViceNumber
- )
- ,OrderDigital as
- (
- select Ordv_Number as ords_OrdNumber,Ordv_ViceNumber as Ords_ViceNumber,
- (case
- when PickupStatus = productCount and productCount>0 then 2
- when PickupStatus >0 then 1
- else 0
- end) as Ords_ProductPickupStatus
- from tb_ErpOrderDigital
- left join asOrderProductPickupStatus
- on Ordv_ViceNumber=asOrderProductPickupStatus.VOrderNumber
- )
- " + StrTableName;
- 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 (Convert.ToInt32(tbl.Rows[0]["Ord_Type"].ToString().Trim()) != this.currentSelectCameraTime.DayTemplate.OrderType)
- {
- MessageBoxCustom.Show(this.currentSelectCameraTime.GetPromptInfo());
-
- return;
- }
- }
- }
- this.OrderType = Convert.ToInt32(tbl.Rows[0]["Ord_Type"].ToString().Trim());
- 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();
- 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() );
- this.cmbtreevPhotographName.Nodes.Clear();
- TreeNode root = null;
- DataRow dataRow = 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 );
- string strDate2 = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[i]["Ordv_ReservationFilmSelectionTime"]);
- string Strtime2 = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[i]["Ordv_ReservationFilmSelectionTime"], "HH:mm");
- if (tbl.Rows[i]["Ords_ProductPickupStatus"].ToString().Trim() != "2"&&(String.IsNullOrWhiteSpace(strDate2) || String.IsNullOrWhiteSpace(Strtime2)))
- {
- if (dataRow == null)
- {
- if (this.OrdViceNumber != tbl.Rows[i]["Ordv_ViceNumber"].ToString().Trim())
- {
- dataRow = tbl.Rows[i];
- }
- }
- }
- }
- if (dataRow == null)
- {
- dataRow = tbl.Rows[0];
- }
- this.cmbtreevPhotographName.TagFindText(dataRow["Ordv_ViceNumber"].ToString().Trim() );
- if (!String.IsNullOrWhiteSpace(dataRow["Company_Name"].ToString().Trim()))
- {
- this.cmbtreevStoreName.TextFindTag(dataRow["Company_Name"].ToString().Trim());
- }
- this.OrdViceNumber = dataRow["Ordv_ViceNumber"].ToString().Trim();
- this.OrdNumber = dataRow["Ord_Number"].ToString().Trim();
-
- this.tx_serial_price.Text = dataRow["Ord_SeriesPrice"].ToString().Trim();
- this.tx_rdrc.Text = string.Format( "{0}\\{1}", dataRow["Ordv_IntoBottomQuantity"].ToString().Trim(), dataRow["Ordv_IntoRegisterQuantity"].ToString().Trim() );
- string strDate = LYFZ.Command.Command_Validate.DateTimeToString(dataRow["Ordv_ReservationFilmSelectionTime"] );
- this.dtpcdgv.DateValue = strDate;
- this.DataRemind( strDate );
- string Strtime = LYFZ.Command.Command_Validate.DateTimeToString(dataRow["Ordv_ReservationFilmSelectionTime"], "HH:mm" );
- this.mskdgv.Text = Strtime == "00:00" ? "" : Strtime;
- this.txtSelectionFilmName.Text = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(dataRow["Ordv_ReservationFilmSelectionName"] );
- this.txtSelectionFilmName.Tag = dataRow["Ordv_ReservationFilmSelectionName"].ToString().Trim();
- if (this.currentSelectCameraTime != null)
- {
- if (String.IsNullOrWhiteSpace(this.dtpcdgv.Text) || String.IsNullOrWhiteSpace(this.mskdgv.Text))
- {
- this.cmbtreevStoreName.TextFindTag(LYFZ.DAL.DAL_ErpCompanyInfo.GetCompanyIDToShopName(this.currentSelectCameraTime.DayTemplate.ShopID));
- this.dtpcdgv.DateValue = this.currentSelectCameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd();
- this.mskdgv.Text = this.currentSelectCameraTime.CameraTime;
- }
- }
- if (dataRow["Ords_ProductPickupStatus"].ToString().Trim() == "2" )
- {
- string StrMaengd = dataRow["Ords_SightsName"].ToString().Trim();
- if ( string.IsNullOrEmpty( StrMaengd ) )
- {
- StrMaengd = "订单取件已完成!";
- }
- else
- {
- StrMaengd = "'" + dataRow["Ords_SightsName"].ToString().Trim() + "'取件已完成!";
- }
- MessageBoxCustom.Show( StrMaengd );
- }
- if (dataRow["Ord_DividedShop"].ToString().Trim() != LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID() )
- {
- if ( MessageBoxCustom.Show( "'" + dataRow["Ord_SinceOrderNumber"].ToString().Trim() + "'订单不属于本店所开,是否要继续安排?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.No )
- {
- return;
- }
- }
- }
- }
- }
- }
|