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;
///
/// 当前选择的档期
///
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;
///
/// 主订单号
///
public string OrdNumber = "";
///
/// 数码编号
///
public string OrdViceNumber = "";
///
/// 是否保存
///
public bool IsSave = false;
///
/// 首次运行 true是,false不是
///
bool IsFirstRun = true;
Model.CameraOrderType GetCameraOrderType()
{
return (Model.CameraOrderType)OrderType;
}
///
/// 窗体加载事件
///
///
///
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;
}
///
/// 获取每日可安排订单量
///
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();
}
}
}
///
/// 日期离开事件
///
///
///
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() );
}
///
/// 拍照名称
///
///
///
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();
///
/// 保存
///
///
///
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 cameraParameterList = new List();
DateTime StrTime = SDateTime.Now;
string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
List clist = new List();
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;
}
}
}
}
///
/// 选择工作人员
///
///
///
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;
}
}
///
/// 设置
///
///
///
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();
}
}
///
/// 加载当日已预约的客人
///
///
///
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( "今日订单的安排已满,若要继续安排需要授权!" );
}
}
}
}
///
/// 列表事件双击
///
///
///
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;
}
///
/// 回车键
///
///
///
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 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;
}
}
}
}
}
}