1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251 |
- 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;
- using LYFZ.Helper;
- namespace LYFZ.Software.MainBusiness.CameraControlBook.SmallForm
- {
- public partial class WeddingReservationSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.WeddingReservationSmallForm
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpProduct pdtbll = new BLL.BLL_ErpProduct();
- LYFZ.BLL.BLL_SMSTemplates smsTemplates = new BLL.BLL_SMSTemplates();
- LYFZ.BLL.BLL_ErpPlusPickItems Pbll = new BLL.BLL_ErpPlusPickItems();
- LYFZ.BLL.BLL_ErpWeddingService Wbll = new BLL.BLL_ErpWeddingService();
- LYFZ.BLL.BLL_ErpProductIntStorage pisbll = new BLL.BLL_ErpProductIntStorage();
- LYFZ.BLL.BLL_ErpProductOutStorage posbll = new BLL.BLL_ErpProductOutStorage();
- LYFZ.BLL.BLL_ErpOrderWorkAnPaiRecord ordwr = new BLL.BLL_ErpOrderWorkAnPaiRecord();
- LYFZ.BLL.BLL_ErpPieceCommissionRecords pcrbll = new BLL.BLL_ErpPieceCommissionRecords();
- public WeddingReservationSmallForm()
- {
- this.Shown += WeddingReservationSmallForm_Shown;
- this.btnAddingGuests.Click += btnAddingGuests_Click;
- this.btnUpdate.Click += btnUpdate_Click;
- this.btnAddService.Click += btnAddService_Click;
- this.btnDelete.Click += btnDelete_Click;
- 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.dgvData.CellDoubleClick += dgvData_CellDoubleClick;
- this.cmbtreevdgv.Leave += cmbtreevdgv_Leave;
- this.cmbtreevStoreName.Leave += cmbtreevStoreName_Leave;
- this.cmbtreevStoreName.IsNodeMouseClick = true;
- this.cmbtreevStoreName.AfterSelectLevelFirstNode = true;
- this.cmbdgv.Leave += cmbdgv_Leave;
- this.mskdgv.Leave += mskdgv_Leave;
- this.txtdgv.Leave += txtdgv_Leave;
- this.dtpcdgv.Leave += dtpcdgv_Leave;
- this.dgvData.CellMouseDown += dgvData_CellMouseDown;
- this.btnQuery.Click += btnQuery_Click;
- this.txtIntCount.Leave += txtIntCount_Leave;
- this.txtIntCount.KeyPress += txtIntCount_KeyPress;
- this.dgvData.DataGridViewConMenu_ItemClicked += dgvData_DataGridViewConMenu_ItemClicked;
- }
- Model.CameraTimeTemplate currentSelectCameraTime = null;
- /// <summary>
- /// 当前选择的档期
- /// </summary>
- public Model.CameraTimeTemplate CurrentSelectCameraTime { get => currentSelectCameraTime; set => currentSelectCameraTime = value; }
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 订单号
- /// </summary>
- public string OrdNumber;
- private DataTable tbl_Department = new DataTable();
- private ArrayList listDeteleID = new ArrayList();
- string[] StrStatus = ("未开始,进行中,OK").Split( ',' );
- /// <summary>
- /// 首次运行 true是,false不是
- /// </summary>
- bool IsFirstRun = true;
- /// <summary>
- /// 订单类型
- /// </summary>
- string StrOrdType = "";
- /// <summary>
- /// 重新安排
- /// </summary>
- bool IsUpdateAnPai = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_PhotographClientAnPaiUpdate );
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void WeddingReservationSmallForm_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 );
- tbl_Department = orbll.GetView_Custom( "tb_ErpDepartment", ShowColumnName: "ID,Dt_Name" ).Tables[0];
- if ( !string.IsNullOrEmpty( OrdNumber ) )
- {
- this.panelEx2.Visible = false;
- this.panelEx4.Height = this.panelEx1.Size.Height - 4;
- this.btnAddingGuests.Visible = false;
- this.GetOrdNumberGetData();
- }
- else
- {
- this.SetClientData();
- this.GetOrdNumberGetData();
- }
- this.panelEx4.Visible = true;
- this.IsFirstRun = false;
- this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_ServiceClientAnPai );
- }
- /// <summary>
- /// 添加客人
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnAddingGuests_Click( object sender, EventArgs e )
- {
- EnumPublic.OrderType orderType = LYFZ.EnumPublic.OrderType.服务订单;
- #if DEBUG
- this.OpenNewOrder( orderType, "" );
- #else
- LYFZ.Software.MainBusiness.DoorCityProcess.OnSingleFormMain01 frm = new OnSingleFormMain01();
- frm.OrdType = orderType;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.OrdNumber = frm.StrNumber;
- this.GetOrdNumberGetData();
- }
- #endif
- }
- /// <summary>
- /// 修改资料
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnUpdate_Click( object sender, EventArgs e )
- {
- if ( !string.IsNullOrEmpty( this.OrdNumber ) )
- {
- if ( !string.IsNullOrEmpty( this.StrOrdType ) )
- {
- EnumPublic.OrderType orderType = (LYFZ.EnumPublic.OrderType)Enum.Parse( typeof( LYFZ.EnumPublic.OrderType ), this.StrOrdType );
- //#if DEBUG
- this.OpenNewOrder( orderType, this.OrdNumber );
- //#else
- // LYFZ.Software.MainBusiness.DoorCityProcess.OnSingleFormMain01 frm = new OnSingleFormMain01();
- // frm.OrdType = orderType;
- // frm.StrNumber = this.OrdNumber;
- // frm.ShowDialog();
- // if (frm.IsSaveed)
- // {
- // this.OrdNumber = frm.StrNumber;
- // this.GetOrdNumberGetData();
- // }
- //#endif
- }
- }
- }
- void OpenNewOrder( EnumPublic.OrderType orderType, string _OrderNumber = "" )
- {
- frmNewOrder newOrder = new frmNewOrder();
- newOrder.OrderNumber = _OrderNumber;
- //newOrder.IsShowUcNavigationTool = false;
- //newOrder.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- //newOrder.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- //newOrder.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- newOrder.OrderType = orderType;
- newOrder.ShowDialog();
- if ( newOrder.IsSaveData )
- {
- this.OrdNumber = newOrder.OrderNumber;
- this.GetOrdNumberGetData();
- }
- }
-
- /// <summary>
- /// 添加服务
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnAddService_Click( object sender, EventArgs e )
- {
- if ( string.IsNullOrEmpty( this.OrdNumber ) )
- {
- MessageBoxCustom.Show( "未选择订单!" ); return;
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxSamllForm frm = new LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxSamllForm();
- frm.LoadType = "婚庆服务";
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- List<LYFZ.Model.Model_ErpProduct> mlist = frm.mlist;
- for ( int k = 0; k < this.dgvData.Rows.Count; k++ )
- {
- for ( int i = 0; i < mlist.Count; i++ )
- {
- if ( this.dgvData.Rows[k].Cells["Ws_ProdNumber"].Value.ToString().Trim() == mlist[i].Prod_Number.Trim() && this.dgvData.Rows[k].Cells["服务状态"].Value.ToString().Trim() != "OK" )
- {
- this.dgvData.Rows[k].Cells["数量"].Value = (Convert.ToInt32( this.dgvData.Rows[k].Cells["数量"].Value ) + 1).ToString().Trim();
- this.dgvData.Rows[k].Tag = "1";
- mlist.RemoveAt( i );
- break;
- }
- }
- }
- for ( int i = 0; i < mlist.Count; i++ )
- {
- DataGridViewRow dgvl = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = "";
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- cell.Value = mlist[i].Prod_Number.Trim();
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- cell.Value = "2";
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- cell.Value = mlist[i].Prod_CostPrice;
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- cell.Value = mlist[i].Prod_SalesPrice;
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- cell.Value = mlist[i].Prod_Name.Trim();
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- cell.Value = "1";
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- DataTable dt = orbll.GetView_Custom( "select Company_DividedShop,Company_Name from tb_ErpCompanyInfo where Company_DividedShop ='" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'" ).Tables[0];
- cell.Value = dt.Rows[0]["Company_Name"].ToLowerString().Trim();
- cell.Tag = dt.Rows[0]["Company_DividedShop"].ToLowerString().Trim();
- dgvl.Cells.Add( cell );
- cell = new DataGridViewTextBoxCell();
- cell.Value = StrStatus[0].Trim();
- dgvl.Cells.Add( cell );
- for ( int k = 0; k < 5; k++ )
- {
- cell = new DataGridViewTextBoxCell();
- cell.Value = "";
- cell.Tag = "";
- dgvl.Cells.Add( cell );
- }
- dgvl.Tag = "1";
- this.dgvData.Rows.Add( dgvl );
- }
- }
- }
- /// <summary>
- /// 删除服务
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDelete_Click( object sender, EventArgs e )
- {
- if ( this.dgvData.SelectedRows.Count > 0 )
- {
- if ( this.dgvData.SelectedRows.Count == 1 )
- {
- if ( this.dgvData.SelectedRows[0].Cells["ID"].Value.ToString().Trim() != "" )
- {
- if ( MessageBoxCustom.Show( "你确定要删除选择的服务?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.Yes )
- {
- if ( this.dgvData.SelectedRows[0].Cells["Ws_Type"].Value.ToString().Trim() == "2" )
- {
- listDeteleID.Add( this.dgvData.SelectedRows[0].Cells["ID"].Value.ToString().Trim() );
- }
- this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[0].Index );
- }
- }
- else
- {
- this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[0].Index );
- }
- }
- else
- {
- if ( MessageBoxCustom.Show( "你确定要删除选择的服务?\r\n\r\n说明:只能删除此处添加的服务", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.Yes )
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() != "" )
- {
- if ( this.dgvData.SelectedRows[i].Cells["Ws_Type"].Value.ToString().Trim() == "2" )
- {
- listDeteleID.Add( this.dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() );
- }
- this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[i].Index );
- }
- else
- {
- this.dgvData.Rows.RemoveAt( this.dgvData.SelectedRows[i].Index );
- }
- }
- }
- }
- }
- }
- LYFZ.BLL.ReservationTimeData timeDataBll = new BLL.ReservationTimeData();
- /// <summary>
- /// 暂存预约选择的档期数据
- /// </summary>
- Dictionary<int, Model.CameraTimeTemplate> TimeTemplateKeyValues = new Dictionary<int, Model.CameraTimeTemplate>();
- Model.CameraOrderType GetCameraOrderType()
- {
- return (Model.CameraOrderType)Convert.ToInt32(this.StrOrdType);
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSave_Click( object sender, EventArgs e )
- {
- if ( this.dgvData.Rows.Count > 0 )
- {
- if ( string.IsNullOrEmpty( this.OrdNumber ) )
- {
- MessageBoxCustom.Show( "未选择订单!" ); return;
- }
- string StrName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- DateTime StrTime = SDateTime.Now;
- List<Model.ReservtionParameter> cameraParameterList = new List<Model.ReservtionParameter>();
- List<CommandInfo> clist = new List<CommandInfo>();
- bool Isbl = false;
- string StrServerContent = "";
- for ( int i = 0; i < this.dgvData.Rows.Count; i++ )
- {
- if ( this.dgvData.Rows[i].Cells["ID"].Value.ToString().Trim() == "" )
- {
- Isbl = true;
- StrServerContent += this.dgvData.Rows[i].Cells["服务内容"].Value.ToString().Trim() + ",";
- }
- }
- if ( listDeteleID.Count > 0 )
- {
- Isbl = true;
- }
- decimal dec_Amount = 0;
- string str_Name = "";
- string str_Remark = "";
- string str_SaleMan = "";
- string str_TwoSaleCategory = "";
- if ( Isbl )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.ServicePaymentSuperSmallForm frm = new SuperSmallForm.ServicePaymentSuperSmallForm();
- frm.StrServerText = StrServerContent.TrimEnd( ',' );
- frm.ShowDialog();
- if ( !frm.IsSave )
- {
- return;
- }
- dec_Amount = frm.OutAmount;
- str_Name = frm.OutName;
- str_Remark = frm.OutRemark;
- str_SaleMan = frm.SaleMan;
- str_TwoSaleCategory = frm.TwoSaleCategory;
- }
- #region 服务内容
- for ( int i = 0; i < listDeteleID.Count; i++ )
- {
- clist.Add( Wbll.GetDeleteCommandInfo( "ID", "=", listDeteleID[i].ToString().Trim() ) );
- }
- LYFZ.Model.Model_ErpWeddingService wm = null;
- Hashtable htEmssAnPai = new Hashtable();
- Hashtable htEmssOK = new Hashtable();
- for ( int i = 0; i < this.dgvData.Rows.Count; i++ )
- {
- if ( this.dgvData.Rows[i].Tag != null )
- {
- if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["ID"].Value.ToString().Trim() ) )
- {
- wm = Wbll.GetModel( Convert.ToInt32( this.dgvData.Rows[i].Cells["ID"].Value ) );
- string StrRen = "";
- if ( this.dgvData.Rows[i].Cells["服务人员1"].Tag != null &&
- wm.Ws_Serviceman1.Trim() != this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim() )
- {
- StrRen += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
- }
- if ( this.dgvData.Rows[i].Cells["服务人员2"].Tag != null &&
- wm.Ws_Serviceman2.Trim() != this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() )
- {
- StrRen += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
- }
- if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != LYFZ.Command.Command_Validate.DateTimeToString( wm.Ws_WeddingDate ) )
- {
- if ( !string.IsNullOrEmpty( StrRen ) )
- {
- if ( htEmssAnPai.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
- {
- htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen;
- }
- else
- {
- htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen;
- }
- }
- else
- {
- string StrRen3 = "";
- if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() ) )
- {
- StrRen3 += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
- }
- if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() ) )
- {
- StrRen3 += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
- }
- if ( htEmssAnPai.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
- {
- htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen3;
- }
- else
- {
- htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen3;
- }
- }
- }
- string StrStatus = this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "未开始" ? "0" : this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "OK" ? "1" : "2";
- if ( this.dgvData.Rows[i].Cells["服务状态"].Tag != null )
- {
- if ( this.dgvData.Rows[i].Cells["服务状态"].Tag.ToString().Trim() == "1" && wm.Ws_Status.Trim() != StrStatus && StrStatus == "1" )
- {
- string StrRen2 = "";
- if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() ) )
- {
- StrRen2 += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
- }
- if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() ) )
- {
- StrRen2 += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
- }
- if ( htEmssOK.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
- {
- htEmssOK[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssOK[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen2;
- }
- else
- {
- htEmssOK[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen2;
- }
- }
- }
- if(StrStatus!="0")
- {
- wm.Ws_ServiceShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID;
- }
- if ( this.dgvData.Rows[i].Cells["数量"].Value.ToString().Trim() != "" )
- {
- wm.Ws_ProdQuantity = Convert.ToInt32( this.dgvData.Rows[i].Cells["数量"].Value );
- }
- if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" && this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() != "" )
- {
- wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() + " " + this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() );
- }
- else if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() );
- }
- else
- {
- wm.Ws_WeddingDate = null; this.dgvData.Rows[i].Cells["服务时间"].Value = "";
- }
- if ( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() != "" )
- {
- wm.Ws_Serviceman1 = this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim();
- }
- else { wm.Ws_Serviceman1 = ""; }
- if ( this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" )
- {
- wm.Ws_Serviceman2 = this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim();
- }
- else
- {
- wm.Ws_Serviceman2 = "";
- }
- //// if (string.IsNullOrEmpty(wm.Ws_ReservationServiceDividedShop))
- //{ wm.Ws_ReservationServiceDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); }
- if ( this.dgvData.Rows[i].Cells["服务门店"].Tag != null )
- {
- wm.Ws_ReservationServiceDividedShop = this.dgvData.Rows[i].Cells["服务门店"].Tag.ToString();
- }
- else
- {
- wm.Ws_ReservationServiceDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- }
- wm.Ws_Status = StrStatus;
- wm.Ws_Remark = this.dgvData.Rows[i].Cells["服务备注"].Value.ToString().Trim();
- wm.Ws_WeddingDispatchDate = StrTime;
- wm.Ws_WeddingDispatcher = StrName;
- clist.AddRange( this.GetLessInventory( ref wm, StrTime, StrName ) );
- clist.Add( Wbll.GetUpdateCommandInfo( wm ) );
- #region 设置模板预约
- cameraParameterList.Add(new Model.ReservtionParameter
- {
- ShopID = wm.Ws_ReservationServiceDividedShop
- ,
- DayDate = this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()
- ,
- Time = this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim()
- ,
- VID = wm.ID.ToString()
- });
- #endregion
- LYFZ.Model.Model_ErpWeddingService modelnew = Wbll.GetModel( Convert.ToInt32( this.dgvData.Rows[i].Cells["ID"].Value ) );
- if ( !modelnew.Ws_Serviceman1.Equals( wm.Ws_Serviceman1 ) ||
- !modelnew.Ws_Serviceman2.Equals( wm.Ws_Serviceman2 ) ||
- !modelnew.Ws_WeddingDate.Equals( wm.Ws_WeddingDate ) ||
- !modelnew.Ws_ReservationServiceDividedShop.Equals( wm.Ws_ReservationServiceDividedShop ) )
- {
- 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 = wm.ID.ToString().Trim();
- modelRecord.Ordwr_OrdNumber = wm.Ws_Number;
- modelRecord.Ordwr_ViceNumber = wm.Ws_ViceNumber;
- modelRecord.Ordwr_ModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排服务客人.ToString();
- modelRecord.Ordwr_UpdateOrderName = wm.Ws_ProdName;
- modelRecord.Ordwr_UpdateAgoPerson = wm.Ws_WeddingDispatcher;
- modelRecord.Ordwr_UpdateAgoTime = wm.Ws_WeddingDispatchDate;
- modelRecord.Ordwr_UpdateAgoData = storaRecord + "服务时间:" + LYFZ.BLL.OtherCommonModel.DateTimeToString( wm.Ws_WeddingDate ) + " 服务人员1:" + LYFZ.BLL.BLL_ErpOrderView.GetUserName( wm.Ws_Serviceman1 ) + " 服务人员2:" + LYFZ.BLL.BLL_ErpOrderView.GetUserName( wm.Ws_Serviceman2 );
- modelRecord.Ordwr_CreateDatetime = StrTime;
- modelRecord.Ordwr_CreateName = StrName;
- clist.Add( ordwr.GetAddCommandInfo( modelRecord ) );
- }
- if ( LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ServiceCompletedAddPieceRate && wm.Ws_Status == "1" )
- {
- if ( !string.IsNullOrEmpty( wm.Ws_Serviceman1 ) )
- {
- LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 1, StrTime, StrName );
- if ( modelRecords != null )
- {
- clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
- }
- }
- if ( !string.IsNullOrEmpty( wm.Ws_Serviceman2 ) )
- {
- LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 2, StrTime, StrName );
- if ( modelRecords != null )
- {
- clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
- }
- }
- }
- else
- {
- string StrContentName = wm.Ws_Number + "_" + wm.Ws_ProdName + "_" + wm.Ws_UpdateDateTime.ToString( "yyyyMMdd HHmmssfff" );
- DataTable tbl = orbll.GetView_Custom( "tb_ErpPieceCommissionRecords", StrWhere: "Pcr_MarkKey = '" + StrContentName + "'", ShowColumnName: "ID" ).Tables[0];
- if ( tbl.Rows.Count > 0 )
- {
- clist.Add( pcrbll.GetDeleteCommandInfo( "ID", "=", tbl.Rows[0]["ID"] ) );
- }
- }
- }
- else
- {
- wm = new Model.Model_ErpWeddingService();
- string StrRen = "";
- if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim() ) )
- {
- StrRen += this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() + ",";
- }
- if ( StrRen != this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() && !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim() ) )
- {
- StrRen += this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() + ",";
- }
- if ( string.IsNullOrEmpty( StrRen ) )
- {
- if ( !string.IsNullOrEmpty( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
- {
- if ( htEmssAnPai.ContainsKey( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() ) )
- {
- htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] + StrRen;
- }
- else
- {
- htEmssAnPai[this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim()] = StrRen;
- }
- }
- }
- wm.Ws_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- wm.Ws_Number = this.OrdNumber;
- wm.Ws_Type = "2";
- wm.Ws_OrderByNumber = (i + 1);
- wm.Ws_ProdNumber = this.dgvData.Rows[i].Cells["Ws_ProdNumber"].Value.ToString().Trim();
- wm.Ws_ProdName = this.dgvData.Rows[i].Cells["服务内容"].Value.ToString().Trim();
- wm.Ws_ProdCostPrice = Convert.ToDecimal( this.dgvData.Rows[i].Cells["Ws_ProdCostPrice"].Value );
- wm.Ws_ProdSoldPrice = Convert.ToDecimal( this.dgvData.Rows[i].Cells["Ws_ProdSoldPrice"].Value );
- wm.Ws_ProdQuantity = Convert.ToInt32( this.dgvData.Rows[i].Cells["数量"].Value );
- if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- if ( this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() != "" )
- {
- wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() + " " + this.dgvData.Rows[i].Cells["服务时间"].Value.ToString().Trim() );
- }
- else
- {
- wm.Ws_WeddingDate = Convert.ToDateTime( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() );
- }
- }
- wm.Ws_WeddingDateLunar = "0";
- if ( this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() != "" )
- {
- wm.Ws_Serviceman1 = this.dgvData.Rows[i].Cells["服务人员1"].Tag.ToString().Trim();
- }
- else
- {
- wm.Ws_Serviceman1 = "";
- }
- if ( this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" )
- {
- wm.Ws_Serviceman2 = this.dgvData.Rows[i].Cells["服务人员2"].Tag.ToString().Trim();
- }
- else
- {
- wm.Ws_Serviceman2 = "";
- }
- wm.Ws_Status = this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "未开始" ? "0" : this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() == "OK" ? "1" : "2";
- wm.Ws_Remark = this.dgvData.Rows[i].Cells["服务备注"].Value.ToString().Trim();
- if ( this.dgvData.Rows[i].Cells["服务日期"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务人员1"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务人员2"].Value.ToString().Trim() != "" || this.dgvData.Rows[i].Cells["服务状态"].Value.ToString().Trim() != "未开始" || this.dgvData.Rows[i].Cells["服务备注"].Value.ToString().Trim() != "" )
- {
- wm.Ws_WeddingDispatchDate = StrTime;
- wm.Ws_WeddingDispatcher = StrName;
- }
- // if (string.IsNullOrEmpty(wm.Ws_ReservationServiceDividedShop))
- {
- wm.Ws_ReservationServiceDividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- }
- wm.Ws_UpdateDateTime = StrTime;
- wm.Ws_UpdateName = StrName;
- clist.AddRange( this.GetLessInventory( ref wm, StrTime, StrName ) );
- clist.Add( Wbll.GetAddCommandInfo( wm ) );
- if ( LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ServiceCompletedAddPieceRate && wm.Ws_Status == "1" )
- {
- if ( !string.IsNullOrEmpty( wm.Ws_Serviceman1 ) )
- {
- LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 1, StrTime, StrName );
- if ( modelRecords != null )
- {
- clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
- }
- }
- if ( !string.IsNullOrEmpty( wm.Ws_Serviceman2 ) )
- {
- LYFZ.Model.Model_ErpPieceCommissionRecords modelRecords = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetPieceCommissionRecordsModel( wm, 2, StrTime, StrName );
- if ( modelRecords != null )
- {
- clist.Add( pcrbll.GetAddCommandInfo( modelRecords ) );
- }
- }
- }
- }
- }
- }
- #endregion
- #region 新增收款项目
- if ( Isbl )
- {
- LYFZ.Model.Model_ErpPlusPickItems model = new Model.Model_ErpPlusPickItems();// Obll.GetModel("Ord_Number", this.OrdNumber);
- model.Plu_OrdNumber = this.OrdNumber;
- model.Plu_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Plu_Amount = dec_Amount;
- model.Plu_Goods = str_Name;
- model.Plu_GoodsCosts = "0";
- model.Plu_SourceType = "0";
- model.Plu_OpenSingle = str_SaleMan;
- model.Plu_TwoPinsCategory = str_TwoSaleCategory;
- model.Plu_RecordedPerson = StrName;
- model.Plu_CreateTime = StrTime;
- clist.Add( Pbll.GetAddCommandInfo( model ) );
- }
- #endregion
- 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 ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran( clist ) <= 0 )
- {
- MessageBoxCustom.Show( "添加收收款项目失败;" ); return;
- }
- new System.Threading.Thread( new System.Threading.ThreadStart( delegate ()
- {
- LYFZ.BLL.BLL_ErpOrderDigitalStatus.UpdateDigitalStatus( this.OrdNumber, EnumPublic.OrderDigitalStatusEnum.摄控服务 );
- } ) ).Start();
- }
- if ( htEmssAnPai.Count > 0 || htEmssOK.Count > 0 )
- {
- System.Threading.Thread t = new System.Threading.Thread( new System.Threading.ThreadStart( delegate ()
- {
- if ( htEmssAnPai.Count > 0 )
- {
- foreach ( DictionaryEntry item in htEmssAnPai )
- {
- if ( !string.IsNullOrEmpty( item.Key.ToString().Trim() ) )
- {
- Model.SMSParameters sparameters = new Model.SMSParameters();
- sparameters.OrderNumber = wm.Ws_Number;
- sparameters.AppointmentPhotographingTime = Convert.ToDateTime( item.Key );
- try
- {
- smsTemplates.GenerateEventSMS( EnumPublic.SmsSendEvent.服务预约后X分钟, sparameters );
- }
- catch { }
- }
- }
- }
- if ( htEmssOK.Count > 0 )
- {
- foreach ( DictionaryEntry item in htEmssOK )
- {
- if ( !string.IsNullOrEmpty( item.Key.ToString().Trim() ) )
- {
- Model.SMSParameters sparameters = new Model.SMSParameters();
- sparameters.OrderNumber = wm.Ws_Number;
- sparameters.AppointmentPhotographingTime = Convert.ToDateTime( item.Key );
- try
- {
- smsTemplates.GenerateEventSMS( EnumPublic.SmsSendEvent.服务完成后X分钟, sparameters );
- }
- catch { }
- }
- }
- }
- } ) );
- t.Start();
- }
- MessageBoxCustom.Show( "保存成功" );
- this.IsSaveed = true;
- this.Close();
- }
- }
- /// <summary>
- /// 减库存
- /// </summary>
- /// <param name="model"></param>
- /// <param name="StrTime"></param>
- /// <param name="StrUserID"></param>
- /// <returns></returns>
- List<Helper.CommandInfo> GetLessInventory( ref LYFZ.Model.Model_ErpWeddingService model, DateTime StrTime, string StrUserID )
- {
- List<Helper.CommandInfo> clist = new List<CommandInfo>();
- DataTable tblList = orbll.GetView_Custom( "tb_ErpProduct", StrWhere: "Prod_Number = '" + model.Ws_ProdNumber + "' And Prod_Availability = 1", ShowColumnName: "*" ).Tables[0];
- if ( tblList.Rows.Count > 0 )
- {
- LYFZ.Model.Model_ErpProduct modelpt = pdtbll.DataRowToModel( tblList.Rows[0] );
- if ( model.Ws_Status == "1" )
- {
- int CompletedHadLessQuantity = model.Ws_CompletedHadLessQuantity;
- int CompletedQuantity = model.Ws_ProdQuantity;
- model.Ws_CompletedHadLessQuantity = CompletedQuantity;
- if ( CompletedQuantity > CompletedHadLessQuantity )
- {
- modelpt.Prod_Quantity = modelpt.Prod_Quantity - (CompletedQuantity - CompletedHadLessQuantity);
- LYFZ.Model.Model_ErpProductOutStorage modelOutStorage = new Model.Model_ErpProductOutStorage();
- modelOutStorage.Pos_OutQuantity = (CompletedQuantity - CompletedHadLessQuantity);
- modelOutStorage.Pos_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- modelOutStorage.Pos_ProductCategory = modelpt.Prod_Class;
- modelOutStorage.Pos_ProductNumber = modelpt.Prod_Number;
- modelOutStorage.Pos_Remark = "服务商品,服务完成自动出库";
- modelOutStorage.Pos_OutTime = StrTime;
- modelOutStorage.Pos_OutName = StrUserID;
- clist.Add( posbll.GetAddCommandInfo( modelOutStorage ) );
- }
- else
- {
- modelpt.Prod_Quantity = modelpt.Prod_Quantity + (CompletedHadLessQuantity - CompletedQuantity);
- LYFZ.Model.Model_ErpProductIntStorage modelIntStorage = new Model.Model_ErpProductIntStorage();
- modelIntStorage.Pis_PurchaseQuantity = (CompletedHadLessQuantity - CompletedQuantity);
- modelIntStorage.Pis_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- modelIntStorage.Pis_ProductCategory = modelpt.Prod_Class;
- modelIntStorage.Pis_ProductNumber = modelpt.Prod_Number;
- modelIntStorage.Pis_PurchasePrice = modelpt.Prod_CostPrice;
- modelIntStorage.Pis_PurchaseVendor = "";
- modelIntStorage.Pis_Remark = "服务商品,由已完成数量" + CompletedHadLessQuantity + "修改为" + CompletedQuantity;
- modelIntStorage.Pis_CreateName = StrUserID;
- modelIntStorage.Pis_CreateDatetime = StrTime;
- clist.Add( pisbll.GetAddCommandInfo( modelIntStorage ) );
- }
- }
- else
- {
- LYFZ.Model.Model_ErpProductIntStorage modelIntStorage = new Model.Model_ErpProductIntStorage();
- modelpt.Prod_Quantity = modelpt.Prod_Quantity + model.Ws_CompletedHadLessQuantity;
- modelIntStorage.Pis_PurchaseQuantity = model.Ws_CompletedHadLessQuantity;
- model.Ws_CompletedHadLessQuantity = 0;
- modelIntStorage.Pis_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- modelIntStorage.Pis_ProductCategory = modelpt.Prod_Class;
- modelIntStorage.Pis_ProductNumber = modelpt.Prod_Number;
- modelIntStorage.Pis_PurchasePrice = modelpt.Prod_CostPrice;
- modelIntStorage.Pis_PurchaseVendor = "";
- modelIntStorage.Pis_Remark = "服务商品,由已完成修改为未完成自动入库之前已出库的数量";
- modelIntStorage.Pis_CreateName = StrUserID;
- modelIntStorage.Pis_CreateDatetime = StrTime;
- clist.Add( pisbll.GetAddCommandInfo( modelIntStorage ) );
- }
- modelpt.Prod_UpdateDateTime = StrTime;
- modelpt.Prod_UpdateName = StrUserID;
- clist.Add( pdtbll.GetUpdateCommandInfo( modelpt ) );
- }
- return clist;
- }
- /// <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.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)
- {
- if (this.lstTextQuery.SelectedItem != null)
- {
- this.lstTextQuery.SelectedIndex = 0; this.lstTextQuery.Focus();
- }
- }
- }
- else if ( e.KeyCode == Keys.Enter )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.InputQueryClient( this.txtTextQuery, this.lstTextQuery, cameraType: Model.CameraType.服务客人);
- }
- }
- /// <summary>
- /// 文本框失去焦点事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtTextQuery_Leave( object sender, EventArgs e )
- {
- if ( !this.lstTextQuery.Focused )
- {
- this.lstTextQuery.Visible = false;
- }
- }
- /// <summary>
- /// 列表列双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellDoubleClick( object sender, DataGridViewCellEventArgs e )
- {
- if ( e.ColumnIndex >= 0 && e.RowIndex >= 0 )
- {
- this.cmbdgv.Visible = false;
- this.mskdgv.Visible = false;
- this.dtpcdgv.Visible = false;
- this.cmbtreevdgv.Visible = false;
- this.txtdgv.Visible = false;
- this.lstTextQuery.Visible = false;
- this.txtIntCount.Visible = false;
- if ( this.dgvData.CurrentRow.Cells["服务状态"].Value.ToString().Trim() != "OK" )
- {
- if ( String.IsNullOrEmpty( this.dgvData.Rows[e.RowIndex].Cells["ID"].Value.ToString() ) )
- {
- if ( this.dgvData.Columns[e.ColumnIndex].Name == "数量" )
- {
- DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
- Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
- this.txtIntCount.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y - 1 );
- this.txtIntCount.Size = rect.Size;
- this.txtIntCount.Visible = true;
- this.txtIntCount.Text = (String)cell.Value;
- this.txtIntCount.Focus();
- }
- else
- {
- return;
- }
- }
- DataTable dt = orbll.GetView_Custom( "tb_ErpWeddingService", StrWhere: "ID = '" + this.dgvData.Rows[e.RowIndex].Cells["ID"].Value + "'", ShowColumnName: "Ws_ReservationServiceDividedShop,Ws_WeddingDate,Ws_Serviceman1,Ws_Serviceman2,Ws_Remark" ).Tables[0];
- if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务门店" )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_ReservationServiceDividedShop"].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 ( !IsUpdateAnPai && dt.Rows.Count > 0 )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString() ) ) )
- {
- 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.Visible = true;
- this.dtpcdgv.DateValue = cell.Value.ToString().Trim();
- this.dtpcdgv.Focus();
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务时间" )//选择时间
- {
- if ( this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm" ) != "00:00" )
- {
- 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 = cell.Value.ToString().Trim();
- this.mskdgv.Tag = "S";
- this.mskdgv.Focus();
- }
- else {
- //选择时间
- DateTime dayDate = SDateTime.Now;
- string shopID = "";
- List<DateTime> dateTimes = GetDateTime();
- List<string> selectShopIDs = GetSelectShopID();
- if (dateTimes.Count > 0)
- {
- dayDate = dateTimes[0];
- }
- if (selectShopIDs.Count > 0)
- {
- shopID = selectShopIDs[0];
- }
- if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
- {
- if (selectShopIDs.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择要预约的门店");
- return;
- }
- }
- if (dateTimes.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择服务日期");
- return;
- }
- Model.CameraTimeTemplate cameraTime = PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.服务客人, this.GetCameraOrderType());
- if (cameraTime != null)
- {
- DataGridViewCell cell = this.dgvData.Rows[e.RowIndex].Cells[e.ColumnIndex];
- cell.Value = cameraTime.CameraTime;
- if (TimeTemplateKeyValues.ContainsKey(e.RowIndex))
- {
- this.TimeTemplateKeyValues.Remove(e.RowIndex);
- }
- this.TimeTemplateKeyValues.Add(e.RowIndex, cameraTime);
- this.dgvData.Rows[e.RowIndex].Tag = "1";
- }
- }
- }
- else
- {
- MessageBoxCustom.Show( "请先填服务日期" ); return;
- }
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务状态" )//选择状态
- {
- if ( this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- if ( this.dgvData.CurrentRow.Cells["服务人员1"].Value.ToString().Trim() != "" || this.dgvData.CurrentRow.Cells["服务人员2"].Value.ToString().Trim() != "" )
- {
- DataGridViewCell cell = this.dgvData.CurrentRow.Cells[e.ColumnIndex];
- Rectangle rect = this.dgvData.GetCellDisplayRectangle( cell.ColumnIndex, cell.RowIndex, true );
- this.cmbdgv.Items.Clear();
- for ( int i = 0; i < StrStatus.Length; i++ )
- {
- this.cmbdgv.Items.Add( StrStatus[i].Trim() );
- }
- this.cmbdgv.Location = new Point( rect.Location.X + this.dgvData.Location.X, rect.Location.Y + this.dgvData.Location.Y );
- this.cmbdgv.Size = rect.Size;
- this.cmbdgv.Visible = true;
- this.cmbdgv.Text = cell.Value.ToString().Trim();
- this.cmbdgv.Tag = "Z";
- this.cmbdgv.Focus();
- }
- else
- {
- MessageBoxCustom.Show( "服务人员必填一位" ); return;
- }
- }
- else
- {
- MessageBoxCustom.Show( "请先填服务日期" ); return;
- }
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务备注" )//选择状态
- {
- if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_Remark"].ToString() ) ) )
- {
- 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.Visible = true;
- this.txtdgv.Text = (String)cell.Value;
- this.txtdgv.Focus();
- this.txtdgv.Focus();
- }
- else if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务人员1" || this.dgvData.Columns[e.ColumnIndex].Name == "服务人员2" )
- {
- LYFZ.EnumPublic.EnumWorkPersonType WorkPersonType = EnumPublic.EnumWorkPersonType.服务师1;
- if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务人员1" )
- {
- if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_Serviceman1"].ToString() ) ) )
- {
- return;
- }
- }
- WorkPersonType = EnumPublic.EnumWorkPersonType.服务师1;
- }
- if ( this.dgvData.Columns[e.ColumnIndex].Name == "服务人员2" )
- {
- if ( !IsUpdateAnPai && dt.Rows.Count > 0 )
- {
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_Serviceman2"].ToString() ) ) )
- {
- return;
- }
- }
- WorkPersonType = EnumPublic.EnumWorkPersonType.服务师2;
- }
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
- frm.StrTime = this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim();
- frm.WorkPersonType = WorkPersonType;
- 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 { MessageBoxCustom.Show( "此服务已结束不能再修改!" ); return; }
- }
- }
- /// <summary>
- /// 服务人员失去焦点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevdgv_Leave( object sender, EventArgs e )
- {
- if ( this.cmbtreevdgv.StrKey != null )
- {
- if ( this.cmbtreevdgv.StrKey.ToString().Trim() == "R1" )
- {
- this.dgvData.CurrentRow.Cells["服务人员1"].Value = this.cmbtreevdgv.Text.Trim();
- if ( this.cmbtreevdgv.Text != "" )
- {
- this.dgvData.CurrentRow.Cells["服务人员1"].Tag = this.cmbtreevdgv.Tag.ToString().Trim();
- }
- else { this.dgvData.CurrentRow.Cells["服务人员1"].Tag = null; }
- }
- if ( this.cmbtreevdgv.StrKey.ToString().Trim() == "R2" )
- {
- this.dgvData.CurrentRow.Cells["服务人员2"].Value = this.cmbtreevdgv.Text.Trim(); if ( this.cmbtreevdgv.Text != "" )
- {
- this.dgvData.CurrentRow.Cells["服务人员2"].Tag = this.cmbtreevdgv.Tag.ToString().Trim();
- }
- else { this.dgvData.CurrentRow.Cells["服务人员2"].Tag = null; }
- }
- this.dgvData.CurrentRow.Tag = "1";
- this.cmbtreevdgv.Visible = false;
- }
- }
- /// <summary>
- /// 选择门店
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevStoreName_Leave( object sender, EventArgs e )
- {
- if ( this.cmbtreevStoreName.StrKey != null )
- {
- if ( this.cmbtreevStoreName.StrKey.ToString().Trim() == "F" )
- {
- if ( this.cmbtreevStoreName.Text.Trim() != "" )
- {
- this.dgvData.CurrentRow.Cells["服务门店"].Value = this.cmbtreevStoreName.Text.Trim();
- this.dgvData.CurrentRow.Cells["服务门店"].Tag = this.cmbtreevStoreName.Tag;
- }
- else
- {
- this.dgvData.CurrentRow.Cells["服务门店"].Value = "";
- this.dgvData.CurrentRow.Cells["服务门店"].Tag = null;
- }
- this.dgvData.CurrentRow.Tag = "1";
- }
- this.cmbtreevStoreName.Visible = false;
- }
- }
- /// <summary>
- /// 下拉选择失去焦点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbdgv_Leave( object sender, EventArgs e )
- {
- if ( this.cmbdgv.Tag != null )
- {
- if ( this.cmbdgv.Tag.ToString().Trim() == "Z" )
- {
- this.dgvData.CurrentRow.Cells["服务状态"].Value = this.cmbdgv.Text.Trim();
- }
- this.dgvData.CurrentRow.Cells["服务状态"].Tag = "1";
- this.dgvData.CurrentRow.Tag = "1";
- this.cmbdgv.Visible = false;
- }
- }
- /// <summary>
- /// 下拉选择失去焦点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void mskdgv_Leave( object sender, EventArgs e )
- {
- if ( this.mskdgv.Tag != null )
- {
- if ( this.mskdgv.Tag.ToString().Trim() == "S" )
- {
- 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.Cells["服务时间"].Tag = "1";
- this.dgvData.CurrentRow.Tag = "1";
- }
- this.mskdgv.Visible = false;
- }
- }
- /// <summary>
- /// 备注离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtdgv_Leave( object sender, EventArgs e )
- {
- this.dgvData.CurrentRow.Cells["服务备注"].Value = this.txtdgv.Text.Trim();
- this.dgvData.CurrentRow.Tag = "1";
- this.txtdgv.Visible = false;
- }
- /// <summary>
- /// 数量离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtIntCount_Leave( object sender, EventArgs e )
- {
- this.dgvData.CurrentRow.Cells["数量"].Value = this.txtIntCount.Text.Trim();
- this.dgvData.CurrentRow.Tag = "1";
- this.txtIntCount.Visible = false;
- }
- /// <summary>
- /// 日期控件失去焦点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dtpcdgv_Leave( object sender, EventArgs e )
- {
- if ( this.dgvData.CurrentCell.ColumnIndex == this.dgvData.Columns["服务日期"].Index )
- {
- if ( this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim() != this.dtpcdgv.DateValue.Trim() && !string.IsNullOrEmpty( this.dtpcdgv.DateValue.Trim() ) )
- {
- this.dgvData.CurrentRow.Cells["服务日期"].Tag = "1";
- }
- if ( !string.IsNullOrEmpty( this.dtpcdgv.DateValue.Trim() ) )
- {
- if ( !string.IsNullOrEmpty( this.dgvData.CurrentRow.Cells["服务人员1"].Value.ToString().Trim() ) )
- {
- if ( this.dgvData.CurrentRow.Cells["服务人员1"].Tag != null )
- {
- if ( LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetRestPerson( this.dtpcdgv.DateValue.Trim(), this.dgvData.CurrentRow.Cells["服务人员1"].Tag.ToString().Trim() ) )
- {
- MessageBoxCustom.Show( this.dgvData.CurrentRow.Cells["服务人员1"].Value.ToString().Trim() + " '" + this.dtpcdgv.DateValue.Trim() + "'休息,不能安排工作!" );
- this.dtpcdgv.DateValue = "";
- this.dtpcdgv.Focus();
- return;
- }
- }
- }
- if ( !string.IsNullOrEmpty( this.dgvData.CurrentRow.Cells["服务人员2"].Value.ToString().Trim() ) )
- {
- if ( this.dgvData.CurrentRow.Cells["服务人员2"].Tag != null )
- {
- if ( LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetRestPerson( this.dtpcdgv.DateValue.Trim(), this.dgvData.CurrentRow.Cells["服务人员2"].Tag.ToString().Trim() ) )
- {
- MessageBoxCustom.Show( this.dgvData.CurrentRow.Cells["服务人员2"].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.Cells["服务时间"].Value = "";
- }
- this.dgvData.CurrentRow.Tag = "1";
- }
- this.dtpcdgv.Text = "";
- this.dtpcdgv.Visible = false;
- }
- /// <summary>
- /// 绑定
- /// </summary>
- /// <param name="WsNumber"></param>
- void GetOrdNumberGetData()
- {
- string strWhere = "";
- string strWhere2 = "";
- if ( !string.IsNullOrEmpty( this.OrdNumber ) )
- {
- strWhere = " Ord_Number = '" + this.OrdNumber + "'";
- strWhere2 = " and Ws_Number = '" + this.OrdNumber + "'";
- }
- else
- {
- strWhere = " tb_ErpOrder.ID = '0' ";
- strWhere2 = " and tb_ErpWeddingService.ID = '0'";
- }
- string strViewName = "tb_ErpOrder Left Join dbo.tb_ErpOrderDigital ON Ord_Number = Ordv_Number " +
- "left join dbo.tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber";
- string strColumnName = "Ord_DividedShop," +
- "M_Cus_CustomerNumber," +
- "Cus_Name," +
- "Cus_Sex_cs," +
- "Ord_SeriesPrice," +
- "Ordv_IntoRegisterQuantity," +
- "Ordv_IntoBottomQuantity," +
- "CASE [Ord_SinceOrderNumber] WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS ShowOrdNumber," +
- "Ord_SeriesName,Ord_Type," +
- "(select stuff((select ',' + dbo.fn_CheckUserIDGetUserName( OrdPe_OrdersPerson) from tb_ErpOrdersPerson where OrdPe_OrderNumber=Ord_Number for xml path('')),1,1,'')) as OrdPe_OrdersPerson," +
- "Ordv_ViceNumber," +
- "Case when Ord_Type = '1' then (select top 1 Ordpg_Sights from dbo.tb_ErpOrdersPhotography where Ordpg_Number = Ordv_Number and Ordpg_ViceNumber = Ordv_ViceNumber) else '' end AS Ordpg_Sights";
- string strColumnName2 = "tb_ErpWeddingService.ID," +
- "Ws_ProdNumber," +
- "Ws_Type," +
- "Ws_ProdCostPrice," +
- "Ws_ProdSoldPrice," +
- "Ws_ProdName AS 服务内容," +
- "Ws_ProdQuantity AS 数量," +
- "Company_Name AS 服务门店," +
- "Company_DividedShop AS 门店编号," +
- "dbo.fn_CheckWeddingServiceStatus(Ws_Status) AS 服务状态," +
- "dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Ws_WeddingDate)) AS 服务日期," +
- "dbo.fn_CheckDateTimeReturn_Time(dbo.fn_CheckDateTime(Ws_WeddingDate)) AS 服务时间," +
- "Ws_Serviceman1 AS 服务人员1," +
- "Ws_Serviceman2 AS 服务人员2," +
- "Ws_Remark AS 服务备注";
- string ExecuteSql = orbll.GetView_CustomReturnExecuteSql( strViewName, StrWhere: strWhere, ShowColumnName: strColumnName );
- ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql( "tb_ErpWeddingService Left Join tb_ErpCompanyInfo on Company_DividedShop = Ws_ReservationServiceDividedShop", StrWhere: " (Ws_Type = '1' or Ws_Type = '2') " + strWhere2, ShowColumnName: strColumnName2 );
- DataSet dtSet = orbll.GetView_Custom( ExecuteSql );
- DataTable tblOrder = dtSet.Tables["ds"];
- DataTable tblWedding = dtSet.Tables["ds1"];
- if ( this.dgvData.Columns.Count <= 0 )
- {
- for ( int i = 0; i < tblWedding.Columns.Count; i++ )
- {
- if ( tblWedding.Columns[i].ColumnName.Trim() != "门店编号" )
- {
- DataGridViewColumn dc = new DataGridViewColumn();
- dc.HeaderText = tblWedding.Columns[i].ColumnName.Trim();
- dc.Name = tblWedding.Columns[i].ColumnName.Trim();
- switch ( dc.Name.Trim() )
- {
- case "ID":
- case "Ws_ProdNumber":
- case "Ws_Type":
- case "Ws_ProdCostPrice":
- case "Ws_ProdSoldPrice":
- dc.Visible = false; break;
- case "服务备注": dc.Width = 240; break;
- case "数量": dc.Width = 80; break;
- default: break;
- }
- dc.ReadOnly = true;
- this.dgvData.Columns.Add( dc );
- }
- }
- }
- this.dgvData.Rows.Clear();
- if ( tblOrder.Rows.Count > 0 )
- {
- if ( tblOrder.Rows[0]["Ord_DividedShop"].ToString().Trim() != LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID() )
- {
- if ( MessageBoxCustom.Show( "'" + tblOrder.Rows[0]["ShowOrdNumber"].ToString().Trim() + "'订单不属于本店所开,是否要继续安排?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.No )
- {
- return;
- }
- }
- if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
- {
- if (this.currentSelectCameraTime != null)
- {
- if (tblOrder.Rows[0]["Ord_Type"].ToString().Trim() != this.currentSelectCameraTime.DayTemplate.OrderType.ToString())
- {
- MessageBoxCustom.Show(this.currentSelectCameraTime.GetPromptInfo());
- return;
- }
- }
- }
- this.tx_serial_price.Text = tblOrder.Rows[0]["Ord_SeriesPrice"].ToString().Trim();
- this.tx_rdrc.Text = string.Format( "{0}\\{1}", tblOrder.Rows[0]["Ordv_IntoBottomQuantity"].ToString().Trim(), tblOrder.Rows[0]["Ordv_IntoRegisterQuantity"].ToString().Trim() );
- this.txtOrderNumber.Text = tblOrder.Rows[0]["ShowOrdNumber"].ToString().Trim();
- this.txtSeriesName.Text = tblOrder.Rows[0]["Ord_SeriesName"].ToString().Trim();
- this.txtOrdersPerson.Text = tblOrder.Rows[0]["OrdPe_OrdersPerson"].ToString().Trim();
- DataTable tblClientWedding = orbll.GetView_Custom( "tb_ErpCustomer", StrWhere: "Cus_CustomerNumber = '" + tblOrder.Rows[0]["M_Cus_CustomerNumber"].ToString().Trim() + "'", ShowColumnName: "Cus_DayForMarriage,Cus_DayForMarriageLunar" ).Tables[0];
- if ( tblClientWedding.Rows.Count > 0 )
- {
- this.txtWedding.Text = LYFZ.Command.Command_Validate.DateTimeToString( tblClientWedding.Rows[0]["Cus_DayForMarriage"] );
- this.chkWedding.Checked = false;
- if ( LYFZ.Command.Command_Validate.DateTimeToString( tblClientWedding.Rows[0]["Cus_DayForMarriage"] ) != "" )
- {
- if ( tblClientWedding.Rows[0]["Cus_DayForMarriageLunar"].ToString().Trim() == "1" )
- {
- this.chkWedding.Checked = true;
- }
- }
- }
- this.StrOrdType = tblOrder.Rows[0]["Ord_Type"].ToString().Trim();
- this.SetClientData( tblOrder.Rows[0]["Cus_Name"].ToString().Trim(), tblOrder.Rows[0]["Cus_Sex_cs"].ToString().Trim(), tblOrder.Rows[0]["Ord_Type"].ToString().Trim() );
- //DataGridViewCell cellShopID = null;
- // DataGridViewCell cellDate = null;
- // DataGridViewCell cellTime = null;
- for ( int i = 0; i < tblWedding.Rows.Count; i++ )
- {
- DataGridViewRow dgvl = new DataGridViewRow();
- DataGridViewCell cell = null;
- for ( int j = 0; j < tblWedding.Columns.Count; j++ )
- {
- if ( tblWedding.Columns[j].ColumnName.Trim() != "门店编号" )
- {
- cell = new DataGridViewTextBoxCell();
- switch ( tblWedding.Columns[j].ColumnName.Trim() )
- {
- case "服务门店":
- // cellShopID = cell;
- cell.Value = tblWedding.Rows[i][tblWedding.Columns[j].ColumnName].ToString().Trim();
- cell.Tag = tblWedding.Rows[i]["门店编号"].ToString().Trim();
- break;
- case "服务人员1":
- case "服务人员2":
- cell.Value = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName( tblWedding.Rows[i][tblWedding.Columns[j].ColumnName] );
- cell.Tag = tblWedding.Rows[i][tblWedding.Columns[j].ColumnName].ToString().Trim();
- break;
- default: cell.Value = tblWedding.Rows[i][tblWedding.Columns[j].ColumnName].ToString().Trim(); break;
- }
- dgvl.Cells.Add( cell );
- }
- }
- this.dgvData.Rows.Add( dgvl );
- }
- }
- }
- /// <summary>
- /// 设计加载的项
- /// </summary>
- /// <param name="StrName"></param>
- /// <param name="StrSex"></param>
- /// <param name="StrOrderType"></param>
- void SetClientData( string StrName, string StrSex, string StrOrderType )
- {
- string[] StrNameArray = StrName.Trim().Split( '/' );
- string[] StrSexArray = StrSex.Trim().Split( '/' );
- this.btnUpdate.Visible = false;
- this.panelWedding.Visible = false;
- if ( StrOrderType.Trim() == "0" || StrOrderType.Trim() == "4" )
- {
- 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();
- }
- }
- this.panelWedding.Visible = true;
- }
- 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();
- this.btnUpdate.Visible = true;
- this.panelWedding.Visible = true;
- }
- //lblName1.Location = new Point(15, lblName1.Location.Y);
- //lblName2.Location = new Point(311, lblName1.Location.Y);
- }
- /// <summary>
- /// 设计加载的项
- /// </summary>
- void SetClientData()
- {
- string StrOrderType = LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.GetVersion();
- this.panelWedding.Visible = false;
- if ( StrOrderType.Trim() == "-1" )
- {
- lblName1.Text = "男/家姓名:";
- lblName2.Text = "女/宝姓名:";
- //lblName1.Location = new Point(10, lblName1.Location.Y);
- //lblName2.Location = new Point(lblName1.Location.X, lblName2.Location.Y);
- }
- else if ( StrOrderType.Trim() == "2" )
- {
- lblName1.Text = "客户姓名:";
- lblName2.Text = "客户性别:";
- }
- else if ( StrOrderType.Trim() == "0" )
- {
- lblName1.Text = "男宾姓名:";
- lblName2.Text = "女宾姓名:";
- this.panelWedding.Visible = true;
- }
- else if ( StrOrderType.Trim() == "1" )
- {
- lblName1.Text = "家长姓名:";
- lblName2.Text = "宝贝姓名:";
- }
- //lblName1.Location = new Point(15, lblName1.Location.Y);
- //lblName2.Location = new Point(lblName1.Location.X, lblName2.Location.Y);
- }
- /// <summary>
- /// 列表列点击事件(右键)
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_CellMouseDown( object sender, DataGridViewCellMouseEventArgs e )
- {
- if ( e.Button == MouseButtons.Right )
- {
- if ( e.ColumnIndex != -1 && e.RowIndex != -1 )
- {
- ToolStripMenuItem item = null;
- #region 日期
- 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 );
- }
- 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 );
- }
- if ( e.ColumnIndex == this.dgvData.Columns["服务状态"].Index )
- {
- //弹出操作菜单
- item = new ToolStripMenuItem();
- item.Text = "清空值";
- item.Tag = "StrStatus";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "未开始";
- item.Tag = "StrStatus";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "OK";
- item.Tag = "StrStatus";
- this.dgvData.conMenu.Items.Add( item );
- }
- if ( e.ColumnIndex == this.dgvData.Columns["服务人员1"].Index )
- {
- //弹出操作菜单
- item = new ToolStripMenuItem();
- item.Text = "清空值";
- item.Tag = "STrCmbTreeV1";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "选择人员";
- item.Tag = "STrCmbTreeV1";
- this.dgvData.conMenu.Items.Add( item );
- }
- if ( e.ColumnIndex == this.dgvData.Columns["服务人员2"].Index )
- {
- //弹出操作菜单
- item = new ToolStripMenuItem();
- item.Text = "清空值";
- item.Tag = "STrCmbTreeV2";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "选择人员";
- item.Tag = "STrCmbTreeV2";
- this.dgvData.conMenu.Items.Add( item );
- }
- if ( e.ColumnIndex == this.dgvData.Columns["服务备注"].Index )
- {
- //弹出操作菜单
- item = new ToolStripMenuItem();
- item.Text = "清空值";
- item.Tag = "StrText";
- this.dgvData.conMenu.Items.Add( item );
- item = new ToolStripMenuItem();
- item.Text = "填写备注";
- item.Tag = "StrText";
- this.dgvData.conMenu.Items.Add( item );
- }
- #endregion
- }
- }
- }
- /// <summary>
- /// 获取预约门店ID
- /// </summary>
- /// <returns></returns>
- List<string> GetSelectShopID()
- {
- List<string> shopIDlist = new List<string>();
- foreach (DataGridViewRow dataGridView in this.dgvData.SelectedRows)
- {
- if (dataGridView.Cells["服务门店"].Tag != null)
- {
- string shopID = dataGridView.Cells["服务门店"].Tag.ToString();
- if (!shopIDlist.Any(s => s.ToLower() == shopID.ToLower()))
- {
- shopIDlist.Add(shopID);
- }
- }
- }
- if (shopIDlist.Count > 1)
- {
- MessageBoxCustom.Show("不能同时预约不同门店的摄控时间");
- }
- return shopIDlist;
- }
- /// <summary>
- /// 获取预约日期
- /// </summary>
- /// <returns></returns>
- List<DateTime> GetDateTime()
- {
- List<DateTime> dateTimelist = new List<DateTime>();
- foreach (DataGridViewRow dataGridView in this.dgvData.SelectedRows)
- {
- if (dataGridView.Cells["服务日期"].Value != null)
- {
- string dateTimeString = dataGridView.Cells["服务日期"].Value.ToString();
- if (!String.IsNullOrWhiteSpace(dateTimeString))
- {
- if (!dateTimelist.Any(d => d.ToYYYY_MM_dd().ToLower() == dateTimeString.ToLower()))
- {
- dateTimelist.Add(Convert.ToDateTime(dateTimeString));
- }
- }
- }
- }
- if (dateTimelist.Count > 1)
- {
- MessageBoxCustom.Show("不能同时预约不同日期的摄控时间");
- }
- return dateTimelist;
- }
- /// <summary>
- /// 右键菜单选择项事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void dgvData_DataGridViewConMenu_ItemClicked( object sender, ToolStripItemClickedEventArgs e )
- {
- ToolStripItem item = e.ClickedItem;
- #region
- 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_ErpWeddingService", StrWhere: "ID in (" + strID.TrimEnd( ',' ) + ")", ShowColumnName: "ID,Ws_WeddingDate,Ws_Serviceman1,Ws_Serviceman2,Ws_Remark" ).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++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- if ( this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != frm.StrValue.Trim() && !string.IsNullOrEmpty( frm.StrValue.Trim() ) )
- {
- this.dgvData.SelectedRows[i].Cells["服务日期"].Tag = "1";
- }
- this.dgvData.SelectedRows[i].Cells["服务日期"].Value = frm.StrValue;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != frm.StrValue.Trim() && !string.IsNullOrEmpty( frm.StrValue.Trim() ) )
- {
- this.dgvData.SelectedRows[i].Cells["服务日期"].Tag = "1";
- }
- this.dgvData.SelectedRows[i].Cells["服务日期"].Value = frm.StrValue;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- }
- }
- else
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务日期"].Value = "";
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务日期"].Value = "";
- 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++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm" ) != "00:00" && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务时间"].Value = frm.StrValue;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务时间"].Value = frm.StrValue;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- }*/
- DateTime dayDate = SDateTime.Now;
- string shopID = "";
- List<DateTime> dateTimes = GetDateTime();
- List<string> selectShopIDs = GetSelectShopID();
- if (dateTimes.Count > 0)
- {
- dayDate = dateTimes[0];
- }
- if (selectShopIDs.Count > 0)
- {
- shopID = selectShopIDs[0];
- }
- if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
- {
- if (selectShopIDs.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择要预约的门店");
- return;
- }
- }
- if (dateTimes.Count <= 0)
- {
- MessageBoxCustom.Show("需要先选择服务日期");
- return;
- }
- Model.CameraTimeTemplate cameraTime = PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.服务客人, this.GetCameraOrderType());
- if (cameraTime != null)
- {
- for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- {
- if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
- {
- if (dt.Rows.Count > 0)
- {
- DataRow dtRow = dt.Rows.Find(dt.Rows[0]["ID"]);
- if (!string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(dtRow["Ws_WeddingDate"].ToString())) && LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm") != "00:00" && !IsUpdateAnPai)
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务时间"].Value = cameraTime.CameraTime;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务时间"].Value = cameraTime.CameraTime;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- 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);
-
- }
- }
- }
- }
- else
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_WeddingDate"].ToString() ) ) && LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[0]["Ws_WeddingDate"].ToString(), "HH:mm" ) != "00:00" && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务时间"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务时间"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- }
- }
- else if ( item.Tag.ToString().Trim() == "StrStatus" )
- {
- if ( item.Text.Trim() != "清空值" )
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" && (this.dgvData.SelectedRows[i].Cells["服务人员1"].Value.ToString().Trim() != "" || this.dgvData.SelectedRows[i].Cells["服务人员2"].Value.ToString().Trim() != "") )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != item.Text.Trim() && !string.IsNullOrEmpty( item.Text.Trim() ) )
- {
- this.dgvData.SelectedRows[i].Cells["服务状态"].Tag = "1";
- }
- this.dgvData.SelectedRows[i].Cells["服务状态"].Value = item.Text.Trim();
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- else
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" )
- {
- this.dgvData.SelectedRows[i].Cells["服务状态"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- }
- else if ( item.Tag.ToString().Trim() == "StrText" )
- {
- if ( item.Text.Trim() == "填写备注" )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetTextRemarkSuperSmallForm frm = new SuperSmallForm.GetTextRemarkSuperSmallForm();
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Remark"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务备注"].Value = frm.StrValue; this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务备注"].Value = frm.StrValue; this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- }
- else
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Remark"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务备注"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务备注"].Value = ""; this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- }
- }
- else if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" || item.Tag.ToString().Trim() == "STrCmbTreeV2" )
- {
- if ( item.Text.Trim() == "选择人员" )
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectWorkPersonSuperSmallForm frm = new SuperSmallForm.SelectWorkPersonSuperSmallForm();
- frm.StrTime = this.dgvData.CurrentRow.Cells["服务日期"].Value.ToString().Trim();
- if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" )
- {
- frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.服务师1;
- }
- else
- {
- frm.WorkPersonType = LYFZ.EnumPublic.EnumWorkPersonType.服务师2;
- }
- frm.ShowDialog();
- if ( frm.IsSaveed )
- {
- for ( int i = 0; i < this.dgvData.SelectedRows.Count; i++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman1"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = frm.StrPersonName;
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = frm.StrPersonNumber;
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = frm.StrPersonName;
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = frm.StrPersonNumber;
- }
- }
- else if ( item.Tag.ToString().Trim() == "STrCmbTreeV2" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman2"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = frm.StrPersonName;
- this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = frm.StrPersonNumber;
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = frm.StrPersonName;
- this.dgvData.SelectedRows[i].Cells["服务人员2"].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++ )
- {
- if ( this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "" )
- {
- if ( item.Tag.ToString().Trim() == "STrCmbTreeV1" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman1"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = "";
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = null;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = "";
- this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = null;
- this.dgvData.SelectedRows[i].Tag = "1";
- }
- }
- else if ( item.Tag.ToString().Trim() == "STrCmbTreeV2" )
- {
- if ( dt.Rows.Count > 0 )
- {
- DataRow dtRow = dt.Rows.Find( dt.Rows[0]["ID"] );
- if ( !string.IsNullOrEmpty( LYFZ.Command.Command_Validate.DateTimeToString( dtRow["Ws_Serviceman2"].ToString() ) ) && !IsUpdateAnPai )
- {
- return;
- }
- this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = "";
- this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = null;
- }
- else
- {
- this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = "";
- this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = null;
- }
- }
- this.dgvData.CurrentRow.Tag = "1";
- }
- }
- }
- }
- //else if (item.Tag.ToString().Trim() == "STrCmbTreeV1")
- //{
- // if (item.Text.Trim() == "选择人员")
- // {
- // LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetPeopleSuperSmallForm frm = new SuperSmallForm.GetPeopleSuperSmallForm();
- // frm.ShowDialog();
- // if (frm.IsOK)
- // {
- // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- // {
- // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
- // {
- // string[] strValues = frm.StrValue.Split(',');
- // this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = strValues[0];
- // this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = strValues[1];
- // this.dgvData.SelectedRows[i].Tag = "1";
- // }
- // }
- // }
- // }
- // else
- // {
- // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- // {
- // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
- // {
- // this.dgvData.SelectedRows[i].Cells["服务人员1"].Value = "";
- // this.dgvData.SelectedRows[i].Cells["服务人员1"].Tag = null;
- // this.dgvData.SelectedRows[i].Tag = "1";
- // }
- // }
- // }
- //}
- //else if (item.Tag.ToString().Trim() == "STrCmbTreeV2")
- //{
- // if (item.Text.Trim() == "选择人员")
- // {
- // LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.GetPeopleSuperSmallForm frm = new SuperSmallForm.GetPeopleSuperSmallForm();
- // frm.ShowDialog();
- // if (frm.IsOK)
- // {
- // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- // {
- // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
- // {
- // string[] strValues = frm.StrValue.Split(',');
- // this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = strValues[0];
- // this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = strValues[1];
- // this.dgvData.SelectedRows[i].Tag = "1";
- // }
- // }
- // }
- // }
- // else
- // {
- // for (int i = 0; i < this.dgvData.SelectedRows.Count; i++)
- // {
- // if (this.dgvData.SelectedRows[i].Cells["服务状态"].Value.ToString().Trim() != "OK" && this.dgvData.SelectedRows[i].Cells["服务日期"].Value.ToString().Trim() != "")
- // {
- // this.dgvData.SelectedRows[i].Cells["服务人员2"].Value = "";
- // this.dgvData.SelectedRows[i].Cells["服务人员2"].Tag = null;
- // this.dgvData.SelectedRows[i].Tag = "1";
- // }
- // }
- // }
- //}
- #endregion
- }
- /// <summary>
- /// 限制数量输入规则
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtIntCount_KeyPress( object sender, KeyPressEventArgs e )
- {
- if ( !Char.IsNumber( e.KeyChar ) && !Char.IsControl( e.KeyChar ) )
- {
- e.Handled = true;
- }
- }
- }
- }
|