123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316 |
- using LYFZ.BLL;
- using LYFZ.ComponentLibrary;
- using LYFZ.Helper;
- using LYFZ.Model;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.NewCameraControlBook
- {
- public partial class MainCameraControlBook : LYFZ.Software.NewCameraControlBook.MainCameraControlBook
- {
- PanelToDataTableView PanelDataView = null;
- public MainCameraControlBook()
- {
- this.IsShowUcNavigationTool = false;
- this.plCalendarInfo.Hide();
- this.plCalendarToolbar.BorderColor = UIBlueThemeResources.BorderAreaColor;
- this.plCalendarToolbar.BorderStyle = BorderStyle.None;
- this.plCalendarInfo.BorderColor = UIBlueThemeResources.BorderAreaColor;
- this.plCalendarInfo.BorderStyle = BorderStyle.FixedSingle;
- this.nudYears.Value = SDateTime.Now.Year;
- this.nudMonth.Value = SDateTime.Now.Month;
- this.Load += MainCameraControlBook_Load;
- this.Shown += MainCameraControlBook_Shown;
- this.plCalendarTable.Paint += PlCalendarTable_Paint;
- this.nudYears.ValueChanged += NudYears_ValueChanged;
- this.nudMonth.ValueChanged += NudMonth_ValueChanged;
- this.plCalendarTable.Height = weekTitleHeight + weekContentHeight * weekRowCount + 20;
- this.plCalendarTable.MouseMove += PlCalendarTable_MouseMove;
- this.plCalendarTable.MouseUp += PlCalendarTable_MouseUp;
- this.plCalendarTable.MouseDoubleClick += PlCalendarTable_MouseDoubleClick;
- this.cmenuCameraBook.ItemClicked += CmenuCameraBook_ItemClicked;
- this.cbxStoreList.SelectedIndexChanged += CbxStoreList_SelectedIndexChanged;
- this.cbxStoreList2.SelectedIndexChanged += CbxStoreList2_SelectedIndexChanged;
- this.plCalendarInfo.Paint += PlCalendarInfo_Paint;
- this.tabControlEx1.Selected += TabControlEx1_Selected;
- this.chbxFixedHeader.Click += ChbxFixedHeader_Click;
- this.btnUpdateQuery.Click += BtnUpdateQuery_Click;
- //第二选项卡
- this.dateTimePickerStar.ValueChanged += DateTimePickerStar_ValueChanged;
- this.dateTimePickerEnd.ValueChanged += DateTimePickerEnd_ValueChanged;
- this.lkBeforeDay.Click += BtnBeforeDay_Click;
- this.lkAfterDay.Click += BtnAfterDay_Click;
- this.lkNowaday.Click += BtnNowaday_Click;
- this.lkNearlyOneWeek.Click += BtnNearlyOneWeek_Click;
- this.lkNearlyHalfMonth.Click += BtnNearlyHalfMonth_Click;
- this.lkNearlyOneMonth.Click += BtnNearlyOneMonth_Click;
- this.likCustomColor.Click += BtnCustomColor_Click;
- this.btnSetTemplate.Click += BtnSetTemplate_Click;
- this.btnQuery.Click += BtnQuery_Click;
- this.PanelDataView = new PanelToDataTableView(this.plTbleContainer);
- //this.plTbleContainer.Controls.Add(this.PanelDataView);
-
- this.PanelDataView.EventCell_Click += PanelDataView_EventCell_Click;
- this.PanelDataView.EventCell_DoubleClick += PanelDataView_EventCell_DoubleClick;
- this.PanelDataView.EventCell_MouseEnter += PanelDataView_EventCell_MouseEnter;
- this.PanelDataView.EventCellThumbtack_MouseEnter += PanelDataView_EventCellThumbtack_MouseEnter;
- this.PanelDataView.EventCellThumbtack_DoubleClick += PanelDataView_EventCellThumbtack_DoubleClick;
- this.contextMenuStrip_Time.ItemClicked += ContextMenuStrip_Time_ItemClicked;
- this.contextMenuStrip_CustomLabel.ItemClicked += ContextMenuStrip_CustomLabel_ItemClicked;
- this.RegisteredRadioButtonEvent();
- this.RegisteredCheckBoxEvent();
- this.likUpPage.Click += LikUpPage_Click;
- this.likDownPage.Click += LikDownPage_Click;
- this.likStatisticsUnfinished.Click += LikStatisticsUnfinished_Click;
- this.likOverview.Click += LikOverview_Click;
- this.likCameraLogs.Click += LikCameraLogs_Click;
- this.likCameraQuer.Click += LikCameraQuer_Click;
- this.likSendSms.Click += LikSendSms_Click;
- this.likYuanGongDanQi.Click += LikYuanGongDanQi_Click;
- this.likJiLianRi.Click += LikJiLianRi_Click;
- // this.likcommunicationInfo.Click += LikcommunicationInfo_Click;
- // this.likAddCommunication.Click += LikAddCommunication_Click;
- this.likAnPaiKeFu.Click += LikAnPaiKeFu_Click;
- this.likConfirmDressing.Click += LikConfirmDressing_Click;
- this.likConfirmDressing.Hide();
- this.btnPrint.Click += btnPrint_Click;
- this.contextMenuStrip_OrderInfo.ItemClicked += ContextMenuStrip_OrderInfo_ItemClicked;
- this.btnReservation.Click += BtnReservation_Click;
- this.btnExport.Click += BtnExport_Click;
- this.btnSearch.Click += BtnSearch_Click;
- this.btnQueryAll.Click += BtnQueryAll_Click;
- this.txtKeyword.KeyUp += TxtKeyword_KeyUp;
- }
- private void TxtKeyword_KeyUp(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- this.BtnSearch_Click(null,null);
- }
- }
- private void BtnQueryAll_Click(object sender, EventArgs e)
- {
- this.ClearCondition();
- this.BindPanelDataView();
- }
- private void BtnSearch_Click(object sender, EventArgs e)
- {
- this.BindPanelDataView();
- }
- /// <summary>
- /// 清除条件
- /// </summary>
- void ClearCondition()
- {
- this.cbxOther.SelectedIndex = 0;
- this.cbxNotificationStatus.SelectedIndex = 0;
- if (this.cbxCustomLabel.Items.Count > 0)
- {
- this.cbxCustomLabel.SelectedIndex = 0;
- }
- this.txtKeyword.Text = "";
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnExport_Click(object sender, EventArgs e)
- {
- if (!LYFZ.BLL.BLL_ErpUser.IsAdministrator())
- {
- // if (!VerificationRights(this.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.DataExport))
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.DataExport))
- {
- MessageBoxCustom.Show("您没有导出当前门店摄控数据的权限!");
- return;
- }
- }
- if (this.PanelDataView.DataRowList.Count <= 0)
- {
- MessageBoxCustom.Show("没有数据可供导出");
- return;
- }
- SaveFileDialog saveFile = new SaveFileDialog();
- saveFile.Title = "导出数据报表文件";
- saveFile.Filter = "EXECL文件(*.xls) |*.xls |文本文件(*.txt) |*.txt |所有文件(*.*) |*.*";
- saveFile.FilterIndex = 1;
- if (saveFile.ShowDialog() == DialogResult.OK)
- {
- System.Data.DataTable m_table = new DataTable();
- m_table.TableName = "摄控预约数据";
- List<string> ColumnLis = new List<string>();
- for (int i = 0; i < this.PanelDataView.HeadColumnRow.DataColumnList.Count; i++)
- {
- ColumnLis.Add(this.PanelDataView.HeadColumnRow.DataColumnList[i].Text);
- m_table.Columns.Add(this.PanelDataView.HeadColumnRow.DataColumnList[i].Text);
- }
- foreach (PDataRow row in this.PanelDataView.DataRowList)
- {
- DataRow dataRow= m_table.NewRow();
- for (int i = 0; i < row.DataColumnList.Count; i++)
- {
- dataRow[i] = row.DataColumnList[i].Text;
- }
- m_table.Rows.Add(dataRow);
- }
- //行数不可以大于65536
- if (m_table.Rows.Count > 65536)
- {
- MessageBoxCustom.Show("数据记录数太多(最多不能超过65536条),不能保存 ");
- return;
- }
- string FileName = saveFile.FileName;
- try
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在导出...");
- if (LYFZ.WinAPI.CustomPublicMethod.DataGridViewToExcel(FileName, m_table, ColumnLis, backgroundWorker))
- {
- MessageBoxCustom.Show("导出成功");
- }
- else
- {
- MessageBoxCustom.Show("导出失败,请重试!");
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("导出成功数据时出错:{0}", ex.Message));
- }
- });
-
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show("导出失败,原因:" + ex.Message);
- }
- }
- }
- /// <summary>
- /// 客人预约
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnReservation_Click(object sender, EventArgs e)
- {
-
- LYFZ.Model.CameraControlTemplate cameraTemplate = null;
- CameraTimeTemplate cameraTime = null;
- /* if (this.PanelDataView.CurrentSelectRow != null)
- {
- cameraTemplate = (LYFZ.Model.CameraControlTemplate)this.PanelDataView.CurrentSelectRow.Tag;
- cameraTime = (CameraTimeTemplate)this.PanelDataView.CurrentSelectRow.DataColumnList[2].Tag;
- }*/
- if (this.StartReservation(cameraTemplate, cameraTime))
- {
- this.LoadTemplateData();
- }
- }
- /// <summary>
- /// 打印
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnPrint_Click(object sender, EventArgs e)
- {
- if (!LYFZ.BLL.BLL_ErpUser.IsAdministrator())
- {
- if (!VerificationRights(this.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.Print))
- {
- MessageBoxCustom.Show("您没有打印当前门店摄控数据的权限!");
- return;
- }
- }
- if (this.PanelDataView.CurrentSelectRow == null)
- {
- MessageBoxCustom.Show("请选客人");
- return;
- }
- // LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)this.PanelDataView.CurrentSelectRow.Tag;
- // CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.CurrentSelectRow.DataColumnList[2].Tag;
- // string StrOrdNumber = cameraTime.ReservationTime.OrderNumber;
- Hashtable htData = new Hashtable();
- if ((this.chkPortraitVersion.Checked && this.chkPortraitVersion.Visible) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.写真版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
- { htData["Ver"] = "2"; }
- else if ((this.chkDressVersion.Checked && this.chkDressVersion.Visible) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
- { htData["Ver"] = "0"; }
- else if ((this.chkKidsVersion.Checked && this.chkKidsVersion.Visible) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
- { htData["Ver"] = "1"; }
- else if ((!this.chkKidsVersion.Checked && !this.chkDressVersion.Checked && !this.chkPortraitVersion.Checked) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
- { htData["Ver"] = "-1"; }
- ArrayList Alist = new ArrayList();
- List<string> tempList = new List<string>();
- if (this.rdoService.Checked)//服务客人预约
- {
- for (int i = 0; i < this.PanelDataView.SelectRowList.Count; i++)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.SelectRowList[i].DataColumnList[2].Tag;
- if (cameraTime.Parameter.DataRows != null && cameraTime.Parameter.DataRows.Length > 0)
- {
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- string viceNumber = row["Ordv_ViceNumber"].ToString().Trim();
- if (!tempList.Any(v => v.ToLower() == viceNumber.ToLower()))
- {
- tempList.Add(viceNumber);
- }
- }
- }
- }
- if (tempList.Count == 0)
- {
- MessageBoxCustom.Show("请选择已预约的客人");
- return;
- }
- else
- {
- Alist.AddRange(tempList);
- }
- htData["Alist"] = Alist;
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.服务明细, ObjValue: htData);
- }
- else
- {
- if (this.rdoPhotographed.Checked)//拍照客人预约
- {
- for (int i = 0; i < this.PanelDataView.SelectRowList.Count; i++)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.SelectRowList[i].DataColumnList[2].Tag;
- if (cameraTime.Parameter.DataRows != null && cameraTime.Parameter.DataRows.Length > 0)
- {
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- string viceNumber = String.Format("{0}|{1}", row["Ordv_ViceNumber"].ToString().Trim(), row["拍摄名称"].ToString().Trim());
- if (!tempList.Any(v => v.ToLower() == viceNumber.ToLower()))
- {
- tempList.Add(viceNumber);
- }
- }
- }
- }
- if (tempList.Count == 0)
- {
- MessageBoxCustom.Show("请选择已预约的客人");
- return;
- }
- Alist.AddRange(tempList);
- }
- else
- {
- for (int i = 0; i < this.PanelDataView.SelectRowList.Count; i++)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.SelectRowList[i].DataColumnList[2].Tag;
- if (cameraTime.Parameter.DataRows != null && cameraTime.Parameter.DataRows.Length > 0)
- {
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- string viceNumber = row["Ordv_ViceNumber"].ToString().Trim();
- if (!tempList.Any(v => v.ToLower() == viceNumber.ToLower()))
- {
- tempList.Add(viceNumber);
- }
- }
- }
- }
- if (tempList.Count == 0)
- {
- MessageBoxCustom.Show("请选择已预约的客人");
- return;
- }
- else
- {
- Alist.AddRange(tempList);
- }
- }
- if (Alist.Count == 0)
- { return; }
- htData["Alist"] = Alist;
- if (this.rdoPhotographed.Checked)//拍照客人预约
- {
- htData["StrDate"] = this.dateTimePickerStar.Value.ToYYYY_MM_dd();
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectPrintTypeSuperSmallForm frm = new CameraControlBook.SuperSmallForm.SelectPrintTypeSuperSmallForm();
- frm.ShowDialog();
- if (frm.IsOk)
- {
- if (frm.StrEnumType == EnumPublic.PrintTypeEnum.订单预约单)
- {
- if (this.PanelDataView.SelectRowList.Count == 1)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.SelectRowList[0].DataColumnList[2].Tag;
- string orderNumber = cameraTime.ReservationTime.OrderNumber;
- if (!String.IsNullOrWhiteSpace(orderNumber))
- {
- BtnPrint_Click(orderNumber);
- }
- else
- {
- MessageBoxCustom.Show("请选择已预约的客人");
- return;
- }
- }
- else
- {
- MessageBoxCustom.Show("打印“订单预约单”时间只能选择一个订单");
- }
- }
- else
- {
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(frm.StrEnumType, ObjValue: htData);
- }
- }
- }
- else if (this.rdoFilmSelection.Checked)//选片客人
- { LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.选片明细表, ObjValue: htData); }
- else if (this.rdoLookDesign.Checked)//看版客人
- { LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.看设计明细表, ObjValue: htData); }
- else if (rdoTotakePiece.Checked)//取件客人
- {
- htData["TakePieceDate"] = this.dateTimePickerStar.Value.ToYYYY_MM_dd();
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.取件明细表, ObjValue: htData);
- }
- else
- { MessageBoxCustom.Show("此功能暂未开放"); }
- }
- }
- /// <summary>
- /// 打印订单(打印预约单)
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnPrint_Click(string OrderNumber)
- {
- if (!String.IsNullOrEmpty(OrderNumber))
- {
- LYFZ.Model.Model_ErpOrder currentOrderModel = orbll.GetModel(OrderNumber);
- if (currentOrderModel.ID > 0)
- {
- EnumPublic.OrderType OrderType = (EnumPublic.OrderType)Convert.ToInt32(currentOrderModel.Ord_Type);
- Hashtable htData = new Hashtable();
- htData["strNumber"] = OrderNumber.Trim();
- htData["strOrdType"] = OrderType.ToString().Trim();
- // 获取全部景点;
- List<ReportPrint.SetSmallForm.PrintPreviewSmallForm.ScenicSpot2> listScenicSpot = null;
- if (OrderType == EnumPublic.OrderType.儿童订单)
- {
- listScenicSpot = new List<ReportPrint.SetSmallForm.PrintPreviewSmallForm.ScenicSpot2>();
- DataTable tb_Data = DAL.DAL_ErpOrder.GetOrdersPhotographyData(OrderNumber);
- for (int i = 0; i < tb_Data.Rows.Count; i++)
- {
- ReportPrint.SetSmallForm.PrintPreviewSmallForm.ScenicSpot2 scenic = new ReportPrint.SetSmallForm.PrintPreviewSmallForm.ScenicSpot2();
- scenic.strScenicName = tb_Data.Rows[i]["景点名"].ToString();
- scenic.strViceNumber = tb_Data.Rows[i]["子单号"].ToString();
- listScenicSpot.Add(scenic);
- }
- }
- LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.订单预约单, htData, listScenicSpot);
- }
- else
- {
- MessageBoxCustom.Show("找不到要打印的订单号“" + OrderNumber + "”的订单");
- }
- }
- else
- {
- MessageBoxCustom.Show("订单号不能为空");
- }
- }
- /// <summary>
- /// 确认选衣
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void LikConfirmDressing_Click(object sender, EventArgs e)
- {
- if (this.PanelDataView.CurrentSelectRow == null)
- {
- MessageBoxCustom.Show("请选客人");
- return;
- }
- // LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)this.PanelDataView.CurrentSelectRow.Tag;
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.CurrentSelectRow.DataColumnList[2].Tag;
- string StrOrdNumber = cameraTime.ReservationTime.OrderNumber;
- if (!String.IsNullOrWhiteSpace(StrOrdNumber))
- {
- if (cameraTime.Parameter.DataRows != null && cameraTime.Parameter.DataRows.Length > 0)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.SelectDressConfirmSmallForm frm = new CameraControlBook.SmallForm.SelectDressConfirmSmallForm();
- frm.strViceNumber = cameraTime.Parameter.DataRows[0]["Ordv_ViceNumber"].ToString();
- frm.ShowDialog();
- if (frm.IsSave)
- { this.LoadTemplateData(); }
- }
- }
- else
- {
- MessageBoxCustom.Show("请选择已预约的客人");
- }
- }
- /// <summary>
- /// 客服安排
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void LikAnPaiKeFu_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ClientServiceTaskAnPaiSmallForm frm = new DoorCityProcess.SetSmallForm.ClientServiceTaskAnPaiSmallForm();
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.拍照客人;
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- switch (cameraType)
- {
- case CameraType.拍照客人:
- ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.拍照客人;
- break;
- case CameraType.选片客人:
- ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.选片客人;
- break;
- case CameraType.看版客人:
- ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.看版客人;
- break;
- case CameraType.取件客人:
- ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.取件客人;
- break;
- case CameraType.选衣客人:
- ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.选衣服客人;
- break;
- case CameraType.服务客人:
- ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.服务客人;
- break;
- case CameraType.爱婴上门:
- ClientServiceAnPai = EnumPublic.ClientServiceTaskItem.摄控医院客人;
- break;
- default:
- break;
- }
- this.ClientServiceAnPai(LYFZ.EnumPublic.ClientServiceTaskType.摄控确认, frm.model, ClientServiceAnPai);
- }
-
- }
- /// <summary>
- /// 安排客服
- /// </summary>
- /// <param name="dgvData"></param>
- /// <param name="modelClientServiceTask"></param>
- /// <param name="ClientServiceTaskType"></param>
- public void ClientServiceAnPai(LYFZ.EnumPublic.ClientServiceTaskType EnumTaskModule, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask, LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceTaskType)
- {
- if (this.PanelDataView.SelectRowList.Count<=0)
- {
- MessageBoxCustom.Show("请选择要添加沟通记录的客人");
- return;
- }
- string StrWhere = "";
- DateTime StrTime = SDateTime.Now;
- List<LYFZ.Helper.CommandInfo> clist = new List<CommandInfo>();
- LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask();
- LYFZ.Model.Model_ErpClientServiceTask modelCst = null;
- DataTable dtprompt = new DataTable();
- DataTable dt = orbll.GetView_Custom("tb_ErpClientServiceTask", StrWhere: "Cst_TaskItem = '" + ClientServiceTaskType.ToString().Trim() + "' And Cst_TaskTermTime = '" + modelClientServiceTask.StrDateTime + "' And Cst_CompletionIntStatus = 0", ShowColumnName: "*").Tables[0];
- #region 获取查询条件
- switch (ClientServiceTaskType)
- {
-
- case EnumPublic.ClientServiceTaskItem.选衣服客人:
- case EnumPublic.ClientServiceTaskItem.选片客人:
- case EnumPublic.ClientServiceTaskItem.看版客人:
- for (int i = 0; i < this.PanelDataView.SelectRowList.Count; i++)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.SelectRowList[i].DataColumnList[2].Tag;
- if (cameraTime.Parameter.DataRows != null)
- {
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- StrWhere += "'" + row["Ordv_ViceNumber"].ToString().Trim() + "',";
- }
- }
- }
- if (StrWhere.Trim().Length > 0)
- {
- StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.拍照客人:
- case EnumPublic.ClientServiceTaskItem.取件客人:
- case EnumPublic.ClientServiceTaskItem.服务客人:
- Hashtable htData = new Hashtable();
- for (int i = 0; i < this.PanelDataView.SelectRowList.Count; i++)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.SelectRowList[i].DataColumnList[2].Tag;
- if (cameraTime.Parameter.DataRows != null)
- {
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- htData[row["Ordv_ViceNumber"].ToString().Trim()] = row["Ordv_ViceNumber"].ToString().Trim();
- }
- }
- }
-
- foreach (string item in htData.Keys)
- {
- StrWhere += "'" + item + "',";
- }
- if (StrWhere.Trim().Length > 0)
- {
- StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
- case EnumPublic.ClientServiceTaskItem.摄控医院客人:
- for (int i = 0; i < this.PanelDataView.SelectRowList.Count; i++)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.SelectRowList[i].DataColumnList[2].Tag;
-
- if (cameraTime.Parameter.DataRows != null)
- {
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- StrWhere += "'" + row["ID"].ToString().Trim() + "',";
- }
- }
- }
- if (StrWhere.Trim().Length > 0)
- {
- StrWhere = "tb_ErpHospitalDispatchDoor.ID in (" + StrWhere.TrimEnd(',') + ")";
- }
- break;
-
- }
- #endregion
- #region 获取保存数据
- switch (ClientServiceTaskType)
- {
- case EnumPublic.ClientServiceTaskItem.选衣服客人:
- case EnumPublic.ClientServiceTaskItem.拍照客人:
- case EnumPublic.ClientServiceTaskItem.选片客人:
- case EnumPublic.ClientServiceTaskItem.看版客人:
- case EnumPublic.ClientServiceTaskItem.取件客人:
- case EnumPublic.ClientServiceTaskItem.服务客人:
- #region 按数码分
- if (StrWhere.Trim().Length > 0)
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tempTB_AggregationCustomer Left Join tb_ErpOrderDigitalStatus on Ords_OrdNumber = GP_OrderNumber Left Join tb_ErpOrder on Ord_Number = GP_OrderNumber", StrWhere: StrWhere, ShowColumnName: "GP_OrderNumber,GP_CustomerGroupID,Cus_Name,Ords_ViceNumber,Ord_SinceOrderNumber,Ords_SightsName").Tables[0];
- for (int i = 0; i < dtClientGroup.Rows.Count; i++)
- {
- DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim() + "'");
- if (dtRows.Length > 0)
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if (StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()))
- {
- continue;
- }
- if (StrUserName.Trim().Length > 0)
- {
- if (MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 拍摄名称'" + dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- continue;
- }
- }
- modelCst = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim();
- modelCst.Cst_SightsName = dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim();
- modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim();
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
- case EnumPublic.ClientServiceTaskItem.摄控医院客人:
- #region 摄控医院客人
- if (StrWhere.Trim().Length > 0)
- {
- DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpHospitalDispatchDoor Left Join tb_ErpHospitalClient on Hct_Oddnumber = Hdr_Number ", StrWhere: StrWhere, ShowColumnName: "tb_ErpHospitalDispatchDoor.ID,Hct_Oddnumber,Hct_CustomerName,Hct_MyselfMobile").Tables[0];
- for (int i = 0; i < dtClientGroup.Rows.Count; i++)
- {
- DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["ID"].ToString().Trim() + "'");
- if (dtRows.Length > 0)
- {
- string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]);
- if (StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()))
- {
- continue;
- }
- if (StrUserName.Trim().Length > 0)
- {
- if (MessageBoxCustom.Show("医院客户'" + dtClientGroup.Rows[i]["Hct_CustomerName"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Hct_MyselfMobile"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- continue;
- }
- }
- modelCst = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask);
- clist.Add(cstbll.GetUpdateCommandInfo(modelCst));
- }
- else
- {
- modelCst = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType);
- modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["ID"].ToString().Trim();
- modelCst.Cst_SightsName = "派单上门";
- modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim();
- modelCst.Cst_CreateDatetime = StrTime;
- clist.Add(cstbll.GetAddCommandInfo(modelCst));
- }
- }
- }
- #endregion
- break;
-
- }
- #endregion
- if (clist.Count > 0)
- {
- if (MessageBoxCustom.Show("您确定要安排吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- return;
- }
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- MessageBoxCustom.Show("安排成功!");
- }
- else
- {
- MessageBoxCustom.Show("安排失败!");
- }
- }
- else
- {
- MessageBoxCustom.Show("没有可以安排的数据!");
- }
- }
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- private void LikAddCommunication_Click(object sender, EventArgs e)
- {
- if (this.PanelDataView.CurrentSelectRow == null)
- {
- MessageBoxCustom.Show("请选择要添加沟通记录的客人");
- return;
- }
- // LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)this.PanelDataView.CurrentSelectRow.Tag;
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.CurrentSelectRow.DataColumnList[2].Tag;
- string StrOrdNumber = cameraTime.ReservationTime.OrderNumber;
- LYFZ.EnumPublic.ClientServiceTaskItem inputType = EnumPublic.ClientServiceTaskItem.拍照客人;
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- switch (cameraType)
- {
- case CameraType.拍照客人:
- inputType = EnumPublic.ClientServiceTaskItem.拍照客人;
- break;
- case CameraType.选片客人:
- inputType = EnumPublic.ClientServiceTaskItem.选片客人;
- break;
- case CameraType.看版客人:
- inputType = EnumPublic.ClientServiceTaskItem.看版客人;
- break;
- case CameraType.取件客人:
- inputType = EnumPublic.ClientServiceTaskItem.取件客人;
- break;
- case CameraType.选衣客人:
- inputType = EnumPublic.ClientServiceTaskItem.选衣服客人;
- break;
- case CameraType.服务客人:
- inputType = EnumPublic.ClientServiceTaskItem.服务客人;
- break;
- default:
-
- break;
- }
- if (cameraType == CameraType.爱婴上门)
- {
- if (cameraTime.Parameter.DataRows.Length > 0)
- {
- string StrOrderID = cameraTime.Parameter.DataRows[0]["id"].ToString();
- LYFZ.Software.MainBusiness.HospitalTrackingSystem.AddingTrackRecord frm = new HospitalTrackingSystem.AddingTrackRecord();
- frm.IsShowDatimeRemind = false;
- frm.StrOrderNumber = StrOrdNumber;
- frm.IsGoForm = false;
- frm.intDispatchDoorID = Convert.ToInt32(StrOrderID);
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.LoadTemplateData(); }
- }
- else
- {
- MessageBoxCustom.Show("请选择已预约的客人");
- }
- }
- else
- {
- if (!String.IsNullOrWhiteSpace(StrOrdNumber))
- {
- /* LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在...");
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("加载数据时出错:{0}", ex.Message));
- }
- });*/
- DataTable tbl = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_OrderNumber = '" + StrOrdNumber + "'", ShowColumnName: "GP_CustomerGroupID").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.A_AddCommunicateRecords frm = new CameraControlBook.SuperSmallForm.A_AddCommunicateRecords();
- frm.StrClientNumber = tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim();
- frm.EnumClientServiceTaskType = EnumPublic.ClientServiceTaskType.摄控确认;
- frm.EnumClientServiceTaskItem = inputType;
- frm.Areminderdate = true;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.LoadTemplateData();
- }
- }
- }
- else {
- MessageBoxCustom.Show("请选择已预约的客人");
- }
- }
- }
- private void LikcommunicationInfo_Click(object sender, EventArgs e)
- {
- if (this.PanelDataView.CurrentSelectRow == null)
- {
- MessageBoxCustom.Show("请选择客人");
- return;
- }
- // LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)this.PanelDataView.CurrentSelectRow.Tag;
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)this.PanelDataView.CurrentSelectRow.DataColumnList[2].Tag;
- string StrOrdNumber = cameraTime.ReservationTime.OrderNumber;
- if (!String.IsNullOrWhiteSpace(StrOrdNumber))
- {
- if (this.rdoHospitalClient.Checked)
- {
- LYFZ.Software.MainBusiness.HospitalTrackingSystem.IntentionsEntered frm = new HospitalTrackingSystem.IntentionsEntered();
- frm.StrOrdNumber = StrOrdNumber;
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.LoadTemplateData(); }
- }
- else
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.A_CommunicationDetails frm = new CameraControlBook.SuperSmallForm.A_CommunicationDetails();
- frm.StrNumber = StrOrdNumber;
- frm.ShowDialog();
- if (frm.IsSaveed)
- { this.LoadTemplateData(); }
- }
- }
- else
- {
- MessageBoxCustom.Show("请选择已预约的客人");
- }
- }
- private void LikJiLianRi_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.A_EventAideFormMain frm = new CameraControlBook.A_EventAideFormMain();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.Show();
- }
- private void LikYuanGongDanQi_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.A_EmployeeScheduleSmallForm frm = new CameraControlBook.SmallForm.A_EmployeeScheduleSmallForm();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.ShowDialog();
- }
- private void LikSendSms_Click(object sender, EventArgs e)
- {
- if (!LYFZ.BLL.BLL_ErpUser.IsAdministrator())
- {
- if (!VerificationRights(this.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.SMSSend))
- {
- MessageBoxCustom.Show("您没有打印当前门店摄控数据的权限!");
- return;
- }
- }
- if (this.PanelDataView.SelectRowList.Count > 0)
- {
- if (this.PanelDataView.HeadColumnRow.DataColumnList.Any(c=>c.Text=="客户电话"))
- {
- String StrTelephone = "";
- for (int i = 0; i < this.PanelDataView.SelectRowList.Count; i++)
- {
- StrTelephone += this.PanelDataView.SelectRowList[i].DataColumnList[this.PanelDataView.HeadColumnRow.DataColumnList.Find(c => c.Text == "客户电话").CellIndex].Text.Replace("/",",") + ",";
- }
- LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms SendSMS = new SMSManagement.SmsSend.FrmSendSms();
- SendSMS.Phone = StrTelephone.TrimEnd(',');
- SendSMS.ShowDialog();
- return;
- }
- else
- { MessageBoxCustom.Show("找不到电话列,或已被您隐藏了!"); }
- }
- else
- {
- MessageBoxCustom.Show("请选中您要发送短信的客人");
- }
- }
-
- private void LikCameraQuer_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.WorkAnPaiRecordSuperSmallForm frm = new CameraControlBook.SuperSmallForm.WorkAnPaiRecordSuperSmallForm();
- frm.ShowDialog();
- }
- private void LikCameraLogs_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.WorkAnPaiRecordSuperSmallForm frm = new CameraControlBook.SuperSmallForm.WorkAnPaiRecordSuperSmallForm();
- frm.ShowDialog();
- }
- private void LikOverview_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.CameraControlBookOverviewSmallForm frm = new CameraControlBook.SmallForm.CameraControlBookOverviewSmallForm();
- frm.StrDate = this.dateTimePickerStar.Value.ToYYYY_MM_dd();
- frm.ShowDialog();
- }
- private void LikStatisticsUnfinished_Click(object sender, EventArgs e)
- {
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- bool IsSaveed = false;
- switch (cameraType)
- {
- case CameraType.拍照客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.CameraControlQuerySmallForm frm = new CameraControlBook.SmallForm.CameraControlQuerySmallForm();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- }
- break;
- case CameraType.选片客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.FilmsSelectionReservationQuerySmallForm frm = new CameraControlBook.SmallForm.FilmsSelectionReservationQuerySmallForm();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- }
- break;
- case CameraType.看版客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.LookSampleReservationQuerySmallForm frm = new CameraControlBook.SmallForm.LookSampleReservationQuerySmallForm();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.ShowDialog();
- IsSaveed = frm.IsSave;
- }
- break;
- case CameraType.取件客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.TakePiecesReservationQuerySmallForm frm = new CameraControlBook.SmallForm.TakePiecesReservationQuerySmallForm();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- }
- break;
- case CameraType.选衣客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.SelectDressReservationQuerySmallForm frm = new CameraControlBook.SmallForm.SelectDressReservationQuerySmallForm();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- }
- break;
- case CameraType.服务客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.WeddingReservationQuerySmallForm frm = new CameraControlBook.SmallForm.WeddingReservationQuerySmallForm();
- frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- }
- break;
- default:
-
- break;
- }
- if (IsSaveed)
- {
- this.isUpdateQuery = true;
- this.LoadTemplateData();
- }
- }
- LYFZ.BLL.ReservationTimeData timeDataBll = new BLL.ReservationTimeData();
- /// <summary>
- /// 档期预约和禁用等右键功能
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ContextMenuStrip_Time_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- PDataColumn CurrentCell = (PDataColumn)this.contextMenuStrip_Time.Tag;
- PDataRow dataRow = this.PanelDataView.DataRowList[CurrentCell.RowIndex];
- LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)dataRow.Tag;
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)dataRow.DataColumnList[2].Tag;
- //MessageBoxCustom.Show(String.Format("{0}_{1}_{2}", ((CameraType)cameraTemplate.CameraType).ToString(), ((CameraOrderType)cameraTemplate.OrderType).ToString(), cameraTime.CameraTime));
- bool isSetStatus = false;
- switch (e.ClickedItem.Text)
- {
- case "档期客人预约":
- if (this.StartReservation(cameraTemplate, cameraTime))
- {
- this.LoadTemplateData();
- }
- break;
- case "客人预约改期":
- if (this.StartReservation(cameraTemplate, cameraTime,true))
- {
- this.LoadTemplateData();
- }
- break;
- case "取消档期预约": break;
- case "剪切档期预约": break;
- case "粘贴档期预约": break;
- case "禁用档期":
- if (cameraTime.ID <= 0)
- {
- MessageBoxCustom.Show("不是预设档期无法禁用");
- return;
- }
- if (this.IsMultiShopID(this.CurrentQueryStoreList2))
- {
- MessageBoxCustom.Show("禁用档期时,只能选择一个门店");
- return;
- }
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(this.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.DisableOREnableSchedule))
- {
- MessageBoxCustom.Show("您没有禁用当前门店档期的权限!");
- return;
- }
- if (cameraTime.ReservationTime.ID > 0 && cameraTime.ReservationTime.IsEnable == 0)
- {
- return;
- }
- if (cameraTime.ReservationTime.ID > 0 && !String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- MessageBoxCustom.Show("当前档期已预约了客人,不能禁用");
- return;
- }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在禁用档期...");
- if (timeDataBll.SetTimeDisable(cameraTemplate.GetCameraTimeTemplate(cameraTime.ID), true))
- {
- cameraTime.ReservationTime = timeDataBll.GetReservationTimeData(cameraTime.ID);
- isSetStatus = true;
- }
- else
- {
- MessageBoxCustom.Show(String.Format("禁用档期失败,刷新数据后重试"));
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("禁用档期时出错:{0}", ex.Message));
- }
- });
-
- break;
- case "取消禁用":
- if (cameraTime.ID <= 0)
- {
- return;
- }
- if (this.IsMultiShopID(this.CurrentQueryStoreList2))
- {
- MessageBoxCustom.Show("取消禁用档期时,只能选择一个门店");
- return;
- }
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(this.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.DisableOREnableSchedule))
- {
- MessageBoxCustom.Show("您没有取消禁用当前门店档期的权限!");
- return;
- }
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在取消禁用档期...");
- if (timeDataBll.SetTimeDisable(cameraTemplate.GetCameraTimeTemplate(cameraTime.ID), false))
- {
- cameraTime.ReservationTime = timeDataBll.GetReservationTimeData(cameraTime.ID);
- isSetStatus = true;
- }
- else
- {
- MessageBoxCustom.Show(String.Format("取消禁用档期失败,刷新数据后重试"));
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("取消禁用档期时出错:{0}", ex.Message));
- }
- });
-
- break;
- case "清除异常预约":
- if (cameraTime.ReservationError() && cameraTime.ReservationTime.ID > 0)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在清除异常预约...");
- if (timeDataBll.Delete(cameraTime.ReservationTime))
- {
- cameraTime.ReservationTime.OrderNumber = "";
- cameraTime.ReservationTime.CameraReserveIDList = "";
- isSetStatus = true;
- }
- else
- {
- MessageBoxCustom.Show(String.Format("清除异常预约失败,刷新数据后重试"));
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("清除异常预约时出错:{0}", ex.Message));
- }
- });
- }
- else {
- MessageBoxCustom.Show("不是“预约异常”的客人预约信息不可清除。");
- }
- break;
- }
-
- if (isSetStatus)
- {
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.BindPanelDataView(cameraType);
- }
- }
- /// <summary>
- /// 开始预约
- /// </summary>
- /// <param name="cameraTemplate"></param>
- /// <param name="cameraTime"></param>
- /// <returns></returns>
- bool StartReservation(LYFZ.Model.CameraControlTemplate cameraTemplate, CameraTimeTemplate cameraTime,bool isEdit=false)
- {
- bool IsSaveed = false;
- if (!isEdit)
- {
- if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.IsWithinSchedule)
- {
- if (cameraTime != null)
- {
- if (cameraTime.ReservationTime.IsEnable == 0)
- {
- MessageBoxCustom.Show("已禁用的档期不可以预约");
- return false;
- }
- if (!String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- MessageBoxCustom.Show("当前档期已预约了客人,不可再预约其它客人");
- return false;
- }
- if (cameraTime.ID <= 0)
- {
- MessageBoxCustom.Show("不是预设档期档,不可以预约");
- return false;
- }
- bool isPublicHoliday = this.thumbtackRecordList.Any(t =>t.ThumbtackType==1&& t.DateTimeMark.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd() == cameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd());
- if (isPublicHoliday)
- {
- MessageBoxCustom.Show("公休日不可以预约");
- return false;
- }
- if (Convert.ToDateTime(String.Format("{0} {1}", cameraTime.DayTemplate.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd(), cameraTime.CameraTime)) < SDateTime.Now)
- {
- MessageBoxCustom.Show("不可以预约到已过去的时间");
- return false;
- }
- }
-
- }
- }
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- switch (cameraType)
- {
- case CameraType.拍照客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.PhotographedReservationSmallForm frm = new CameraControlBook.SmallForm.PhotographedReservationSmallForm();
- frm.CurrentSelectCameraTime = cameraTime;
- if (cameraTime != null&& isEdit)
- {
- frm.IsEditCameraTime = true;
- frm.OrdNumber = cameraTime.ReservationTime.OrderNumber;
- }
-
- frm.ShowDialog();
- IsSaveed = frm.IsSave;
- }
- break;
- case CameraType.选片客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.FilmsSelectionReservationSmallForm frm = new CameraControlBook.SmallForm.FilmsSelectionReservationSmallForm();
- frm.CurrentSelectCameraTime = cameraTime;
- if (cameraTime != null && isEdit)
- {
- if (cameraTime.Parameter.DataRows != null && cameraTime.Parameter.DataRows.Length > 0)
- {
- frm.OrdViceNumber = cameraTime.Parameter.DataRows[0]["Ordv_ViceNumber"].ToString();
- }
- }
- frm.ShowDialog();
- IsSaveed = frm.IsSave;
- }
- break;
- case CameraType.看版客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.LookDesignReservationSmallForm frm = new CameraControlBook.SmallForm.LookDesignReservationSmallForm();
- frm.CurrentSelectCameraTime = cameraTime;
- if (cameraTime != null && isEdit)
- {
- if (cameraTime.Parameter.DataRows != null && cameraTime.Parameter.DataRows.Length > 0)
- {
- frm.OrdViceNumber = cameraTime.Parameter.DataRows[0]["Ordv_ViceNumber"].ToString();
- }
- }
- frm.ShowDialog();
- IsSaveed = frm.IsSave;
- }
- break;
- case CameraType.取件客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.TakePiecesReservationSmallForm frm = new CameraControlBook.SmallForm.TakePiecesReservationSmallForm();
- frm.CurrentSelectCameraTime = cameraTime;
- if (cameraTime != null && isEdit)
- {
- frm.OrdNumber = cameraTime.ReservationTime.OrderNumber;
- }
- frm.ShowDialog();
- IsSaveed = frm.IsSave;
- }
- break;
- case CameraType.选衣客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.SelectDressReservationSmallForm frm = new CameraControlBook.SmallForm.SelectDressReservationSmallForm();
- frm.CurrentSelectCameraTime = cameraTime;
- if (cameraTime != null && isEdit)
- {
- if (cameraTime.Parameter.DataRows != null && cameraTime.Parameter.DataRows.Length > 0)
- {
- frm.OrdViceNumber = cameraTime.Parameter.DataRows[0]["Ordv_ViceNumber"].ToString();
- }
- }
- frm.ShowDialog();
- IsSaveed = frm.IsSave;
- }
- break;
- case CameraType.服务客人:
- {
- LYFZ.Software.MainBusiness.CameraControlBook.SmallForm.WeddingReservationSmallForm frm = new CameraControlBook.SmallForm.WeddingReservationSmallForm();
- frm.CurrentSelectCameraTime = cameraTime;
- if (cameraTime != null && isEdit)
- {
- frm.OrdNumber = cameraTime.ReservationTime.OrderNumber;
- }
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- }
- break;
- case CameraType.爱婴上门:
- {
- if (cameraTime != null && isEdit)
- {
- LYFZ.Software.MainBusiness.HospitalTrackingSystem.DispatchDoor frm = new HospitalTrackingSystem.DispatchDoor();
- frm.CurrentSelectCameraTime = cameraTime;
- if (cameraTime != null && isEdit)
- {
- frm.StrOrderNumber = cameraTime.ReservationTime.OrderNumber;
- }
- frm.ShowDialog();
- IsSaveed = frm.IsSaveed;
- }
- else {
- MessageBoxCustom.Show("爱婴上门不支持直接客人上门预约,请到爱婴跟踪系统中安排上门服务");
- }
- }
- break;
- default:
- break;
- }
- return IsSaveed;
- }
- /// <summary>
- /// 下一页
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void LikDownPage_Click(object sender, EventArgs e)
- {
- this.currentPage++;
- if (this.currentPage > sumPageCount)
- {
- this.currentPage = sumPageCount;
- return;
- }
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.BindPanelDataView(cameraType);
- }
- /// <summary>
- /// 上一页
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void LikUpPage_Click(object sender, EventArgs e)
- {
- this.currentPage--;
- if (this.currentPage < 1)
- {
- this.currentPage = 1;
- return;
- }
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.BindPanelDataView(cameraType);
- }
- private void BtnUpdateQuery_Click(object sender, EventArgs e)
- {
- GetCurrentQueryStoreList(ref CurrentQueryStoreList, this.cbxStoreList);
- this.InitializeCalendar();
- }
- private void BtnQuery_Click(object sender, EventArgs e)
- {
- this.LoadTemplateData();
- }
- /// <summary>
- /// 设置订单类型复选框显示
- /// </summary>
- void SetOrderTypeChBoxShow()
- {
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- List<CameraOrderType> cameraOrderTypeList = SetCameraTemplate.GetCameraOrderTypeList(cameraType, GetCurrentStoreBusinessType(this.CurrentQueryStoreList2));
- foreach (Control con in this.flowLayoutPanel4.Controls)
- {
- if (con.GetType() == typeof(LYFZ.ComponentLibrary.CheckBoxEx))
- {
- LYFZ.ComponentLibrary.CheckBoxEx OrderCheckBox = (LYFZ.ComponentLibrary.CheckBoxEx)con;
- int orderType =Convert.ToInt32(OrderCheckBox.Tag);
- if (cameraOrderTypeList.Any(t => (int)t == orderType))
- {
- OrderCheckBox.Show();
- }
- else {
- OrderCheckBox.Hide();
- }
- }
- }
- }
- /// <summary>
- /// 注册订单类型复选框事件
- /// </summary>
- void RegisteredCheckBoxEvent()
- {
- foreach (Control con in this.flowLayoutPanel4.Controls)
- {
- if (con.GetType() == typeof(LYFZ.ComponentLibrary.CheckBoxEx))
- {
- LYFZ.ComponentLibrary.CheckBoxEx OrderCheckBox = (LYFZ.ComponentLibrary.CheckBoxEx)con;
- OrderCheckBox.Click += OrderCheckBox_Click;
- }
- }
- }
- private void OrderCheckBox_Click(object sender, EventArgs e)
- {
- LYFZ.ComponentLibrary.CheckBoxEx OrderCheckBox = (LYFZ.ComponentLibrary.CheckBoxEx)sender;
- int orderType = Convert.ToInt32(OrderCheckBox.Tag);
- this.BindPanelDataView((CameraType)orderType);
- }
- List<int> GetOrderTypeList()
- {
- List<int> orderTypeList = new List<int>();
- foreach (Control con in this.flowLayoutPanel4.Controls)
- {
- if (con.GetType() == typeof(LYFZ.ComponentLibrary.CheckBoxEx))
- {
- LYFZ.ComponentLibrary.CheckBoxEx OrderCheckBox = (LYFZ.ComponentLibrary.CheckBoxEx)con;
- int orderType = Convert.ToInt32(OrderCheckBox.Tag);
- if (OrderCheckBox.Checked)
- {
- orderTypeList.Add(orderType);
- }
- }
- }
- return orderTypeList;
- }
- void RegisteredRadioButtonEvent()
- {
- foreach (Control con in this.flowLayoutPanel3.Controls)
- {
- if (con.GetType() == typeof(LYFZ.ComponentLibrary.RadioButtonEx))
- {
- LYFZ.ComponentLibrary.RadioButtonEx rdo = (LYFZ.ComponentLibrary.RadioButtonEx)con;
- rdo.Click += Rdo_Click;
- }
- }
- }
- private void Rdo_Click(object sender, EventArgs e)
- {
-
- this.SetOrderTypeChBoxShow();
- this.SetStatisticsUnfinished();
- this.LoadTemplateData();
- }
- void SetStatisticsUnfinished()
- {
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- if (cameraType == CameraType.选衣客人)
- {
- this.likConfirmDressing.Show();
- }
- else {
- this.likConfirmDressing.Hide();
- }
- if (cameraType == CameraType.爱婴上门)
- {
- this.btnPrint.Hide();
- this.btnReservation.Hide();
- }
- else {
- this.btnPrint.Show();
- this.btnReservation.Show();
- }
- switch (cameraType)
- {
- case CameraType.拍照客人:
- this.likStatisticsUnfinished.Show();
- this.likStatisticsUnfinished.Text = "统计未拍";
- break;
- case CameraType.选片客人:
- this.likStatisticsUnfinished.Show();
- this.likStatisticsUnfinished.Text = "统计未选片";
- break;
- case CameraType.看版客人:
- this.likStatisticsUnfinished.Show();
- this.likStatisticsUnfinished.Text = "统计未看版";
- break;
- case CameraType.取件客人:
- this.likStatisticsUnfinished.Show();
- this.likStatisticsUnfinished.Text = "统计未取件";
- break;
- case CameraType.选衣客人:
- this.likStatisticsUnfinished.Show();
- this.likStatisticsUnfinished.Text = "统计未选衣";
-
- break;
- case CameraType.服务客人:
- this.likStatisticsUnfinished.Show();
- this.likStatisticsUnfinished.Text = "统计未服务";
- break;
- default:
- this.likStatisticsUnfinished.Hide();
- break;
- }
- }
- void SetCameraTypeRadioButton(CameraType cameraType)
- {
- foreach (Control con in this.flowLayoutPanel3.Controls)
- {
- if (con.GetType() == typeof(LYFZ.ComponentLibrary.RadioButtonEx))
- {
- LYFZ.ComponentLibrary.RadioButtonEx rdo = (LYFZ.ComponentLibrary.RadioButtonEx)con;
- if (cameraType == (CameraType)Enum.Parse(typeof(CameraType), rdo.Text))
- {
- rdo.Checked=true;
- break;
- }
- }
- }
- this.SetOrderTypeChBoxShow();
- }
- /// <summary>
- /// 安排任务的任务类型
- /// </summary>
- public string StrClientServiceType = "";
- void GoToCameraRecord()
- {
- if (!String.IsNullOrWhiteSpace(StrClientServiceType))
- {
- CameraType cameraType = CameraType.拍照客人;
- /* StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选衣服客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.拍照客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选片客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.看版客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.取件客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.服务客人.ToString());
- StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.摄控医院客人.ToString());*/
- LYFZ.EnumPublic.ClientServiceTaskItem serviceTaskItem = (LYFZ.EnumPublic.ClientServiceTaskItem)Enum.Parse(typeof(LYFZ.EnumPublic.ClientServiceTaskItem), StrClientServiceType);
- switch (serviceTaskItem)
- {
- case LYFZ.EnumPublic.ClientServiceTaskItem.拍照客人:
- cameraType = CameraType.拍照客人;
- break;
- case LYFZ.EnumPublic.ClientServiceTaskItem.选片客人:
- cameraType = CameraType.选片客人;
- break;
- case LYFZ.EnumPublic.ClientServiceTaskItem.看版客人:
- cameraType = CameraType.看版客人;
- break;
- case LYFZ.EnumPublic.ClientServiceTaskItem.取件客人:
- cameraType = CameraType.取件客人;
- break;
- case LYFZ.EnumPublic.ClientServiceTaskItem.服务客人:
- cameraType = CameraType.服务客人;
- break;
- case LYFZ.EnumPublic.ClientServiceTaskItem.选衣服客人:
- cameraType = CameraType.选衣客人;
- break;
- case LYFZ.EnumPublic.ClientServiceTaskItem.摄控医院客人:
- cameraType = CameraType.爱婴上门;
- break;
- }
- this.GoToCameraRecord(this.cbxStoreList.SelectedIndex, cameraType, SDateTime.Now);
- }
- }
- bool isGoToCameraRecord = false;
- /// <summary>
- /// 转到摄控记录
- /// </summary>
- /// <param name="shopIDSelectIndex"></param>
- /// <param name="cameraType"></param>
- /// <param name="dayDate"></param>
- void GoToCameraRecord(int shopIDSelectIndex, CameraType cameraType,DateTime dayDate)
- {
- isGoToCameraRecord = true;
- this.ClearDataTable(this.currentOrderDataTable);
- this.dateTimePickerStar.Value = dayDate;
- this.dateTimePickerEnd.Value = dayDate;
- this.SetCameraTypeRadioButton(cameraType);
- this.cbxStoreList2.SelectedIndex = shopIDSelectIndex;
- this.tabControlEx1.SelectedIndex = 1;
-
- // this.LoadTemplateData();
- }
- protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
- {
- return base.ProcessCmdKey(ref msg, keyData);
- }
- private void PanelDataView_EventCellThumbtack_MouseEnter(Panel viewPanel, DataEventArgs e)
- {
- this.tpsInfo.ToolTipTitle = "图钉内容预览";
- this.tpsInfo.Show(String.Format("{0}",e.CurrentThumbtack.ThumbtackText), this.PanelDataView, new Point(e.MousePoint.X + 10, e.MousePoint.Y), 5000);
- }
- private void PanelDataView_EventCellThumbtack_DoubleClick(Panel viewPanel, DataEventArgs e)
- {
- if (e.CurrentThumbtack.Tag != null)
- {
- LYFZ.Model.ThumbtackRecord record = (LYFZ.Model.ThumbtackRecord)e.CurrentThumbtack.Tag;
- ThumbtackType thumType = (ThumbtackType)e.CurrentThumbtack.ThumbtackType;
- if (thumType == ThumbtackType.公休图钉 || thumType == ThumbtackType.摄控本日历图钉)
- {
- if (this.EditThumbtackRecord(record, e.CurrentCell.DateTimeTag, thumType))
- {
- if (record.ThumbtackInfo.ToLower() != e.CurrentThumbtack.ThumbtackText.ToLower())
- {
- e.CurrentThumbtack.ThumbtackText = record.ThumbtackInfo;
- this.PanelDataView.RefreshCell(e.CrrrentRow, e.CurrentCell);
- this.isUpdateQuery = true;
- }
- if (String.IsNullOrWhiteSpace(e.CurrentThumbtack.ThumbtackText))
- {
- e.CurrentCell.CrossRowCell.ThumbtackList.Remove(e.CurrentThumbtack);
- this.thumbtackRecordList.Remove(this.thumbtackRecordList.Find(r => r.ID == record.ID));
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.BindPanelDataView(cameraType);
- }
-
-
- }
- }
- }
- // MessageBoxCustom.Show(e.CurrentThumbtack.ThumbtackText);
- }
- QueryStoreInfo GetCurrentStoreInfo()
- {
- if (this.CurrentQueryStoreList2 != null && this.CurrentQueryStoreList2.QueryStoreInfoList.Count > 0)
- {
- return this.CurrentQueryStoreList2.QueryStoreInfoList[0];
- }
- return new QueryStoreInfo
- {
- DividedShop = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID
- ,
- DividedShop_Name = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CompanyName
- };
- }
- Model_UserRights CurrentUserRights
- {
- get {
- return LYFZ.BLL.BLL_ErpUser.GetSIDToUserRights(this.GetCurrentStoreInfo().DividedShop);
- }
- }
- /// <summary>
- /// 权限验证
- /// </summary>
- /// <param name="moduleBlock"></param>
- /// <param name="operatingAuthority"></param>
- /// <returns></returns>
- bool VerificationRights(LYFZ.CustomAttributes.RightsValue moduleBlock, LYFZ.CustomAttributes.OperatingAuthority operatingAuthority)
- {
- if (this.IsMultiShopID(this.CurrentQueryStoreList2))
- {
- MessageBoxCustom.Show("此操作时,只能选择一个门店");
- return false;
- }
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(moduleBlock, operatingAuthority))
- {
- return false;
- }
- return true;
- }
- private void BtnSetTemplate_Click(object sender, EventArgs e)
- {
- if (this.IsMultiShopID(this.CurrentQueryStoreList2))
- {
- MessageBoxCustom.Show("设置摄控档期模板时,只能选择一个门店");
- return;
- }
- if (!LYFZ.BLL.BLL_ErpUser.GetRights(this.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.SetCameraTemplate))
- {
- MessageBoxCustom.Show("您没有设置当前门店档期模板的权限!");
- return;
- }
- SetCameraTemplate setTemplate = new SetCameraTemplate();
- setTemplate.CurrentQueryStoreList = this.CurrentQueryStoreList2;
- setTemplate.ShowDialog();
- if (setTemplate.WhetherUpdate)
- {
- this.LoadTemplateData();
- this.isUpdateQuery = true;
- }
- if (!setTemplate.IsDisposed)
- {
- setTemplate.Dispose();
- }
- }
- private void BtnCustomColor_Click(object sender, EventArgs e)
- {
- CameraControlBook.SmallForm.frmColorManager frmColor = new CameraControlBook.SmallForm.frmColorManager();
- if (frmColor.ShowDialog() == DialogResult.OK)
- {
- LoadColorList();
- }
- }
- private void PanelDataView_EventCell_MouseEnter(Panel viewPanel, DataEventArgs e)
- {
-
- }
- List<Model.TitleColumnDisplay> _TitleColumnDisplayList = new List<Model.TitleColumnDisplay>();
- /// <summary>
- /// 检查满意度字段是否存在
- /// </summary>
- /// <param name="columnText"></param>
- /// <returns></returns>
- bool CheckSatisfactionColumnDisplay(string columnText)
- {
- if (columnText.ToLower().Contains("满意度"))
- {
- return true;
- }
- return false;
- }
- /// <summary>
- /// 检查沟通记录字段是否存在
- /// </summary>
- /// <param name="columnText"></param>
- /// <returns></returns>
- bool CheckCommunicateColumnDisplay(string columnText)
- {
- if (columnText.ToLower() == "客服人员"
- || columnText.ToLower() == "沟通时间"
- || columnText.ToLower() == "沟通状态"
- || columnText.ToLower() == "沟通备注")
- {
- return true;
- }
- return false;
- }
- void LoadTitleColumnDisplayList(string ctDataViewID)
- {
- this._TitleColumnDisplayList.Clear();
- LYFZ.Model.Model_GridViewDisplayIndex model_GridViewDisplay= LYFZ.DAL.DAL_GridViewDisplayIndex.GetGridViewDisplayIndexModel(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID, ctDataViewID);
- this._TitleColumnDisplayList= Model.TitleColumnDisplay.ToTitleColumnDisplayList(model_GridViewDisplay.DisplayIndexValue);
- if (this._TitleColumnDisplayList == null)
- {
- this._TitleColumnDisplayList = new List<TitleColumnDisplay>();
- }
- if (this._TitleColumnDisplayList.Count <= 0)
- {
- EnumPermissions.BusinessType businessType = GetCurrentStoreBusinessType(this.CurrentQueryStoreList2);
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- List<string> tempcolumnsList= DAL.CameraDataQuery.GetCameraDataColumns(cameraType, businessType).FindAll(t=> CheckSatisfactionColumnDisplay(t)
- || CheckCommunicateColumnDisplay(t));
- foreach (string columnText in tempcolumnsList)
- {
- this._TitleColumnDisplayList.Add(new TitleColumnDisplay {
- ColumnText = columnText
- ,
- Index = -99999
- ,
- Display = 0
- });
- }
- }
- }
- private void PanelDataView_EventCell_DoubleClick(Panel viewPanel, DataEventArgs e)
- {
- if (e.IsHeadRow)
- {
- EnumPermissions.BusinessType businessType = GetCurrentStoreBusinessType(this.CurrentQueryStoreList2);
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- LYFZ.ComponentLibrary.DataViewColumnSet viewColumnSet = new DataViewColumnSet();
- viewColumnSet.DgvGuidName = this.currentDataViewID;
- viewColumnSet.DgvUserEmployeeID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- viewColumnSet.DataCoumnList = DAL.CameraDataQuery.GetCameraDataColumns(cameraType, businessType);
- viewColumnSet.EnabledList= DAL.CameraDataQuery.GetColumnsEnabledList();
- viewColumnSet.TitleColumnDisplayList = this._TitleColumnDisplayList;
- if (viewColumnSet.ShowDialog() == DialogResult.OK)
- {
- this.LoadTitleColumnDisplayList(this.currentDataViewID);
- this.BindPanelDataView(cameraType);
- }
- }
- else
- {
- PDataColumn titleText = this.PanelDataView.HeadColumnRow.DataColumnList[e.CurrentCell.CellIndex];
- if (titleText.Text=="通知状态" || titleText.Text == "通知备注")
- {
- // LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)e.CrrrentRow.Tag;
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)e.CrrrentRow.DataColumnList[2].Tag;
- if (cameraTime.Parameter.WithinSchedule)
- {
- if (cameraTime.ReservationTime.ID > 0&&!String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- frmNotifyCustomer frmNotify = new frmNotifyCustomer();
- frmNotify.NotifyType = (NotifyCustomerType)cameraTime.ReservationTime.NotifyCustomerType;
- frmNotify.CustomerText = cameraTime.ReservationTime.CustomerFeedback.Trim();
- if (frmNotify.ShowDialog() == DialogResult.OK)
- {
- cameraTime.ReservationTime.NotifyCustomerType = (int)frmNotify.NotifyType;
- cameraTime.ReservationTime.CustomerFeedback = frmNotify.CustomerText.Trim();
- bool UpdateStatus = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在设置通知方式...");
- if (timeDataBll.Update(cameraTime.ReservationTime))
- {
- cameraTime.ReservationTime = timeDataBll.GetReservationTimeData(cameraTime.ID);
- UpdateStatus = true;
- }
- else
- {
- MessageBoxCustom.Show(String.Format("设置通知方式失败,请重新刷新后重试"));
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("加载数据时出错:{0}", ex.Message));
- }
- });
- if (UpdateStatus)
- {
- this.BindPanelDataView();
- }
- }
- }
- else {
- MessageBoxCustom.Show(String.Format("当前档期还没预约客人,不可设置通知方式"));
- }
- }
- else {
- MessageBoxCustom.Show("不在档期内的预约不可设置通知方式");
- }
- }
- // MessageBoxCustom.Show(e.CurrentCell.Text);
- }
- }
- private void PanelDataView_EventCell_Click(Panel viewPanel, DataEventArgs e)
- {
- this.HideTpsInfo();
- if (e.Button == MouseButtons.Right)
- {
- if (!e.IsHeadRow)
- {
- PDataColumn titleText = this.PanelDataView.HeadColumnRow.DataColumnList[e.CurrentCell.CellIndex];
- if (e.CurrentCell.CellIndex == 0)
- {
- CellWeekContent cellWeek = new CellWeekContent(e.CurrentCell.DateTimeTag.Year, e.CurrentCell.DateTimeTag.Month, 0);
- cellWeek.SetDayTime(e.CurrentCell.DateTimeTag);
- cellWeek.Thumbtack = e.CurrentCell.ThumbtackList.Find(t => t.ThumbtackType == 2);
- cellWeek.PublicHoliday = e.CurrentCell.ThumbtackList.Find(t => t.ThumbtackType == 1);
- if (cellWeek.Thumbtack == null)
- {
- cellWeek.Thumbtack = new ThumbtackData();
- cellWeek.Thumbtack.ThumbtackType = 2;
- }
- if (cellWeek.PublicHoliday == null)
- {
- cellWeek.PublicHoliday = new ThumbtackData();
- cellWeek.PublicHoliday.ThumbtackType = 1;
- }
- cellWeek.Tag = e;
- this.cmenuCameraBook.Tag = cellWeek;
- this.cmenuCameraBook.Show(this.PanelDataView, e.MousePoint);
- }
- else if (e.CurrentCell.CellIndex >= 2 && e.CurrentCell.CellIndex <= 3)
- {
- // LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)e.CrrrentRow.Tag;
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)e.CrrrentRow.DataColumnList[2].Tag;
- if (String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- this.档期客人预约ToolStripMenuItem.Enabled = true;
- this.取消档期预约ToolStripMenuItem.Enabled = false;
- this.剪切档期预约toolStripMenuItem3.Enabled = false;
- this.粘贴档期预约toolStripMenuItem4.Enabled = true;
- this.客人预约改期ToolStripMenuItem.Enabled = false;
- }
- else
- {
- this.档期客人预约ToolStripMenuItem.Enabled = true;
- this.取消档期预约ToolStripMenuItem.Enabled = true;
- this.剪切档期预约toolStripMenuItem3.Enabled = true;
- this.粘贴档期预约toolStripMenuItem4.Enabled = false;
- this.客人预约改期ToolStripMenuItem.Enabled = true;
- }
- if (cameraTime.ReservationTime.IsEnable == 0)
- {
- this.禁用档期toolStripMenuItem1.Enabled = false;
- this.取消禁用toolStripMenuItem2.Enabled = true;
- }
- else
- {
- this.禁用档期toolStripMenuItem1.Enabled = true;
- this.取消禁用toolStripMenuItem2.Enabled = false;
- }
- this.contextMenuStrip_Time.Tag = e.CurrentCell;
- this.contextMenuStrip_Time.Show(this.PanelDataView, e.MousePoint);
- }
- else if (titleText.Text == "自定义标签")
- {
- this.BidContextMenuStrip_CustomLabel();
- this.contextMenuStrip_CustomLabel.Tag = e.CurrentCell;
- this.contextMenuStrip_CustomLabel.Show(this.PanelDataView, e.MousePoint);
- }
- else if (e.CurrentCell.CellIndex > 3)
- {
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)e.CrrrentRow.DataColumnList[2].Tag;
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- switch (cameraType)
- {
- case CameraType.拍照客人:
- case CameraType.选片客人:
- this.安排变更记录ToolStripMenuItem.Visible = true;
- this.自定义颜色ToolStripMenuItem.Visible = true;
- this.订单备注ToolStripMenuItem.Visible = true;
- this.复制单元格内容ToolStripMenuItem.Visible = true;
- this.SetRetakeMenuItemSubItem(this.订单备注ToolStripMenuItem, cameraTime);
- //this.SetRetakeMenuItemSubItem(this.安排变更记录ToolStripMenuItem, cameraTime);
- if (cameraType == CameraType.选片客人)
- {
- this.重拍ToolStripMenuItem.Visible = false;
- this.重拍记录ToolStripMenuItem.Visible = false;
- this.toolStripSeparator_1.Visible = true;
- this.toolStripSeparator_2.Visible = false;
- this.toolStripSeparator_3.Visible = true;
- }
- else
- {
- this.重拍ToolStripMenuItem.Visible = true;
- this.重拍记录ToolStripMenuItem.Visible = true;
- this.toolStripSeparator_1.Visible = true;
- this.toolStripSeparator_2.Visible = true;
- this.toolStripSeparator_3.Visible = true;
- this.SetRetakeMenuItemSubItem(this.重拍ToolStripMenuItem, cameraTime);
- this.SetRetakeMenuItemSubItem(this.重拍记录ToolStripMenuItem, cameraTime);
- }
- this.SetToolStripMenuItemSubItem(this.自定义颜色ToolStripMenuItem);
- //bool IsPhotographRetake = true;//LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupStoreRights(this.cmbtreevStoreName, "StoresPhotograph", LYFZ.CustomAttributes.OperatingAuthority.PhotographRetake);
- break;
- case CameraType.看版客人:
- case CameraType.取件客人:
- case CameraType.服务客人:
- case CameraType.选衣客人:
- this.安排变更记录ToolStripMenuItem.Visible = false;
- this.自定义颜色ToolStripMenuItem.Visible = true;
- this.订单备注ToolStripMenuItem.Visible = true;
- this.复制单元格内容ToolStripMenuItem.Visible = true;
- this.重拍ToolStripMenuItem.Visible = false;
- this.重拍记录ToolStripMenuItem.Visible = false;
- this.toolStripSeparator_1.Visible = true;
- this.toolStripSeparator_2.Visible = false;
- this.toolStripSeparator_3.Visible = true;
- this.SetToolStripMenuItemSubItem(this.自定义颜色ToolStripMenuItem);
- this.SetRetakeMenuItemSubItem(this.订单备注ToolStripMenuItem, cameraTime);
- break;
- case CameraType.爱婴上门:
- this.安排变更记录ToolStripMenuItem.Visible = false;
- this.自定义颜色ToolStripMenuItem.Visible = false;
- this.订单备注ToolStripMenuItem.Visible = false;
- this.复制单元格内容ToolStripMenuItem.Visible = true;
- this.重拍ToolStripMenuItem.Visible = false;
- this.重拍记录ToolStripMenuItem.Visible = false;
- this.toolStripSeparator_1.Visible = false;
- this.toolStripSeparator_2.Visible = false;
- this.toolStripSeparator_3.Visible = false;
- break;
- }
- if (String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- this.toolStripMenuItem_档期客人预约.Enabled = true;
- this.ToolStripMenuItem_客人预约改期.Enabled = false;
- }
- else
- {
- this.toolStripMenuItem_档期客人预约.Enabled =false;
- this.ToolStripMenuItem_客人预约改期.Enabled = true;
- }
- this.contextMenuStrip_OrderInfo.Tag = e.CurrentCell;
- this.contextMenuStrip_OrderInfo.Show(this.PanelDataView, e.MousePoint);
- }
-
- }
- }
- }
- BLL_ErpSystemConfigure systemConfigurebll = new BLL_ErpSystemConfigure();
- CustomLabelData labelData = new CustomLabelData();
- void BidContextMenuStrip_CustomLabel()
- {
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.contextMenuStrip_CustomLabel.Items.Clear();
- ToolStripMenuItem subItem0 = new ToolStripMenuItem();
- subItem0.Text = String.Format("复制单元格");
- ToolStripMenuItem subItem = new ToolStripMenuItem();
- subItem.Text = String.Format("设置自定义标签");
- this.contextMenuStrip_CustomLabel.Items.Add(subItem0);
- this.contextMenuStrip_CustomLabel.Items.Add(new ToolStripSeparator());
- this.contextMenuStrip_CustomLabel.Items.Add(subItem);
- this.contextMenuStrip_CustomLabel.Items.Add(new ToolStripSeparator());
- List<string> customLabelList = labelData.GetCustomLabelList(cameraType);
- foreach(string item in customLabelList)
- {
- ToolStripMenuItem cItem = new ToolStripMenuItem();
- cItem.Text = String.Format("{0}", item);
- this.contextMenuStrip_CustomLabel.Items.Add(cItem);
- }
- }
- private void ContextMenuStrip_CustomLabel_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- if (e.ClickedItem.Text == "设置自定义标签")
- {
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- frmCustomLabel customLabel = new frmCustomLabel();
- customLabel.AddCameraType = cameraType;
- customLabel.LabelData = this.labelData;
- if (customLabel.ShowDialog() == DialogResult.OK)
- {
- if (systemConfigurebll.SaveConfigureInfo(ConfigItemType.CameraCustomLabelData, this.labelData.ToString()))
- {
- MessageBoxCustom.Show("自定义标签设置成功");
- this.BindCBXCustomLabel(cameraType);
- }
- else
- {
- MessageBoxCustom.Show("自定义标签设置失败");
- }
- }
- }
- else if (e.ClickedItem.Text == "复制单元格")
- {
- PDataColumn CurrentCell = (PDataColumn)this.contextMenuStrip_CustomLabel.Tag;
- Clipboard.SetDataObject(CurrentCell.Text.Trim());
- }
- else
- {
- if (this.contextMenuStrip_CustomLabel.Tag == null)
- {
- MessageBoxCustom.Show("请选择行");
- return;
- }
- PDataColumn CurrentCell = (PDataColumn)this.contextMenuStrip_CustomLabel.Tag;
- PDataRow dataRow = this.PanelDataView.DataRowList[CurrentCell.RowIndex];
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)dataRow.DataColumnList[2].Tag;
- if (cameraTime.Parameter.WithinSchedule)
- {
- if (cameraTime.ReservationTime.ID > 0 && !String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- cameraTime.ReservationTime.CustomLabel = e.ClickedItem.Text.Trim();
- bool UpdateStatus = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在设置自定义标签...");
- if (timeDataBll.Update(cameraTime.ReservationTime))
- {
- cameraTime.ReservationTime = timeDataBll.GetReservationTimeData(cameraTime.ID);
- UpdateStatus = true;
- }
- else
- {
- MessageBoxCustom.Show(String.Format("设置自定义标签失败,请重新刷新后重试"));
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("加载数据时出错:{0}", ex.Message));
- }
- });
- if (UpdateStatus)
- {
- this.BindPanelDataView();
- }
- }
- else
- {
- MessageBoxCustom.Show(String.Format("当前档期还没预约客人,不可设置自定义标签"));
- }
- }
- else
- {
- MessageBoxCustom.Show("不在档期内的预约不能设置自定义标签");
- }
- }
-
- }
- /// <summary>
- /// 设置重拍子菜单
- /// </summary>
- /// <param name="menuItem"></param>
- /// <param name="cameraTime"></param>
- void SetRetakeMenuItemSubItem(System.Windows.Forms.ToolStripMenuItem menuItem, CameraTimeTemplate cameraTime)
- {
- menuItem.DropDownItems.Clear();
- if (cameraTime.ReservationTime.ToCameraReserveIDList().Count > 0)
- {
- if (cameraTime.ReservationTime.ToCameraReserveIDList().Count == 1)
- {
- if (cameraTime.Parameter.DataRows != null&& cameraTime.Parameter.DataRows.Length>0)
- {
- if (menuItem.Text.Trim() == "重拍")
- {
- menuItem.Tag = cameraTime.Parameter.DataRows[0]["VID"].ToString();
- }
- else if (menuItem.Text.Trim() == "重拍记录")
- {
- menuItem.Tag = cameraTime.Parameter.DataRows[0]["Ordpg_IDNumber"].ToString();
- }
- else if (menuItem.Text.Trim() == "订单备注")
- {
- menuItem.Tag = cameraTime.Parameter.DataRows[0]["Ordv_ViceNumber"].ToString();
- }
- else if (menuItem.Text.Trim() == "安排变更记录")
- {
- menuItem.Tag = cameraTime.Parameter.DataRows[0]["Ordv_ViceNumber"].ToString();
- }
- }
-
- }
- else {
- if (cameraTime.Parameter.DataRows != null)
- {
- List<string> idList = cameraTime.ReservationTime.ToCameraReserveIDList();
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- ToolStripMenuItem subItem = new ToolStripMenuItem();
- subItem.Text =String.Format("{0}[{1}]", menuItem.Text.Trim(), row["拍摄名称"].ToString());
- if (menuItem.Text.Trim() == "重拍")
- {
- subItem.Tag = row["VID"].ToString();
- }
- else if (menuItem.Text.Trim() == "重拍记录")
- {
- subItem.Tag = row["Ordpg_IDNumber"].ToString();
- }
- else if (menuItem.Text.Trim() == "订单备注")
- {
- subItem.Tag = row["Ordv_ViceNumber"].ToString();
- }
- else if (menuItem.Text.Trim() == "安排变更记录")
- {
- subItem.Tag = row["Ordv_ViceNumber"].ToString();
- }
- subItem.Click += SubItem_Click;
- menuItem.DropDownItems.Add(subItem);
- }
- }
- }
- }
-
-
- }
- private void SubItem_Click(object sender, EventArgs e)
- {
- this.ContextMenuStrip_OrderInfo_ItemClicked(sender, new ToolStripItemClickedEventArgs((ToolStripMenuItem)sender));
- }
- /// <summary>
- /// 获取颜色子菜单
- /// </summary>
- /// <param name="menuItem"></param>
- void SetToolStripMenuItemSubItem(System.Windows.Forms.ToolStripMenuItem menuItem)
- {
- menuItem.DropDownItems.Clear();
- ToolStripItem subItem= new ToolStripMenuItem();
- subItem.Text = "清除颜色";
- subItem.Tag = new Model.Model_ColorSetting();
- subItem.Click += SubItem_Click;
- menuItem.DropDownItems.Add(subItem);
-
- foreach (Model.Model_ColorSetting color in this.ColorSettingList)
- {
- ToolStripItem subItem2 = new ToolStripMenuItem();
- subItem2.Text = color.InfoText;
- subItem2.ForeColor = color.ToColor();
- subItem2.Tag = color;
- subItem2.Click+= SubItem_Click;
- menuItem.DropDownItems.Add(subItem2);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ContextMenuStrip_OrderInfo_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- string itemText = e.ClickedItem.Text.Trim();
- if (e.ClickedItem.Text.Trim().StartsWith("重拍["))
- {
- itemText = "重拍";
- }
- else if (e.ClickedItem.Text.Trim().StartsWith("重拍记录["))
- {
- itemText = "重拍记录";
- }
- else if (e.ClickedItem.Text.Trim().StartsWith("订单备注["))
- {
- itemText = "订单备注";
- }
- else if (e.ClickedItem.Text.Trim().StartsWith("安排变更记录["))
- {
- itemText = "安排变更记录";
- }
- else if (e.ClickedItem.OwnerItem!=null&&e.ClickedItem.OwnerItem.Text == "自定义颜色")
- {
- itemText = "自定义颜色";
- }
-
- if (this.contextMenuStrip_OrderInfo.Tag == null)
- {
- MessageBoxCustom.Show("请选择行");
- return;
- }
- PDataColumn CurrentCell = (PDataColumn)this.contextMenuStrip_OrderInfo.Tag;
- PDataRow dataRow = this.PanelDataView.DataRowList[CurrentCell.RowIndex];
- LYFZ.Model.CameraControlTemplate cameraTemplate = (LYFZ.Model.CameraControlTemplate)dataRow.Tag;
- CameraTimeTemplate cameraTime = (CameraTimeTemplate)dataRow.DataColumnList[2].Tag;
- string StrOrdNumber = cameraTime.ReservationTime.OrderNumber;
- switch (itemText)
- {
- case "复制单元格内容":
- Clipboard.SetDataObject(CurrentCell.Text.Trim());
- break;
- case "档期客人预约":
- if (this.StartReservation(cameraTemplate, cameraTime))
- {
- this.LoadTemplateData();
- }
- break;
- case "客人预约改期":
- if (this.StartReservation(cameraTemplate, cameraTime, true))
- {
- this.LoadTemplateData();
- }
- break;
- case "重拍":
- {
- if (!LYFZ.BLL.BLL_ErpUser.IsAdministrator())
- {
- if (!VerificationRights(this.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.PhotographRetake))
- {
- MessageBoxCustom.Show("您没有重拍当前门店摄控的权限!");
- return;
- }
- }
- if (e.ClickedItem.Tag != null)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.OrderSightsRetakeSmallForm frm = new DoorCityProcess.SetSmallForm.OrderSightsRetakeSmallForm();
- frm.StrOrdNumber = StrOrdNumber.Trim();
- frm.StrSightsID = e.ClickedItem.Tag.ToString().Trim();
- frm.StrRetakeType = EnumPublic.EnumRetakeType.拍照重拍;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.LoadTemplateData();
- }
- }
- }
- break;
- case "重拍记录":
- {
- if (e.ClickedItem.Tag != null)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.OrderSightsRemakeRecordSmallForm frm = new DoorCityProcess.SetSmallForm.OrderSightsRemakeRecordSmallForm();
- frm.StrRemakeRecordType = EnumPublic.EnumRetakeType.拍照重拍;
- frm.StrOrdNumber = StrOrdNumber.Trim();
- frm.StrSightsID = e.ClickedItem.Tag.ToString().Trim();
- frm.IsCompetence = true;//是否有重拍权限
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.LoadTemplateData();
- }
- }
- }
- break;
- case "订单备注":
- {
- if (e.ClickedItem.Tag != null)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrderRemarkRecordAddSuperSmallForm frm = new DoorCityProcess.SuperSmallForm.OrderRemarkRecordAddSuperSmallForm();
- frm.StrOrderNumber = StrOrdNumber.Trim();
- frm.StrOrdViceNumber = e.ClickedItem.Tag.ToString().Trim();
- if (this.rdoPhotographed.Checked)
- {
- frm.StrOrdModuleName = LYFZ.EnumPublic.EnumOrderRemarkModule.预约拍照.ToString().Trim();
- }
- else if (this.rdoFilmSelection.Checked)
- {
- frm.StrOrdModuleName = LYFZ.EnumPublic.EnumOrderRemarkModule.预约选片.ToString().Trim();
- }
- else if (this.rdoLookDesign.Checked)
- {
- frm.StrOrdModuleName = LYFZ.EnumPublic.EnumOrderRemarkModule.预约看版.ToString().Trim();
- }
- else if (this.rdoSelectDress.Checked)
- {
- frm.StrOrdModuleName = LYFZ.EnumPublic.EnumOrderRemarkModule.预约选衣.ToString().Trim();
- }
- else if (this.rdoTotakePiece.Checked)
- {
- frm.StrOrdModuleName = LYFZ.EnumPublic.EnumOrderRemarkModule.预约取件.ToString().Trim();
- }
- else if (this.rdoService.Checked)
- {
- frm.StrOrdModuleName = LYFZ.EnumPublic.EnumOrderRemarkModule.预约服务.ToString().Trim();
- }
- frm.ShowDialog();
- }
- }
- break;
- case "安排变更记录":
- {
- string StrModuleName = "";
- if (this.rdoFilmSelection.Checked)
- {
- StrModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排选片客人.ToString();
- }
- else if (this.rdoLookDesign.Checked)
- {
- StrModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排看版客人.ToString();
- }
- else if (this.rdoPhotographed.Checked)
- {
- StrModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排拍照客人.ToString();
- }
- else if (this.rdoSelectDress.Checked)
- {
- StrModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排选礼服客人.ToString();
- }
- else if (this.rdoService.Checked)
- {
- StrModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排服务客人.ToString();
- }
- else if (this.rdoTotakePiece.Checked)
- {
- StrModuleName = LYFZ.EnumPublic.WorkAnPaiChangeLogEnum.摄控安排取件客人.ToString();
- }
- LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.WorkAnPaiRecordSuperSmallForm frm = new CameraControlBook.SuperSmallForm.WorkAnPaiRecordSuperSmallForm();
- frm.StrOrdNumber = StrOrdNumber.Trim();
- // frm.StrViceNumber = e.ClickedItem.Tag.ToString().Trim();
- frm.StrModuleName = StrModuleName;
- frm.ShowDialog();
- }
- break;
- case "自定义颜色":
- if (e.ClickedItem.Tag != null)
- {
- Model.Model_ColorSetting model_Color = (Model.Model_ColorSetting)e.ClickedItem.Tag;
- string colorString = "";
- if (!String.IsNullOrWhiteSpace(model_Color.ColorText))
- {
- colorString = model_Color.ColorText;
- }
- if (orbll.SetOrderColor(StrOrdNumber.Trim(), colorString))
- {
- cameraTime.Parameter.OrderAutoColor = colorString;
- if (cameraTime.Parameter.DataRows != null)
- {
- foreach (DataRow row in cameraTime.Parameter.DataRows)
- {
- row["ord_AutoColor"] = colorString;
- }
- }
- this.BindPanelDataView();
- }
- }
- break;
- case "添加记录":
- this.LikAddCommunication_Click(null,null);
- break;
- case "沟通详情":
- this.LikcommunicationInfo_Click(null, null);
- break;
- }
- }
- LYFZ.BLL.CameraControlTemplate cameraTemplateBll = new BLL.CameraControlTemplate();
- LYFZ.DAL.CameraControlTemplate cameraTemplateDal = new DAL.CameraControlTemplate();
- LYFZ.BLL.ThumbtackRecord thumbtackBll = new BLL.ThumbtackRecord();
- List<LYFZ.Model.CameraControlTemplate> CameraControlTemplateList = new List<Model.CameraControlTemplate>();
- /// <summary>
- /// 预约数据报告图钉
- /// </summary>
- List<LYFZ.Model.ThumbtackRecord> thumbtackRecordList = new List<Model.ThumbtackRecord>();
- public static string GetQueryStoreList(QueryStoreList queryStore)
- {
- StringBuilder strBuild = new StringBuilder();
- if (queryStore != null)
- {
- if (queryStore.QueryType != 0)
- {
- foreach (QueryStoreInfo sid in queryStore.QueryStoreInfoList)
- {
- if (!string.IsNullOrEmpty(sid.DividedShop))
- {
- strBuild.Append(String.Format("{0},", sid.DividedShop.Trim()));
- }
- }
- }
- }
- return strBuild.ToString().Trim(',');
- }
- string currentDataViewID = "";
- /// <summary>
- /// 加载模板数据
- /// </summary>
- void LoadTemplateData()
- {
- int tempDay = CameraTemplateHandle.GetSubtractDay(this.dateTimePickerStar.Value, this.dateTimePickerEnd.Value);
- if (tempDay > 31)
- {
- MessageBoxCustom.Show("为了保证系统数据查询性能,时间查询最多不能超过31天");
- }
- else
- {
- if (this.CurrentQueryStoreList2 != null)
- {
- string shopIDString = "";
- if (this.CurrentQueryStoreList2.QueryType != 0)
- {
- shopIDString = GetQueryStoreList(this.CurrentQueryStoreList2);
- }
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.ClearCondition();
- this.currentDataViewID = String.Format("CameraInfoDataViewID_{0}", (int)cameraType);
- this.LoadCameraControlTemplate(this.dateTimePickerStar.Value.ToYYYYMMddDate(), this.dateTimePickerEnd.Value.ToYYYYMMddDate(), (int)cameraType, shopIDString);
- this.BindCBXCustomLabel(cameraType);
- this.BindSearchField(cameraType);
- }
- else
- {
- MessageBoxCustom.Show("请选择门店");
- }
- }
- }
- void BindCBXCustomLabel(CameraType cameraType)
- {
- this.cbxCustomLabel.Items.Clear();
- this.cbxCustomLabel.Items.Add("全部");
- this.cbxCustomLabel.Items.AddRange(labelData.GetCustomLabelList(cameraType).ToArray());
- this.cbxCustomLabel.SelectedIndex = 0;
- }
- void BindSearchField(CameraType cameraType)
- {
- List<string> titleColumnList =new List<string>(this.GetCameraDataColumns(cameraType).ToArray());
- titleColumnList.RemoveRange(0,4);
- this.cbxSearchField.Items.Clear();
- this.cbxSearchField.Items.Add("智能筛选");
- this.cbxSearchField.Items.AddRange(titleColumnList.ToArray());
- this.cbxSearchField.SelectedIndex = 0;
- }
- /// <summary>
- /// 当前预约订单数据
- /// </summary>
- DataTable currentOrderDataTable = null;
- /// <summary>
- /// 满意度调查数据
- /// </summary>
- DataTable OrderSatisfactionSurveyData = null;
- /// <summary>
- /// 客户沟通记录
- /// </summary>
- DataTable OrderCustomersTrackRecordData = null;
- /// <summary>
- /// 摄控预约按排记录
- /// </summary>
- DataTable OrderWorkAnPaiRecordData = null;
- /// <summary>
- /// 摄控预约按排次数 集合
- /// </summary>
- Dictionary<string, int> OrderWorkAnPaiCountList = new Dictionary<string, int>();
- void ClearDataTable(DataTable tb)
- {
- if (tb != null)
- {
- tb.Rows.Clear();
- tb.Clear();
- tb.Dispose();
- tb.DataSet.Clear();
- tb.DataSet.Dispose();
- tb = null;
- }
- }
- /// <summary>
- /// 加载模板数据
- /// </summary>
- /// <param name="dateStart"></param>
- /// <param name="dateEnd"></param>
- void LoadCameraControlTemplate(DateTime dateStart, DateTime dateEnd, int cameraType, string shopID)
- {
- CameraType currentCameraType = (CameraType)cameraType;
- ClearDataTable(currentOrderDataTable);
- ClearDataTable(OrderSatisfactionSurveyData);
- ClearDataTable(OrderCustomersTrackRecordData);
- ClearDataTable(OrderWorkAnPaiRecordData);
- this.CameraControlTemplateList.Clear();
- this.thumbtackRecordList.Clear();
- this.OrderWorkAnPaiCountList.Clear();
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0,"正在加载数据...");
- this.labelData.SetCustomLabelData(systemConfigurebll.GetConfigureInfo(ConfigItemType.CameraCustomLabelData).Sconfig_Value);
- this.LoadTitleColumnDisplayList(this.currentDataViewID);
- this.CameraControlTemplateList = cameraTemplateBll.GetCameraControlTemplateList(dateStart, dateEnd, cameraType, shopID);
- this.thumbtackRecordList = thumbtackBll.GetThumbtackRecordList(dateStart, dateEnd, shopID, !LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition);
- currentOrderDataTable = DAL.CameraDataQuery.GetReservationOrderDataList(currentCameraType, dateStart, dateEnd, shopID);
- List<string> titleColumnList = this.GetCameraDataColumns(currentCameraType);
- List<string> ordNumberList = (from d in currentOrderDataTable.AsEnumerable() select d.Field<string>("Ord_Number")).Distinct().ToList<string>();
- if (currentCameraType != CameraType.爱婴上门)
- {
- List<string> subOrdNumberList = (from d in currentOrderDataTable.AsEnumerable() select d.Field<string>("Ordv_ViceNumber")).Distinct().ToList<string>();
- switch (currentCameraType)
- {
- case CameraType.拍照客人:
- this.OrderWorkAnPaiRecordData = DAL.CameraDataQuery.GetOrderWorkAnPaiRecord(subOrdNumberList, EnumPublic.WorkAnPaiChangeLogEnum.摄控安排拍照客人);
- break;
- case CameraType.选片客人:
- this.OrderWorkAnPaiRecordData = DAL.CameraDataQuery.GetOrderWorkAnPaiRecord(subOrdNumberList, EnumPublic.WorkAnPaiChangeLogEnum.摄控安排选片客人);
- break;
- case CameraType.看版客人:
- this.OrderWorkAnPaiRecordData = DAL.CameraDataQuery.GetOrderWorkAnPaiRecord(subOrdNumberList, EnumPublic.WorkAnPaiChangeLogEnum.摄控安排看版客人);
- break;
- case CameraType.取件客人:
- this.OrderWorkAnPaiRecordData = DAL.CameraDataQuery.GetOrderWorkAnPaiRecord(subOrdNumberList, EnumPublic.WorkAnPaiChangeLogEnum.摄控安排取件客人);
- break;
- case CameraType.选衣客人:
- this.OrderWorkAnPaiRecordData = DAL.CameraDataQuery.GetOrderWorkAnPaiRecord(subOrdNumberList, EnumPublic.WorkAnPaiChangeLogEnum.摄控安排选礼服客人);
- break;
- case CameraType.服务客人:
- this.OrderWorkAnPaiRecordData = DAL.CameraDataQuery.GetOrderWorkAnPaiRecord(subOrdNumberList, EnumPublic.WorkAnPaiChangeLogEnum.摄控安排服务客人);
- break;
- }
- this.GetOrderWorkAnPaiCountList();
- }
-
- if (titleColumnList.Any(t => this.CheckSatisfactionColumnDisplay(t)))
- {
- OrderSatisfactionSurveyData = new LYFZ.BLL.BLL_ErpSatisfactionSurvey().GetOrderSatisfactionSurveyData(ordNumberList);
- }
- if (titleColumnList.Any(t => this.CheckCommunicateColumnDisplay(t)))
- {
- OrderCustomersTrackRecordData = DAL.CameraDataQuery.GetCustomersTrackRecord(currentCameraType, ordNumberList);
- }
- backgroundWorker.ReportProgress(0, "正在处理数据...");
- AddDataToCameraControlTemplate(currentCameraType, dateStart, dateEnd);
- // DataProcessing(currentCameraType);
- } catch (Exception ex) {
- MessageBoxCustom.Show(String.Format("加载数据时出错:{0}",ex.Message));
- }
- });
- this.currentPage = 1;
- this.BindPanelDataView(currentCameraType);
- }
- /// <summary>
- /// 获取摄控预约按排改期次数
- /// </summary>
- void GetOrderWorkAnPaiCountList()
- {
- IEnumerable<IGrouping<string, DataRow>> dataRowListGroup= this.OrderWorkAnPaiRecordData.Select().GroupBy(r=>String.Format("{0},{1}", r.Field<string>("Ordwr_ViceNumber"), r.Field<string>("Ordwr_WorkNumber")));
- foreach (IGrouping<string, DataRow> dataRows in dataRowListGroup)
- {
- string groupKey = dataRows.Key;
- List<string> tempTimeList = new List<string>();
- foreach (DataRow dataRow in dataRows)
- {
- try
- {
- string tempText = "";
- if (dataRow["Ordwr_UpdateAgoData"].ToString().Split(' ').Any(s => s.Replace(":", ":").Contains("时间:")))
- {
- tempText = dataRow["Ordwr_UpdateAgoData"].ToString().Split(' ').First(s => s.Replace(":", ":").Contains("时间:"));
- }
- if (!String.IsNullOrWhiteSpace(tempText))
- {
- string[] temps = tempText.Split(':');
- if (temps.Length >= 2)
- {
- if (!tempTimeList.Contains(temps[1]))
- {
- tempTimeList.Add(temps[1]);
- }
- }
- }
- }
- catch (Exception ex){
- MessageBoxCustom.Show("解析改期次数时出错:"+ex.Message);
- }
- }
- this.OrderWorkAnPaiCountList.Add(groupKey,tempTimeList.Count);
- }
- ClearDataTable(this.OrderWorkAnPaiRecordData);
- }
- /// <summary>
- /// 获取改期次数
- /// </summary>
- /// <param name="_WorkNumberID"></param>
- /// <param name="subOrderNumber"></param>
- /// <returns></returns>
- int GetReschedulesCount(string _WorkNumberID, string subOrderNumber)
- {
- string key = String.Format("{0},{1}", subOrderNumber, _WorkNumberID);
- if (this.OrderWorkAnPaiCountList.ContainsKey(key))
- {
- return this.OrderWorkAnPaiCountList[key];
- }
- else {
- return 0;
- }
- }
- /// <summary>
- /// 把查询的预约订单数据转为 CameraControlTemplate 模板对象 并添加到模板集合中
- /// </summary>
- /// <param name="cameraType"></param>
- void AddDataToCameraControlTemplate(CameraType cameraType, DateTime dateStart, DateTime dateEnd)
- {
- List<string> columnTitleList = this.GetCameraDataColumns(cameraType);
- // LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.CameraStatisticNotReservedButCompletionTime
- //String.Format("shopDate>='{0}' and shopDate<='{1}'", dateStart.ToYYYYMMddDate().ToYYYY_MM_dd_HH_mm(), dateEnd.ToDayDateMaxTime().ToYYYY_MM_dd_HH_mm())
- IEnumerable<IGrouping<string, DataRow>> dataRowListGroup = null;
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.CameraStatisticNotReservedButCompletionTime)
- {
- dataRowListGroup = this.currentOrderDataTable.Select(String.Format("shopDate>='{0}' and shopDate<='{1}'", dateStart.ToYYYYMMddDate().ToYYYY_MM_dd_HH_mm(), dateEnd.ToDayDateMaxTime().ToYYYY_MM_dd_HH_mm())).GroupBy(r => String.Format("{0},{1},{2}", r.Field<string>("shopID"), Convert.ToDateTime(r["shopDate"].ToString()).ToYYYY_MM_dd(), r.Field<string>("Ord_Type")));
- }
- else {
- dataRowListGroup = this.currentOrderDataTable.Select(String.Format("shopDate>='{0}' and shopDate<='{1}'", dateStart.ToYYYYMMddDate().ToYYYY_MM_dd_HH_mm(), dateEnd.ToDayDateMaxTime().ToYYYY_MM_dd_HH_mm())).ToList().FindAll(r => String.IsNullOrWhiteSpace(r["resDate"].ToString()) ? false : r.Field<DateTime>("resDate") > LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime()).GroupBy(r => String.Format("{0},{1},{2}", r.Field<string>("shopID"), Convert.ToDateTime(r["shopDate"].ToString()).ToYYYY_MM_dd(), r.Field<string>("Ord_Type")));
- }
- foreach (IGrouping<string, DataRow> items in dataRowListGroup)
- {
- string[] groupKeys = items.Key.Split(',');
- string shopID = groupKeys[0];
- string dayDate = groupKeys[1];
- int orderType = Convert.ToInt32(groupKeys[2]);
- LYFZ.Model.CameraControlTemplate template = this.CameraControlTemplateList.Find(t => t.ShopID.ToLower() == shopID.ToLower() && t.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd() == dayDate && t.OrderType == orderType);
- if (template == null)
- {
- template = new Model.CameraControlTemplate
- {
- OrderType = orderType
- ,
- CameraType = (int)cameraType
- ,
- CameraDateTime = Convert.ToDateTime(dayDate).ToJavaScriptTimeStamp()
- ,
- ShopID = shopID
- };
- this.CameraControlTemplateList.Add(template);
- }
- IEnumerable<IGrouping<string, DataRow>> dataRowOrderTimeListGroup = items.ToArray().GroupBy(r => String.Format("{0},{1}", r.Field<string>("Ord_Number"), Convert.ToDateTime(r["shopDate"].ToString()).ToString("HH:mm")));
- foreach (IGrouping<string, DataRow> dataRows in dataRowOrderTimeListGroup)
- {
- string[] groupTimeKeys = dataRows.Key.Split(',');
- string orderNumber = groupTimeKeys[0];
- string timeText = groupTimeKeys[1];
-
- List<CameraTimeTemplate> cameraTimeList = new List<CameraTimeTemplate>();
- if (template.ID > 0)
- {
- cameraTimeList = template.TimeTemplateData.TimeTemplateDataList.FindAll(t => t.ReservationTime.OrderNumber.ToLower() == orderNumber.ToLower()
- && t.ReservationTime.ToCameraReserveIDList().Any(id => dataRows.Any(r => r[DAL.CameraDataQuery.GetCameraDataItemTitlieName(cameraType)].ToString().ToLower() == id.ToLower())));
- if (cameraTimeList.Count > 0)
- {
- foreach (CameraTimeTemplate cameraTime in cameraTimeList)
- {
- this.SetCameraTimeTemplate(cameraType, orderNumber, timeText, template, cameraTime, columnTitleList, dataRows);
- }
- }
- else {
- this.SetCameraTimeTemplate(cameraType, orderNumber, timeText, template, null, columnTitleList, dataRows);
- }
- }
- else {
- this.SetCameraTimeTemplate(cameraType, orderNumber, timeText, template, null, columnTitleList, dataRows);
- }
-
- }
- //时间排序
- template.TimeTemplateData.TimeTemplateDataList = template.TimeTemplateData.TimeTemplateDataList.OrderBy(t => t.CameraTime).ToList();
- }
- }
- void SetCameraTimeTemplate(CameraType cameraType, string orderNumber, string timeText, LYFZ.Model.CameraControlTemplate template, CameraTimeTemplate cameraTime, List<string> columnTitleList, IGrouping<string, DataRow> dataRows)
- {
- if (cameraTime == null)
- {
- cameraTime = new CameraTimeTemplate
- {
- CameraTime = timeText
- ,
- DayTemplate = template
- };
- cameraTime.ReservationTime.OrderNumber = orderNumber;
- cameraTime.Parameter.WithinSchedule = false;
- template.TimeTemplateData.Add(cameraTime);
- cameraTime.Parameter.DataRows = dataRows.ToArray();
- }
- else {
- cameraTime.Parameter.DataRows = dataRows.ToList<DataRow>().FindAll(r => cameraTime.ReservationTime.ToCameraReserveIDList().Any(id => id.ToLower() == r[DAL.CameraDataQuery.GetCameraDataItemTitlieName(cameraType)].ToString().ToLower())).ToArray();
- }
- if (cameraTime.Parameter.DataRows.Length > 0)
- {
- DataRow cusRow = cameraTime.Parameter.DataRows[0];
- cameraTime.ReservationTime.ShowOrderNumber = cusRow["订单号"].ToString();
- if (!cameraTime.Parameter.WithinSchedule)
- {
- cameraTime.ReservationTime.CameraReserveIDList = String.Join(",", GetValueList(cameraTime.Parameter.DataRows, DAL.CameraDataQuery.GetCameraDataItemTitlieName(cameraType)));
- }
- if (cameraType == CameraType.爱婴上门)
- {
- this.SetReservationDispatchDoorParameter(columnTitleList, cameraTime);
- }
- else
- {
- if (cusRow["ord_AutoColor"] != null)
- {
- cameraTime.Parameter.OrderAutoColor = cusRow["ord_AutoColor"].ToString();
- }
- if (cusRow["Ord_Class"] != null)
- {
- cameraTime.Parameter.IsIntentionOrder = cusRow["Ord_Class"].ToString() == "0";
- }
- if (cusRow["欠款"] != null)
- {
- cameraTime.Parameter.IsArrears = String.IsNullOrWhiteSpace(cusRow["欠款"].ToString()) ? false : Convert.ToDecimal(cusRow["欠款"].ToString()) > 0;
- }
- if (cameraType == CameraType.拍照客人)
- {
- cameraTime.Parameter.RetakesCount = cameraTime.Parameter.DataRows.Max(r => String.IsNullOrWhiteSpace(r["重拍次数"].ToString()) ? 0 : Convert.ToInt32(r["重拍次数"].ToString()));
- }
- this.SetReservationParameter(cameraType, columnTitleList, cameraTime);
- }
- }
- }
- /// <summary>
- /// 设置预约爱婴上门 参数
- /// </summary>
- /// <param name="columnTitleList"></param>
- /// <param name="Parameter"></param>
- void SetReservationDispatchDoorParameter(List<string> columnTitleList, CameraTimeTemplate cameraTime)
- {
- cameraTime.Parameter.KeyValues.Add("订单号", cameraTime.ReservationTime.ShowOrderNumber);
- cameraTime.Parameter.KeyValues.Add("通知备注", cameraTime.ReservationTime.CustomerFeedback);
- for (int i = 4; i < columnTitleList.Count; i++)
- {
- string columnTitle = columnTitleList[i];
- if (cameraTime.Parameter.DataRows.Length > 0)
- {
- DataRow cusRow = cameraTime.Parameter.DataRows[0];
- //订单号,客户姓名,客户电话,宝贝名称,上门时间,上门状态,车辆,上门人员1,上门人员2,上门人员3,上门人员4,派单备注,客服人员,录入时间,沟通备注"
- cameraTime.Parameter.ReschedulesCount = cameraTime.Parameter.DataRows.Max(r => this.GetReschedulesCount(r[DAL.CameraDataQuery.GetCameraDataItemTitlieName(CameraType.爱婴上门)].ToString(), r.Field<string>("Ord_Number")));
- switch (columnTitle)
- {
- case "订单号":
- case "通知备注":
- break;
- case "上门时间":
- cameraTime.Parameter.KeyValues.Add(columnTitle, String.IsNullOrWhiteSpace(cusRow[columnTitle].ToString()) ? LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime().ToYYYY_MM_dd_HH_mm() : Convert.ToDateTime(cusRow[columnTitle].ToString()).ToYYYY_MM_dd_HH_mm());
- break;
- case "上门状态":
- int digStatus = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus == 0 ? "未上门" : digStatus == cameraTime.Parameter.DataRows.Length ? "OK" : "部分已上门");
- break;
- case "车辆":
- case "派单备注":
- case "沟通备注":
- case "上门人员1":
- case "上门人员2":
- case "上门人员3":
- case "上门人员4":
- cameraTime.Parameter.KeyValues.Add(columnTitle, String.Join(",", GetValueList(cameraTime.Parameter.DataRows, columnTitle)));
- break;
- case "客服人员":
- cameraTime.Parameter.KeyValues.Add(columnTitle, LYFZ.DAL.DAL_ErpUser.GetUserIDToUserName(String.Join(",", GetValueList(cameraTime.Parameter.DataRows, columnTitle))));
- break;
- case "录入时间":
- cameraTime.Parameter.KeyValues.Add(columnTitle, cameraTime.Parameter.DataRows.ToList().Max(r => String.IsNullOrWhiteSpace(cusRow[columnTitle].ToString()) ? LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime(): Convert.ToDateTime(r[columnTitle].ToString())).ToYYYY_MM_dd_HH_mm());
- break;
- default:
- if (cusRow.Table.Columns.Contains(columnTitle))
- {
- cameraTime.Parameter.KeyValues.Add(columnTitle, cusRow[columnTitle].ToString());
- }
- break;
- }
- }
- }
- }
- /// <summary>
- /// 设置预约 参数
- /// </summary>
- /// <param name="columnTitleList"></param>
- /// <param name="Parameter"></param>
- void SetReservationParameter(CameraType cameraType,List<string> columnTitleList, CameraTimeTemplate cameraTime)
- {
- cameraTime.Parameter.KeyValues.Add("订单号", cameraTime.ReservationTime.ShowOrderNumber);
- cameraTime.Parameter.KeyValues.Add("通知备注", cameraTime.ReservationTime.CustomerFeedback);
-
- for (int i = 4; i < columnTitleList.Count; i++)
- {
- string columnTitle = columnTitleList[i];
- if (cameraTime.Parameter.DataRows.Length > 0)
- {
- DataRow cusRow = cameraTime.Parameter.DataRows[0];
-
- cameraTime.Parameter.ReschedulesCount = cameraTime.Parameter.DataRows.Max(r => this.GetReschedulesCount(r[DAL.CameraDataQuery.GetCameraDataItemTitlieName(cameraType)].ToString(), r.Field<string>("Ordv_ViceNumber")));
- switch (columnTitle)
- {
- case "订单号":
- case "通知备注":
- break;
- case "会员信息":
- string VipString = "";
- string vipType = "";
- if (!String.IsNullOrWhiteSpace(cusRow["Mc_CardType"].ToString().Trim()))
- {
- vipType = String.Format("{0}", cusRow["Mc_CardType"].ToString().Trim() == "无" ? "会员卡号" : cusRow["Mc_CardType"].ToString().Trim());
- }
- if (!String.IsNullOrWhiteSpace(cusRow["Mc_CradNumber"].ToString().Trim()))
- {
- VipString = String.Format("{0}:{1}"
- , vipType
- , cusRow["Mc_CradNumber"].ToString().Trim());
- }
- cameraTime.Parameter.KeyValues.Add(columnTitle, VipString);
- break;
- case "预约时间":
- if (String.IsNullOrWhiteSpace(cusRow["resDate"].ToString()))
- {
- cameraTime.Parameter.KeyValues.Add(columnTitle,"");
- }
- else
- {
- cameraTime.Parameter.KeyValues.Add(columnTitle, Convert.ToDateTime(cusRow["resDate"].ToString()).ToYYYY_MM_dd_HH_mm());
- }
- break;
- case "选片时间":
- case "看版时间":
- case "确认选礼服时间":
- case "取件时间":
- case "服务日期":
- cameraTime.Parameter.KeyValues.Add(columnTitle, cameraTime.Parameter.DataRows.ToList().Max(r => String.IsNullOrWhiteSpace(r["stDate"].ToString()) ? LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime() : Convert.ToDateTime(r["stDate"].ToString())).ToYYYY_MM_dd_HH_mm());
- break;
- case "拍摄状态":
- int cameraStatus = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- string cameraStatusText = cameraStatus == 0 ? "未拍" : cameraStatus == cameraTime.Parameter.DataRows.Length ? "OK" : "拍照中";
- if (cameraTime.Parameter.RetakesCount > 0)
- {
- cameraStatusText = String.Format("{0}(重拍)", cameraStatusText);
- }
- cameraTime.Parameter.KeyValues.Add(columnTitle, cameraStatusText);
- break;
- case "拍摄时间":
- case "初修时间":
- case "精修时间":
- case "设计时间":
- case "完成时间":
- cameraTime.Parameter.KeyValues.Add(columnTitle, cameraTime.Parameter.DataRows.ToList().Max(r =>String.IsNullOrWhiteSpace(r[columnTitle].ToString())?LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime(): Convert.ToDateTime(r[columnTitle].ToString())).ToYYYY_MM_dd_HH_mm());
- break;
- case "预约摄影师":
- case "预约摄影助理":
- case "预约化妆师":
- case "预约化妆助理":
- case "预约引导师":
- case "预约引导助理":
- case "摄影师":
- case "摄影助理":
- case "化妆师":
- case "化妆助理":
- case "引导师":
- case "引导助理":
- case "初修师":
- case "精修师":
- case "设计师":
- case "预约看版师":
- case "看版师":
- case "预约选片师":
- case "选片师":
- case "预约取件人":
- case "取件人":
- case "服务人员1":
- case "服务人员2":
- case "预约选礼服师":
- case "确认选礼服师":
- cameraTime.Parameter.KeyValues.Add(columnTitle, LYFZ.DAL.DAL_ErpUser.GetUserIDToUserName(String.Join(",", GetValueList(cameraTime.Parameter.DataRows, columnTitle))));
- break;
- case "套系价格":
- cameraTime.Parameter.KeyValues.Add(columnTitle, Convert.ToDecimal(cusRow[columnTitle].ToString()).ToString("n2"));
- break;
- case "欠款":
- cameraTime.Parameter.KeyValues.Add(columnTitle, Convert.ToDecimal(cusRow[columnTitle].ToString()).ToString("n2"));
- break;
- case "婚期":
- cameraTime.Parameter.KeyValues.Add(columnTitle, Convert.ToDateTime(cusRow[columnTitle].ToString()).ToYYYY_MM_dd());
- break;
- case "接单人":
- cameraTime.Parameter.KeyValues.Add(columnTitle, cusRow[columnTitle].ToString());
- break;
-
- case "拍摄名称":
- cameraTime.Parameter.KeyValues.Add(columnTitle, String.Join(",", GetValueList(cameraTime.Parameter.DataRows, columnTitle)));
- break;
- //star
- case "服装套数":
- cameraTime.Parameter.KeyValues.Add(columnTitle, cameraTime.Parameter.DataRows.Sum(r => r.Field<int>(columnTitle)).ToString());
- break;
- case "摄影师满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "摄影师"));
- break;
- case "摄影助理满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "摄影师助理"));
- break;
- case "化妆师满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "化妆师"));
- break;
- case "化妆助理满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "化妆师助理"));
- break;
- case "引导师满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "引导师"));
- break;
- case "引导助理满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "引导师助理"));
- break;
- case "选片师满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "选片师"));
- break;
- case "初修状态":
- {
- int digStatus = cameraTime.Parameter.DataRows.Sum(r => GetRepairAndDesignerStatus(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus == 0 ? "未修" : digStatus == cameraTime.Parameter.DataRows.Length ? "OK" : "修片中");
- }
- break;
- case "选片状态":
- {
- int digStatus2 = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus2 == 0 ? "未选" : digStatus2 == cameraTime.Parameter.DataRows.Length ? "OK" : "选片中");
- }
- break;
- case "看版师满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "看设计师"));
- break;
- case "设计状态":
- {
- int digStatus = cameraTime.Parameter.DataRows.Sum(r => GetRepairAndDesignerStatus(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus == 0 ? "未设计" : digStatus == cameraTime.Parameter.DataRows.Length ? "OK" : "设计中");
- }
- break;
- case "看版状态":
- {
- int digStatus2 = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus2 == 0 ? "未看" : digStatus2 == cameraTime.Parameter.DataRows.Length ? "OK" : "看版中");
- }
- break;
- case "预约取件商品":
- cameraTime.Parameter.KeyValues.Add(columnTitle, String.Join(",", GetValueList(cameraTime.Parameter.DataRows, columnTitle)));
- break;
- case "取件师满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "取件师"));
- break;
- case "完成状态":
- {
- int digStatus = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus == 0 ? "未完成" : digStatus == cameraTime.Parameter.DataRows.Length ? "OK" : "部分完成");
- }
- break;
- case "取件状态":
- {
- int digStatus2 = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus2 == 0 ? "未取" : digStatus2 == cameraTime.Parameter.DataRows.Length ? "OK" : "部分已取");
- }
- break;
- case "预约服务内容":
- cameraTime.Parameter.KeyValues.Add(columnTitle, String.Join(",", GetValueList(cameraTime.Parameter.DataRows, columnTitle)));
- break;
- case "服务人员1满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "服务人员1"));
- break;
- case "服务人员2满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "服务人员2"));
- break;
- case "服务状态":
- {
- int digStatus = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus == 0 ? "未进行" : digStatus == cameraTime.Parameter.DataRows.Length ? "OK" : "进行中");
- }
- break;
- case "预约服装套数":
- int LeiJingHuZhuang = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r["内景服装套数"].ToString()));
- int WaiJingHuZhuang = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r["外景服装套数"].ToString()));
- string textString = "";
- if (LeiJingHuZhuang > 0)
- {
- textString = String.Format("内景:{0}", LeiJingHuZhuang);
- }
- string textString2 = "";
- if (WaiJingHuZhuang > 0)
- {
- textString2 = String.Format("外景:{0}", WaiJingHuZhuang);
- }
- cameraTime.Parameter.KeyValues.Add(columnTitle, String.Format("{0}{1}", textString, textString2));
- break;
- case "礼服师满意度":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderSatisfactionSurveyData(cameraTime.ReservationTime.OrderNumber, "礼服师"));
- break;
- case "选礼服状态":
- {
- int digStatus = cameraTime.Parameter.DataRows.Sum(r => Convert.ToInt32(r[columnTitle].ToString()));
- cameraTime.Parameter.KeyValues.Add(columnTitle, digStatus == 0 ? "未选" : digStatus == cameraTime.Parameter.DataRows.Length ? "OK" : "部分已选");
- }
- break;
- //end
- case "安排人":
- cameraTime.Parameter.KeyValues.Add(columnTitle, LYFZ.DAL.DAL_ErpUser.GetUserIDToUserName(String.Join(",", GetValueList(cameraTime.Parameter.DataRows, columnTitle))));
- break;
- case "安排时间":
- cameraTime.Parameter.KeyValues.Add(columnTitle, cameraTime.Parameter.DataRows.ToList().Max(r => String.IsNullOrWhiteSpace(r[columnTitle].ToString()) ? LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime() : Convert.ToDateTime(r[columnTitle].ToString())).ToYYYY_MM_dd_HH_mm());
- break;
- case "沟通时间":
- string tempDateTime = this.GetOrderCustomersTrackRecord(cameraTime.ReservationTime.OrderNumber, columnTitle);
- cameraTime.Parameter.KeyValues.Add(columnTitle, String.IsNullOrWhiteSpace(tempDateTime) ? "" : Convert.ToDateTime(tempDateTime).ToYYYY_MM_dd_HH_mm());
- break;
- case "客服人员":
- cameraTime.Parameter.KeyValues.Add(columnTitle, LYFZ.DAL.DAL_ErpUser.GetUserIDToUserName(this.GetOrderCustomersTrackRecord(cameraTime.ReservationTime.OrderNumber, columnTitle)));
- break;
- case "沟通状态":
- case "沟通备注":
- cameraTime.Parameter.KeyValues.Add(columnTitle, this.GetOrderCustomersTrackRecord(cameraTime.ReservationTime.OrderNumber, columnTitle));
- break;
- default:
- if (cusRow.Table.Columns.Contains(columnTitle))
- {
- cameraTime.Parameter.KeyValues.Add(columnTitle, cusRow[columnTitle].ToString());
- }
- break;
- }
- }
- }
- }
- /// <summary>
- /// 转换初修和设计的状态值
- /// </summary>
- /// <param name="status"></param>
- /// <returns></returns>
- static int GetRepairAndDesignerStatus(string status)
- {
- switch (status)
- {
- case "1":return 2;
- case "2": return 1;
- default:
- if (String.IsNullOrWhiteSpace(status))
- {
- return 0;
- }
- else {
- return Convert.ToInt32(status);
- }
- }
- }
- string GetOrderCustomersTrackRecord(string orderNumber, string columnTitle)
- {
- string valueString = "";
- if (this.OrderCustomersTrackRecordData != null && this.OrderCustomersTrackRecordData.Rows.Count > 0)
- {
- DataRow[] dataRows = this.OrderCustomersTrackRecordData.Select(String.Format("TR_OrdNumber='{0}'", orderNumber));
- if (dataRows != null&& dataRows.Length>0)
- {
- valueString = dataRows[0][columnTitle].ToString();
- }
- }
- return valueString;
- }
- /// <summary>
- /// 获取满意度调查值
- /// </summary>
- /// <param name="orderNumber"></param>
- /// <param name="SurveyType"></param>
- /// <returns></returns>
- string GetOrderSatisfactionSurveyData(string orderNumber,string SurveyType)
- {
- string _OrderSatisfaction = "";
- if (this.OrderSatisfactionSurveyData != null&&this.OrderSatisfactionSurveyData.Rows.Count>0)
- {
- DataRow dataRow = this.OrderSatisfactionSurveyData.Select(String.Format("订单号='{0}'", orderNumber)).ToList().Find(r => r.Field<string>("回访对象") == SurveyType);
- if (dataRow != null)
- {
- _OrderSatisfaction = dataRow["sfrs_Name"].ToString();
- }
- }
- return _OrderSatisfaction;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="dataRows"></param>
- /// <param name="columnName"></param>
- /// <returns></returns>
- List<string> GetValueList(DataRow[] dataRows, string columnName)
- {
- List<string> valueList = new List<string>();
- foreach (DataRow row in dataRows)
- {
- if (row[columnName] != null)
- {
- string valueString = row[columnName].ToString();
- if (!valueList.Contains(valueString))
- {
- valueList.Add(valueString);
- }
- }
- }
- return valueList;
- }
- List<string> GetCameraDataColumns(CameraType cameraType)
- {
- EnumPermissions.BusinessType businessType = GetCurrentStoreBusinessType(this.CurrentQueryStoreList2);
- if (this._TitleColumnDisplayList!=null&&this._TitleColumnDisplayList.Count > 0)
- {
- return DAL.CameraDataQuery.GetCameraDataColumns(cameraType, businessType).FindAll(
- c => this._TitleColumnDisplayList.Any(t => (t.ColumnText.ToLower() == c.ToLower() && t.Display == 1))
- || !this._TitleColumnDisplayList.Any(t => t.ColumnText.ToLower() == c.ToLower())
- );
- }
- else {
- return DAL.CameraDataQuery.GetCameraDataColumns(cameraType, businessType);
- }
-
- }
- int currentPage = 1;//当前页
- int sumPageCount = 1;//共多少页
- int PageCount = 1800;//每页多少行
- /// <summary>
- /// 绑定数据
- /// </summary>
- void BindPanelDataView()
- {
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.BindPanelDataView(cameraType);
- }
- /// <summary>
- /// 绑定数据
- /// </summary>
- void BindPanelDataView(CameraType cameraType)
- {
- PanelDataView.DataRowList.Clear();
- PanelDataView.HeadColumnRow.DataColumnList.Clear();
- string[] titleColumns = this.GetCameraDataColumns(cameraType).ToArray();
- if (titleColumns.Length <= 6)
- {
- MessageBoxCustom.Show("表格列字段配置不正确");
- return;
- }
- for (int i = 0; i < titleColumns.Length; i++)
- {
- PanelDataView.HeadColumnRow.DataColumnList.Add(new ComponentLibrary.PDataColumn
- {
- Text = String.Format("{0}", titleColumns[i])
- ,
- Width = GetTitleDataColumnWidth(titleColumns, titleColumns[i])
- });
- }
- List<int> orderTypeList = GetOrderTypeList();
- List<LYFZ.Model.CameraControlTemplate> PageTemplateList=this.CameraControlTemplateList.FindAll(t => orderTypeList.Any(orderType => orderType == t.OrderType)).OrderBy(c=>c.CameraDateTime).ThenBy(c=>c.OrderType).ToList();
- int sumRowCount = PageTemplateList.Sum(t => t.TimeTemplateData.TimeTemplateDataList.Count);
- if (sumRowCount > this.PageCount)
- {
- this.sumPageCount = sumRowCount / this.PageCount;
- if ((sumRowCount % this.PageCount) > 0)
- {
- this.sumPageCount = this.sumPageCount + 1;
- }
- }
- List<LYFZ.Model.CameraControlTemplate> currentPageTemplateList = this.GetCurrentPageTemplateList(this.currentPage, this.PageCount, PageTemplateList);
- IEnumerable <IGrouping<long, LYFZ.Model.CameraControlTemplate>> templateListGroup = currentPageTemplateList.FindAll(t => orderTypeList.Any(orderType => orderType == t.OrderType)).GroupBy(s => s.CameraDateTime);
- foreach (IGrouping<long, LYFZ.Model.CameraControlTemplate> items in templateListGroup)
- {
- this.AddCameraDate(items.Key.JavaScriptTimeStampToDateTime(), items);
- }
-
- this.likCurrentPage.Text = this.currentPage.ToString();
- this.likSumPage.Text = this.sumPageCount.ToString();
- PanelDataView.RefreshTableView();
- // ScheduleStatisticsInfo(this.CameraControlTemplateList);
- ScheduleStatisticsInfo(currentPageTemplateList);
- this.PanelDataView.Focus();
- }
- /// <summary>
- /// 搜索函数
- /// </summary>
- /// <param name="cameraTime"></param>
- /// <returns></returns>
- bool CheckFilterTemplateList(CameraTimeTemplate cameraTime)
- {
- bool filter = true;
- if (this.cbxNotificationStatus.SelectedIndex > 0)
- {
- if (this.cbxNotificationStatus.Text == "不在预设档期")
- {
- if (cameraTime.Parameter.WithinSchedule)
- {
- return false;
- }
- }
- else if (this.cbxNotificationStatus.Text == "未预约")
- {
- if (cameraTime.ReservationTime.NotifyCustomerType == 0 && String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- filter = true;
- }
- else {
- return false;
- }
- }
- else
- {
- if (((NotifyCustomerType)cameraTime.ReservationTime.NotifyCustomerType).ToString() == this.cbxNotificationStatus.Text)
- {
- if (((NotifyCustomerType)cameraTime.ReservationTime.NotifyCustomerType) == NotifyCustomerType.未通知)
- {
- if (String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber)|| !cameraTime.Parameter.WithinSchedule)
- {
- return false;
- }
- }
- filter = true;
- } else {
- return false;
- }
- }
- }
- if (this.cbxCustomLabel.SelectedIndex > 0)
- {
- if (cameraTime.ReservationTime.CustomLabel != this.cbxCustomLabel.Text)
- {
- return false;
- }
- }
- if (this.cbxOther.SelectedIndex > 0)
- {
- switch (this.cbxOther.Text)
- {
- case "欠款":
- if (!cameraTime.Parameter.IsArrears)
- {
- return false;
- }
- break;
- case "重拍过":
- if (cameraTime.Parameter.RetakesCount<=0)
- {
- return false;
- }
- break;
- case "意向订单":
- if (!cameraTime.Parameter.IsIntentionOrder)
- {
- return false;
- }
- break;
- case "预约异常":
- if (!cameraTime.ReservationError())
- {
- return false;
- }
- break;
- case "被禁用档期":
- if (cameraTime.ReservationTime.IsEnable!=0)
- {
- return false;
- }
- break;
- case "改期二次以上":
- if (cameraTime.Parameter.ReschedulesCount<=2)
- {
- return false;
- }
- break;
- case "超期完成":
- if (!cameraTime.Parameter.AreExtendedComplete)
- {
- return false;
- }
- break;
- }
- }
- if (!String.IsNullOrWhiteSpace(this.txtKeyword.Text.Trim()))
- {
- filter = false;
- string keyWord = this.txtKeyword.Text.Trim();
- if (this.cbxSearchField.SelectedIndex == 0)
- {
- if (this.PanelDataView.HeadColumnRow.DataColumnList.Count > 4)
- {
- for (int i = 4; i < this.PanelDataView.HeadColumnRow.DataColumnList.Count; i++)
- {
- string findKey = this.PanelDataView.HeadColumnRow.DataColumnList[i].Text;
- if (cameraTime.Parameter.KeyValues.ContainsKey(findKey))
- {
- if (cameraTime.Parameter.KeyValues[findKey].ToLower().Contains(keyWord.ToLower()))
- {
- return true;
- }
- }
- }
- }
- }
- else {
- string findKey = this.cbxSearchField.Text;
- if (cameraTime.Parameter.KeyValues.ContainsKey(findKey))
- {
- if (cameraTime.Parameter.KeyValues[findKey].ToLower().Contains(keyWord.ToLower()))
- {
- return true;
- }
- }
- }
- }
- return filter;
- }
- /// <summary>
- /// 获取模板档期分页集合
- /// </summary>
- /// <param name="_currentPage"></param>
- /// <param name="_PageCount"></param>
- /// <param name="sumTemplateList"></param>
- /// <returns></returns>
- List<LYFZ.Model.CameraControlTemplate> GetCurrentPageTemplateList(int _currentPage, int _PageCount, List<LYFZ.Model.CameraControlTemplate> sumTemplateList)
- {
- List<LYFZ.Model.CameraControlTemplate> pageList = new List<Model.CameraControlTemplate>();
- int pageRowCount = pageList.Sum(t => t.TimeTemplateData.TimeTemplateDataList.Count);
- int rowIndex = 0;
- foreach (LYFZ.Model.CameraControlTemplate controlTemplate in sumTemplateList)
- {
- LYFZ.Model.CameraControlTemplate Template = Newtonsoft.Json.JsonConvert.DeserializeObject<LYFZ.Model.CameraControlTemplate>(controlTemplate.ToString());
- Template.TimeTemplateData.TimeTemplateDataList.Clear();
- foreach (CameraTimeTemplate cameraTime in controlTemplate.TimeTemplateData.TimeTemplateDataList)
- {
- if (this.CheckFilterTemplateList(cameraTime))
- {
- if (rowIndex >= _currentPage * _PageCount - _PageCount && rowIndex < _currentPage * _PageCount)
- {
- if (pageRowCount + Template.TimeTemplateData.TimeTemplateDataList.Count < _currentPage * _PageCount)
- {
- Template.TimeTemplateData.TimeTemplateDataList.Add(cameraTime);
- }
- else
- {
- return pageList;
- }
- }
- rowIndex++;
- }
- }
- pageList.Add(Template);
- }
- return pageList;
- }
- /// <summary>
- /// 统计摄控信息
- /// </summary>
- /// <param name="cameraTemplateList"></param>
- void ScheduleStatisticsInfo(List<LYFZ.Model.CameraControlTemplate> cameraTemplateList)
- {
- IEnumerable<IGrouping<int, LYFZ.Model.CameraControlTemplate>> templateListGroup = cameraTemplateList.GroupBy(s => s.OrderType);
- foreach (Control con in this.flowLayoutPanel4.Controls)
- {
- if (con.GetType() == typeof(LYFZ.ComponentLibrary.CheckBoxEx))
- {
- LYFZ.ComponentLibrary.CheckBoxEx OrderCheckBox = (LYFZ.ComponentLibrary.CheckBoxEx)con;
- // if (OrderCheckBox.Visible)
- {
- int orderType = Convert.ToInt32(OrderCheckBox.Tag);
- CameraOrderType cameraOrderType = (CameraOrderType)orderType;
- IEnumerable<IGrouping<int, LYFZ.Model.CameraControlTemplate>> templateList = templateListGroup.Where(i => i.Key == orderType);
- if (templateList.Count() > 0)
- {
- //总的档期数
- int sumCount = templateList.Sum(i => i.Sum(t => t.TimeTemplateData.TimeTemplateDataList.FindAll(s=>s.Parameter.WithinSchedule).Count));
- //已预约的档期数
- int sumReservationCount = templateList.Sum(i => i.Sum(t => t.TimeTemplateData.TimeTemplateDataList.FindAll(time => !String.IsNullOrWhiteSpace(time.ReservationTime.OrderNumber)&& time.Parameter.WithinSchedule).Count));
- //已禁用的档期数
- int sumDisableCount = templateList.Sum(i => i.Sum(t => t.TimeTemplateData.TimeTemplateDataList.FindAll(time => time.ReservationTime.IsEnable == 0).Count));
- //不在档期内的 预约客人
- int NotWithinScheduleSumCount = templateList.Sum(i => i.Sum(t => t.TimeTemplateData.TimeTemplateDataList.FindAll(s => !s.Parameter.WithinSchedule).Count));
- string DisableText = "";
- if (sumDisableCount > 0)
- {
- DisableText = String.Format("-{0}", sumDisableCount);
- }
- string NotWithinScheduleText = "";
- if (NotWithinScheduleSumCount > 0)
- {
- NotWithinScheduleText = String.Format("+{0}", NotWithinScheduleSumCount);
- }
- OrderCheckBox.Text = String.Format("{0}:({1}/{2}{3}){4}", cameraOrderType.ToString(), sumReservationCount, sumCount, DisableText, NotWithinScheduleText);
- }
- else {
- OrderCheckBox.Text = String.Format("{0}:({1}/{2}{3})", cameraOrderType.ToString(), 0, 0, "");
- }
- }
- }
- }
- }
- ThumbtackData ToThumbtackData(LYFZ.Model.ThumbtackRecord record)
- {
- ThumbtackData thumbtack = new ThumbtackData();
- thumbtack.Tag = record;
- thumbtack.ThumbtackType = record.ThumbtackType;
- thumbtack.ThumbtackText = record.ThumbtackInfo;
- return thumbtack;
- }
- /// <summary>
- /// 添加绑定数据
- /// </summary>
- /// <param name="dayDate"></param>
- /// <param name="items"></param>
- void AddCameraDate(DateTime dayDate, IGrouping<long, LYFZ.Model.CameraControlTemplate> items)
- {
- int Index = 0;
- int sumRowCount = items.Sum(t => t.TimeTemplateData.TimeTemplateDataList.Count);
- List<LYFZ.Model.ThumbtackRecord> thumbtackRecordList = this.thumbtackRecordList.FindAll(t=>t.DateTimeMark.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd()==dayDate.ToYYYY_MM_dd());
- List<ThumbtackData> ThumbtackList = new List<ThumbtackData>();
- foreach (LYFZ.Model.ThumbtackRecord record in thumbtackRecordList)
- {
- ThumbtackList.Add(this.ToThumbtackData(record));
- }
- foreach (LYFZ.Model.CameraControlTemplate cameraTemplate in items)
- {
- int subIndex = 0;
- foreach (LYFZ.Model.CameraTimeTemplate time in cameraTemplate.TimeTemplateData.TimeTemplateDataList.OrderBy(t=>t.CameraTime))
- {
- int dayDateCrossRowCount = 1;
- if (Index == 0)
- {
- dayDateCrossRowCount = sumRowCount;
- }
- int orderTypeCrossRowCount = 1;
- if (subIndex == 0)
- {
- orderTypeCrossRowCount = cameraTemplate.TimeTemplateData.TimeTemplateDataList.Count;
- }
- ComponentLibrary.PDataRow row = GetNewDataRow(dayDate, dayDateCrossRowCount, orderTypeCrossRowCount, cameraTemplate, time, ThumbtackList);
- if (sumRowCount == 1)
- {
- row.Height = 64;
- }
-
- PanelDataView.DataRowList.Add(row);
- Index++;
- subIndex++;
- }
-
- }
- }
-
- string ShopIDToShopName(string shopid, System.Windows.Forms.ComboBox cbxStoreList)
- {
- foreach (ItemValue item in cbxStoreList.Items)
- {
- if (item.Tag != null)
- {
- QueryStoreInfo qStoreInfo = GetQueryStoreInfo(item);
- if (qStoreInfo != null)
- {
- if (qStoreInfo.DividedShop.ToLower() == shopid.ToLower())
- {
- return qStoreInfo.DividedShop_Name;
- }
- }
- }
- }
- return shopid;
- }
- /// <summary>
- /// 获取行
- /// </summary>
- /// <param name="dayDate"></param>
- /// <param name="dateCrossRowCount"></param>
- /// <param name="orderTypeCrossRowCount"></param>
- /// <param name="cameraTemplate"></param>
- /// <param name="cameraTime"></param>
- /// <returns></returns>
- ComponentLibrary.PDataRow GetNewDataRow(DateTime dayDate, int dateCrossRowCount, int orderTypeCrossRowCount, LYFZ.Model.CameraControlTemplate cameraTemplate, CameraTimeTemplate cameraTime, List<ThumbtackData> dayThumbtackList)
- {
- ComponentLibrary.PDataRow row = new PDataRow();
- CameraType cameraType = (CameraType)cameraTemplate.CameraType;
- CameraOrderType cameraOrderType = (CameraOrderType)cameraTemplate.OrderType;
- string LunarCalendarDayTime = Command.Command_CalendarTurnLunar.GetChineseDateTimeToNoYear(dayDate);
- string weekName = weekNames[SetCameraTemplate.GetDayOfWeekIndex(dayDate.DayOfWeek) - 1];
- ComponentLibrary.PDataColumn cell0 = new ComponentLibrary.PDataColumn
- {
- Text = String.Format("{0}\r\n{1}\r\n{2}", weekName, dayDate.ToString("yyyy-MM-dd"), LunarCalendarDayTime)
- ,
- CrossRow = dateCrossRowCount
- ,
- DateTimeTag = dayDate
- ,
- Tag = weekName
-
- };
- //不在档期内的 预约客人
- int NotWithinScheduleSumCount = cameraTemplate.TimeTemplateData.TimeTemplateDataList.FindAll(t => !t.Parameter.WithinSchedule).Count;
- string NotWithinScheduleText = "";
- if (NotWithinScheduleSumCount > 0)
- {
- NotWithinScheduleText = String.Format("+{0}", NotWithinScheduleSumCount);
- }
- string DisableText = "";
- if (cameraTemplate.TimeTemplateData.TimeTemplateDataList.Any(t => t.ReservationTime.IsEnable == 0))
- {
- DisableText = String.Format("-{0}", cameraTemplate.TimeTemplateData.TimeTemplateDataList.FindAll(t => t.ReservationTime.IsEnable == 0).Count);
- }
- string ScheduleStatistics = String.Format("({0}/{1}{2}){3}", cameraTemplate.TimeTemplateData.TimeTemplateDataList.FindAll(t => !String.IsNullOrWhiteSpace(t.ReservationTime.OrderNumber)&& t.Parameter.WithinSchedule).Count
- , cameraTemplate.TimeTemplateData.TimeTemplateDataList.FindAll(t => t.Parameter.WithinSchedule).Count, DisableText, NotWithinScheduleText);
- string ShopName = "";
- if (IsMultiShopID(this.CurrentQueryStoreList2))
- {
- ShopName = String.Format("\r\n【{0}】", ShopIDToShopName(cameraTemplate.ShopID, this.cbxStoreList2));
- }
- Font columnTextFont = new Font("微软雅黑", 10, FontStyle.Regular);
- Color columnTextColor = Color.Black;
- if (cameraTime.ReservationTime.IsEnable == 0)
- {
- columnTextFont = new Font("微软雅黑", 10, FontStyle.Strikeout | FontStyle.Italic);
- columnTextColor = Color.Gray;
- }
- else if (cameraTime.ReservationError())
- {
- columnTextFont = new Font("微软雅黑", 10, FontStyle.Strikeout | FontStyle.Italic);
- columnTextColor = Color.Maroon;
- }
- else if (cameraTime.Parameter.IsArrears)
- {
- columnTextColor = Color.Red;
- }
- else if (cameraTime.Parameter.RetakesCount>0)
- {
- columnTextColor = Color.Orange;
- }
- else if (cameraTime.Parameter.IsIntentionOrder)
- {
- columnTextColor = Color.Violet;
- }
- else if (cameraTime.Parameter.ReschedulesCount>2)
- {
- columnTextColor = Color.Green;
- }
- else if (!String.IsNullOrWhiteSpace(cameraTime.Parameter.OrderAutoColor))
- {
- columnTextFont = new Font("微软雅黑", 10, FontStyle.Bold);
- columnTextColor = cameraTime.Parameter.GetOrderAutoColor();
- }
- else if (cameraTime.Parameter.AreExtendedComplete)
- {
- columnTextColor = Color.DodgerBlue;
- }
- if (dayThumbtackList.Count > 0)
- {
- cell0.ThumbtackList.AddRange(dayThumbtackList);
- if (dayThumbtackList.Any(t => t.ThumbtackType == 1))
- {
- columnTextFont = new Font("微软雅黑", 10, FontStyle.Strikeout | FontStyle.Italic);
- columnTextColor = Color.BlueViolet;
- }
- }
-
- ComponentLibrary.PDataColumn cell1 = new ComponentLibrary.PDataColumn
- {
- Text = String.Format("{0}[{1}]{2}", cameraOrderType.ToString(), ScheduleStatistics, ShopName)
- ,
- CrossRow = orderTypeCrossRowCount
-
- };
- ComponentLibrary.PDataColumn cell2 = new ComponentLibrary.PDataColumn
- {
- Text = String.Format("{1}{0}", cameraTime.CameraTime,cameraTime.Parameter.WithinSchedule?"": "☆ ")
- ,TextFont= columnTextFont
- ,TextColor= columnTextColor
- ,
- Tag = cameraTime
- };
- row.DataColumnList.AddRange(new ComponentLibrary.PDataColumn[] { cell0, cell1, cell2 });
- for (int i = 3; i < this.PanelDataView.HeadColumnRow.DataColumnList.Count; i++)
- {
- string cellValue = "";
- string cellKey = this.PanelDataView.HeadColumnRow.DataColumnList[i].Text.Trim();
- if (cameraTime.Parameter != null && cameraTime.Parameter.KeyValues.Count > 0)
- {
- if (cameraTime.Parameter.KeyValues.ContainsKey(cellKey))
- {
- if (cellKey == "客户电话")
- {
- //ProhibitViewCustomerPhoneNumber
- if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber) && !LYFZ.BLL.BLL_ErpUser.IsAdministrator())
- {
- cellValue = LYFZ.Command.Command_Validate.HidePhone(cameraTime.Parameter.KeyValues[cellKey]);
- }
- else {
- cellValue = cameraTime.Parameter.KeyValues[cellKey];
- }
-
- }
- else
- {
- cellValue = cameraTime.Parameter.KeyValues[cellKey];
- }
- }
- }
- ComponentLibrary.PDataColumn cell = new ComponentLibrary.PDataColumn
- {
- Text = String.Format("{0}", cellValue)
- ,
- TextColor = columnTextColor
- ,
- TextFont = columnTextFont
- };
- switch (cellKey)
- {
- case "通知状态":
- cell.Text = String.Format("{0}", GetNotifyCustomerTypeText(cameraTime));
- cell.Tag = cameraTime.ReservationTime.NotifyCustomerType;
- break;
- case "通知备注":
- cell.Text = String.Format("{0}", cameraTime.ReservationTime.CustomerFeedback);
- break;
- case "自定义标签":
- cell.Text = String.Format("{0}", cameraTime.ReservationTime.CustomLabel);
- break;
- case "订单号":
- cell.Text = String.Format("{0}", cameraTime.ReservationTime.ShowOrderNumber);
- break;
- /* case "预约时间":
- case "上门时间":
- cell.Text = String.Format("{0} {1}", dayDate.ToString("yyyy-MM-dd"), cameraTime.CameraTime);
- break;*/
- }
- row.DataColumnList.Add(cell);
-
- }
- row.Tag = cameraTemplate;
- return row;
- }
- static string GetNotifyCustomerTypeText(CameraTimeTemplate cameraTime)
- {
- if (cameraTime.ReservationTime.NotifyCustomerType == 0 && String.IsNullOrWhiteSpace(cameraTime.ReservationTime.OrderNumber))
- {
- return "未预约";
- }
- else if (cameraTime.Parameter.WithinSchedule)
- {
- return ((NotifyCustomerType)cameraTime.ReservationTime.NotifyCustomerType).ToString();
- }
- else
- {
- return "不在预设档期";
- }
- }
- int GetTitleDataColumnWidth(string[] titleNames, string titleName)
- {
- int cell_width = 160;
- if (titleName.Trim() == titleNames[0])
- {
- cell_width = 130;
- }
- else if (titleName.Trim() == titleNames[1])
- {
- cell_width = 160;
- }
- else if (titleName.Trim() == titleNames[2])
- {
- cell_width = 110;
- }
- else if (titleName.Trim() == titleNames[3])
- {
- cell_width = 110;
- }
- return cell_width;
- }
- /// <summary>
- /// 初始化摄控详情
- /// </summary>
- void initializationCamera()
- {
- this.dateTimePickerStar.Value = SDateTime.Now;
- this.dateTimePickerEnd.Value = SDateTime.Now;
- }
- #region 摄控详情时间控制
- /// <summary>
- /// 近一个月
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnNearlyOneMonth_Click(object sender, EventArgs e)
- {
- this.dateTimePickerStar.Value = SDateTime.Now;
- this.dateTimePickerEnd.Value = SDateTime.Now.AddDays(29);
- this.LoadTemplateData();
- }
- /// <summary>
- /// 近半个月
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnNearlyHalfMonth_Click(object sender, EventArgs e)
- {
- this.dateTimePickerStar.Value = SDateTime.Now;
- this.dateTimePickerEnd.Value = SDateTime.Now.AddDays(14);
- this.LoadTemplateData();
- }
- /// <summary>
- /// 近一周
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnNearlyOneWeek_Click(object sender, EventArgs e)
- {
- this.dateTimePickerStar.Value = SDateTime.Now;
- this.dateTimePickerEnd.Value = SDateTime.Now.AddDays(6);
- this.LoadTemplateData();
- }
- /// <summary>
- /// 今天
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnNowaday_Click(object sender, EventArgs e)
- {
- this.dateTimePickerStar.Value = SDateTime.Now;
- this.dateTimePickerEnd.Value = SDateTime.Now;
- this.LoadTemplateData();
- }
- /// <summary>
- /// 后一天
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnAfterDay_Click(object sender, EventArgs e)
- {
- int tempDay = CameraTemplateHandle.GetSubtractDay(this.dateTimePickerStar.Value, this.dateTimePickerEnd.Value) + 1;
- this.dateTimePickerEnd.Value = this.dateTimePickerEnd.Value.AddDays(tempDay);
- this.dateTimePickerStar.Value = this.dateTimePickerStar.Value.AddDays(tempDay);
- this.LoadTemplateData();
- }
- /// <summary>
- /// 前一天
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BtnBeforeDay_Click(object sender, EventArgs e)
- {
- int tempDay = CameraTemplateHandle.GetSubtractDay(this.dateTimePickerStar.Value, this.dateTimePickerEnd.Value) + 1;
- this.dateTimePickerStar.Value = this.dateTimePickerStar.Value.AddDays(-tempDay);
- this.dateTimePickerEnd.Value = this.dateTimePickerEnd.Value.AddDays(-tempDay);
- this.LoadTemplateData();
- }
- private void DateTimePickerEnd_ValueChanged(object sender, EventArgs e)
- {
- if (this.dateTimePickerStar.Value > this.dateTimePickerEnd.Value)
- {
- this.dateTimePickerStar.Value = this.dateTimePickerEnd.Value;
- }
-
- }
- private void DateTimePickerStar_ValueChanged(object sender, EventArgs e)
- {
- if (this.dateTimePickerStar.Value > this.dateTimePickerEnd.Value)
- {
- this.dateTimePickerEnd.Value = this.dateTimePickerStar.Value;
- }
-
- }
- #endregion
- bool isUpdateQuery = false;
- bool isUpdateOrderDataTableQuery = false;
- private void TabControlEx1_Selected(object sender, TabControlEventArgs e)
- {
- this.HideTpsInfo();
-
- if (this.tabControlEx1.SelectedIndex != 1)
- {
- this.lbColorText.Hide();
- }
- switch (this.tabControlEx1.SelectedIndex)
- {
- case 0:
- if (isUpdateQuery)
- {
- this.BtnUpdateQuery_Click(null, null);
- }
- break;
- case 1:
- if (this.currentOrderDataTable == null||isUpdateOrderDataTableQuery|| this.isGoToCameraRecord)
- {
- this.LoadTemplateData();
- this.isGoToCameraRecord = false;
- }
- this.lbColorText.Show();
- break;
- case 2:
- {
-
- }
- break;
- case 3:
- break;
- }
- }
- void HideTpsInfo()
- {
- this.tpsInfo.Hide(this.plCalendarTable);
- this.tpsInfo.Hide(this.PanelDataView);
- }
-
- bool isShownLoad = true;
- private void MainCameraControlBook_Shown(object sender, EventArgs e)
- {
- this.plCalendarInfo.Show();
- this.cbxOther.SelectedIndex = 0;
- this.BindNotificationStatus();
- //绑定门店
- BindStoreList(this.cbxStoreList,LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition);
- BindStoreList(this.cbxStoreList2, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition);
- this.SetOrderTypeChBoxShow();
- this.InitializeCalendar();
- this.isShownLoad = false;
- LoadColorList();
- GoToCameraRecord();
- }
- void BindNotificationStatus()
- {
- this.cbxNotificationStatus.Items.Clear();
- this.cbxNotificationStatus.Items.Add("全部");
- this.cbxNotificationStatus.Items.Add("未预约");
- this.cbxNotificationStatus.Items.Add("不在预设档期");
- this.cbxNotificationStatus.Items.AddRange(Enum.GetNames(typeof(NotifyCustomerType)));
- this.cbxNotificationStatus.SelectedIndex = 0;
- }
- List<Model.Model_ColorSetting> ColorSettingList = new List<Model_ColorSetting>();
- /// <summary>
- /// 加载自定义颜色
- /// </summary>
- void LoadColorList()
- {
- BLL.BLL_ColorSetting bLL_Color = new BLL.BLL_ColorSetting();
- ColorSettingList = bLL_Color.GetDataTableToOblList<Model_ColorSetting>(bLL_Color.GetAllList().Tables[0]);
- }
- CameraReservationDataCount reservationDataCount = new CameraReservationDataCount();
- /// <summary>
- /// 加载预约统计数量数据
- /// </summary>
- void LoadCameraReservationData()
- {
- if (this.CurrentQueryStoreList != null)
- {
- string shopIDString = "";
- if (this.CurrentQueryStoreList.QueryType != 0)
- {
- shopIDString = GetQueryStoreList(this.CurrentQueryStoreList);
- }
- //DateTime dateStar = Convert.ToDateTime(String.Format("{0}-{1}-01", this.selectYear, this.selectMonth));
- //DateTime dateEnd = dateStar.AddMonths(1).AddDays(-1).ToDayDateMaxTime();
- DateTime dateStar = CellWeekContent.GetDayDateTime(this.selectYear, this.selectMonth,1).ToYYYYMMddDate();
- DateTime dateEnd = CellWeekContent.GetDayDateTime(this.selectYear, this.selectMonth, 42).ToDayDateMaxTime();
- this.LoadCameraReservationData(dateStar, dateEnd, shopIDString);
- }
- else
- {
- MessageBoxCustom.Show("请选择门店");
- }
- }
- /// <summary>
- /// 加载预约统计数量数据
- /// </summary>
- /// <param name="dateStar"></param>
- /// <param name="dateEnd"></param>
- /// <param name="shopID"></param>
- void LoadCameraReservationData(DateTime dateStar, DateTime dateEnd, string shopID)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在加载预约统计数据...");
- this.reservationDataCount.LoadData(dateStar, dateEnd, shopID, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition);
- }
- catch(Exception ex) {
- MessageBoxCustom.Show(String.Format("加载预约统计数据时出错:{0}",ex.Message));
- }
- });
- }
- private void MainCameraControlBook_Load(object sender, EventArgs e)
- {
- this.HideORShowStoresList(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition);
- this.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
- this.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
- this.initializationCamera();
-
- }
- #region 摄控日历初始化
- /// <summary>
- /// 当前选择年
- /// </summary>
- int selectYear = SDateTime.Now.Year;
- /// <summary>
- /// 当前选择月
- /// </summary>
- int selectMonth = SDateTime.Now.Month;
- private void NudMonth_ValueChanged(object sender, EventArgs e)
- {
- selectMonth = Convert.ToInt32(this.nudMonth.Value);
- this.InitializeCalendar();
- }
- private void NudYears_ValueChanged(object sender, EventArgs e)
- {
- selectYear = Convert.ToInt32(this.nudYears.Value);
- this.InitializeCalendar();
- }
- /// <summary>
- /// 是否选择了多个门店
- /// </summary>
- /// <returns></returns>
- bool IsMultiShopID(QueryStoreList StoreList)
- {
- if (!LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
- {
- return false;
- }
- if (StoreList != null)
- {
- if (StoreList.QueryStoreInfoList.Count > 1)
- {
- return true;
- }
- }
- return false;
- }
- /// <summary>
- /// 是否只选择了一个门店 或 是单店版
- /// </summary>
- /// <returns></returns>
- bool IsOneShopID(QueryStoreList StoreList)
- {
- if (!LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition)
- {
- return true;
- }
- if (StoreList != null)
- {
- if (StoreList.QueryStoreInfoList.Count==1)
- {
- return true;
- }
- }
-
- return false;
- }
- string GetShopID(QueryStoreList StoreList)
- {
- if (StoreList != null)
- {
- if (StoreList.QueryStoreInfoList.Count == 1)
- {
- return StoreList.QueryStoreInfoList[0].DividedShop;
- }
- }
- return LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID;
- }
- int dayCount = 0;
- /// <summary>
- /// 日历数据
- /// </summary>
- List<CellWeekContent> CellWeekContentList = new List<CellWeekContent>();
- /// <summary>
- /// 初始化日历数据
- /// </summary>
- void InitializeCalendar()
- {
- isUpdateQuery = false;
- dayCount = 0;
- CellWeekContentList.Clear();
- this.LoadCameraReservationData();
- // LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- // {
- try
- {
- // backgroundWorker.ReportProgress(0, "正在统计数据...");
-
- for (int i = 0; i < weekRowCount; i++)
- {
- for (int j = 0; j < weekNames.Length; j++)
- {
- CellWeekContent cellWeek = new CellWeekContent(this.selectYear, this.selectMonth, ++dayCount);
- cellWeek.RowIndex = i;
- cellWeek.CellIndex = j;
- cellWeek.WeekDayName = weekNames[cellWeek.CellIndex];
- cellWeek.WeekDayNumber = cellWeek.CellIndex + 1;
- // if (cellWeek.IsValid)
- {
- if (this.IsOneShopID(this.CurrentQueryStoreList))
- {
- this.SetThumbtack(this.reservationDataCount, cellWeek.DayTime, cellWeek.Thumbtack);
- this.SetPublicHoliday(this.reservationDataCount, cellWeek.DayTime, cellWeek.PublicHoliday);
- }
- List<LYFZ.Model.CameraControlTemplate> dayCameraTemplateList = this.reservationDataCount.CameraControlTemplateList.FindAll(t =>t.CameraDateTime.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd() == cellWeek.DayTime.ToYYYY_MM_dd());
- cellWeek.CameraTypeItemList.Add(this.reservationDataCount.GetCameraTypeItem(LYFZ.Model.CameraType.拍照客人, cellWeek.DayTime, dayCameraTemplateList));
- cellWeek.CameraTypeItemList.Add(this.reservationDataCount.GetCameraTypeItem(LYFZ.Model.CameraType.选片客人, cellWeek.DayTime, dayCameraTemplateList));
- cellWeek.CameraTypeItemList.Add(this.reservationDataCount.GetCameraTypeItem(LYFZ.Model.CameraType.看版客人, cellWeek.DayTime, dayCameraTemplateList));
- cellWeek.CameraTypeItemList.Add(this.reservationDataCount.GetCameraTypeItem(LYFZ.Model.CameraType.取件客人, cellWeek.DayTime, dayCameraTemplateList));
- cellWeek.CameraTypeItemList.Add(this.reservationDataCount.GetCameraTypeItem(LYFZ.Model.CameraType.服务客人, cellWeek.DayTime, dayCameraTemplateList));
- cellWeek.CameraTypeItemList.Add(this.reservationDataCount.GetCameraTypeItem(LYFZ.Model.CameraType.选衣客人, cellWeek.DayTime, dayCameraTemplateList));
- cellWeek.CameraTypeItemList.Add(this.reservationDataCount.GetCameraTypeItem(LYFZ.Model.CameraType.爱婴上门, cellWeek.DayTime, dayCameraTemplateList));
-
- }
- this.CellWeekContentList.Add(cellWeek);
- }
- }
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("统计数据时出错:{0}", ex.Message));
- }
- // });
-
- this.CalendarTableRefresh();
- }
- void SetThumbtack(CameraReservationDataCount reservationData,DateTime dayDate, ThumbtackData thumbtack)
- {
- Model.ThumbtackRecord record= reservationData.ThumbtackRecordList.Find(t=>t.ThumbtackType==2 && t.DateTimeMark.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd()==dayDate.ToYYYY_MM_dd());
- if (record != null)
- {
- thumbtack.Tag = record;
- thumbtack.ThumbtackType = record.ThumbtackType;
- thumbtack.ThumbtackText = record.ThumbtackInfo;
-
- }
- }
- void SetPublicHoliday(CameraReservationDataCount reservationData, DateTime dayDate, ThumbtackData thumbtack)
- {
- Model.ThumbtackRecord record = reservationData.ThumbtackRecordList.Find(t => t.ThumbtackType == 1 && t.DateTimeMark.JavaScriptTimeStampToDateTime().ToYYYY_MM_dd() == dayDate.ToYYYY_MM_dd());
- if (record != null)
- {
- thumbtack.Tag = record;
- thumbtack.ThumbtackType = record.ThumbtackType;
- thumbtack.ThumbtackText = record.ThumbtackInfo;
- }
- }
- #endregion
- #region 绘制日历表
- int weekRowCount = 6;//日历行数
- int weekTitleHeight = 32;//日历标题高度
- int weekContentHeight = 180;//日历内容单元格高度
- Font weekFont = new Font("微软雅黑", 12, FontStyle.Bold);
- string[] weekNames = new string[7] { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
- Pen borderPen = new Pen(Brushes.White, 2);
- private void PlCalendarInfo_Paint(object sender, PaintEventArgs e)
- {
- if (this.chbxFixedHeader.Checked)
- {
- this.CalendarTableRefresh();
- }
- }
- private void PlCalendarTable_Paint(object sender, PaintEventArgs e)
- {
- this.PlCalendarTableDraw(e.Graphics);
- }
- private void ChbxFixedHeader_Click(object sender, EventArgs e)
- {
- this.CalendarTableRefresh();
- }
- void CalendarTableRefresh()
- {
- this.plCalendarTable.Refresh();
- }
- void PlCalendarTableDraw(Graphics g)
- {
- int days = DateTime.DaysInMonth(selectYear, selectMonth);
- Rectangle rec = new Rectangle(2, 2, (this.plCalendarTable.Width - 4) / 7, weekTitleHeight);
- foreach (CellWeekContent cellWeek in CellWeekContentList)
- {
- this.DrawCellWeekContent(cellWeek, g, new Rectangle(rec.X, rec.Y + rec.Height, rec.Width, weekContentHeight),cellWeek.RowIndex,cellWeek.CellIndex);
- }
- if (this.chbxFixedHeader.Checked)
- {
- int VerticalScrollValue = this.plCalendarInfo.VerticalScroll.Value;
- if (VerticalScrollValue > 20)
- {
- VerticalScrollValue = this.plCalendarInfo.VerticalScroll.Value - 7;
- }
- rec = new Rectangle(rec.X, rec.Y + VerticalScrollValue, rec.Width, rec.Height);
- }
- for (int i = 0; i < weekNames.Length; i++)
- {
- Rectangle weekRec = new Rectangle(rec.X + rec.Width * i, rec.Y-1, rec.Width, rec.Height);
- g.DrawRectangle(borderPen, weekRec);
- Brush brush = new SolidBrush(Color.FromArgb(90, 158, 203));
- g.FillRectangle(brush, new Rectangle(weekRec.X + 1, weekRec.Y + 1, weekRec.Width - 2, weekRec.Height - 2));
- g.DrawString(String.Format("{0}", weekNames[i]), weekFont, Brushes.White, weekRec.X + weekRec.Width / 2 - 11, weekRec.Y + weekRec.Height / 2 - 11);
- }
-
- }
- /// <summary>
- /// 画单元格
- /// </summary>
- /// <param name="cellWeek">单元格数据对象</param>
- /// <param name="g">画笔</param>
- /// <param name="rec">基础位置和大小</param>
- /// <param name="rowIndex">行索引</param>
- /// <param name="cellIndex">单元格索引</param>
- void DrawCellWeekContent(CellWeekContent cellWeek, Graphics g, Rectangle rec, int rowIndex, int cellIndex)
- {
- Rectangle weekRec = new Rectangle(rec.X + rec.Width * cellIndex, rec.Y + rec.Height * rowIndex, rec.Width, rec.Height);
- cellWeek.BorderRectangle = weekRec;
- g.DrawRectangle(borderPen, cellWeek.BorderRectangle);
- Brush brush = new SolidBrush(Color.FromArgb(220, 220, 220));
- if (cellWeek.DayTime.Month == SDateTime.Now.Month && cellWeek.DayTime.Day == SDateTime.Now.Day)
- {
- brush = new SolidBrush(Color.FromArgb(135, 206, 235));
- }
- cellWeek.ContentRectangle = new Rectangle(weekRec.X + 1, weekRec.Y + 1, weekRec.Width - 2, weekRec.Height - 2);
- g.FillRectangle(brush, cellWeek.ContentRectangle);
- this.DrawCellWeekContentText(g, cellWeek);
- }
-
- Font weekDayNumberFont = new Font("微软雅黑", 12, FontStyle.Bold);
- Font weekDayTextFont = new Font("微软雅黑", 10, FontStyle.Bold);
- Font weekItemTextFont = new Font("微软雅黑", 10, FontStyle.Regular);
- /// <summary>
- /// 画单元格内容
- /// </summary>
- /// <param name="g">画笔</param>
- /// <param name="cellWeek">单元格数据对象</param>
- void DrawCellWeekContentText(Graphics g, CellWeekContent cellWeek)
- {
- Brush dayBrush = Brushes.Red;
- Brush textBrush = Brushes.Black;
- if (!cellWeek.IsValid)
- {
- dayBrush = Brushes.Gray;
- textBrush = Brushes.Gray;
- }
- Rectangle weekRec = cellWeek.ContentRectangle;
- Point locatePoint = new Point(weekRec.X + 5, weekRec.Y + 5);
- // if (cellWeek.IsValid)
- {
- g.DrawString(String.Format("{0}", cellWeek.DayTime.Day), weekDayNumberFont, dayBrush, locatePoint);
- g.DrawString(String.Format("{0}", cellWeek.LunarCalendarDayTime), weekDayTextFont, textBrush, new Point(locatePoint.X + 28, locatePoint.Y + 2));
- }
- //画图钉
- Rectangle destRect = new Rectangle(locatePoint.X + 140, locatePoint.Y, 42, 42);
- cellWeek.Thumbtack.ThumbtackRectangle = destRect;
- cellWeek.PublicHoliday.ThumbtackRectangle = destRect;
- // if (cellWeek.IsValid)
- {
- if (!cellWeek.Thumbtack.IsNullThumbtackText)
- {
- Rectangle srcRect = new Rectangle(0, 0, LYFZ.Software.Properties.Resources.TuDing1.Width, LYFZ.Software.Properties.Resources.TuDing1.Height);
- g.DrawImage(LYFZ.Software.Properties.Resources.TuDing1, destRect, srcRect, GraphicsUnit.Pixel);
- if (!cellWeek.PublicHoliday.IsNullThumbtackText)
- {
- //画公休图钉
- cellWeek.PublicHoliday.ThumbtackRectangle = new Rectangle(destRect.X, destRect.Y + 50, 42, 42);
- this.DrawPublicHoliday(g, cellWeek);
- }
- }
- else if (!cellWeek.PublicHoliday.IsNullThumbtackText)
- {
- //画公休图钉
- this.DrawPublicHoliday(g, cellWeek);
- }
- }
- if (cellWeek.ContentRectangle.Contains(this.MouseClickLocation))
- {
- cellWeek.IsCurrent = true;
- Pen tempPen = new Pen(new SolidBrush(Color.FromArgb(0, 181, 244)), 4);
- // if (cellWeek.IsValid)
- {
- g.DrawRectangle(tempPen, new Rectangle(cellWeek.BorderRectangle.X + 2, cellWeek.BorderRectangle.Y + 2, cellWeek.BorderRectangle.Width - 5, cellWeek.BorderRectangle.Height - 5));
- }
- }
- else
- {
- cellWeek.IsCurrent = false;
- }
- locatePoint = new Point(locatePoint.X + 2, locatePoint.Y + 24);
- // if (cellWeek.IsValid)
- {
- for (int i = 0; i < cellWeek.CameraTypeItemList.Count; i++)
- {
- CameraTypeItem cameraItem = cellWeek.CameraTypeItemList[i];
- Point tempPoint = new Point(locatePoint.X, locatePoint.Y + i * 20);
- g.DrawString(String.Format("{0}:{1}", cameraItem.CurrCameraType.ToString(), cameraItem.GetStatisticalText()), weekItemTextFont, textBrush, tempPoint);
- cameraItem.ItemRectangle = new Rectangle(tempPoint.X, tempPoint.Y, weekRec.Width - 12, 18);
- }
- }
- //this.Invoke(new MethodInvoker(delegate
- //{
- //}));
- }
- /// <summary>
- /// 画公休图钉
- /// </summary>
- /// <param name="g"></param>
- /// <param name="cellWeek"></param>
- void DrawPublicHoliday(Graphics g, CellWeekContent cellWeek)
- {
- Rectangle srcRect = new Rectangle(0, 0, LYFZ.Software.Properties.Resources.TuDing4_0.Width, LYFZ.Software.Properties.Resources.TuDing4_0.Height);
- g.DrawImage(LYFZ.Software.Properties.Resources.TuDing4_0, cellWeek.PublicHoliday.ThumbtackRectangle, srcRect, GraphicsUnit.Pixel);
- //画公休标记
- Pen tempPen = new Pen(new SolidBrush(Color.FromArgb(179, 123, 255)), 2); // new Pen(new SolidBrush(Color.FromArgb(165, 239, 173)), 2);
- g.DrawRectangle(tempPen, new Rectangle(cellWeek.BorderRectangle.X + 1, cellWeek.BorderRectangle.Y + 1, cellWeek.BorderRectangle.Width - 3, cellWeek.BorderRectangle.Height - 3));
- }
- #endregion
- #region 日历表事件处理
- private void PlCalendarTable_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- this.tpsInfo.Hide(this.plCalendarTable);
- CellWeekContent cellWeek = CellWeekContentList.Find(w => w.ContentRectangle.Contains(e.Location));
- if (cellWeek != null)
- {
- CameraTypeItem CameraItem = cellWeek.CameraTypeItemList.Find(w => w.ItemRectangle.Contains(e.Location));
- if (CameraItem != null)
- {
- if (e.Location.X < CameraItem.ItemRectangle.X + 120)
- {
- //MessageBoxCustom.Show(CameraItem.CurrCameraType.ToString());
- this.GoToCameraRecord(this.cbxStoreList.SelectedIndex, CameraItem.CurrCameraType,cellWeek.DayTime);
- }
- }
- if (!String.IsNullOrWhiteSpace(cellWeek.Thumbtack.ThumbtackText))
- {
- if (cellWeek.Thumbtack.ThumbtackRectangle.Contains(e.Location))
- {
- if (cellWeek.Thumbtack.Tag != null)
- {
- LYFZ.Model.ThumbtackRecord thumbtackRecord = (LYFZ.Model.ThumbtackRecord)cellWeek.Thumbtack.Tag;
- if (this.EditThumbtackRecord(thumbtackRecord, cellWeek.DayTime, ThumbtackType.摄控本日历图钉))
- {
- cellWeek.Thumbtack.ThumbtackText = thumbtackRecord.ThumbtackInfo.Trim();
- this.plCalendarTable.Refresh();
- }
- else
- {
- MessageBoxCustom.Show("图钉修改失败");
- }
- }
- }
- }
- if (!cellWeek.PublicHoliday.IsNullThumbtackText)
- {
- if (cellWeek.PublicHoliday.ThumbtackRectangle.Contains(e.Location))
- {
- if (cellWeek.PublicHoliday.Tag != null)
- {
- LYFZ.Model.ThumbtackRecord thumbtackRecord = (LYFZ.Model.ThumbtackRecord)cellWeek.PublicHoliday.Tag;
- if (this.EditThumbtackRecord(thumbtackRecord, cellWeek.DayTime, ThumbtackType.公休图钉))
- {
- cellWeek.PublicHoliday.ThumbtackText = thumbtackRecord.ThumbtackInfo.Trim();
- this.plCalendarTable.Refresh();
- }
- else
- {
- MessageBoxCustom.Show("图钉修改失败");
- }
- }
- }
- }
- }
- }
- bool EditThumbtackRecord(LYFZ.Model.ThumbtackRecord thumbtackRecord, DateTime dayTime, ThumbtackType thumType)
- {
- LYFZ.Software.MainBusiness.NewCameraControlBook.frmThumbtackText frmThumbtack = new frmThumbtackText();
- frmThumbtack.TType = thumType;
- frmThumbtack.txtInfo.Text = thumbtackRecord.ThumbtackInfo;
- if (frmThumbtack.ShowDialog() == DialogResult.OK)
- {
- bool isOldRemark = false;
- int OldRemarkID = 0;
- if (thumbtackRecord.ID <= 0)
- {
- isOldRemark = true;
- if (!String.IsNullOrWhiteSpace(thumbtackRecord.ThumbtackMark))
- {
- OldRemarkID = Convert.ToInt32(thumbtackRecord.ThumbtackMark);
- }
- thumbtackRecord.ThumbtackMark = LYFZ.WinAPI.CustomPublicMethod.GenerateUniqueID();
- thumbtackRecord.DateTimeMark = dayTime.ToJavaScriptTimeStamp();
- thumbtackRecord.CreateDateTime = SDateTime.Now.ToJavaScriptTimeStamp();
- thumbtackRecord.CreatePeople = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
- thumbtackRecord.ShopID = GetShopID(this.CurrentQueryStoreList);
- }
- thumbtackRecord.ThumbtackTitle = thumType.ToString();
- thumbtackRecord.ThumbtackType = (int)thumType;
- thumbtackRecord.UpdateDateTime = SDateTime.Now.ToJavaScriptTimeStamp();
- thumbtackRecord.UpdatePeople = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
- thumbtackRecord.ThumbtackInfo = frmThumbtack.txtInfo.Text.Trim();
- bool isUpdateOK = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- if (String.IsNullOrWhiteSpace(thumbtackRecord.ThumbtackInfo))
- {
- if (isOldRemark)
- {
- isUpdateOK = thumbtackBll.DeleteOrderRemarkRecord(OldRemarkID);
- }
- else
- {
- isUpdateOK = thumbtackBll.Delete(thumbtackRecord);
- }
- }
- else
- {
- if (isOldRemark)
- {
- isUpdateOK = thumbtackBll.Add(thumbtackRecord);
- if (isUpdateOK)
- {
- thumbtackBll.DeleteOrderRemarkRecord(OldRemarkID);
- }
- }
- else
- {
- isUpdateOK = thumbtackBll.Update(thumbtackRecord);
- }
- }
- });
- return isUpdateOK;
- }
- else {
- return true;
- }
- }
- /// <summary>
- /// 单击图钉右键菜单时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void CmenuCameraBook_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- if ((!this.IsOneShopID(this.CurrentQueryStoreList)&&this.tabControlEx1.SelectedIndex==0)
- || (!this.IsOneShopID(this.CurrentQueryStoreList2) && this.tabControlEx1.SelectedIndex == 1))
- {
- MessageBoxCustom.Show("未了防止误操作,在选择查询全部门店时不可使用此功能");
- return;
- }
- if (this.cmenuCameraBook.Tag != null)
- {
- if (this.tabControlEx1.SelectedIndex == 0)
- {
- this.isUpdateOrderDataTableQuery = true;
- }
- if (this.cmenuCameraBook.Tag.GetType() == typeof(CellWeekContent))
- {
- CellWeekContent cellWeek = (CellWeekContent)this.cmenuCameraBook.Tag;
- DataEventArgs eventArgs = null;
- if (cellWeek.Tag != null)
- {
- if (cellWeek.Tag.GetType() == typeof(DataEventArgs))
- {
- eventArgs = (DataEventArgs)cellWeek.Tag;
- }
- }
- switch (e.ClickedItem.Text)
- {
- case "添加图钉":
- if (String.IsNullOrWhiteSpace(cellWeek.Thumbtack.ThumbtackText))
- {
- LYFZ.Software.MainBusiness.NewCameraControlBook.frmThumbtackText frmThumbtack = new frmThumbtackText();
- frmThumbtack.TType = ThumbtackType.摄控本日历图钉;
- if (frmThumbtack.ShowDialog() == DialogResult.OK)
- {
- LYFZ.Model.ThumbtackRecord thumbtackRecord = new Model.ThumbtackRecord();
- thumbtackRecord.ID = LYFZ.WinAPI.CustomPublicMethod.GenerateId();
- thumbtackRecord.CreateDateTime = SDateTime.Now.ToJavaScriptTimeStamp();
- thumbtackRecord.CreatePeople = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
- thumbtackRecord.UpdateDateTime = SDateTime.Now.ToJavaScriptTimeStamp();
- thumbtackRecord.UpdatePeople= LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
- thumbtackRecord.ShopID = GetShopID(this.CurrentQueryStoreList);
- thumbtackRecord.ThumbtackTitle = ThumbtackType.摄控本日历图钉.ToString();
- thumbtackRecord.ThumbtackType = (int)ThumbtackType.摄控本日历图钉;
- thumbtackRecord.ThumbtackMark= LYFZ.WinAPI.CustomPublicMethod.GenerateUniqueID();
- thumbtackRecord.ThumbtackInfo = frmThumbtack.txtInfo.Text.Trim();
- thumbtackRecord.DateTimeMark = cellWeek.DayTime.ToJavaScriptTimeStamp();
- bool isAddOK = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- isAddOK = thumbtackBll.Add(thumbtackRecord);
- });
- if (isAddOK)
- {
- cellWeek.Thumbtack.Tag = thumbtackRecord;
- cellWeek.Thumbtack.ThumbtackText = thumbtackRecord.ThumbtackInfo.Trim();
- if (eventArgs != null)
- {
- eventArgs.CurrentCell.ThumbtackList.Add(cellWeek.Thumbtack);
- this.PanelDataView.RefreshCell(eventArgs.CrrrentRow, eventArgs.CurrentCell);
- this.isUpdateQuery = true;
- }
- else
- {
- this.plCalendarTable.Refresh();
- }
- }
- else {
- MessageBoxCustom.Show(String.Format("图钉添加失败"));
- }
- }
- }
- else
- {
- MessageBoxCustom.Show(String.Format("每一个日期上只能添加一个图钉"));
- }
- break;
- case "删除图钉":
- if (!String.IsNullOrWhiteSpace(cellWeek.Thumbtack.ThumbtackText))
- {
- if (cellWeek.Thumbtack.Tag != null)
- {
- LYFZ.Model.ThumbtackRecord thumbtackRecord = (LYFZ.Model.ThumbtackRecord)cellWeek.Thumbtack.Tag;
- bool isAddOK = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- if (thumbtackRecord.ID > 0)
- {
- isAddOK = thumbtackBll.Delete(thumbtackRecord);
- }
- else
- {
- if (!String.IsNullOrWhiteSpace(thumbtackRecord.ThumbtackMark))
- {
- int OldRemarkID = Convert.ToInt32(thumbtackRecord.ThumbtackMark);
- isAddOK = thumbtackBll.DeleteOrderRemarkRecord(OldRemarkID);
- }
- }
- });
- if (isAddOK)
- {
- cellWeek.Thumbtack.ThumbtackText = "";
- cellWeek.Thumbtack.Tag = null;
- if (eventArgs != null)
- {
- eventArgs.CurrentCell.ThumbtackList.Remove(eventArgs.CurrentCell.ThumbtackList.Find(t=>t.ThumbtackType==2));
- this.PanelDataView.RefreshCell(eventArgs.CrrrentRow, eventArgs.CurrentCell);
- this.isUpdateQuery = true;
- }
- else
- {
- this.plCalendarTable.Refresh();
- }
- }
- else
- {
- MessageBoxCustom.Show("图钉删除失败");
- }
- }
- else {
- cellWeek.Thumbtack.ThumbtackText = "";
- this.plCalendarTable.Refresh();
- }
- }
- break;
- case "设为公休日":
- if (cellWeek.PublicHoliday.IsNullThumbtackText)
- {
- LYFZ.Software.MainBusiness.NewCameraControlBook.frmThumbtackText frmThumbtack = new frmThumbtackText();
- frmThumbtack.TType = ThumbtackType.公休图钉;
- frmThumbtack.txtInfo.Text = "全员公休日";
- if (frmThumbtack.ShowDialog() == DialogResult.OK)
- {
- LYFZ.Model.ThumbtackRecord thumbtackRecord = new Model.ThumbtackRecord();
- thumbtackRecord.ID = LYFZ.WinAPI.CustomPublicMethod.GenerateId();
- thumbtackRecord.CreateDateTime = SDateTime.Now.ToJavaScriptTimeStamp();
- thumbtackRecord.CreatePeople = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
- thumbtackRecord.UpdateDateTime = SDateTime.Now.ToJavaScriptTimeStamp();
- thumbtackRecord.UpdatePeople = LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID;
- thumbtackRecord.ShopID = GetShopID(this.CurrentQueryStoreList);
- thumbtackRecord.ThumbtackTitle = ThumbtackType.公休图钉.ToString();
- thumbtackRecord.ThumbtackType = (int)ThumbtackType.公休图钉;
- thumbtackRecord.ThumbtackMark = LYFZ.WinAPI.CustomPublicMethod.GenerateUniqueID();
- thumbtackRecord.ThumbtackInfo = frmThumbtack.txtInfo.Text.Trim();
- thumbtackRecord.DateTimeMark = cellWeek.DayTime.ToJavaScriptTimeStamp();
- bool isAddOK = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- isAddOK = thumbtackBll.Add(thumbtackRecord);
- });
- if (isAddOK)
- {
- cellWeek.PublicHoliday.Tag = thumbtackRecord;
- cellWeek.PublicHoliday.ThumbtackText = thumbtackRecord.ThumbtackInfo.Trim();
- if (eventArgs != null)
- {
- eventArgs.CurrentCell.ThumbtackList.Add(cellWeek.PublicHoliday);
-
- // this.PanelDataView.RefreshCell(eventArgs.CrrrentRow, eventArgs.CurrentCell);
- this.thumbtackRecordList.Add(thumbtackRecord);
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.BindPanelDataView(cameraType);
- this.isUpdateQuery = true;
- }
- else
- {
- this.plCalendarTable.Refresh();
- }
- }
- else
- {
- MessageBoxCustom.Show(String.Format("设为公休日失败"));
- }
- }
- }
- else
- {
- MessageBoxCustom.Show(String.Format("当前日期已经是公休日,不需要重复设置"));
- }
- break;
- case "取消公休日":
- if (!cellWeek.PublicHoliday.IsNullThumbtackText)
- {
- if (cellWeek.PublicHoliday.Tag != null)
- {
- LYFZ.Model.ThumbtackRecord thumbtackRecord = (LYFZ.Model.ThumbtackRecord)cellWeek.PublicHoliday.Tag;
- bool isAddOK = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- isAddOK = thumbtackBll.Delete(thumbtackRecord);
- });
- if (isAddOK)
- {
- cellWeek.PublicHoliday.ThumbtackText = "";
- cellWeek.PublicHoliday.Tag = null;
- if (eventArgs != null)
- {
- eventArgs.CurrentCell.ThumbtackList.Remove(eventArgs.CurrentCell.ThumbtackList.Find(t => t.ThumbtackType == 1));
- // this.PanelDataView.RefreshCell(eventArgs.CrrrentRow, eventArgs.CurrentCell);
- this.thumbtackRecordList.Remove(this.thumbtackRecordList.Find(r=>r.ID== thumbtackRecord.ID));
- CameraType cameraType = SetCameraTemplate.GetCameraType(this.flowLayoutPanel3.Controls);
- this.BindPanelDataView(cameraType);
- this.isUpdateQuery = true;
- }
- else
- {
- this.plCalendarTable.Refresh();
- }
- }
- else
- {
- MessageBoxCustom.Show("取消公休日失败");
- }
- }
- else
- {
- cellWeek.PublicHoliday.ThumbtackText = "";
- this.plCalendarTable.Refresh();
- }
- }
- break;
- }
- }
- }
- }
- /// <summary>
- /// 当前鼠标点击时的位置
- /// </summary>
- Point MouseClickLocation = new Point(0, 0);
- /// <summary>
- /// 在日历上单击鼠标时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void PlCalendarTable_MouseUp(object sender, MouseEventArgs e)
- {
- this.tpsInfo.Hide(this.plCalendarTable);
- CellWeekContent cellWeek = CellWeekContentList.Find(w => w.ContentRectangle.Contains(e.Location));
- if (cellWeek != null)
- {
- if (!cellWeek.IsCurrent)
- {
- this.MouseClickLocation = e.Location;
- this.plCalendarTable.Refresh();
- }
- if (e.Button == MouseButtons.Right)
- {
- this.cmenuCameraBook.Tag = cellWeek;
- this.cmenuCameraBook.Show(this.plCalendarTable, e.Location);
- }
- }
- }
- Rectangle currentMoveRectangle = new Rectangle(0, 0, 1, 1);
- /// <summary>
- /// 在日历上移动鼠标时
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void PlCalendarTable_MouseMove(object sender, MouseEventArgs e)
- {
- CellWeekContent cellWeek = CellWeekContentList.Find(w => w.ContentRectangle.Contains(e.Location));
- if (cellWeek != null)
- {
- this.plCalendarTable.Cursor = Cursors.Hand;
- int duration = 5000;//提示标签显示时间
- CameraTypeItem CameraItem = cellWeek.CameraTypeItemList.Find(w => w.ItemRectangle.Contains(e.Location));
- if (CameraItem != null)
- {
- if (CameraItem.OrderCameraDataList.Count > 0)
- {
- if (!currentMoveRectangle.Contains(e.Location) && e.Location.X > CameraItem.ItemRectangle.X + 65 && e.Location.X < CameraItem.ItemRectangle.X + 120)
- {
- currentMoveRectangle = new Rectangle(e.Location.X - 5, e.Location.Y - 5, 10, 10);
- this.tpsInfo.ToolTipTitle = CameraItem.CurrCameraType.ToString();
- this.tpsInfo.Show(String.Format("{0}", CameraItem.GetToolTipText()), this.plCalendarTable, new Point(e.Location.X + 10, e.Location.Y));
- }
- }
- }
-
- if (!String.IsNullOrWhiteSpace(cellWeek.Thumbtack.ThumbtackText))
- {
- if (cellWeek.Thumbtack.ThumbtackRectangle.Contains(e.Location))
- {
- if (!currentMoveRectangle.Contains(e.Location))
- {
- currentMoveRectangle = new Rectangle(e.Location.X - 5, e.Location.Y - 5, 10, 10);
- this.tpsInfo.ToolTipTitle = "图钉内容预览";
- this.tpsInfo.Show(String.Format("{0}", this.GetToolTipText(cellWeek.Thumbtack.ThumbtackText)), this.plCalendarTable, new Point(e.Location.X + 10, e.Location.Y), duration);
- }
- }
- }
- if (!cellWeek.PublicHoliday.IsNullThumbtackText)
- {
- if (cellWeek.PublicHoliday.ThumbtackRectangle.Contains(e.Location))
- {
- if (!currentMoveRectangle.Contains(e.Location))
- {
- currentMoveRectangle = new Rectangle(e.Location.X - 5, e.Location.Y - 5, 10, 10);
- this.tpsInfo.ToolTipTitle = "公休日说明内容预览";
- this.tpsInfo.Show(String.Format("{0}", this.GetToolTipText(cellWeek.PublicHoliday.ThumbtackText)), this.plCalendarTable, new Point(e.Location.X + 10, e.Location.Y), duration);
- }
- }
- }
- }
- else
- {
- this.plCalendarTable.Cursor = Cursors.Default;
- }
- }
- string GetToolTipText(string text)
- {
- string tempText = text;
- if (tempText.Length > 50)
- {
- tempText = String.Format("{0}......", tempText.Substring(0, 50));
- }
- return tempText;
- }
- #endregion
- #region 门店列表处理
- private void CbxStoreList2_SelectedIndexChanged(object sender, EventArgs e)
- {
- GetCurrentQueryStoreList(ref CurrentQueryStoreList2, this.cbxStoreList2);
- if (!this.isShownLoad)
- {
- if (this.tabControlEx1.SelectedIndex == 1)
- {
- this.SetOrderTypeChBoxShow();
- this.LoadTemplateData();
- }
- }
- }
- private void CbxStoreList_SelectedIndexChanged(object sender, EventArgs e)
- {
- GetCurrentQueryStoreList(ref CurrentQueryStoreList, this.cbxStoreList);
- if (!this.isShownLoad)
- {
- this.InitializeCalendar();
- }
- }
- /// <summary>
- /// 根是是否集团版显示隐藏门店列表
- /// </summary>
- /// <param name="isGroupEdition"></param>
- void HideORShowStoresList(bool isGroupEdition)
- {
- if (isGroupEdition)
- {
- this.cbxStoreList.Show();
- this.lbStore.Show();
- this.cbxStoreList2.Show();
- this.lbStore2.Show();
- }
- else
- {
- this.cbxStoreList.Hide();
- this.lbStore.Hide();
- this.cbxStoreList2.Hide();
- this.lbStore2.Hide();
- }
- }
- /// <summary>
- /// 当前要查询的门店信息集合
- /// </summary>
- QueryStoreList CurrentQueryStoreList = null;
- /// <summary>
- /// 当前要查询的门店信息集合2
- /// </summary>
- QueryStoreList CurrentQueryStoreList2 = null;
- public EnumPermissions.BusinessType GetCurrentStoreBusinessType(QueryStoreList storeList)
- {
- if (storeList != null)
- {
- return GetStoreBusinessType(storeList);
- }
- else
- {
- return LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType();
- }
- }
- public static EnumPermissions.BusinessType GetStoreBusinessType(QueryStoreList storeList)
- {
- if (storeList.QueryStoreInfoList.Count > 0)
- {
- List<EnumPermissions.BusinessType> tempBuTypeList = new List<EnumPermissions.BusinessType>();
- foreach (QueryStoreInfo storeInfo in storeList.QueryStoreInfoList)
- {
- EnumPermissions.BusinessType buType = GetStoreBusinessType(storeInfo);
- if (buType == EnumPermissions.BusinessType.旗舰版)
- {
- return EnumPermissions.BusinessType.旗舰版;
- }
- else {
- if (!tempBuTypeList.Any(b => b == buType))
- {
- tempBuTypeList.Add(buType);
- }
- }
- }
- if (tempBuTypeList.Count > 1)
- {
- return EnumPermissions.BusinessType.旗舰版;
- }
- else if (tempBuTypeList.Count == 1)
- {
- return tempBuTypeList[0];
- }
- }
- return LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType();
- }
- public static EnumPermissions.BusinessType GetStoreBusinessType(QueryStoreInfo storeInfo)
- {
- EnumPermissions.BusinessType buType = (EnumPermissions.BusinessType)storeInfo.ShopStoreFeature.BusinessType;
- return buType;
- }
- /// <summary>
- /// 获取当前要查询的门店信息集合
- /// </summary>
- public static void GetCurrentQueryStoreList(ref QueryStoreList cQueryStoreList, System.Windows.Forms.ComboBox cStoreList)
- {
- if (cQueryStoreList == null)
- {
- cQueryStoreList = new QueryStoreList();
- }
- else
- {
- cQueryStoreList.QueryStoreInfoList.Clear();
- }
- ItemValue cItem = (ItemValue)cStoreList.SelectedItem;
- if (cItem.Value.ToString() == "0"|| cItem.Value.ToString() == "1")
- {
- cQueryStoreList.QueryType = 1;
- if (cItem.Value.ToString() == "0")
- {
- cQueryStoreList.QueryType = 0;
- }
- foreach (ItemValue item in cStoreList.Items)
- {
- if (item.Tag != null)
- {
- QueryStoreInfo qStoreInfo = GetQueryStoreInfo(item);
- if (qStoreInfo != null)
- {
- cQueryStoreList.QueryStoreInfoList.Add(qStoreInfo);
- }
- }
- }
- }
- else
- {
- cQueryStoreList.QueryType = 1;
- QueryStoreInfo qStoreInfo = GetQueryStoreInfo(cItem);
- if (qStoreInfo != null)
- {
- cQueryStoreList.QueryStoreInfoList.Add(qStoreInfo);
- }
- }
- }
- static QueryStoreInfo GetQueryStoreInfo(ItemValue item)
- {
- if (item.Tag != null)
- {
- DataRow dataRow = ((DataRow)item.Tag);
- QueryStoreInfo qStoreInfo = new QueryStoreInfo();
- qStoreInfo.DividedShop = item.Value.ToString();
- qStoreInfo.DividedShop_Name = item.Text.Trim();
- qStoreInfo.JMGDomain = dataRow["Company_JMGDomain"].ToString();
- qStoreInfo.ShopStoreFeature = LYFZ.Model.Model_ErpCompanyInfo.GetStoreFeature(dataRow["Company_ServerAddress"].ToString());
- return qStoreInfo;
- }
- return null;
- }
- /// <summary>
- /// 邦定门店
- /// </summary>
- public static void BindStoreList(System.Windows.Forms.ComboBox cbxStoreList, bool isGroupEdition,bool isGroupEditionShowAll=true)
- {
- DataRowCollection rows = null;
- int allValue = 0;
- int allStoreCount = 1;
- if (isGroupEdition)
- {
-
- string groupKeyCode = LYFZ.Model.Model_UserRights.GetQuickToolsPet();
- List<string> mlist = LYFZ.BLL.BLL_ErpUser.GetGroupRights(groupKeyCode, "qt001");
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
-
- rows = LYFZ.DAL.DAL_ErpCompanyInfo.GetCompanyBasicInfoList(mlist.ToArray());
- allStoreCount = LYFZ.DAL.DAL_ErpCompanyInfo.GetCompanyBasicInfoListCount();
- });
- if (rows == null)
- {
- MessageBoxCustom.Show("获取门店信息失败!");
- return;
- }
- else
- {
- if (allStoreCount > 1 && allStoreCount == rows.Count)
- {
- allValue = 0;
- }
- else
- {
- allValue = 1;
- }
- if (isGroupEditionShowAll)
- {
- if (rows.Count > 1)
- {
- ItemValue itemAll = new ItemValue(allValue, "全部");
- cbxStoreList.Items.Add(itemAll);
- cbxStoreList.SelectedIndex = 0;
- }
- }
- //是否找到当前店
- bool isCurrentStore = false;
- foreach (DataRow row in rows)
- {
- ItemValue itemStore = new ItemValue(row["Company_DividedShop"].ToString(), row["Company_Name"].ToString());
- itemStore.Tag = row;
- cbxStoreList.Items.Add(itemStore);
- if (row["Company_JMGDomain"].ToString().Trim().ToLower() == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.SoftwareInfo.SDomainName.Trim().ToLower())
- {
- isCurrentStore = true;
- // if (allValue == 1)
- {
- cbxStoreList.SelectedItem = itemStore;
- }
- }
- }
- if (!isCurrentStore)
- {
- MessageBoxCustom.Show("没有找到当前门店信息");
- cbxStoreList.Items.Clear();
- return;
- }
- }
- }
- else
- {
- ItemValue itemAll = new ItemValue(allValue, "全部");
- cbxStoreList.Items.Add(itemAll);
- cbxStoreList.SelectedIndex = 0;
- }
- }
- #endregion
- }
- /// <summary>
- /// 日历内容单元格
- /// </summary>
- public class CellWeekContent
- {
- public CellWeekContent(int selectYear, int selectMonth, int currentDayCount)
- {
- this.selectYear = selectYear;
- this.selectMonth = selectMonth;
- this.currentDayCount = currentDayCount;
- this.SetDayTime();
- }
- /// <summary>
- /// 设置当前天的时间
- /// </summary>
- void SetDayTime()
- {
- this.dayTime = GetDayDateTime(this.SelectYear, this.SelectMonth, this.currentDayCount);
- this._LunarCalendarDayTime = Command.Command_CalendarTurnLunar.GetChineseDateTimeToNoYear(this.dayTime);
- }
- /// <summary>
- /// 设置当前天的时间
- /// </summary>
- public void SetDayTime(DateTime dateTime)
- {
- this.dayTime = dateTime;
- this._LunarCalendarDayTime = Command.Command_CalendarTurnLunar.GetChineseDateTimeToNoYear(this.dayTime);
- }
- public static DateTime GetDayDateTime(int selectYear, int selectMonth, int currentDayCount)
- {
- DateTime tempDate = Convert.ToDateTime(String.Format("{0}-{1}-{2}", selectYear, selectMonth, 1));
- int afterDay = ((int)tempDate.DayOfWeek) - 1;
- if (afterDay < 0)
- {
- afterDay = 6;
- }
- return tempDate.AddDays(-afterDay + (currentDayCount - 1));
- }
- Rectangle _BorderRectangle = new Rectangle();
- Rectangle _ContentRectangle = new Rectangle();
- //bool isValid = true;
- int rowIndex = 0;
- int cellIndex = 0;
- int currentDayCount = 0;
- string weekDayName = "";
- int weekDayNumber = 0;
- DateTime dayTime;
- string _LunarCalendarDayTime = "";
- int selectYear = SDateTime.Now.Year;
- int selectMonth = SDateTime.Now.Month;
- bool _IsCurrent = false;
- object tag;
- List<CameraTypeItem> _CameraTypeItemList = new List<CameraTypeItem>();
- ThumbtackData _Thumbtack = new ThumbtackData();
- ThumbtackData _PublicHoliday = new ThumbtackData();
- /// <summary>
- /// 边框区域
- /// </summary>
- public Rectangle BorderRectangle { get => _BorderRectangle; set => _BorderRectangle = value; }
- /// <summary>
- /// 内容区域
- /// </summary>
- public Rectangle ContentRectangle { get => _ContentRectangle; set => _ContentRectangle = value; }
- /// <summary>
- /// 是否有效
- /// </summary>
- public bool IsValid {
- get {
- if (this.dayTime.Month == this.SelectMonth)
- {
- return true;
- }
- else {
- return false;
- }
- }
- }
- /// <summary>
- /// 行索引
- /// </summary>
- public int RowIndex { get => rowIndex; set => rowIndex = value; }
- /// <summary>
- /// 列索引
- /// </summary>
- public int CellIndex { get => cellIndex; set => cellIndex = value; }
- /// <summary>
- /// 当前天时间 哪年哪月哪日
- /// </summary>
- public DateTime DayTime { get => dayTime; }
- /// <summary>
- /// 农历
- /// </summary>
- public string LunarCalendarDayTime
- {
- get {
- return _LunarCalendarDayTime;
- }
- }
- /// <summary>
- /// 当前单元格索引计数 1-42
- /// </summary>
- public int CurrentDayCount { get => currentDayCount; set => currentDayCount = value; }
- /// <summary>
- /// 星期几 (一、二、三、四、五、六、日)
- /// </summary>
- public string WeekDayName { get => weekDayName; set => weekDayName = value; }
- /// <summary>
- /// 星期几 (1、2、3、4、5、6、0)
- /// </summary>
- public int WeekDayNumber
- {
- get { return weekDayNumber; }
- set {
- if (value == 7)
- {
- weekDayNumber = 0;
- }
- else {
- weekDayNumber = value;
- }
- }
- }
- /// <summary>
- /// 当前选择年
- /// </summary>
- public int SelectYear { get => selectYear; set => selectYear = value; }
- /// <summary>
- /// 当前选择月
- /// </summary>
- public int SelectMonth { get => selectMonth; set => selectMonth = value; }
- /// <summary>
- /// 是否为当前选择项
- /// </summary>
- public bool IsCurrent { get => _IsCurrent; set => _IsCurrent = value; }
- public object Tag { get => tag; set => tag = value; }
- /// <summary>
- /// 摄控数据集合
- /// </summary>
- public List<CameraTypeItem> CameraTypeItemList { get => _CameraTypeItemList; set => _CameraTypeItemList = value; }
- /// <summary>
- /// 图钉
- /// </summary>
- public ThumbtackData Thumbtack { get => _Thumbtack; set => _Thumbtack = value; }
- /// <summary>
- /// 公休图钉
- /// </summary>
- public ThumbtackData PublicHoliday { get => _PublicHoliday; set => _PublicHoliday = value; }
- }
-
-
- }
|