OnSingleFormMain.cs 275 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776
  1. using LYFZ.ComponentLibrary;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace LYFZ.Software.MainBusiness.DoorCityProcess
  12. {
  13. public partial class OnSingleFormMain : LYFZ.Software.UI.DoorCityProcess.OnSingleFormMain
  14. {
  15. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  16. LYFZ.BLL.BLL_ErpStyle stbll = new BLL.BLL_ErpStyle();
  17. LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment();
  18. LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL.BLL_ErpCustomer();
  19. LYFZ.BLL.BLL_ErpMemberCard mcbll = new BLL.BLL_ErpMemberCard();
  20. LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL.BLL_ErpSystemLogs();
  21. LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital();
  22. LYFZ.BLL.BLL_ErpOrdersPerson orpbll = new BLL.BLL_ErpOrdersPerson();
  23. LYFZ.BLL.BLL_SMSTemplates smsTemplates = new BLL.BLL_SMSTemplates();
  24. LYFZ.BLL.BLL_ErpCustomerGroup cgbll = new BLL.BLL_ErpCustomerGroup();
  25. LYFZ.BLL.BLL_ErpHospitalClient hcbll = new BLL.BLL_ErpHospitalClient();
  26. LYFZ.BLL.BLL_ErpWeddingService wsbll = new BLL.BLL_ErpWeddingService();
  27. LYFZ.BLL.BLL_ErpOrderProductLOG ptlog = new BLL.BLL_ErpOrderProductLOG();
  28. LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
  29. LYFZ.BLL.BLL_ErpOrderProductList libll = new BLL.BLL_ErpOrderProductList();
  30. LYFZ.BLL.BLL_ErpOrdersPhotography opbll = new BLL.BLL_ErpOrdersPhotography();
  31. LYFZ.BLL.BLL_ErpMemberCardPoints mcptsbll = new BLL.BLL_ErpMemberCardPoints();
  32. LYFZ.BLL.BLL_ErpOrderNumberRecord ornrbll = new BLL.BLL_ErpOrderNumberRecord();
  33. LYFZ.BLL.BLL_ErpMemberCardViceCard mcvbll = new BLL.BLL_ErpMemberCardViceCard();
  34. LYFZ.BLL.BLL_ErpOrderDigitalStatus orsbll = new BLL.BLL_ErpOrderDigitalStatus();
  35. LYFZ.BLL.BLL_ErpMemberCardBackCash mcbcbll = new BLL.BLL_ErpMemberCardBackCash();
  36. LYFZ.BLL.BLL_ErpCustomerGroupMembers cgmbll = new BLL.BLL_ErpCustomerGroupMembers();
  37. LYFZ.BLL.BLL_ErpMemberCardOperateLOG mcopbll = new BLL.BLL_ErpMemberCardOperateLOG();
  38. LYFZ.BLL.BLL_ErpMemberCardPointsLOG mcpslogbll = new BLL.BLL_ErpMemberCardPointsLOG();
  39. LYFZ.BLL.BLL_ErpPackagesGiftMerchandise pgbll = new BLL.BLL_ErpPackagesGiftMerchandise();
  40. LYFZ.BLL.BLL_ErpMemberCardBackCashSet mcbcsetbll = new BLL.BLL_ErpMemberCardBackCashSet();
  41. LYFZ.BLL.BLL_ErpMemberCardInterfaceManagement mcimbll = new BLL.BLL_ErpMemberCardInterfaceManagement();
  42. #region 属性
  43. /// <summary>
  44. /// 是否是修改订单(从订单报表、保存后这里都会为true)
  45. /// </summary>
  46. public bool IsUpdateOrderLoad = false;
  47. /// <summary>
  48. /// 关闭窗体前判断是否提示
  49. /// </summary>
  50. private bool isClose = true;
  51. /// <summary>
  52. /// 订单编号
  53. /// </summary>
  54. public string StrNumber = "";
  55. /// <summary>
  56. /// 是否保存
  57. /// </summary>
  58. public bool IsSaveed = false;
  59. /// <summary>
  60. /// 订单类型
  61. /// </summary>
  62. public LYFZ.EnumPublic.OrderType OrdType;
  63. /// <summary>
  64. /// 用于写入成人客户控件的序号
  65. /// </summary>
  66. private int ClientAdultNameCount = 1;
  67. /// <summary>
  68. /// 用于写入儿童客户控件的序号
  69. /// </summary>
  70. private int ClientChildNameCount = 1;
  71. /// <summary>
  72. /// 是否显示写真版
  73. /// </summary>
  74. private bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
  75. /// <summary>
  76. /// 登录都姓名
  77. /// </summary>
  78. string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
  79. /// <summary>
  80. /// 登录者员工ID
  81. /// </summary>
  82. string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  83. /// <summary>
  84. /// 本地分店ID
  85. /// </summary>
  86. string strInfoID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  87. /// <summary>
  88. /// 当前客户数量
  89. /// </summary>
  90. int AddClinetCount = 0;
  91. /// <summary>
  92. /// 订单客户组编号
  93. /// </summary>
  94. string OrderGroupNumber = "";
  95. /// <summary>
  96. /// 来单批号
  97. /// </summary>
  98. string ComeSingleLotNumber = "";
  99. /// <summary>
  100. /// 覆盖订单数据时候,是否覆盖客户数据
  101. /// </summary>
  102. bool UpdateOrderIsUpdateClientData = true;
  103. /// <summary>
  104. /// 如果没有保存权限,是否已授过权
  105. /// </summary>
  106. bool IsSaveedHadAuthorized = false;
  107. /// <summary>
  108. /// 当前登录者、授权者的保利系数
  109. /// </summary>
  110. decimal dec_OrderDiscounts = 0;
  111. /// <summary>
  112. /// 客户来源《朋友介绍——副卡资料》
  113. /// </summary>
  114. LYFZ.Model.Model_ErpMemberCardViceCard modelViceCard = null;
  115. /// <summary>
  116. /// 客户来源《朋友介绍——朋友资料》
  117. /// </summary>
  118. LYFZ.Model.Model_ErpCustomer modelFriends = null;
  119. /// <summary>
  120. /// 老客户信息
  121. /// </summary>
  122. LYFZ.Model.Model_ErpCustomer modelOldClient = null;
  123. /// <summary>
  124. /// 介绍人要办理的会员卡号
  125. /// </summary>
  126. public string StrReferralsMemberCardNumber = "";
  127. /// <summary>
  128. /// 介绍人要修改的电话号码
  129. /// </summary>
  130. public string StrReferralsClientPhone = "";
  131. bool _isIntentionOrder = false;
  132. /// <summary>
  133. /// 当前打开的是否为意向订单
  134. /// </summary>
  135. bool IsIntentionOrder
  136. {
  137. get { return _isIntentionOrder; }
  138. set { _isIntentionOrder = value; }
  139. }
  140. public LoadFormType EnumLoadFormType;
  141. public enum LoadFormType
  142. {
  143. 订单报表,
  144. 开单选择
  145. }
  146. #endregion
  147. #region 窗体事件
  148. public OnSingleFormMain()
  149. {
  150. this.Shown += OnSingleFormMain_Shown;
  151. this.Load += OnSingleFormMain_Load;
  152. this.btnSaveIntent.Click += btnSaveIntent_Click;
  153. this.btnSave.Click += btnSave_Click;
  154. this.btnPrint.Click += btnPrint_Click;
  155. this.btnNewOrder.Click += btnNewOrder_Click;
  156. this.btnOrderClose.Click += btnOrderClose_Click;
  157. this.FormClosing += OnSingleFormMain_FormClosing;
  158. this.FormClosed += OnSingleFormMain_FormClosed;
  159. this.Resize += OnSingleFormMain_Resize;
  160. #region 第一页
  161. this.btnSourceSet.Click += btnSourceSet_Click;
  162. this.btnStyleSet.Click += btnStyleSet_Click;
  163. this.pictAddClient.Click += pictAddClient_Click;
  164. this.btnSelectUser.Click += btnSelectUser_Click;
  165. this.panelEx3.Click += panelEx3_Click;
  166. this.panelEx2.Click += panelEx2_Click;
  167. this.panelVice1.Click += panelVice1_Click;
  168. this.PanelMain1.Click += PanelMain1_Click;
  169. this.chkOldClient.Click += chkOldClient_Click;
  170. this.chkFriends.Click += chkFriends_Click;
  171. this.chkHospitalClient.Click += chkHospitalClient_Click;
  172. this.chkOther.Click += chkOther_Click;
  173. this.lblYiXiangClient.Click += lblYiXiangClient_Click;
  174. this.lblBrowseSelect.Click += lblBrowseSelect_Click;
  175. #endregion
  176. #region 第二页
  177. this.tabControl.SelectedIndexChanged += tabControl_SelectedIndexChanged;
  178. this.PanelMain2.Click += PanelMain2_Click;
  179. this.PanelMain3.Click += PanelMain3_Click;
  180. #endregion
  181. }
  182. /// <summary>
  183. /// 窗体加载事件
  184. /// </summary>
  185. /// <param name="sender"></param>
  186. /// <param name="e"></param>
  187. void OnSingleFormMain_Shown(object sender, EventArgs e)
  188. {
  189. this.Text = "开单(" + this.OrdType.ToString().Trim() + ")";
  190. this.flowPanel0.Location = new Point(this.flowPanel0.Location.X, tabControl.Location.Y - 2);// this.flowPanel0.Location.Y);
  191. this.FillClientDataPanelHeight();
  192. this.PanelMain1_Click(this, null);
  193. }
  194. /// <summary>
  195. /// 窗体加载事件
  196. /// </summary>
  197. /// <param name="sender"></param>
  198. /// <param name="e"></param>
  199. void OnSingleFormMain_Load(object sender, EventArgs e)
  200. {
  201. this.StyleSetAdd();
  202. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientSourec("AAAAAAF", this.cmbtreevClientSource, strHideFiled: "BFACBABGBGBJGDHIE,BFAFBCBADBDCABFDD,AAAAABT");
  203. this.chBox_Click();
  204. #region 权限与加载
  205. if (this.StrNumber == "")
  206. {
  207. this.tap3.Parent = null;
  208. //this.btnSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.NewOrder);
  209. this.GetTransactmemberCard();
  210. }
  211. else
  212. {
  213. this.btnSaveIntent.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.ModifyOrder);
  214. this.OpenSingleLoad();
  215. }
  216. this.btnPrint.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.Print);
  217. this.btnStyleSet.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderLoveStyleSet);
  218. this.btnSourceSet.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderClientSourceSet);
  219. #endregion
  220. }
  221. /// <summary>
  222. /// 打开订单数据
  223. /// </summary>
  224. void OpenSingleLoad()
  225. {
  226. this.IsSaveedHadAuthorized = false;
  227. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  228. {
  229. LYFZ.Model.Model_ErpOrder modelorder = orbll.GetModel(this.StrNumber);
  230. if (modelorder.ID <= 0)
  231. { return; }
  232. else
  233. {
  234. this.OrdType = (LYFZ.EnumPublic.OrderType)Enum.Parse(typeof(LYFZ.EnumPublic.OrderType), modelorder.Ord_Type);
  235. if (modelorder.Ord_Class == "0")
  236. {
  237. IsIntentionOrder = true;
  238. }
  239. DataTable tbl_P = orbll.GetView_Custom("tb_ErpOrdersPerson", StrWhere: "OrdPe_OrderNumber = '" + this.StrNumber + "'", filedOrder: "OrdPe_Type ASC", ShowColumnName: "dbo.fn_CheckUserIDGetUserName(OrdPe_OrdersPerson) AS OrdPe_OrdersPersonName,OrdPe_OrdersPerson,OrdPe_Type").Tables[0];
  240. DataTable tblFriends = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_OrderNumber = '" + this.StrNumber + "'", ShowColumnName: "GP_CustomerGroupID,GP_IntroducerCustomerID").Tables[0];
  241. List<LYFZ.Model.Model_ErpCustomer> mlistClient = new List<Model.Model_ErpCustomer>();
  242. List<string> mlistClientRelation = new List<string>();
  243. string StrMasterNumber = "";
  244. string StrChildNumber = "";
  245. DataTable tblGroup = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_OrderNumber = '" + this.StrNumber + "'", ShowColumnName: "GP_CustomerGroupID").Tables[0];
  246. if (tblGroup.Rows.Count > 0)
  247. {
  248. DataTable tblClientGroup = orbll.GetView_Custom("View_CustomerGroupMembersAndErpCustomer", StrWhere: "GM_CustomerGroupID = '" + tblGroup.Rows[0]["GP_CustomerGroupID"].ToString().Trim() + "'", ShowColumnName: "Cus_CustomerNumber,GM_Master,GM_RelatedPersonID,GM_Relation,GM_ProtagonistCustomer").Tables[0];
  249. for (int i = 0; i < tblClientGroup.Rows.Count; i++)
  250. {
  251. if (tblClientGroup.Rows[i]["GM_Master"].ToString().Trim() == "1")
  252. { StrMasterNumber = tblClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); }
  253. if (modelorder.Ord_Type == "1")
  254. {
  255. if (tblClientGroup.Rows[i]["GM_ProtagonistCustomer"].ToString().Trim() == "1")
  256. { StrChildNumber = tblClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); }
  257. }
  258. LYFZ.Model.Model_ErpCustomer modelClient = ctbll.GetModel("Cus_CustomerNumber", tblClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim());
  259. if (modelClient.ID > 0)
  260. {
  261. mlistClient.Add(modelClient);
  262. mlistClientRelation.Add(tblClientGroup.Rows[i]["GM_Relation"].ToString().Trim());
  263. }
  264. }
  265. }
  266. try
  267. {
  268. this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
  269. {
  270. if (modelorder.Ord_Class == "1")
  271. { this.btnSaveIntent.Visible = false; }
  272. else
  273. { this.btnSaveIntent.Visible = true; }
  274. if (this.IsUpdateOrderLoad)
  275. { this.lblYiXiangClient.Enabled = false; this.panelTransactmemberCard.Visible = false; }
  276. #region 订单资料
  277. if (this.UpdateOrderIsUpdateClientData)
  278. {
  279. this.AddClinetCount = 0;
  280. }
  281. this.tabControl.SelectedIndex = 1;
  282. bool IsActivity = false;
  283. switch (this.OrdType)
  284. {
  285. case EnumPublic.OrderType.婚纱订单:
  286. case EnumPublic.OrderType.儿童订单:
  287. case EnumPublic.OrderType.写真订单:
  288. case EnumPublic.OrderType.婚庆订单:
  289. this.OrderEx.StrCustomPrefix = this.GetOrderCustomPrefix();
  290. IsActivity = this.OrderEx.SetOrderValue(modelorder);
  291. if (this.OrderSightsEx != null)
  292. { this.OrderSightsEx.SetOrderSightsValue(this.StrNumber, modelorder.Ord_SeriesName); }
  293. else if (this.OrderStagesEx != null)
  294. { this.OrderStagesEx.SetOrderStagesValue(this.StrNumber, modelorder.Ord_SeriesName); }
  295. break;
  296. case EnumPublic.OrderType.服务订单:
  297. this.ServiceOrderEx.StrCustomPrefix = this.GetOrderCustomPrefix();
  298. this.ServiceOrderEx.SetOrderValue(modelorder);
  299. break;
  300. }
  301. try
  302. {
  303. this.OrderServiceEx.SetOrderServiceValue(this.StrNumber, IsActivity, modelorder.Ord_SeriesName);
  304. this.OrderProductEx.SetOrderProductValue(this.StrNumber, IsActivity, modelorder.Ord_SeriesName);
  305. }
  306. catch (Exception ex)
  307. {
  308. MessageBoxCustom.Show(ex.Message + ",原因:可能是“tb_ErpOrderProductList”商品唯一标识重复");
  309. }
  310. #endregion
  311. #region 接单人
  312. string PersonName = "";
  313. string PersonTag = "";
  314. string PersonType = "";
  315. for (int i = 0; i < tbl_P.Rows.Count; i++)
  316. {
  317. if (i == 0)
  318. {
  319. PersonName = tbl_P.Rows[i]["OrdPe_OrdersPersonName"].ToString().Trim();
  320. PersonTag = tbl_P.Rows[i]["OrdPe_OrdersPerson"].ToString().Trim();
  321. PersonType = tbl_P.Rows[i]["OrdPe_Type"].ToString().Trim();
  322. }
  323. else
  324. {
  325. PersonName += "," + tbl_P.Rows[i]["OrdPe_OrdersPersonName"].ToString().Trim();
  326. PersonTag += "," + tbl_P.Rows[i]["OrdPe_OrdersPerson"].ToString().Trim();
  327. PersonType += "," + tbl_P.Rows[i]["OrdPe_Type"].ToString().Trim();
  328. }
  329. }
  330. this.txtOrderPerson.Text = PersonName;
  331. this.txtOrderPerson.Tag = PersonTag + "|" + PersonType;
  332. #endregion
  333. #region 客户来源
  334. if (modelorder.Ord_CustomerSource.Trim() == "朋友介绍")
  335. {
  336. this.chkFriends.Checked = true;
  337. if (tblFriends.Rows.Count > 0)
  338. {
  339. if (tblFriends.Rows[0]["GP_IntroducerCustomerID"].ToString().Trim() != "")
  340. {
  341. this.modelFriends = ctbll.GetModel("Cus_CustomerNumber", tblFriends.Rows[0]["GP_IntroducerCustomerID"]);
  342. string StrCardType = "";
  343. string StrCardTypeShow = "";
  344. DataTable dt = orbll.GetView_Custom("tb_ErpMemberCard", StrWhere: "Mc_CustomerNumber = '" + this.modelFriends.Cus_CustomerNumber + "' And Mc_CradNumber != ''", ShowColumnName: "Mc_CardType").Tables[0];
  345. if (dt.Rows.Count > 0)
  346. {
  347. StrCardType = ";主卡等级:" + dt.Rows[0]["Mc_CardType"].ToString().Trim();
  348. if (dt.Rows[0]["Mc_CardType"].ToString().Trim() != "无")
  349. { StrCardTypeShow = " - " + dt.Rows[0]["Mc_CardType"].ToString().Trim(); }
  350. }
  351. LYFZ.Model.Model_ErpMemberCardBackCashSet modelCashSet = mcbcsetbll.GetModel("Mcb_OrderNumber", modelorder.Ord_Number);
  352. if (modelCashSet.ID > 0)
  353. {
  354. this.modelViceCard = mcvbll.GetModel("Mvc_ViceNumber", modelCashSet.Mcb_ViceNumber);
  355. this.chkFriends.Text = this.chkFriends.Tag + "(" + this.modelFriends.Cus_Name.Trim() + StrCardTypeShow + " - 副卡)";
  356. this.toolTip1.SetToolTip(this.chkFriends, "朋友介绍(介绍人:" + this.modelFriends.Cus_Name + StrCardType + ";副卡卡号:" + this.modelViceCard.Mvc_ViceCardNumber + ")");
  357. }
  358. else
  359. {
  360. if (this.modelFriends.Cus_Name != null)
  361. {
  362. this.chkFriends.Text = this.chkFriends.Tag + "(" + this.modelFriends.Cus_Name.Trim() + StrCardTypeShow + ")";
  363. this.toolTip1.SetToolTip(this.chkFriends, "朋友介绍(介绍人:" + this.modelFriends.Cus_Name + StrCardType + ")");
  364. }
  365. }
  366. }
  367. }
  368. }
  369. else if (modelorder.Ord_CustomerSource.Trim() == "老客户")
  370. { this.chkOldClient.Checked = true; }
  371. else if (modelorder.Ord_CustomerSource.Trim() == "老客户")
  372. { this.chkOldClient.Checked = true; }
  373. else if (modelorder.Ord_CustomerSource.Trim() == "医院跟踪客户")
  374. { this.chkHospitalClient.Checked = true; }
  375. else
  376. {
  377. this.chkOther.Checked = true;
  378. this.cmbtreevClientSource.Enabled = true;
  379. this.cmbtreevClientSource.TextFindTag(modelorder.Ord_CustomerSource.Trim());
  380. }
  381. #endregion
  382. #region 喜爱格调
  383. if (modelorder.Ord_LovedStyle.Trim() != "")
  384. {
  385. if (modelorder.Ord_LovedStyle.Trim().IndexOf('|') != -1)
  386. {
  387. string[] LovedStylelist = modelorder.Ord_LovedStyle.Trim().Split('|');
  388. if (LovedStylelist.Length > 0)
  389. {
  390. for (int i = 0; i < LovedStylelist.Length; i++)
  391. {
  392. try
  393. {
  394. ((CheckBoxEx)panelEx3.Controls[LovedStylelist[i]]).Checked = true;
  395. }
  396. catch { }
  397. }
  398. }
  399. }
  400. else
  401. { ((CheckBoxEx)panelEx3.Controls[modelorder.Ord_LovedStyle.Trim()]).Checked = true; }
  402. }
  403. #endregion
  404. #region 客户资料
  405. this.chBox_Click();
  406. if (this.UpdateOrderIsUpdateClientData)
  407. {
  408. foreach (Control control in this.flowPanel1.Controls)
  409. {
  410. if (control is SetCustomControls.OrderClientParentsControlsEx)
  411. {
  412. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  413. if (tmp.StrClientAttribute == "Man_")
  414. {
  415. for (int i = 0; i < mlistClient.Count; i++)
  416. {
  417. if (mlistClient[i].Cus_CustomerNumber == StrMasterNumber)
  418. {
  419. this.SetMarriageValue(mlistClient[i].Cus_DayForMarriage.Trim(), mlistClient[i].Cus_DayForMarriageLunar);
  420. tmp.SetClientValue(mlistClient[i], true, mlistClientRelation[i].Trim());
  421. tmp.IsPictResetShow = true;
  422. tmp.IsPictEditShow = true;
  423. mlistClient.RemoveAt(i);
  424. mlistClientRelation.RemoveAt(i);
  425. break;
  426. }
  427. }
  428. }
  429. else
  430. {
  431. for (int i = 0; i < mlistClient.Count; i++)
  432. {
  433. if (mlistClient[i].Cus_CustomerNumber != StrChildNumber && mlistClient[i].Cus_CustomerNumber.Trim() == StrMasterNumber)
  434. {
  435. this.SetMarriageValue(mlistClient[i].Cus_DayForMarriage.Trim(), mlistClient[i].Cus_DayForMarriageLunar);
  436. tmp.SetClientValue(mlistClient[i], true, mlistClientRelation[i].Trim());
  437. tmp.IsPictResetShow = true;
  438. tmp.IsPictEditShow = true;
  439. mlistClient.RemoveAt(i);
  440. mlistClientRelation.RemoveAt(i);
  441. break;
  442. }
  443. }
  444. }
  445. }
  446. else if (control is SetCustomControls.OrderClientChildrenControlsEx)
  447. {
  448. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  449. for (int i = 0; i < mlistClient.Count; i++)
  450. {
  451. if (mlistClient[i].Cus_CustomerNumber.Trim() == StrChildNumber)
  452. {
  453. tmp.SetClientValue(mlistClient[i], true);
  454. tmp.IsPictResetShow = true;
  455. tmp.IsPictEditShow = true;
  456. mlistClient.RemoveAt(i);
  457. mlistClientRelation.RemoveAt(i);
  458. break;
  459. }
  460. }
  461. }
  462. }
  463. if (mlistClient.Count > 0)
  464. {
  465. for (int i = 0; i < mlistClient.Count; i++)
  466. {
  467. this.SetMarriageValue(mlistClient[i].Cus_DayForMarriage.Trim(), mlistClient[i].Cus_DayForMarriageLunar);
  468. this.ClientAdultPanelAdd("其他联系人" + ClientAdultNameCount, model: mlistClient[i], MainClientRelation: mlistClientRelation[i].Trim());
  469. this.AddClinetCount++;
  470. }
  471. }
  472. }
  473. #endregion
  474. this.Text = "开单(" + this.OrdType.ToString().Trim() + ")";
  475. }));
  476. }
  477. catch { }
  478. }
  479. });
  480. this.tabControl.SelectedIndex = 0;
  481. }
  482. /// <summary>
  483. /// 赋婚期值
  484. /// </summary>
  485. /// <param name="StrValue"></param>
  486. /// <param name="StrLunar"></param>
  487. void SetMarriageValue(string StrValue, string StrLunar)
  488. {
  489. switch (this.OrdType)
  490. {
  491. case EnumPublic.OrderType.婚纱订单:
  492. case EnumPublic.OrderType.婚庆订单:
  493. case EnumPublic.OrderType.服务订单:
  494. this.mskMarriage.StrValue = StrValue;
  495. this.chkMarriage.Checked = LYFZ.Command.Command_Validate.DateLunar(StrLunar);
  496. break;
  497. }
  498. }
  499. /// <summary>
  500. /// 获取前缀
  501. /// </summary>
  502. /// <returns></returns>
  503. private string GetOrderCustomPrefix()
  504. {
  505. string StrCustomPrefix = "";
  506. if (this.OrdType == LYFZ.EnumPublic.OrderType.婚纱订单)
  507. { StrCustomPrefix = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.婚纱订单).Trim(); }
  508. else if (this.OrdType == LYFZ.EnumPublic.OrderType.儿童订单)
  509. { StrCustomPrefix = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.儿童订单).Trim(); }
  510. else if (this.OrdType == LYFZ.EnumPublic.OrderType.写真订单)
  511. { StrCustomPrefix = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.写真订单).Trim(); }
  512. else if (this.OrdType == LYFZ.EnumPublic.OrderType.服务订单)
  513. { StrCustomPrefix = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.服务订单).Trim(); }
  514. else if (this.OrdType == LYFZ.EnumPublic.OrderType.婚庆订单)
  515. { StrCustomPrefix = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.婚庆订单).Trim(); }
  516. return StrCustomPrefix;
  517. }
  518. /// <summary>
  519. /// 填充客户层的高
  520. /// </summary>
  521. void FillClientDataPanelHeight()
  522. {
  523. if (this.panelVice1.Height < (this.tap1.Height - 12))
  524. {
  525. this.panelVice1.Height = this.tap1.Height - 12;
  526. this.flowPanel1.Height = this.panelVice1.Height - this.flowPanel1.Location.Y;
  527. }
  528. }
  529. /// <summary>
  530. /// 检查数据是否被修改过
  531. /// </summary>
  532. /// <returns></returns>
  533. bool CheckDataIsUpdate()
  534. {
  535. bool IsUpdateSaveed = false;
  536. if (this.OrdType == EnumPublic.OrderType.服务订单)
  537. { }
  538. else
  539. {
  540. ComboBoxTreeViewEx cmbtreevTaoXiName = OrderEx.CmbtreevTaoXi;
  541. if (cmbtreevTaoXiName.Tag != null)
  542. {
  543. DataRow[] dtRow0 = null;
  544. DataRow[] dtRow1 = null;
  545. DataRow[] dtRow2 = null;
  546. DataTable tbl0 = null;
  547. DataTable tbl1 = null;
  548. DataTable tbl2 = null;
  549. string ExecuteSql = "select tb_ErpPackagesGiftMerchandise.ID,Sc_ClassName,Pgm_GiveType,Pgm_IntoRegisterQuantity,Pgm_IntoBottomQuantity,Pgm_Quantity " +
  550. "from tb_ErpPackagesGiftMerchandise Left Join tb_ErpTheScenery on cast(tb_ErpTheScenery.ID as varchar(20)) = Pgm_ProductNumber " +
  551. "Left Join tb_ErpSystemCategory on Tsc_Rating = Sc_ClassCode where Pgm_GiveType in ('2','3') And Pgm_PackagesCode = '" + cmbtreevTaoXiName.Tag.ToString().Trim() + "';";
  552. ExecuteSql += "select tb_ErpPackagesGiftMerchandise.ID,Prod_Batch,Pgm_Quantity,Pgm_GiveType from tb_ErpPackagesGiftMerchandise " +
  553. "Left Join tb_ErpProduct on Prod_Number = Pgm_ProductNumber where Pgm_GiveType in ('0','1') And Pgm_PackagesCode = '" + cmbtreevTaoXiName.Tag.ToString().Trim() + "';";
  554. ExecuteSql += "select Pak_UnitPrice from tb_ErpPackages where Pak_PackagesID = '" + cmbtreevTaoXiName.Tag.ToString().Trim() + "';";
  555. DataSet dsData = orbll.GetView_Custom(ExecuteSql);
  556. DataTable dt0 = dsData.Tables["ds"];
  557. DataTable dt1 = dsData.Tables["ds1"];
  558. DataTable dt2 = dsData.Tables["ds2"];
  559. switch (this.OrdType)
  560. {
  561. case EnumPublic.OrderType.儿童订单:
  562. case EnumPublic.OrderType.婚纱订单:
  563. case EnumPublic.OrderType.写真订单:
  564. case EnumPublic.OrderType.婚庆订单:
  565. #region 判断价格
  566. if (dt2.Rows.Count > 0)
  567. {
  568. if (Convert.ToDecimal(dt2.Rows[0]["Pak_UnitPrice"]) != Convert.ToDecimal(this.OrderEx.TaoXiPrice))
  569. { IsUpdateSaveed = true; }
  570. }
  571. #endregion
  572. #region 判断入底入册
  573. switch (this.OrdType)
  574. {
  575. case EnumPublic.OrderType.写真订单:
  576. case EnumPublic.OrderType.婚庆订单:
  577. try
  578. {
  579. DataTable dt = orbll.GetView_Custom("tb_ErpPackages", StrWhere: "Pak_PackagesID = '" + cmbtreevTaoXiName.Tag.ToString().Trim() + "'", ShowColumnName: "Pak_IntoTheArchive,Pak_IntoTheBook").Tables[0];
  580. Hashtable htDataPackages = this.OrderEx.GetIntoRegisterAndIntoBottom();
  581. if (dt.Rows.Count == 0 && htDataPackages.Count > 0)
  582. { IsUpdateSaveed = true; }
  583. else if (Convert.ToInt32(dt.Rows[0]["Pak_IntoTheArchive"]) != Convert.ToInt32(htDataPackages["IntoBottom"].ToString()) || Convert.ToInt32(dt.Rows[0]["Pak_IntoTheBook"]) != Convert.ToInt32(htDataPackages["IntoRegister"].ToString()))
  584. { IsUpdateSaveed = true; }
  585. }
  586. catch
  587. { }
  588. break;
  589. }
  590. #endregion
  591. #region 商品与服务
  592. if (!IsUpdateSaveed)
  593. {
  594. dtRow0 = dt1.Select("Pgm_GiveType = '0'");
  595. tbl0 = this.OrderProductEx.GetListViewData();
  596. if (dtRow0.Length != tbl0.Rows.Count)
  597. { IsUpdateSaveed = true; }
  598. else if (dtRow0.Length > 0 && tbl0.Rows.Count > 0)
  599. {
  600. for (int j = 0; j < tbl0.Rows.Count; j++)
  601. {
  602. if (string.IsNullOrEmpty(tbl0.Rows[j]["PgmID"].ToString().Trim()))
  603. {
  604. IsUpdateSaveed = true;
  605. break;
  606. }
  607. }
  608. if (!IsUpdateSaveed)
  609. {
  610. for (int i = 0; i < dtRow0.Length; i++)
  611. {
  612. DataRow[] dtRow = tbl0.Select("PgmID = '" + dtRow0[i]["ID"].ToString().Trim() + "'");
  613. if (dtRow0.Length <= 0)
  614. { IsUpdateSaveed = true; }
  615. else
  616. {
  617. if (Convert.ToInt32(dtRow[0]["商品P数"]) != Convert.ToInt32(dtRow0[i]["Prod_Batch"]) || Convert.ToInt32(dtRow[0]["商品数量"]) != Convert.ToInt32(dtRow0[i]["Pgm_Quantity"]))
  618. {
  619. IsUpdateSaveed = true;
  620. break;
  621. }
  622. }
  623. }
  624. }
  625. }
  626. }
  627. if (!IsUpdateSaveed)
  628. {
  629. dtRow1 = dt1.Select("Pgm_GiveType = '1'");
  630. tbl1 = this.OrderServiceEx.GetListViewData();
  631. if (dtRow1.Length != tbl1.Rows.Count)
  632. { IsUpdateSaveed = true; }
  633. else if (dtRow1.Length > 0 && tbl1.Rows.Count > 0)
  634. {
  635. for (int j = 0; j < tbl1.Rows.Count; j++)
  636. {
  637. if (string.IsNullOrEmpty(tbl1.Rows[j]["PgmID"].ToString().Trim()))
  638. {
  639. IsUpdateSaveed = true;
  640. break;
  641. }
  642. }
  643. if (!IsUpdateSaveed)
  644. {
  645. for (int i = 0; i < dtRow1.Length; i++)
  646. {
  647. DataRow[] dtRow = tbl1.Select("PgmID = '" + dtRow1[i]["ID"].ToString().Trim() + "'");
  648. if (dtRow1.Length <= 0)
  649. { IsUpdateSaveed = true; }
  650. else
  651. {
  652. if (Convert.ToInt32(dtRow[0]["服务数量"]) != Convert.ToInt32(dtRow1[i]["Pgm_Quantity"]))
  653. {
  654. IsUpdateSaveed = true;
  655. break;
  656. }
  657. }
  658. }
  659. }
  660. }
  661. }
  662. #endregion
  663. #region 景点与拍摄次数
  664. if (!IsUpdateSaveed)
  665. {
  666. switch (this.OrdType)
  667. {
  668. case EnumPublic.OrderType.婚纱订单:
  669. case EnumPublic.OrderType.写真订单:
  670. dtRow2 = dt0.Select("Pgm_GiveType = '2'");
  671. tbl2 = this.OrderSightsEx.GetListViewData();
  672. break;
  673. case EnumPublic.OrderType.儿童订单:
  674. dtRow2 = dt0.Select("Pgm_GiveType = '3'");
  675. tbl2 = this.OrderStagesEx.GetListViewData();
  676. break;
  677. }
  678. if (dtRow2.Length != tbl2.Rows.Count)
  679. { IsUpdateSaveed = true; }
  680. else if (dtRow2.Length > 0 && tbl2.Rows.Count > 0)
  681. {
  682. for (int j = 0; j < tbl2.Rows.Count; j++)
  683. {
  684. if (string.IsNullOrEmpty(tbl2.Rows[j]["PgmID"].ToString().Trim()))
  685. {
  686. IsUpdateSaveed = true;
  687. break;
  688. }
  689. }
  690. if (!IsUpdateSaveed)
  691. {
  692. for (int i = 0; i < dtRow2.Length; i++)
  693. {
  694. DataRow[] dtRow = tbl2.Select("PgmID = '" + dtRow2[i]["ID"].ToString().Trim() + "'");
  695. if (dtRow2.Length <= 0)
  696. { IsUpdateSaveed = true; }
  697. else
  698. {
  699. if (dtRow[0]["拍摄级别"].ToString().Trim() != dtRow2[i]["Sc_ClassName"].ToString().Trim() || Convert.ToInt32(dtRow[0]["服装套数"]) != Convert.ToInt32(dtRow2[i]["Pgm_Quantity"]))
  700. {
  701. IsUpdateSaveed = true;
  702. break;
  703. }
  704. if (!IsUpdateSaveed)
  705. {
  706. switch (this.OrdType)
  707. {
  708. case EnumPublic.OrderType.儿童订单:
  709. if (Convert.ToInt32(dtRow[0]["入册"]) != Convert.ToInt32(dtRow2[i]["Pgm_IntoRegisterQuantity"]) || Convert.ToInt32(dtRow[0]["入底"]) != Convert.ToInt32(dtRow2[i]["Pgm_IntoBottomQuantity"]) || Convert.ToInt32(dtRow[0]["服装套数"]) != Convert.ToInt32(dtRow2[i]["Pgm_Quantity"]))
  710. {
  711. IsUpdateSaveed = true;
  712. break;
  713. }
  714. break;
  715. }
  716. }
  717. }
  718. }
  719. }
  720. }
  721. }
  722. #endregion
  723. break;
  724. }
  725. }
  726. }
  727. return IsUpdateSaveed;
  728. }
  729. /// <summary>
  730. /// 保存意向
  731. /// </summary>
  732. /// <param name="sender"></param>
  733. /// <param name="e"></param>
  734. void btnSaveIntent_Click(object sender, EventArgs e)
  735. {
  736. DateTime strTime = SDateTime.Now;
  737. string strOrderPrefix = this.GetOrderCustomPrefix();
  738. List<Helper.CommandInfo> clist = null;
  739. bool IsSaveedOK = false;
  740. while (!IsSaveedOK)
  741. {
  742. clist = new List<Helper.CommandInfo>();
  743. #region 客户资料
  744. LYFZ.Model.Model_ErpCustomer modelCilent = null;
  745. LYFZ.Model.Model_ErpCustomer modelCilentMain = null;
  746. LYFZ.Model.Model_ErpCustomer modelChildCilent = null;
  747. List<LYFZ.Model.Model_ErpCustomer> ctmlist = new List<Model.Model_ErpCustomer>();
  748. string CilentMainRelation = "本人";
  749. string ChildCilentRelation = "本人";
  750. List<string> ClientRelation = new List<string>();
  751. int ClientIndex = 1;
  752. foreach (Control control in this.flowPanel1.Controls)
  753. {
  754. if (control is SetCustomControls.OrderClientParentsControlsEx)
  755. {
  756. #region 如果是婚纱版,则验证并设置婚期
  757. string Marriage = "";
  758. string MarriageLunar = "";
  759. switch (this.OrdType)
  760. {
  761. case EnumPublic.OrderType.婚纱订单:
  762. case EnumPublic.OrderType.婚庆订单:
  763. case EnumPublic.OrderType.服务订单:
  764. int intMasse = this.mskMarriage.CheckDateValue(this.mskMarriage, chkMarriage);
  765. if (intMasse == 1) { MessageBoxCustom.Show("婚期日期日期格式输入错误"); return; }
  766. else if (intMasse == 2)
  767. { MessageBoxCustom.Show("婚期日期:" + this.mskMarriage.StrValue.Trim() + "不是公历日期,若要保存请勾上农历"); return; }
  768. if (this.mskMarriage.StrValue.Trim() != "")
  769. {
  770. Marriage = this.mskMarriage.StrValue.Trim();//婚期
  771. if (this.chkMarriage.Checked)//婚期历类
  772. { MarriageLunar = "1"; }
  773. else { MarriageLunar = "0"; }
  774. }
  775. break;
  776. }
  777. #endregion
  778. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  779. if (tmp.StrClientAttribute == "Man_")
  780. {
  781. #region 主要联系人
  782. if (this.OrdType == EnumPublic.OrderType.儿童订单)
  783. { CilentMainRelation = ""; }
  784. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel ClientModel = tmp.GetClientValue(ref CilentMainRelation);
  785. if (ClientModel == null)
  786. { return; }
  787. if (ClientModel.ID > 0)
  788. {
  789. modelCilentMain = ctbll.GetModel(ClientModel.ID);
  790. modelCilentMain.Cus_UpdateDateTime = strTime;
  791. modelCilentMain.Cus_UpdateName = strUserID;
  792. }
  793. else
  794. {
  795. modelCilentMain = new Model.Model_ErpCustomer();
  796. modelCilentMain.Cus_CustomerNumber = LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  797. modelCilentMain.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  798. modelCilentMain.Cus_CreateDateTime = strTime;
  799. modelCilentMain.Cus_CreateName = strUserID;
  800. }
  801. modelCilentMain.Cus_Type = "";
  802. modelCilentMain.Cus_Address = ClientModel.CusAddress;
  803. modelCilentMain.Cus_Birthday = ClientModel.CusBirthday;
  804. modelCilentMain.Cus_BirthdayLunar = ClientModel.CusBirthdayLunar;
  805. modelCilentMain.Cus_DayForMarriage = "";
  806. modelCilentMain.Cus_DayForMarriageLunar = "";
  807. switch (this.OrdType)
  808. {
  809. case EnumPublic.OrderType.婚纱订单:
  810. case EnumPublic.OrderType.婚庆订单:
  811. case EnumPublic.OrderType.服务订单:
  812. modelCilentMain.Cus_DayForMarriage = Marriage;
  813. modelCilentMain.Cus_DayForMarriageLunar = MarriageLunar;
  814. break;
  815. }
  816. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
  817. { modelCilentMain.Cus_IDNumber = ClientModel.CusIDNumber; }
  818. modelCilentMain.Cus_FixedPhone = ClientModel.CusFixedPhone;
  819. modelCilentMain.Cus_MicroSignal = ClientModel.CusMicroSignal;
  820. modelCilentMain.Cus_Name = ClientModel.CusName;
  821. modelCilentMain.Cus_NamePinyin = ClientModel.CusNamePinyin;
  822. modelCilentMain.Cus_QQ = ClientModel.CusQQ;
  823. modelCilentMain.Cus_Region = ClientModel.CusRegion;
  824. modelCilentMain.Cus_Relations = ClientModel.CusRelations;
  825. modelCilentMain.Cus_Sex = ClientModel.CusSex;
  826. modelCilentMain.Cus_Telephone = ClientModel.CusTelephone;
  827. modelCilentMain.Cus_WorkUnit = ClientModel.CusWorkUnit;
  828. modelCilentMain.Cus_Zodiac = ClientModel.CusZodiac;
  829. if (modelCilentMain.ID == 0)
  830. { clist.Add(ctbll.GetAddCommandInfo(modelCilentMain)); }
  831. else
  832. { clist.Add(ctbll.GetUpdateCommandInfo(modelCilentMain)); }
  833. #endregion
  834. }
  835. else
  836. {
  837. #region 其他联系人
  838. string strOtherClienRelation = "";
  839. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel ClientModel = tmp.GetClientValue(ref strOtherClienRelation);
  840. ClientRelation.Add(strOtherClienRelation);
  841. if (ClientModel == null)
  842. { return; }
  843. if (ClientModel.ID > 0)
  844. {
  845. modelCilent = ctbll.GetModel(ClientModel.ID);
  846. modelCilent.Cus_UpdateDateTime = strTime;
  847. modelCilent.Cus_UpdateName = strUserID;
  848. }
  849. else
  850. {
  851. modelCilent = new Model.Model_ErpCustomer();
  852. modelCilent.Cus_CustomerNumber = LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  853. modelCilent.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  854. modelCilent.Cus_CreateDateTime = strTime;
  855. modelCilent.Cus_CreateName = strUserID;
  856. }
  857. modelCilent.Cus_Type = "";
  858. modelCilent.Cus_Address = ClientModel.CusAddress;
  859. modelCilent.Cus_Birthday = ClientModel.CusBirthday;
  860. modelCilent.Cus_BirthdayLunar = ClientModel.CusBirthdayLunar;
  861. modelCilent.Cus_DayForMarriage = "";
  862. modelCilent.Cus_DayForMarriageLunar = "";
  863. switch (this.OrdType)
  864. {
  865. case EnumPublic.OrderType.婚纱订单:
  866. case EnumPublic.OrderType.婚庆订单:
  867. case EnumPublic.OrderType.服务订单:
  868. modelCilent.Cus_DayForMarriage = Marriage;
  869. modelCilent.Cus_DayForMarriageLunar = MarriageLunar;
  870. break;
  871. }
  872. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
  873. { modelCilent.Cus_IDNumber = ClientModel.CusIDNumber; }
  874. modelCilent.Cus_FixedPhone = ClientModel.CusFixedPhone;
  875. modelCilent.Cus_MicroSignal = ClientModel.CusMicroSignal;
  876. modelCilent.Cus_Name = ClientModel.CusName;
  877. modelCilent.Cus_NamePinyin = ClientModel.CusNamePinyin;
  878. modelCilent.Cus_QQ = ClientModel.CusQQ;
  879. modelCilent.Cus_Region = ClientModel.CusRegion;
  880. modelCilent.Cus_Relations = ClientModel.CusRelations;
  881. modelCilent.Cus_Sex = ClientModel.CusSex;
  882. modelCilent.Cus_Telephone = ClientModel.CusTelephone;
  883. modelCilent.Cus_WorkUnit = ClientModel.CusWorkUnit;
  884. modelCilent.Cus_Zodiac = ClientModel.CusZodiac;
  885. if (modelCilent.ID <= 0)
  886. { clist.Add(ctbll.GetAddCommandInfo(modelCilent)); }
  887. else
  888. { clist.Add(ctbll.GetUpdateCommandInfo(modelCilent)); }
  889. ctmlist.Add(modelCilent);
  890. #endregion
  891. }
  892. }
  893. if (control is SetCustomControls.OrderClientChildrenControlsEx)
  894. {
  895. #region 儿童客户
  896. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  897. LYFZ.Model.Model_ErpCustomer ChildClientModel = tmp.GetClientValue(ref ChildCilentRelation);
  898. if (ChildClientModel == null)
  899. { return; }
  900. if (ChildClientModel.ID > 0)
  901. {
  902. modelChildCilent = ctbll.GetModel(ChildClientModel.ID);
  903. modelChildCilent.Cus_UpdateDateTime = strTime;
  904. modelChildCilent.Cus_UpdateName = strUserID;
  905. }
  906. else
  907. {
  908. modelChildCilent = new Model.Model_ErpCustomer();
  909. modelChildCilent.Cus_CustomerNumber = LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  910. modelChildCilent.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  911. modelChildCilent.Cus_CreateDateTime = strTime;
  912. modelChildCilent.Cus_CreateName = strUserID;
  913. }
  914. modelChildCilent.Cus_Type = "儿童";
  915. modelChildCilent.Cus_Birthday = ChildClientModel.Cus_Birthday;
  916. modelChildCilent.Cus_BirthdayLunar = ChildClientModel.Cus_BirthdayLunar;
  917. modelChildCilent.Cus_Name = ChildClientModel.Cus_Name;
  918. modelChildCilent.Cus_NamePinyin = ChildClientModel.Cus_NamePinyin;
  919. modelChildCilent.Cus_Sex = ChildClientModel.Cus_Sex;
  920. modelChildCilent.Cus_Zodiac = ChildClientModel.Cus_Zodiac;
  921. if (modelChildCilent.ID == 0)
  922. { clist.Add(ctbll.GetAddCommandInfo(modelChildCilent)); }
  923. else
  924. { clist.Add(ctbll.GetUpdateCommandInfo(modelChildCilent)); }
  925. #endregion
  926. }
  927. ClientIndex++;
  928. }
  929. #endregion
  930. #region 订单资料
  931. //int IntoRegisterQuantity = 0;
  932. //int IntoBottomQuantity = 0;
  933. //int IntoRegisterQuantityPackage = 0;
  934. //int IntoBottomQuantityPackage = 0;
  935. Hashtable htData_RegisterAndBottom = new Hashtable();
  936. htData_RegisterAndBottom["IntoRegisterQuantity"] = 0;
  937. htData_RegisterAndBottom["IntoBottomQuantity"] = 0;
  938. htData_RegisterAndBottom["IntoRegisterQuantityPackage"] = 0;
  939. htData_RegisterAndBottom["IntoBottomQuantityPackage"] = 0;
  940. LYFZ.Model.Model_ErpOrder modelOrder = null;
  941. string StrLovedStyle = this.GetStyle();
  942. string StrCustomerSource = this.GetClientSource();
  943. string StrNewOrderNumber = LYFZ.BLL.BLL_ErpOrder.GenerateNewMainOrderNo(SDateTime.Now, strOrderPrefix);
  944. string StrOrderType = Convert.ToInt32(this.OrdType).ToString();
  945. bool IsOrderFind = false;
  946. switch (this.OrdType)
  947. {
  948. case EnumPublic.OrderType.婚纱订单:
  949. case EnumPublic.OrderType.儿童订单:
  950. case EnumPublic.OrderType.写真订单:
  951. case EnumPublic.OrderType.婚庆订单:
  952. if (this.OrderEx != null)
  953. {
  954. modelOrder = this.OrderEx.GetOrderValue(ref htData_RegisterAndBottom, StrNewOrderNumber: StrNewOrderNumber, StrOrderType: StrOrderType, StrLovedStyle: StrLovedStyle,
  955. StrCustomerSource: StrCustomerSource, StrClass: "0", StrInfoID: strInfoID, StrTime: strTime, StrUserID: strUserID, IsMagess: false);
  956. IsOrderFind = true;
  957. }
  958. break;
  959. case EnumPublic.OrderType.服务订单:
  960. if (this.ServiceOrderEx != null)
  961. {
  962. modelOrder = this.ServiceOrderEx.GetOrderValue(StrNewOrderNumber: StrNewOrderNumber, StrOrderType: StrOrderType, StrLovedStyle: StrLovedStyle, StrCustomerSource: StrCustomerSource,
  963. StrClass: "0", StrInfoID: strInfoID, StrTime: strTime, StrUserID: strUserID, IsMagess: false);
  964. IsOrderFind = true;
  965. }
  966. break;
  967. }
  968. if (!IsOrderFind)
  969. {
  970. modelOrder = new Model.Model_ErpOrder();
  971. modelOrder.Ord_Number = StrNewOrderNumber;
  972. modelOrder.Ord_SinceOrderNumber = modelOrder.Ord_Number;
  973. modelOrder.Ord_Type = StrOrderType;
  974. modelOrder.Ord_DividedShop = strInfoID;
  975. modelOrder.Ord_Class = "0";
  976. modelOrder.Ord_CustomerSource = StrCustomerSource;
  977. modelOrder.Ord_LovedStyle = StrLovedStyle;
  978. modelOrder.Ord_CreateDateTime = strTime;
  979. modelOrder.Ord_CreateName = strUserID;
  980. }
  981. #endregion
  982. #region 订单客户组
  983. LYFZ.Model.Model_ErpCustomerGroup modelClientGroup = null;
  984. if (this.OrderGroupNumber != "")
  985. { modelClientGroup = cgbll.GetModel("GP_CustomerGroupID", this.OrderGroupNumber); }
  986. else
  987. { modelClientGroup = cgbll.GetModel("GP_OrderNumber", modelOrder.Ord_Number); }
  988. string strClientSource = this.GetClientSource();
  989. if (strClientSource == "")
  990. { MessageBoxCustom.Show("请选择客户来源!"); return; }
  991. if (modelClientGroup.ID > 0)
  992. {
  993. modelClientGroup.GP_GroupType = 2;
  994. modelClientGroup.GP_CustomerType = Convert.ToInt32(this.OrdType);
  995. modelClientGroup.GP_OrderNumber = modelOrder.Ord_Number;
  996. modelClientGroup.GP_CustomerSource = strClientSource;
  997. modelClientGroup.GP_CustomerStatus = "意向";
  998. modelClientGroup.GP_UpdateDatetime = strTime;
  999. modelClientGroup.GP_UpdateName = strUserID;
  1000. modelClientGroup.GP_ISIntentionCustomer = 2;
  1001. if (this.modelFriends != null)
  1002. { modelClientGroup.GP_IntroducerCustomerID = this.modelFriends.Cus_CustomerNumber; }
  1003. else
  1004. { modelClientGroup.GP_IntroducerCustomerID = ""; }
  1005. clist.Add(cgbll.GetUpdateCommandInfo(modelClientGroup));
  1006. }
  1007. else
  1008. {
  1009. modelClientGroup = new Model.Model_ErpCustomerGroup();
  1010. modelClientGroup.GP_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1011. modelClientGroup.GP_OrderNumber = modelOrder.Ord_Number;
  1012. modelClientGroup.GP_CustomerGroupID = LYFZ.BLL.BLL_ErpCustomer.GetNewClientGroupNumber();
  1013. modelClientGroup.GP_GroupType = 2;
  1014. modelClientGroup.GP_CustomerType = Convert.ToInt32(this.OrdType);
  1015. modelClientGroup.GP_CustomerStatus = "意向";
  1016. modelClientGroup.GP_LossReason = "";
  1017. modelClientGroup.GP_DegreeOfIntent = "";
  1018. modelClientGroup.GP_CustomerSource = strClientSource;
  1019. if (this.modelFriends != null)
  1020. { modelClientGroup.GP_IntroducerCustomerID = this.modelFriends.Cus_CustomerNumber; }
  1021. else
  1022. { modelClientGroup.GP_IntroducerCustomerID = ""; }
  1023. modelClientGroup.GP_Remark = "";
  1024. modelClientGroup.GP_BelongsPersonID = strUserID;
  1025. modelClientGroup.GP_CreateDatetime = strTime;
  1026. modelClientGroup.GP_CreateName = strUserID;
  1027. modelClientGroup.GP_ISIntentionCustomer = 2;
  1028. clist.Add(cgbll.GetAddCommandInfo(modelClientGroup));
  1029. }
  1030. #endregion
  1031. #region 客户成员组
  1032. LYFZ.Model.Model_ErpCustomerGroupMembers modelGroupMember = null;
  1033. List<LYFZ.Model.Model_ErpCustomerGroupMembers> Gmlist = cgmbll.GetModelList("GM_CustomerGroupID='" + modelClientGroup.GP_CustomerGroupID + "'");
  1034. List<LYFZ.Model.Model_ErpCustomer> ctmlistGroup = ctmlist;
  1035. List<string> ClientRelationGroup = ClientRelation;
  1036. if (Gmlist.Count > 0)
  1037. {
  1038. if (modelChildCilent != null)
  1039. {
  1040. bool IsBl = true;
  1041. for (int i = 0; i < Gmlist.Count; i++)
  1042. {
  1043. if (Gmlist[i].GM_CustomerID.Trim() == modelChildCilent.Cus_CustomerNumber)
  1044. {
  1045. modelGroupMember = Gmlist[i];
  1046. modelGroupMember.GM_Master = 0;
  1047. modelGroupMember.GM_Relation = ChildCilentRelation;
  1048. clist.Add(cgmbll.GetUpdateCommandInfo(modelGroupMember));
  1049. IsBl = false;
  1050. Gmlist.RemoveAt(i);
  1051. break;
  1052. }
  1053. }
  1054. if (IsBl)
  1055. {
  1056. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  1057. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1058. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  1059. modelGroupMember.GM_CustomerID = modelChildCilent.Cus_CustomerNumber;
  1060. modelGroupMember.GM_Master = 0;
  1061. modelGroupMember.GM_ProtagonistCustomer = 1;
  1062. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  1063. modelGroupMember.GM_Relation = ChildCilentRelation;
  1064. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  1065. }
  1066. }
  1067. if (modelCilentMain != null)
  1068. {
  1069. bool IsBl = true;
  1070. for (int i = 0; i < Gmlist.Count; i++)
  1071. {
  1072. if (Gmlist[i].GM_CustomerID.Trim() == modelCilentMain.Cus_CustomerNumber)
  1073. {
  1074. modelGroupMember = Gmlist[i];
  1075. modelGroupMember.GM_Master = 1;
  1076. switch (this.OrdType)
  1077. {
  1078. case EnumPublic.OrderType.儿童订单:
  1079. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  1080. modelGroupMember.GM_ProtagonistCustomer = 0;
  1081. break;
  1082. default:
  1083. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  1084. modelGroupMember.GM_ProtagonistCustomer = 1;
  1085. break;
  1086. }
  1087. modelGroupMember.GM_Relation = CilentMainRelation;
  1088. clist.Add(cgmbll.GetUpdateCommandInfo(modelGroupMember));
  1089. IsBl = false;
  1090. Gmlist.RemoveAt(i);
  1091. break;
  1092. }
  1093. }
  1094. if (IsBl)
  1095. {
  1096. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  1097. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1098. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  1099. modelGroupMember.GM_CustomerID = modelCilentMain.Cus_CustomerNumber;
  1100. modelGroupMember.GM_Master = 1;
  1101. switch (this.OrdType)
  1102. {
  1103. case EnumPublic.OrderType.儿童订单:
  1104. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  1105. modelGroupMember.GM_ProtagonistCustomer = 0;
  1106. break;
  1107. default:
  1108. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  1109. modelGroupMember.GM_ProtagonistCustomer = 1;
  1110. break;
  1111. }
  1112. modelGroupMember.GM_Relation = CilentMainRelation;
  1113. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  1114. }
  1115. }
  1116. for (int i = 0; i < Gmlist.Count; i++)
  1117. {
  1118. bool IsBl = true;
  1119. for (int j = 0; j < ctmlistGroup.Count; j++)
  1120. {
  1121. if (Gmlist[i].GM_CustomerID == ctmlistGroup[j].Cus_CustomerNumber)
  1122. {
  1123. modelGroupMember = Gmlist[i];
  1124. switch (this.OrdType)
  1125. {
  1126. case EnumPublic.OrderType.儿童订单:
  1127. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  1128. modelGroupMember.GM_ProtagonistCustomer = 0;
  1129. break;
  1130. default:
  1131. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  1132. modelGroupMember.GM_ProtagonistCustomer = 1;
  1133. break;
  1134. }
  1135. modelGroupMember.GM_Master = 0;
  1136. modelGroupMember.GM_Relation = ClientRelationGroup[j].Trim();
  1137. clist.Add(cgmbll.GetUpdateCommandInfo(modelGroupMember));
  1138. ctmlistGroup.RemoveAt(j);
  1139. ClientRelationGroup.RemoveAt(j);
  1140. IsBl = false;
  1141. }
  1142. }
  1143. if (IsBl)
  1144. { clist.Add(cgmbll.GetDeleteCommandInfo("ID", "=", Gmlist[i].ID)); }
  1145. }
  1146. }
  1147. else
  1148. {
  1149. switch (this.OrdType)
  1150. {
  1151. case EnumPublic.OrderType.儿童订单:
  1152. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  1153. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1154. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  1155. modelGroupMember.GM_CustomerID = modelChildCilent.Cus_CustomerNumber;
  1156. modelGroupMember.GM_Master = 0;
  1157. modelGroupMember.GM_ProtagonistCustomer = 1;
  1158. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  1159. modelGroupMember.GM_Relation = ChildCilentRelation;
  1160. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  1161. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  1162. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1163. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  1164. modelGroupMember.GM_CustomerID = modelCilentMain.Cus_CustomerNumber;
  1165. modelGroupMember.GM_Master = 1;
  1166. modelGroupMember.GM_ProtagonistCustomer = 0;
  1167. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  1168. modelGroupMember.GM_Relation = CilentMainRelation;
  1169. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  1170. break;
  1171. default:
  1172. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  1173. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1174. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  1175. modelGroupMember.GM_CustomerID = modelCilentMain.Cus_CustomerNumber;
  1176. modelGroupMember.GM_Master = 1;
  1177. modelGroupMember.GM_ProtagonistCustomer = 1;
  1178. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  1179. modelGroupMember.GM_Relation = CilentMainRelation;
  1180. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  1181. break;
  1182. }
  1183. }
  1184. for (int i = 0; i < ctmlistGroup.Count; i++)
  1185. {
  1186. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  1187. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1188. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  1189. modelGroupMember.GM_CustomerID = ctmlistGroup[i].Cus_CustomerNumber;
  1190. modelGroupMember.GM_Master = 0;
  1191. modelGroupMember.GM_Relation = ClientRelationGroup[i].Trim();
  1192. switch (this.OrdType)
  1193. {
  1194. case EnumPublic.OrderType.儿童订单:
  1195. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  1196. modelGroupMember.GM_ProtagonistCustomer = 0;
  1197. break;
  1198. default:
  1199. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  1200. modelGroupMember.GM_ProtagonistCustomer = 1;
  1201. break;
  1202. }
  1203. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  1204. }
  1205. #endregion
  1206. #region 订单人员表
  1207. if (this.txtOrderPerson.Text.Trim() == "")
  1208. { MessageBoxCustom.Show("接单人员不能为空!"); return; }
  1209. string[] StrValue = txtOrderPerson.Tag.ToString().Trim().Split('|')[0].Trim().Split(',');
  1210. string[] StrTag = txtOrderPerson.Tag.ToString().Trim().Split('|')[1].Trim().Split(',');
  1211. DataTable dtList = orbll.GetView_Custom("tb_ErpOrdersPerson", StrWhere: "OrdPe_OrderNumber='" + modelOrder.Ord_Number + "'", ShowColumnName: "*", filedOrder: "OrdPe_Type ASC").Tables[0];// orpbll.GetModelList("OrdPe_OrderNumber='" + modelOrder.Ord_Number + "'");
  1212. //List<LYFZ.Model.Model_ErpOrdersPerson> nmlist = orpbll.GetModelList("OrdPe_OrderNumber='" + modelOrder.Ord_Number + "'");
  1213. LYFZ.Model.Model_ErpOrdersPerson modelPerson = null;
  1214. ArrayList Removelist = new ArrayList();
  1215. for (int i = 0; i < StrValue.Length; i++)
  1216. {
  1217. bool IsFind = false;
  1218. for (int j = 0; j < dtList.Rows.Count; j++)
  1219. {
  1220. if (dtList.Rows[j]["OrdPe_OrdersPerson"].ToString().Trim() == StrValue[i].Trim())
  1221. {
  1222. IsFind = true;
  1223. modelPerson = orpbll.DataRowToModel(dtList.Rows[j]);
  1224. modelPerson.OrdPe_Type = StrTag[i].Trim();
  1225. modelPerson.OrdPe_UpdateDateTime = strTime;
  1226. modelPerson.OrdPe_UpdateName = strUserID;
  1227. clist.Add(orpbll.GetUpdateCommandInfo(modelPerson));
  1228. dtList.Rows.Remove(dtList.Rows[j]);
  1229. break;
  1230. }
  1231. }
  1232. if (!IsFind)
  1233. {
  1234. modelPerson = new Model.Model_ErpOrdersPerson();
  1235. modelPerson.OrdPe_OrderNumber = modelOrder.Ord_Number;
  1236. modelPerson.OrdPe_OrdersPerson = StrValue[i].Trim();
  1237. modelPerson.OrdPe_Type = StrTag[i].Trim();
  1238. modelPerson.OrdPe_CreateDateTime = strTime;
  1239. modelPerson.OrdPe_CreateName = strUserID;
  1240. clist.Add(orpbll.GetAddCommandInfo(modelPerson));
  1241. }
  1242. }
  1243. for (int i = 0; i < dtList.Rows.Count; i++)
  1244. { clist.Add(orpbll.GetDeleteCommandInfo("ID", "=", dtList.Rows[i]["ID"].ToString().Trim())); }
  1245. modelOrder.Ord_OrderPersonNumber = txtOrderPerson.Tag.ToString().Trim().Split('|')[0].Trim();
  1246. modelOrder.Ord_OrderPersonName = txtOrderPerson.Text.Trim();
  1247. //if (this.txtOrderPerson.Text.Trim() == "")
  1248. //{ MessageBoxCustom.Show("接单人员不能为空!"); return; }
  1249. //string[] StrValue = txtOrderPerson.Tag.ToString().Trim().Split('|')[0].Trim().Split(',');
  1250. //string[] StrTag = txtOrderPerson.Tag.ToString().Trim().Split('|')[1].Trim().Split(',');
  1251. //List<LYFZ.Model.Model_ErpOrdersPerson> nmlist = orpbll.GetModelList("OrdPe_OrderNumber='" + modelOrder.Ord_Number + "'");
  1252. //LYFZ.Model.Model_ErpOrdersPerson modelPerson = null;
  1253. //ArrayList Removelist = new ArrayList();
  1254. //for (int i = 0; i < nmlist.Count; i++)
  1255. //{
  1256. // bool isbl = true;
  1257. // for (int k = 0; k < StrValue.Length; k++)
  1258. // {
  1259. // if (nmlist[i].OrdPe_OrdersPerson.Trim() == StrValue[k].Trim())//说明有
  1260. // {
  1261. // if (nmlist[i].OrdPe_Type.Trim() != StrTag[k].Trim())
  1262. // {
  1263. // modelPerson = nmlist[i];
  1264. // modelPerson.OrdPe_Type = StrTag[k].Trim();
  1265. // modelPerson.OrdPe_UpdateDateTime = strTime;
  1266. // modelPerson.OrdPe_UpdateName = strUserID;
  1267. // clist.Add(orpbll.GetUpdateCommandInfo(modelPerson));
  1268. // }
  1269. // Removelist.Add(k);
  1270. // isbl = false;
  1271. // break;
  1272. // }
  1273. // }
  1274. // if (isbl)
  1275. // { clist.Add(orpbll.GetDeleteCommandInfo("ID", "=", nmlist[i].ID)); }
  1276. //}
  1277. //for (int l = 0; l < Removelist.Count; l++)
  1278. //{
  1279. // List<string> a = StrValue.ToList();
  1280. // a.RemoveAt(l);
  1281. // StrValue = a.ToArray();
  1282. // List<string> b = StrTag.ToList();
  1283. // b.RemoveAt(l);
  1284. // StrTag = b.ToArray();
  1285. // Removelist.RemoveAt(l);
  1286. // l--;
  1287. //}
  1288. //for (int k = 0; k < StrValue.Length; k++)
  1289. //{
  1290. // modelPerson = new Model.Model_ErpOrdersPerson();
  1291. // modelPerson.OrdPe_OrderNumber = modelOrder.Ord_Number;
  1292. // modelPerson.OrdPe_OrdersPerson = StrValue[k].Trim();
  1293. // modelPerson.OrdPe_Type = StrTag[k].Trim();
  1294. // modelPerson.OrdPe_CreateDateTime = strTime;
  1295. // modelPerson.OrdPe_CreateName = strUserID;
  1296. // clist.Add(orpbll.GetAddCommandInfo(modelPerson));
  1297. //}
  1298. #endregion
  1299. #region 景点与阶段资料
  1300. Hashtable htGroupList = new Hashtable();
  1301. List<LYFZ.Model.Model_ErpOrdersPhotography> plist = new List<Model.Model_ErpOrdersPhotography>();
  1302. List<LYFZ.Model.Model_ErpOrdersPhotography> pmlist = new List<Model.Model_ErpOrdersPhotography>();
  1303. switch (this.OrdType)
  1304. {
  1305. case EnumPublic.OrderType.婚纱订单:
  1306. case EnumPublic.OrderType.写真订单:
  1307. if (this.OrderSightsEx != null)
  1308. {
  1309. bool IsContinueA = false;
  1310. List<Helper.CommandInfo> mClistA = this.OrderSightsEx.GetOrderSightsValue(htData_RegisterAndBottom, modelOrder.Ord_Number, strTime, ref IsContinueA, IsMagess: false);
  1311. if (!IsContinueA)
  1312. { clist.AddRange(mClistA); }
  1313. }
  1314. break;
  1315. case EnumPublic.OrderType.儿童订单:
  1316. if (this.OrderStagesEx != null)
  1317. {
  1318. bool IsContinueB = false;
  1319. List<Helper.CommandInfo> mClistB = OrderStagesEx.GetOrderStagesValue(modelOrder.Ord_Number, strTime, ref IsContinueB, ref htGroupList, IsMagess: false);
  1320. if (!IsContinueB)
  1321. { clist.AddRange(mClistB); }
  1322. }
  1323. break;
  1324. }
  1325. #endregion
  1326. #region 订单数码
  1327. switch (this.OrdType)
  1328. {
  1329. case EnumPublic.OrderType.服务订单:
  1330. case EnumPublic.OrderType.婚庆订单:
  1331. DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigital", StrWhere: "Ordv_Number = '" + modelOrder.Ord_Number + "'", ShowColumnName: "ID").Tables[0];
  1332. if (dt.Rows.Count <= 0)
  1333. {
  1334. LYFZ.Model.Model_ErpOrderDigital ViceModel = new Model.Model_ErpOrderDigital();
  1335. ViceModel.Ordv_Number = modelOrder.Ord_Number;
  1336. ViceModel.Ordv_ViceNumber = ViceModel.Ordv_Number + "_001";
  1337. ViceModel.Ordv_DigitalNumber = 1;
  1338. ViceModel.Ordv_IntoRegisterQuantity = 0;
  1339. ViceModel.Ordv_IntoBottomQuantity = 0;
  1340. ViceModel.Ordv_IntoRegisterQuantityPackage = 0;
  1341. ViceModel.Ordv_IntoBottomQuantityPackage = 0;
  1342. ViceModel.Ordv_IntoBottomAddPickQuantity = 0;
  1343. ViceModel.Ordv_IntoRegisterAddPickQuantity = 0;
  1344. ViceModel.Ordv_ClothingDispatcher = "";
  1345. ViceModel.Ordv_ClothingName = "";
  1346. ViceModel.Ordv_ClothingRemark = "";
  1347. ViceModel.Ordv_ClothingStatus = "0";
  1348. ViceModel.Ordv_DesignerDispatcher = "";
  1349. ViceModel.Ordv_DesignerName = "";
  1350. ViceModel.Ordv_DesignerStatus = "0";
  1351. ViceModel.Ordv_DesignValidation = "";
  1352. ViceModel.Ordv_EarlyRepairDispatcher = "";
  1353. ViceModel.Ordv_EarlyRepairName = "";
  1354. ViceModel.Ordv_EarlyRepairStatus = "0";
  1355. ViceModel.Ordv_FilmSelectionDispatcher = "";
  1356. ViceModel.Ordv_FilmSelectionName = "";
  1357. ViceModel.Ordv_FilmSelectionStatus = "0";
  1358. ViceModel.Ordv_LookDesignClaim = "";
  1359. ViceModel.Ordv_LookDesignDispatcher = "";
  1360. ViceModel.Ordv_LookDesignName = "";
  1361. ViceModel.Ordv_LookDesignStatus = "0";
  1362. ViceModel.Ordv_RefinementDispatcher = "";
  1363. ViceModel.Ordv_RefinementName = "";
  1364. ViceModel.Ordv_RefinementStatus = "0";
  1365. ViceModel.Ordv_ReservationClothingName = "";
  1366. ViceModel.Ordv_ReservationDesignerName = "";
  1367. ViceModel.Ordv_ReservationEarlyRepairName = "";
  1368. ViceModel.Ordv_ReservationFilmSelectionName = "";
  1369. ViceModel.Ordv_ReservationLookDesignName = "";
  1370. ViceModel.Ordv_ReservationRefinementName = "";
  1371. ViceModel.Ordv_ReservationSendPhotoName = "";
  1372. ViceModel.Ordv_ReservationSendPhotoStatus = "0";
  1373. ViceModel.Ordv_SelectionDesign = "";
  1374. ViceModel.Ordv_SelectionFilm = "";
  1375. ViceModel.Ordv_UpdateName = "";
  1376. ViceModel.Ordv_CreateDatetime = strTime;
  1377. ViceModel.Ordv_CreateName = strUserID;
  1378. clist.Add(odbll.GetAddCommandInfo(ViceModel));
  1379. LYFZ.Model.Model_ErpOrderDigitalStatus modelStatus = new Model.Model_ErpOrderDigitalStatus();
  1380. modelStatus.Ords_Number = "ORDS_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  1381. modelStatus.Ords_OrdNumber = ViceModel.Ordv_Number;
  1382. modelStatus.Ords_ViceNumber = ViceModel.Ordv_ViceNumber;
  1383. modelStatus.Ords_DigitalNumber = ViceModel.Ordv_DigitalNumber;
  1384. modelStatus.Ords_OutSendEarlyRepairName = "";
  1385. modelStatus.Ords_OutSendEarlyRepairQuantity = 0;
  1386. modelStatus.Ords_OutSendEarlyRepairStatus = "未发";
  1387. modelStatus.Ords_OutSendEarlyRepairVendor = "";
  1388. modelStatus.Ords_OutSendEarlyRepairVendorQQ = "";
  1389. modelStatus.Ords_PhotographStatus = "未拍";
  1390. modelStatus.Ords_PhotographIntStatus = 0;
  1391. modelStatus.Ords_SightsName = "";
  1392. modelStatus.Ords_Photographer = "";
  1393. modelStatus.Ords_PhotographyAssistant = "";
  1394. modelStatus.Ords_MakeupArtist = "";
  1395. modelStatus.Ords_MakeupAssistant = "";
  1396. modelStatus.Ords_BootDivision = "";
  1397. modelStatus.Ords_BootDivisionAssistant = "";
  1398. modelStatus.Ords_ProductSendStatus = "未发";
  1399. modelStatus.Ords_ProductCompletedStatus = "未完";
  1400. modelStatus.Ords_ProductPickupStatus = "未取";
  1401. modelStatus.Ords_ProductPickupIntStatus = 0;
  1402. modelStatus.Ords_ProductIsExpedited = "否";
  1403. modelStatus.Ords_ServiceStatus = "未进行";
  1404. modelStatus.Ords_ServiceIntStatus = 0;
  1405. clist.Add(orsbll.GetAddCommandInfo(modelStatus));
  1406. }
  1407. break;
  1408. }
  1409. #endregion
  1410. #region 套系服务
  1411. if (this.OrderServiceEx != null)
  1412. {
  1413. bool IsServiceContinue = false;
  1414. List<Helper.CommandInfo> AddServiceclist = this.OrderServiceEx.GetOrderServiceValue(strTime, ref IsServiceContinue, modelOrder.Ord_Number, Marriage: "", htGroupList: htGroupList);
  1415. if (!IsServiceContinue)
  1416. { clist.AddRange(AddServiceclist); }
  1417. }
  1418. #endregion
  1419. #region 套系商品
  1420. if (this.OrderEx != null)
  1421. {
  1422. if (this.OrderProductEx != null)
  1423. {
  1424. string StrCode = "";
  1425. ComboBoxTreeViewEx cmbtreevTaoXiName = OrderEx.CmbtreevTaoXi;
  1426. if (cmbtreevTaoXiName.Tag != null)
  1427. { StrCode = cmbtreevTaoXiName.Tag.ToString().Trim(); }
  1428. bool IsContinue = false;
  1429. List<Helper.CommandInfo> AddProductclist = this.OrderProductEx.GetOrderProductValue(strTime, ref IsContinue, modelOrder.Ord_Number, htGroupList, StrCode, IsMagess: false);
  1430. if (!IsContinue)
  1431. { clist.AddRange(AddProductclist); }
  1432. }
  1433. }
  1434. #endregion
  1435. #region 保存订单
  1436. if (modelOrder.ID > 0)
  1437. { clist.Add(orbll.GetUpdateCommandInfo(modelOrder)); }
  1438. else
  1439. { clist.Add(orbll.GetAddCommandInfo(modelOrder)); }
  1440. #endregion
  1441. #region 写日志
  1442. string StrContent = "";
  1443. LYFZ.EnumPublic.SystemLogsType SysType;
  1444. if (modelOrder.ID > 0)
  1445. {
  1446. SysType = LYFZ.EnumPublic.SystemLogsType.修改订单;
  1447. StrContent = "[修改为意向订单] 订单号为:" + modelOrder.Ord_Number + ";接单人员为:" + this.txtOrderPerson.Text.Trim() + ";订单类别为:" + modelOrder.Ord_OrderClass + ";套系名称为:" + modelOrder.Ord_SeriesName + ";套系价格为:" + modelOrder.Ord_SeriesPrice;
  1448. }
  1449. else
  1450. {
  1451. SysType = LYFZ.EnumPublic.SystemLogsType.新开订单;
  1452. StrContent = "[新开意向订单] 订单号为:" + modelOrder.Ord_Number + ";接单人员为:" + this.txtOrderPerson.Text.Trim() + ";订单类别为:" + modelOrder.Ord_OrderClass + ";套系名称为:" + modelOrder.Ord_SeriesName + ";套系价格为:" + modelOrder.Ord_SeriesPrice;
  1453. }
  1454. clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(SysType, StrContent, strUserID, StrUserName, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP)));
  1455. #endregion
  1456. #region 办理会员卡
  1457. //办理介绍人的
  1458. if (modelClientGroup.GP_IntroducerCustomerID != "")
  1459. {
  1460. LYFZ.Model.Model_ErpMemberCard modelMc2 = mcbll.GetModel("Mc_CustomerNumber", modelClientGroup.GP_IntroducerCustomerID);
  1461. if (modelMc2.ID <= 0)
  1462. {
  1463. LYFZ.Model.Model_ErpSystemConfigure sgModel = LYFZ.BLL.OrderPayment_Member.GetNewMenberNumber(1);
  1464. clist.Add(sgbll.GetUpdateCommandInfo(sgModel));
  1465. modelMc2 = new Model.Model_ErpMemberCard();
  1466. modelMc2.Mc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1467. modelMc2.Mc_Number = sgModel.Sconfig_Value;
  1468. if (!string.IsNullOrEmpty(this.StrReferralsMemberCardNumber))
  1469. {
  1470. modelMc2.Mc_CradNumber = this.StrReferralsMemberCardNumber;
  1471. #region 打开管理界面
  1472. LYFZ.Model.Model_ErpMemberCardInterfaceManagement Modelmcim = mcimbll.GetModel("Mcim_Number", modelMc2.Mc_Number);
  1473. if (Modelmcim.ID <= 0)
  1474. {
  1475. DataTable newdtb = new DataTable();
  1476. newdtb.Columns.Add("Points", typeof(bool));
  1477. newdtb.Columns.Add("StoredValue", typeof(bool));
  1478. newdtb.Columns.Add("BackCash", typeof(bool));
  1479. newdtb.Columns.Add("Service", typeof(bool));
  1480. newdtb.Columns.Add("NewTaken", typeof(bool));
  1481. DataRow newRow = newdtb.NewRow();
  1482. newRow["Points"] = "True";
  1483. newRow["StoredValue"] = "True";
  1484. newRow["BackCash"] = "False";
  1485. newRow["Service"] = "False";
  1486. newRow["NewTaken"] = "False";
  1487. newdtb.Rows.Add(newRow);
  1488. Modelmcim = new Model.Model_ErpMemberCardInterfaceManagement();
  1489. Modelmcim.Mcim_Number = modelMc2.Mc_Number;
  1490. Modelmcim.Mcim_InterfaceName = new Json.JsontoDataTable().toJson(newdtb);
  1491. Modelmcim.Mcim_UpdateDatetime = strTime;
  1492. Modelmcim.Mcim_UpdateName = strUserID;
  1493. clist.Add(mcimbll.GetAddCommandInfo(Modelmcim));
  1494. }
  1495. #endregion
  1496. }
  1497. else
  1498. { modelMc2.Mc_CradNumber = ""; }
  1499. modelMc2.Mc_CustomerNumber = modelClientGroup.GP_IntroducerCustomerID;
  1500. //modelMc2.Mc_CardType = "积分卡";
  1501. modelMc2.Mc_CardType = "无";
  1502. modelMc2.Mc_TotalMoney = 0;
  1503. modelMc2.Mc_Money = 0;
  1504. modelMc2.Mc_TraderPassword = "";
  1505. modelMc2.Mc_UsedNumber = "";
  1506. modelMc2.Mc_Status = "1";
  1507. if (modelOrder.ID <= 0)
  1508. { modelMc2.Mc_OpenCardSource = "订单介绍保存," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  1509. else
  1510. { modelMc2.Mc_OpenCardSource = "订单介绍修改," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  1511. modelMc2.Mc_Remark = "";
  1512. modelMc2.Mc_CreateDatetime = strTime;
  1513. modelMc2.Mc_CreateName = strUserID;
  1514. modelMc2.Mc_TouchAccount = 0;
  1515. modelMc2.Mc_TotalTouchAccount = 0;
  1516. clist.Add(mcbll.GetAddCommandInfo(modelMc2));
  1517. }
  1518. }
  1519. #endregion
  1520. #region 修改介绍的电话号码
  1521. if (!string.IsNullOrEmpty(this.StrReferralsClientPhone.Trim()))
  1522. {
  1523. clist.Add(ctbll.GetUpdateCommandInfo(this.modelFriends));
  1524. }
  1525. #endregion
  1526. if (clist.Count > 0)
  1527. {
  1528. #region 保存前检测订单号
  1529. if (modelOrder.ID <= 0)
  1530. {
  1531. DataTable tbl = orbll.GetView_Custom("tb_ErpOrder", StrWhere: "Ord_Number = '" + modelOrder.Ord_Number + "'", ShowColumnName: "Ord_Number").Tables[0];
  1532. if (tbl.Rows.Count > 0)
  1533. {
  1534. //if (strOrderPrefix != "")
  1535. //{ tbl = orbll.GetView_Custom("tb_ErpOrder", StrWhere: "Ord_Number like '" + strOrderPrefix + "%'", filedOrder: " Ord_Number DESC", ShowColumnName: "Ord_Number", TopCount: 1).Tables[0]; }
  1536. //else
  1537. //{ tbl = orbll.GetView_Custom("tb_ErpOrder", filedOrder: " Ord_Number DESC", ShowColumnName: "Ord_Number", TopCount: 1).Tables[0];
  1538. //}
  1539. //if (tbl.Rows.Count > 0)
  1540. //{
  1541. #region 刘工 2017-03-26 修改
  1542. LYFZ.BLL.BLL_ErpOrder.UpdateOrderNumberRecord(modelOrder.Ord_Number, strUserID, SDateTime.Now);
  1543. #endregion
  1544. /*string strUpdateNumber = modelOrder.Ord_Number;
  1545. if (tbl.Rows[0]["Ord_Number"].ToString().Trim() == modelOrder.Ord_Number)
  1546. { strUpdateNumber = tbl.Rows[0]["Ord_Number"].ToString().Trim(); }
  1547. DataTable tbl2 = ornrbll.GetList("Ornr_OrderDate = '" + Convert.ToDateTime(SDateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'").Tables[0];
  1548. LYFZ.Model.Model_ErpOrderNumberRecord modelrecotd = null;
  1549. if (tbl2.Rows.Count > 0)
  1550. {
  1551. modelrecotd = ornrbll.DataTableToList(tbl2)[0];
  1552. modelrecotd.Ornr_OrderCount = modelrecotd.Ornr_OrderCount + 1;
  1553. modelrecotd.Ornr_LastNumber = strUpdateNumber;
  1554. modelrecotd.Ornr_UpdateDateTime = strTime;
  1555. modelrecotd.Ornr_UpdateName = strUserID;
  1556. ornrbll.Update(modelrecotd);
  1557. }
  1558. else
  1559. {
  1560. modelrecotd = new Model.Model_ErpOrderNumberRecord();
  1561. modelrecotd.Ornr_LastNumber = strUpdateNumber;
  1562. modelrecotd.Ornr_OrderCount = 1;
  1563. modelrecotd.Ornr_CreateDateTime = strTime;
  1564. modelrecotd.Ornr_CreateName = strUserID;
  1565. ornrbll.Add(modelrecotd);
  1566. }*/
  1567. //MessageBoxCustom.Show("此订单号已被占用,请重新保存!"); return;
  1568. IsSaveedOK = false;
  1569. //}
  1570. //else
  1571. //{ IsSaveedOK = true; }
  1572. }
  1573. else
  1574. { IsSaveedOK = true; }
  1575. }
  1576. else
  1577. { IsSaveedOK = true; }
  1578. #endregion
  1579. if (IsSaveedOK)
  1580. {
  1581. #region 修改最后订单号的记录
  1582. /* if (modelOrder.ID <= 0)
  1583. {
  1584. LYFZ.Model.Model_ErpOrderNumberRecord modelNR = ornrbll.GetModel("Ornr_OrderDate", Convert.ToDateTime(strTime.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss"));
  1585. if (modelNR.ID <= 0)
  1586. {
  1587. modelNR.Ornr_LastNumber = modelOrder.Ord_Number;
  1588. modelNR.Ornr_OrderCount = 1;
  1589. modelNR.Ornr_OrderDate = Convert.ToDateTime(strTime.ToString("yyyy-MM-dd"));
  1590. modelNR.Ornr_CreateDateTime = strTime;
  1591. modelNR.Ornr_CreateName = strUserID;
  1592. clist.Add(ornrbll.GetAddCommandInfo(modelNR));
  1593. }
  1594. else
  1595. {
  1596. modelNR.Ornr_LastNumber = modelOrder.Ord_Number;
  1597. modelNR.Ornr_OrderCount = modelNR.Ornr_OrderCount + 1;
  1598. modelNR.Ornr_UpdateDateTime = strTime;
  1599. modelNR.Ornr_UpdateName = strUserID;
  1600. clist.Add(ornrbll.GetUpdateCommandInfo(modelNR));
  1601. }
  1602. }*/
  1603. #endregion
  1604. if (MessageBoxCustom.Show("确定要保存为意向订单吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  1605. { return; }
  1606. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  1607. {
  1608. #region 刘工 2017-03-26 修改
  1609. if (modelOrder.ID <= 0)
  1610. {
  1611. LYFZ.BLL.BLL_ErpOrder.UpdateOrderNumberRecord(modelOrder.Ord_Number, strUserID, SDateTime.Now);
  1612. }
  1613. #endregion
  1614. this.StrNumber = modelOrder.Ord_Number;
  1615. this.IsSaveed = true;
  1616. switch (this.OrdType)
  1617. {
  1618. case EnumPublic.OrderType.婚纱订单:
  1619. case EnumPublic.OrderType.儿童订单:
  1620. case EnumPublic.OrderType.写真订单:
  1621. case EnumPublic.OrderType.婚庆订单:
  1622. if (this.OrderEx != null)
  1623. { this.OrderEx.SetOrderValue(orbll.GetModel(modelOrder.Ord_Number)); }
  1624. break;
  1625. case EnumPublic.OrderType.服务订单:
  1626. if (this.ServiceOrderEx != null)
  1627. { this.ServiceOrderEx.SetOrderValue(orbll.GetModel(modelOrder.Ord_Number)); }
  1628. break;
  1629. }
  1630. this.IsUpdateOrderLoad = true;
  1631. LYFZ.DAL.DAL_ErpCustomer.UpdateAggregationCustomer(this.StrNumber);
  1632. if (modelOrder.Ord_Number.Trim().Length > 0)
  1633. { LYFZ.BLL.BLL_ErpOrderDigitalStatus.UpdateDigitalStatus(modelOrder.Ord_Number, LYFZ.EnumPublic.OrderDigitalStatusEnum.开单); }
  1634. this.OpenSingleLoad();
  1635. MessageBoxCustom.Show("保存成功!");
  1636. }
  1637. else
  1638. { MessageBoxCustom.Show("保存失败!"); }
  1639. IsSaveedOK = true;
  1640. }
  1641. }
  1642. }
  1643. }
  1644. /// <summary>
  1645. /// 保存
  1646. /// </summary>
  1647. /// <param name="sender"></param>
  1648. /// <param name="e"></param>
  1649. void btnSave_Click(object sender, EventArgs e)
  1650. {
  1651. #region 检查授权
  1652. if (this.StrNumber.Trim() == "")
  1653. {
  1654. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.NewOrder))
  1655. {
  1656. if (!this.IsSaveedHadAuthorized)
  1657. {
  1658. bool IsCheckDataIsUpdate = this.CheckDataIsUpdate();
  1659. string strWindowText = "开订单";
  1660. if (IsCheckDataIsUpdate)
  1661. { strWindowText += "、修改新订单"; }
  1662. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm frm = new SuperSmallForm.AuthorizeLoginSuperSmallForm("StoresOPenSingle", LYFZ.CustomAttributes.OperatingAuthority.NewOrder);
  1663. frm.StrWindowText = strWindowText;
  1664. frm.ShowDialog();
  1665. if (!frm.IsSaveed)
  1666. { return; }
  1667. else if (!LYFZ.BLL.BLL_ErpUser.GetRights(frm.CurrentAuthorizeUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.NewOrder, frm.User_BelongRoles))
  1668. {
  1669. frm.SetAuthorizationResult(String.Format("授权失败,授权人没有'开订单'权限"));
  1670. MessageBoxCustom.Show("对不起!授权帐号:" + frm.StrUserAccount + "没有'开订单'权限。"); return; }
  1671. else {
  1672. frm.SetAuthorizationResult();
  1673. }
  1674. this.dec_OrderDiscounts = frm.CurrentAuthorizeUserRights.GetOrderDiscounts(Convert.ToInt32(this.OrdType));
  1675. #region 检测套系是否被修改过
  1676. if (IsCheckDataIsUpdate)
  1677. {
  1678. if (!LYFZ.BLL.BLL_ErpUser.GetRights(frm.CurrentAuthorizeUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.ModifyNewOrder, frm.User_BelongRoles))
  1679. {
  1680. frm.SetAuthorizationResult(String.Format("授权失败,授权人没有'修改新订单'权限"));
  1681. MessageBoxCustom.Show("对不起!授权帐号:" + frm.StrUserAccount + "没有'修改新订单'权限。"); return; }
  1682. else {
  1683. frm.SetAuthorizationResult();
  1684. }
  1685. }
  1686. #endregion
  1687. }
  1688. }
  1689. else
  1690. {
  1691. #region 检测套系是否被修改过
  1692. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.ModifyNewOrder))
  1693. {
  1694. if (this.CheckDataIsUpdate())
  1695. {
  1696. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm frm = new SuperSmallForm.AuthorizeLoginSuperSmallForm("StoresOPenSingle", LYFZ.CustomAttributes.OperatingAuthority.ModifyNewOrder);
  1697. frm.StrWindowText = "修改新订单";
  1698. frm.ShowDialog();
  1699. if (!frm.IsSaveed)
  1700. { return; }
  1701. else if (!LYFZ.BLL.BLL_ErpUser.GetRights(frm.CurrentAuthorizeUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.ModifyNewOrder, frm.User_BelongRoles))
  1702. {
  1703. frm.SetAuthorizationResult(String.Format("授权失败,授权人没有'修改新订单'权限"));
  1704. MessageBoxCustom.Show("对不起!授权帐号:" + frm.StrUserAccount + "没有'修改新订单'权限。"); return;
  1705. }
  1706. else {
  1707. frm.SetAuthorizationResult();
  1708. }
  1709. }
  1710. }
  1711. #endregion
  1712. this.dec_OrderDiscounts = LYFZ.BLL.BLL_ErpUser.CurrentUserRights.GetOrderDiscounts(Convert.ToInt32(this.OrdType));
  1713. }
  1714. }
  1715. else
  1716. {
  1717. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.ModifyOrder))
  1718. {
  1719. if (!this.IsSaveedHadAuthorized)
  1720. {
  1721. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm frm = new SuperSmallForm.AuthorizeLoginSuperSmallForm("StoresOPenSingle", LYFZ.CustomAttributes.OperatingAuthority.ModifyOrder);
  1722. frm.StrWindowText = "修改已订单";
  1723. frm.ShowDialog();
  1724. if (!frm.IsSaveed)
  1725. { return; }
  1726. else
  1727. {
  1728. if (!LYFZ.BLL.BLL_ErpUser.GetRights(frm.CurrentAuthorizeUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.ModifyOrder, frm.User_BelongRoles))
  1729. {
  1730. frm.SetAuthorizationResult(String.Format("授权失败,授权人没有'修改已订单'权限"));
  1731. MessageBoxCustom.Show("对不起!授权帐号:" + frm.StrUserAccount + "没有'修改已订单'权限。"); return; }
  1732. else {
  1733. frm.SetAuthorizationResult();
  1734. }
  1735. this.dec_OrderDiscounts = frm.CurrentAuthorizeUserRights.GetOrderDiscounts(Convert.ToInt32(this.OrdType));
  1736. }
  1737. }
  1738. }
  1739. else
  1740. { this.dec_OrderDiscounts = LYFZ.BLL.BLL_ErpUser.CurrentUserRights.GetOrderDiscounts(Convert.ToInt32(this.OrdType)); }
  1741. }
  1742. this.IsSaveedHadAuthorized = true;
  1743. #endregion
  1744. DateTime strTime = SDateTime.Now;
  1745. string strOrderPrefix = this.GetOrderCustomPrefix();
  1746. //Model.SMSParameters sparametersModel = null;
  1747. List<Helper.CommandInfo> clist = null;
  1748. //是否为添加新订单
  1749. bool isAddOrder = false;
  1750. bool IsSaveedOK = false;
  1751. string StrMainClientNumber = "";
  1752. string StrSeriesName = "";
  1753. while (!IsSaveedOK)
  1754. {
  1755. clist = new List<Helper.CommandInfo>();
  1756. #region 客户资料
  1757. LYFZ.Model.Model_ErpCustomer modelCilent = null;
  1758. LYFZ.Model.Model_ErpCustomer modelCilentMain = null;
  1759. LYFZ.Model.Model_ErpCustomer modelChildCilent = null;
  1760. List<LYFZ.Model.Model_ErpCustomer> ctmlist = new List<Model.Model_ErpCustomer>();
  1761. string CilentMainRelation = "本人";
  1762. string ChildCilentRelation = "本人";
  1763. List<string> ClientRelation = new List<string>();
  1764. int ClientIndex = 1;
  1765. #region 如果是婚纱版,则验证并设置婚期
  1766. string Marriage = "";
  1767. string MarriageLunar = "";
  1768. switch (this.OrdType)
  1769. {
  1770. case EnumPublic.OrderType.婚纱订单:
  1771. case EnumPublic.OrderType.婚庆订单:
  1772. case EnumPublic.OrderType.服务订单:
  1773. int intMasse = this.mskMarriage.CheckDateValue(this.mskMarriage, chkMarriage);
  1774. if (intMasse == 1) { MessageBoxCustom.Show("婚期日期日期格式输入错误"); return; }
  1775. else if (intMasse == 2)
  1776. { MessageBoxCustom.Show("婚期日期:" + this.mskMarriage.StrValue.Trim() + "不是公历日期,若要保存请勾上农历"); return; }
  1777. if (this.mskMarriage.StrValue.Trim() != "")
  1778. {
  1779. Marriage = this.mskMarriage.StrValue.Trim();//婚期
  1780. if (this.chkMarriage.Checked)//婚期历类
  1781. { MarriageLunar = "1"; }
  1782. else
  1783. { MarriageLunar = "0"; }
  1784. }
  1785. break;
  1786. }
  1787. #endregion
  1788. foreach (Control control in this.flowPanel1.Controls)
  1789. {
  1790. if (control is SetCustomControls.OrderClientParentsControlsEx)
  1791. {
  1792. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  1793. if (tmp.StrClientAttribute == "Man_")
  1794. {
  1795. #region 主要联系人
  1796. if (this.OrdType == EnumPublic.OrderType.儿童订单)
  1797. { CilentMainRelation = ""; }
  1798. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel ClientModel = tmp.GetClientValue(ref CilentMainRelation);
  1799. if (ClientModel == null)
  1800. { return; }
  1801. if (ClientModel.ID > 0)
  1802. {
  1803. modelCilentMain = ctbll.GetModel(ClientModel.ID);
  1804. modelCilentMain.Cus_UpdateDateTime = strTime;
  1805. modelCilentMain.Cus_UpdateName = strUserID;
  1806. }
  1807. else
  1808. {
  1809. modelCilentMain = new Model.Model_ErpCustomer();
  1810. modelCilentMain.Cus_CustomerNumber = LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  1811. modelCilentMain.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1812. modelCilentMain.Cus_CreateDateTime = strTime;
  1813. modelCilentMain.Cus_CreateName = strUserID;
  1814. }
  1815. modelCilentMain.Cus_Address = ClientModel.CusAddress;
  1816. modelCilentMain.Cus_Birthday = ClientModel.CusBirthday;
  1817. modelCilentMain.Cus_BirthdayLunar = ClientModel.CusBirthdayLunar;
  1818. modelCilentMain.Cus_DayForMarriage = "";
  1819. modelCilentMain.Cus_DayForMarriageLunar = "";
  1820. switch (this.OrdType)
  1821. {
  1822. case EnumPublic.OrderType.婚纱订单:
  1823. case EnumPublic.OrderType.婚庆订单:
  1824. case EnumPublic.OrderType.服务订单:
  1825. modelCilentMain.Cus_DayForMarriage = Marriage;
  1826. modelCilentMain.Cus_DayForMarriageLunar = MarriageLunar;
  1827. break;
  1828. }
  1829. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
  1830. { modelCilentMain.Cus_IDNumber = ClientModel.CusIDNumber; }
  1831. modelCilentMain.Cus_Type = "";
  1832. modelCilentMain.Cus_FixedPhone = ClientModel.CusFixedPhone;
  1833. modelCilentMain.Cus_MicroSignal = ClientModel.CusMicroSignal;
  1834. modelCilentMain.Cus_Name = ClientModel.CusName;
  1835. modelCilentMain.Cus_NamePinyin = ClientModel.CusNamePinyin;
  1836. modelCilentMain.Cus_QQ = ClientModel.CusQQ;
  1837. modelCilentMain.Cus_Region = ClientModel.CusRegion;
  1838. modelCilentMain.Cus_Relations = ClientModel.CusRelations;
  1839. modelCilentMain.Cus_Sex = ClientModel.CusSex;
  1840. modelCilentMain.Cus_Telephone = ClientModel.CusTelephone;
  1841. modelCilentMain.Cus_WorkUnit = ClientModel.CusWorkUnit;
  1842. modelCilentMain.Cus_Zodiac = ClientModel.CusZodiac;
  1843. StrMainClientNumber = modelCilentMain.Cus_CustomerNumber;
  1844. if (modelCilentMain.ID == 0)
  1845. { clist.Add(ctbll.GetAddCommandInfo(modelCilentMain)); }
  1846. else
  1847. { clist.Add(ctbll.GetUpdateCommandInfo(modelCilentMain)); }
  1848. #endregion
  1849. }
  1850. else
  1851. {
  1852. #region 其他联系人
  1853. string strOtherClienRelation = "";
  1854. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel ClientModel = tmp.GetClientValue(ref strOtherClienRelation);
  1855. ClientRelation.Add(strOtherClienRelation);
  1856. if (ClientModel == null)
  1857. { return; }
  1858. if (ClientModel.ID > 0)
  1859. {
  1860. modelCilent = ctbll.GetModel(ClientModel.ID);
  1861. modelCilent.Cus_UpdateDateTime = strTime;
  1862. modelCilent.Cus_UpdateName = strUserID;
  1863. }
  1864. else
  1865. {
  1866. modelCilent = new Model.Model_ErpCustomer();
  1867. modelCilent.Cus_CustomerNumber = LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  1868. modelCilent.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1869. modelCilent.Cus_CreateDateTime = strTime;
  1870. modelCilent.Cus_CreateName = strUserID;
  1871. }
  1872. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
  1873. { modelCilent.Cus_IDNumber = ClientModel.CusIDNumber; }
  1874. modelCilent.Cus_Address = ClientModel.CusAddress;
  1875. modelCilent.Cus_Birthday = ClientModel.CusBirthday;
  1876. modelCilent.Cus_BirthdayLunar = ClientModel.CusBirthdayLunar;
  1877. modelCilent.Cus_DayForMarriage = "";
  1878. modelCilent.Cus_DayForMarriageLunar = "";
  1879. switch (this.OrdType)
  1880. {
  1881. case EnumPublic.OrderType.婚纱订单:
  1882. case EnumPublic.OrderType.婚庆订单:
  1883. case EnumPublic.OrderType.服务订单:
  1884. modelCilent.Cus_DayForMarriage = Marriage;
  1885. modelCilent.Cus_DayForMarriageLunar = MarriageLunar;
  1886. break;
  1887. }
  1888. modelCilent.Cus_Type = "";
  1889. modelCilent.Cus_FixedPhone = ClientModel.CusFixedPhone;
  1890. modelCilent.Cus_MicroSignal = ClientModel.CusMicroSignal;
  1891. modelCilent.Cus_Name = ClientModel.CusName;
  1892. modelCilent.Cus_NamePinyin = ClientModel.CusNamePinyin;
  1893. modelCilent.Cus_QQ = ClientModel.CusQQ;
  1894. modelCilent.Cus_Region = ClientModel.CusRegion;
  1895. modelCilent.Cus_Relations = ClientModel.CusRelations;
  1896. modelCilent.Cus_Sex = ClientModel.CusSex;
  1897. modelCilent.Cus_Telephone = ClientModel.CusTelephone;
  1898. modelCilent.Cus_WorkUnit = ClientModel.CusWorkUnit;
  1899. modelCilent.Cus_Zodiac = ClientModel.CusZodiac;
  1900. if (modelCilent.ID <= 0)
  1901. { clist.Add(ctbll.GetAddCommandInfo(modelCilent)); }
  1902. else
  1903. { clist.Add(ctbll.GetUpdateCommandInfo(modelCilent)); }
  1904. ctmlist.Add(modelCilent);
  1905. #endregion
  1906. }
  1907. }
  1908. if (control is SetCustomControls.OrderClientChildrenControlsEx)
  1909. {
  1910. #region 儿童客户
  1911. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  1912. LYFZ.Model.Model_ErpCustomer ChildClientModel = tmp.GetClientValue(ref ChildCilentRelation);
  1913. if (ChildClientModel == null)
  1914. { return; }
  1915. if (ChildClientModel.ID > 0)
  1916. {
  1917. modelChildCilent = ctbll.GetModel(ChildClientModel.ID);
  1918. modelChildCilent.Cus_UpdateDateTime = strTime;
  1919. modelChildCilent.Cus_UpdateName = strUserID;
  1920. }
  1921. else
  1922. {
  1923. modelChildCilent = new Model.Model_ErpCustomer();
  1924. modelChildCilent.Cus_CustomerNumber = LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  1925. modelChildCilent.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  1926. modelChildCilent.Cus_CreateDateTime = strTime;
  1927. modelChildCilent.Cus_CreateName = strUserID;
  1928. }
  1929. modelChildCilent.Cus_Type = "儿童";
  1930. modelChildCilent.Cus_Birthday = ChildClientModel.Cus_Birthday;
  1931. modelChildCilent.Cus_BirthdayLunar = ChildClientModel.Cus_BirthdayLunar;
  1932. modelChildCilent.Cus_Name = ChildClientModel.Cus_Name;
  1933. modelChildCilent.Cus_NamePinyin = ChildClientModel.Cus_NamePinyin;
  1934. modelChildCilent.Cus_Sex = ChildClientModel.Cus_Sex;
  1935. modelChildCilent.Cus_Zodiac = ChildClientModel.Cus_Zodiac;
  1936. if (modelChildCilent.ID == 0)
  1937. { clist.Add(ctbll.GetAddCommandInfo(modelChildCilent)); }
  1938. else
  1939. { clist.Add(ctbll.GetUpdateCommandInfo(modelChildCilent)); }
  1940. #endregion
  1941. }
  1942. ClientIndex++;
  1943. }
  1944. #endregion
  1945. #region 订单资料
  1946. Hashtable htData_RegisterAndBottom = new Hashtable();
  1947. htData_RegisterAndBottom["IntoRegisterQuantity"] = 0;
  1948. htData_RegisterAndBottom["IntoBottomQuantity"] = 0;
  1949. htData_RegisterAndBottom["IntoRegisterQuantityPackage"] = 0;
  1950. htData_RegisterAndBottom["IntoBottomQuantityPackage"] = 0;
  1951. LYFZ.Model.Model_ErpOrder modelOrder = null;
  1952. string StrLovedStyle = this.GetStyle();
  1953. string StrCustomerSource = this.GetClientSource();
  1954. string StrNewOrderNumber = LYFZ.BLL.BLL_ErpOrder.GenerateNewMainOrderNo(SDateTime.Now, strOrderPrefix);
  1955. string StrOrderType = Convert.ToInt32(this.OrdType).ToString();
  1956. switch (this.OrdType)
  1957. {
  1958. case EnumPublic.OrderType.婚纱订单:
  1959. case EnumPublic.OrderType.儿童订单:
  1960. case EnumPublic.OrderType.写真订单:
  1961. case EnumPublic.OrderType.婚庆订单:
  1962. if (this.OrderEx != null)
  1963. {
  1964. modelOrder = this.OrderEx.GetOrderValue(ref htData_RegisterAndBottom, StrNewOrderNumber: StrNewOrderNumber, StrOrderType: StrOrderType, StrLovedStyle: StrLovedStyle,
  1965. StrCustomerSource: StrCustomerSource, StrClass: "1", StrInfoID: strInfoID, StrTime: strTime, StrUserID: strUserID);
  1966. }
  1967. else
  1968. { MessageBoxCustom.Show("订单信息未填写!"); return; }
  1969. break;
  1970. case EnumPublic.OrderType.服务订单:
  1971. if (this.ServiceOrderEx != null)
  1972. {
  1973. modelOrder = this.ServiceOrderEx.GetOrderValue(StrNewOrderNumber: StrNewOrderNumber, StrOrderType: StrOrderType, StrLovedStyle: StrLovedStyle, StrCustomerSource: StrCustomerSource,
  1974. StrClass: "1", StrInfoID: strInfoID, StrTime: strTime, StrUserID: strUserID);
  1975. }
  1976. else
  1977. { MessageBoxCustom.Show("订单信息未填写!"); return; }
  1978. break;
  1979. }
  1980. if (modelOrder == null)
  1981. { return; }
  1982. StrSeriesName = modelOrder.Ord_SeriesName;
  1983. #endregion
  1984. #region 医院跟踪客户修改
  1985. if (!string.IsNullOrEmpty(this.ComeSingleLotNumber))
  1986. {
  1987. LYFZ.Model.Model_ErpHospitalClient modelHospitalClient = hcbll.GetModel("Hct_Oddnumber", this.ComeSingleLotNumber);
  1988. modelHospitalClient.Hct_OrderNumber = modelOrder.Ord_Number;
  1989. modelHospitalClient.Hct_CustomerOrders = 1;
  1990. clist.Add(hcbll.GetUpdateCommandInfo(modelHospitalClient));
  1991. }
  1992. #endregion
  1993. #region 订单客户组
  1994. LYFZ.Model.Model_ErpCustomerGroup modelClientGroup = null;
  1995. if (this.OrderGroupNumber != "")
  1996. { modelClientGroup = cgbll.GetModel("GP_CustomerGroupID", this.OrderGroupNumber); }
  1997. else
  1998. { modelClientGroup = cgbll.GetModel("GP_OrderNumber", modelOrder.Ord_Number); }
  1999. string strClientSource = this.GetClientSource();
  2000. if (strClientSource == "")
  2001. { MessageBoxCustom.Show("请选择客户来源!"); return; }
  2002. if (modelClientGroup.ID > 0)
  2003. {
  2004. modelClientGroup.GP_GroupType = 0;
  2005. modelClientGroup.GP_CustomerType = Convert.ToInt32(this.OrdType);
  2006. modelClientGroup.GP_OrderNumber = modelOrder.Ord_Number;
  2007. modelClientGroup.GP_CustomerSource = strClientSource;
  2008. if (modelClientGroup.GP_CustomerStatus.Trim() != "正常")
  2009. {
  2010. modelClientGroup.GP_CustomerStatus = "追回";
  2011. modelClientGroup.GP_RecoverDateTime = strTime;
  2012. if (string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(modelClientGroup.GP_TransactionTime)))
  2013. { modelClientGroup.GP_TransactionTime = strTime; }
  2014. }
  2015. modelClientGroup.GP_UpdateDatetime = strTime;
  2016. modelClientGroup.GP_UpdateName = strUserID;
  2017. if (this.modelFriends != null)
  2018. { modelClientGroup.GP_IntroducerCustomerID = this.modelFriends.Cus_CustomerNumber; }
  2019. else
  2020. { modelClientGroup.GP_IntroducerCustomerID = ""; }
  2021. clist.Add(cgbll.GetUpdateCommandInfo(modelClientGroup));
  2022. }
  2023. else
  2024. {
  2025. modelClientGroup = new Model.Model_ErpCustomerGroup();
  2026. modelClientGroup.GP_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2027. modelClientGroup.GP_OrderNumber = modelOrder.Ord_Number;
  2028. modelClientGroup.GP_CustomerGroupID = LYFZ.BLL.BLL_ErpCustomer.GetNewClientGroupNumber();
  2029. modelClientGroup.GP_GroupType = 0;
  2030. modelClientGroup.GP_CustomerType = Convert.ToInt32(this.OrdType);
  2031. modelClientGroup.GP_CustomerStatus = "正常";
  2032. modelClientGroup.GP_LossReason = "";
  2033. modelClientGroup.GP_DegreeOfIntent = "";
  2034. modelClientGroup.GP_CustomerSource = strClientSource;
  2035. if (this.modelFriends != null)
  2036. { modelClientGroup.GP_IntroducerCustomerID = this.modelFriends.Cus_CustomerNumber; }
  2037. else
  2038. { modelClientGroup.GP_IntroducerCustomerID = ""; }
  2039. modelClientGroup.GP_Remark = "";
  2040. modelClientGroup.GP_BelongsPersonID = strUserID;
  2041. modelClientGroup.GP_CreateDatetime = strTime;
  2042. modelClientGroup.GP_CreateName = strUserID;
  2043. modelClientGroup.GP_ISIntentionCustomer = 0;
  2044. clist.Add(cgbll.GetAddCommandInfo(modelClientGroup));
  2045. }
  2046. #endregion
  2047. #region 客户成员组
  2048. LYFZ.Model.Model_ErpCustomerGroupMembers modelGroupMember = null;
  2049. List<LYFZ.Model.Model_ErpCustomerGroupMembers> Gmlist = cgmbll.GetModelList("GM_CustomerGroupID='" + modelClientGroup.GP_CustomerGroupID + "'");
  2050. List<LYFZ.Model.Model_ErpCustomer> ctmlistGroup = ctmlist;
  2051. List<string> ClientRelationGroup = ClientRelation;
  2052. if (Gmlist.Count > 0)
  2053. {
  2054. if (modelChildCilent != null)
  2055. {
  2056. bool IsBl = true;
  2057. for (int i = 0; i < Gmlist.Count; i++)
  2058. {
  2059. if (Gmlist[i].GM_CustomerID.Trim() == modelChildCilent.Cus_CustomerNumber)
  2060. {
  2061. IsBl = false;
  2062. modelGroupMember = Gmlist[i];
  2063. modelGroupMember.GM_Master = 0;
  2064. modelGroupMember.GM_Relation = ChildCilentRelation;
  2065. clist.Add(cgmbll.GetUpdateCommandInfo(modelGroupMember));
  2066. Gmlist.RemoveAt(i);
  2067. break;
  2068. }
  2069. }
  2070. if (IsBl)
  2071. {
  2072. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  2073. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2074. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  2075. modelGroupMember.GM_CustomerID = modelChildCilent.Cus_CustomerNumber;
  2076. modelGroupMember.GM_Master = 0;
  2077. modelGroupMember.GM_ProtagonistCustomer = 1;
  2078. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  2079. modelGroupMember.GM_Relation = ChildCilentRelation;
  2080. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  2081. }
  2082. }
  2083. if (modelCilentMain != null)
  2084. {
  2085. bool IsBl = true;
  2086. for (int i = 0; i < Gmlist.Count; i++)
  2087. {
  2088. if (Gmlist[i].GM_CustomerID.Trim() == modelCilentMain.Cus_CustomerNumber)
  2089. {
  2090. IsBl = false;
  2091. modelGroupMember = Gmlist[i];
  2092. modelGroupMember.GM_Master = 1;
  2093. switch (this.OrdType)
  2094. {
  2095. case EnumPublic.OrderType.儿童订单:
  2096. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  2097. modelGroupMember.GM_ProtagonistCustomer = 0;
  2098. break;
  2099. default:
  2100. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  2101. modelGroupMember.GM_ProtagonistCustomer = 1;
  2102. break;
  2103. }
  2104. modelGroupMember.GM_Relation = CilentMainRelation;
  2105. clist.Add(cgmbll.GetUpdateCommandInfo(modelGroupMember));
  2106. Gmlist.RemoveAt(i);
  2107. break;
  2108. }
  2109. }
  2110. if (IsBl)
  2111. {
  2112. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  2113. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2114. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  2115. modelGroupMember.GM_CustomerID = modelCilentMain.Cus_CustomerNumber;
  2116. modelGroupMember.GM_Master = 1;
  2117. switch (this.OrdType)
  2118. {
  2119. case EnumPublic.OrderType.儿童订单:
  2120. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  2121. modelGroupMember.GM_ProtagonistCustomer = 0;
  2122. break;
  2123. default:
  2124. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  2125. modelGroupMember.GM_ProtagonistCustomer = 1;
  2126. break;
  2127. }
  2128. modelGroupMember.GM_Relation = CilentMainRelation;
  2129. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  2130. }
  2131. }
  2132. for (int i = 0; i < Gmlist.Count; i++)
  2133. {
  2134. bool IsBl = true;
  2135. for (int j = 0; j < ctmlistGroup.Count; j++)
  2136. {
  2137. if (Gmlist[i].GM_CustomerID == ctmlistGroup[j].Cus_CustomerNumber)
  2138. {
  2139. IsBl = false;
  2140. modelGroupMember = Gmlist[i];
  2141. switch (this.OrdType)
  2142. {
  2143. case EnumPublic.OrderType.儿童订单:
  2144. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  2145. modelGroupMember.GM_ProtagonistCustomer = 0;
  2146. break;
  2147. default:
  2148. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  2149. modelGroupMember.GM_ProtagonistCustomer = 1;
  2150. break;
  2151. }
  2152. modelGroupMember.GM_Master = 0;
  2153. modelGroupMember.GM_Relation = ClientRelationGroup[j].Trim();
  2154. clist.Add(cgmbll.GetUpdateCommandInfo(modelGroupMember));
  2155. ctmlistGroup.RemoveAt(j);
  2156. ClientRelationGroup.RemoveAt(j);
  2157. }
  2158. }
  2159. if (IsBl)
  2160. { clist.Add(cgmbll.GetDeleteCommandInfo("ID", "=", Gmlist[i].ID)); }
  2161. }
  2162. }
  2163. else
  2164. {
  2165. switch (this.OrdType)
  2166. {
  2167. case EnumPublic.OrderType.儿童订单:
  2168. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  2169. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2170. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  2171. modelGroupMember.GM_CustomerID = modelChildCilent.Cus_CustomerNumber;
  2172. modelGroupMember.GM_Master = 0;
  2173. modelGroupMember.GM_ProtagonistCustomer = 1;
  2174. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  2175. modelGroupMember.GM_Relation = ChildCilentRelation;
  2176. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  2177. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  2178. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2179. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  2180. modelGroupMember.GM_CustomerID = modelCilentMain.Cus_CustomerNumber;
  2181. modelGroupMember.GM_Master = 1;
  2182. modelGroupMember.GM_ProtagonistCustomer = 0;
  2183. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  2184. modelGroupMember.GM_Relation = CilentMainRelation;
  2185. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  2186. break;
  2187. default:
  2188. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  2189. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2190. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  2191. modelGroupMember.GM_CustomerID = modelCilentMain.Cus_CustomerNumber;
  2192. modelGroupMember.GM_Master = 1;
  2193. modelGroupMember.GM_ProtagonistCustomer = 1;
  2194. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  2195. modelGroupMember.GM_Relation = CilentMainRelation;
  2196. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  2197. break;
  2198. }
  2199. }
  2200. for (int i = 0; i < ctmlistGroup.Count; i++)
  2201. {
  2202. modelGroupMember = new Model.Model_ErpCustomerGroupMembers();
  2203. modelGroupMember.GM_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2204. modelGroupMember.GM_CustomerGroupID = modelClientGroup.GP_CustomerGroupID;
  2205. modelGroupMember.GM_CustomerID = ctmlistGroup[i].Cus_CustomerNumber;
  2206. modelGroupMember.GM_Master = 0;
  2207. modelGroupMember.GM_Relation = ClientRelationGroup[i].Trim();
  2208. switch (this.OrdType)
  2209. {
  2210. case EnumPublic.OrderType.儿童订单:
  2211. modelGroupMember.GM_RelatedPersonID = modelChildCilent.Cus_CustomerNumber;
  2212. modelGroupMember.GM_ProtagonistCustomer = 0;
  2213. break;
  2214. default:
  2215. modelGroupMember.GM_RelatedPersonID = modelCilentMain.Cus_CustomerNumber;
  2216. modelGroupMember.GM_ProtagonistCustomer = 1;
  2217. break;
  2218. }
  2219. clist.Add(cgmbll.GetAddCommandInfo(modelGroupMember));
  2220. }
  2221. #endregion
  2222. #region 订单人员表
  2223. if (this.txtOrderPerson.Text.Trim() == "")
  2224. { MessageBoxCustom.Show("接单人员不能为空!"); return; }
  2225. string[] StrValue = txtOrderPerson.Tag.ToString().Trim().Split('|')[0].Trim().Split(',');
  2226. string[] StrTag = txtOrderPerson.Tag.ToString().Trim().Split('|')[1].Trim().Split(',');
  2227. DataTable dtList = orbll.GetView_Custom("tb_ErpOrdersPerson", StrWhere: "OrdPe_OrderNumber='" + modelOrder.Ord_Number + "'", ShowColumnName: "*", filedOrder: "OrdPe_Type ASC").Tables[0];// orpbll.GetModelList("OrdPe_OrderNumber='" + modelOrder.Ord_Number + "'");
  2228. //List<LYFZ.Model.Model_ErpOrdersPerson> nmlist = orpbll.GetModelList("OrdPe_OrderNumber='" + modelOrder.Ord_Number + "'");
  2229. LYFZ.Model.Model_ErpOrdersPerson modelPerson = null;
  2230. ArrayList Removelist = new ArrayList();
  2231. for (int i = 0; i < StrValue.Length; i++)
  2232. {
  2233. bool IsFind = false;
  2234. for (int j = 0; j < dtList.Rows.Count; j++)
  2235. {
  2236. if (dtList.Rows[j]["OrdPe_OrdersPerson"].ToString().Trim() == StrValue[i].Trim())
  2237. {
  2238. IsFind = true;
  2239. modelPerson = orpbll.DataRowToModel(dtList.Rows[j]);
  2240. modelPerson.OrdPe_Type = StrTag[i].Trim();
  2241. modelPerson.OrdPe_UpdateDateTime = strTime;
  2242. modelPerson.OrdPe_UpdateName = strUserID;
  2243. clist.Add(orpbll.GetUpdateCommandInfo(modelPerson));
  2244. dtList.Rows.Remove(dtList.Rows[j]);
  2245. break;
  2246. }
  2247. }
  2248. if (!IsFind)
  2249. {
  2250. modelPerson = new Model.Model_ErpOrdersPerson();
  2251. modelPerson.OrdPe_OrderNumber = modelOrder.Ord_Number;
  2252. modelPerson.OrdPe_OrdersPerson = StrValue[i].Trim();
  2253. modelPerson.OrdPe_Type = StrTag[i].Trim();
  2254. modelPerson.OrdPe_CreateDateTime = strTime;
  2255. modelPerson.OrdPe_CreateName = strUserID;
  2256. clist.Add(orpbll.GetAddCommandInfo(modelPerson));
  2257. }
  2258. }
  2259. for (int i = 0; i < dtList.Rows.Count; i++)
  2260. { clist.Add(orpbll.GetDeleteCommandInfo("ID", "=", dtList.Rows[i]["ID"].ToString().Trim())); }
  2261. modelOrder.Ord_OrderPersonNumber = txtOrderPerson.Tag.ToString().Trim().Split('|')[0].Trim();
  2262. modelOrder.Ord_OrderPersonName = txtOrderPerson.Text.Trim();
  2263. #endregion
  2264. #region 景点与阶段资料
  2265. Hashtable htGroupList = new Hashtable();
  2266. switch (this.OrdType)
  2267. {
  2268. case EnumPublic.OrderType.婚纱订单:
  2269. case EnumPublic.OrderType.写真订单:
  2270. if (this.OrderSightsEx != null)
  2271. {
  2272. bool IsContinueA = false;
  2273. List<Helper.CommandInfo> mClistA = this.OrderSightsEx.GetOrderSightsValue(htData_RegisterAndBottom, modelOrder.Ord_Number, strTime, ref IsContinueA, IsMagess: true);
  2274. if (IsContinueA)
  2275. { return; }
  2276. clist.AddRange(mClistA);
  2277. }
  2278. break;
  2279. case EnumPublic.OrderType.儿童订单:
  2280. bool IsContinueB = false;
  2281. List<Helper.CommandInfo> mClistB = OrderStagesEx.GetOrderStagesValue(modelOrder.Ord_Number, strTime, ref IsContinueB, ref htGroupList, IsMagess: true);
  2282. if (IsContinueB)
  2283. { return; }
  2284. clist.AddRange(mClistB);
  2285. break;
  2286. }
  2287. #endregion
  2288. #region 订单数码
  2289. switch (this.OrdType)
  2290. {
  2291. case EnumPublic.OrderType.服务订单:
  2292. case EnumPublic.OrderType.婚庆订单:
  2293. DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigital", StrWhere: "Ordv_Number = '" + modelOrder.Ord_Number + "'", ShowColumnName: "ID").Tables[0];
  2294. if (dt.Rows.Count <= 0)
  2295. {
  2296. LYFZ.Model.Model_ErpOrderDigital ViceModel = new Model.Model_ErpOrderDigital();
  2297. ViceModel.Ordv_Number = modelOrder.Ord_Number;
  2298. ViceModel.Ordv_ViceNumber = ViceModel.Ordv_Number + "_001";
  2299. ViceModel.Ordv_DigitalNumber = 1;
  2300. ViceModel.Ordv_IntoRegisterQuantity = 0;
  2301. ViceModel.Ordv_IntoBottomQuantity = 0;
  2302. ViceModel.Ordv_IntoRegisterQuantityPackage = 0;
  2303. ViceModel.Ordv_IntoBottomQuantityPackage = 0;
  2304. ViceModel.Ordv_IntoBottomAddPickQuantity = 0;
  2305. ViceModel.Ordv_IntoRegisterAddPickQuantity = 0;
  2306. ViceModel.Ordv_ClothingDispatcher = "";
  2307. ViceModel.Ordv_ClothingName = "";
  2308. ViceModel.Ordv_ClothingRemark = "";
  2309. ViceModel.Ordv_ClothingStatus = "0";
  2310. ViceModel.Ordv_DesignerDispatcher = "";
  2311. ViceModel.Ordv_DesignerName = "";
  2312. ViceModel.Ordv_DesignerStatus = "0";
  2313. ViceModel.Ordv_DesignValidation = "";
  2314. ViceModel.Ordv_EarlyRepairDispatcher = "";
  2315. ViceModel.Ordv_EarlyRepairName = "";
  2316. ViceModel.Ordv_EarlyRepairStatus = "0";
  2317. ViceModel.Ordv_FilmSelectionDispatcher = "";
  2318. ViceModel.Ordv_FilmSelectionName = "";
  2319. ViceModel.Ordv_FilmSelectionStatus = "0";
  2320. ViceModel.Ordv_LookDesignClaim = "";
  2321. ViceModel.Ordv_LookDesignDispatcher = "";
  2322. ViceModel.Ordv_LookDesignName = "";
  2323. ViceModel.Ordv_LookDesignStatus = "0";
  2324. ViceModel.Ordv_RefinementDispatcher = "";
  2325. ViceModel.Ordv_RefinementName = "";
  2326. ViceModel.Ordv_RefinementStatus = "0";
  2327. ViceModel.Ordv_ReservationClothingName = "";
  2328. ViceModel.Ordv_ReservationDesignerName = "";
  2329. ViceModel.Ordv_ReservationEarlyRepairName = "";
  2330. ViceModel.Ordv_ReservationFilmSelectionName = "";
  2331. ViceModel.Ordv_ReservationLookDesignName = "";
  2332. ViceModel.Ordv_ReservationRefinementName = "";
  2333. ViceModel.Ordv_ReservationSendPhotoName = "";
  2334. ViceModel.Ordv_ReservationSendPhotoStatus = "0";
  2335. ViceModel.Ordv_SelectionDesign = "";
  2336. ViceModel.Ordv_SelectionFilm = "";
  2337. ViceModel.Ordv_UpdateName = "";
  2338. ViceModel.Ordv_CreateDatetime = strTime;
  2339. ViceModel.Ordv_CreateName = strUserID;
  2340. clist.Add(odbll.GetAddCommandInfo(ViceModel));
  2341. LYFZ.Model.Model_ErpOrderDigitalStatus modelStatus = new Model.Model_ErpOrderDigitalStatus();
  2342. modelStatus.Ords_Number = "ORDS_" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber();
  2343. modelStatus.Ords_OrdNumber = ViceModel.Ordv_Number;
  2344. modelStatus.Ords_ViceNumber = ViceModel.Ordv_ViceNumber;
  2345. modelStatus.Ords_DigitalNumber = ViceModel.Ordv_DigitalNumber;
  2346. modelStatus.Ords_OutSendEarlyRepairName = "";
  2347. modelStatus.Ords_OutSendEarlyRepairQuantity = 0;
  2348. modelStatus.Ords_OutSendEarlyRepairStatus = "未发";
  2349. modelStatus.Ords_OutSendEarlyRepairVendor = "";
  2350. modelStatus.Ords_OutSendEarlyRepairVendorQQ = "";
  2351. modelStatus.Ords_PhotographStatus = "未拍";
  2352. modelStatus.Ords_PhotographIntStatus = 0;
  2353. modelStatus.Ords_SightsName = "";
  2354. modelStatus.Ords_Photographer = "";
  2355. modelStatus.Ords_PhotographyAssistant = "";
  2356. modelStatus.Ords_MakeupArtist = "";
  2357. modelStatus.Ords_MakeupAssistant = "";
  2358. modelStatus.Ords_BootDivision = "";
  2359. modelStatus.Ords_BootDivisionAssistant = "";
  2360. modelStatus.Ords_ProductSendStatus = "未发";
  2361. modelStatus.Ords_ProductCompletedStatus = "未完";
  2362. modelStatus.Ords_ProductPickupStatus = "未取";
  2363. modelStatus.Ords_ProductPickupIntStatus = 0;
  2364. modelStatus.Ords_ProductIsExpedited = "否";
  2365. modelStatus.Ords_ServiceStatus = "未进行";
  2366. modelStatus.Ords_ServiceIntStatus = 0;
  2367. clist.Add(orsbll.GetAddCommandInfo(modelStatus));
  2368. }
  2369. break;
  2370. }
  2371. #endregion
  2372. #region 套系服务
  2373. //DateTime DateMarriage = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
  2374. //if (Marriage != "")
  2375. //{
  2376. // if (MarriageLunar.Trim() == "1")
  2377. // {
  2378. // if (string.IsNullOrEmpty(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetLunarCalendarToSolarCalendar(Marriage)))
  2379. // { MessageBoxCustom.Show("婚期日期:农历不存在" + Marriage + "此日期!"); return; }
  2380. // DateMarriage = Convert.ToDateTime(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetLunarCalendarToSolarCalendar(Marriage));
  2381. // }
  2382. // else
  2383. // { DateMarriage = Convert.ToDateTime(Marriage); }
  2384. //}
  2385. bool IsServiceContinue = false;
  2386. List<Helper.CommandInfo> AddServiceclist = OrderServiceEx.GetOrderServiceValue(strTime, ref IsServiceContinue, modelOrder.Ord_Number, Marriage, htGroupList, MarriageLunar);
  2387. if (IsServiceContinue)
  2388. { return; }
  2389. clist.AddRange(AddServiceclist);
  2390. #endregion
  2391. #region 套系商品
  2392. switch (this.OrdType)
  2393. {
  2394. case EnumPublic.OrderType.婚纱订单:
  2395. case EnumPublic.OrderType.儿童订单:
  2396. case EnumPublic.OrderType.写真订单:
  2397. case EnumPublic.OrderType.婚庆订单:
  2398. ComboBoxTreeViewEx cmbtreevTaoXiName = OrderEx.CmbtreevTaoXi;
  2399. //if (cmbtreevTaoXiName.Tag != null)
  2400. {
  2401. bool IsContinue = false;
  2402. string strPackagesCode = "";
  2403. if (cmbtreevTaoXiName.Tag != null)
  2404. {strPackagesCode = cmbtreevTaoXiName.Tag.ToString().Trim(); }
  2405. List<Helper.CommandInfo> AddProductclist = OrderProductEx.GetOrderProductValue(strTime, ref IsContinue, modelOrder.Ord_Number, htGroupList, strPackagesCode);
  2406. if (IsContinue)
  2407. { return; }
  2408. clist.AddRange(AddProductclist);
  2409. #region 计算权限套系价格
  2410. if (cmbtreevTaoXiName.StrGetName.Trim() != "true" && cmbtreevTaoXiName.StrGetName.Trim() != "")
  2411. {
  2412. if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableOrderCostControlSystem)
  2413. {
  2414. //当前总成本价
  2415. decimal Old_PackagesAmount = OrderProductEx.GetProductAoumnt();
  2416. Old_PackagesAmount += OrderServiceEx.GetServiceAoumnt();
  2417. if (this.OrdType == EnumPublic.OrderType.儿童订单)
  2418. { Old_PackagesAmount += this.OrderStagesEx.GetStagesAoumnt(); }
  2419. else if (this.OrdType != EnumPublic.OrderType.婚庆订单)
  2420. { Old_PackagesAmount += this.OrderSightsEx.GetSightsAoumnt(); }
  2421. if (modelOrder.Ord_SeriesPrice < (Old_PackagesAmount * this.dec_OrderDiscounts))
  2422. {
  2423. if (MessageBoxCustom.Show("您输入的套系价格低于订单总成本,无法保存!\r\n是否需要去授权?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  2424. { return; }
  2425. else
  2426. {
  2427. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm frm = new SuperSmallForm.AuthorizeLoginSuperSmallForm(null, CustomAttributes.OperatingAuthority.ErrorPrivilegeValue, 1);
  2428. frm.ShowDialog();
  2429. if (!frm.IsSaveed)
  2430. { return; }
  2431. else
  2432. {
  2433. if (modelOrder.Ord_SeriesPrice < (Old_PackagesAmount * frm.CurrentAuthorizeUserRights.GetOrderDiscounts(Convert.ToInt32(this.OrdType))))
  2434. {
  2435. frm.SetAuthorizationResult(String.Format("授权失败,授权人成本管控权限不够"));
  2436. MessageBoxCustom.Show("授权帐号:" + frm.StrUserAccount + ",授权后的套系价格低于订单总成本,无法保存!"); return; }
  2437. else {
  2438. frm.SetAuthorizationResult();
  2439. }
  2440. }
  2441. }
  2442. }
  2443. }
  2444. }
  2445. #endregion
  2446. }
  2447. break;
  2448. case EnumPublic.OrderType.服务订单:
  2449. bool IsContinueA = false;
  2450. List<Helper.CommandInfo> AddProductclistA = OrderProductEx.GetOrderProductValue(strTime, ref IsContinueA, modelOrder.Ord_Number, htGroupList, "".Trim());
  2451. if (IsContinueA)
  2452. { return; }
  2453. clist.AddRange(AddProductclistA);
  2454. decimal Old_PackagesAmountA = OrderProductEx.GetProductAoumnt();
  2455. Old_PackagesAmountA += OrderServiceEx.GetServiceAoumnt();
  2456. if (modelOrder.Ord_SeriesPrice < (Old_PackagesAmountA * this.dec_OrderDiscounts))
  2457. {
  2458. if (MessageBoxCustom.Show("您输入的套系价格低于订单总成本,无法保存!\r\n是否需要去授权?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  2459. { return; }
  2460. else
  2461. {
  2462. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.AuthorizeLoginSuperSmallForm frm = new SuperSmallForm.AuthorizeLoginSuperSmallForm(null, CustomAttributes.OperatingAuthority.ErrorPrivilegeValue,1);
  2463. frm.ShowDialog();
  2464. if (!frm.IsSaveed)
  2465. { return; }
  2466. else
  2467. {
  2468. if (modelOrder.Ord_SeriesPrice < (Old_PackagesAmountA * frm.CurrentAuthorizeUserRights.GetOrderDiscounts(Convert.ToInt32(this.OrdType))))
  2469. {
  2470. frm.SetAuthorizationResult(String.Format("授权失败,授权人成本管控权限不够"));
  2471. MessageBoxCustom.Show("授权帐号:" + frm.StrUserAccount + ",授权后的套系价格低于订单总成本,无法保存!"); return; }
  2472. else {
  2473. frm.SetAuthorizationResult();
  2474. }
  2475. }
  2476. }
  2477. }
  2478. break;
  2479. }
  2480. #endregion
  2481. #region 朋友介绍副卡使用
  2482. if (this.modelViceCard != null)
  2483. {
  2484. if (this.modelViceCard.Mvc_Status == "1")
  2485. {
  2486. if (this.modelViceCard.Mvc_ViceCardType == "返现副卡")
  2487. {
  2488. string StrRemark = "";
  2489. bool IsValidity = LYFZ.BLL.OrderPayment_Member.VerifiedValidity(this.modelViceCard.Mvc_Number, LYFZ.EnumPublic.MemberFunctionAttribute.返现);
  2490. if (!IsValidity)
  2491. { StrRemark = "主卡返现有效期已过,不支持返现!"; }
  2492. decimal IntCoefficient = 1;
  2493. DataTable tblSconfig = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: " Sconfig_Code = 'BackCashCoefficient'", ShowColumnName: "Sconfig_Value").Tables[0];
  2494. if (tblSconfig.Rows.Count > 0)
  2495. { IntCoefficient = Convert.ToDecimal(tblSconfig.Rows[0]["Sconfig_Value"].ToString().Trim()); }
  2496. LYFZ.Model.Model_ErpMemberCardBackCash modelBackCash = mcbcbll.GetModel("Mcbc_Number", this.modelViceCard.Mvc_Number);
  2497. this.modelViceCard.Mvc_Status = "2";
  2498. this.modelViceCard.Mvc_UpdateDateTime = strTime;
  2499. this.modelViceCard.Mvc_UpdateName = strUserID;
  2500. this.modelViceCard.Mvc_Remark = StrRemark;
  2501. clist.Add(mcvbll.GetUpdateCommandInfo(this.modelViceCard));
  2502. LYFZ.Model.Model_ErpMemberCardOperateLOG modelopLog = new Model.Model_ErpMemberCardOperateLOG();
  2503. modelopLog.mcol_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2504. modelopLog.mcol_Number = this.modelViceCard.Mvc_ViceNumber;
  2505. modelopLog.mcol_Type = "4";
  2506. modelopLog.mcol_Remark = StrRemark;
  2507. modelopLog.mcol_CreateDatetime = strTime;
  2508. modelopLog.mcol_CreateName = strUserID;
  2509. clist.Add(mcopbll.GetAddCommandInfo(modelopLog));
  2510. if (IsValidity)
  2511. {
  2512. List<LYFZ.Model.Model_ErpMemberCardBackCashSet> mlistBackCashSet = mcbcsetbll.GetModelList("Mcb_Number = '" + this.modelViceCard.Mvc_Number + "' and (Mcb_ViceNumber = '' or Mcb_ViceNumber is NULL)");
  2513. if (mlistBackCashSet.Count > 0)
  2514. {
  2515. LYFZ.Model.Model_ErpMemberCardBackCashSet modelMcBcSet = mlistBackCashSet[0];
  2516. if ((modelBackCash.Mcbc_PackagesMoney * IntCoefficient) <= modelOrder.Ord_SeriesPrice)
  2517. {
  2518. modelMcBcSet.Mcb_IsSpending = 1;
  2519. modelMcBcSet.Mcb_ViceNumber = modelViceCard.Mvc_ViceNumber;
  2520. modelMcBcSet.Mcb_OrderNumber = modelOrder.Ord_Number;
  2521. modelMcBcSet.Mcb_SpendingTime = strTime;
  2522. modelMcBcSet.Mcb_UpdateDateTime = strTime;
  2523. modelMcBcSet.Mcb_UpdateName = strUserID;
  2524. DataTable tbl = orbll.GetView_Custom("tb_ErpMemberCardBackCashSet", StrWhere: "Mcb_Number = '" + this.modelViceCard.Mvc_Number + "' and Mcb_CashBackGroup = '" + this.modelViceCard.Mvc_CashBackGroup + "'", ShowColumnName: "Mcb_CashBackAmount,Mcb_IsSpending").Tables[0];
  2525. DataRow[] dtRow = tbl.Select("Mcb_IsSpending = '0'");
  2526. decimal DecBackCashAmount = 0;
  2527. if (dtRow.Length == 1)
  2528. {
  2529. for (int i = 0; i < tbl.Rows.Count; i++)
  2530. {
  2531. if (tbl.Rows[i]["Mcb_IsSpending"].ToString().Trim() == "1")
  2532. {
  2533. if (tbl.Rows[i]["Mcb_CashBackAmount"].ToString().Trim() != "")
  2534. { DecBackCashAmount += Convert.ToDecimal(tbl.Rows[i]["Mcb_CashBackAmount"]); }
  2535. }
  2536. }
  2537. DecBackCashAmount = modelBackCash.Mcbc_PackagesMoney - DecBackCashAmount;
  2538. }
  2539. else
  2540. { DecBackCashAmount = (modelMcBcSet.Mcb_Proportion / 100) * modelBackCash.Mcbc_PackagesMoney; }
  2541. List<LYFZ.Model.Model_ErpMemberCardViceCard> mlist = mcvbll.GetModelList("Mvc_Number = '" + this.modelViceCard.Mvc_Number + "' and Mvc_ViceCardType = '返现副卡' and Mvc_CashBackGroup = '" + this.modelViceCard.Mvc_CashBackGroup + "' and Mvc_Status = '1'");
  2542. if (mlist.Count == 1)
  2543. {
  2544. modelBackCash.Mcbc_PackagesMoney = 0;
  2545. modelBackCash.Mcbc_CashBackNumber = 0;
  2546. modelBackCash.Mcbc_CashBackProportion = "";
  2547. }
  2548. modelBackCash.Mcbc_AlreadyCashBack += DecBackCashAmount;
  2549. modelBackCash.Mcbc_UpdateDateTime = strTime;
  2550. modelBackCash.Mcbc_UpdateName = strUserID;
  2551. clist.Add(mcbcbll.GetUpdateCommandInfo(modelBackCash));
  2552. modelMcBcSet.Mcb_CashBackAmount = DecBackCashAmount;
  2553. clist.Add(mcbcsetbll.GetUpdateCommandInfo(modelMcBcSet));
  2554. }
  2555. else
  2556. { MessageBoxCustom.Show("订单套系不在返现套系范围内!"); return; }
  2557. }
  2558. else
  2559. {
  2560. if (MessageBoxCustom.Show("此返现副所属的主卡返现次数已经使用完,是否要回收副卡?", "温馨提示!", MessageBoxButtons.YesNo) == DialogResult.No)
  2561. { return; }
  2562. }
  2563. }
  2564. }
  2565. else if (modelViceCard.Mvc_ViceCardType == "积分副卡")
  2566. {
  2567. modelViceCard.Mvc_Status = "2";
  2568. modelViceCard.Mvc_UpdateDateTime = strTime;
  2569. modelViceCard.Mvc_UpdateName = strUserID;
  2570. clist.Add(mcvbll.GetUpdateCommandInfo(modelViceCard));
  2571. LYFZ.Model.Model_ErpMemberCardOperateLOG modelOPLog = new Model.Model_ErpMemberCardOperateLOG();
  2572. modelOPLog.mcol_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2573. modelOPLog.mcol_Number = modelViceCard.Mvc_Number;
  2574. modelOPLog.mcol_Type = "4";
  2575. modelOPLog.mcol_Remark = "副卡消费订单" + modelOrder.Ord_Number;
  2576. modelOPLog.mcol_CreateDatetime = strTime;
  2577. modelOPLog.mcol_CreateName = strUserID;
  2578. clist.Add(mcopbll.GetAddCommandInfo(modelOPLog));
  2579. }
  2580. }
  2581. }
  2582. #endregion
  2583. #region 保存订单
  2584. if (modelOrder.ID > 0)
  2585. { clist.Add(orbll.GetUpdateCommandInfo(modelOrder)); }
  2586. else
  2587. {
  2588. isAddOrder = true;
  2589. clist.Add(orbll.GetAddCommandInfo(modelOrder));
  2590. }
  2591. #endregion
  2592. #region 写日志
  2593. string StrContent = "";
  2594. LYFZ.EnumPublic.SystemLogsType SysType;
  2595. if (modelOrder.ID > 0)
  2596. {
  2597. SysType = LYFZ.EnumPublic.SystemLogsType.修改订单;
  2598. StrContent = "[修改为订单] 订单号为:" + modelOrder.Ord_Number + ";接单人员为:" + this.txtOrderPerson.Text.Trim() + ";订单类别为:" + modelOrder.Ord_OrderClass + ";套系名称为:" + modelOrder.Ord_SeriesName + ";套系价格为:" + modelOrder.Ord_SeriesPrice;
  2599. }
  2600. else
  2601. {
  2602. SysType = LYFZ.EnumPublic.SystemLogsType.新开订单;
  2603. StrContent = "[新开订单] 订单号为:" + modelOrder.Ord_Number + ";接单人员为:" + this.txtOrderPerson.Text.Trim() + ";订单类别为:" + modelOrder.Ord_OrderClass + ";套系名称为:" + modelOrder.Ord_SeriesName + ";套系价格为:" + modelOrder.Ord_SeriesPrice;
  2604. }
  2605. clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(SysType, StrContent, strUserID, StrUserName, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP)));
  2606. #region 系统记录
  2607. string StrContentDetails = "";
  2608. if (this.OrderSightsEx != null)
  2609. { StrContentDetails += this.OrderSightsEx.GetOrderSightsContentDetails(); }
  2610. if (this.OrderStagesEx != null)
  2611. { StrContentDetails += this.OrderStagesEx.GetOrderStagesContentDetails(); }
  2612. if (this.OrderProductEx != null)
  2613. { StrContentDetails = this.OrderProductEx.GetOrderProuctContentDetails(); }
  2614. if (this.OrderServiceEx != null)
  2615. { StrContentDetails += this.OrderServiceEx.GetOrderServiceContentDetails(); }
  2616. //if (this.SightsEx != null)
  2617. //{
  2618. // StrContentDetails += "拍摄景点(";
  2619. // DataGridViewEc dgvSights = this.SightsEx.GetdgvData;
  2620. // for (int i = 0; i < dgvSights.Rows.Count; i++)
  2621. // { StrContentDetails += "名称:" + dgvSights.Rows[i].Cells["S_Sights"].Value.ToString().Trim() + " 套数:" + dgvSights.Rows[i].Cells["S_Quantity"].Value.ToString().Trim() + " ;"; }
  2622. // StrContentDetails = StrContentDetails.Trim(';') + ")";
  2623. //}
  2624. //if (this.StagesEx != null)
  2625. //{
  2626. // StrContentDetails += " 拍摄阶段(";
  2627. // DataGridViewEc dgvStages = this.StagesEx.GetdgvData;
  2628. // for (int i = 0; i < dgvStages.Rows.Count; i++)
  2629. // { StrContentDetails += "名称:" + dgvStages.Rows[i].Cells["S_Sights"].Value.ToString().Trim() + " 套数:" + dgvStages.Rows[i].Cells["S_Quantity"].Value.ToString().Trim() + " ;"; }
  2630. // StrContentDetails = StrContentDetails.Trim(';') + ")";
  2631. //}
  2632. //if (this.ProductEx != null)
  2633. //{
  2634. // StrContentDetails += " 订单商品(";
  2635. // DataGridViewEc dgvProduct = this.ProductEx.GetdgvData;
  2636. // for (int i = 0; i < dgvProduct.Rows.Count; i++)
  2637. // { StrContentDetails += "名称:" + dgvProduct.Rows[i].Cells["T_Column2"].Value.ToString().Trim() + " 数量:" + dgvProduct.Rows[i].Cells["T_Column4"].Value.ToString().Trim() + " ;"; }
  2638. // StrContentDetails = StrContentDetails.Trim(';') + ")";
  2639. //}
  2640. //if (this.ServiceEx != null)
  2641. //{
  2642. // StrContentDetails += " 订单服务(";
  2643. // DataGridViewEc dgvService = this.ServiceEx.GetdgvData;
  2644. // for (int i = 0; i < dgvService.Rows.Count; i++)
  2645. // { StrContentDetails += "名称:" + dgvService.Rows[i].Cells["H_Column2"].Value.ToString().Trim() + " 数量:" + dgvService.Rows[i].Cells["H_Column4"].Value.ToString().Trim() + " ;"; }
  2646. // StrContentDetails = StrContentDetails.Trim(';') + ")";
  2647. //}
  2648. clist.Add(new BLL.BLL_ErpACVBSYS().GetAddCommandInfo(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetModelLog(SysType.ToString(), StrContent, StrContentDetails, strTime)));
  2649. #endregion
  2650. #endregion
  2651. #region 办理会员卡
  2652. bool IsOpenCardSendSMS = false;
  2653. //办理自己的
  2654. LYFZ.Model.Model_ErpMemberCard modelMc = mcbll.GetModel("Mc_CustomerNumber", modelCilentMain.Cus_CustomerNumber);
  2655. if (modelMc.ID <= 0)
  2656. {
  2657. LYFZ.Model.Model_ErpSystemConfigure sgModel = LYFZ.BLL.OrderPayment_Member.GetNewMenberNumber();
  2658. clist.Add(sgbll.GetUpdateCommandInfo(sgModel));
  2659. modelMc = new Model.Model_ErpMemberCard();
  2660. modelMc.Mc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2661. modelMc.Mc_Number = sgModel.Sconfig_Value;
  2662. modelMc.Mc_CradNumber = "";
  2663. if (this.chkTransactmemberCard.Checked)
  2664. {
  2665. modelMc.Mc_CradNumber = modelCilentMain.Cus_Telephone;
  2666. IsOpenCardSendSMS = true;
  2667. #region 打开管理界面
  2668. LYFZ.Model.Model_ErpMemberCardInterfaceManagement Modelmcim = mcimbll.GetModel("Mcim_Number", modelMc.Mc_Number);
  2669. if (Modelmcim.ID <= 0)
  2670. {
  2671. DataTable newdtb = new DataTable();
  2672. newdtb.Columns.Add("Points", typeof(bool));
  2673. newdtb.Columns.Add("StoredValue", typeof(bool));
  2674. newdtb.Columns.Add("BackCash", typeof(bool));
  2675. newdtb.Columns.Add("Service", typeof(bool));
  2676. newdtb.Columns.Add("NewTaken", typeof(bool));
  2677. DataRow newRow = newdtb.NewRow();
  2678. newRow["Points"] = "True";
  2679. newRow["StoredValue"] = "True";
  2680. newRow["BackCash"] = "False";
  2681. newRow["Service"] = "False";
  2682. newRow["NewTaken"] = "False";
  2683. newdtb.Rows.Add(newRow);
  2684. Modelmcim = new Model.Model_ErpMemberCardInterfaceManagement();
  2685. Modelmcim.Mcim_Number = modelMc.Mc_Number;
  2686. Modelmcim.Mcim_InterfaceName = new Json.JsontoDataTable().toJson(newdtb);
  2687. Modelmcim.Mcim_UpdateDatetime = strTime;
  2688. Modelmcim.Mcim_UpdateName = strUserID;
  2689. clist.Add(mcimbll.GetAddCommandInfo(Modelmcim));
  2690. }
  2691. #endregion
  2692. }
  2693. modelMc.Mc_CustomerNumber = modelCilentMain.Cus_CustomerNumber;
  2694. modelMc.Mc_CardType = "无";
  2695. modelMc.Mc_TotalMoney = 0;
  2696. modelMc.Mc_Money = 0;
  2697. modelMc.Mc_TraderPassword = "";
  2698. modelMc.Mc_UsedNumber = "";
  2699. modelMc.Mc_Status = "1";
  2700. modelMc.Mc_Remark = "";
  2701. if (modelOrder.ID <= 0)
  2702. { modelMc.Mc_OpenCardSource = "订单保存," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2703. else
  2704. { modelMc.Mc_OpenCardSource = "订单修改," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2705. modelMc.Mc_CreateDatetime = strTime;
  2706. modelMc.Mc_CreateName = strUserID;
  2707. modelMc.Mc_TouchAccount = 0;
  2708. modelMc.Mc_TotalTouchAccount = 0;
  2709. string StrChlid = "";
  2710. if (this.OrdType == EnumPublic.OrderType.儿童订单)
  2711. {
  2712. StrChlid = LYFZ.DAL.DAL_ErpCustomer.ClientNumberGetClientAllChildName(modelCilentMain.Cus_CustomerNumber);
  2713. if (modelChildCilent != null)
  2714. {
  2715. if (modelChildCilent.Cus_Name.Trim().Length > 0 && !StrChlid.Contains(modelChildCilent.Cus_Name.Trim()))
  2716. {
  2717. if (StrChlid.Trim().Length > 0)
  2718. { StrChlid += "/"; }
  2719. StrChlid += modelChildCilent.Cus_Name.Trim();
  2720. }
  2721. }
  2722. }
  2723. else if (this.OrdType == EnumPublic.OrderType.婚纱订单)
  2724. {
  2725. if (modelCilent != null)
  2726. { StrChlid = modelCilent.Cus_Name; }
  2727. }
  2728. modelMc.Mc_SecondQueryName = StrChlid.TrimEnd('/');
  2729. clist.Add(mcbll.GetAddCommandInfo(modelMc));
  2730. }
  2731. else
  2732. {
  2733. if (modelMc.Mc_CradNumber == "" && this.chkTransactmemberCard.Checked)
  2734. {
  2735. IsOpenCardSendSMS = true;
  2736. modelMc.Mc_CradNumber = modelCilentMain.Cus_Telephone;
  2737. modelMc.Mc_UpdateDateTime = strTime;
  2738. modelMc.Mc_UpdateName = strUserID;
  2739. clist.Add(mcbll.GetUpdateCommandInfo(modelMc));
  2740. }
  2741. else
  2742. {
  2743. string StrChlid = "";
  2744. if (this.OrdType == EnumPublic.OrderType.儿童订单)
  2745. {
  2746. StrChlid = LYFZ.DAL.DAL_ErpCustomer.ClientNumberGetClientAllChildName(modelCilentMain.Cus_CustomerNumber);
  2747. if (modelChildCilent != null)
  2748. {
  2749. if (modelChildCilent.Cus_Name.Trim().Length > 0 && !StrChlid.Contains(modelChildCilent.Cus_Name.Trim()))
  2750. {
  2751. if (StrChlid.Trim().Length > 0)
  2752. { StrChlid += "/"; }
  2753. StrChlid += modelChildCilent.Cus_Name.Trim();
  2754. }
  2755. }
  2756. }
  2757. else if (this.OrdType == EnumPublic.OrderType.婚纱订单)
  2758. {
  2759. if (modelCilent != null)
  2760. { StrChlid = modelCilent.Cus_Name; }
  2761. }
  2762. if (StrChlid.Trim().Length > 0)
  2763. {
  2764. modelMc.Mc_SecondQueryName = StrChlid.TrimEnd('/');
  2765. clist.Add(mcbll.GetUpdateCommandInfo(modelMc));
  2766. }
  2767. }
  2768. }
  2769. LYFZ.Model.Model_ErpMemberCardPoints modelPoints = mcptsbll.GetModel("Mcps_Number", modelMc.Mc_Number);
  2770. if (modelPoints.ID <= 0)
  2771. {
  2772. modelPoints = new Model.Model_ErpMemberCardPoints();
  2773. modelPoints.Mcps_Number = modelMc.Mc_Number;
  2774. modelPoints.Mcps_TotalPoints = 0;
  2775. modelPoints.Mcps_AvailablePoints = 0;
  2776. if (modelOrder.ID <= 0)
  2777. { modelPoints.Mcps_OpenCardSource = "服务保存," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2778. else
  2779. { modelPoints.Mcps_OpenCardSource = "服务修改," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2780. modelPoints.Mcps_UpdateDateTime = strTime;
  2781. modelPoints.Mcps_UpdateName = strUserID;
  2782. clist.Add(mcptsbll.GetAddCommandInfo(modelPoints));
  2783. //积分有效期
  2784. clist.AddRange(LYFZ.BLL.OrderPayment_Member.PointsChangeAutoValidity(modelMc.Mc_Number, modelMc.Mc_CradNumber));
  2785. }
  2786. //办理介绍人的
  2787. if (modelClientGroup.GP_IntroducerCustomerID != "")
  2788. {
  2789. LYFZ.Model.Model_ErpMemberCard modelMc2 = mcbll.GetModel("Mc_CustomerNumber", modelClientGroup.GP_IntroducerCustomerID);
  2790. if (modelMc2.ID <= 0)
  2791. {
  2792. LYFZ.Model.Model_ErpSystemConfigure sgModel = LYFZ.BLL.OrderPayment_Member.GetNewMenberNumber(1);
  2793. clist.Add(sgbll.GetUpdateCommandInfo(sgModel));
  2794. modelMc2 = new Model.Model_ErpMemberCard();
  2795. modelMc2.Mc_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
  2796. modelMc2.Mc_Number = sgModel.Sconfig_Value;
  2797. if (!string.IsNullOrEmpty(this.StrReferralsMemberCardNumber))
  2798. {
  2799. modelMc2.Mc_CradNumber = this.StrReferralsMemberCardNumber;
  2800. #region 打开管理界面
  2801. LYFZ.Model.Model_ErpMemberCardInterfaceManagement Modelmcim = mcimbll.GetModel("Mcim_Number", modelMc2.Mc_Number);
  2802. if (Modelmcim.ID <= 0)
  2803. {
  2804. DataTable newdtb = new DataTable();
  2805. newdtb.Columns.Add("Points", typeof(bool));
  2806. newdtb.Columns.Add("StoredValue", typeof(bool));
  2807. newdtb.Columns.Add("BackCash", typeof(bool));
  2808. newdtb.Columns.Add("Service", typeof(bool));
  2809. newdtb.Columns.Add("NewTaken", typeof(bool));
  2810. DataRow newRow = newdtb.NewRow();
  2811. newRow["Points"] = "True";
  2812. newRow["StoredValue"] = "True";
  2813. newRow["BackCash"] = "False";
  2814. newRow["Service"] = "False";
  2815. newRow["NewTaken"] = "False";
  2816. newdtb.Rows.Add(newRow);
  2817. Modelmcim = new Model.Model_ErpMemberCardInterfaceManagement();
  2818. Modelmcim.Mcim_Number = modelMc2.Mc_Number;
  2819. Modelmcim.Mcim_InterfaceName = new Json.JsontoDataTable().toJson(newdtb);
  2820. Modelmcim.Mcim_UpdateDatetime = strTime;
  2821. Modelmcim.Mcim_UpdateName = strUserID;
  2822. clist.Add(mcimbll.GetAddCommandInfo(Modelmcim));
  2823. }
  2824. #endregion
  2825. }
  2826. else
  2827. { modelMc2.Mc_CradNumber = ""; }
  2828. modelMc2.Mc_CustomerNumber = modelClientGroup.GP_IntroducerCustomerID;
  2829. //modelMc2.Mc_CardType = "积分卡";
  2830. modelMc2.Mc_CardType = "无";
  2831. modelMc2.Mc_TotalMoney = 0;
  2832. modelMc2.Mc_Money = 0;
  2833. modelMc2.Mc_TraderPassword = "";
  2834. modelMc2.Mc_UsedNumber = "";
  2835. modelMc2.Mc_Status = "1";
  2836. modelMc2.Mc_Remark = "";
  2837. if (modelOrder.ID <= 0)
  2838. { modelMc2.Mc_OpenCardSource = "订单介绍保存," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2839. else
  2840. { modelMc2.Mc_OpenCardSource = "订单介绍修改," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2841. modelMc2.Mc_CreateDatetime = strTime;
  2842. modelMc2.Mc_CreateName = strUserID;
  2843. modelMc2.Mc_TouchAccount = 0;
  2844. modelMc2.Mc_TotalTouchAccount = 0;
  2845. modelMc2.Mc_SecondQueryName = LYFZ.DAL.DAL_ErpCustomer.ClientNumberGetClientAllChildName(modelClientGroup.GP_IntroducerCustomerID);
  2846. clist.Add(mcbll.GetAddCommandInfo(modelMc2));
  2847. }
  2848. else
  2849. {
  2850. if (!string.IsNullOrEmpty(this.StrReferralsMemberCardNumber))
  2851. {
  2852. modelMc2.Mc_CradNumber = this.StrReferralsMemberCardNumber;
  2853. clist.Add(mcbll.GetUpdateCommandInfo(modelMc2));
  2854. }
  2855. }
  2856. if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ReferralAmountPaidPoints)
  2857. {
  2858. DataTable tblPointLog = orbll.GetView_Custom("tb_ErpMemberCardPointsLOG", StrWhere: "MPlg_Type = '3' and MPlg_OrderNumber = '" + modelOrder.Ord_Number + "'", ShowColumnName: "ID").Tables[0];
  2859. if (tblPointLog.Rows.Count <= 0)
  2860. {
  2861. LYFZ.Model.Model_ErpMemberCardPointsLOG modelPointsIntrLOG = new Model.Model_ErpMemberCardPointsLOG();
  2862. int IntPointsIntr = LYFZ.BLL.BLL_ErpMemberCard.GetPoints_AgoPeriod(LYFZ.EnumPublic.MemberPointsType.txtReferral_RMB, modelOrder.Ord_SeriesPrice, strInfoID, ClientNumber: modelClientGroup.GP_IntroducerCustomerID, IsHaveCardNumber: true);
  2863. if (IntPointsIntr > 0)
  2864. {
  2865. LYFZ.Model.Model_ErpMemberCardPoints modelPoints2 = mcptsbll.GetModel("Mcps_Number", modelMc2.Mc_Number);
  2866. if (modelPoints2.ID <= 0)
  2867. {
  2868. modelPoints2 = new Model.Model_ErpMemberCardPoints();
  2869. modelPointsIntrLOG.MPlg_OriginalPoints = 0;
  2870. modelPoints2.Mcps_Number = modelMc2.Mc_Number;
  2871. modelPoints2.Mcps_TotalPoints = IntPointsIntr;
  2872. modelPoints2.Mcps_AvailablePoints = IntPointsIntr;
  2873. if (modelOrder.ID <= 0)
  2874. { modelPoints2.Mcps_OpenCardSource = "订单介绍保存," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2875. else
  2876. { modelPoints2.Mcps_OpenCardSource = "订单介绍修改," + new System.Diagnostics.StackTrace(new System.Diagnostics.StackFrame(true)).ToString(); }
  2877. modelPoints2.Mcps_UpdateDateTime = strTime;
  2878. modelPoints2.Mcps_UpdateName = strUserID;
  2879. clist.Add(mcptsbll.GetAddCommandInfo(modelPoints2));
  2880. }
  2881. else
  2882. {
  2883. modelPointsIntrLOG.MPlg_OriginalPoints = modelPoints2.Mcps_AvailablePoints;
  2884. modelPoints2.Mcps_TotalPoints = modelPoints2.Mcps_TotalPoints + IntPointsIntr;
  2885. modelPoints2.Mcps_AvailablePoints = modelPoints2.Mcps_AvailablePoints + IntPointsIntr;
  2886. modelPoints2.Mcps_UpdateDateTime = strTime;
  2887. modelPoints2.Mcps_UpdateName = strUserID;
  2888. clist.Add(mcptsbll.GetUpdateCommandInfo(modelPoints2));
  2889. }
  2890. modelPointsIntrLOG.MPlg_DividedShop = LYFZ.BLL.OrderPayment_Member.StrInfoID;
  2891. modelPointsIntrLOG.MPlg_Number = modelPoints2.Mcps_Number;
  2892. modelPointsIntrLOG.MPlg_Type = "3";
  2893. modelPointsIntrLOG.MPlg_ExistingPoints = modelPoints2.Mcps_AvailablePoints;
  2894. modelPointsIntrLOG.MPlg_UsePoints = IntPointsIntr;
  2895. modelPointsIntrLOG.MPlg_RedeemArticle = "";
  2896. modelPointsIntrLOG.MPlg_RedeemAmount = 0;
  2897. modelPointsIntrLOG.MPlg_OrderNumber = modelOrder.Ord_SinceOrderNumber.Trim() != "" ? modelOrder.Ord_SinceOrderNumber.Trim() : modelOrder.Ord_Number;
  2898. modelPointsIntrLOG.MPlg_ViceCardNumber = "";
  2899. modelPointsIntrLOG.MPlg_Remark = "你介绍" + modelCilentMain.Cus_Name + "来订单,订单号:" + modelPointsIntrLOG.MPlg_OrderNumber + "付款,获得积分:" + IntPointsIntr;
  2900. modelPointsIntrLOG.MPlg_CreateDatetime = strTime;
  2901. modelPointsIntrLOG.MPlg_CreateName = strUserID;
  2902. clist.Add(mcpslogbll.GetAddCommandInfo(modelPointsIntrLOG));
  2903. //积分有效期
  2904. clist.AddRange(LYFZ.BLL.OrderPayment_Member.PointsChangeAutoValidity(modelMc2.Mc_Number, modelMc2.Mc_CradNumber));
  2905. }
  2906. }
  2907. }
  2908. }
  2909. #endregion
  2910. #region 修改介绍的电话号码
  2911. if (!string.IsNullOrEmpty(this.StrReferralsClientPhone.Trim()))
  2912. {
  2913. clist.Add(ctbll.GetUpdateCommandInfo(this.modelFriends));
  2914. }
  2915. #endregion
  2916. if (clist.Count > 0)
  2917. {
  2918. #region 保存前检测订单号
  2919. if (modelOrder.ID <= 0)
  2920. {
  2921. DataTable tbl = orbll.GetView_Custom("tb_ErpOrder", StrWhere: "Ord_Number = '" + modelOrder.Ord_Number + "'", ShowColumnName: "Ord_Number").Tables[0];
  2922. if (tbl.Rows.Count > 0)
  2923. {
  2924. //if (strOrderPrefix != "")
  2925. //{ tbl = orbll.GetView_Custom("tb_ErpOrder", StrWhere: "Ord_Number like '" + strOrderPrefix + "%'", filedOrder: " Ord_Number DESC", ShowColumnName: "Ord_Number", TopCount: 1).Tables[0]; }
  2926. //else
  2927. //{ tbl = orbll.GetView_Custom("tb_ErpOrder", filedOrder: " Ord_Number DESC", ShowColumnName: "Ord_Number", TopCount: 1).Tables[0]; }
  2928. //if (tbl.Rows.Count > 0)
  2929. //{
  2930. #region 刘工 2017-03-26 修改
  2931. LYFZ.BLL.BLL_ErpOrder.UpdateOrderNumberRecord(modelOrder.Ord_Number, strUserID,SDateTime.Now);
  2932. #endregion
  2933. /* string strUpdateNumber = modelOrder.Ord_Number;
  2934. if (tbl.Rows[0]["Ord_Number"].ToString().Trim() == modelOrder.Ord_Number)
  2935. { strUpdateNumber = tbl.Rows[0]["Ord_Number"].ToString().Trim(); }
  2936. DataTable tbl2 = ornrbll.GetList("Ornr_OrderDate = '" + Convert.ToDateTime(SDateTime.Now.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'").Tables[0];
  2937. LYFZ.Model.Model_ErpOrderNumberRecord modelrecotd = null;
  2938. if (tbl2.Rows.Count > 0)
  2939. {
  2940. modelrecotd = ornrbll.DataTableToList(tbl2)[0];
  2941. modelrecotd.Ornr_OrderCount = modelrecotd.Ornr_OrderCount + 1;
  2942. modelrecotd.Ornr_LastNumber = strUpdateNumber;
  2943. modelrecotd.Ornr_UpdateDateTime = strTime;
  2944. modelrecotd.Ornr_UpdateName = strUserID;
  2945. ornrbll.Update(modelrecotd);
  2946. }
  2947. else
  2948. {
  2949. modelrecotd = new Model.Model_ErpOrderNumberRecord();
  2950. modelrecotd.Ornr_LastNumber = strUpdateNumber;
  2951. modelrecotd.Ornr_OrderCount = 1;
  2952. modelrecotd.Ornr_CreateDateTime = strTime;
  2953. modelrecotd.Ornr_CreateName = strUserID;
  2954. ornrbll.Add(modelrecotd);
  2955. }*/
  2956. //MessageBoxCustom.Show("此订单号已被占用,请重新保存!"); return;
  2957. IsSaveedOK = false;
  2958. //}
  2959. //else
  2960. //{ IsSaveedOK = true; }
  2961. }
  2962. else
  2963. { IsSaveedOK = true; }
  2964. }
  2965. else
  2966. { IsSaveedOK = true; }
  2967. #endregion
  2968. if (IsSaveedOK)
  2969. {
  2970. #region 修改最后订单号的记录
  2971. /* if (modelOrder.ID <= 0)
  2972. {
  2973. LYFZ.Model.Model_ErpOrderNumberRecord modelNR = ornrbll.GetModel("Ornr_OrderDate", Convert.ToDateTime(strTime.ToString("yyyy-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss"));
  2974. if (modelNR.ID <= 0)
  2975. {
  2976. modelNR.Ornr_LastNumber = modelOrder.Ord_Number;
  2977. modelNR.Ornr_OrderCount = 1;
  2978. modelNR.Ornr_OrderDate = Convert.ToDateTime(strTime.ToString("yyyy-MM-dd"));
  2979. modelNR.Ornr_CreateDateTime = strTime;
  2980. modelNR.Ornr_CreateName = strUserID;
  2981. clist.Add(ornrbll.GetAddCommandInfo(modelNR));
  2982. }
  2983. else
  2984. {
  2985. modelNR.Ornr_LastNumber = modelOrder.Ord_Number;
  2986. modelNR.Ornr_OrderCount = modelNR.Ornr_OrderCount + 1;
  2987. modelNR.Ornr_UpdateDateTime = strTime;
  2988. modelNR.Ornr_UpdateName = strUserID;
  2989. clist.Add(ornrbll.GetUpdateCommandInfo(modelNR));
  2990. }
  2991. }*/
  2992. #endregion
  2993. if (MessageBoxCustom.Show("确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  2994. { return; }
  2995. //test(clist, StrNewOrderNumber);
  2996. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  2997. {
  2998. #region 刘工 2017-03-26 修改
  2999. if (modelOrder.ID <= 0)
  3000. {
  3001. LYFZ.BLL.BLL_ErpOrder.UpdateOrderNumberRecord(modelOrder.Ord_Number, strUserID, SDateTime.Now);
  3002. }
  3003. #endregion
  3004. if (IsOpenCardSendSMS)
  3005. { LYFZ.BLL.OrderPayment_Member.OpenMemberSendSMS(modelCilentMain.Cus_CustomerNumber, modelMc.Mc_CradNumber, StrStoreNumber: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID()); }
  3006. this.StrNumber = modelOrder.Ord_Number;
  3007. this.IsSaveed = true;
  3008. switch (this.OrdType)
  3009. {
  3010. case EnumPublic.OrderType.婚纱订单:
  3011. case EnumPublic.OrderType.儿童订单:
  3012. case EnumPublic.OrderType.写真订单:
  3013. case EnumPublic.OrderType.婚庆订单:
  3014. if (this.OrderEx != null)
  3015. { this.OrderEx.SetOrderValue(orbll.GetModel(modelOrder.Ord_Number)); }
  3016. break;
  3017. case EnumPublic.OrderType.服务订单:
  3018. if (this.ServiceOrderEx != null)
  3019. { this.ServiceOrderEx.SetOrderValue(orbll.GetModel(modelOrder.Ord_Number)); }
  3020. break;
  3021. }
  3022. this.IsUpdateOrderLoad = true;
  3023. //更新客户组成员表
  3024. if (string.IsNullOrEmpty(this.OrderGroupNumber))
  3025. { LYFZ.DAL.DAL_ErpCustomer.UpdateAggregationCustomer(this.StrNumber); }
  3026. else
  3027. { LYFZ.DAL.DAL_ErpCustomer.UpdateAggregationCustomer(this.OrderGroupNumber); }
  3028. if (modelOrder.Ord_Number.Trim().Length > 0)
  3029. { LYFZ.BLL.BLL_ErpOrderDigitalStatus.UpdateDigitalStatus(modelOrder.Ord_Number, LYFZ.EnumPublic.OrderDigitalStatusEnum.开单); }
  3030. #region 收款 并 积分
  3031. bool IsPayment = true;
  3032. if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OrdersReceivablesCompetence, LYFZ.CustomAttributes.OperatingAuthority.OrdersReceivables))
  3033. {
  3034. if (modelOrder.Ord_SeriesPrice > 0)
  3035. {
  3036. if (ptbll.GetRecordCount("Pay_OrdNumber = '" + modelOrder.Ord_Number + "'") <= 0)
  3037. {
  3038. LYFZ.Software.MainBusiness.FinancialManagement.OrdersReceivables.FrmPrePayment frm = new FinancialManagement.OrdersReceivables.FrmPrePayment();
  3039. //frm.StrOrdType = this.OrdType.ToString();
  3040. frm.StrOrdNumber = this.StrNumber;
  3041. //frm.StrCope = modelOrder.Ord_SeriesPrice;
  3042. frm.IsShowButtonPayment = true;
  3043. //frm.StrPaid = 0;
  3044. //frm.StrArrears = modelOrder.Ord_SeriesPrice;
  3045. frm.ShowDialog();
  3046. IsPayment = false;
  3047. }
  3048. }
  3049. }
  3050. #endregion
  3051. this.OpenSingleLoad();
  3052. if (IsPayment)
  3053. { MessageBoxCustom.Show("保存成功!"); }
  3054. }
  3055. else
  3056. { MessageBoxCustom.Show("保存失败!"); }
  3057. IsSaveedOK = true;
  3058. }
  3059. }
  3060. }
  3061. if (IsSaveedOK)
  3062. {
  3063. #region 流程短信
  3064. if (isAddOrder || IsIntentionOrder)
  3065. {
  3066. System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(delegate()
  3067. {
  3068. Model.SMSParameters sparameters = new Model.SMSParameters();
  3069. sparameters.OrderNumber = this.StrNumber;
  3070. try
  3071. { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.客人订单后X分钟, sparameters); }
  3072. catch { }
  3073. if (this.modelFriends != null)
  3074. {
  3075. if (this.OrderEx != null)
  3076. {
  3077. if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ReferralAmountPaidPoints)
  3078. {
  3079. sparameters = new Model.SMSParameters();
  3080. sparameters.CurrentSpendingMemberID = StrMainClientNumber;
  3081. sparameters.Referrals = modelFriends.Cus_CustomerNumber;
  3082. sparameters.ReferralsBonusPoints = LYFZ.BLL.BLL_ErpMemberCard.GetPoints_AgoPeriod(EnumPublic.MemberPointsType.txtReferral_RMB, OrderEx.TaoXiPrice, strInfoID, ClientNumber: modelFriends.Cus_CustomerNumber);
  3083. try
  3084. { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.转介绍后X分钟发送短信给介绍人, sparameters); }
  3085. catch { }
  3086. }
  3087. }
  3088. }
  3089. //客户名称:XXX 订单金额:OrderAmount 订单号:OrderNO 订单号(显示用):ShowOrderNO 订单时间:Time 套系名称:GroupName
  3090. try
  3091. {
  3092. DataTable dtShowNumber = orbll.GetView_Custom("tb_ErpOrder", StrWhere: "Ord_Number = '" + this.StrNumber + "'", ShowColumnName: "CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS 订单号").Tables[0];
  3093. dynamic tMParameters = new System.Dynamic.ExpandoObject();
  3094. tMParameters.OrderNO = this.StrNumber;
  3095. tMParameters.ShowOrderNO = dtShowNumber.Rows[0]["订单号"].ToString().Trim();
  3096. tMParameters.OrderAmount = this.OrderEx.TaoXiPrice.ToString("n2") + "元";
  3097. tMParameters.Time = strTime;
  3098. tMParameters.GroupName = StrSeriesName;
  3099. smsTemplates.GenerateEventTemplateMessage(EnumPublic.MicroSendEvent.客人订单后X分钟, tMParameters);
  3100. }
  3101. catch
  3102. { }
  3103. if (this.modelViceCard != null)
  3104. {
  3105. DataTable dt = orbll.GetView_Custom("tb_ErpMemberCard", StrWhere: "Mc_Number = '" + this.modelViceCard.Mvc_Number + "' And Mc_CradNumber != ''", ShowColumnName: "Mc_CustomerNumber,Mc_CradNumber").Tables[0];
  3106. if (dt.Rows.Count > 0)
  3107. {
  3108. if (this.modelViceCard.Mvc_ViceCardType == "返现副卡")
  3109. {
  3110. DataTable dtPackagesMoney = orbll.GetView_Custom("tb_ErpMemberCardBackCash", StrWhere: "Mcbc_Number = '" + this.modelViceCard.Mvc_Number + "'", ShowColumnName: "Mcbc_PackagesMoney").Tables[0];
  3111. if (dtPackagesMoney.Rows.Count > 0)
  3112. {
  3113. dec_OrderDiscounts = 1;
  3114. DataTable tbl = orbll.GetView_Custom("tb_ErpSystemConfigure", StrWhere: " Sconfig_Code = 'BackCashCoefficient'", ShowColumnName: "Sconfig_Value").Tables[0];
  3115. if (tbl.Rows.Count > 0)
  3116. { dec_OrderDiscounts = Convert.ToDecimal(tbl.Rows[0]["Sconfig_Value"].ToString().Trim()); }
  3117. else
  3118. {
  3119. LYFZ.Model.Model_ErpSystemConfigure model = new Model.Model_ErpSystemConfigure();
  3120. model.Sconfig_Code = "BackCashCoefficient";
  3121. model.Sconfig_Name = "返现系数";
  3122. model.Sconfig_Value = dec_OrderDiscounts.ToString().Trim();
  3123. model.Sconfig_IsEnabled = true;
  3124. model.Sconfig_Type = "";
  3125. model.Sconfig_Remark = "返现系数(实现返现范围)";
  3126. model.Sconfig_Order = 0;
  3127. model.Sconfig_CreateDatetime = SDateTime.Now;
  3128. model.Sconfig_CreateName = "";
  3129. sgbll.Add(model);
  3130. }
  3131. decimal decTaoXiPrice = Convert.ToDecimal(dtPackagesMoney.Rows[0]["Mcbc_PackagesMoney"]) * dec_OrderDiscounts;
  3132. if (decTaoXiPrice <= this.OrderEx.TaoXiPrice)
  3133. {
  3134. List<LYFZ.Model.Model_ErpMemberCardBackCashSet> mlistBackCashSet = mcbcsetbll.GetModelList("Mcb_Number = '" + modelViceCard.Mvc_Number + "' and (Mcb_ViceNumber = '' or Mcb_ViceNumber is NULL)");
  3135. if (mlistBackCashSet.Count > 0)
  3136. {
  3137. LYFZ.Model.Model_ErpMemberCardBackCashSet modelCardBack = mlistBackCashSet[0];
  3138. DataTable tblBackCash = orbll.GetView_Custom("tb_ErpMemberCardBackCashSet", StrWhere: "Mcb_Number = '" + modelViceCard.Mvc_Number + "' and Mcb_CashBackGroup = '" + modelViceCard.Mvc_CashBackGroup + "'", ShowColumnName: "Mcb_CashBackAmount,Mcb_IsSpending").Tables[0];
  3139. DataRow[] dtRow = tblBackCash.Select("Mcb_IsSpending = '0'");
  3140. decimal DecBackCashAmount = 0;
  3141. if (dtRow.Length == 1)
  3142. {
  3143. for (int i = 0; i < tbl.Rows.Count; i++)
  3144. {
  3145. if (tbl.Rows[i]["Mcb_IsSpending"].ToString().Trim() == "1")
  3146. {
  3147. if (tbl.Rows[i]["Mcb_CashBackAmount"].ToString().Trim() != "")
  3148. { DecBackCashAmount += Convert.ToDecimal(tbl.Rows[i]["Mcb_CashBackAmount"]); }
  3149. }
  3150. }
  3151. DecBackCashAmount = decTaoXiPrice - DecBackCashAmount;
  3152. }
  3153. else
  3154. { DecBackCashAmount = (modelCardBack.Mcb_Proportion / 100) * decTaoXiPrice; }
  3155. //XXX 为客户姓名;XXN 为会员卡号;TEXT 为获得返现金内容(如:本次某某朋友为您返现金5000元); XXT 为获得返现金时间
  3156. sparameters = new Model.SMSParameters();
  3157. sparameters.CurrentSpendingMemberID = dt.Rows[0]["Mc_CustomerNumber"].ToString().Trim();
  3158. sparameters.CardNumber = dt.Rows[0]["Mc_CradNumber"].ToString().Trim();
  3159. sparameters.XXT = strTime;
  3160. sparameters.TEXT = "您朋友持返现副卡" + this.modelViceCard.Mvc_ViceCardNumber + "来订单,获得返现" + DecBackCashAmount.ToString("0.00") + "元";
  3161. sparameters.ReferralsBonusPoints = 0;
  3162. try
  3163. { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.会员返现卡获得返现金后X分钟, sparameters); }
  3164. catch { }
  3165. }
  3166. }
  3167. }
  3168. }
  3169. else if (modelViceCard.Mvc_ViceCardType == "积分副卡")
  3170. {
  3171. DataTable dtAvailablePoints = orbll.GetView_Custom("tb_ErpMemberCardPoints", StrWhere: "Mcps_Number = '" + this.modelViceCard.Mvc_Number + "'", ShowColumnName: "Mcps_AvailablePoints").Tables[0];// mcpsbll.GetModel("Mcps_Number", modelMc.Mc_Number);
  3172. if (dtAvailablePoints.Rows.Count > 0)
  3173. {
  3174. //XXX 为客户姓名;XXN 为会员卡号;TEXT 为获得返现金内容(如:本次某某朋友为您返现金5000元); XXT 为获得返现金时间
  3175. int IntPointsIntr = LYFZ.BLL.BLL_ErpMemberCard.GetPoints_AgoPeriod(LYFZ.EnumPublic.MemberPointsType.txtReferral_RMB, this.OrderEx.TaoXiPrice, LYFZ.BLL.OrderPayment_Member.StrInfoID, StrMainClientNumber);
  3176. sparameters = new Model.SMSParameters();
  3177. sparameters.CurrentSpendingMemberID = dt.Rows[0]["Mc_CustomerNumber"].ToString().Trim();
  3178. sparameters.CardNumber = dt.Rows[0]["Mc_CradNumber"].ToString().Trim();
  3179. sparameters.XXT = strTime;
  3180. sparameters.TEXT = "您朋友持积分副卡" + this.modelViceCard.Mvc_ViceCardNumber + "来订单,获得" + IntPointsIntr + "积分";
  3181. sparameters.ReferralsBonusPoints = IntPointsIntr;
  3182. sparameters.AvailablePoints = Convert.ToInt32(dtAvailablePoints.Rows[0]["Mcps_AvailablePoints"]);
  3183. try
  3184. { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.当积分达到或超过X分时, sparameters); }
  3185. catch { }
  3186. try
  3187. { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.当积分接近X的百分之80时, sparameters); }
  3188. catch { }
  3189. try
  3190. {
  3191. if (!string.IsNullOrEmpty(sparameters.TEXT))
  3192. { smsTemplates.GenerateEventSMS(EnumPublic.SmsSendEvent.会员积分变动后X分钟, sparameters); }
  3193. }
  3194. catch { }
  3195. }
  3196. }
  3197. }
  3198. }
  3199. }));
  3200. t.Start();
  3201. }
  3202. #endregion
  3203. }
  3204. }
  3205. void test(List<Helper.CommandInfo> clist, string newOrderNumber)
  3206. {
  3207. foreach (Helper.CommandInfo commd in clist)
  3208. {
  3209. foreach (System.Data.SqlClient.SqlParameter Par in commd.Parameters)
  3210. {
  3211. if ("orderNuber,eddiid,iiii,dddd".Contains(Par.ParameterName))
  3212. {
  3213. Par.Value = newOrderNumber;
  3214. }
  3215. }
  3216. }
  3217. }
  3218. /// <summary>
  3219. /// 获取订单数码表的摄次数种子值
  3220. /// </summary>
  3221. /// <param name="dlist"></param>
  3222. /// <returns></returns>
  3223. int GetDigitalNumber(List<LYFZ.Model.Model_ErpOrderDigital> dlist)
  3224. {
  3225. int DigitalNumber = 0;
  3226. if (dlist != null && dlist.Count > 0)
  3227. {
  3228. DigitalNumber = Convert.ToInt32(dlist[dlist.Count - 1].Ordv_DigitalNumber);
  3229. while (ViceNumberEquals(dlist, DigitalNumber))
  3230. { DigitalNumber++; }
  3231. DigitalNumber--;
  3232. }
  3233. return DigitalNumber;
  3234. }
  3235. /// <summary>
  3236. /// 栓检查DigitalNumber是否存在
  3237. /// </summary>
  3238. /// <param name="dlist"></param>
  3239. /// <param name="DigitalNumber"></param>
  3240. /// <returns></returns>
  3241. bool ViceNumberEquals(List<LYFZ.Model.Model_ErpOrderDigital> dlist, int DigitalNumber)
  3242. {
  3243. bool bl = false;
  3244. if (dlist != null)
  3245. {
  3246. int tempMaxNumber = 0;
  3247. foreach (LYFZ.Model.Model_ErpOrderDigital modelDig in dlist)
  3248. {
  3249. string tempViceNumer = modelDig.Ordv_Number + "_" + LYFZ.Command.Command_Validate.GetBeforeAddZero(DigitalNumber, 3);
  3250. if (modelDig.Ordv_ViceNumber.Equals(tempViceNumer))
  3251. {
  3252. bl = true;
  3253. break;
  3254. }
  3255. else
  3256. {
  3257. int tempNu = 0;
  3258. try
  3259. { tempNu = Convert.ToInt32(modelDig.Ordv_ViceNumber.Split('_')[1]); }
  3260. catch
  3261. { tempNu = dlist.Count + modelDig.Ordv_DigitalNumber; }
  3262. if (tempNu > tempMaxNumber)
  3263. { tempMaxNumber = tempNu; }
  3264. }
  3265. }
  3266. if (tempMaxNumber >= DigitalNumber)
  3267. { bl = true; }
  3268. }
  3269. return bl;
  3270. }
  3271. /// <summary>
  3272. /// 打印
  3273. /// </summary>
  3274. /// <param name="sender"></param>
  3275. /// <param name="e"></param>
  3276. void btnPrint_Click(object sender, EventArgs e)
  3277. {
  3278. if (this.StrNumber.Trim() != "")
  3279. {
  3280. Hashtable htData = new Hashtable();
  3281. htData["strNumber"] = this.StrNumber.Trim();
  3282. htData["strOrdType"] = this.OrdType.ToString().Trim();
  3283. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(LYFZ.EnumPublic.PrintTypeEnum.订单预约单, htData);
  3284. }
  3285. }
  3286. /// <summary>
  3287. /// 新订单
  3288. /// </summary>
  3289. /// <param name="sender"></param>
  3290. /// <param name="e"></param>
  3291. void btnNewOrder_Click(object sender, EventArgs e)
  3292. {
  3293. if (MessageBoxCustom.Show("重置后将清空所有数据,您确定要重置订单吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  3294. {
  3295. this.IsGoForm = true;
  3296. this.EnumLoadFormType = LoadFormType.开单选择;
  3297. this.Close();
  3298. }
  3299. }
  3300. /// <summary>
  3301. /// 清空数据重置
  3302. /// </summary>
  3303. void ClearDataReset()
  3304. {
  3305. this.btnSaveIntent.Visible = true;
  3306. this.btnSaveIntent.Enabled = true;
  3307. this.StrNumber = "";
  3308. this.txtOrderPerson.Text = "";
  3309. this.txtOrderPerson.Tag = null;
  3310. this.mskMarriage.Text = "";
  3311. this.chkMarriage.Checked = false;
  3312. this.StyleSetAdd();
  3313. this.ClearClientSource();
  3314. this.mskMarriage.StrValue = "";
  3315. this.chkMarriage.Checked = false;
  3316. this.flowPanel2.Controls.Clear();
  3317. this.tabControl.SelectedIndex = 0;
  3318. this.tabControl.TabPages["tap2"].Tag = null;
  3319. this.lblYiXiangClient.Enabled = true;
  3320. this.IsUpdateOrderLoad = false;
  3321. this.IsSaveedHadAuthorized = false;
  3322. this.FillClientDataPanelHeight();
  3323. this.GetTransactmemberCard();
  3324. }
  3325. /// <summary>
  3326. /// 获取是否自动办理会员卡
  3327. /// </summary>
  3328. void GetTransactmemberCard()
  3329. {
  3330. this.panelTransactmemberCard.Visible = true;
  3331. this.chkTransactmemberCard.Checked = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.OrderAutoOpenMemberCard;
  3332. }
  3333. /// <summary>
  3334. /// 关闭
  3335. /// </summary>
  3336. /// <param name="sender"></param>
  3337. /// <param name="e"></param>
  3338. void btnOrderClose_Click(object sender, EventArgs e)
  3339. {
  3340. isClose = false;
  3341. if (!isClose)
  3342. {
  3343. if (MessageBoxCustom.Show("你确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  3344. { return; }
  3345. }
  3346. this.Close();
  3347. }
  3348. /// <summary>
  3349. /// 关闭窗体之前发生
  3350. /// </summary>
  3351. /// <param name="sender"></param>
  3352. /// <param name="e"></param>
  3353. void OnSingleFormMain_FormClosing(object sender, FormClosingEventArgs e)
  3354. {
  3355. if (!this.IsGoForm)
  3356. {
  3357. if (this.isClose)
  3358. {
  3359. if (MessageBoxCustom.Show("你确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
  3360. { e.Cancel = true; }
  3361. }
  3362. }
  3363. }
  3364. bool IsGoForm = false;
  3365. /// <summary>
  3366. /// 关闭窗体之后发生
  3367. /// </summary>
  3368. /// <param name="sender"></param>
  3369. /// <param name="e"></param>
  3370. void OnSingleFormMain_FormClosed(object sender, FormClosedEventArgs e)
  3371. {
  3372. if (this.IsGoForm)
  3373. {
  3374. this.Hide();
  3375. switch (this.EnumLoadFormType)
  3376. {
  3377. case LoadFormType.开单选择:
  3378. LYFZ.Software.MainBusiness.DoorCityProcess.OnSingleFirstFormMain frm = new OnSingleFirstFormMain();
  3379. frm.StartPosition = FormStartPosition.CenterScreen;
  3380. frm.Show();
  3381. break;
  3382. }
  3383. }
  3384. }
  3385. /// <summary>
  3386. /// 窗体大小 发生变化
  3387. /// </summary>
  3388. /// <param name="sender"></param>
  3389. /// <param name="e"></param>
  3390. void OnSingleFormMain_Resize(object sender, EventArgs e)
  3391. { this.FillClientDataPanelHeight(); }
  3392. #endregion
  3393. #region 第一页
  3394. #region 添加成年人客户控件
  3395. /// <summary>
  3396. /// 添加客户控件
  3397. /// </summary>
  3398. /// <param name="sender"></param>
  3399. /// <param name="e"></param>
  3400. void pictAddClient_Click(object sender, EventArgs e)
  3401. {
  3402. if (this.OrdType == EnumPublic.OrderType.婚纱订单)
  3403. {
  3404. if (this.AddClinetCount >= 2)
  3405. { MessageBoxCustom.Show("婚纱订单,添加客户最多只能" + this.AddClinetCount + "个!"); return; }
  3406. this.ClientAdultPanelAdd("其他联系人" + this.ClientAdultNameCount, IsPhoneSymbol: false);
  3407. }
  3408. else if (this.OrdType == EnumPublic.OrderType.儿童订单)
  3409. {
  3410. if (this.AddClinetCount >= 5)
  3411. { MessageBoxCustom.Show("儿童订单,添加客户最多只能" + this.AddClinetCount + "个!"); return; }
  3412. this.ClientAdultPanelAdd("其他联系人" + this.ClientAdultNameCount, IsShowRelation: true, lblRelation: "与宝贝关系:", IsPhoneSymbol: false);
  3413. }
  3414. else
  3415. {
  3416. if (this.AddClinetCount >= 5)
  3417. { MessageBoxCustom.Show("写真订单,添加客户最多只能" + this.AddClinetCount + "个!"); return; }
  3418. this.ClientAdultPanelAdd("其他联系人" + this.ClientAdultNameCount, IsPhoneSymbol: false);
  3419. }
  3420. this.AddClinetCount++;
  3421. }
  3422. /// <summary>
  3423. /// 客户成年人资料
  3424. /// </summary>
  3425. /// <param name="lblClentName">层标题名称</param>
  3426. /// <param name="PanelName">层Name</param>
  3427. /// <param name="IsShowRemove">是否显示移除按钮</param>
  3428. /// <param name="IsShowRelation">是否显示关系控件</param>
  3429. /// <param name="lblRelation">关系控件lable的名称</param>
  3430. void ClientAdultPanelAdd(string lblClentName = "", string PanelName = "Adult_", bool IsShowRemove = true, bool IsShowRelation = true, string lblRelation = "与客户关系:", LYFZ.Model.Model_ErpCustomer model = null, string MainClientRelation = "", bool IsPhoneSymbol = true)
  3431. {
  3432. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx Client = new SetCustomControls.OrderClientParentsControlsEx();
  3433. Client.IsUpdateOrderLoad = this.IsUpdateOrderLoad;
  3434. Client.Name = PanelName + ClientAdultNameCount;
  3435. Client.StrClientAttribute = PanelName;
  3436. Client.IsPictDeleteShow = IsShowRemove;
  3437. if (model != null)
  3438. {
  3439. Client.SetClientValue(model, true, MainClientRelation: MainClientRelation);
  3440. Client.IsPictResetShow = true;
  3441. Client.IsPictEditShow = true;
  3442. }
  3443. else
  3444. {
  3445. Client.IsPictEditShow = false;
  3446. Client.IsPictResetShow = false;
  3447. }
  3448. Client.LblClientName = lblClentName;
  3449. Client.IsShowRelation = IsShowRelation;
  3450. Client.LblRelationText = lblRelation;
  3451. Client.Location = new Point(this.panelAddClient.Location.X, this.panelAddClient.Location.Y + this.flowPanel1.Location.Y);
  3452. Client.IsExistClient += Client_IsExistClient;
  3453. Client.DeleteClick += Client_DeleteClick;
  3454. Client.RelationSet += Client_RelationSet;
  3455. Client.RegionSet += Client_RegionSet;
  3456. Client.PhoneLeave += Client_PhoneLeave;
  3457. Client.UpdateOrderGroup += Client_UpdateOrderGroup;
  3458. Client.isShowPhoneSymbol(IsPhoneSymbol);
  3459. this.flowPanel1.Controls.Add(Client);
  3460. this.ClientAdultNameCount++;
  3461. this.panelAddClient.Location = new Point(this.panelAddClient.Location.X, Client.Location.Y + Client.Height + 6);
  3462. if (this.flowPanel1.Height < (panelAddClient.Location.Y + panelAddClient.Height + Client.Height))
  3463. {
  3464. this.panelVice1.Height = this.panelVice1.Height + ((panelAddClient.Location.Y + (panelAddClient.Height * 2) + Client.Height) - this.flowPanel1.Height);
  3465. this.flowPanel1.Height = this.panelVice1.Height - this.flowPanel1.Location.Y;
  3466. }
  3467. this.panelAddClient.SendToBack();
  3468. this.PanelMain1_Click(this, null);
  3469. }
  3470. /// <summary>
  3471. /// 判断当前客户在其他资料是否存在,一个订单不能同时存在两个相同的客户
  3472. /// </summary>
  3473. /// <param name="StrControlsName"></param>
  3474. /// <param name="StrClientNumber"></param>
  3475. /// <returns></returns>
  3476. string Client_IsExistClient(string StrControlsName, string StrClientNumber)
  3477. {
  3478. foreach (Control control in this.flowPanel1.Controls)
  3479. {
  3480. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3481. {
  3482. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3483. if (tmp.Name.Trim() != StrControlsName.Trim())
  3484. {
  3485. if (tmp.modelCilent != null)
  3486. {
  3487. if (tmp.modelCilent.Cus_CustomerNumber.Trim() != "")
  3488. {
  3489. if (tmp.modelCilent.Cus_CustomerNumber.Trim() == StrClientNumber.Trim())
  3490. { return tmp.LblClientName.Trim(); }
  3491. }
  3492. }
  3493. }
  3494. }
  3495. }
  3496. return "";
  3497. }
  3498. /// <summary>
  3499. /// 移除客户控件
  3500. /// </summary>
  3501. void Client_DeleteClick(SetCustomControls.OrderClientParentsControlsEx senderEx)
  3502. {
  3503. if (this.modelOldClient != null)
  3504. {
  3505. if (senderEx.modelCilent != null)
  3506. {
  3507. if (this.modelOldClient.Cus_CustomerNumber == senderEx.modelCilent.Cus_CustomerNumber)
  3508. { this.modelOldClient = null; }
  3509. }
  3510. }
  3511. if ((this.flowPanel1.Height + this.flowPanel1.Location.Y - this.panelAddClient.Height) >= this.PanelMain1.Height)
  3512. {
  3513. this.panelVice1.Height = this.panelVice1.Height - senderEx.Height;
  3514. if (this.PanelMain1.Height > (this.panelVice1.Height + 6))
  3515. { this.panelVice1.Height = this.PanelMain1.Height - 6; }
  3516. this.flowPanel1.Height = this.panelVice1.Height - this.flowPanel1.Location.Y;
  3517. }
  3518. this.AddClinetCount--;
  3519. }
  3520. /// <summary>
  3521. /// 客户关系
  3522. /// </summary>
  3523. /// <param name="obj"></param>
  3524. void Client_RelationSet(object obj)
  3525. {
  3526. foreach (Control control in this.flowPanel1.Controls)
  3527. {
  3528. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3529. {
  3530. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3531. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("BFABDBAJBJCEBDJCJ", tmp.CmbtreevRelation);
  3532. }
  3533. }
  3534. }
  3535. /// <summary>
  3536. /// 客户地区设置
  3537. /// </summary>
  3538. /// <param name="obj"></param>
  3539. void Client_RegionSet(object obj)
  3540. {
  3541. foreach (Control control in this.flowPanel1.Controls)
  3542. {
  3543. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3544. {
  3545. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3546. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("AAAAAAC", tmp.CmbtreevRegion, true);
  3547. }
  3548. }
  3549. }
  3550. /// <summary>
  3551. /// 客户电话输入后离开事件,去检测是否有相同电话的
  3552. /// </summary>
  3553. /// <param name="objForm"></param>
  3554. void Client_PhoneLeave(object objForm)
  3555. {
  3556. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx ClientEx = (SetCustomControls.OrderClientParentsControlsEx)objForm;
  3557. foreach (Control control in this.flowPanel1.Controls)
  3558. {
  3559. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3560. {
  3561. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3562. if (!ClientEx.Equals(tmp))
  3563. {
  3564. if (ClientEx.StrClientPhone.Trim() != "" && tmp.StrClientPhone.Trim() != "")
  3565. {
  3566. if (ClientEx.StrClientPhone.Trim() == tmp.StrClientPhone.Trim())
  3567. { MessageBoxCustom.Show("'" + ClientEx.LblClientName.Trim() + "' 与 '" + tmp.LblClientName.Trim() + "' 的手机号码不能一样!"); ClientEx.StrClientPhone = ""; }
  3568. }
  3569. }
  3570. }
  3571. }
  3572. }
  3573. /// <summary>
  3574. /// 电话输入事件——模糊查询
  3575. /// </summary>
  3576. /// <param name="obj"></param>
  3577. /// <param name="senderEx"></param>
  3578. void Client_UpdateOrderGroup(object obj)
  3579. {
  3580. if (obj != null && obj.ToString().Trim().Length > 0)
  3581. {
  3582. string[] StrArray = obj.ToString().Trim().Split('|');
  3583. switch (StrArray[0].Trim())
  3584. {
  3585. case "ClientGroup":
  3586. this.OrderGroupNumber = StrArray[1].Trim();
  3587. break;
  3588. case "OrderNumber":
  3589. this.UpdateOrderIsUpdateClientData = true;
  3590. this.StrNumber = StrArray[1].Trim();
  3591. this.OpenSingleLoad();
  3592. this.UpdateOrderIsUpdateClientData = true;
  3593. break;
  3594. case "IntentClient":
  3595. string[] StrList = StrArray[1].Trim().Split(',');
  3596. this.UpdateOrderIsUpdateClientData = false;
  3597. this.SelectIntentClient(StrList[0].Trim(), StrList[1].Trim());
  3598. this.UpdateOrderIsUpdateClientData = true;
  3599. break;
  3600. }
  3601. }
  3602. }
  3603. #endregion
  3604. #region 添加儿童客户资料
  3605. /// <summary>
  3606. /// 添加儿童客户资料
  3607. /// </summary>
  3608. /// <param name="lbClentName"></param>
  3609. /// <param name="PanelName"></param>
  3610. /// <param name="IsShowRemove"></param>
  3611. void ClientChildPanelAdd(string lbClentName = "宝贝资料", string PanelName = "Child_", bool IsShowRemove = true)
  3612. {
  3613. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderClientChildrenControlsEx Children = new SetCustomControls.OrderClientChildrenControlsEx();
  3614. Children.IsUpdateOrderLoad = this.IsUpdateOrderLoad;
  3615. Children.Name = PanelName + ClientAdultNameCount;
  3616. Children.StrClientAttribute = PanelName;
  3617. Children.IsPictDeleteShow = IsShowRemove;
  3618. Children.LblClientName = lbClentName;
  3619. Children.Location = new Point(this.panelAddClient.Location.X, this.panelAddClient.Location.Y + this.flowPanel1.Location.Y);
  3620. Children.DeleteClick += Children_DeleteClick;
  3621. this.flowPanel1.Controls.Add(Children);
  3622. this.ClientChildNameCount++;
  3623. this.panelAddClient.Location = new Point(this.panelAddClient.Location.X, Children.Location.Y + Children.Height + 6);
  3624. if (this.flowPanel1.Height < (panelAddClient.Location.Y + panelAddClient.Height + Children.Height))
  3625. { this.panelVice1.Height += Children.Height; }
  3626. this.panelAddClient.SendToBack();
  3627. }
  3628. /// <summary>
  3629. /// 移除客户控件
  3630. /// </summary>
  3631. /// <param name="sender"></param>
  3632. /// <param name="e"></param>
  3633. void Children_DeleteClick(SetCustomControls.OrderClientChildrenControlsEx senderEx)
  3634. {
  3635. if (this.panelVice1.Height >= this.PanelMain1.Height)
  3636. { this.panelVice1.Height = this.panelVice1.Height - senderEx.Height; }
  3637. this.AddClinetCount--;
  3638. }
  3639. #endregion
  3640. #region 开单类型
  3641. /// <summary>
  3642. /// 开单类型选择
  3643. /// </summary>
  3644. /// <param name="sender"></param>
  3645. /// <param name="e"></param>
  3646. void chBox_Click()
  3647. {
  3648. List<SetCustomControls.OrderClientParentsControlsEx> ClistA = new List<SetCustomControls.OrderClientParentsControlsEx>();
  3649. List<SetCustomControls.OrderClientChildrenControlsEx> ClistB = new List<SetCustomControls.OrderClientChildrenControlsEx>();
  3650. foreach (Control control in this.flowPanel1.Controls)
  3651. {
  3652. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3653. {
  3654. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3655. ClistA.Add(tmp);
  3656. }
  3657. if (control is SetCustomControls.OrderClientChildrenControlsEx)
  3658. {
  3659. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  3660. ClistB.Add(tmp);
  3661. }
  3662. }
  3663. for (int i = 0; i < ClistA.Count; i++)
  3664. { this.flowPanel1.Controls.Remove(ClistA[i]); }
  3665. for (int i = 0; i < ClistB.Count; i++)
  3666. { this.flowPanel1.Controls.Remove(ClistB[i]); }
  3667. this.ClientAdultNameCount = 1;
  3668. this.ClientChildNameCount = 1;
  3669. this.AddClinetCount = 0;
  3670. this.AddClinetCount++;
  3671. this.panelMarriage.Visible = false;
  3672. switch (this.OrdType)
  3673. {
  3674. case EnumPublic.OrderType.婚纱订单:
  3675. this.panelHospitalClient.Visible = false;
  3676. this.panelMarriage.Visible = true;
  3677. this.ClientAdultPanelAdd("客户资料", PanelName: "Man_", IsShowRemove: false, IsShowRelation: false);
  3678. break;
  3679. case EnumPublic.OrderType.儿童订单:
  3680. this.AddClinetCount++;
  3681. this.panelHospitalClient.Visible = true;
  3682. this.ClientChildPanelAdd(IsShowRemove: false);
  3683. this.ClientAdultPanelAdd("家长资料", PanelName: "Man_", IsShowRemove: false, IsShowRelation: true, lblRelation: "与宝贝关系:");
  3684. break;
  3685. case EnumPublic.OrderType.写真订单:
  3686. this.panelHospitalClient.Visible = true;
  3687. this.ClientAdultPanelAdd("客户资料", PanelName: "Man_", IsShowRemove: false, IsShowRelation: false);
  3688. break;
  3689. case EnumPublic.OrderType.婚庆订单:
  3690. this.panelHospitalClient.Visible = false;
  3691. this.panelMarriage.Visible = true;
  3692. this.panelEx3.Visible = false;
  3693. this.ClientAdultPanelAdd("客户资料", PanelName: "Man_", IsShowRemove: false, IsShowRelation: false);
  3694. break;
  3695. case EnumPublic.OrderType.服务订单:
  3696. this.panelHospitalClient.Visible = true;
  3697. this.panelMarriage.Visible = true;
  3698. this.panelEx3.Visible = false;
  3699. this.ClientAdultPanelAdd("客户资料", PanelName: "Man_", IsShowRemove: false, IsShowRelation: false);
  3700. break;
  3701. }
  3702. if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() == LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 || LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() == LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版)
  3703. { this.pictAddClient.Visible = true; }
  3704. else
  3705. { this.panelHospitalClient.Visible = false; }
  3706. SetCustomControls.OrderClientParentsControlsEx frmClient = (SetCustomControls.OrderClientParentsControlsEx)flowPanel1.Controls["Man_1"];
  3707. if (this.modelOldClient != null)
  3708. {
  3709. frmClient.SetClientValue(this.modelOldClient, true);
  3710. frmClient.IsPictEditShow = true;
  3711. frmClient.IsPictResetShow = true;
  3712. }
  3713. else
  3714. {
  3715. frmClient.SetClientValue(null);
  3716. frmClient.IsPictEditShow = false;
  3717. frmClient.IsPictResetShow = false;
  3718. }
  3719. //this.CurrentClickCount = Convert.ToInt32(chk.Tag);
  3720. }
  3721. #endregion
  3722. #region 客户来源
  3723. /// <summary>
  3724. /// 客户来源设置
  3725. /// </summary>
  3726. /// <param name="sender"></param>
  3727. /// <param name="e"></param>
  3728. void btnSourceSet_Click(object sender, EventArgs e)
  3729. {
  3730. LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
  3731. frm.TypeName = "AAAAAAF";
  3732. frm.Version = "Version";
  3733. if (frm.ShowDialog() == DialogResult.OK)
  3734. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientSourec("AAAAAAF", this.cmbtreevClientSource, strHideFiled: "BFACBABGBGBJGDHIE,BFAFBCBADBDCABFDD,AAAAABT"); }
  3735. }
  3736. /// <summary>
  3737. /// 老客户
  3738. /// </summary>
  3739. /// <param name="sender"></param>
  3740. /// <param name="e"></param>
  3741. void chkOldClient_Click(object sender, EventArgs e)
  3742. {
  3743. if (string.IsNullOrEmpty(this.StrNumber))
  3744. {
  3745. if (!this.chkOldClient.Checked)
  3746. { return; }
  3747. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ClientGroupSelectSuperSmallForm frm = new SuperSmallForm.ClientGroupSelectSuperSmallForm();
  3748. frm.ShowDialog();
  3749. if (frm.IsSaveed)
  3750. {
  3751. #region
  3752. this.chBox_Click();
  3753. if (frm.mlist.Count > 0)
  3754. {
  3755. if (frm.mlist.Count == 1)
  3756. {
  3757. foreach (Control control in this.flowPanel1.Controls)
  3758. {
  3759. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3760. {
  3761. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3762. if (tmp.StrClientAttribute == "Man_")
  3763. {
  3764. tmp.SetClientValue(frm.mlist[0], true);
  3765. tmp.IsPictResetShow = true;
  3766. tmp.IsPictEditShow = true;
  3767. break;
  3768. }
  3769. }
  3770. else if (control is SetCustomControls.OrderClientChildrenControlsEx)
  3771. {
  3772. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  3773. if (frm.mlist[0].Cus_Telephone == "")
  3774. {
  3775. tmp.SetClientValue(frm.mlist[0], true);
  3776. tmp.IsPictResetShow = true;
  3777. tmp.IsPictEditShow = true;
  3778. break;
  3779. }
  3780. }
  3781. }
  3782. }
  3783. else
  3784. {
  3785. foreach (Control control in this.flowPanel1.Controls)
  3786. {
  3787. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3788. {
  3789. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3790. if (tmp.StrClientAttribute == "Man_")
  3791. {
  3792. for (int i = 0; i < frm.mlist.Count; i++)
  3793. {
  3794. if (frm.mlist[i].Cus_CustomerNumber == frm.htData["MainClientNumber"].ToString().Trim())
  3795. {
  3796. tmp.SetClientValue(frm.mlist[i], true);
  3797. tmp.IsPictResetShow = true;
  3798. tmp.IsPictEditShow = true;
  3799. frm.mlist.RemoveAt(i);
  3800. break;
  3801. }
  3802. }
  3803. }
  3804. else
  3805. {
  3806. for (int i = 0; i < frm.mlist.Count; i++)
  3807. {
  3808. if (frm.mlist[i].Cus_CustomerNumber != frm.htData["MainClientNumber"].ToString().Trim() && frm.mlist[i].Cus_Telephone.Trim() != "")
  3809. {
  3810. tmp.SetClientValue(frm.mlist[i], true);
  3811. tmp.IsPictResetShow = true;
  3812. tmp.IsPictEditShow = true;
  3813. frm.mlist.RemoveAt(i);
  3814. break;
  3815. }
  3816. }
  3817. }
  3818. }
  3819. else if (control is SetCustomControls.OrderClientChildrenControlsEx)
  3820. {
  3821. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  3822. for (int i = 0; i < frm.mlist.Count; i++)
  3823. {
  3824. if (frm.mlist[i].Cus_Telephone == "")
  3825. {
  3826. tmp.SetClientValue(frm.mlist[i], true);
  3827. tmp.IsPictResetShow = true;
  3828. tmp.IsPictEditShow = true;
  3829. frm.mlist.RemoveAt(i);
  3830. break;
  3831. }
  3832. }
  3833. }
  3834. }
  3835. if (frm.mlist.Count > 0)
  3836. {
  3837. for (int i = 0; i < frm.mlist.Count; i++)
  3838. {
  3839. ClientAdultPanelAdd("其他联系人" + ClientAdultNameCount, model: frm.mlist[i]);
  3840. this.AddClinetCount++;
  3841. }
  3842. }
  3843. }
  3844. if (frm.htData["Ord_Number"].ToString().Trim() == "")
  3845. { this.OrderGroupNumber = frm.htData["GP_CustomerGroupID"].ToString().Trim(); }
  3846. }
  3847. #endregion
  3848. }
  3849. this.chkFriends.Enabled = true;
  3850. }
  3851. this.chkOldClient.Checked = true;
  3852. this.chkOther.Checked = false;
  3853. this.chkFriends.Checked = false;
  3854. this.modelViceCard = null;
  3855. this.toolTip1.SetToolTip(this.chkFriends, "");
  3856. this.chkFriends.Text = this.chkFriends.Tag.ToString();
  3857. this.cmbtreevClientSource.Text = "";
  3858. this.cmbtreevClientSource.Tag = "";
  3859. this.cmbtreevClientSource.StrGetName = "";
  3860. this.cmbtreevClientSource.Enabled = false;
  3861. this.chkHospitalClient.Checked = false;
  3862. this.modelFriends = null;
  3863. this.ComeSingleLotNumber = "";
  3864. }
  3865. /// <summary>
  3866. /// 朋友介绍
  3867. /// </summary>
  3868. /// <param name="sender"></param>
  3869. /// <param name="e"></param>
  3870. void chkFriends_Click(object sender, EventArgs e)
  3871. {
  3872. if (!this.chkFriends.Checked)
  3873. {
  3874. this.chkFriends.Text = this.chkFriends.Tag.ToString();
  3875. return;
  3876. }
  3877. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.FriendIntroducedSuperSmallForm frm = new SuperSmallForm.FriendIntroducedSuperSmallForm();
  3878. frm.ShowDialog();
  3879. this.toolTip1.SetToolTip(this.chkFriends, "");
  3880. this.modelViceCard = null;
  3881. if (frm.IsSaveed)
  3882. {
  3883. this.StrReferralsClientPhone = frm.StrReferralsClientPhone;
  3884. this.StrReferralsMemberCardNumber = frm.StrReferralsMemberCardNumber;
  3885. string StrCardType = "";
  3886. string StrCardTypeShow = "";
  3887. DataTable dt = orbll.GetView_Custom("tb_ErpMemberCard", StrWhere: "Mc_CustomerNumber = '" + frm.model.Cus_CustomerNumber + "' And Mc_CradNumber != ''", ShowColumnName: "Mc_CardType").Tables[0];
  3888. if (dt.Rows.Count > 0)
  3889. {
  3890. StrCardType = ";主卡等级:" + dt.Rows[0]["Mc_CardType"].ToString().Trim();
  3891. if (dt.Rows[0]["Mc_CardType"].ToString().Trim() != "无")
  3892. { StrCardTypeShow = " - " + dt.Rows[0]["Mc_CardType"].ToString().Trim(); }
  3893. }
  3894. this.modelFriends = frm.model;
  3895. if (frm.modelVice != null)
  3896. {
  3897. this.chkFriends.Text = "朋友介绍(" + frm.model.Cus_Name + StrCardTypeShow + " - 副卡)";
  3898. this.modelViceCard = frm.modelVice;
  3899. this.toolTip1.SetToolTip(this.chkFriends, "朋友介绍(介绍人:" + frm.model.Cus_Name + StrCardType + ";副卡卡号:" + frm.modelVice.Mvc_ViceCardNumber + ")");
  3900. }
  3901. else
  3902. {
  3903. this.chkFriends.Text = "朋友介绍(" + frm.model.Cus_Name + StrCardTypeShow + ")";
  3904. this.toolTip1.SetToolTip(this.chkFriends, "朋友介绍(介绍人:" + frm.model.Cus_Name + StrCardType + ")");
  3905. }
  3906. }
  3907. else
  3908. {
  3909. this.chkFriends.Text = this.chkFriends.Tag.ToString();
  3910. this.modelFriends = null;
  3911. }
  3912. this.chkFriends.Checked = true;
  3913. this.chkOldClient.Checked = false;
  3914. this.chkOldClient.Enabled = true;
  3915. this.cmbtreevClientSource.Text = "";
  3916. this.cmbtreevClientSource.Tag = "";
  3917. this.cmbtreevClientSource.StrGetName = "";
  3918. this.ComeSingleLotNumber = "";
  3919. this.chkOther.Checked = false;
  3920. this.chkHospitalClient.Checked = false;
  3921. this.cmbtreevClientSource.Enabled = false;
  3922. }
  3923. /// <summary>
  3924. /// 医院跟踪客户
  3925. /// </summary>
  3926. /// <param name="sender"></param>
  3927. /// <param name="e"></param>
  3928. void chkHospitalClient_Click(object sender, EventArgs e)
  3929. {
  3930. if (!this.chkHospitalClient.Checked)
  3931. { return; }
  3932. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.SelectHospitalClientSuperSmallForm frm = new SuperSmallForm.SelectHospitalClientSuperSmallForm();
  3933. frm.ShowDialog();
  3934. if (frm.IsSaveed)
  3935. {
  3936. this.chBox_Click();
  3937. LYFZ.Model.Model_ErpHospitalClient model = frm.model;
  3938. this.ComeSingleLotNumber = model.Hct_Oddnumber;
  3939. foreach (Control control in this.flowPanel1.Controls)
  3940. {
  3941. if (control is SetCustomControls.OrderClientParentsControlsEx)
  3942. {
  3943. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  3944. if (tmp.StrClientAttribute == "Man_")
  3945. {
  3946. tmp.setHospitalClientValue(model);
  3947. tmp.IsPictResetShow = true;
  3948. tmp.IsPictEditShow = true;
  3949. }
  3950. }
  3951. else if (control is SetCustomControls.OrderClientChildrenControlsEx)
  3952. {
  3953. if (this.OrdType == EnumPublic.OrderType.儿童订单)
  3954. {
  3955. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  3956. tmp.setHospitalClientValue(model);
  3957. tmp.IsPictResetShow = true;
  3958. tmp.IsPictEditShow = true;
  3959. }
  3960. }
  3961. }
  3962. }
  3963. this.chkOldClient.Checked = false;
  3964. this.chkOldClient.Enabled = true;
  3965. this.cmbtreevClientSource.Text = "";
  3966. this.cmbtreevClientSource.Tag = "";
  3967. this.cmbtreevClientSource.StrGetName = "";
  3968. this.cmbtreevClientSource.Enabled = false;
  3969. this.chkOther.Checked = false;
  3970. this.chkFriends.Checked = false;
  3971. this.modelViceCard = null;
  3972. this.toolTip1.SetToolTip(this.chkFriends, "");
  3973. this.modelFriends = null;
  3974. this.chkFriends.Text = this.chkFriends.Tag.ToString();
  3975. }
  3976. /// <summary>
  3977. /// 其他
  3978. /// </summary>
  3979. /// <param name="sender"></param>
  3980. /// <param name="e"></param>
  3981. void chkOther_Click(object sender, EventArgs e)
  3982. {
  3983. if (this.chkOther.Checked)
  3984. {
  3985. this.chkOther.Checked = true;
  3986. this.cmbtreevClientSource.Enabled = true;
  3987. }
  3988. else
  3989. {
  3990. this.chkOther.Checked = false;
  3991. this.cmbtreevClientSource.Text = "";
  3992. this.cmbtreevClientSource.Tag = "";
  3993. this.cmbtreevClientSource.StrGetName = "";
  3994. this.cmbtreevClientSource.Enabled = false;
  3995. }
  3996. this.modelFriends = null;
  3997. this.chkFriends.Checked = false;
  3998. this.modelViceCard = null;
  3999. this.toolTip1.SetToolTip(this.chkFriends, "");
  4000. this.chkOldClient.Checked = false;
  4001. this.chkHospitalClient.Checked = false;
  4002. this.chkFriends.Enabled = true;
  4003. this.chkOldClient.Enabled = true;
  4004. this.chkFriends.Text = this.chkFriends.Tag.ToString();
  4005. this.ComeSingleLotNumber = "";
  4006. }
  4007. /// <summary>
  4008. /// 意向客户点击选择
  4009. /// </summary>
  4010. /// <param name="sender"></param>
  4011. /// <param name="e"></param>
  4012. void lblYiXiangClient_Click(object sender, EventArgs e)
  4013. {
  4014. LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrderSelectSuperSmallForm frm = new SuperSmallForm.OrderSelectSuperSmallForm();
  4015. frm.Text = "选择订单(双击选择)";
  4016. frm.ShowDialog();
  4017. if (frm.IsSaveed)
  4018. {
  4019. this.chkFriends.Checked = false;
  4020. this.chkOldClient.Checked = false;
  4021. this.chkFriends.Enabled = true;
  4022. this.chkOldClient.Enabled = true;
  4023. this.chkFriends.Text = this.chkFriends.Tag.ToString();
  4024. this.ComeSingleLotNumber = "";
  4025. this.modelOldClient = null;
  4026. this.SelectIntentClient(frm.SelectOrderNumber, frm.SelectClientGroupNumber);
  4027. }
  4028. }
  4029. /// <summary>
  4030. /// 选择意向订单或意向客户组
  4031. /// </summary>
  4032. /// <param name="SelectOrderNumber"></param>
  4033. /// <param name="SelectClientGroupNumber"></param>
  4034. void SelectIntentClient(string SelectOrderNumber, string SelectClientGroupNumber)
  4035. {
  4036. if (this.IsUpdateOrderLoad)
  4037. { return; }
  4038. if (!string.IsNullOrEmpty(SelectOrderNumber))
  4039. {
  4040. this.StrNumber = SelectOrderNumber;
  4041. this.OrderGroupNumber = SelectClientGroupNumber;
  4042. this.OpenSingleLoad();
  4043. }
  4044. else
  4045. {
  4046. DataTable tblGroup = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_CustomerGroupID = '" + SelectClientGroupNumber + "'", ShowColumnName: "GP_CustomerType").Tables[0];
  4047. this.OrdType = (LYFZ.EnumPublic.OrderType)Convert.ToInt32(tblGroup.Rows[0]["GP_CustomerType"]);
  4048. this.ClearDataReset();
  4049. this.OrderGroupNumber = SelectClientGroupNumber;
  4050. DataTable tbl = orbll.GetView_Custom("tb_ErpCustomerGroupMembers", StrWhere: "GM_CustomerGroupID = '" + this.OrderGroupNumber + "'", ShowColumnName: "GM_CustomerID,GM_Master,GM_ProtagonistCustomer,GM_RelatedPersonID").Tables[0];
  4051. if (tbl.Rows.Count > 0)
  4052. {
  4053. List<SetCustomControls.OrderClientParentsControlsEx> AdultList = new List<SetCustomControls.OrderClientParentsControlsEx>();
  4054. List<SetCustomControls.OrderClientChildrenControlsEx> ChildList = new List<SetCustomControls.OrderClientChildrenControlsEx>();
  4055. foreach (Control control in this.flowPanel1.Controls)
  4056. {
  4057. if (control is SetCustomControls.OrderClientParentsControlsEx)
  4058. {
  4059. SetCustomControls.OrderClientParentsControlsEx tmp = (SetCustomControls.OrderClientParentsControlsEx)control;
  4060. bool Isbl = true;
  4061. if (tbl.Rows.Count > 0)
  4062. {
  4063. if (tmp.StrClientAttribute == "Man_")
  4064. {
  4065. for (int i = 0; i < tbl.Rows.Count; i++)
  4066. {
  4067. if (tbl.Rows[i]["GM_Master"].ToString().Trim() == "1")
  4068. {
  4069. tmp.SetClientValue(ctbll.GetModel("Cus_CustomerNumber", tbl.Rows[i]["GM_CustomerID"].ToString().Trim()), true);
  4070. tmp.IsPictResetShow = true;
  4071. tmp.IsPictEditShow = true;
  4072. Isbl = false;
  4073. tbl.Rows.RemoveAt(i);
  4074. break;
  4075. }
  4076. }
  4077. }
  4078. else
  4079. {
  4080. for (int i = 0; i < tbl.Rows.Count; i++)
  4081. {
  4082. if (tbl.Rows[i]["GM_Master"].ToString().Trim() == "0" && tbl.Rows[i]["GM_ProtagonistCustomer"].ToString().Trim() == "1" && !tbl.Rows[i]["GM_CustomerID"].Equals(tbl.Rows[i]["GM_RelatedPersonID"]))
  4083. {
  4084. tmp.SetClientValue(ctbll.GetModel("Cus_CustomerNumber", tbl.Rows[i]["GM_CustomerID"].ToString().Trim()), true);
  4085. tmp.IsPictResetShow = true;
  4086. tmp.IsPictEditShow = true;
  4087. Isbl = false;
  4088. tbl.Rows.RemoveAt(i);
  4089. break;
  4090. }
  4091. }
  4092. }
  4093. }
  4094. if (Isbl)
  4095. { AdultList.Add(tmp); }
  4096. }
  4097. else if (control is SetCustomControls.OrderClientChildrenControlsEx)
  4098. {
  4099. SetCustomControls.OrderClientChildrenControlsEx tmp = (SetCustomControls.OrderClientChildrenControlsEx)control;
  4100. bool Isbl = true;
  4101. if (tbl.Rows.Count > 0)
  4102. {
  4103. for (int i = 0; i < tbl.Rows.Count; i++)
  4104. {
  4105. if (tbl.Rows[i]["GM_Master"].ToString().Trim() == "0" && tbl.Rows[i]["GM_ProtagonistCustomer"].ToString().Trim() == "1" && tbl.Rows[i]["GM_CustomerID"].Equals(tbl.Rows[i]["GM_RelatedPersonID"]))
  4106. {
  4107. tmp.SetClientValue(ctbll.GetModel("Cus_CustomerNumber", tbl.Rows[i]["GM_CustomerID"].ToString().Trim()), true);
  4108. tmp.IsPictResetShow = true;
  4109. tmp.IsPictEditShow = true;
  4110. Isbl = false;
  4111. tbl.Rows.RemoveAt(i);
  4112. break;
  4113. }
  4114. }
  4115. }
  4116. if (Isbl)
  4117. { ChildList.Add(tmp); }
  4118. }
  4119. }
  4120. //移除多余的客户组件
  4121. for (int i = 0; i < AdultList.Count; i++)
  4122. { this.flowPanel1.Controls.Remove(AdultList[i]); }
  4123. for (int i = 0; i < ChildList.Count; i++)
  4124. { this.flowPanel1.Controls.Remove(ChildList[i]); }
  4125. }
  4126. }
  4127. }
  4128. /// <summary>
  4129. /// 清空客户来源
  4130. /// </summary>
  4131. void ClearClientSource()
  4132. {
  4133. this.chkOldClient.Checked = false;
  4134. this.chkFriends.Checked = false;
  4135. this.chkFriends.Text = this.chkFriends.Tag.ToString();
  4136. this.chkOther.Checked = false;
  4137. this.cmbtreevClientSource.SetTextAndTag_ValueNull();
  4138. this.modelOldClient = null;
  4139. this.modelFriends = null;
  4140. this.OrderGroupNumber = "";
  4141. this.ComeSingleLotNumber = "";
  4142. }
  4143. /// <summary>
  4144. /// 获取客户来源
  4145. /// </summary>
  4146. /// <returns></returns>
  4147. private string GetClientSource()
  4148. {
  4149. string StrClientSource = "";
  4150. foreach (Control control in this.flowPanelClientSource.Controls)
  4151. {
  4152. foreach (Control control2 in control.Controls)
  4153. {
  4154. if (control2 is CheckBoxEx)
  4155. {
  4156. CheckBoxEx tmp = (CheckBoxEx)control2;
  4157. if (tmp.Checked)
  4158. {
  4159. if (tmp.Tag.ToString().Trim() == "其他")
  4160. { StrClientSource = this.cmbtreevClientSource.Text.Trim(); }
  4161. else
  4162. { StrClientSource = tmp.Tag.ToString().Trim(); }
  4163. }
  4164. }
  4165. }
  4166. }
  4167. return StrClientSource;
  4168. }
  4169. #endregion
  4170. #region 喜爱格调
  4171. /// <summary>
  4172. /// 喜爱格调设置
  4173. /// </summary>
  4174. /// <param name="sender"></param>
  4175. /// <param name="e"></param>
  4176. void btnStyleSet_Click(object sender, EventArgs e)
  4177. {
  4178. LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.StyleSetSmallForm frm = new SetSmallForm.StyleSetSmallForm();
  4179. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  4180. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  4181. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  4182. frm.ShowDialog();
  4183. if (frm.IsSaveed)
  4184. { this.StyleSetAdd(); }
  4185. }
  4186. /// <summary>
  4187. /// 添加Check控件
  4188. /// </summary>
  4189. private void StyleSetAdd()
  4190. {
  4191. List<CheckBoxEx> chklist = new List<CheckBoxEx>();
  4192. foreach (Control control in this.panelEx3.Controls)
  4193. {
  4194. if (control is CheckBoxEx)
  4195. {
  4196. CheckBoxEx tmp = (CheckBoxEx)control;
  4197. chklist.Add(tmp);
  4198. }
  4199. }
  4200. for (int i = 0; i < chklist.Count; i++)
  4201. { this.panelEx3.Controls.Remove(chklist[i]); }
  4202. DataTable tbl = stbll.GetAllList(" ID ASC").Tables[0];
  4203. if (tbl.Rows.Count > 0)
  4204. {
  4205. int StrTablIndex = 11;
  4206. int LocationY = this.lblStyle.Location.Y + this.lblStyle.Height + 11;
  4207. CheckBoxEx chBox = null;
  4208. int[] Str1 = { 0, 5, 10, 15 };
  4209. int[] Str2 = { 1, 6, 11, 16 };
  4210. int[] Str3 = { 2, 7, 12, 17 };
  4211. int[] Str4 = { 3, 8, 13, 18 };
  4212. int[] Str5 = { 4, 9, 14, 19 };
  4213. for (int i = 0; i < tbl.Rows.Count; i++)
  4214. {
  4215. chBox = new CheckBoxEx();
  4216. if (Array.IndexOf(Str1, i) != -1)
  4217. { chBox.Location = new Point(20, LocationY); }
  4218. else if (Array.IndexOf(Str2, i) != -1)
  4219. { chBox.Location = new Point(180, LocationY); }
  4220. else if (Array.IndexOf(Str3, i) != -1)
  4221. { chBox.Location = new Point(340, LocationY); }
  4222. else if (Array.IndexOf(Str4, i) != -1)
  4223. { chBox.Location = new Point(500, LocationY); }
  4224. else if (Array.IndexOf(Str5, i) != -1)
  4225. { chBox.Location = new Point(670, LocationY); LocationY += 25; }
  4226. chBox.Name = "chk_" + tbl.Rows[i]["ID"].ToString();
  4227. chBox.Text = tbl.Rows[i]["Style_Name"].ToString();
  4228. chBox.TabIndex = StrTablIndex;
  4229. StrTablIndex++;
  4230. this.panelEx3.Controls.Add(chBox);
  4231. }
  4232. }
  4233. }
  4234. /// <summary>
  4235. /// 获取喜爱格调
  4236. /// </summary>
  4237. /// <returns></returns>
  4238. private string GetStyle()
  4239. {
  4240. String strStyle = "";
  4241. foreach (Control control in this.panelEx3.Controls)//订单资料
  4242. {
  4243. if (control is CheckBoxEx)
  4244. {
  4245. CheckBoxEx tmp = (CheckBoxEx)control;
  4246. if (tmp.Checked)
  4247. { strStyle += tmp.Name.Trim() + "|"; }
  4248. }
  4249. }
  4250. return strStyle.TrimEnd('|');
  4251. }
  4252. /// <summary>
  4253. /// 获取喜爱格调
  4254. /// </summary>
  4255. /// <returns></returns>
  4256. private List<string> GetStyleList()
  4257. {
  4258. List<string> ListID = new List<string>();
  4259. foreach (Control control in this.panelEx3.Controls)//订单资料
  4260. {
  4261. if (control is CheckBoxEx)
  4262. {
  4263. CheckBoxEx tmp = (CheckBoxEx)control;
  4264. if (tmp.Checked)
  4265. {
  4266. string[] strArray = tmp.Name.Trim().Split('_');
  4267. ListID.Add(strArray[1].Trim());
  4268. }
  4269. }
  4270. }
  4271. return ListID;
  4272. }
  4273. /// <summary>
  4274. /// 喜爱风格—浏览选择
  4275. /// </summary>
  4276. /// <param name="sender"></param>
  4277. /// <param name="e"></param>
  4278. void lblBrowseSelect_Click(object sender, EventArgs e)
  4279. {
  4280. LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.StyleViewSmallForm frm = new SetSmallForm.StyleViewSmallForm();
  4281. frm.frmStyleViewVersion = SetSmallForm.StyleViewSmallForm.StyleViewVersion.风格浏览;
  4282. frm.OldSelectStyleList = GetStyleList();
  4283. frm.WindowState = FormWindowState.Maximized;
  4284. frm.ShowDialog();
  4285. if (frm.IsSaveed)
  4286. {
  4287. List<string> strList = frm.SelectStyleList;
  4288. foreach (Control control in this.panelEx3.Controls)//订单资料
  4289. {
  4290. if (control is CheckBoxEx)
  4291. {
  4292. CheckBoxEx tmp = (CheckBoxEx)control;
  4293. bool IsFind = false;
  4294. for (int i = 0; i < strList.Count; i++)
  4295. {
  4296. string[] strArray = tmp.Name.Trim().Split('_');
  4297. if (strArray[1].Trim() == strList[i].Trim())
  4298. {
  4299. IsFind = true;
  4300. tmp.Checked = true;
  4301. strList.RemoveAt(i);
  4302. break;
  4303. }
  4304. }
  4305. if (!IsFind)
  4306. { tmp.Checked = false; }
  4307. }
  4308. }
  4309. }
  4310. }
  4311. #endregion
  4312. #region 选择接单人员
  4313. /// <summary>
  4314. /// 选择接单人员
  4315. /// </summary>
  4316. /// <param name="sender"></param>
  4317. /// <param name="e"></param>
  4318. void btnSelectUser_Click(object sender, EventArgs e)
  4319. { new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses().txtOrdersPerson(this.txtOrderPerson); }
  4320. #endregion
  4321. #region 点击让滚动条获取焦点
  4322. /// <summary>
  4323. /// 点击让滚动条获取焦点
  4324. /// </summary>
  4325. /// <param name="sender"></param>
  4326. /// <param name="e"></param>
  4327. void panelEx3_Click(object sender, EventArgs e)
  4328. {
  4329. this.PanelMain1_Click(this, null);
  4330. }
  4331. /// <summary>
  4332. /// 点击让滚动条获取焦点
  4333. /// </summary>
  4334. /// <param name="sender"></param>
  4335. /// <param name="e"></param>
  4336. void panelEx2_Click(object sender, EventArgs e)
  4337. {
  4338. this.PanelMain1_Click(this, null);
  4339. }
  4340. /// <summary>
  4341. /// 点击让滚动条获取焦点
  4342. /// </summary>
  4343. /// <param name="sender"></param>
  4344. /// <param name="e"></param>
  4345. void panelVice1_Click(object sender, EventArgs e)
  4346. {
  4347. this.PanelMain1_Click(this, null);
  4348. }
  4349. /// <summary>
  4350. /// 点击让滚动条获取焦点
  4351. /// </summary>
  4352. /// <param name="sender"></param>
  4353. /// <param name="e"></param>
  4354. void PanelMain1_Click(object sender, EventArgs e)
  4355. {
  4356. this.PanelMain1.Focus();
  4357. }
  4358. #endregion
  4359. #endregion
  4360. #region 第二页
  4361. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderInfoOneControlsEx OrderEx = null;
  4362. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderInfoTwoControlsEx ServiceOrderEx = null;
  4363. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderProductControlsEx OrderProductEx = null;
  4364. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderServiceControlsEx OrderServiceEx = null;
  4365. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderStagesControlsEx OrderStagesEx = null;
  4366. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderSightsControlsEx OrderSightsEx = null;
  4367. LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderProcessModule_PaymentDetailsControlsEx OrderProcessesEx = null;
  4368. /// <summary>
  4369. /// 选项卡选择事件
  4370. /// </summary>
  4371. /// <param name="sender"></param>
  4372. /// <param name="e"></param>
  4373. void tabControl_SelectedIndexChanged(object sender, EventArgs e)
  4374. {
  4375. if (this.tabControl.SelectedTab.Name.Trim() == this.tabControl.TabPages["tap2"].Name.Trim())
  4376. {
  4377. if (this.tabControl.TabPages["tap2"].Tag == null)
  4378. {
  4379. int PanelVice2Height = 0;
  4380. Hashtable htData = new Hashtable();
  4381. htData["IsShowSinceOrderNumber"] = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsCustomOrderNumber();
  4382. htData["IsOrderNumber"] = "";
  4383. htData["StrPrefix"] = this.GetOrderCustomPrefix();
  4384. htData["StrOrderType"] = this.OrdType.ToString().Trim();
  4385. switch (this.OrdType)
  4386. {
  4387. case EnumPublic.OrderType.服务订单:
  4388. if (this.ServiceOrderEx == null)
  4389. {
  4390. this.ServiceOrderEx = new SetCustomControls.OrderInfoTwoControlsEx(htData);
  4391. this.flowPanel2.Controls.Add(this.ServiceOrderEx);
  4392. }
  4393. PanelVice2Height += this.ServiceOrderEx.Height;
  4394. break;
  4395. default:
  4396. if (this.OrderEx == null)
  4397. {
  4398. this.OrderEx = new SetCustomControls.OrderInfoOneControlsEx(htData);
  4399. switch (this.OrdType)
  4400. {
  4401. case EnumPublic.OrderType.婚庆订单:
  4402. this.OrderEx.IsHotelInfo = true;
  4403. break;
  4404. case EnumPublic.OrderType.儿童订单:
  4405. this.OrderEx.IsShowIntoRegisterAndIntoBottom = false;
  4406. break;
  4407. }
  4408. this.OrderEx.OrderTaoXiNodeMouseClick += OrderEx_OrderTaoXiNodeMouseClick;
  4409. this.flowPanel2.Controls.Add(this.OrderEx);
  4410. #region 权限
  4411. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderPackagesNameSet))
  4412. { this.OrderEx.IsShowTaoXiNameSet = false; }
  4413. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderClsssSet))
  4414. { this.OrderEx.IsOrderClsssSet = false; }
  4415. #endregion
  4416. }
  4417. PanelVice2Height += this.OrderEx.Height;
  4418. break;
  4419. }
  4420. switch (this.OrdType)
  4421. {
  4422. case EnumPublic.OrderType.婚纱订单:
  4423. case EnumPublic.OrderType.写真订单:
  4424. if (this.OrderSightsEx == null)
  4425. {
  4426. this.OrderSightsEx = new SetCustomControls.OrderSightsControlsEx();
  4427. this.flowPanel2.Controls.Add(this.OrderSightsEx);
  4428. #region 权限
  4429. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderSightsOrStageSet))
  4430. { this.OrderSightsEx.IsShowSightsSet = false; }
  4431. #endregion
  4432. }
  4433. this.OrderSightsEx.StrOrdNumber = this.StrNumber;
  4434. PanelVice2Height += this.OrderSightsEx.Height;
  4435. break;
  4436. case EnumPublic.OrderType.儿童订单:
  4437. if (this.OrderStagesEx == null)
  4438. {
  4439. this.OrderStagesEx = new SetCustomControls.OrderStagesControlsEx();
  4440. this.flowPanel2.Controls.Add(this.OrderStagesEx);
  4441. #region 权限
  4442. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderSightsOrStageSet))
  4443. { this.OrderStagesEx.IsShowStagesSet = false; }
  4444. #endregion
  4445. }
  4446. this.OrderStagesEx.StrOrdNumber = this.StrNumber;
  4447. PanelVice2Height += this.OrderStagesEx.Height;
  4448. break;
  4449. }
  4450. switch (this.OrdType)
  4451. {
  4452. case EnumPublic.OrderType.婚纱订单:
  4453. case EnumPublic.OrderType.儿童订单:
  4454. case EnumPublic.OrderType.婚庆订单:
  4455. case EnumPublic.OrderType.写真订单:
  4456. case EnumPublic.OrderType.服务订单:
  4457. if (this.OrderProductEx == null)
  4458. {
  4459. this.OrderProductEx = new SetCustomControls.OrderProductControlsEx();
  4460. this.OrderProductEx.OrdType = this.OrdType;
  4461. this.flowPanel2.Controls.Add(this.OrderProductEx);
  4462. if (this.OrderStagesEx != null)
  4463. { this.OrderStagesEx.OrderProductEx = this.OrderProductEx; }
  4464. }
  4465. this.OrderProductEx.StrNumber = this.StrNumber;
  4466. PanelVice2Height += this.OrderProductEx.Height;
  4467. break;
  4468. }
  4469. if (this.OrderServiceEx == null)
  4470. {
  4471. this.OrderServiceEx = new SetCustomControls.OrderServiceControlsEx();
  4472. this.OrderServiceEx.OrdType = this.OrdType;
  4473. this.flowPanel2.Controls.Add(this.OrderServiceEx);
  4474. if (this.OrderStagesEx != null)
  4475. { this.OrderStagesEx.OrderServiceEx = this.OrderServiceEx; }
  4476. }
  4477. PanelVice2Height += this.OrderServiceEx.Height;
  4478. this.panelVice2.Height = PanelVice2Height + 40;
  4479. }
  4480. this.PanelClick(this.panelVice2, 2);
  4481. this.PanelMain2_Click(this, null);
  4482. }
  4483. else
  4484. {
  4485. if (this.tap3.Parent != null)
  4486. {
  4487. if (this.tabControl.SelectedTab.Name.Trim() == this.tabControl.TabPages["tap3"].Name.Trim())
  4488. {
  4489. if (this.OrderProcessesEx == null)
  4490. {
  4491. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  4492. {
  4493. try
  4494. {
  4495. this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
  4496. {
  4497. this.OrderProcessesEx = new SetCustomControls.OrderProcessModule_PaymentDetailsControlsEx(this.StrNumber, Convert.ToInt32(this.OrdType).ToString());
  4498. //this.OrderProcessesEx.Dock = DockStyle.Fill;
  4499. this.panelVice3.Controls.Add(this.OrderProcessesEx);
  4500. if (this.panelVice3.Height < this.OrderProcessesEx.Height)
  4501. { this.panelVice3.Height = this.OrderProcessesEx.Height; }
  4502. //else
  4503. //{ this.panelVice3.Height = this.PanelMain3.Height; }
  4504. this.PanelClick(this.panelVice3, 3);
  4505. this.PanelMain3_Click(this, null);
  4506. }));
  4507. }
  4508. catch
  4509. { }
  4510. });
  4511. }
  4512. }
  4513. }
  4514. }
  4515. }
  4516. /// <summary>
  4517. ///
  4518. /// </summary>
  4519. /// <param name="Panelcontrol"></param>
  4520. void PanelClick(Control Panelcontrol, int LoadType)
  4521. {
  4522. if (Panelcontrol.Controls.Count > 0)
  4523. {
  4524. foreach (Control control in Panelcontrol.Controls)
  4525. {
  4526. if (control is LYFZ.ComponentLibrary.PanelEx || control is UserControl || control is FlowLayoutPanel)
  4527. {
  4528. if (LoadType == 2)
  4529. { control.Click += PanelMain2_Click; }
  4530. else if (LoadType == 3)
  4531. { control.Click += PanelMain3_Click; }
  4532. if (control.Controls.Count > 0)
  4533. {
  4534. this.PanelClick(control, LoadType);
  4535. }
  4536. }
  4537. }
  4538. }
  4539. }
  4540. /// <summary>
  4541. /// 点击让滚动条获取焦点
  4542. /// </summary>
  4543. /// <param name="sender"></param>
  4544. /// <param name="e"></param>
  4545. void PanelMain2_Click(object sender, EventArgs e)
  4546. { this.PanelMain2.Focus(); }
  4547. /// <summary>
  4548. /// 点击让滚动条获取焦点
  4549. /// </summary>
  4550. /// <param name="sender"></param>
  4551. /// <param name="e"></param>
  4552. void PanelMain3_Click(object sender, EventArgs e)
  4553. {
  4554. this.PanelMain3.Focus();
  4555. }
  4556. /// <summary>
  4557. /// 套系选择
  4558. /// </summary>
  4559. /// <param name="objTaoXiNameTag">套系编号</param>
  4560. /// <param name="IsActivity">是否可以操作</param>
  4561. /// <param name="PackagesType">类型,判断是礼包还是套系</param>
  4562. /// <param name="dtPackages">礼包几选几数据</param>
  4563. void OrderEx_OrderTaoXiNodeMouseClick(object objTaoXiNameTag, bool IsActivity, LYFZ.EnumPublic.EnumPackagesType PackagesType, Hashtable htData)
  4564. {
  4565. if (objTaoXiNameTag != null)
  4566. {
  4567. string StrWhere = " And Pgm_PackagesCode = '" + objTaoXiNameTag.ToString().Trim() + "'";
  4568. if (htData.ContainsKey("OptionalSeveral") && htData["OptionalSeveral"].ToString().Trim().Length > 0 && Convert.ToInt32(htData["OptionalSeveral"]) >= 0)
  4569. {
  4570. LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ToolboxPackageListViewSamllForm frm = new SetSmallForm.ToolboxPackageListViewSamllForm();
  4571. frm.intOptionalSeveral = Convert.ToInt32(htData["OptionalSeveral"]);
  4572. frm.StrPackageCode = objTaoXiNameTag.ToString().Trim();
  4573. frm.StrOrderType = this.OrdType;
  4574. frm.ShowDialog();
  4575. if (frm.IsSaveed)
  4576. {
  4577. List<int> listID = frm.listID;
  4578. string StrIDing = "";
  4579. for (int i = 0; i < listID.Count; i++)
  4580. { StrIDing += listID[i].ToString().Trim() + ","; }
  4581. if (!string.IsNullOrEmpty(StrIDing))
  4582. { StrWhere = " And tb_ErpPackagesGiftMerchandise.ID in (" + StrIDing.TrimEnd(',') + ")"; }
  4583. }
  4584. else
  4585. { OrderEx.RemovePackageItem(); return; }
  4586. }
  4587. string strMagess = "";
  4588. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  4589. {
  4590. if (!string.IsNullOrEmpty(objTaoXiNameTag.ToString().Trim()))
  4591. {
  4592. string StrSource = "'' AS TaoXiNameSource,";
  4593. if (PackagesType == EnumPublic.EnumPackagesType.AAAAACA)
  4594. { StrSource = "'礼包' AS TaoXiNameSource,"; }
  4595. string ExecuteSql = "select tb_ErpTheScenery.ID," + StrSource + "tb_ErpPackagesGiftMerchandise.ID AS PgmID,Tsc_Rating,Sc_ClassName,Tcs_Category,case when Tcs_Category = 0 then '内景' else '外景' end AS Tcs_CategoryText,Tsc_CostPrice,Tsc_SalesPrice,Tsc_Remark,Pgm_ProductName,Pgm_GiveType," +
  4596. "Pgm_IntoRegisterQuantity,Pgm_IntoBottomQuantity,Pgm_Quantity from tb_ErpPackagesGiftMerchandise Left Join tb_ErpTheScenery on cast(tb_ErpTheScenery.ID as varchar(20)) = Pgm_ProductNumber " +
  4597. "Left Join tb_ErpSystemCategory on Tsc_Rating = Sc_ClassCode where Pgm_GiveType in ('2','3') " + StrWhere + ";";
  4598. ExecuteSql += "select Prod_Number," + StrSource + "tb_ErpPackagesGiftMerchandise.ID AS PgmID,Pgm_ProductNumber,Prod_Name,Prod_Batch,Prod_CostPrice,Prod_SalesPrice,Prod_Class,Prod_Unit,Prod_Thumbnail,Pgm_ProductNumber,Pgm_ProductName,Pgm_IntoRegisterQuantity,Pgm_IntoBottomQuantity,Pgm_GiveType," +
  4599. "Pgm_Quantity,Pgm_GiveType,Pgm_ProductGroupName from tb_ErpPackagesGiftMerchandise Left Join tb_ErpProduct on Prod_Number = Pgm_ProductNumber where Pgm_GiveType in ('0','1') " + StrWhere + ";";
  4600. DataSet dsData = orbll.GetView_Custom(ExecuteSql);
  4601. DataTable dtSights = dsData.Tables["ds"];
  4602. DataTable dtProduct = dsData.Tables["ds1"];
  4603. try
  4604. {
  4605. this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
  4606. {
  4607. if (this.OrderSightsEx != null)
  4608. {
  4609. DataRow[] dtRow = dtSights.Select("Pgm_GiveType = '2'");
  4610. strMagess += this.OrderSightsEx.SetOrderSightsValue(dtRow, IsActivity, PackagesType);
  4611. }
  4612. if (this.OrderStagesEx != null)
  4613. {
  4614. DataRow[] dtRow = dtSights.Select("Pgm_GiveType = '3'");
  4615. strMagess += this.OrderStagesEx.SetOrderStagesValue(dtRow, IsActivity, PackagesType);
  4616. }
  4617. if (this.OrderServiceEx != null)
  4618. {
  4619. DataRow[] dtRow = dtProduct.Select("Pgm_GiveType = '1'");
  4620. strMagess += this.OrderServiceEx.SetOrderServiceValue(dtRow, IsActivity, PackagesType);
  4621. }
  4622. if (this.OrderProductEx != null)
  4623. {
  4624. DataRow[] dtRow = dtProduct.Select("Pgm_GiveType = '0'");
  4625. strMagess += this.OrderProductEx.SetOrderProductValue(dtRow, IsActivity, PackagesType);
  4626. }
  4627. }));
  4628. }
  4629. catch { }
  4630. }
  4631. else if (PackagesType == EnumPublic.EnumPackagesType.AAAAACA)
  4632. {
  4633. this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
  4634. {
  4635. if (this.OrderSightsEx != null)
  4636. {
  4637. try
  4638. { this.OrderSightsEx.RemovePackageItem(); }
  4639. catch { }
  4640. }
  4641. if (this.OrderStagesEx != null)
  4642. {
  4643. try
  4644. { this.OrderStagesEx.RemovePackageItem(); }
  4645. catch { }
  4646. }
  4647. if (this.OrderServiceEx != null)
  4648. {
  4649. try
  4650. { this.OrderServiceEx.RemovePackageItem(); }
  4651. catch { }
  4652. }
  4653. if (this.OrderProductEx != null)
  4654. {
  4655. try
  4656. { this.OrderProductEx.RemovePackageItem(); }
  4657. catch { }
  4658. }
  4659. }));
  4660. }
  4661. });
  4662. if (strMagess.Trim() != "")
  4663. { MessageBoxCustom.Show(strMagess); }
  4664. }
  4665. }
  4666. #endregion
  4667. }
  4668. }