123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611 |
- Imports System.Data.SqlClient
-
- Imports OfficeOpenXml
- Imports System.Net
- Imports Microsoft.Office.Interop
- Imports System.Windows.Media
- Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
- Imports Microsoft.Office.Interop.Excel.Constants
- Imports Microsoft.Office.Interop.Excel.XlBordersIndex
- Imports Microsoft.Office.Interop.Excel.XlLineStyle
- Imports Microsoft.Office.Interop.Excel.XlBorderWeight
- Imports Microsoft.Office.Interop.Excel.XlPrintLocation
- Imports Microsoft.Office.Interop.Excel.XlPageOrientation
- Imports Microsoft.Office.Interop.Excel.XlPaperSize
- Imports Microsoft.Office.Interop.Excel.XlOrder
- Imports Microsoft.Office.Interop.Excel.XlPrintErrors
- 'Imports Excel = Microsoft.Office.Interop.Excel
- Imports Microsoft.Office.Core
- Imports Microsoft.Office.Interop.Excel.XlThemeColor
- Imports Microsoft.Office.Interop.Excel.XlThemeFont
-
-
- Public Class Frm_Ship_daily_1
- Dim cmd As New SqlCommand
- Dim da As New SqlDataAdapter
- Dim my_year111 As Integer
- Dim my_month111 As Integer
- Dim mysplit() As String
- Dim sql As String
- 'Dim my_year As Integer
- Dim dt1 As New DataTable
-
- Dim conn As New SqlConnection
- Dim xlApp As Microsoft.Office.Interop.Excel.Application
- Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
- Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
- Dim xlRange As Microsoft.Office.Interop.Excel.Range
- Dim PTCache As Microsoft.Office.Interop.Excel.PivotCache
- Dim PT As Microsoft.Office.Interop.Excel.PivotTable
-
-
- Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
- Dim xlApp As Microsoft.Office.Interop.Excel.Application
- Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
- Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
-
- Dim name(1000) As String
- Dim no(1000) As String
- Dim SERIAL(1000) As String
- Dim YEAR1(1000) As String
- Dim MONTH1(1000) As String
- Dim DATE1(1000) As String
- Dim COMMENT(1000) As String
- Dim qty(1000) As Double
- Dim QTY1(1000) As Double
- Dim po_no(1000) As String
- Dim sku_no(1000) As String
- Dim nw(1000) As Double
- Dim gw(1000) As Double
- Dim price(1000) As Double
-
-
- Dim dt As New DataTable
- Dim file_name As String = ""
- Dim file_name1 As String = ""
-
-
- ListBox1.Items.Clear()
-
- Dim my_weight As Double = 0
-
-
-
- Dim a As Integer = 0
- Dim my_count As Integer = 0
- 'OpenFileDialog1.Multiselect = True
- If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
-
- file_name = OpenFileDialog1.FileName
- file_name1 = OpenFileDialog1.SafeFileName
- Else
- Exit Sub
-
- End If
-
-
- Dim yy As Integer = 0
-
-
-
-
- ListBox1.Items.Add(file_name)
-
-
- Dim my_customer As String = ""
-
- If OpenFileDialog1.SafeFileName Like "*上杰*" And OpenFileDialog1.SafeFileName Like "越南*" Then '---------------------------------------上杰越南货柜
-
- Dim s1 As Integer = 1
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
- my_weight = 0
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
- xlSheet.Activate()
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 14 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A14:N" & y - 1).Select()
-
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- For y = 14 To y - 1
- If IsNumeric(xlSheet.Cells(y, 10).value) Then
- If xlSheet.Cells(13, 4).value = "张数" Then
- sql = "insert into rt_ship_temp_1 (order_item,serial,filename,name,qty,card,po_no,work_no) values(N'" & xlSheet.Cells(y, 9).value & "',N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",'" & xlSheet.Cells(y, 6).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 12).value & "')"
- ElseIf xlSheet.Cells(13, 9).value = "张数" Or xlSheet.Cells(13, 10).value = "张数" Then
- sql = "insert into rt_ship_temp_1 (order_item,serial,filename,name,qty,card,po_no,work_no) values(N'" & xlSheet.Cells(y, 8).value & "',N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",'" & xlSheet.Cells(y, 5).value & "',N'" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 12).value & "')"
- ElseIf xlSheet.Cells(13, 7).value = "张数" Then
- sql = "insert into rt_ship_temp_1 (order_item,serial,filename,name,qty,card,po_no,work_no) values(N'" & xlSheet.Cells(y, 9).value & "',N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 12).value & "')"
- ElseIf xlSheet.Cells(13, 5).value = "张数" Then
- sql = "insert into rt_ship_temp_1 (order_item,serial,filename,name,qty,card,po_no,work_no) values(N'" & xlSheet.Cells(y, 8).value & "',N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 10).value & ",'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 12).value & "')"
- ElseIf xlSheet.Cells(13, 6).value = "张数" Then
- sql = "insert into rt_ship_temp_1 (order_item,serial,filename,name,qty,card,po_no,work_no) values(N'" & xlSheet.Cells(y, 8).value & "',N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 10).value & ",'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 12).value & "')"
-
- End If
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- s1 = s1 + 1
-
- Else
-
-
- End If
-
-
-
-
-
-
-
- Next
-
-
-
-
- sql = "SELECT * FROM rt_ship_daily_sj_vn " '--------------------------改颜色
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- For x As Integer = 0 To dt.Rows.Count - 1
-
- mysplit = Split(dt.Rows(x).Item("name"), ",")
-
-
- If UBound(mysplit) = 0 Then
- mysplit = Split(dt.Rows(x).Item("name"), ",")
- End If
-
- If UBound(mysplit) >= 1 Then
-
- sql = "update rt_ship_temp_1 set color=N'" & mysplit(UBound(mysplit)) & "' where po_no='" & dt.Rows(x).Item("po_no") & "' and name=N'" & dt.Rows(x).Item("name") & "' and work_no='" & dt.Rows(x).Item("work_no") & "' and no='" & dt.Rows(x).Item("no") & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- Else
-
- sql = "update rt_ship_temp_1 set color=N'" & mysplit(UBound(mysplit)) & "' where po_no='" & dt.Rows(x).Item("po_no") & "' and name=N'" & dt.Rows(x).Item("name") & "' and work_no='" & dt.Rows(x).Item("work_no") & "' and no='" & dt.Rows(x).Item("no") & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- End If
-
-
-
-
- Next
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "加和样品*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 3 To y - 1
-
-
- If y = 3 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- thick = xlSheet.Cells(y, 6).value
-
- my_po = xlSheet.Cells(y, 4).value
-
-
-
- End If
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
- If Not (xlSheet.Cells(y, 2).value Is Nothing) Then
-
-
- If xlSheet.Cells(y, 4).value Is Nothing Then
-
-
- Else
- my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- thick = xlSheet.Cells(y, 6).value
- my_po = xlSheet.Cells(y, 4).value
-
-
- End If
-
-
-
-
-
- End If
-
-
- If my_comment Is Nothing Then
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
- Else
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment.ToString.Replace("'", "''") & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
-
- End If
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "名志样品*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 3 To y - 1
-
-
- If y = 3 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- thick = xlSheet.Cells(y, 6).value
-
- my_po = xlSheet.Cells(y, 4).value
-
-
-
- End If
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
- If Not (xlSheet.Cells(y, 2).value Is Nothing) Then
-
-
- If xlSheet.Cells(y, 4).value Is Nothing Then
-
-
- Else
- my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- thick = xlSheet.Cells(y, 6).value
- my_po = xlSheet.Cells(y, 4).value
-
-
- End If
-
-
-
-
-
- End If
-
-
- If my_comment Is Nothing Then
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
- Else
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment.ToString.Replace("'", "''") & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
-
- End If
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "瑞泰出货明细*" And (OpenFileDialog1.SafeFileName Like "*温州*" Or OpenFileDialog1.SafeFileName Like "*湖北*" Or OpenFileDialog1.SafeFileName Like "*泉州*") Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Not (IsNumeric(xlSheet.Cells(y, 6).value)) Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 3 To y - 1
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
-
-
- Else
-
-
- my_no = xlSheet.Cells(y, 2).value
-
- 'my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 4).value
- 'thick = xlSheet.Cells(y, 6).value
-
- my_po = xlSheet.Cells(y, 2).value
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & "',N'" & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 6).value & "')"
-
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- End If
-
-
-
-
-
- Next
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "名扬发货明细*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 2 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If IsDBNull(xlSheet.Cells(y, 2).value) Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 2 To y - 1
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
-
-
- Else
-
-
- my_no = xlSheet.Cells(y, 1).value
-
- 'my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 2).value
- 'thick = xlSheet.Cells(y, 6).value
-
- my_po = xlSheet.Cells(y, 8).value
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "',N'" & my_color & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 3).value & "')"
-
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- End If
-
-
-
-
-
- Next
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*上杰*" And Not (OpenFileDialog1.SafeFileName Like "*越南*") Then '----------------------------------------------------------------------------------上杰
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A14:N" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 14 To y - 1
-
-
- 'If y = 14 Then
- ' my_nw = xlSheet.Cells(y, 6).value
- ' my_gw = xlSheet.Cells(y, 7).value
- ' my_no = xlSheet.Cells(y, 1).value
- 'End If
-
- If xlSheet.Cells(13, 11).value = "订单出货数量" Then
-
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
-
- If xlSheet.Cells(y, 18).value Is Nothing Then
-
- sql = "insert into rt_ship_temp_1 (work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- (N'" & xlSheet.Cells(y, 13).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 11).value & ")"
-
- Else
- sql = "insert into rt_ship_temp_1 (comment,work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- (N'" & xlSheet.Cells(y, 18).value & "','" & xlSheet.Cells(y, 13).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 11).value & ")"
-
- End If
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- End If
-
- ElseIf xlSheet.Cells(13, 10).value = "订单出货数量" Then
-
- If xlSheet.Cells(y, 10).value Is Nothing Then
- Else
-
-
- If xlSheet.Cells(y, 18).value Is Nothing Then
-
- sql = "insert into rt_ship_temp_1 (work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- (N'" & xlSheet.Cells(y, 13).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 10).value & ")"
-
- Else
- sql = "insert into rt_ship_temp_1 (comment,work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- (N'" & xlSheet.Cells(y, 18).value.ToString.Replace("'", " ") & "','" & xlSheet.Cells(y, 13).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 10).value & ")"
-
- End If
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
- End If
-
- ElseIf xlSheet.Cells(13, 9).value = "订单出货数量" Then
-
- If xlSheet.Cells(y, 9).value Is Nothing Then
- Else
-
-
- If xlSheet.Cells(y, 19).value Is Nothing Then
-
- sql = "insert into rt_ship_temp_1 (work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- (N'" & xlSheet.Cells(y, 12).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 8).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 9).value & ")"
-
- Else
- sql = "insert into rt_ship_temp_1 (comment,work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- (N'" & xlSheet.Cells(y, 19).value.ToString.Replace("'", " ") & "','" & xlSheet.Cells(y, 12).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 8).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 9).value & ")"
-
- End If
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
- End If
-
-
- End If
-
-
-
-
-
- 'If Not (xlSheet.Cells(y, 10).value Is Nothing) Then '尺数
-
-
- ' my_sf = xlSheet.Cells(y, 11).value
- ' my_price = xlSheet.Cells(y, 12).value
-
- ' If xlSheet.Cells(y, 10).value Is Nothing Then
- ' Else
-
- ' If xlSheet.Cells(y, 18).value Is Nothing Then
-
- ' If xlSheet.Cells(13, 10).value = "张数" Then
- ' sql = "insert into rt_ship_temp_1 (work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- ' (N'" & xlSheet.Cells(y, 13).value & "','" & xlSheet.Cells(y, 5).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 11).value & ")"
- ' ElseIf xlSheet.Cells(13, 11).value = "张数" Then
-
- ' sql = "insert into rt_ship_temp_1 (work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- ' (N'" & xlSheet.Cells(y, 13).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 10).value & ")"
-
- ' End If
-
-
- ' Else
-
- ' If xlSheet.Cells(13, 10).value = "张数" Then
-
- ' sql = "insert into rt_ship_temp_1 (comment,work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- ' (N'" & xlSheet.Cells(y, 18).value & "','" & xlSheet.Cells(y, 13).value & "','" & xlSheet.Cells(y, 5).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 11).value & ")"
- ' ElseIf xlSheet.Cells(13, 11).value = "张数" Then
-
- ' sql = "insert into rt_ship_temp_1 (comment,work_no,card,filename,serial,order_item,no,name,po_no,qty) values
- ' (N'" & xlSheet.Cells(y, 18).value & "','" & xlSheet.Cells(y, 14).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & file_name & "','" & s1 & "','" & xlSheet.Cells(y, 9).value & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 8).value & "'," & xlSheet.Cells(y, 10).value & ")"
-
- ' End If
-
-
- ' End If
-
-
-
- ' cmd.CommandText = sql
- ' cmd.ExecuteScalar()
- ' s1 = s1 + 1
- ' End If
-
-
- 'End If
-
-
- Next
-
-
- ' sql = "select 品名,cast(sum(淨重) as numeric(10,1)) as 淨重 from (select case when 品名 like '%PU%' or 品名 like '%action%' or 品名 like N'%榔%' then 'pu' else '反毛' end as 品名,淨重 from (select name as 品名,sum(weight) as 淨重 from (SELECT no, name, qty_sf1, nw,qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) AS Ratio, cast(qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) *nw as numeric(10,3)) as weight FROM rt_ship_daily_sj) as p group by name) as q ) as qq group by 品名"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
- ' dt.Columns.Add("尺数")
- ' dt.Columns.Add("货值")
-
-
-
- ' For rr As Integer = 0 To dt.Rows.Count - 1
-
- ' sql = "SELECT CAST(SUM(qty_sf1) AS numeric(10, 1)) AS 呎數 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM rt_ship_daily_sj) AS p
- 'GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- ' cmd.CommandText = sql
-
- ' dt.Rows(rr).Item("尺数") = cmd.ExecuteScalar
-
-
- ' Next
-
-
-
- ' For rr As Integer = 0 To dt.Rows.Count - 1
-
- ' sql = "SELECT CAST(SUM(qty_sf1 * unit_price) AS numeric(10, 3)) AS 金額 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, unit, nw, gw, po_no, po_serial, qty_sf1, sku_no, order_month, supplier, type, unit_price, cbm FROM rt_ship_daily_sj) AS p
- 'GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- ' cmd.CommandText = sql
-
- ' dt.Rows(rr).Item("货值") = cmd.ExecuteScalar
-
-
- ' Next
- ' dgv1.DataSource = dt
-
-
-
- sql = "select 品名,po_no as 订购单号,厚度,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,cast(sum(unit_price*qty_sf1)/sum(qty_sf1) as numeric(10,2)) as 单价,cast(sum(unit_price*qty_sf1) as numeric(10,2)) as 货值,sum(净重) as 净重 from
- (SELECT no, case when (name like '%PU%' or name like '%action%' or name like N'%榔%') AND name NOT LIKE '%tpu%' then N'贴膜' else '反毛' end as 品名, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM rt_ship_daily_sj) as p group by 品名,po_no,厚度" '----旧
-
- Sql = "select name as 品名 ,po_no as 订单号,order_item as 项次号,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_sj group by name,po_no,order_item,deli_no "
-
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
-
-
- da.Fill(dt)
-
-
- dgv1.DataSource = dt
-
-
- dgv1.Columns("品名").Width = 300
-
- dgv1.Columns("订单号").Width = 180
-
- dgv1.Columns("项次号").Width = 80
-
- dgv1.Columns("尺数").Width = 120
-
-
-
- Sql = "select 品名,颜色,厚度,sum(尺数) as 尺数,sum(货值) as 货值,sum(净重) as 净重 from (select 品名,颜色,po_no as 订购单号,厚度,sum(qty_sf1) as 尺数,sum(unit_price*qty_sf1)/sum(qty_sf1) as 单价,sum(unit_price*qty_sf1) as 货值,sum(净重) as 净重 from
- (SELECT no, case when (name like '%PU%' or name like '%action%' or name like N'%榔%') and name not like '%tpu%' then N'贴膜' else '反毛' end as 品名, case when name like '%黑色%' then '黑色' else '其他' end as 颜色, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM rt_ship_daily_sj) as p group by 品名,po_no,厚度,颜色) as q group by 品名,颜色,厚度 order by 品名"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
-
-
-
- Sql = "select 品名,颜色,sum(尺数) as 尺数,sum(货值) as 货值,sum(净重) as 净重 from (select 品名,颜色,po_no as 订购单号,厚度,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,cast(sum(unit_price*qty_sf1)/sum(qty_sf1) as numeric(10,2)) as 单价,cast(sum(unit_price*qty_sf1) as numeric(10,2)) as 货值,sum(净重) as 净重 from
- (SELECT no, case when (name like '%PU%' or name like '%action%' or name like N'%榔%') and name not like '%tpu%' then N'贴膜' else '反毛' end as 品名, case when name like '%黑色%' then '黑色' else '其他' end as 颜色, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM rt_ship_daily_sj) as p group by 品名,po_no,厚度,颜色) as q group by 品名,颜色 order by 品名"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv3.DataSource = dt
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*东家*" Or OpenFileDialog1.SafeFileName Like "*东治*" Then '----------------------------------------------------------------------------------东家
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 2 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:L" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 2 To y - 1
-
- If y = 2 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,serial,no,po_no,work_no,qty,name) values
- (N'" & file_name & "','" & s1 & "','" & my_no & "','" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 9).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 2).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- s1 = s1 + 1
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "好兄弟*" And Not (OpenFileDialog1.SafeFileName Like "*样品*") And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '----------------------------------------------------------------------------------好兄弟
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- Dim my_name As String
- Dim my_qty As Double
- Dim my_po As String
- Dim my_po1 As String
- Dim my_name1() As String
- Dim my_po_1() As String
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
- my_name = xlSheet.Cells(4, 1).value
-
-
-
-
-
-
- my_qty = xlSheet.Cells(38, 10).value
-
- my_po = xlSheet.Cells(3, 1).value
-
- my_po1 = xlSheet.Cells(3, 8).value
-
-
- my_name1 = Split(my_name, "材料名称:")
-
- my_po_1 = Split(my_po, "调料单号:")
-
- sql = "insert into rt_ship_temp_1 (filename,color1,serial,po_no,qty,name) values
- (N'" & file_name & "',N'" & my_name1(1) & "','" & i & "',N'" & my_po_1(1) & "/" & my_po1 & "'," & my_qty & ",N'" & my_name1(1) & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
- Next
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "名创*" And Not (OpenFileDialog1.SafeFileName Like "名创发货明细*") And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '----------------------------------------------------------------------------------
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- Dim my_name As String
- Dim my_qty As Double
- Dim my_po As String
- Dim my_po1 As String
- Dim my_name1() As String
- Dim my_po_1() As String
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
- my_name = xlSheet.Cells(4, 1).value
-
-
-
-
-
-
- my_qty = xlSheet.Cells(38, 10).value
-
- my_po = xlSheet.Cells(3, 1).value
-
- my_po1 = xlSheet.Cells(3, 8).value
-
-
- my_name1 = Split(my_name, "材料名称:")
-
- my_po_1 = Split(my_po, "调料单号:")
-
- sql = "insert into rt_ship_temp_1 (filename,color1,serial,po_no,qty,name) values
- (N'" & file_name & "',N'" & my_name1(1) & "','" & i & "',N'" & my_po_1(1) & "/" & my_po1 & "'," & my_qty & ",N'" & my_name1(1) & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "名越*" And Not (OpenFileDialog1.SafeFileName Like "*名越发货明细*") And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '----------------------------------------------------------------------------------
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- Dim my_name As String
- Dim my_qty As Double
- Dim my_po As String
- Dim my_po1 As String
- Dim my_name1() As String
- Dim my_po_1() As String
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
- my_name = xlSheet.Cells(4, 1).value
-
-
-
-
-
-
- my_qty = xlSheet.Cells(38, 10).value
-
- my_po = xlSheet.Cells(3, 1).value
-
- my_po1 = xlSheet.Cells(3, 8).value
-
-
- my_name1 = Split(my_name, "材料名称:")
-
- my_po_1 = Split(my_po, "调料单号:")
-
- sql = "insert into rt_ship_temp_1 (filename,color1,serial,po_no,qty,name) values
- (N'" & file_name & "',N'" & my_name1(1) & "','" & i & "',N'" & my_po_1(1) & "/" & my_po1 & "'," & my_qty & ",N'" & my_name1(1) & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
- Next
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "名晋*" And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '----------------------------------------------------------------------------------
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- Dim my_name As String
- Dim my_qty As Double
- Dim my_po As String
- Dim my_po1 As String
- Dim my_name1() As String
- Dim my_po_1() As String
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
- my_name = xlSheet.Cells(4, 1).value
-
-
-
-
-
-
- my_qty = xlSheet.Cells(38, 10).value
-
- my_po = xlSheet.Cells(3, 1).value
-
- my_po1 = xlSheet.Cells(3, 8).value
-
-
- my_name1 = Split(my_name, "材料名称:")
-
- my_po_1 = Split(my_po, "调料单号:")
-
- sql = "insert into rt_ship_temp_1 (filename,color1,serial,po_no,qty,name) values
- (N'" & file_name & "',N'" & Trim(my_name1(1)) & "','" & i & "',N'" & Trim(my_po_1(1)) & "/" & Trim(my_po1) & "'," & my_qty & ",N'" & Trim(my_name1(1)) & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
- Next
-
-
-
- ''sql = "insert into rt_ship_temp_1 (filename,serial,no,po_no,work_no,qty,name) values
- ' (N'" & file_name & "','" & s1 & "','" & my_no & "','" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 9).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 2).value & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
- 's1 = s1 + 1
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "顺泰盛*" And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '----------------------------------------------------------------------------------
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- Dim my_name As String
- Dim my_qty As Double
- Dim my_po As String
- Dim my_po1 As String
- Dim my_name1() As String
- Dim my_po_1() As String
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
- my_name = xlSheet.Cells(4, 1).value
-
-
-
-
-
-
- my_qty = xlSheet.Cells(38, 10).value
-
- my_po = xlSheet.Cells(3, 1).value
-
- my_po1 = xlSheet.Cells(3, 8).value
-
-
- my_name1 = Split(my_name, "材料名称:")
-
- my_po_1 = Split(my_po, "调料单号:")
-
- sql = "insert into rt_ship_temp_1 (filename,color1,serial,po_no,qty,name) values
- (N'" & file_name & "',N'" & my_name1(1) & "','" & i & "',N'" & my_po_1(1) & "/" & my_po1 & "'," & my_qty & ",N'" & my_name1(1) & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
- Next
-
-
-
- ''sql = "insert into rt_ship_temp_1 (filename,serial,no,po_no,work_no,qty,name) values
- ' (N'" & file_name & "','" & s1 & "','" & my_no & "','" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 9).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 2).value & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
- 's1 = s1 + 1
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*吉兴*" Then '----------------------------------------------------------------------------------吉兴
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 8 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 1).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- 'xlApp.Range("A2:L" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 8 To y - 1
-
- If y = 8 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,serial,no,po_no,work_no,qty,name) values
- (N'" & file_name & "','" & s1 & "','" & my_no & "','" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 1).value & "'," & xlSheet.Cells(y, 13).value & ",N'" & xlSheet.Cells(y, 8).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- s1 = s1 + 1
-
- Next
-
- ElseIf OpenFileDialog1.SafeFileName Like "*松城*" And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '----------------------------------------------------------------------------------松城
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- 'xlApp.Range("A2:L" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 3 To y - 1
-
- If y = 3 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,serial,no,po_no,work_no,qty,name,thick) values
- (N'" & file_name & "','" & s1 & "','" & my_no & "','" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 2).value & ",N'" & xlSheet.Cells(y, 5).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- s1 = s1 + 1
-
- Next
-
-
- 'Sql = "select name as 品名 ,po_no as 订单号,work_no as 指令号,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_dongjia group by name,po_no,work_no,deli_no "
-
-
- 'cmd.CommandText = Sql
- 'dt = New DataTable
- 'da.SelectCommand = cmd
-
-
- 'da.Fill(dt)
-
-
- 'dgv1.DataSource = dt
-
-
- 'dgv1.Columns("品名").Width = 300
-
- 'dgv1.Columns("订单号").Width = 180
-
- 'dgv1.Columns("指令号").Width = 80
-
- 'dgv1.Columns("尺数").Width = 120
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*宏福出货柜*" Then '----------------------------------------------------------------------------------上杰
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A5:q" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 5 To y - 1
-
-
-
-
- sql = "insert into rt_ship_temp_1 (card,serial,filename,name,qty,po_no,order_item,
- work_no,order_month) values
- ('" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 1).value & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "',N'" & xlSheet.Cells(y, 7).value & "','" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 11).value & "','" & xlSheet.Cells(y, 12).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
-
-
-
-
-
-
- Sql = "select name as 品名 ,po_no as 订单号,order_item as 项次号,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_hongfu group by name,po_no,order_item,deli_no "
-
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
-
-
- da.Fill(dt)
-
-
- dgv1.DataSource = dt
-
-
- dgv1.Columns("品名").Width = 300
-
- dgv1.Columns("订单号").Width = 180
-
- dgv1.Columns("项次号").Width = 80
-
- dgv1.Columns("尺数").Width = 120
-
- ElseIf OpenFileDialog1.SafeFileName Like "*宏美发货柜*" Then '----------------------------------------------------------------------------------上杰
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A5:q" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 6 To y - 1
-
-
-
-
- sql = "insert into rt_ship_temp_1 (card,serial,filename,name,qty,po_no,order_item,
- work_no,order_month) values
- ('" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 1).value & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "',N'" & xlSheet.Cells(y, 7).value & "','" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 11).value & "','" & xlSheet.Cells(y, 12).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
-
-
-
-
-
-
- sql = "select name as 品名 ,po_no as 订单号,order_item as 项次号,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_hongfu group by name,po_no,order_item,deli_no "
-
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
-
-
- da.Fill(dt)
-
-
- dgv1.DataSource = dt
-
-
- dgv1.Columns("品名").Width = 300
-
- dgv1.Columns("订单号").Width = 180
-
- dgv1.Columns("项次号").Width = 80
-
- dgv1.Columns("尺数").Width = 120
-
- ElseIf OpenFileDialog1.SafeFileName Like "*欣昌*" Then '----------------------------------------------------------------------------------上杰
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets("PKL")
-
- Dim y As Integer = 0
- For y = 16 To xlApp.Workbooks(1).Worksheets("PKL").UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A5:q" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 16 To y - 1
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,name,qty,po_no,work_no,THICK) values
- (N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 3).value & "','" & xlSheet.Cells(y, 6).value & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 5).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*ruitai inv*" Then '----------------------------------------------------------------------------------大田
-
- Dim filename1 As String
-
- filename1 = file_name & "大田"
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & filename1 & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & filename1 & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets("P&L")
- Dim s1 As Integer = 1
- Dim y As Integer = 0
- For y = 29 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 3).value) < 1 Then
- Exit For
- End If
-
- Next y
- file_name = file_name & "大田"
-
-
- For y = 29 To y - 1
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,name,qty,po_no) values (N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 3).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 2).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 += 1
-
-
-
- Next
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*三元*" Then '----------------------------------------------------------------------------------大田
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets("1")
- Dim s1 As Integer = 1
- Dim y As Integer = 0
- For y = 2 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
-
- For y = 2 To y - 1
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,name,qty,po_no,card) values (N'" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & xlSheet.Cells(y, 4).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 += 1
-
-
-
- Next
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*宏福出货*" Then '----------------------------------------------------------------------------------
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets("1")
-
- Dim yyy As Integer = 0
-
-
- Dim y As Integer = 0
- For y = 4 To xlApp.Workbooks(1).Worksheets("1").UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A4:w" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
- Dim s1 As Integer = 1
- For y = 4 To y - 1
-
-
-
- sql = "insert into rt_ship_temp_1 (card,serial,filename,name,qty,po_no,order_item,
- work_no,color1) values ('" & xlSheet.Cells(y, 7).value & "','" & s1 & "',N'" & file_name & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 5).value & ",N'" & xlSheet.Cells(y, 15).value & "','" & xlSheet.Cells(y, 14).value & "',N'" & xlSheet.Cells(y, 17).value & "',N'" & xlSheet.Cells(y, 4).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 += 1
-
-
-
- Next
-
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*永丰*" Then '----------------------------------------------------------------------------------永丰
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- Dim my_total_weight As Double = 0
-
- Dim s1 As Integer = 1
- Dim s11 As Integer = 1001
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
- Dim y As Integer
- For y = xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count To 3 Step -1
-
- If xlSheet.Cells(y, 1).value = Nothing Then
-
- If xlSheet.Cells(y, 2).value = "重量" Then
-
-
-
- End If
-
-
- GoTo OK5
- End If
-
- If xlSheet.Cells(y, 1).value.ToString = "数量合计" Then
- Exit For
- End If
- OK5:
-
- Next y
-
- Dim yyy As Integer
-
- For yyy = 3 To xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count
-
- If xlSheet.Cells(yyy, 14).value = "制 表" Then
- Exit For
- End If
-
-
- Next yyy
-
-
-
- If xlSheet.Cells(y + 2, 2).value Like "重量*" Then
-
- Dim q() As String
- Dim r() As String
-
- q = Split(xlSheet.Cells(y + 2, 2).value, "重量")
- r = Split(q(1), "KG")
-
- If IsNumeric(r(0)) Then
- Else
-
- r = Split(q(1), "kg")
-
- If IsNumeric(r(0)) Then
- Else
-
- r = Split(q(1), "Kg")
- End If
-
-
-
- End If
-
-
-
-
- 'my_total_weight = r(0)
-
-
-
-
- End If
-
-
-
- xlSheet.Range("A3:A" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- xlSheet.Range("c3:g" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- xlSheet.Range("N3:Q" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- If xlSheet.Range("K3:L" & yyy - 1).MergeCells.ToString <> "False" Then
-
- xlSheet.Range("K3:L" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- End If
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_po As String
- Dim my_work As String
- Dim my_color As String
- Dim my_thick As String
- Dim my_no1 As String
- Dim my_po1 As String
- Dim my_work1 As String
- Dim my_color1 As String
- Dim my_thick1 As String
-
-
-
-
- For y = 3 To y - 1
-
-
- If y = 3 Then
- my_no = 3
- my_no1 = xlSheet.Cells(y, 11).value
- my_po = xlSheet.Cells(y, 4).value
- my_work = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
- my_po1 = xlSheet.Cells(y, 14).value
- my_work1 = xlSheet.Cells(y, 15).value
- my_color1 = xlSheet.Cells(y, 16).value
- my_thick1 = xlSheet.Cells(y, 17).value
- End If
-
-
-
- If xlSheet.Cells(y, 2).value = Nothing And xlSheet.Cells(y, 4).value = Nothing And xlSheet.Cells(y, 5).value = Nothing And xlSheet.Cells(y, 6).value = Nothing And xlSheet.Cells(y, 7).value = Nothing Then
- ' Exit For
- Else
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
- If xlSheet.Cells(y, 4).VALUE Is Nothing Then
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Else
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
- my_po = xlSheet.Cells(y, 4).value
- my_work = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
-
- Sql = "insert into rt_ship_daily_yongfong (filename,card,serial,no,qty_sf,po_no,work_no,color,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & xlSheet.Ce & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty_sf,po_no,work_no,color,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & xlSheet.Ce & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- End If
- End If
- End If
-
-
-
- If xlSheet.Cells(y, 12).value = Nothing And xlSheet.Cells(y, 14).value = Nothing And xlSheet.Cells(y, 15).value = Nothing And xlSheet.Cells(y, 16).value = Nothing And xlSheet.Cells(y, 17).value = Nothing Then
-
- ' Exit For
- Else
-
- If xlSheet.Cells(y, 12).value Is Nothing Then
- Else
-
- If xlSheet.Cells(y, 14).VALUE Is Nothing Then
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
- End If
- Sql = "insert into rt_ship_daily_yongfong (filename,card,serial,no,qty_sf,po_no,work_no,color,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty_sf,po_no,work_no,color,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- Else
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
- End If
-
- my_po1 = xlSheet.Cells(y, 14).value
- my_work1 = xlSheet.Cells(y, 15).value
- my_color1 = xlSheet.Cells(y, 16).value
- my_thick1 = xlSheet.Cells(y, 17).value
-
- Sql = "insert into rt_ship_daily_yongfong (filename,card,serial,no,qty_sf,po_no,work_no,color,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty_sf,po_no,work_no,color,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- End If
-
-
-
- End If
-
-
- 'sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no1 & "'," & xlSheet.Cells(y, 10).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
-
- End If
-
-
-
- Next
-
-
-
- Next
-
-
- 'Sql = "SELECT * FROM rt_ship_daily_yongfong" '--------------------------
-
- 'cmd.CommandText = Sql
- 'dt = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt)
-
-
- 'For x As Integer = 0 To dt.Rows.Count - 1
-
- ' Sql = "update rt_ship_daily_yongfong set size='"
-
-
-
- ' mysplit = Split(dt.Rows(x).Item("color"), "/")
-
- ' If UBound(mysplit) > 1 Then
- ' Sql = "update rt_ship_daily_yongfong set color1=N'" & mysplit(UBound(mysplit)) & "' where COLOR=N'" & dt.Rows(x).Item("COLOR") & "' and deli_no='" & dt.Rows(x).Item("deli_no") & "' and serial='" & dt.Rows(x).Item("serial") & "' AND FILENAME=N'" & dt.Rows(x).Item("serial") & "'"
- ' cmd.CommandText = sql
- ' cmd.ExecuteScalar()
- ' sql = "update rt_ship_temp_1 set color1=N'" & mysplit(UBound(mysplit)) & "' where COLOR=N'" & dt.Rows(x).Item("COLOR") & "' and deli_no='" & dt.Rows(x).Item("deli_no") & "' and serial='" & dt.Rows(x).Item("serial") & "' AND FILENAME=N'" & dt.Rows(x).Item("serial") & "'"
- ' cmd.CommandText = sql
- ' cmd.ExecuteScalar()
- ' Else
- ' sql = "update rt_ship_daily_yongfong set color1=N'" & dt.Rows(x).Item("color") & "' where COLOR=N'" & dt.Rows(x).Item("COLOR") & "' and deli_no='" & dt.Rows(x).Item("deli_no") & "' and serial='" & dt.Rows(x).Item("serial") & "' AND FILENAME=N'" & dt.Rows(x).Item("serial") & "'"
- ' cmd.CommandText = sql
- ' cmd.ExecuteScalar()
-
- ' sql = "update rt_ship_daily_temp_1 set color1=N'" & dt.Rows(x).Item("color") & "' where COLOR=N'" & dt.Rows(x).Item("COLOR") & "' and deli_no='" & dt.Rows(x).Item("deli_no") & "' and serial='" & dt.Rows(x).Item("serial") & "' AND FILENAME=N'" & dt.Rows(x).Item("serial") & "'"
- ' cmd.CommandText = sql
- ' cmd.ExecuteScalar()
-
- ' End If
-
-
- 'Next
-
-
-
-
-
-
-
- sql = "SELECT po_no AS 订单号, work_no AS 指令号, color AS 颜色, thick AS 厚度, cast(SUM(qty_sf) as numeric(10,1)) AS 尺数,deli as 发货单号 FROM RT_ship_daily_yongfong GROUP BY po_no, work_no, color,thick,deli ORDER BY 订单号, 指令号, 颜色"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
-
- dgv1.DataSource = dt
-
-
- 'dt.Columns.Add("货值")
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*永正货柜*" Then '--------------------------------------------------------------------------永正货柜
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A14:N" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- ' End If
-
-
- Dim mc As Integer = 1
- For y = 14 To y - 1
-
- sql = "insert into rt_ship_temp_1 (filename,work_no,order_item,card,no,name,qty,po_no,serial) values(N'" & file_name & "',N'" & xlSheet.Cells(y, 10).value &
- "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 4).value & "',N'" &
- xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 7).value & "'," & mc & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- mc = mc + 1
-
- Next
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*永弘出货*" Then '--------------------------------------------------------------------------永正货柜
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 4 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A14:N" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- ' End If
-
-
- Dim mc As Integer = 1
- For y = 4 To y - 1
-
- sql = "insert into rt_ship_temp_1 (filename,order_item,name,qty,po_no,serial) values(N'" & file_name & "',N'" & xlSheet.Cells(y, 12).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 4).value & ",N'" & xlSheet.Cells(y, 13).value & "'," & mc & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- mc = mc + 1
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*永弘*" And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '--------------------------------------------------------------------------永正货柜
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A14:N" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- ' End If
-
-
- Dim mc As Integer = 1
- For y = 13 To y - 1
-
- sql = "insert into rt_ship_temp_1 (filename,work_no,order_item,name,qty,po_no,serial) values(N'" & file_name & "',N'" & xlSheet.Cells(y, 11).value & "',N'" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 6).value & "'," & mc & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- mc = mc + 1
-
- Next
-
-
- ' sql = "select 品名,厚度,cast(sum(淨重) as numeric(10,1)) as 淨重 from (select case when 品名 like '%PU%' or 品名 like '%action%' or 品名 like N'%榔%' then 'pu' else '反毛' end as 品名,淨重,厚度 from (select name as 品名, thick as 厚度,sum(weight) as 淨重 from (SELECT no, name,CASE WHEN name LIKE '%1.2%' THEN 1.24 ELSE 1.46 END AS thick, qty_sf1, nw,qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) AS Ratio, cast(qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) *nw as numeric(10,3)) as weight FROM RT_Ship_UZ_HG) as p group by name,thick) as q ) as qq group by 品名,厚度"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
- ' dt.Columns.Add("尺数")
- ' dt.Columns.Add("货值")
-
-
-
- ' For rr As Integer = 0 To dt.Rows.Count - 1
-
- ' sql = "SELECT CAST(SUM(qty_sf1) AS numeric(10, 1)) AS 呎數 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, nw, gw, po_no, qty_sf1, unit_price FROM RT_Ship_UZ_HG) AS p
- 'GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- ' cmd.CommandText = sql
-
- ' dt.Rows(rr).Item("尺数") = cmd.ExecuteScalar
-
-
- ' Next
-
-
-
- ' For rr As Integer = 0 To dt.Rows.Count - 1
-
- ' sql = "SELECT CAST(SUM(qty_sf1 * unit_price) AS numeric(10, 3)) AS 金額 FROM (SELECT DISTINCT no, name, CASE WHEN name LIKE '%PU%' OR name LIKE '%action%' OR name LIKE N'%榔%' THEN 'pu' ELSE '反毛' END AS 品名, qty_sf, nw, po_no, qty_sf1,unit_price FROM RT_Ship_UZ_HG) AS p
- 'GROUP BY 品名 having 品名=N'" & dt.Rows(rr).Item("品名") & "'"
- ' cmd.CommandText = sql
-
- ' dt.Rows(rr).Item("货值") = cmd.ExecuteScalar
-
-
- ' Next
- ' dgv1.DataSource = dt
-
-
-
- ' Sql = "select po_no as 订单号,品名 as 类别, 颜色,sum(qty_sf1) as 尺数,cast(sum(qty_sf1*单价)/sum(qty_sf1) as numeric(10,2)) as 单价 from (SELECT rt_ship_uz_hg.po_no, case when name like '%PU%' or name like '%action%' or name like N'%榔%' then '貼膜' else '反毛' end as 品名,case when name like '%黑色%' then '黑色' else '其他' end as 颜色,name,CASE WHEN name LIKE '%1.2%' THEN 1.24 ELSE 1.46 END AS thick,
- 'unit_price as 单价, qty_sf1, nw,qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) AS Ratio, cast(qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) *nw as numeric(10,3)) as weight FROM RT_Ship_UZ_HG) as p group by po_no,品名,颜色"
-
- ' sql = "select po_no as 订单号,name as 品名,work_no as 指令号 ,sum(qty_sf1) as 尺数,deli_no as 发货单号 FROM RT_Ship_UZ_HG group by po_no,name,work_no,deli_no"
- ' cmd.CommandText = Sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
- ' dgv1.DataSource = dt
-
-
- ' dgv1.Columns(0).Width = 200
- ' dgv1.Columns(1).Width = 80
- ' dgv1.Columns(2).Width = 80
-
-
-
- ' sql = "select 类别,颜色,sum(尺数) as 尺数,cast(sum(货值)/sum(尺数) as numeric(10,2)) as 单价,cast(sum(货值) as numeric(10,2)) as 货值,sum(毛重) as 毛重,sum(净重) as 净重,sum(件数) as 件数 from
- '( select po_no as 订单号,类别,sum(nw) as 净重,sum(gw) as 毛重, 颜色,sum(qty_sf1) as 尺数,sum(qty_sf1*单价)as 货值,count(*) as 件数 from
- '(SELECT rt_ship_uz_hg.po_no, case when name like '%PU%' or name like '%action%' or name like N'%榔%' then '貼膜' else '反毛' end as 类别,case when name like '%黑色%' then '黑色' else '其他' end as 颜色,name,
- 'unit_price as 单价, qty_sf1, nw, gw,qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) AS Ratio, cast(qty_sf1/SUM(qty_sf1) OVER (PARTITION BY no) *nw as numeric(10,3)) as weight FROM RT_Ship_UZ_HG) as p group by po_no,类别,颜色) as q group by 类别,颜色 order by 类别"
- ' cmd.CommandText = Sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
- ' dgv2.DataSource = dt
-
-
-
- ' dgv2.Columns(0).Width = 70
- ' dgv2.Columns(1).Width = 70
- ' dgv2.Columns(2).Width = 120
- ' dgv2.Columns(3).Width = 70
- ' dgv2.Columns(4).Width = 120
- ' dgv2.Columns(5).Width = 120
-
-
-
-
- ' With dgv2.Columns("尺数").DefaultCellStyle
- ' .Format = "n2"
- ' .Alignment = DataGridViewContentAlignment.MiddleRight
-
- ' End With
-
- ' With dgv2.Columns("货值").DefaultCellStyle
- ' .Format = "n2"
- ' .Alignment = DataGridViewContentAlignment.MiddleRight
-
- ' End With
-
- ' With dgv2.Columns("净重").DefaultCellStyle
- ' .Format = "n2"
- ' .Alignment = DataGridViewContentAlignment.MiddleRight
-
- ' End With
-
- ' With dgv2.Columns("毛重").DefaultCellStyle
- ' .Format = "n2"
- ' .Alignment = DataGridViewContentAlignment.MiddleRight
-
- ' End With
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "永正发货*" Then '-----------永正发货
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 14 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- xlApp.Range("A14:q" & yy).Select()
-
- 'If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- 'End If
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
-
-
-
- For y = 14 To y - 1
-
-
- If y = 14 Then
-
- my_no = xlSheet.Cells(y, 1).value
- my_order_item = xlSheet.Cells(y, 1).value
- my_name = xlSheet.Cells(y, 2).value
- my_card = xlSheet.Cells(y, 4).value
-
- my_po = xlSheet.Cells(y, 7).value
- my_skuno = xlSheet.Cells(y, 11).value
-
-
- End If
-
-
- If xlSheet.Cells(y, 1).value Is Nothing And xlSheet.Cells(y, 3).value Is Nothing And xlSheet.Cells(y, 7).value Is Nothing And xlSheet.Cells(y, 10).value Is Nothing Then
-
- Else
-
- If xlSheet.Cells(y, 10).value Is Nothing Then
-
- Else
-
-
- If xlSheet.Cells(y, 3).value Is Nothing And xlSheet.Cells(y, 8).value Is Nothing And xlSheet.Cells(y, 9).value Is Nothing Then
-
-
-
- Else
-
- my_name = xlSheet.Cells(y, 2).value
- my_po = xlSheet.Cells(y, 7).value
- my_skuno = xlSheet.Cells(y, 11).value
-
-
-
-
-
- End If
-
-
-
-
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (order_item,filename,work_no,serial,card,no,name,po_no,qty) values('" & xlSheet.Cells(y, 8).value & "',N'" & file_name & "',N'" & my_skuno & "','" & s1 & "','" & xlSheet.Cells(y, 4).value & "','" & my_no & "',N'" & my_name & "',N'" & my_po & "'," & xlSheet.Cells(y, 10).value & ")"
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
-
-
- End If
- End If
-
-
- Next
-
-
- Sql = "select 品名,po_no as 订购单号,厚度,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,cast(sum(unit_price*qty_sf1)/sum(qty_sf1) as numeric(10,2)) as 单价,cast(sum(unit_price*qty_sf1) as numeric(10,2)) as 货值,sum(净重) as 净重 from
- (SELECT no, case when name like '%PU%' or name like '%action%' or name like N'%榔%' then N'贴膜' else '反毛' end as 品名, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM RT_SHIP_DAILY_UZ_1) as p group by 品名,po_no,厚度" '----旧
-
-
-
- Sql = "select name as 品名,po_no as 订单号,order_item as 项次号,cast(sum(qty_sf1) as numeric(10,1)) as 尺数 from rt_ship_daily_uz_1 group by name,po_no,order_item"
-
-
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dt.Columns.Add("发货单号")
-
-
- dgv1.DataSource = dt
-
-
- dgv1.Columns("品名").Width = 300
- dgv1.Columns("订单号").Width = 120
- dgv1.Columns("项次号").Width = 80
- dgv1.Columns("尺数").Width = 120
-
-
-
-
-
-
- Sql = "select 品名,厚度,sum(尺数) as 尺数,sum(货值) as 货值,sum(净重) as 净重 from (select 品名,po_no as 订购单号,厚度,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,cast(sum(unit_price*qty_sf1)/sum(qty_sf1) as numeric(10,2)) as 单价,cast(sum(unit_price*qty_sf1) as numeric(10,2)) as 货值,sum(净重) as 净重 from
- (SELECT no, case when name like '%PU%' or name like '%action%' or name like N'%榔%' then N'贴膜' else '反毛' end as 品名, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM RT_SHIP_DAILY_UZ_1) as p group by 品名,po_no,厚度) as q group by 品名,厚度 order by 品名"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
-
-
-
- Sql = "select 品名,sum(尺数) as 尺数,sum(货值) as 货值,sum(净重) as 净重 from (select 品名,po_no as 订购单号,厚度,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,cast(sum(unit_price*qty_sf1)/sum(qty_sf1) as numeric(10,2)) as 单价,cast(sum(unit_price*qty_sf1) as numeric(10,2)) as 货值,sum(净重) as 净重 from
- (SELECT no, case when name like '%PU%' or name like '%action%' or name like N'%榔%' then N'贴膜' else '反毛' end as 品名, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM RT_SHIP_DAILY_UZ_1) as p group by 品名,po_no,厚度) as q group by 品名 order by 品名"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv3.DataSource = dt
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*亿博样*" And Not (OpenFileDialog1.SafeFileName Like "*华盛*") And Not (OpenFileDialog1.SafeFileName Like "*NK*") Then '-----------------------------
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value = "合计:" Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:i" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,nw,gw,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",'" & xlSheet.Cells(y, 7).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
- Sql = "select 订单号,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB ) as p group by 订单号,厚度" '旧
-
- Sql = "SELECT name as 品名,po_no as 订单号, cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from RT_SHIP_DAILY_YBy group by po_no,name,deli_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- dgv1.Columns("品名").Width = 350
- dgv1.Columns("订单号").Width = 150
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*亿博样*" And (OpenFileDialog1.SafeFileName Like "*NK*") Then '-----------------------------
-
-
-
-
- Sql = "select count(*) from rt_ship_daily_yby where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
- Sql = "delete from rt_ship_daily_yby where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "明细" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value = "合计:" Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:i" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (thick,serial,filename,no,qty,name,po_no) values('" & xlSheet.Cells(y, 3).value & "',N'" & s1 & "',N'" & file_name & "','" & my_no &
- "'," & xlSheet.Cells(y, 4).value & ",N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 9).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
- Sql = "select 订单号,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB ) as p group by 订单号,厚度" '旧
-
- Sql = "SELECT name as 品名,po_no as 订单号, cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from RT_SHIP_DAILY_YBy group by po_no,name,deli_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- dgv1.Columns("品名").Width = 350
- dgv1.Columns("订单号").Width = 150
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "亿博发货*" Then '--------------------------------------- 亿博发货明细
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value = "合计:" Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:i" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,serial,filename,no,name,qty,po_no) values('" & xlSheet.Cells(y, 4).value & "','" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 8).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
-
-
-
-
-
- ' sql = "select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- 'FROM RT_SHIP_DAILY_YB) as p group by 订单号,类别,厚度"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
- ' dgv2.DataSource = dt
-
-
- ' sql = "select 类别,sum(尺数),sum(净重) from (select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, case when name like '%black%' then '黑色' else '其他' end as 颜色, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- 'FROM RT_SHIP_DAILY_YB) as p group by 订单号,类别,厚度) as q group by 类别"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
- ' dgv3.DataSource = dt
-
-
-
-
- ' sql = "select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,1)) as 总价,sum(weight) as 淨重 from (SELECT no, name, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,1)) as weight
- 'FROM RT_SHIP_DAILY_PUMA) as p group by name"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
-
-
-
-
-
-
-
-
- 'sql = ""
-
-
- 'cmd.CommandText = sql
- 'dt = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt)
-
-
- 'dgv2.DataSource = dt
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "宏美*" Then '------------------------------------------------------------------
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 4 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 3).value = "合 计" Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- xlApp.Range("A4:w" & yy).Select()
-
- 'If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- 'End If
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 4 To y - 1
-
-
- If y = 4 Then
-
- my_no = xlSheet.Cells(y, 1).value
- 'my_order_item = xlSheet.Cells(y, 1).value
- my_name = xlSheet.Cells(y, 2).value
- my_color = xlSheet.Cells(y, 4).value
- ' my_card = xlSheet.Cells(y, 5).value
- ' my_nw = xlSheet.Cells(y, 6).value
- 'my_gw = xlSheet.Cells(y, 7).value
- 'my_po = xlSheet.Cells(y, 8).value
- 'my_skuno = xlSheet.Cells(y, 12).value
-
-
- End If
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color,po_no,work_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 14).value & "',N'" & xlSheet.Cells(y, 17).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 5).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
-
-
-
- Sql = "select 品名,po_no as 订购单号,厚度,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,cast(sum(unit_price*qty_sf1)/sum(qty_sf1) as numeric(10,2)) as 单价,cast(sum(unit_price*qty_sf1) as numeric(10,2)) as 货值,sum(净重) as 净重 from
- (SELECT no, case when name like '%PU%' or name like '%action%' or name like N'%榔%' then N'贴膜' else '反毛' end as 品名, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM RT_SHIP_DAILY_UZ_1) as p group by 品名,po_no,厚度" '----旧
-
-
-
- Sql = "select po_no as 订单号,name as 品名,color as 颜色,cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_hongmei group by name,po_no,name,color,deli_no"
-
-
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
-
-
- dgv1.DataSource = dt
-
-
- dgv1.Columns("品名").Width = 350
- dgv1.Columns("订单号").Width = 120
- dgv1.Columns("颜色").Width = 100
- dgv1.Columns("尺数").Width = 120
-
- ElseIf OpenFileDialog1.SafeFileName Like "志捷*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 3 To y - 1
-
-
- If y = 3 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- thick = xlSheet.Cells(y, 6).value
-
- my_po = xlSheet.Cells(y, 4).value
-
-
-
- End If
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
- If Not (xlSheet.Cells(y, 2).value Is Nothing) Then
-
-
- If xlSheet.Cells(y, 4).value Is Nothing Then
-
-
- Else
- my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- thick = xlSheet.Cells(y, 6).value
- my_po = xlSheet.Cells(y, 4).value
-
-
- End If
-
-
-
-
-
- End If
-
-
- If my_comment Is Nothing Then
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
- Else
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment.ToString.Replace("'", "''") & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
-
- End If
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "金帝样品*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 3 To y - 1
-
-
-
-
- my_no = xlSheet.Cells(y, 4).value
-
- ' my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- ' thick = xlSheet.Cells(y, 6).value
-
- my_po = xlSheet.Cells(y, 4).value
-
-
-
-
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
-
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "名越发货明细*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 2 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 2 To y - 1
-
-
-
-
- my_no = xlSheet.Cells(y, 4).value
-
- my_comment = ""
- my_color = xlSheet.Cells(y, 2).value
- thick = ""
-
- my_po = xlSheet.Cells(y, 8).value
-
-
-
-
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "',N'" & my_color & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','',N'" & my_color & "','" & xlSheet.Cells(y, 3).value & "')"
-
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "名创发货明细*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 2 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- 'xlApp.Range("A2:g" & yy).Select()
-
-
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 2 To y - 1
-
-
-
-
- my_no = xlSheet.Cells(y, 4).value
-
- my_comment = ""
- my_color = xlSheet.Cells(y, 2).value
- thick = ""
-
- my_po = xlSheet.Cells(y, 8).value
-
-
-
-
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "',N'" & my_color & "',N'" & xlSheet.Cells(y, 7).value & "',N'" & thick & "',N'" & xlSheet.Cells(y, 7).value & "',N'" & file_name & "','" & s1 & "','',N'" & my_color & "','" & xlSheet.Cells(y, 3).value & "')"
-
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "好兄弟样品*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim thick As String
- Dim my_comment As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
-
- For y = 3 To y - 1
-
-
-
-
- my_no = xlSheet.Cells(y, 4).value
-
- ' my_comment = xlSheet.Cells(y, 7).value
- my_color = xlSheet.Cells(y, 5).value
- thick = xlSheet.Cells(y, 6).value
-
- my_po = xlSheet.Cells(y, 4).value
-
-
-
-
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,color1,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 3).value & "',N'" & my_color & "',N'" & my_comment & "',N'" & thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
-
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*THANG*" Then '------------------------------------------------------------------
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- xlApp.Range("A2:j" & yy).Select()
-
-
-
- xlApp.Selection.UnMerge
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 2 To y - 1
-
-
- If y = 2 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- my_name = xlSheet.Cells(y, 2).value
-
-
- my_po = xlSheet.Cells(y, 9).value
-
-
-
- End If
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
-
-
-
- my_name = xlSheet.Cells(y, 2).value.Replace("'", "''")
-
-
- my_po = xlSheet.Cells(y, 9).value
-
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (po_no,filename,serial,no,name,qty,card) values(N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_name & "','" & xlSheet.Cells(y, 3).value & "','" & xlSheet.Cells(y, 4).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "076样品*" Then '------------------------------------------------------------------
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- xlApp.Range("A3:h" & yy).Select()
-
- 'If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- 'End If
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
- Dim my_thick As String
-
-
- For y = 3 To y - 1
-
-
- If y = 3 Then
-
- my_no = xlSheet.Cells(y, 1).value
- 'my_order_item = xlSheet.Cells(y, 1).value
-
-
-
- my_po = xlSheet.Cells(y, 4).value
- my_skuno = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
- my_card = xlSheet.Cells(y, 3).value
-
- End If
-
-
- If xlSheet.Cells(y, 5).value Is Nothing Then
- Else
-
- my_no = xlSheet.Cells(y, 1).value
-
- my_po = xlSheet.Cells(y, 4).value
- my_skuno = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
- my_card = xlSheet.Cells(y, 3).value
-
- End If
-
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (card,comment,work_no,thick,po_no,filename,serial,no,color1,qty) values(N'" & my_card & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & my_skuno & "',N'" & my_thick & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_color & "','" & xlSheet.Cells(y, 2).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
-
-
-
- Sql = "select 品名,po_no as 订购单号,厚度,cast(sum(qty_sf1) as numeric(10,1)) as 尺数,cast(sum(unit_price*qty_sf1)/sum(qty_sf1) as numeric(10,2)) as 单价,cast(sum(unit_price*qty_sf1) as numeric(10,2)) as 货值,sum(净重) as 净重 from
- (SELECT no, case when name like '%PU%' or name like '%action%' or name like N'%榔%' then N'贴膜' else '反毛' end as 品名, nw, gw, po_no, qty_sf1, unit_price,case when name like '%1.2%' then '1.24' when name like '%1.4%' then '1.46' else '1.24' end as 厚度,cast(qty_sf1/sum(qty_sf1) over (partition by no) *nw as numeric(10,1)) as 净重
- FROM RT_SHIP_DAILY_UZ_1) as p group by 品名,po_no,厚度" '----旧
-
-
-
- Sql = "select po_no as 订单号,name as 品名,work_no as 指令号,cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_076_sample group by name,po_no,name,work_no,deli_no"
-
-
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
-
-
- dgv1.DataSource = dt
-
-
- dgv1.Columns("品名").Width = 350
- dgv1.Columns("订单号").Width = 120
- dgv1.Columns("指令号").Width = 150
- dgv1.Columns("尺数").Width = 120
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "加和*" And Not (OpenFileDialog1.SafeFileName Like "*sample*") Then
-
-
- sql = "select count(*) from rt_ship_TEMP_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "加和" Or xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
- Dim y As Integer = 0
- For y = 3 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 7).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- 'xlApp.Range("A4:m" & y - 1).Select()
-
- '' If xlApp.Selection.mergecells = True Then
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- '' End If
-
-
-
-
- Dim my_no As String
- Dim s1 As Integer = 0
-
-
-
- For y = 4 To y - 1
-
- If y = 4 Then
- my_no = xlSheet.Cells(4, 1).value
- End If
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,serial,filename,no,po_no,work_no,material_no,name,thick,
- color1,qty) values('" & xlSheet.Cells(y, 9).value & "','" & s1 & "',N'" & file_name & "','" &
- my_no & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 6).value &
- "',N'" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 8).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
-
- Next
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "吉兴*" Then
-
-
-
- Sql = "delete from rt_ship_daily_JX"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- 'For i = 1 To xlApp.Worksheets.Count
-
-
- ' If xlApp.Workbooks(1).Worksheets(i).name = "0" Then
- ' Exit For
- ' End If
-
-
-
- 'Next
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
- xlSheet.Activate()
-
-
-
- Dim y As Integer = 0
- For y = 8 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:u" & y - 1).Select()
-
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- For y = 8 To y - 1
-
- Sql = "insert into rt_ship_daily_jx (no,name,color,qty,nw,gw,po_no) values('" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 10).value & "'," & xlSheet.Cells(y, 13).value & "," & xlSheet.Cells(y, 17).value & "," & xlSheet.Cells(y, 20).value & ",N'" & xlSheet.Cells(y, 2).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "insert into rt_ship_temp_1 (no,name,color,qty,nw,gw,po_no) values('" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 10).value & "'," & xlSheet.Cells(y, 13).value & "," & xlSheet.Cells(y, 17).value & "," & xlSheet.Cells(y, 20).value & ",N'" & xlSheet.Cells(y, 2).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- Sql = "select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from
- (SELECT po_no as 订单号,name as 品名,case when name like '%PU %' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,
- cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价
- FROM RT_SHIP_DAILY_jx) as p group by 订单号,类别,厚度"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- Sql = "select 类别,sum(尺数),sum(净重),sum(货值) from(select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU %' or name like '% action %' or name like N'%榔%' or name like N'% virgin %' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价 FROM RT_SHIP_DAILY_jx) as p group by 订单号,类别,厚度) as q group by 类别"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*PEI HAI*" Then '-----------------------------------------
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:J" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 8).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
- ElseIf OpenFileDialog1.SafeFileName Like "加和*" And Not (OpenFileDialog1.SafeFileName Like "*sample*") Then
-
-
- sql = "select count(*) from rt_ship_TEMP_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "加和" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
- Dim y As Integer = 0
- For y = 4 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 7).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A4:m" & y - 1).Select()
-
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
- ' End If
-
-
-
-
- Dim my_no As String
- Dim s1 As Integer = 0
-
-
-
- For y = 4 To y - 1
-
- If y = 4 Then
- my_no = xlSheet.Cells(4, 1).value
- End If
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (CARD,serial,filename,no,po_no,work_no,material_no,name,thick,
- color1,qty) values('" & xlSheet.Cells(y, 9).value & "','" & s1 & "',N'" & file_name & "','" &
- my_no & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "','" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 6).value &
- "',N'" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 8).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
-
- Next
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "吉兴*" Then
-
-
-
- Sql = "delete from rt_ship_daily_JX"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- 'For i = 1 To xlApp.Worksheets.Count
-
-
- ' If xlApp.Workbooks(1).Worksheets(i).name = "0" Then
- ' Exit For
- ' End If
-
-
-
- 'Next
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
- xlSheet.Activate()
-
-
-
- Dim y As Integer = 0
- For y = 8 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:u" & y - 1).Select()
-
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- For y = 8 To y - 1
-
- Sql = "insert into rt_ship_daily_jx (no,name,color,qty,nw,gw,po_no) values('" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 10).value & "'," & xlSheet.Cells(y, 13).value & "," & xlSheet.Cells(y, 17).value & "," & xlSheet.Cells(y, 20).value & ",N'" & xlSheet.Cells(y, 2).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "insert into rt_ship_temp_1 (no,name,color,qty,nw,gw,po_no) values('" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 10).value & "'," & xlSheet.Cells(y, 13).value & "," & xlSheet.Cells(y, 17).value & "," & xlSheet.Cells(y, 20).value & ",N'" & xlSheet.Cells(y, 2).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- Sql = "select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from
- (SELECT po_no as 订单号,name as 品名,case when name like '%PU %' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,
- cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价
- FROM RT_SHIP_DAILY_jx) as p group by 订单号,类别,厚度"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- Sql = "select 类别,sum(尺数),sum(净重),sum(货值) from(select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU %' or name like '% action %' or name like N'%榔%' or name like N'% virgin %' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价 FROM RT_SHIP_DAILY_jx) as p group by 订单号,类别,厚度) as q group by 类别"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*coach*" Then '-----------------------------------------
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:J" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 7).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "锐奇*" Then '---------------------
-
-
- sql = "select count(*) from rt_ship_TEMP_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:h" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
-
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,po_no,work_no,card) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "',N'" & xlSheet.Cells(y, 6).value & "',N'" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 4).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
- Sql = "select 订单号,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB ) as p group by 订单号,厚度" '旧
-
- Sql = "SELECT name as 品名,po_no as 采购号,work_no as 订单号, cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from RT_SHIP_DAILY_ruiqi group by po_no,name,work_no,deli_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- dgv1.Columns("品名").Width = 300
- dgv1.Columns("采购号").Width = 150
- dgv1.Columns("订单号").Width = 200
-
- ElseIf OpenFileDialog1.SafeFileName Like "鑫龙*" Then '---------------------
-
-
- sql = "select count(*) from rt_ship_TEMP_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- 'xlApp.Range("A2:h" & y - 1).Select()
- '' If xlApp.Selection.mergecells = True Then
-
- 'xlApp.Selection.UnMerge
-
-
-
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "','" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
-
- Dim mysplit() As String
-
- dt = New DataTable
-
- sql = "select * from rt_ship_temp_1 where color1 is null and filename like N'%鑫龙%'"
- cmd.CommandText = sql
-
- da.Fill(dt)
-
-
- For d As Integer = 0 To dt.Rows.Count - 1
-
- mysplit = Split(dt.Rows(d).Item("name"), " ")
-
- If UBound(mysplit) > 0 Then
-
- sql = "update rt_ship_temp_1 set color1='" & mysplit(0) & "' where po_no='" & dt.Rows(d).Item("po_no") & "' and name='" & dt.Rows(d).Item("name") & "' and qty='" & dt.Rows(d).Item("qty") & "' and serial='" & dt.Rows(d).Item("serial") & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- End If
-
-
- Next
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*鑫茂*" Then '---------------------
-
-
- sql = "select count(*) from rt_ship_TEMP_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- 'xlApp.Range("A2:h" & y - 1).Select()
- '' If xlApp.Selection.mergecells = True Then
-
- 'xlApp.Selection.UnMerge
-
-
-
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
-
- Dim mysplit() As String
-
- dt = New DataTable
-
- sql = "select * from rt_ship_temp_1 where color1 is null and filename like N'%鑫龙%'"
- cmd.CommandText = sql
-
- da.Fill(dt)
-
-
- For d As Integer = 0 To dt.Rows.Count - 1
-
- mysplit = Split(dt.Rows(d).Item("name"), " ")
-
- If UBound(mysplit) > 0 Then
-
- sql = "update rt_ship_temp_1 set color1='" & mysplit(0) & "' where po_no='" & dt.Rows(d).Item("po_no") & "' and name='" & dt.Rows(d).Item("name") & "' and qty='" & dt.Rows(d).Item("qty") & "' and serial='" & dt.Rows(d).Item("serial") & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- End If
-
-
- Next
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*亿博*" And (OpenFileDialog1.SafeFileName Like "*华盛*" Or OpenFileDialog1.SafeFileName Like "*NK*") Then '-----------------------------------
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "明细" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value = "合计:" Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:i" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,po_no,thick) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 4).value & ",N'" & xlSheet.Cells(y, 9).value & "','" & xlSheet.Cells(y, 3).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
- Sql = "select 订单号,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB ) as p group by 订单号,厚度" '旧
-
- Sql = "SELECT name as 品名,po_no as 订单号, cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_yby_huasheng group by po_no,name,deli_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- dgv1.Columns("品名").Width = 350
- dgv1.Columns("订单号").Width = 150
-
- ElseIf OpenFileDialog1.SafeFileName Like "EVERGREE*" Then '------------------------------------
- Sql = "select count(*) from rt_ship_daily_evergree where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
- Sql = "delete from rt_ship_daily_evergree where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:J" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & "N'" & xlSheet.Cells(y, 7).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*THANH*" Then '------------------------------------------------------------------------
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:J" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,nw,gw,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 6).value & "," & xlSheet.Cells(y, 7).value & ",N'" & xlSheet.Cells(y, 8).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
- Sql = "select 订单号,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB ) as p group by 订单号,厚度" '旧
-
- Sql = "SELECT name as 品名,po_no as 订单号, cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from RT_SHIP_DAILY_thanhhu group by po_no,name,deli_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- dgv1.Columns("品名").Width = 400
- dgv1.Columns("订单号").Width = 150
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "PROPERWELL*" Then '------------------------------------------------------
-
- Sql = "select count(*) from rt_ship_daily_PROPERWELL where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
- Sql = "delete from rt_ship_daily_PROPERWELL where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:J" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
- Sql = "insert into rt_ship_daily_PROPERWELL (serial,filename,no,name,qty,nw,gw,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",N'" & xlSheet.Cells(y, 7).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "insert into rt_ship_temp_1 (serial,filename,no,name,qty,nw,gw,po_no) values('" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",N'" & xlSheet.Cells(y, 7).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
- Sql = "select 订单号,cast(sum(数量) as numeric(10,1)) as 尺数,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度
- FROM RT_SHIP_DAILY_YB ) as p group by 订单号,厚度" '旧
-
- Sql = "SELECT name as 品名,po_no as 订单号, cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from RT_SHIP_DAILY_PROPERWELL group by po_no,name,deli_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- dgv1.Columns("品名").Width = 400
- dgv1.Columns("订单号").Width = 150
-
- ElseIf OpenFileDialog1.SafeFileName Like "STELLA*" Or OpenFileDialog1.SafeFileName Like "INDIA*" Or OpenFileDialog1.SafeFileName Like "RAMARIM*" Or OpenFileDialog1.SafeFileName Like "KHE *" Or OpenFileDialog1.SafeFileName Like "PONTUS*" Or OpenFileDialog1.SafeFileName Like "BRANCH *" Then '--------------------------------
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
- Dim s1 As Integer = 0
- Dim my_no As Integer
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:J" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'End If
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (thick,serial,filename,no,name,qty,po_no) values('1.24','" & s1 & "',N'" & file_name & "','" & my_no & "',N'" & xlSheet.Cells(y, 2).value & " " & xlSheet.Cells(y, 3).value & "'," & xlSheet.Cells(y, 4).value & ",N'" & xlSheet.Cells(y, 8).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- Next
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*HATAY*" And Not (OpenFileDialog1.SafeFileName Like "*手动*") Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 3 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Exit For
- End If
-
- Next y
-
- yy = y - 1
- xlApp.Range("A2:j" & yy).Select()
-
-
-
- xlApp.Selection.UnMerge
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 2 To y - 1
-
-
- If y = 2 Then
-
- my_no = xlSheet.Cells(y, 1).value
-
- my_name = xlSheet.Cells(y, 2).value
-
-
- my_po = xlSheet.Cells(y, 8).value
-
-
-
- End If
-
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
- Else
-
- my_no = xlSheet.Cells(y, 1).value
-
- End If
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
-
-
-
- my_name = xlSheet.Cells(y, 2).value
-
-
- my_po = xlSheet.Cells(y, 8).value
-
-
- End If
-
-
-
-
- 'sql = "insert into rt_ship_daily_jj (color,work_no,thick,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).Value.ToString.Replace("'", "''") & "',N'" & xlSheet.Cells(y, 5).value & "',N'" & xlSheet.Cells(y, 3).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 2).value & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
- sql = "insert into rt_ship_temp_1 (card,po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "',N'" & my_po & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & my_name.ToString.Replace("'", "''") & "',N'" & xlSheet.Cells(y, 3).value & "')"
- cmd.CommandText = sql & "','" & xlSheet.Cells(y, 3).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
- sql = "update rt_ship_temp_1 set thick=1.24 where name like '%1.2%' and name like '%1.4%' and filename like N'%hatay%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set thick=1.46 where name like '%1.4%' and name like '%1.6%' and filename like N'%hatay%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*许宝贝*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,thick,card,deli_no,deli,
- po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & "尤珊荣" & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
- ElseIf OpenFileDialog1.SafeFileName Like "*手动*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,thick,card,deli_no,deli,
- po_no,work_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & xlSheet.Cells(y, 10).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 11).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*许宝贝*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,thick,card,deli_no,deli,
- po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & "尤珊荣" & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
- ElseIf OpenFileDialog1.SafeFileName Like "*手动锐奇*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,thick,card,deli_no,deli,
- po_no,work_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & "陈立雄" & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 11).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*手动加和*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,thick,card,deli_no,deli,
- po_no,work_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & "尤珊荣" & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 11).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
- 'ElseIf OpenFileDialog1.SafeFileName Like "*好兄弟*" Then '-----------------------------------------
-
-
-
-
-
- ' sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- ' cmd.CommandText = sql
- ' Dim msg As String
- ' If cmd.ExecuteScalar > 0 Then
-
- ' msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- ' If msg = vbNo Then
-
- ' Exit Sub
-
-
- ' End If
-
- ' End If
-
-
- ' If msg = vbYes Then
-
-
- ' sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- ' cmd.CommandText = sql
- ' cmd.ExecuteNonQuery()
-
-
- ' End If
-
-
-
- ' xlApp = CreateObject("Excel.Application")
- ' xlApp.Visible = True
- ' xlApp.DisplayAlerts = False
- ' Dim my_name As String
- ' Dim my_qty As Double
- ' Dim my_po As String
- ' Dim my_po1 As String
-
-
-
-
-
-
-
-
-
-
-
-
- ' xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- ' Dim s1 As Integer
-
- ' s1 = 1
- ' For y = 3 To 100
-
-
- ' If xlSheet.Cells(y, 3).value Is Nothing Then
- ' Exit For
- ' End If
-
-
-
-
-
- ' sql = "insert into rt_ship_temp_1 (SIZE,COMMENT,color1,thick,card,deli_no,deli,
- ' po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 12).value & "',N'" & xlSheet.Cells(y, 3).value & "',N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & xlSheet.Cells(y, 10).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- ' cmd.CommandText = sql
-
- ' cmd.ExecuteScalar()
- ' s1 = s1 + 1
-
- ' Next
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*利亚*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,thick,card,deli_no,deli,
- po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & xlSheet.Cells(y, 10).value & "',N'" & xlSheet.Cells(y, 3).value & xlSheet.Cells(y, 8).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*名创鞋业*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (WORK_NO,color1,thick,card,deli_no,deli,
- po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 11).value & "','" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & xlSheet.Cells(y, 10).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*聚兴*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,thick,card,deli_no,deli,
- po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 9).value & "',N'" & "尤珊荣" & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*加和sample*" Then '-----------------------------------------
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
-
-
-
-
-
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_nw As String
- Dim my_gw As String
- Dim my_name As String
- Dim my_po As String
- Dim my_price As String
- Dim s1 As String = 1
- Dim my_skuno As String
- Dim my_order_item As String
- Dim my_color As String
-
- s1 = 1
- For y = 3 To 100
-
-
- If xlSheet.Cells(y, 3).value Is Nothing Then
- Exit For
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (work_no,color,thick,card,deli_no,deli,
- po_no,filename,serial,no,name,qty) values(N'" & xlSheet.Cells(y, 9).value & "',N'" & xlSheet.Cells(y, 4).value & "','" & xlSheet.Cells(y, 5).value & "','" & xlSheet.Cells(y, 7).value & "',N'" & xlSheet.Cells(y, 10).value & "',N'" & xlSheet.Cells(y, 11).value & "',N'" & xlSheet.Cells(y, 8).value & "',N'" & file_name & "','" & s1 & "','" & my_no & "',N'" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 6).value & "')"
- cmd.CommandText = sql
-
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Next
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "11111" Then '-----------------------------------------
- ElseIf OpenFileDialog1.SafeFileName Like "11111" Then '---------------------------------------------------
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- Sql = "delete from rt_ship_daily_dj"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "0" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 7).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:K" & y - 1).Select()
-
-
- xlApp.Selection.UnMerge
-
-
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- For y = 2 To y - 1
-
- Sql = "insert into rt_ship_daily_dj (no,name,qty,nw,gw,po_no,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",N'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 10).value & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "insert into rt_ship_temp_1 (no,name,qty,nw,gw,po_no,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & "," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 6).value & ",N'" & xlSheet.Cells(y, 7).value & "'," & xlSheet.Cells(y, 10).value & ")"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- Sql = "select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from
- (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,
- cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价
- FROM RT_SHIP_DAILY_dj) as p group by 订单号,类别,厚度"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- Sql = "select 类别,sum(尺数),sum(净重),sum(货值) from(select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU%' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价 FROM RT_SHIP_DAILY_dj) as p group by 订单号,类别,厚度) as q group by 类别"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*威弘*" Then '------------------------------------
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- Dim s1 As Integer = 1
- Dim s11 As Integer = 1001
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
-
- Dim y As Integer
- For y = xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count To 3 Step -1
-
- If xlSheet.Cells(y, 1).value = Nothing Then
- GoTo OK2
- End If
-
- If xlSheet.Cells(y, 1).value.ToString = "数量合计" Then
- Exit For
- End If
- OK2:
-
- Next y
-
- Dim yyy As Integer
-
- For yyy = 3 To xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count
-
- If xlSheet.Cells(yyy, 14).value = "制 表" Then
- Exit For
- End If
-
-
- Next yyy
-
-
-
-
-
-
-
- xlSheet.Range("A3:A" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- xlSheet.Range("c4:g" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- xlSheet.Range("k3:k" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- If xlSheet.Range("N3:Q" & yyy - 1).MergeCells.ToString <> "False" Then
-
- xlSheet.Range("N3:Q" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- End If
-
-
- Dim my_no As String
- Dim my_po As String
- Dim my_work As String
- Dim my_color As String
- Dim my_thick As String
- Dim my_no1 As String
- Dim my_po1 As String
- Dim my_work1 As String
- Dim my_color1 As String
- Dim my_thick1 As String
- Dim my_card As String
-
-
- For y = 3 To y - 1
-
-
- If y = 3 Then
-
- my_po = xlSheet.Cells(3, 4).value
- my_work = xlSheet.Cells(3, 5).value
- my_color = xlSheet.Cells(3, 6).value
- my_thick = xlSheet.Cells(3, 7).value
-
- my_po1 = xlSheet.Cells(3, 14).value
- my_work1 = xlSheet.Cells(3, 15).value
- my_color1 = xlSheet.Cells(3, 16).value
- my_thick1 = xlSheet.Cells(3, 17).value
-
- End If
-
-
-
-
- If xlSheet.Cells(y, 2).value = Nothing And xlSheet.Cells(y, 4).value = Nothing And xlSheet.Cells(y, 5).value = Nothing And xlSheet.Cells(y, 6).value = Nothing And xlSheet.Cells(y, 7).value = Nothing Then
- ' Exit For
- Else
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
- If xlSheet.Cells(y, 4).VALUE Is Nothing Then
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Else
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
- my_po = xlSheet.Cells(y, 4).value
- my_work = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- End If
- End If
- End If
-
-
-
- If xlSheet.Cells(y, 12).value = Nothing And xlSheet.Cells(y, 14).value = Nothing And xlSheet.Cells(y, 15).value = Nothing And xlSheet.Cells(y, 16).value = Nothing And xlSheet.Cells(y, 17).value = Nothing Then
-
- ' Exit For
- Else
-
- If xlSheet.Cells(y, 12).value Is Nothing Then
- Else
-
- If xlSheet.Cells(y, 14).VALUE Is Nothing Then
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
- End If
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- Else
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
- End If
-
- my_po1 = xlSheet.Cells(y, 14).value
- my_work1 = xlSheet.Cells(y, 15).value
- my_color1 = xlSheet.Cells(y, 16).value
- my_thick1 = xlSheet.Cells(y, 17).value
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- End If
-
-
-
- End If
-
-
- 'sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no1 & "'," & xlSheet.Cells(y, 10).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
-
- End If
-
-
-
- Next
-
-
-
- Next
-
-
-
-
- Sql = "SELECT order_no AS 订单号, i_no AS 指令号, color AS 颜色, thick AS 厚度, cast(SUM(sf) as numeric(10,1)) AS 尺数,deli_no as 发货单号 FROM RT_ship_daily_wh GROUP BY order_no, i_no, color, thick,deli_no ORDER BY 订单号, 指令号, 颜色"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
-
-
-
- dgv1.Columns("颜色").Width = 350
- dgv1.Columns("订单号").Width = 120
-
- 'dt.Columns.Add("尺数")
- 'dt.Columns.Add("货值")
-
- Sql = "SELECT 订单类别, 厚度, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM RT_ship_daily_wh
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 厚度, 类别
- ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv2.DataSource = dt
-
-
- Sql = "SELECT 订单类别, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM RT_ship_daily_wh
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 类别 ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv3.DataSource = dt
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "SAMIL*" Then '--------------------------------
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
-
-
- Dim s1 As Integer = 1
-
-
- 'For i = 1 To xlApp.Worksheets.Count
-
-
- ' If xlApp.Workbooks(1).Worksheets(i).name = "0" Then
- ' Exit For
- ' End If
-
-
-
- 'Next
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
- xlSheet.Activate()
-
-
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:j" & y - 1).Select()
-
-
- xlApp.Selection.UnMerge
-
-
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- s1 = 1
- For y = 2 To y - 1
-
-
-
- sql = "insert into rt_ship_temp_1 (comment,serial,filename,card,name,qty,po_no) values(N'" & xlSheet.Cells(y, 13).value & "','" & s1 & "',N'" & file_name & "','" & xlSheet.Cells(y, 4).value & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 9).value.ToString.Replace("'", " ") & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- s1 = s1 + 1
- Next
-
-
- Sql = "select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from
- (SELECT po_no as 订单号,name as 品名,case when name like '%PU %' or name like '%action%' or name like N'%榔%' or name like N'%virgin%' then 'PU' else '反毛' end as 类别, qty as 数量,
- cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价
- FROM RT_SHIP_DAILY_samil) as p group by 订单号,类别,厚度" '旧
-
-
- Sql = "select name as 品名,po_no as 订单号,cast(sum(qty) as numeric(10,1)) as 尺数,deli_no as 发货单号 from rt_ship_daily_samil group by name,po_no,deli_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- dgv1.Columns("品名").Width = 350
- dgv1.Columns("订单号").Width = 180
-
-
-
-
-
- Sql = "select 类别,sum(尺数),sum(净重),sum(货值) from(select 订单号,类别,cast(sum(数量) as numeric(10,1)) as 尺数,cast(sum(数量*单价) as numeric(10,3)) as 货值,sum(重量) as 净重,厚度 from (SELECT po_no as 订单号,name as 品名,case when name like '%PU %' or name like '% action %' or name like N'%榔%' or name like N'% virgin %' then 'PU' else '反毛' end as 类别, qty as 数量,cast(qty/SUM(qty) OVER (PARTITION BY no) *nw as numeric(10,1)) as 重量,case when left(ltrim(name),3)='1.2' then left(ltrim(name),3) +'4' else '1.46' end as 厚度,unit_price as 单价 FROM RT_SHIP_DAILY_samil) as p group by 订单号,类别,厚度) as q group by 类别"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "宏福1111*" Then '-----------------宏福-----------------PUMA
-
-
- Sql = "select count(*) from rt_ship_daily_hongfu where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
- Sql = "delete from rt_ship_daily_hongfu where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
- Dim conn1 As New SqlConnection
- conn1.ConnectionString = connstring
- conn1.Open()
- Dim cmd1 As New SqlCommand
- cmd1.Connection = conn1
- Dim dr As SqlDataReader
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
-
- Next
-
-
-
-
-
-
- Dim y As Integer = 0
- For y = 4 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A4:v" & y - 1).Select()
- 'If xlApp.Selection.mergecells = True Then
-
- xlApp.Selection.UnMerge
- xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- xlApp.CutCopyMode = False
- xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- For y = 4 To y - 1
-
- Sql = "insert into rt_ship_daily_puma (no,name,color,qty_sf,gw1,po_no,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 4).value & "'," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 12).value & ",N'" & xlSheet.Cells(y, 14).value & "',N'" & xlSheet.Cells(y, 20).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "insert into rt_ship_temp_1 (no,name,color,qty_sf,gw1,po_no,unit_price) values('" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "',N'" & xlSheet.Cells(y, 4).value & "'," & xlSheet.Cells(y, 5).value & "," & xlSheet.Cells(y, 12).value & ",N'" & xlSheet.Cells(y, 14).value & "',N'" & xlSheet.Cells(y, 20).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
- Sql = "select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,2)) as 货值,po_no as 订单号,sum(重量) as 毛重, sum(袋重) as 袋重,sum(重量)-sum(袋重) as 净重 from
- (select no,name,qty_sf,unit_price,po_no,gw1,cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,2)) as 重量,cast(pa/SUM(pa) OVER (PARTITION BY no)*0.1 as numeric(10,2)) as 袋重 from
- (select no,name,color,qty_sf,unit_price,po_no,gw1,cast(count as numeric(10,1)) as pa from
- (SELECT no, name,case when name<>'' then 1 end as count, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,1)) as weight
- FROM RT_SHIP_DAILY_PUMA) as r) as s) as t group by name,po_no order by 品名,po_no"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
-
-
-
- Sql = "select 品名,sum(尺数) as 尺数,cast(sum(净重) as numeric(10,1)) as 淨重 from(select case when (品名 like '%PU%' or 品名 like '%action%' or 品名 like N'%榔%') and 品名 not like '%puma%' then 'pu' else '反毛' end as 品名,尺数,净重 from
- (select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,2)) as 货值,po_no as 订单号,sum(重量) as 毛重, sum(袋重) as 袋重,sum(重量)-sum(袋重) as 净重 from
- (select no,name,qty_sf,unit_price,po_no,gw1,cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,2)) as 重量,cast(pa/SUM(pa) OVER (PARTITION BY no)*0.1 as numeric(10,3)) as 袋重 from
- (select no,name,color,qty_sf,unit_price,po_no,gw1,cast(count as numeric(10,2)) as pa from
- (SELECT no, name,case when name<>'' then 1 end as count, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,2)) as weight
- FROM RT_SHIP_DAILY_PUMA) as r) as s) as t group by name,po_no) as u) as v group by 品名"
-
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv2.DataSource = dt
-
-
-
-
-
-
- ' sql = "select name as 品名,cast(sum(qty_sf) as numeric(10,1)) as 尺数,cast(sum(qty_sf*unit_price) as numeric(10,1)) as 总价,sum(weight) as 淨重 from (SELECT no, name, color, qty_sf, gw1, po_no, unit_price, cast(qty_sf/SUM(qty_sf) OVER (PARTITION BY no) *gw1 as numeric(10,1)) as weight
- 'FROM RT_SHIP_DAILY_PUMA) as p group by name"
-
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
-
-
-
-
-
-
-
-
-
-
- 'sql = ""
-
-
- 'cmd.CommandText = sql
- 'dt = New DataTable
- 'da.SelectCommand = cmd
- 'da.Fill(dt)
-
-
- 'dgv2.DataSource = dt
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "穎億*" Then '-------------------------
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- If xlApp.Workbooks(1).Worksheets(i).name = "0" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
- Next
-
- Dim y As Integer = 0
- For y = 2 To xlApp.ActiveSheet.UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- 'xlApp.Range("A2:k" & y - 1).Select()
- ''If xlApp.Selection.mergecells = True Then
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- For y = 2 To y - 1
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,no,name,qty,
- po_no,work_no) values(N'" & file_name & "','" & xlSheet.Cells(y, 1).value & "',N'" & xlSheet.Cells(y, 2).value & "','" & xlSheet.Cells(y, 3).value & "',N'" &
- xlSheet.Cells(y, 8).value & "',N'" & xlSheet.Cells(y, 9).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Next
-
-
-
-
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "澳孚*" Then '------------------------------------
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
-
- xlSheet = xlApp.Workbooks(1).Worksheets(1)
-
- Dim y As Integer = 0
- For y = 2 To xlApp.Workbooks(1).Worksheets(1).UsedRange.Rows.Count
-
- If Len(xlSheet.Cells(y, 2).value) < 1 Then
- Exit For
- End If
-
- Next y
-
-
- xlApp.Range("A2:l" & y - 1).Select()
- ' If xlApp.Selection.mergecells = True Then
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- ' End If
-
- Dim my_no As String
- Dim my_nw As Double
- Dim my_gw As Double
- Dim my_sf As Double
- Dim my_price As Double
-
- Dim s1 As Integer = 0
-
- For y = 2 To y - 1
-
- 'If Not (xlSheet.Cells(y, 9).value Is Nothing) Then
-
- 'If (xlSheet.Cells(y, 5).value Is Nothing) And (xlSheet.Cells(y, 6).value Is Nothing) Then
- ' my_nw = xlSheet.Cells(y - 1, 5).value
- ' my_gw = xlSheet.Cells(y - 1, 6).value
- ' my_no = xlSheet.Cells(y - 1, 1).value
-
-
- 'Else
- ' my_nw = xlSheet.Cells(y, 5).value
- ' my_gw = xlSheet.Cells(y, 6).value
- ' my_no = xlSheet.Cells(y, 1).value
-
-
- 'End If
- my_sf = xlSheet.Cells(y, 4).value
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,serial,no,name,qty,
- po_no,work_no) values(N'" & file_name & "','" & s1 & "','" &
- my_no & "',N'" & xlSheet.Cells(y, 2).value & "'," & xlSheet.Cells(y, 3).value & ",N'" & xlSheet.Cells(y, 8).value & "','" & xlSheet.Cells(y, 9).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- ' End If
-
- Next
-
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "极路客*" Then '--------------------------------------------极路客
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
- Dim s1 As Integer = 1
- Dim s11 As Integer = 1001
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
-
- Dim y As Integer
- For y = xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count To 3 Step -1
-
- If xlSheet.Cells(y, 1).value = Nothing Then
- GoTo OK3
- End If
-
- If xlSheet.Cells(y, 5).value.ToString = "重量总计:" Then
- Exit For
- End If
-
-
- Next y
-
- OK3:
-
- Dim yyy As Integer
-
- For yyy = 3 To xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count
-
- If xlSheet.Cells(yyy, 7).value Is Nothing And xlSheet.Cells(yyy, 8).value Is Nothing Then
- Exit For
- End If
-
-
- Next yyy
-
-
- 'xlSheet.Range("A3:A" & y - 1).Select()
-
- 'xlApp.Selection.UnMerge
- ''xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- ''xlApp.CutCopyMode = False
- ''xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'xlSheet.Range("d3:e" & y - 1).Select()
-
- 'xlApp.Selection.UnMerge
- ''xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- ''xlApp.CutCopyMode = False
- ''xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- 'xlSheet.Range("j3:M" & yyy - 1).Select()
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- 'If xlSheet.Range("N3:Q" & yyy - 1).MergeCells.ToString <> "False" Then
-
- ' xlSheet.Range("N3:Q" & yyy - 1).Select()
-
- ' xlApp.Selection.UnMerge
- ' 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- ' 'xlApp.CutCopyMode = False
- ' 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- 'End If
-
-
- Dim my_no As String
- Dim my_po As String
- Dim my_work As String
- Dim my_color As String
- Dim my_thick As String
- Dim my_no1 As String
- Dim my_po1 As String
- Dim my_work1 As String
- Dim my_color1 As String
- Dim my_thick1 As String
- Dim my_card As String
-
-
- For y = 3 To y - 1
-
-
- If y = 3 Then
-
-
- my_no = xlSheet.Cells(y, 1).value
- my_color = xlSheet.Cells(y, 5).value
- my_thick = xlSheet.Cells(y, 6).value
- my_card = xlSheet.Cells(y, 3).value
-
- my_no1 = xlSheet.Cells(y, 7).value
- my_color1 = xlSheet.Cells(y, 12).value
- my_thick1 = xlSheet.Cells(y, 13).value
-
-
-
-
- End If
-
-
-
-
-
- If xlSheet.Cells(y, 2).value = Nothing And xlSheet.Cells(y, 5).value = Nothing And xlSheet.Cells(y, 6).value = Nothing Then
- ' Exit For
- Else
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
-
-
-
-
- If xlSheet.Cells(y, 5).value Is Nothing And xlSheet.Cells(y, 6).value Is Nothing Then
- Else
-
- my_card = xlSheet.Cells(y, 3).value
- my_color = xlSheet.Cells(y, 5).value
- my_thick = xlSheet.Cells(y, 6).value
-
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,qty,color1,thick,PO_NO) values(N'" &
- file_name & "','" & my_card & "','" & s1 & "','" & xlSheet.Cells(y, 2).value & "',N'" & my_color & "','" & my_thick & "','" & xlSheet.Cells(y, 4).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- End If
- End If
-
-
-
-
-
-
-
- If xlSheet.Cells(y, 9).value = Nothing And xlSheet.Cells(y, 12).value = Nothing And xlSheet.Cells(y, 13).value = Nothing Then
- ' Exit For
- Else
- If xlSheet.Cells(y, 9).value Is Nothing Then
- Else
-
-
-
- If xlSheet.Cells(y, 12).value Is Nothing And xlSheet.Cells(y, 13).value Is Nothing Then
- Else
-
-
- my_color1 = xlSheet.Cells(y, 12).value
- my_thick1 = xlSheet.Cells(y, 13).value
-
-
-
-
- End If
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,color1,thick,PO_NO) values(N'" &
- file_name & "','" & xlSheet.Cells(y, 10).value & "','" & s11 & "','" & my_no1 & "','" & xlSheet.Cells(y, 9).value & "',N'" & my_color1 & "','" & my_thick1 & "','" & xlSheet.Cells(y, 11).value & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
-
-
- End If
- End If
-
-
-
-
-
-
-
- Next
-
-
-
- Next
-
-
-
-
- Sql = "SELECT color as 颜色,thick as 厚度,sum(qty) as 尺数,deli_no as 发货单号 from rt_ship_daily_jlk group by color,thick,deli_no "
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- dgv1.DataSource = dt
-
- 'dt.Columns.Add("尺数")
- 'dt.Columns.Add("货值")
-
- ' sql = "SELECT 订单类别, 厚度, SUM(尺数) AS 尺数, 类别
- 'FROM (SELECT CASE WHEN LEFT(order_no, 2)
- ' = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- ' i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- ' CASE WHEN color LIKE '%pu%' OR
- ' color LIKE '%action%' OR
- ' color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- ' FROM RT_ship_daily_wh
- ' GROUP BY order_no, i_no, color, thick) AS p
- 'GROUP BY 订单类别, 厚度, 类别
- 'ORDER BY 订单类别"
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
- ' dgv2.DataSource = dt
-
-
- ' sql = "SELECT 订单类别, SUM(尺数) AS 尺数, 类别
- 'FROM (SELECT CASE WHEN LEFT(order_no, 2)
- ' = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- ' i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- ' CASE WHEN color LIKE '%pu%' OR
- ' color LIKE '%action%' OR
- ' color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- ' FROM RT_ship_daily_wh
- ' GROUP BY order_no, i_no, color, thick) AS p
- 'GROUP BY 订单类别, 类别 ORDER BY 订单类别"
- ' cmd.CommandText = sql
- ' dt = New DataTable
- ' da.SelectCommand = cmd
- ' da.Fill(dt)
- ' dgv3.DataSource = dt
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*永驰*" Then '------------------------------------------------
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
- Dim my_total_weight As Double = 0
-
- Dim s1 As Integer = 1
- Dim s11 As Integer = 1001
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
- Dim y As Integer
- For y = xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count To 3 Step -1
-
- If xlSheet.Cells(y, 1).value = Nothing Then
-
- If xlSheet.Cells(y, 2).value = "数量合计" Then
-
-
-
- End If
-
-
- GoTo OK
- End If
-
- If xlSheet.Cells(y, 1).value.ToString = "数量合计" Then
- Exit For
- End If
- OK:
-
- Next y
-
- Dim yyy As Integer
-
- For yyy = 3 To xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count
-
- If xlSheet.Cells(yyy, 14).value = "制 表" Then
- Exit For
- End If
-
-
- Next yyy
-
-
-
- If xlSheet.Cells(y + 2, 2).value Like "重量*" Then
-
- Dim q() As String
- Dim r() As String
-
- q = Split(xlSheet.Cells(y + 2, 2).value, "重量")
- r = Split(q(1), "KG")
-
- If IsNumeric(r(0)) Then
- Else
-
- r = Split(q(1), "kg")
-
- If IsNumeric(r(0)) Then
- Else
-
- r = Split(q(1), "Kg")
- End If
-
-
-
- End If
-
-
-
-
- 'my_total_weight = r(0)
-
-
-
-
- End If
-
-
-
- xlSheet.Range("A3:A" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- 'xlSheet.Range("c3:c" & y - 1).Select()
-
- 'xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- xlSheet.Range("d3:g" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- xlSheet.Range("N3:Q" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- If xlSheet.Range("K3:s" & yyy - 1).MergeCells.ToString <> "False" Then
-
- xlSheet.Range("K3:s" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- End If
-
- Dim my_card1 As String
- Dim my_card As String
- Dim my_no As String
- Dim my_po As String
- Dim my_work As String
- Dim my_color As String
- Dim my_thick As String
- Dim my_no1 As String
- Dim my_po1 As String
- Dim my_work1 As String
- Dim my_color1 As String
- Dim my_thick1 As String
-
-
-
-
-
- For y = 3 To y - 1
-
- If y = 3 Then
-
- my_card = xlSheet.Cells(3, 3).value
- my_po = xlSheet.Cells(3, 4).value
- my_work = xlSheet.Cells(3, 5).value
- my_color = xlSheet.Cells(3, 6).value
- my_thick = xlSheet.Cells(3, 7).value
-
- my_card1 = xlSheet.Cells(3, 13).value
- my_po1 = xlSheet.Cells(3, 14).value
- my_work1 = xlSheet.Cells(3, 15).value
- my_color1 = xlSheet.Cells(3, 16).value
- my_thick1 = xlSheet.Cells(3, 17).value
-
-
- End If
-
-
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
- If xlSheet.Cells(y, 6).VALUE Is Nothing Then '颜色为空
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,order_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Else
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
- my_po = xlSheet.Cells(y, 4).value
- my_work = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,order_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- End If
- End If
-
-
-
-
-
-
- If xlSheet.Cells(y, 12).value Is Nothing Then
- Else
-
- If xlSheet.Cells(y, 16).VALUE Is Nothing Then '颜色为空
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
-
-
-
-
- End If
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,order_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- Else
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
- End If
-
-
-
- my_po1 = xlSheet.Cells(y, 14).value
- my_work1 = xlSheet.Cells(y, 15).value
- my_color1 = xlSheet.Cells(y, 16).value
- my_thick1 = xlSheet.Cells(y, 17).value
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,order_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- End If
-
-
-
- End If
-
-
- 'sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no1 & "'," & xlSheet.Cells(y, 10).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
-
-
-
-
-
- Next
-
-
-
- Next
-
-
-
-
-
-
-
- Sql = "SELECT order_no AS 订单号, i_no AS 指令号, color AS 颜色, thick AS 厚度, cast(SUM(sf) as numeric(10,1)) AS 尺数 FROM rt_ship_daily_yongchi GROUP BY order_no, i_no, color, thick ORDER BY 订单号, 指令号, 颜色"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dt.Columns.Add("发货单号")
-
- dgv1.DataSource = dt
-
-
- 'dt.Columns.Add("货值")
-
- Sql = "SELECT 订单类别, 厚度, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM rt_ship_daily_yongchi
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 厚度, 类别
- ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv2.DataSource = dt
-
-
- Sql = "SELECT 订单类别, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM rt_ship_daily_yongchi
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 类别 ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv3.DataSource = dt
-
-
-
- sql = "update rt_ship_temp_1 set name=color where filename like N'%永驰%'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "*铭鑫*" Then '------------------------------------------------
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
-
-
-
-
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
-
- Dim my_total_weight As Double = 0
-
- Dim s1 As Integer = 1
- Dim s11 As Integer = 1001
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
-
-
-
-
-
-
-
-
-
- Dim my_card1 As String
- Dim my_card As String
- Dim my_no As String
- Dim my_po As String
- Dim my_work As String
- Dim my_color As String
- Dim my_thick As String
- Dim my_no1 As String
- Dim my_po1 As String
- Dim my_work1 As String
- Dim my_color1 As String
- Dim my_thick1 As String
-
-
-
-
-
- For y = 2 To xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count
-
- If y = 2 Then
-
- ' my_card = xlSheet.Cells(3, 3).value
- my_po = xlSheet.Cells(y, 5).value
- ' my_work = xlSheet.Cells(3, 5).value
- my_color = xlSheet.Cells(y, 2).value
- my_thick = xlSheet.Cells(y, 3).value
-
- ' my_card1 = xlSheet.Cells(y, 13).value
- my_po1 = xlSheet.Cells(y, 10).value
- ' my_work1 = xlSheet.Cells(y, 15).value
- my_color1 = xlSheet.Cells(y, 7).value
- my_thick1 = xlSheet.Cells(y, 8).value
-
-
- End If
-
-
-
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
-
-
- sql = "insert into rt_ship_temp_1 (filename,serial,no,qty,order_no,work_no,color,thick) values(N'" & file_name & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 4).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
-
- End If
-
-
-
-
-
-
- If xlSheet.Cells(y, 7).value Is Nothing Then
- Else
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,serial,no,sf,order_no,work_no,color,thick) values(N'" & file_name & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 9).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
-
-
-
-
- End If
-
-
- 'sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no1 & "'," & xlSheet.Cells(y, 10).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
-
-
-
-
-
- Next
-
-
-
- Next
-
-
-
-
-
-
-
- Sql = "SELECT order_no AS 订单号, i_no AS 指令号, color AS 颜色, thick AS 厚度, cast(SUM(sf) as numeric(10,1)) AS 尺数 FROM rt_ship_daily_yongchi GROUP BY order_no, i_no, color, thick ORDER BY 订单号, 指令号, 颜色"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dt.Columns.Add("发货单号")
-
- dgv1.DataSource = dt
-
-
- 'dt.Columns.Add("货值")
-
- Sql = "SELECT 订单类别, 厚度, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM rt_ship_daily_yongchi
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 厚度, 类别
- ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv2.DataSource = dt
-
-
- Sql = "SELECT 订单类别, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM rt_ship_daily_yongchi
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 类别 ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv3.DataSource = dt
-
-
-
- sql = "update rt_ship_temp_1 set name=color where filename like N'%永驰%'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
-
- ElseIf OpenFileDialog1.SafeFileName Like "076*" Then '------------------------076
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = Sql
- Dim msg As String
- If cmd.ExecuteScalar > 0 Then
-
- msg = MsgBox("资料已经存在,是否要覆盖?", MsgBoxStyle.YesNo, "警告")
-
-
- If msg = vbNo Then
-
- Exit Sub
-
-
- End If
-
- End If
-
-
- If msg = vbYes Then
-
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & file_name & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
- End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
- xlBook = xlApp.Workbooks.Open(file_name,, True)
- xlBook.Activate()
-
-
- Dim my_total_weight As Double = 0
-
- Dim s1 As Integer = 1
- Dim s11 As Integer = 1001
-
- For i = 1 To xlApp.Worksheets.Count
-
- xlSheet = xlApp.Worksheets(i)
- xlSheet.Activate()
-
- Dim y As Integer
- For y = xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count To 3 Step -1
-
- If xlSheet.Cells(y, 1).value = Nothing Then
-
- If xlSheet.Cells(y, 2).value = "重量" Then
-
-
-
- End If
-
-
- GoTo OK6
- End If
-
- If xlSheet.Cells(y, 1).value.ToString = "数量合计" Then
- Exit For
- End If
- OK6:
-
- Next y
-
- Dim yyy As Integer
-
- For yyy = 3 To xlApp.Workbooks(1).Worksheets(i).UsedRange.Rows.Count
-
- If xlSheet.Cells(yyy, 14).value = "制 表" Then
- Exit For
- End If
-
-
- Next yyy
-
-
-
- If xlSheet.Cells(y + 2, 2).value Like "重量*" Then
-
- Dim q() As String
- Dim r() As String
-
- q = Split(xlSheet.Cells(y + 2, 2).value, "重量")
- r = Split(q(1), "KG")
-
- If IsNumeric(r(0)) Then
- Else
-
- r = Split(q(1), "kg")
-
- If IsNumeric(r(0)) Then
- Else
-
- r = Split(q(1), "Kg")
- End If
-
-
-
- End If
-
-
-
-
- 'my_total_weight = r(0)
-
-
-
-
- End If
-
-
-
- xlSheet.Range("A3:A" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
- xlSheet.Range("c3:g" & y - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- xlSheet.Range("N3:Q" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
- If xlSheet.Range("K3:L" & yyy - 1).MergeCells.ToString <> "False" Then
-
- xlSheet.Range("K3:L" & yyy - 1).Select()
-
- xlApp.Selection.UnMerge
- 'xlApp.Selection.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeBlanks).Select
- 'xlApp.CutCopyMode = False
- 'xlApp.Selection.FormulaR1C1 = "=R[-1]C"
-
-
-
- End If
-
-
- Dim my_card As String
- Dim my_no As String
- Dim my_po As String
- Dim my_work As String
- Dim my_color As String
- Dim my_thick As String
- Dim my_no1 As String
- Dim my_po1 As String
- Dim my_work1 As String
- Dim my_color1 As String
- Dim my_thick1 As String
-
-
-
-
- For y = 3 To y - 1
-
- If y = 3 Then
-
- my_po = xlSheet.Cells(y, 4).value
- my_work = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
- my_po1 = xlSheet.Cells(y, 14).value
- my_work1 = xlSheet.Cells(y, 15).value
- my_color1 = xlSheet.Cells(y, 16).value
- my_thick1 = xlSheet.Cells(y, 17).value
-
- End If
-
-
- If xlSheet.Cells(y, 2).value = Nothing And xlSheet.Cells(y, 4).value = Nothing And xlSheet.Cells(y, 5).value = Nothing And xlSheet.Cells(y, 6).value = Nothing And xlSheet.Cells(y, 7).value = Nothing Then
- ' Exit For
- Else
- If xlSheet.Cells(y, 2).value Is Nothing Then
- Else
- If xlSheet.Cells(y, 4).VALUE Is Nothing Then
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- Else
-
- If xlSheet.Cells(y, 1).value Is Nothing Then
-
- Else
- my_no = xlSheet.Cells(y, 1).value
- End If
-
-
- my_po = xlSheet.Cells(y, 4).value
- my_work = xlSheet.Cells(y, 5).value
- my_color = xlSheet.Cells(y, 6).value
- my_thick = xlSheet.Cells(y, 7).value
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 3).value & "','" & s1 & "','" & my_no & "'," & xlSheet.Cells(y, 2).value & ",N'" & my_po & "',N'" & my_work & "',N'" & my_color & "','" & my_thick & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s1 = s1 + 1
-
- End If
- End If
- End If
-
-
-
- If xlSheet.Cells(y, 12).value = Nothing And xlSheet.Cells(y, 14).value = Nothing And xlSheet.Cells(y, 15).value = Nothing And xlSheet.Cells(y, 16).value = Nothing And xlSheet.Cells(y, 17).value = Nothing Then
-
- ' Exit For
- Else
-
- If xlSheet.Cells(y, 12).value Is Nothing Then
- Else
-
- If xlSheet.Cells(y, 14).VALUE Is Nothing Then
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
- End If
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- Else
- If xlSheet.Cells(y, 11).value Is Nothing Then
- Else
- my_no1 = xlSheet.Cells(y, 11).value
- End If
-
- my_po1 = xlSheet.Cells(y, 14).value
- my_work1 = xlSheet.Cells(y, 15).value
- my_color1 = xlSheet.Cells(y, 16).value
- my_thick1 = xlSheet.Cells(y, 17).value
-
-
- sql = "insert into rt_ship_temp_1 (filename,card,serial,no,qty,po_no,work_no,color1,thick) values(N'" & file_name & "','" & xlSheet.Cells(y, 13).value & "','" & s11 & "','" & my_no1 & "'," & xlSheet.Cells(y, 12).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- s11 = s11 + 1
-
- End If
-
-
-
- End If
-
-
- 'sql = "insert into rt_ship_076_1 (no,sf,order_no,i_no,color,thick) values('" & my_no1 & "'," & xlSheet.Cells(y, 10).value & ",N'" & my_po1 & "',N'" & my_work1 & "',N'" & my_color1 & "','" & my_thick1 & "')"
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
-
- End If
-
-
-
- Next
-
-
-
- Next
-
-
-
-
-
-
-
- Sql = "SELECT order_no AS 订单号, i_no AS 指令号, color AS 颜色, thick AS 厚度, cast(SUM(sf) as numeric(10,1)) AS 尺数 FROM RT_ship_076_1 GROUP BY order_no, i_no, color, thick ORDER BY 订单号, 指令号, 颜色"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dt.Columns.Add("发货单号")
-
- dgv1.DataSource = dt
-
-
- 'dt.Columns.Add("货值")
-
- Sql = "SELECT 订单类别, 厚度, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM RT_ship_076_1
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 厚度, 类别
- ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv2.DataSource = dt
-
-
- Sql = "SELECT 订单类别, SUM(尺数) AS 尺数, 类别
- FROM (SELECT CASE WHEN LEFT(order_no, 2)
- = 'RT' THEN N'人民币' WHEN order_no LIKE 'SX%' THEN '美元' ELSE order_no END AS 订单类别,
- i_no AS 指令号, color AS 颜色, thick AS 厚度, CAST(SUM(sf) AS numeric(10, 1)) AS 尺数,
- CASE WHEN color LIKE '%pu%' OR
- color LIKE '%action%' OR
- color LIKE N'%纹%' THEN 'PU' ELSE '反毛' END AS 类别
- FROM RT_ship_076_1
- GROUP BY order_no, i_no, color, thick) AS p
- GROUP BY 订单类别, 类别 ORDER BY 订单类别"
- cmd.CommandText = Sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv3.DataSource = dt
-
-
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
- 'sql = ""
- 'cmd.CommandText = sql
- 'dt.Rows(rr).Item("尺数") = cmd.ExecuteScalar
- Next
-
-
-
- For rr As Integer = 0 To dt.Rows.Count - 1
- 'sql = ""
- 'cmd.CommandText = sql
- 'dt.Rows(rr).Item("货值") = cmd.ExecuteScalar
- Next
- 'DataGridView1.DataSource = dt
-
-
- Else
-
- MsgBox("找不到相对应的模组")
- Exit Sub
-
- End If
-
-
-
- sql = "update rt_ship_temp_1 set comment='' where comment is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
-
-
-
-
-
-
-
-
- xlApp.Visible = True
-
-
- xlApp.Quit()
-
- xlSheet = Nothing '釋放sheet物件
-
-
- ' xlApp.Quit() '關閉Excel
-
-
-
-
-
- KillExcel(xlApp)
-
-
-
-
- update() '更新资料
-
- 'Button3.PerformClick()
- 'Button6.PerformClick()
-
-
- sql = "update rt_ship_temp_1 set thick=1.24 where name like '%1.2-%' and thick is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set thick=1.46 where name like '%1.4-%' and thick is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set name=color1 where name is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "select filename,cast(sum(qty) as numeric(10,1)) as 尺数 from rt_ship_temp_1 group by filename,update_date order by update_date desc"
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
- DataGridView1.DataSource = Nothing
- DataGridView1.DataSource = dt1
-
-
- MsgBox("作业完成")
- End Sub
- Private Sub KillExcel(ByVal objExcel As Object)
- Try
- If objExcel IsNot Nothing Then
- Dim lProcessIdAddr As Integer
- Dim iPID As Integer
- iPID = GetWindowThreadProcessId(objExcel.Hwnd, lProcessIdAddr)
- System.Diagnostics.Process.GetProcessById(lProcessIdAddr).Kill()
- End If
- Catch ex As Exception
-
- End Try
- End Sub
-
- Private Sub Frm_Ship_daily_1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
-
- dgv_edit.SelectionMode = DataGridViewSelectionMode.FullRowSelect
-
- dgv1.AllowUserToAddRows = False
- DataGridView2.AllowUserToAddRows = False
- DataGridView2.SelectionMode = DataGridViewSelectionMode.FullRowSelect
-
- chkZhiDan.Items.Add("陈立雄")
- chkZhiDan.Items.Add("尤珊荣")
- chkZhiDan.Items.Add("郑春玉")
- chkZhiDan.Items.Add("陈建超")
- chkZhiDan.Items.Add("蔡春燕")
- chkZhiDan.Items.Add("叶以")
-
- chkZhiDan.Items.Add("蔡青山")
- chkZhiDan.Items.Add("许燕江")
- chkZhiDan.SelectionMode = SelectionMode.One
-
-
- chkSongHuo.Items.Add("许智富")
- chkSongHuo.Items.Add("蔡青山")
-
-
- chkSongHuo.SelectionMode = SelectionMode.One
-
-
-
-
- conn.ConnectionString = connstring
- conn.Open()
- cmd.Connection = conn
-
- '---------------------------------------------------------------------------更新
- sql = "update rt_ship_temp_1 set update_date=getdate() where date is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "update rt_ship_temp_1 set work_no='' where work_no is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set color1=name where len(color1)<2 "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "UPDATE rt_ship_temp_1
- SET source1 = p.Expr1
- FROM (SELECT card1, source AS Expr1
- FROM RT_RETAN_RECORD
- ) AS p INNER JOIN
- rt_ship_temp_1 ON p.card1 = rt_ship_temp_1.card"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "update rt_ship_temp_1 set source1=N'信德' where right(card,2)= 'WB'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "update rt_ship_temp_1 set source1=N'外购小皮' where right(card,1)= 'W'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
- sql = "select top(1) date from rt_ship_temp_1 order by date desc"
- cmd.CommandText = sql
- TextBox8.Text = cmd.ExecuteScalar
-
- sql = "select top(1) date from rt_measure_daily order by date desc"
- cmd.CommandText = sql
- TextBox7.Text = cmd.ExecuteScalar
-
-
- sql = "SELECT rt_ship_temp_1.date, rt_ship_temp_1.custname, rt_ship_temp_1.name, rt_ship_temp_1.card AS 卡号,
- CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 销售数量, CAST(AVG(rt_finish_stock.sf) AS numeric(10, 1))
- AS 即时库存, CAST(AVG(rt_finish_stock.sf) AS numeric(10, 1)) - CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 结存,
- rt_finish_stock.code AS 代码, rt_finish_stock.name AS 品名
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- WHERE (rt_ship_temp_1.date BETWEEN '2024/6/18' AND '2024/6/30')
- GROUP BY rt_ship_temp_1.card, rt_finish_stock.code, rt_finish_stock.name, rt_ship_temp_1.date, rt_ship_temp_1.custname,
- rt_ship_temp_1.name
- ORDER BY 结存"
-
- DateTimePicker3.Value = "2024/6/18"
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
-
- dgv_bal.DataSource = dt1
-
-
-
-
- sql = "update rt_ship_temp_1 set comment='' where comment is null"
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "update rt_ship_temp_1 set comment='' where comment is null"
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- update()
-
- End Sub
-
- Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
- If DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*上杰*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*宏美发*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*永正*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*宏福*" Then '---加order_item
- sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,order_item as 项次号, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,order_item,deli,deli_no"
-
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- rt_ship_temp_1.work_no AS 指令号,order_item as 项次号,CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.order_item, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- rt_ship_temp_1.order_item AS 项次号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.order_item, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- If DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*上杰*" Then
- sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,order_item as 项次号, cast(sum(qty) as numeric(10,1)) as 尺数,comment as 备注,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,order_item,comment,deli,deli_no"
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- rt_ship_temp_1.work_no AS 指令号,order_item as 项次号,CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数, rt_ship_temp_1.comment as 备注,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.comment,rt_ship_temp_1.order_item, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- rt_ship_temp_1.order_item AS 项次号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.order_item, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- End If
-
-
-
-
- ElseIf DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*076样*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*好兄弟*" Then '-----加comment
-
- sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,comment as 备注, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,comment,deli_no,deli"
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- rt_ship_temp_1.work_no AS 指令号,comment as 备注, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.comment, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,comment as 备注,
- CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.comment, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- Else '---其他
-
- sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,deli_no,deli"
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- rt_ship_temp_1.work_no AS 指令号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- FROM rt_ship_temp_1 LEFT OUTER JOIN
- rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.deli, rt_finish_stock.name"
- End If
-
-
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
- DataGridView2.DataSource = Nothing
- DataGridView2.DataSource = dt1
-
- DataGridView2.Columns(0).Width = 550
- DataGridView2.Columns(1).Width = 100
- DataGridView2.Columns(2).Width = 70
- DataGridView2.Columns(3).Width = 150
- DataGridView2.Columns(5).Width = 150
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ' If DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*上杰*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*宏美发*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*永正*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*宏福*" Then '---加order_item
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,order_item as 项次号, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,order_item,deli,deli_no"
-
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号,order_item as 项次号,CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.order_item, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- ' rt_ship_temp_1.order_item AS 项次号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.order_item, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- ' If DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*上杰*" Then
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,order_item as 项次号, cast(sum(qty) as numeric(10,1)) as 尺数,comment as 备注,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,order_item,comment,deli,deli_no"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号,order_item as 项次号,CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数, rt_ship_temp_1.comment as 备注,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.comment,rt_ship_temp_1.order_item, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- ' rt_ship_temp_1.order_item AS 项次号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.order_item, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- ' End If
-
-
-
-
- ' ElseIf DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*076样*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*好兄弟*" Then '-----加comment
-
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,comment as 备注, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,comment,deli_no,deli"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号,comment as 备注, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.comment, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,comment as 备注,
- ' CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.comment, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- ' Else '---其他
-
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,deli_no,deli"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- ' CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.deli, rt_finish_stock.name"
- ' End If
-
-
-
- ' cmd.CommandText = sql
- ' da.SelectCommand = cmd
- ' dt1 = New DataTable
- ' da.Fill(dt1)
- ' DataGridView2.DataSource = Nothing
- ' DataGridView2.DataSource = dt1
-
- ' DataGridView2.Columns(0).Width = 400
- ' DataGridView2.Columns(1).Width = 200
- ' DataGridView2.Columns(3).Width = 200
-
-
-
- End Sub
- Private Sub update()
-
- sql = "update rt_ship_temp_1 set name=color1 where name is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set work_no='' where work_no is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "select filename,cast(sum(qty) as numeric(10,1)) as 尺数 from rt_ship_temp_1 group by filename,update_date order by update_date desc"
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
- DataGridView1.DataSource = Nothing
- DataGridView1.DataSource = dt1
-
-
- DataGridView1.Columns(0).Width = 350
- DataGridView1.RowHeadersWidth = 25
-
- DataGridView1.Rows(0).Selected = False
-
-
-
-
-
- End Sub
-
- Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
-
- xlApp = CreateObject("Excel.Application")
-
-
-
- xlBook = xlApp.Workbooks.Add
-
- xlApp.Visible = True
- 'xlApp.DisplayAlerts = False
-
- xlBook.Activate()
- xlBook.Parent.Windows(1).Visible = True
-
-
- xlSheet = xlBook.Worksheets(1)
- xlSheet.Name = "反毛皮"
-
- xlApp.DisplayAlerts = False
-
- sql = "select date as 日期,custname as 客户,deli_no as 发货单号,replace(color1,char(10),'') as 颜色,cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人 from rt_ship_temp_1
- where DATE BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and pattern is null group by date,custname,deli_no,color1,deli"
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
-
- dgv_1.DataSource = dt1
- dgv_1.SelectAll()
- Me.dgv_1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
- Me.dgv_1.RowHeadersVisible = False
-
- Clipboard.SetDataObject(dgv_1.GetClipboardContent())
-
-
-
-
-
- xlSheet.Cells(4, 2).PasteSpecial()
- Clipboard.SetDataObject(DBNull.Value)
-
- xlApp.ActiveSheet.ListObjects.Add(Microsoft.Office.Interop.Excel.XlListObjectSourceType.xlSrcRange, xlApp.Range("B4:g" & dt1.Rows.Count + 3 + 1), , Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes).Name = "表1"
-
-
-
- sql = "select deli as 发货人,cast(sum(qty) as numeric(10,1)) as 尺数 from rt_ship_temp_1 where DATE BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and pattern is null group by deli "
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
-
- dgv_2.DataSource = dt1
- dgv_2.SelectAll()
- Me.dgv_2.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
- Me.dgv_2.RowHeadersVisible = False
-
- Clipboard.SetDataObject(dgv_2.GetClipboardContent())
-
- xlApp.Cells(4, 10).Select()
-
-
- xlSheet.PasteSpecial()
- Clipboard.SetDataObject(DBNull.Value)
-
- xlApp.ActiveSheet.ListObjects.Add(Microsoft.Office.Interop.Excel.XlListObjectSourceType.xlSrcRange, xlApp.Range("J4:K" & dt1.Rows.Count + 3 + 1), , Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes).Name = "表2"
-
- xlSheet.Columns("b:b").ColumnWidth = 22
- xlSheet.Columns("c:c").ColumnWidth = 25
- xlSheet.Columns("d:d").ColumnWidth = 25
- xlSheet.Columns("e:e").ColumnWidth = 40
-
- ' xlApp.Columns("f:k").NumberFormatLocal = "#,###.0_ ;[红色]-0.0 "
- xlApp.Columns("b:k").EntireColumn.AutoFit
-
-
- xlApp.Columns("b:b").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("d:d").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("g:g").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
-
-
-
- PTCache = xlBook.PivotCaches.Add _
- (SourceType:=Microsoft.Office.Interop.Excel.XlPivotTableSourceType.xlDatabase,
- SourceData:=xlSheet.Range("b4:g123").CurrentRegion.Address)
-
- PT = PTCache.CreatePivotTable _
- (TableDestination:=xlSheet.Cells(4, 13),
- TableName:="PivotTable1")
-
- With PT
- .PivotFields("日期").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlColumnField
- .PivotFields("客户").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlRowField
- .PivotFields("尺数").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlDataField
- End With
-
- xlSheet.PivotTables("PivotTable1").TableStyle2 = "PivotStyleMedium9"
-
- '----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- xlSheet = xlBook.Worksheets.Add()
- xlSheet.Name = "全部"
-
- xlApp.DisplayAlerts = False
-
- sql = "select date as 日期,custname as 客户, po_no as 订单号, order_item as 项次号, replace(name,char(10),'') as 品名,thick as 厚度, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号,card as 卡号,source1 as 皮源 from rt_ship_temp_1
- where DATE BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' group by date,custname,po_no,order_item,thick,deli_no,name,deli,card,source1"
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- Dim dt2 As New DataTable
- da.Fill(dt2)
-
- sql = "select date as 日期,cust as 客户,N'退货' as 订单号,color + ' [' + comment + ' ]' as 品名,cast(qty as numeric(10,1)) as 尺数 from rt_k3_sale_reject where date BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "'"
- cmd.CommandText = sql
- da.SelectCommand = cmd
-
- da.Fill(dt2)
-
-
-
- DataGridView2.DataSource = dt2
- DataGridView2.SelectAll()
- Me.DataGridView2.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
- Me.DataGridView2.RowHeadersVisible = False
-
- Clipboard.SetDataObject(DataGridView2.GetClipboardContent())
-
-
-
-
-
- xlSheet.Cells(4, 2).PasteSpecial()
- Clipboard.SetDataObject(DBNull.Value)
-
- xlApp.ActiveSheet.ListObjects.Add(Microsoft.Office.Interop.Excel.XlListObjectSourceType.xlSrcRange, xlApp.Range("B4:L" & dt2.Rows.Count + 5), , Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes).Name = "表1"
-
-
-
- sql = "select deli as 发货人,cast(sum(qty) as numeric(10,1)) as 尺数 from rt_ship_temp_1 where DATE BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' group by deli "
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
-
- dgv_2.DataSource = dt1
- dgv_2.SelectAll()
- Me.dgv_2.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
- Me.dgv_2.RowHeadersVisible = False
-
- Clipboard.SetDataObject(dgv_2.GetClipboardContent())
-
- xlApp.Cells(4, 14).Select()
-
-
- xlSheet.PasteSpecial()
- Clipboard.SetDataObject(DBNull.Value)
-
- xlApp.ActiveSheet.ListObjects.Add(Microsoft.Office.Interop.Excel.XlListObjectSourceType.xlSrcRange, xlApp.Range("N4:o" & dt1.Rows.Count + 3 + 1), , Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes).Name = "表2"
-
- xlSheet.Columns("b:b").ColumnWidth = 22
- xlSheet.Columns("c:c").ColumnWidth = 25
- xlSheet.Columns("d:d").ColumnWidth = 25
- xlSheet.Columns("e:e").ColumnWidth = 40
- xlApp.Columns("f:f").ColumnWidth = 100
-
-
- 'xlApp.Columns("H").Select
- 'With xlApp.Selection.Font
- ' .Color = -16776961
- ' .TintAndShade = 0
- 'End With
-
-
- xlSheet.Columns("H:H").NumberFormatLocal = "#,###.0_ ;[紅色]-0.0"
-
-
- xlApp.Selection.NumberFormatLocal = "@"
-
-
- ' xlApp.Selection.NumberFormatLocal = "#,###.0_ ;[红色]-0.0 "
- xlApp.Columns("b:L").EntireColumn.AutoFit
-
-
- xlApp.Columns("b:b").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("d:d").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("e:e").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("g:g").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("i:i").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("j:j").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlRight
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
-
- PTCache = xlBook.PivotCaches.Add _
- (SourceType:=Microsoft.Office.Interop.Excel.XlPivotTableSourceType.xlDatabase,
- SourceData:=xlSheet.Range("b4:L1000").CurrentRegion.Address)
-
- PT = PTCache.CreatePivotTable _
- (TableDestination:=xlSheet.Cells(4, 17),
- TableName:="PivotTable1")
-
- With PT
- .PivotFields("日期").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlColumnField
- .PivotFields("客户").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlRowField
- .PivotFields("尺数").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlDataField
- End With
-
- xlSheet.PivotTables("PivotTable1").TableStyle2 = "PivotStyleMedium9"
- '-----------------------------------------------------------------------------贴膜
-
-
- xlSheet = xlBook.Worksheets.Add()
-
- xlSheet.Name = "贴膜"
-
-
- sql = "select date as 日期,custname as 客户,deli_no as 发货单号,replace(color1,char(10),'') as 颜色,pattern as 纹路, size as 分类,cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人 from rt_ship_temp_1 where DATE BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and pattern is not null
- group by date,custname,deli_no,color1,pattern,size,deli order by date,custname,deli_no,color1,pattern,sum(sf),deli"
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
-
- DGV_3.DataSource = dt1
- DGV_3.SelectAll()
- Me.DGV_3.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
- Me.DGV_3.RowHeadersVisible = False
-
- Clipboard.SetDataObject(DGV_3.GetClipboardContent())
-
-
-
-
-
- xlSheet.Cells(4, 2).Select()
- xlApp.Selection.PasteSpecial()
- Clipboard.SetDataObject(DBNull.Value)
-
- xlApp.ActiveSheet.ListObjects.Add(Microsoft.Office.Interop.Excel.XlListObjectSourceType.xlSrcRange, xlApp.Range("B4:i" & dt1.Rows.Count + 3 + 1), , Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes).Name = "表1"
-
-
-
-
-
- sql = "select deli as 发货人,cast(sum(qty) as numeric(10,1)) as 尺数 from rt_ship_temp_1 where DATE BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and pattern is not null group by deli "
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
-
- dgv_4.DataSource = dt1
- dgv_4.SelectAll()
- Me.dgv_4.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
- Me.dgv_4.RowHeadersVisible = False
-
- Clipboard.SetDataObject(dgv_4.GetClipboardContent())
-
- xlSheet.Cells(4, 13).Select()
-
-
- xlApp.Selection.PasteSpecial()
- Clipboard.SetDataObject(DBNull.Value)
-
- xlSheet.ListObjects.Add(Microsoft.Office.Interop.Excel.XlListObjectSourceType.xlSrcRange, xlApp.Range("m4:n" & dt1.Rows.Count + 3 + 1), , Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes).Name = "表2"
-
-
-
-
-
- xlSheet.Columns("b:b").ColumnWidth = 22
- xlSheet.Columns("c:c").ColumnWidth = 25
- xlSheet.Columns("d:d").ColumnWidth = 25
- xlSheet.Columns("e:e").ColumnWidth = 40
-
- ' xlApp.Columns("f:k").NumberFormatLocal = "#,###.0_ ;[红色]-0.0 "
- xlApp.Columns("b:k").EntireColumn.AutoFit
-
- xlApp.Columns("b:b").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("d:d").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Columns("g:g").Select()
- xlApp.Selection.HorizontalAlignment = Excel.Constants.xlCenter
- xlApp.Selection.VerticalAlignment = Excel.Constants.xlCenter
-
- xlApp.Cells(1, 1).Select()
-
-
-
- PTCache = xlBook.PivotCaches.Add _
- (SourceType:=Microsoft.Office.Interop.Excel.XlPivotTableSourceType.xlDatabase,
- SourceData:=xlSheet.Range("b4:i18").CurrentRegion.Address)
-
- PT = PTCache.CreatePivotTable _
- (TableDestination:=xlSheet.Cells(4, 16),
- TableName:="PivotTable1")
-
- With PT
- .PivotFields("日期").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlColumnField
- .PivotFields("客户").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlRowField
- .PivotFields("尺数").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlDataField
- End With
-
- xlSheet.PivotTables("PivotTable1").TableStyle2 = "PivotStyleMedium9"
-
-
-
-
-
- xlBook.SaveAs("d:\销售汇总自" & String.Format("{0:MMdd}", DateTimePicker1.Value) & "至" & String.Format("{0:MMdd}", DateTimePicker2.Value) & "止" & String.Format("{0:HHss}", Now) & ".xls")
-
- ' KillExcel(xlApp)
-
- End Sub
-
- Private Sub ListBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox3.SelectedIndexChanged
-
- End Sub
-
- Private Sub DataGridView2_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
-
- End Sub
-
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click '更新color order_no qty work_no order_item
-
-
-
-
-
- Dim dt As DataTable
-
-
-
- sql = "update rt_ship_temp_1 set po_no=order_no where order_no Is Not null And po_no Is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set qty=qty_sf1 where qty_sf1 Is Not null And qty Is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set work_no=i_no where i_no Is Not null And work_no Is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set qty=sf where qty Is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set order_item='' where order_item Is null "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "SELECT * FROM rt_ship_temp_1 WHERE COLOR1 IS NULL" '--------------------------
-
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- For x As Integer = 0 To dt.Rows.Count - 1
-
-
- If dt.Rows(x).Item("name").ToString = "" Then
-
- sql = "update rt_ship_temp_1 set color1=N'" & dt.Rows(x).Item("color") & "' where filename=N'" & dt.Rows(x).Item("filename") & "' and po_no=N'" & dt.Rows(x).Item("po_no") & "' and thick='" & dt.Rows(x).Item("thick") & "' and serial=N'" & dt.Rows(x).Item("serial") & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
-
- Else
-
-
- mysplit = Split(dt.Rows(x).Item("name"), ",")
- If UBound(mysplit) = 0 Then
- mysplit = Split(dt.Rows(x).Item("name"), ",")
- End If
-
- If UBound(mysplit) = 0 Then
- mysplit = Split(dt.Rows(x).Item("name"), "/")
- End If
-
-
-
- If UBound(mysplit) > 0 Then
- sql = "update rt_ship_temp_1 set color1=N'" & mysplit(UBound(mysplit)).ToString.Replace("'", "") & "' where filename=N'" & dt.Rows(x).Item("filename") & "' and name=N'" & dt.Rows(x).Item("name").ToString.Replace("'", "''") & "' and qty='" & dt.Rows(x).Item("qty") & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- Else
- sql = "update rt_ship_temp_1 set color1=N'" & dt.Rows(x).Item("NAME").ToString.Replace("'", "") & "' where filename=N'" & dt.Rows(x).Item("filename") & "' and name=N'" & dt.Rows(x).Item("name").ToString.Replace("'", "''") & "' and qty='" & dt.Rows(x).Item("qty") & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- End If
- End If
-
-
- Next
-
-
-
- MsgBox("")
-
-
- End Sub
-
- Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
-
-
- update_custname()
-
-
- sql = "UPDATE rt_ship_temp_1 SET THICK='1.24' WHERE NAME LIKE '%1.24%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "UPDATE rt_ship_temp_1 SET THICK='1.24' WHERE NAME LIKE '%1.2mm-1.4%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "UPDATE rt_ship_temp_1 SET THICK='1.24' WHERE NAME LIKE '%1.2M1.4MM%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "UPDATE rt_ship_temp_1 SET THICK='1.24' WHERE NAME LIKE '%1.2-1.4%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "UPDATE rt_ship_temp_1 SET THICK='1.46' WHERE NAME LIKE '%1.46%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "UPDATE rt_ship_temp_1 SET THICK='1.46' WHERE NAME LIKE '%1.4-1.6%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "UPDATE rt_ship_temp_1 SET THICK='1.68' WHERE NAME LIKE '%1.6-1.8%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- '------------------纹路
- sql = "UPDATE rt_ship_temp_1 SET rt_ship_temp_1.pattern = rt_pu_pattern1.pattern
- FROM rt_ship_temp_1 left OUTER JOIN rt_pu_pattern1 ON rt_ship_temp_1.name LIKE '%' + rt_pu_pattern1.pattern + '%'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- '-----size
-
- sql = "update rt_ship_temp_1 set order_no='' where order_no is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set work_no='' where work_no is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set card='' where card is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set po_no='' where po_no is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "update rt_ship_temp_1 set size=N'8以上身' where name like N'榔皮%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8以上软' where name like N'软榔%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8尺以上' where pattern is not null and (custname like N'%松城%' or custname like N'%欣錩%' or custname like N'%金帝%' or custname like N'%澳孚%' or custname like N'%东家%' or custname like N'%颖亿%' or custname like N'%穎億%' or custname like N'%东治%' or custname like N'%华新%' or custname like N'%蜘蛛王%' or custname like N'%加和%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8以上身' where pattern is not null and (custname like N'%志捷%' or custname like N'%金威利%' or custname like N'%威弘%' or custname like N'%极路客%' or custname like N'%永弘%' or custname like N'%上杰%') and color1 not like '%SM%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'4-8小皮' where pattern is not null and ( custname like N'%金威利%' or custname like N'%威弘%' ) and color1 like '%SM%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'4-8尺' where pattern is not null and (custname like N'%吉兴%' or custname like N'%百合%' or custname like N'%鑫龙%' or custname like N'%鑫茂%' ) "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set size=N'12以上' where pattern is not null and (custname like N'%好兄弟%' ) and name not like '%4-8%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'4-8尺' where pattern is not null and (custname like N'%好兄弟%' ) and name like '%4-8%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set size=N'4-8小皮' where pattern is not null and (custname like N'%铭鑫%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8以上身' where pattern is not null and (custname like N'%永山%' or custname like N'%亿博%' or custname like N'%宏美%' or custname like N'%大田%' or custname like N'%宏福%' or custname like N'%THANG%' or custname like N'%HATAY%' or custname like N'%利亚%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8-12尺' where pattern is not null and (custname like N'%锐奇%' or custname like N'%凯运%' or custname like N'%东霖%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- 'sql = "update rt_ship_temp_1 set size=N'8-12尺' where pattern is not null and (custname like N'%好兄弟%') and po_no like N'%样品%' "
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8以上' where pattern is not null and (custname like N'%周连发%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- 'sql = "update rt_ship_temp_1 set size=N'12以上' where pattern is not null and (custname like N'%好兄弟%') and po_no not like N'%样品%' "
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set size=N'8-12尺和12以上' where pattern is not null and custname like N'%源泰%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set size=N'12以上' where pattern is not null and (custname like N'%名创鞋业%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'12以上' where pattern is not null and (name like N'%12以上%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- MsgBox("更新完成")
-
-
- End Sub
-
- Private Sub update_date()
- Dim dt As New DataTable
- Dim mysplit() As String
- Dim str() As String
-
- sql = "select * from rt_ship_temp_1 where date is null"
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
- Dim mymonth As Integer
- Dim myday As Integer
-
- Dim mydate As String
-
- Dim d As Date
-
-
- For x As Integer = 0 To dt.Rows.Count - 1
-
-
- mysplit = Split(dt.Rows(x).Item("filename"), ".xls")
-
- If UBound(mysplit) = 0 Then
- mysplit = Split(dt.Rows(x).Item("filename"), ".xlsx")
- End If
-
-
- str = Split(mysplit(0), ".")
-
- If IsNumeric(Mid(str(0), Len(str(0)) - 1, 2)) Then
-
- mymonth = Mid(str(0), Len(str(0)) - 1, 2)
- Else
- mymonth = Mid(str(0), Len(str(0)) - 1, 1)
-
- End If
-
-
- If IsNumeric(Mid(str(1), 1, 2)) Then
-
-
- If IsNumeric(Mid(str(1), 2, 1)) Then
-
- myday = Mid(str(1), 1, 2)
- Else
- myday = Mid(str(1), 1, 1)
-
-
- End If
-
-
-
-
-
-
- Else
-
-
- If IsNumeric(Mid(str(1), 2, 1)) Then
-
- myday = Mid(str(1), 1, 2)
- Else
- myday = Mid(str(1), 1, 1)
- End If
-
-
- 'myday = Mid(str(1), 2, 1)
-
- End If
-
-
-
-
- mydate = "2022" & "/" & mymonth & "/" & myday
-
-
- d = mydate
-
- sql = "update rt_ship_temp_1 set date='" & d & "' where po_no=N'" & dt.Rows(x).Item("po_no") & "' and order_no=N'" & dt.Rows(x).Item("order_no") & "' and qty='" & dt.Rows(x).Item("qty") & "' and filename=N'" & dt.Rows(x).Item("filename") & "' and serial='" & dt.Rows(x).Item("serial") & "' and cust='" & dt.Rows(x).Item("cust") & "'"
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
-
-
-
-
-
-
- Next
- End Sub
- Private Sub getdate() '----------------新增temp之后改日期
- Dim dt As New DataTable
- Dim mysplit() As String
- Dim str() As String
-
-
- sql = "update rt_ship_temp_1 set po_no ='' where po_no is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set serial ='' where serial is null"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- sql = "select * from rt_ship_temp_1 where date is null"
- cmd.CommandText = sql
- dt = New DataTable
- da.SelectCommand = cmd
- da.Fill(dt)
-
- Dim mymonth As Integer
- Dim myday As Integer
- Dim mydate As String
-
- Dim d As Date
-
- For x As Integer = 0 To dt.Rows.Count - 1
-
- 'If dt.Rows(x).Item("custname") Like "*鑫*" Then
-
- ' Dim aaaa As Integer
- ' aaaa = 1
- ' End If
-
-
- mysplit = Split(dt.Rows(x).Item("filename"), ".xls")
-
-
- If UBound(mysplit) = 0 Then
- mysplit = Split(dt.Rows(x).Item("filename"), ".xlsx")
- End If
-
-
- str = Split(mysplit(0), ".")
-
- If IsNumeric(Mid(str(0), Len(str(0)) - 1, 2)) Then
-
- mymonth = Mid(str(0), Len(str(0)) - 1, 2)
- Else
- mymonth = Mid(str(0), Len(str(0)) , 1)
-
- End If
-
-
- If IsNumeric(Mid(str(1), 1, 2)) Then
-
-
- If IsNumeric(Mid(str(1), 2, 1)) Then
-
- myday = Mid(str(1), 1, 2)
- Else
- myday = Mid(str(1), 1, 1)
-
-
- End If
-
- Else
-
-
- If IsNumeric(Mid(str(1), 2, 1)) Then
-
- myday = Mid(str(1), 1, 2)
- Else
- myday = Mid(str(1), 1, 1)
- End If
-
-
- 'myday = Mid(str(1), 2, 1)
-
- End If
-
-
- mydate = "2024" & "/" & mymonth & "/" & myday
-
-
- d = mydate
-
-
-
- sql = "update rt_ship_temp_1 set date='" & d & "' where po_no=N'" & dt.Rows(x).Item("po_no").ToString.Replace("'", "''") & "' and qty='" & dt.Rows(x).Item("qty") & "' and filename=N'" &
- dt.Rows(x).Item("filename") & "' and serial='" & dt.Rows(x).Item("serial") & "' and po_no=N'" & dt.Rows(x).Item("po_no").ToString.Replace("'", "''") & "'"
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- Next
-
- sql = "update rt_ship_temp_1 set size=N'8以上身' where name like N'榔皮%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8以上软' where name like N'软榔%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8尺以上' where pattern is not null and (custname like N'%澳孚%' or custname like N'%东家%' or custname like N'%东治%' or custname like N'%华新%' or custname like N'%蜘蛛王%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8以上身' where pattern is not null and (custname like N'%金威利%' or custname like N'%威弘%') and color not like '%SM%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'4-8小皮' where pattern is not null and (custname like N'%金威利%' or custname like N'%威弘%') and color like '%SM%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8以上身' where pattern is not null and (custname like N'%永山%' or custname like N'%宏福%' or custname like N'%亿博%' or custname like N'%宏美%' or custname like N'%大田%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set size=N'8-12尺' where pattern is not null and (custname like N'%锐奇%' or custname like N'%凯运%' or custname like N'%东霖%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set size=N'8-12尺和12以上' where pattern is not null and custname like N'%源泰%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- MsgBox("更新完成")
-
- End Sub
-
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
-
- End Sub
-
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
-
-
- Dim dt As New DataTable
-
- If IsNumeric(TextBox4.Text) Then
- Else
-
- MsgBox("未输入单号/单号格式有误")
- Exit Sub
- End If
-
- sql = "select count(*) from rt_ship_temp_1 where DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and cust is null or custname is null"
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
-
- sql = "select filename 档案名,color1 as 颜色,qty as 尺数,no as 序号 from rt_ship_temp_1 where DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and cust is null or custname is null order by filename"
- dt = New DataTable
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
- MsgBox("请检查客户名/客户编号")
- Exit Sub
-
- End If
-
-
- sql = "select count(*) from rt_ship_temp_1 where pattern is not null and size is null and DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "'"
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
- MsgBox("请检查贴膜皮身")
- Exit Sub
-
- End If
-
- sql = "select count(*) from rt_ship_temp_1 where size is not null and pattern is null and DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "'"
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
- MsgBox("请检查纹路")
- Exit Sub
-
- End If
-
-
-
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where date is null"
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
- sql = "select filename 档案名,color1 as 颜色,qty as 尺数,no as 序号 from rt_ship_temp_1 where date is null order by filename"
- dt = New DataTable
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
- MsgBox("请检查出货日期")
- Exit Sub
-
- End If
-
-
- sql = "select count(*) from rt_ship_temp_1 where DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and color1 is null "
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
-
- sql = "select filename 档案名,color1 as 颜色,qty as 尺数,no as 序号 from rt_ship_temp_1 where color1 is null order by filename"
- dt = New DataTable
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- MsgBox("请检查颜色栏位")
- Exit Sub
-
- End If
-
-
- sql = "select count(*) from rt_ship_temp_1 where DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and deli is null "
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
- MsgBox("请检查送货人")
- Exit Sub
-
- End If
-
-
-
- sql = "select count(*) from rt_ship_temp_1 where DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and thick is null "
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
- MsgBox("请检查厚度")
- Exit Sub
-
- End If
-
-
-
-
- Dim xlApp As Microsoft.Office.Interop.Excel.Application
- Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
- Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
- Dim xlSheet2 As Microsoft.Office.Interop.Excel.Worksheet
-
-
-
-
- Dim file_name As String = ""
- Dim file_name1 As String = ""
- Dim my_weight As Double = 0
- Dim a As Integer = 0
- Dim my_count As Integer = 0
- 'OpenFileDialog1.Multiselect = True
-
-
- 'If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
-
- ' file_name = OpenFileDialog1.FileName
- ' file_name1 = OpenFileDialog1.SafeFileName
- 'Else
- ' Exit Sub
-
- 'End If
-
-
-
- xlApp = CreateObject("Excel.Application")
- xlApp.Visible = True
- xlApp.DisplayAlerts = False
-
-
-
- 'sql = "delete from rt_bg_io"
- 'cmd.CommandText = sql
- 'cmd.ExecuteNonQuery()
-
-
-
- xlBook = xlApp.Workbooks.Open("D:\K3\k3表格模板\销售出库空白模版.xls",, True)
-
- xlBook.Activate()
-
-
-
- Dim dt2 As New DataTable
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page1" Then
- xlSheet = xlApp.Workbooks(1).Worksheets(i)
- xlSheet.Activate()
- Exit For
- End If
-
-
- Next
-
-
- dt = New DataTable
- sql = "SELECT po_no,deli_no,work_no,thick, cust,custname,date,filename,deli,order_item,color1 FROM rt_ship_temp_1 where DATE
- BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "'
- group by deli_no,po_no,cust,date,filename,custname,work_no,thick,deli,order_item,color1,thick order by date,cust,deli_no "
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
-
-
-
- Dim aa As Integer
-
-
-
-
- aa = TextBox4.Text
- Dim my_no As String = "XSCK"
- Dim yy As Integer = 1
- Dim x As Integer = 0
-
-
- For x = 0 To dt.Rows.Count - 1
-
- xlSheet.Cells(x + 2, 1) = dt.Rows(x).Item("date")
- xlSheet.Cells(x + 2, 2) = dt.Rows(x).Item("date")
- xlSheet.Cells(x + 2, 3) = "'吴小男"
- xlSheet.Cells(x + 2, 4) = "'" & my_no & aa
- xlSheet.Cells(x + 2, 5) = "'zhang"
-
- xlSheet.Cells(x + 2, 9) = "'" & dt.Rows(x).Item("cust")
- xlSheet.Cells(x + 2, 10) = "'" & dt.Rows(x).Item("custname")
-
-
- xlSheet.Cells(x + 2, 34) = dt.Rows(x).Item("date")
- xlSheet.Cells(x + 2, 46) = "'" & dt.Rows(x).Item("po_no")
-
-
-
-
-
- If dt.Rows(x).Item("custname") Like "*上杰*" Or dt.Rows(x).Item("custname") Like "*永正*" Or dt.Rows(x).Item("custname") Like "*宏福*" Then
-
- xlSheet.Cells(x + 2, 47) = "'" & dt.Rows(x).Item("order_item")
-
- Else
-
- xlSheet.Cells(x + 2, 47) = dt.Rows(x).Item("work_no")
-
-
- End If
-
-
-
-
-
-
-
-
-
- 'If dt.Rows(x).Item("custname") Like "%样%" Then
- ' xlSheet.Cells(x + 2, 47) = "'样品"
- 'End If
-
- ' xlSheet.Cells(x + 5, 48) = "型体号"
-
- 'If dt.Rows(x).Item("custname") Like "*澳孚*" Or dt.Rows(x).Item("custname") Like "*贝孚第*" Or dt.Rows(x).Item("custname") Like "*大田*" Or dt.Rows(x).Item("custname") Like "*德艺科技*" Or dt.Rows(x).Item("custname") Like "*澳孚*" Or
- ' dt.Rows(x).Item("custname") Like "*东家*" Or dt.Rows(x).Item("custname") Like "*东霖*" Or dt.Rows(x).Item("custname") Like "*东治*" Or dt.Rows(x).Item("custname") Like "*贵州唐先生*" Or dt.Rows(x).Item("custname") Like "*宏美二厂*" Or
- ' dt.Rows(x).Item("custname") Like "*龙优*" Or dt.Rows(x).Item("custname") Like "*美迪洋*" Or dt.Rows(x).Item("custname") Like "*美浩实业*" Or dt.Rows(x).Item("custname") Like "*名志鞋业*" Or dt.Rows(x).Item("custname") Like "*秋夏皮业*" Or
- ' dt.Rows(x).Item("custname") Like "*三益鞋厂*" Or dt.Rows(x).Item("custname") Like "*三元鞋厂*" Or dt.Rows(x).Item("custname") Like "*卫士*" Or dt.Rows(x).Item("custname") Like "*许宝贝*" Or dt.Rows(x).Item("custname") Like "*永盛*" Or
- ' dt.Rows(x).Item("custname") Like "*振兴皮行*" Or dt.Rows(x).Item("custname") Like "*中山华新*" Or dt.Rows(x).Item("custname") Like "*汇力*" Or dt.Rows(x).Item("custname") Like "*惠雄*" Or dt.Rows(x).Item("custname") Like "*金帝*" Or dt.Rows(x).Item("custname") Like "*凯运皮革*" Or dt.Rows(x).Item("custname") Like "*励泰*" Or dt.Rows(x).Item("custname") Like "*锐奇*" Then
-
-
-
- 'Else
-
-
-
-
- 'End If
-
-
-
- ' If dt.Rows(x).Item("custname") Like "*样*" Or dt.Rows(x).Item("custname") Like "*志捷*" Then
-
-
- 'End If
-
-
- If dt.Rows(x).Item("deli") = "陈立雄" Then
-
- xlSheet.Cells(x + 2, 49) = "'021"
- xlSheet.Cells(x + 2, 50) = "'陈立雄"
- End If
-
- If dt.Rows(x).Item("deli") = "尤珊荣" Then
-
- xlSheet.Cells(x + 2, 49) = "'020"
- xlSheet.Cells(x + 2, 50) = "'尤珊荣"
-
- End If
-
- If dt.Rows(x).Item("deli") = "许燕江" Then
- xlSheet.Cells(x + 2, 49) = "'206"
- xlSheet.Cells(x + 2, 50) = "'许燕江"
-
- End If
-
- If dt.Rows(x).Item("deli") = "蔡青山" Then
- xlSheet.Cells(x + 2, 49) = "'016"
- xlSheet.Cells(x + 2, 50) = "'蔡青山"
-
- End If
-
- If dt.Rows(x).Item("deli") = "陈建超" Then
- xlSheet.Cells(x + 2, 49) = "'247"
- xlSheet.Cells(x + 2, 50) = "'陈建超"
-
- End If
-
- If dt.Rows(x).Item("deli") = "蔡春燕" Then
- xlSheet.Cells(x + 2, 49) = "'246"
- xlSheet.Cells(x + 2, 50) = "'蔡春燕"
-
- End If
-
- If dt.Rows(x).Item("deli") = "叶以" Then
- xlSheet.Cells(x + 2, 49) = "'248"
- xlSheet.Cells(x + 2, 50) = "'叶以"
-
- End If
-
-
-
-
- For i = 1 To xlApp.Worksheets.Count
-
- If xlApp.Workbooks(1).Worksheets(i).name = "Page2" Then
- xlSheet2 = xlApp.Workbooks(1).Worksheets(i)
- xlSheet2.Activate()
- Exit For
- End If
-
- Next
-
-
- dt2 = New DataTable
- ' sql = "select date,cust,color1,deli_no,card,thick,sum(qty) as qty,pattern from rt_ship_temp_1 where DATE BETWEEN '" & String.Format("{0:d}", DateTimePicker1.Value) & "' AND '" & String.Format("{0:d}", DateTimePicker2.Value) & "' and deli_no='" & dt.Rows(x).Item("deli_no") & "' and filename=N'" & dt.Rows(x).Item("filename") & "' group by date,cust,color1,deli_no,card,thick,pattern"
-
-
-
-
-
- ' sql = "SELECT FILENAME,COMMENT,sum( qty) as qty, work_no, color1, pattern, SIZE,name,
- ' thick, deli_no, card,CASE
- 'WHEN source1 LIKE N'%美国广东%' THEN N'516.F.A2'
- 'WHEN source1 LIKE N'%APP%' THEN N'516.F.A3'
- 'WHEN source1 LIKE N'%阿根廷%' THEN N'516.F.B1'
- 'WHEN source1 LIKE N'%澳州%' THEN N'516.F.C1'
- 'WHEN source1 LIKE N'%越南美国%' THEN N'516.F.A3'
- 'WHEN source1 LIKE N'%澳洲%' THEN N'516.F.C1'
- 'WHEN source1 LIKE N'%南非%' THEN N'516.F.E1'
- 'WHEN source1 LIKE N'%乌拉圭%' THEN N'516.F.F1'
- 'WHEN source1 LIKE N'%墨西哥%' THEN N'516.F.G1'
- 'WHEN source1 LIKE N'%泰国日本%' THEN N'516.F.S1'
- 'WHEN source1 LIKE N'%新西兰%' THEN N'516.F.I1'
- 'WHEN source1 LIKE N'%欧州%' THEN N'516.F.J1'
- 'WHEN source1 LIKE N'%孟加拉%' THEN N'516.F.K1'
- 'WHEN source1 LIKE N'%西班牙%' THEN N'516.F.L1'
- 'WHEN source1 LIKE N'%巴西%' THEN N'516.F.N1'
- 'WHEN source1 LIKE N'%英国%' THEN N'516.F.O1'
- 'WHEN source1 LIKE N'%牛种%' THEN N'516.F.P1'
- 'WHEN source1 LIKE N'%智利%' THEN N'516.F.Q1'
- 'WHEN source1 LIKE N'%德国%' THEN N'516.F.R1'
- 'WHEN source1 LIKE N'%日本%' THEN N'516.F.S1'
- 'WHEN source1 LIKE N'%俄罗斯%' THEN N'516.F.T1'
- 'WHEN source1 LIKE N'%台湾泰庆%' THEN N'516.F.Z1'
- 'WHEN source1 LIKE N'%杂皮%' THEN N'516.F.Z9'
- 'WHEN source1 LIKE N'%二层%' THEN N'516.P.01' ELSE '516.F.Z9'
- 'END AS source2,
- ' CASE
- 'WHEN source1 LIKE N'%美国广东%' THEN N'美国广东 二层'
- 'WHEN source1 LIKE N'%APP%' THEN N'美国APP 二层'
- 'WHEN source1 LIKE N'%越南美国%' THEN N'美国APP 二层'
- 'WHEN source1 LIKE N'%阿根廷%' THEN N'阿根廷 二层'
- 'WHEN source1 LIKE N'%澳州%' THEN N'澳洲 二层'
- 'WHEN source1 LIKE N'%澳洲%' THEN N'澳洲 二层'
- 'WHEN source1 LIKE N'%南非%' THEN N'南非 二层'
- 'WHEN source1 LIKE N'%乌拉圭%' THEN N'乌拉圭 二层'
- 'WHEN source1 LIKE N'%墨西哥%' THEN N'墨西哥 二层'
- 'WHEN source1 LIKE N'%泰国日本%' THEN N'日本 二层'
- 'WHEN source1 LIKE N'%新西兰%' THEN N'新西兰 二层'
- 'WHEN source1 LIKE N'%欧州%' THEN N'欧洲 二层'
- 'WHEN source1 LIKE N'%孟加拉%' THEN N'孟加拉 二层'
- 'WHEN source1 LIKE N'%西班牙%' THEN N'西班牙 二层'
- 'WHEN source1 LIKE N'%巴西%' THEN N'巴西 二层'
- 'WHEN source1 LIKE N'%英国%' THEN N'英国 二层'
- 'WHEN source1 LIKE N'%牛种%' THEN N'肯尼亚 二层'
- 'WHEN source1 LIKE N'%智利%' THEN N'智利 二层'
- 'WHEN source1 LIKE N'%德国%' THEN N'德国 二层'
- 'WHEN source1 LIKE N'%日本%' THEN N'日本 二层'
- 'WHEN source1 LIKE N'%俄罗斯%' THEN N'俄罗斯 二层'
- 'WHEN source1 LIKE N'%台湾泰庆%' THEN N'台湾泰庆 二层'
- 'WHEN source1 LIKE N'%杂皮%' THEN N'杂皮 二层'
- 'WHEN source1 LIKE N'%二层%' THEN N'二层' ELSE N'杂皮 二层'
- 'END AS source3
- 'from rt_ship_temp_1 where po_no=N'" & dt.Rows(x).Item("po_no").ToString.Replace("'", "''") & "' and date='" & dt.Rows(x).Item("date") & "' and work_no=N'" & dt.Rows(x).Item("work_no").ToString.Replace("'", "''") & "' and deli_no='" & dt.Rows(x).Item("deli_no") & "' and filename=N'" & dt.Rows(x).Item("filename") & "' and color1=N'" & dt.Rows(x).Item("color1") & "' group by FILENAME,COMMENT,work_no,color1,source1,pattern,size,name,thick,deli_no,card ORDER BY QTY"
-
-
-
- ' sql = "SELECT TOP (100) PERCENT rt_ship_temp_1.custname, rt_ship_temp_1.card AS 卡号, CAST(SUM(rt_ship_temp_1.qty)
- ' AS numeric(10, 1)) AS 尺数, CASE WHEN RIGHT(rt_ship_temp_1.card, 1) = 'F' THEN 'BRF' + substring(rt_ship_temp_1.card,
- ' 0, len(rt_ship_temp_1.card)) ELSE '' END AS 卡号1, CASE WHEN rt_finish_stock.name IS NULL
- ' THEN N'杂皮 二层' ELSE rt_finish_stock.name END AS 品名, CASE WHEN rt_finish_stock.sf IS NULL
- ' THEN '' ELSE rt_finish_stock.sf END AS 库存尺数, CASE WHEN rt_finish_stock.code IS NULL
- ' THEN '516.F.XX' ELSE rt_finish_stock.code END AS 编码, rt_ship_temp_1.color1 AS 颜色,
- ' rt_ship_temp_1.date AS 出货日期, rt_ship_temp_1.po_no, rt_ship_temp_1.work_no, rt_ship_temp_1.thick,
- ' rt_ship_temp_1.deli_no, rt_ship_temp_1.cust, rt_finish_stock.lot
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.po_no=N'" & dt.Rows(x).Item("po_no").ToString.Replace("'", "''") & "' and rt_ship_temp_1.date='" & dt.Rows(x).Item("date") & "' and rt_ship_temp_1.work_no=N'" & dt.Rows(x).Item("work_no").ToString.Replace("'", "''") & "' and rt_ship_temp_1.deli_no='" & dt.Rows(x).Item("deli_no") & "' and rt_ship_temp_1.filename=N'" & dt.Rows(x).Item("filename") & "' and rt_ship_temp_1.color1=N'" & dt.Rows(x).Item("color1") & "')
- 'GROUP BY rt_ship_temp_1.custname, rt_ship_temp_1.card, rt_finish_stock.name, rt_finish_stock.sf, rt_finish_stock.code,
- ' rt_ship_temp_1.color1, rt_ship_temp_1.date, rt_ship_temp_1.po_no, rt_ship_temp_1.work_no, rt_ship_temp_1.thick,
- ' rt_ship_temp_1.deli_no, rt_ship_temp_1.cust, rt_finish_stock.lot
- 'ORDER BY 出货日期"
-
-
- ' sql = "SELECT CASE WHEN 卡号 = '' and pattern is null THEN '2024999999F' when 卡号 = '' and pattern is not null THEN '2024999999P' else 卡号 END AS 卡号, SUM(尺数) AS 尺数, 品名, 编码, 颜色, thick, deli_no,
- ' size, name, deli, filename, comment, pattern
- 'FROM (SELECT TOP (100) PERCENT rt_ship_temp_1.card AS 卡号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' CASE WHEN RIGHT(rt_ship_temp_1.card, 1) = 'F' THEN 'BRF' + substring(rt_ship_temp_1.card, 0,
- ' len(rt_ship_temp_1.card)) ELSE '' END AS 卡号1, CASE WHEN rt_finish_stock.name IS NULL
- ' THEN N'杂皮 二层' ELSE rt_finish_stock.name END AS 品名, CASE WHEN rt_finish_stock.code IS NULL
- ' THEN '516.F.XX' ELSE rt_finish_stock.code END AS 编码, rt_ship_temp_1.color1 AS 颜色,
- ' rt_ship_temp_1.date AS 出货日期, rt_ship_temp_1.po_no, rt_ship_temp_1.work_no, rt_ship_temp_1.thick,
- ' rt_ship_temp_1.deli_no, rt_ship_temp_1.cust, rt_finish_stock.lot, rt_ship_temp_1.size, rt_ship_temp_1.order_item,
- ' rt_ship_temp_1.name, rt_ship_temp_1.custname, rt_ship_temp_1.filename, rt_ship_temp_1.qty,
- ' rt_ship_temp_1.comment, rt_ship_temp_1.pattern, rt_ship_temp_1.deli
- ' FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- ' WHERE (rt_ship_temp_1.po_no=N'" & dt.Rows(x).Item("po_no").ToString.Replace("'", "''") & "' and rt_ship_temp_1.date='" & dt.Rows(x).Item("date") & "' and rt_ship_temp_1.work_no=N'" & dt.Rows(x).Item("work_no").ToString.Replace("'", "''") & "' and rt_ship_temp_1.deli_no='" & dt.Rows(x).Item("deli_no") & "' and rt_ship_temp_1.filename=N'" & dt.Rows(x).Item("filename") & "' and rt_ship_temp_1.color1=N'" & dt.Rows(x).Item("color1") & "')
- ' GROUP BY rt_ship_temp_1.card, rt_finish_stock.name, rt_finish_stock.code, rt_ship_temp_1.color1, rt_ship_temp_1.date,
- ' rt_ship_temp_1.po_no, rt_ship_temp_1.work_no, rt_ship_temp_1.thick, rt_ship_temp_1.deli_no,
- ' rt_ship_temp_1.cust, rt_finish_stock.lot, rt_ship_temp_1.size, rt_ship_temp_1.order_item, rt_ship_temp_1.name,
- ' rt_ship_temp_1.custname, rt_ship_temp_1.filename, rt_ship_temp_1.qty, rt_ship_temp_1.comment,
- ' rt_ship_temp_1.pattern, rt_ship_temp_1.deli) AS q
- 'GROUP BY 卡号, 品名, 编码, 颜色, thick, deli_no, size, name, deli, filename, comment, pattern"
-
- sql = "SELECT FILENAME,COMMENT,cast(sum(qty) as numeric(10,1)) as qty, work_no, color1, pattern, SIZE,name,
- thick, deli_no,source1, card,CASE
- WHEN source1 LIKE N'%美国广东%' THEN N'516.F.A2'
- WHEN source1 LIKE N'%APP%' THEN N'516.F.A3'
- WHEN source1 LIKE N'%阿根廷%' THEN N'516.F.B1'
- WHEN source1 LIKE N'%澳州%' THEN N'516.F.C1'
- WHEN source1 LIKE N'%越南美国%' THEN N'516.F.A3'
- WHEN source1 LIKE N'%澳洲%' THEN N'516.F.C1'
- WHEN source1 LIKE N'%南非%' THEN N'516.F.E1'
- WHEN source1 LIKE N'%乌拉圭%' THEN N'516.F.F1'
- WHEN source1 LIKE N'%墨西哥%' THEN N'516.F.G1'
- WHEN source1 LIKE N'%泰国日本%' THEN N'516.F.S1'
- WHEN source1 LIKE N'%新西兰%' THEN N'516.F.I1'
- WHEN source1 LIKE N'%欧州%' THEN N'516.F.J1'
- WHEN source1 LIKE N'%孟加拉%' THEN N'516.F.K1'
- WHEN source1 LIKE N'%西班牙%' THEN N'516.F.L1'
- WHEN source1 LIKE N'%巴西%' THEN N'516.F.N1'
- WHEN source1 LIKE N'%英国%' THEN N'516.F.O1'
- WHEN source1 LIKE N'%牛种%' THEN N'516.F.P1'
- WHEN source1 LIKE N'%智利%' THEN N'516.F.Q1'
- WHEN source1 LIKE N'%德国%' THEN N'516.F.R1'
- WHEN source1 LIKE N'%日本%' THEN N'516.F.S1'
- WHEN source1 LIKE N'%俄罗斯%' THEN N'516.F.T1'
- WHEN source1 LIKE N'%台湾泰庆%' THEN N'516.F.Z1'
- WHEN source1 LIKE N'%杂皮%' THEN N'516.F.Z9'
- WHEN source1 LIKE N'%二层%' THEN N'516.P.01' ELSE '516.F.Z9'
- END AS source2,
- CASE
-
- WHEN source1 LIKE N'%美国广东%' THEN N'516 美国 二层'
- WHEN source1 LIKE N'%信德%' THEN N'516 信德 二层'
- WHEN source1 LIKE N'%APP%' THEN N'516 美国 二层'
- WHEN source1 LIKE N'%美国%' THEN N'516 美国 二层'
- WHEN source1 LIKE N'%阿根廷%' THEN N'516 阿根廷 二层'
- WHEN source1 LIKE N'%意大利%' THEN N'516 意大利 二层'
- WHEN source1 LIKE N'%澳洲%' THEN N'516 澳大利亚 二层'
- WHEN source1 LIKE N'%澳大利亚%' THEN N'516 澳大利亚 二层'
- WHEN source1 LIKE N'%南非%' THEN N'516 南非 二层'
- WHEN source1 LIKE N'%乌拉圭%' THEN N'516 乌拉圭 二层'
- WHEN (source1 LIKE N'%墨西哥%' and not(source1 LIKE N'%美国%')) THEN N'516 墨西哥 二层'
- WHEN source1 LIKE N'%泰国日本%' THEN N'516 日本 二层'
- WHEN source1 LIKE N'%新西兰%' THEN N'516 新西兰 二层'
- WHEN source1 LIKE N'%欧洲%' THEN N'516 欧洲 二层'
- WHEN source1 LIKE N'%孟加拉%' THEN N'516 孟加拉 二层'
- WHEN source1 LIKE N'%西班牙%' THEN N'516 西班牙 二层'
- WHEN (source1 LIKE N'%巴西%') or (source1 LIKE N'%南美%') THEN N'516 巴西 二层'
- WHEN source1 LIKE N'%英国%' THEN N'516 英国 二层'
- WHEN source1 LIKE N'%牛种%' THEN N'516 肯尼亚 二层'
- WHEN source1 LIKE N'%智利%' THEN N'516 智利 二层'
- WHEN source1 LIKE N'%泰国美国%' THEN N'516 美国 二层'
- WHEN source1 LIKE N'%德国%' THEN N'516 德国 二层'
- WHEN source1 LIKE N'%肯尼亚%' THEN N'516 肯尼亚 二层'
- WHEN source1 LIKE N'%日本%' THEN N'516 日本 二层'
- WHEN source1 LIKE N'泰国' THEN N'516 泰国 二层'
- WHEN source1 LIKE N'%无铬鞣%' THEN N'516 无铬鞣 二层'
- WHEN source1 LIKE N'%俄罗斯%' THEN N'516 俄罗斯 二层'
- WHEN source1 LIKE N'BX%' THEN N'516 巴西 二层'
- WHEN source1 LIKE N'%台湾泰庆%' THEN N'516 美国 二层'
- WHEN pattern is not null THEN N'516 贴膜皮'
- WHEN (source1 like N'%外购%') THEN N'516 小皮 二层'
- WHEN source1 LIKE N'%杂皮%' THEN N'516 杂皮 二层'
- ELSE N'516 杂皮 二层'
- END AS source3
- from rt_ship_temp_1 where (rt_ship_temp_1.po_no=N'" & dt.Rows(x).Item("po_no").ToString.Replace("'", "''") & "' and rt_ship_temp_1.thick='" & dt.Rows(x).Item("thick") & "' and rt_ship_temp_1.date='" & dt.Rows(x).Item("date") & "' and rt_ship_temp_1.work_no=N'" & dt.Rows(x).Item("work_no").ToString.Replace("'", "''") & "' and rt_ship_temp_1.deli_no=N'" & dt.Rows(x).Item("deli_no") & "' and rt_ship_temp_1.filename=N'" & dt.Rows(x).Item("filename") & "' and rt_ship_temp_1.color1=N'" & dt.Rows(x).Item("color1") & "') group by FILENAME,COMMENT,work_no,color1,source1,pattern,size,name,thick,deli_no,card ORDER BY source3"
-
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt2)
-
-
-
-
-
-
-
-
-
-
- Dim serial As Integer = 1
-
- For y = 0 To dt2.Rows.Count - 1
-
- xlSheet2.Cells(yy + 1 + y, 5) = "'" & serial '行号
- xlSheet2.Cells(yy + 1 + y, 6) = "'" & my_no & aa
- ' xlSheet2.Cells(yy 1 5 + y, 7) = "'21"
-
- If IsDBNull(dt2.Rows(y).Item("pattern")) Then
-
-
- xlSheet2.Cells(yy + 1 + y, 9) = "516.F.FM"
- xlSheet2.Cells(yy + 1 + y, 10) = "二层皮"
- xlSheet2.Cells(yy + 1 + y, 17) = dt2.Rows(y).Item("source3")
-
- Else
-
- xlSheet2.Cells(yy + 1 + y, 9) = "516.P.PU"
- xlSheet2.Cells(yy + 1 + y, 10) = "贴膜皮"
-
-
- If dt2.Rows(y).Item("size") Like "12*" Then
-
-
- xlSheet2.Cells(yy + 1 + y, 17) = "'516 贴膜 12+"
-
- ElseIf dt2.Rows(y).Item("size") Like "8*" Then
-
- xlSheet2.Cells(yy + 1 + y, 17) = "'516 贴膜 8-12"
-
-
-
- ElseIf dt2.Rows(y).Item("size") Like "4*" Then
- xlSheet2.Cells(yy + 1 + y, 17) = "'516 贴膜 4-8"
-
-
- End If
-
-
-
-
- End If
-
-
-
- ' xlSheet2.Cells(yy + 5 + y, 15) = "'3 尺/kg"
- ' xlSheet2.Cells(yy + 5 + y, 16) = "'平方英尺"
-
-
-
-
-
-
-
- xlSheet2.Cells(yy + 1 + y, 18) = dt2.Rows(y).Item("qty")
-
- xlSheet2.Cells(yy + 1 + y, 21) = "'" & dt2.Rows(y).Item("SIZE")
- xlSheet2.Cells(yy + 1 + y, 22) = dt2.Rows(y).Item("qty")
-
-
- If dt2.Rows(y).Item("FILENAME") Like "*顽刻*" Then
- xlSheet2.Cells(yy + 1 + y, 54) = "顽刻"
- ElseIf dt2.Rows(y).Item("FILENAME") Like "*顺泰盛*" Then
- xlSheet2.Cells(yy + 1 + y, 54) = "顺泰盛"
- ElseIf dt2.Rows(y).Item("FILENAME") Like "*红晟*" Then
- xlSheet2.Cells(yy + 1 + y, 54) = "红晟"
- ElseIf dt2.Rows(y).Item("FILENAME") Like "*富拓*" Then
- xlSheet2.Cells(yy + 1 + y, 54) = "富拓"
- ElseIf dt2.Rows(y).Item("FILENAME") Like "*浩博*" Then
- xlSheet2.Cells(yy + 1 + y, 54) = "浩博"
-
- End If
-
- If dt2.Rows(y).Item("COMMENT") Like "*顽刻*" Then
- xlSheet2.Cells(yy + 1 + y, 54) = "顽刻"
-
-
-
- End If
-
- ' xlSheet2.Cells(yy + 5 + y, 28) = "'516-R"
- ' xlSheet2.Cells(yy + 5 + y, 29) = "'待售成品仓/赤湖"
-
-
- xlSheet2.Cells(yy + 1 + y, 55) = "'" & dt2.Rows(y).Item("color1")
- xlSheet2.Cells(yy + 1 + y, 56) = "'" & dt2.Rows(y).Item("name")
-
- xlSheet2.Cells(yy + 1 + y, 57) = "'" & dt2.Rows(y).Item("thick")
- xlSheet2.Cells(yy + 1 + y, 58) = "'" & dt2.Rows(y).Item("card") '流程卡号
- ' xlSheet2.Cells(yy + 1 + y, 63) = "'" & dt2.Rows(y).Item("work_no") '工作指令号
-
- xlSheet2.Cells(yy + 1 + y, 63) = dt2.Rows(y).Item("COMMENT")
-
- If Len(dt2.Rows(y).Item("pattern").ToString) < 2 Then
- xlSheet2.Cells(yy + 1 + y, 64) = "'反毛皮"
- Else
- xlSheet2.Cells(yy + 1 + y, 64) = "'贴膜"
-
-
-
-
- End If
-
-
- xlSheet2.Cells(yy + 1 + y, 65) = "'" & dt2.Rows(y).Item("pattern") '贴膜纹路
-
- xlSheet2.Cells(yy + 1 + y, 66) = "'" & dt2.Rows(y).Item("deli_no") '送货单号
-
- serial = serial + 1
-
- Next
-
- yy = yy + dt2.Rows.Count
-
-
- aa = aa + 1
-
-
- Next
-
-
-
-
- '' xlSheet.Range("C2:C" & x + 1).FillDown()
- ''xlSheet.Range("E2:E" & x + 1).FillDown()
- xlSheet.Range("F2:F" & x + 1).FillDown()
- xlSheet.Range("G2:G" & x + 1).FillDown()
- xlSheet.Range("H2:H" & x + 1).FillDown()
- xlSheet.Range("K2:K" & x + 1).FillDown()
- xlSheet.Range("L2:L" & x + 1).FillDown()
- xlSheet.Range("M2:M" & x + 1).FillDown()
- xlSheet.Range("N2:N" & x + 1).FillDown()
- xlSheet.Range("O2:O" & x + 1).FillDown()
- xlSheet.Range("P2:P" & x + 1).FillDown()
- xlSheet.Range("Q2:Q" & x + 1).FillDown()
- xlSheet.Range("U2:U" & x + 1).FillDown()
- xlSheet.Range("V2:V" & x + 1).FillDown()
- xlSheet.Range("W2:W" & x + 1).FillDown()
- xlSheet.Range("X2:X" & x + 1).FillDown()
- xlSheet.Range("Y2:Y" & x + 1).FillDown()
- xlSheet.Range("AD2:AD" & x + 1).FillDown()
- xlSheet.Range("AE2:AE" & x + 1).FillDown()
-
-
-
- xlSheet2.Range("C2:C" & yy).FillDown()
- xlSheet2.Range("A2:A" & yy).FillDown()
-
- xlSheet2.Range("G2:G" & yy).FillDown()
-
- xlSheet2.Range("N2:N" & yy).FillDown()
- xlSheet2.Range("O2:O" & yy).FillDown()
- xlSheet2.Range("P2:P" & yy).FillDown()
- xlSheet2.Range("S2:S" & yy).FillDown()
- xlSheet2.Range("T2:T" & yy).FillDown()
-
- xlSheet2.Range("W2:W" & yy).FillDown()
- xlSheet2.Range("X2:X" & yy).FillDown()
- xlSheet2.Range("Y2:Y" & yy).FillDown()
- xlSheet2.Range("AB2:AB" & yy).FillDown()
- xlSheet2.Range("AC2:AC" & yy).FillDown()
-
-
- Dim PTCache As Microsoft.Office.Interop.Excel.PivotCache
- Dim PT As Microsoft.Office.Interop.Excel.PivotTable
-
-
- PTCache = xlBook.PivotCaches.Add _
- (SourceType:=Microsoft.Office.Interop.Excel.XlPivotTableSourceType.xlDatabase,
- SourceData:=xlSheet2.Range("a1:BN" & xlSheet2.UsedRange.Rows.Count).CurrentRegion.Address)
-
- PT = PTCache.CreatePivotTable _
- (TableDestination:=xlSheet2.Cells(2, 67),
- TableName:="PivotTable1")
-
- With PT
- '.PivotFields("批号").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlColumnField
- .PivotFields("批号").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlRowField
- .PivotFields("实发数量").Orientation = Microsoft.Office.Interop.Excel.XlPivotFieldOrientation.xlDataField
- End With
-
- xlSheet2.PivotTables("PivotTable1").TableStyle2 = "PivotStyleMedium9"
-
-
-
-
-
-
-
-
-
-
-
- 'dt = New DataTable
- 'sql = "SELECT no, sf, order_no, i_no, color, thick, deli_no, serial, card, filename, work_no, orderitem, pattern, cust, date FROM rt_ship_temp"
- 'cmd.CommandText = sql
- 'da.SelectCommand = cmd
- 'da.Fill(dt)
-
-
- 'For x As Integer = 0 To dt.Rows.Count - 1
-
-
- ' xlSheet2.Cells(x + 2, 2) = dt.Rows(x).Item("date")
- ' xlSheet2.Cells(x + 2, 4) = My
- ' xlSheet2.Cells(x + 2, 6) = "1"
- ' xlSheet2.Cells(x + 2, 9) = dt.Rows(x).Item("cust")
- ' xlSheet2.Cells(x + 2, 12) = "FXF02"
- ' xlSheet2.Cells(x + 2, 14) = "233"
- ' xlSheet2.Cells(x + 2, 16) = "112"
-
-
- ' xlSheet2.Cells(x + 2, 17) = "成品仓阿娇"
- ' xlSheet2.Cells(x + 2, 21) = "XSLX01"
-
- ' xlSheet2.Cells(x + 2, 24) = "0"
-
- ' xlSheet2.Cells(x + 2, 30) = "017"
- ' xlSheet2.Cells(x + 2, 34) = "0"
- ' xlSheet2.Cells(x + 2, 46) = dt.Rows(x).Item("order_no")
-
-
-
-
-
- 'Next
-
-
-
-
- MsgBox("")
-
-
- End Sub
-
- Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
-
- End Sub
-
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click '更新发货单号
-
- 'Dim p1, p2 As String
-
- 'If chkZhiDan.SelectedIndices.Count = 0 Then
- ' MsgBox("请先选择发货人")
- ' Exit Sub
-
- 'Else
-
- ' p1 = chkZhiDan.SelectedItem
- 'End If
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- If DataGridView2.Columns.Contains("项次号") Then
-
-
-
-
- If DataGridView2.Columns.Contains("备注") Then
-
-
- For x As Integer = 0 To DataGridView2.Rows.Count - 1
- sql = "update rt_ship_temp_1 Set deli_no=N'" & DataGridView2.Rows(x).Cells("发货单号").Value & "',deli=N'" & DataGridView2.Rows(x).Cells("发货人").Value & "' where po_no =N'" & DataGridView2.Rows(x).Cells("订单号").Value & "' and work_no=N'" & DataGridView2.Rows(x).Cells("指令号").Value & "' and name=N'" & DataGridView2.Rows(x).Cells("品名").Value & "' and color1=N'" & DataGridView2.Rows(x).Cells("颜色").Value & "' and order_item='" & DataGridView2.Rows(x).Cells("项次号").Value & "' and filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & "' and comment=N'" & DataGridView2.Rows(x).Cells("备注").Value & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- Next
-
- Else
-
- For x As Integer = 0 To DataGridView2.Rows.Count - 1
- sql = "update rt_ship_temp_1 Set deli_no=N'" & DataGridView2.Rows(x).Cells("发货单号").Value & "',deli=N'" & DataGridView2.Rows(x).Cells("发货人").Value & "' where po_no =N'" & DataGridView2.Rows(x).Cells("订单号").Value & "' and work_no=N'" & DataGridView2.Rows(x).Cells("指令号").Value.replace("'", "''") & "' and name=N'" & DataGridView2.Rows(x).Cells("品名").Value & "' and color1=N'" & DataGridView2.Rows(x).Cells("颜色").Value & "' and order_item='" & DataGridView2.Rows(x).Cells("项次号").Value & "' and filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- Next
-
- End If
-
-
-
- Else
-
-
- For x As Integer = 0 To DataGridView2.Rows.Count - 1
-
- If DataGridView2.Rows(x).Cells("发货单号").Value Is Nothing Then
- Else
- sql = "update rt_ship_temp_1 Set deli_no=N'" & DataGridView2.Rows(x).Cells("发货单号").Value & "',deli=N'" & DataGridView2.Rows(x).Cells("发货人").Value & "' where po_no =N'" & DataGridView2.Rows(x).Cells("订单号").Value.ToString.Replace("'", "''") & "' and work_no=N'" & DataGridView2.Rows(x).Cells("指令号").Value.ToString.Replace("'", "''") & "' and name=N'" & DataGridView2.Rows(x).Cells("品名").Value.ToString.Replace("'", "''") & "' and color1=N'" & DataGridView2.Rows(x).Cells("颜色").Value & "' and thick='" & DataGridView2.Rows(x).Cells("厚度").Value & "' and filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- End If
-
-
-
- Next
- End If
-
-
-
-
- MsgBox("")
- End Sub
-
- Private Sub chkZhiDan_SelectedIndexChanged(sender As Object, e As EventArgs) Handles chkZhiDan.SelectedIndexChanged
-
-
-
-
- Dim index1, index2 As Integer
-
- index1 = chkZhiDan.SelectedIndex
-
-
-
- For x As Integer = 0 To chkZhiDan.Items.Count - 1
-
- If x <> index1 Then
- chkZhiDan.SetItemChecked(x, False)
- Else
- chkZhiDan.SetItemChecked(index1, True)
-
-
-
- For y As Integer = 0 To DataGridView2.Rows.Count - 1
- DataGridView2.Rows(y).Cells("发货人").Value = chkZhiDan.SelectedItem
- Next
-
-
-
- End If
-
-
- Next
-
-
-
-
-
-
-
-
-
-
- End Sub
-
-
-
- Private Sub chkZhiDan_MouseClick(sender As Object, e As MouseEventArgs) Handles chkZhiDan.MouseClick
- 'Dim index1, index2 As Integer
-
- 'index1 = chkZhiDan.SelectedIndex
-
-
-
-
-
-
-
-
-
-
- 'For x As Integer = 0 To chkZhiDan.Items.Count - 1
-
- ' If x <> index1 Then
- ' chkZhiDan.SetItemChecked(x, False)
- ' Else
- ' chkZhiDan.SetItemChecked(index1, True)
- ' End If
-
-
- 'Next
-
- End Sub
-
- Private Sub chkSongHuo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles chkSongHuo.SelectedIndexChanged
-
-
-
- Dim index1, index2 As Integer
-
- index1 = chkSongHuo.SelectedIndex
-
-
-
-
-
-
-
-
-
-
- For x As Integer = 0 To chkSongHuo.Items.Count - 1
-
- If x <> index1 Then
- chkSongHuo.SetItemChecked(x, False)
- Else
- chkSongHuo.SetItemChecked(index1, True)
- End If
-
-
- Next
-
-
- End Sub
-
- Private Sub DataGridView2_MouseUp(sender As Object, e As MouseEventArgs) Handles DataGridView2.MouseUp
-
-
- Dim x As Double = 0
- Dim y As Double = 0
- Dim z As Double = 0
- Dim a As Int16 = 0
- Dim b As Double = 0
-
- For i As Integer = 0 To DataGridView2.SelectedRows.Count - 1
-
- x = x + Math.Round(DataGridView2.Rows(DataGridView2.SelectedRows.Item(i).Index).Cells("尺数").Value, 2)
-
-
-
- Next i
-
- TextBox3.Text = DataGridView2.SelectedRows.Count
-
- TextBox2.Text = x
-
-
-
-
- End Sub
-
- Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
-
- Dim cust As String
- Dim name As String
- Dim my_po As String
- Dim work_no As String
- Dim my_date As String
-
- Dim my_color As String
- Dim my_thick As String
-
- Dim my_qty As Double
-
- Dim deli_no As String
-
- Dim deli As String
-
- my_date = InputBox("请输入日期")
-
- cust = InputBox("请输入客户")
- name = InputBox("请输入品名")
-
- my_po = InputBox("请输入订单号")
- work_no = InputBox("请输入指令号")
- my_color = InputBox("请输入颜色")
-
- my_thick = InputBox("请输入厚度")
-
- my_qty = InputBox("请输入数量")
-
- deli = InputBox("请输入发货人")
-
- deli_no = InputBox("请输入发货单号")
-
- Dim s1 As Integer
-
- sql = "select serial from rt_ship_temp_1 where filename=N'" & cust & my_date & "'"
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar Is Nothing Then
- s1 = 1
- Else
- s1 = cmd.ExecuteScalar + 1
-
- End If
-
-
-
- sql = "insert into rt_ship_temp_1 (color1,work_no,thick,po_no,filename,name,qty,deli,deli_no) values(N'" & my_color & "',N'" & work_no.ToString.Replace("'", "''") & "',N'" & my_thick & "',N'" & my_po & "',N'手动" & cust & my_date & ".xls',N'" & name & "','" & my_qty & "',N'" & deli & "','" & deli_no & "')"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- getdate()
-
- Button6.PerformClick()
-
-
-
- MsgBox("")
- End Sub
-
- Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
-
- Dim dt As DataTable
-
- sql = "select count(*) from rt_ship_temp_1 where cust is null or custname is null"
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
-
- sql = "select filename 档案名,color1 as 颜色,qty as 尺数,no as 序号 from rt_ship_temp_1 where cust is null or custname is null order by filename"
- dt = New DataTable
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
- MsgBox("请检查客户名/客户编号")
- Exit Sub
-
- End If
-
- sql = "select count(*) from rt_ship_temp_1 where date is null"
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
- sql = "select filename 档案名,color1 as 颜色,qty as 尺数,no as 序号 from rt_ship_temp_1 where date is null order by filename"
- dt = New DataTable
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
- MsgBox("请检查出货日期")
- Exit Sub
-
- End If
-
-
- sql = "select count(*) from rt_ship_temp_1 where color1 is null "
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
-
- sql = "select filename 档案名,color1 as 颜色,qty as 尺数,no as 序号 from rt_ship_temp_1 where color1 is null order by filename"
- dt = New DataTable
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
- da.Fill(dt)
-
- dgv1.DataSource = dt
-
- MsgBox("请检查颜色栏位")
- Exit Sub
-
- End If
-
-
- sql = "select count(*) from rt_ship_temp_1 where deli is null "
- cmd.CommandText = sql
-
- If cmd.ExecuteScalar > 0 Then
-
- MsgBox("请检查送货人")
- Exit Sub
-
- End If
-
-
- End Sub
-
- Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
- getdate()
- MsgBox("")
- End Sub
-
- Private Sub update_custname()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.050' ,custname=N'金威利' where filename like N'%076%' and filename not like N'%076样%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.109' ,custname=N'正纬(人民币)' where filename like N'%正纬%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.98' ,custname=N'金帝' where filename like N'%温州%' or filename like N'%金帝%' or filename like N'%湖北%' or filename like N'%泉州%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- 'sql = "update rt_ship_temp_1 set cust=N'A01.98' ,custname=N'金帝' where filename like N'%金帝%' "
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.006-1' ,custname=N'吉兴(美元)' where filename like N'%吉兴%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set cust=N'A01.061-1' ,custname=N'松城(美元)' where filename like N'%松城%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set cust=N'A01.006-1' ,custname=N'吉兴(美元)' where filename like N'%吉兴%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set cust=N'A01.107' ,custname=N'赛特' where filename like N'%赛特%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.092' ,custname=N'合成行东莞有限公司' where filename like N'%合成行%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.056-1' ,custname=N'永弘(美元)' where filename like N'%永弘%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A00.048' ,custname=N'珍琦' where filename like N'%珍琦%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.104' ,custname=N'咏升' where filename like N'%咏升%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.003' ,custname=N'美迪洋' where filename like N'%美迪洋%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.028-1' ,custname=N'中山华新(美元)' where filename like N'%华新%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.043' ,custname=N'惠雄' where filename like N'%惠雄%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.015-1' ,custname=N'欣錩(美元)' where filename like N'%欣昌%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'C.09.003' ,custname=N'鑫龙' where filename like N'%鑫龙%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A00.001' ,custname=N'现金' where filename like N'%有人鞋业%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A00.001' ,custname=N'现金' where filename like N'%富拓%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.090' ,custname=N'鑫茂' where filename like N'%鑫茂%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.068-1' ,custname=N'东治(美元)' where filename like N'%东治%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.084' ,custname=N'鑫越' where filename like N'%商汤%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A00.049' ,custname=N'利亚' where filename like N'%利亚%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set cust=N'A00.049' ,custname=N'利亚' where filename like N'%浩博%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.080' ,custname=N'百合' where filename like N'%百合%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.022-1' ,custname=N'三元鞋厂(美元)' where filename like N'%三元%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.004-1' ,custname=N'大田(美元)' where filename like N'%大田%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.082-1' ,custname=N'THANG LONG美元' where filename like N'%THANG%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A02.11' ,custname=N'源泰' where filename like N'%聚兴%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.105' ,custname=N'好兄弟鞋业' where (filename like N'%好兄弟%' OR FILENAME LIKE N'%名扬%' OR FILENAME LIKE N'%名创%' OR FILENAME LIKE N'%名晋%' OR FILENAME LIKE N'%名志%' OR FILENAME LIKE N'%名越%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A02.004' ,custname=N'华昌皮业' where (filename like N'%华世%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.110' ,custname=N'华鑫(美元)' where (filename like N'%华鑫%') "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set cust=N'A00.049' ,custname=N'利亚' where (filename like N'%顺泰盛%' OR FILENAME LIKE N'%红晟%' OR FILENAME LIKE N'%lpcc%' OR FILENAME LIKE N'%荣创%' ) "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set cust=N'A01.071' ,custname=N'旭晨' where filename like N'%旭晨%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A06.001' ,custname=N'许宝贝' where filename like N'%宝贝%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.058-1' ,custname=N'HATAY(美元)' where filename like N'%HATAY%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- sql = "update rt_ship_temp_1 set cust=N'A01.050-2' ,custname=N'金威利样品' where filename like N'%076样%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.054-1' ,custname=N'中山志捷(美元)' where filename like N'%志捷%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.054-1' ,custname=N'中山志捷(美元)' where filename like N'%正永%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A02.10' ,custname=N'锐奇鞋业' where filename like N'%锐奇%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.016-1' ,custname=N'何先生/SAMIL(美元)' where filename like N'%SAMIL%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.002-1' ,custname=N'上杰(越南)(美元)' where filename like N'%上杰%'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.040-1' ,custname=N'东家(美元)' where filename like N'%东家%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.100' ,custname=N'永驰' where filename like N'%永驰%'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.052-1' ,custname=N'永正(美元)' where filename like N'%永正%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.000' ,custname=N'威弘' where filename like N'%威弘%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.019-1' ,custname=N'亿博(美元)' where filename like N'%亿博%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.033-1' ,custname=N'颖亿(美元)' where filename like N'%穎億%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.005-1' ,custname=N'宏美二厂(美元)' where filename like N'%宏美%' or filename like N'%reebok%' " '----待改
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.048' ,custname=N'极路客' where filename like N'%极路客%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.008-1' ,custname=N'加和(美元)' where filename like N'%加和%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.067-1' ,custname=N'创德(美元)' where filename like N'%evergree%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.062-1' ,custname=N'PROPERWELL(美元)' where filename like N'%properwell%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.063-1' ,custname=N'coach(美元)' where filename like N'%thanh%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.063-1' ,custname=N'coach(美元)' where filename like N'%STELLA%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.063-1' ,custname=N'coach(美元)' where filename like N'%coach%' or filename like '%INDIA%' or filename like '%PONTUS%' or filename like '%RAMA%' or filename like '%INDIA%' or filename like '%KHE%' or filename like '%BRANCH%'"
- cmd.CommandText = sql
- cmd.ExecuteScalar() 'sql = "update rt_ship_temp_1 set cust=N'' ,custname=N'coach(美元)' where filename like N'%076样%' "
- 'cmd.CommandText = sql
- 'cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.024-1' ,custname=N'PEI HAI-BRM(美元)' where filename like N'%pei hai%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.073-1' ,custname=N'澳孚(美元)' where filename like N'%澳孚%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.001-1' ,custname=N'宏福(美元)' where filename like N'%宏福%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.102' ,custname=N'永丰' where filename like N'%永丰%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
- sql = "update rt_ship_temp_1 set cust=N'A01.087' ,custname=N'乐迪' where filename like N'%乐迪%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.088' ,custname=N'铭鑫' where filename like N'%铭鑫%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.060' ,custname=N'励泰' where filename like N'%励泰%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A06.008' ,custname=N'周连发' where filename like N'%周连发%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- sql = "update rt_ship_temp_1 set cust=N'A01.022-1' ,custname=N'三元鞋厂(美元)' where filename like N'%三元%' "
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
- MsgBox("")
-
- End Sub
-
- Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
- update_custname()
- End Sub
-
- Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
-
-
-
- Dim new_card As String
-
- new_card = InputBox("请输入新卡号")
-
-
-
- Dim msg As MsgBoxResult = MsgBox("确认要将卡号" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("卡号").Value & "替换为" & new_card & " ?", MsgBoxStyle.YesNo, "警告")
-
-
-
- If msg = vbYes Then
-
-
-
-
-
- If DataGridView2.Columns.Contains("项次号") Then
-
-
-
-
- If DataGridView2.Columns.Contains("备注") Then
-
-
-
- sql = "update rt_ship_temp_1 Set card='" & new_card & "' where po_no =N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("订单号").Value & "' and work_no=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("指令号").Value & "' and name=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("品名").Value & "' and card='" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("卡号").Value & "' and order_item='" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("项次号").Value & "' and filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & "' and comment=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("备注").Value & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- Else
-
- sql = "update rt_ship_temp_1 Set card='" & new_card & "' where po_no =N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("订单号").Value & "' and work_no=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("指令号").Value & "' and name=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("品名").Value & "' and card='" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("卡号").Value & "' and order_item='" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("项次号").Value & "' and filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
- End If
-
-
-
- Else
-
-
-
-
-
-
- sql = "update rt_ship_temp_1 Set card='" & new_card & "' where po_no =N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("订单号").Value.ToString.Replace("'", "''") & "' and work_no=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("指令号").Value.ToString.Replace("'", "''") & "' and name=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("品名").Value.ToString.Replace("'", "''") & "' and thick='" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("厚度").Value & "' and card='" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("卡号").Value & "' and filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & "'"
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
-
-
-
-
- End If
-
-
-
-
-
-
-
-
-
- Else
-
-
-
-
-
-
-
- End If
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MsgBox("")
-
-
-
-
- End Sub
-
- Private Sub DataGridView1_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
-
-
-
-
- ' If DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*上杰*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*宏美发*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*永正*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*宏福*" Then '---加order_item
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,order_item as 项次号, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,order_item,deli,deli_no"
-
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号,order_item as 项次号,CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.order_item, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- ' rt_ship_temp_1.order_item AS 项次号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.order_item, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- ' If DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*上杰*" Then
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,order_item as 项次号, cast(sum(qty) as numeric(10,1)) as 尺数,comment as 备注,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,order_item,comment,deli,deli_no"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号,order_item as 项次号,CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数, rt_ship_temp_1.comment as 备注,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.comment,rt_ship_temp_1.order_item, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- ' rt_ship_temp_1.order_item AS 项次号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.order_item, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- ' End If
-
-
-
-
- ' ElseIf DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*076样*" Or DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value Like "*好兄弟*" Then '-----加comment
-
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号,comment as 备注, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,comment,deli_no,deli"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号,comment as 备注, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no,rt_ship_temp_1.comment, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,comment as 备注,
- ' CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.comment, rt_ship_temp_1.deli, rt_finish_stock.name"
-
-
- ' Else '---其他
-
- ' sql = "select name as 品名,color1 as 颜色,thick as 厚度,card as 卡号,po_no as 订单号,work_no as 指令号, cast(sum(qty) as numeric(10,1)) as 尺数,deli as 发货人,deli_no as 发货单号 from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' group by name,color1,thick,card,po_no,work_no,deli_no,deli"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, RT_RETAN_RECORD.source AS 皮源, rt_ship_temp_1.po_no AS 订单号,
- ' rt_ship_temp_1.work_no AS 指令号, CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' RT_RETAN_RECORD ON rt_ship_temp_1.card = RT_RETAN_RECORD.card
- 'WHERE (rt_ship_temp_1.filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.deli, RT_RETAN_RECORD.source"
-
- ' sql = "SELECT rt_ship_temp_1.name AS 品名, rt_ship_temp_1.color1 AS 颜色, rt_ship_temp_1.thick AS 厚度,
- ' rt_ship_temp_1.card AS 卡号, rt_finish_stock.name, rt_ship_temp_1.po_no AS 订单号, rt_ship_temp_1.work_no AS 指令号,
- ' CAST(SUM(rt_ship_temp_1.qty) AS numeric(10, 1)) AS 尺数,
- ' rt_ship_temp_1.deli AS 发货人, rt_ship_temp_1.deli_no AS 发货单号
- 'FROM rt_ship_temp_1 LEFT OUTER JOIN
- ' rt_finish_stock ON rt_ship_temp_1.card = rt_finish_stock.lot
- 'WHERE (rt_ship_temp_1.filename = N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "')
- 'GROUP BY rt_ship_temp_1.name, rt_ship_temp_1.color1, rt_ship_temp_1.thick, rt_ship_temp_1.card, rt_ship_temp_1.po_no,
- ' rt_ship_temp_1.work_no, rt_ship_temp_1.deli_no, rt_ship_temp_1.deli, rt_finish_stock.name"
- ' End If
-
-
-
- ' cmd.CommandText = sql
- ' da.SelectCommand = cmd
- ' dt1 = New DataTable
- ' da.Fill(dt1)
- ' DataGridView2.DataSource = Nothing
- ' DataGridView2.DataSource = dt1
-
- ' DataGridView2.Columns(0).Width = 400
- ' DataGridView2.Columns(1).Width = 200
- ' DataGridView2.Columns(3).Width = 200
-
-
-
-
- End Sub
-
-
-
- Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
-
- If dgv_edit.Visible = False Then
- dgv_edit.Visible = True
- Button11.Enabled = True
- Else
- dgv_edit.Visible = False
- Button11.Enabled = False
- Exit Sub
-
- End If
-
-
-
- sql = "select date,name,po_no,work_no,qty as 尺数,card,order_no,deli,deli_no,id from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "' and name=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("品名").Value & "' and card=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("卡号").Value & "' and po_no=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("订单号").Value & "' and thick=N'" & DataGridView2.Rows(DataGridView2.CurrentCell.RowIndex).Cells("厚度").Value & "'" & " order by id "
-
-
- cmd.CommandText = sql
-
-
-
-
-
-
-
-
-
- dgv_edit.Visible = True
-
-
- da.SelectCommand = cmd
- dt1 = New DataTable
- da.Fill(dt1)
-
-
- Dim myRow As DataRow
- myRow = dt1.NewRow
- If IsDBNull(dt1.Compute("sum(尺数)", "")) Then
- myRow(4) = 0
- Else
- myRow(4) = Math.Round(dt1.Compute("sum(尺数)", ""), 1)
- End If
-
-
- myRow(3) = "合计"
-
-
-
-
-
- dt1.Rows.InsertAt(myRow, 0)
-
-
-
- dgv_edit.DataSource = dt1
-
- dgv_edit.Columns(0).Width = 150
- dgv_edit.Columns(1).Width = 150
- dgv_edit.Columns(3).Width = 150
-
-
-
- End Sub
-
- Private Sub dgv_edit_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgv_edit.CellContentClick
-
- End Sub
-
- Private Sub dgv_edit_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgv_edit.CellMouseUp
-
-
-
- Dim x As Double = 0
- Dim y As Double = 0
- Dim z As Double = 0
- Dim a As Int16 = 0
- Dim b As Double = 0
-
- For i As Integer = 0 To dgv_edit.SelectedRows.Count - 1
-
- x = x + Math.Round(dgv_edit.Rows(dgv_edit.SelectedRows.Item(i).Index).Cells("尺数").Value, 1)
-
-
-
- Next i
-
- ' TextBox3.Text = dgv2.SelectedRows.Count
-
-
- TextBox5.Text = x
-
-
-
-
- End Sub
-
- Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
-
-
-
- Dim my_card As String = ""
-
-
- my_card = InputBox("请输入新卡号")
-
-
- Dim msg As MsgBoxResult
-
-
- msg = MsgBox("确定将卡号更改为 : " & my_card & "?", vbYesNo)
-
-
- If msg = vbNo Then Exit Sub
-
-
-
-
-
- For i As Integer = 0 To dgv_edit.SelectedRows.Count - 1
-
-
- sql = "update rt_ship_temp_1 set card=N'" & my_card & "' where id='" & dgv_edit.Rows(dgv_edit.SelectedRows.Item(i).Index).Cells("id").Value & "'"
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
-
-
-
-
- Next i
-
- MsgBox("修改完成")
-
- update() '更新资料
-
-
-
-
- End Sub
-
- Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
-
- Dim dt As New DataTable
- Dim file_name As String = ""
-
- Dim a As Integer = 0
- Dim my_count As Integer = 0
- If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
-
- file_name = OpenFileDialog1.FileName
-
- End If
-
-
-
-
-
-
- Dim filepath As String = "k3/在制品"
-
- Dim sourceFileName As String = file_name
-
-
- Dim address2 As String = "ftp://" & my_ip & ":7788/" & filepath & "/" & OpenFileDialog1.SafeFileName
-
- Dim address3() As String
-
- address3 = Split(address2, "ftp://" & my_ip & ":7788/")
- Dim add4 As String
-
- add4 = "d:\k3\在制品\" & OpenFileDialog1.SafeFileName
-
-
- Dim userName As String = "matchy3c"
- Dim password As String = "Lafayette11"
- Dim showUI As Boolean = True
- Dim connectionTimeout As Integer = 500
-
-
- Dim client As WebClient = New WebClient
- client.Credentials = New NetworkCredential(userName, password)
- client.Proxy = GlobalProxySelection.GetEmptyWebProxy()
- client.UploadFile(address2, sourceFileName)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- sql = "delete from rt_finish_stock" '-------
- cmd.CommandText = sql
- cmd.ExecuteNonQuery()
-
- sql = "Select * FROM OPENDATASOURCE ('Microsoft.ACE.OLEDB.12.0','Excel 12.0;HDR=Yes;IMEX=1;Database=" & add4 & "')...[即时库存$]"
-
- cmd.CommandText = sql
-
- da.SelectCommand = cmd
- da.Fill(dt)
- dgv1.DataSource = dt
-
-
- dt.Columns.Add("filename")
-
- For x As Integer = 0 To dt.Rows.Count - 1
- dt.Rows(x).Item("filename") = file_name
- Next
-
-
- Dim my_sqlbulk As New SqlBulkCopy(conn)
-
- my_sqlbulk.DestinationTableName = "dbo.rt_finish_stock"
- my_sqlbulk.WriteToServer(dt)
-
- MsgBox("导入完成!")
-
-
-
-
- End Sub
-
- Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
-
- sql = "delete from rt_ship_temp_1 where filename=N'" & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & "'"
-
-
- Dim msg As String
- msg = MsgBox("确定要删除 " & DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells("filename").Value & " ?", vbYesNo)
-
- If msg = vbNo Then
- Exit Sub
- Else
-
-
- cmd.CommandText = sql
- cmd.ExecuteScalar()
-
- MsgBox("已删除")
-
- update()
-
-
- End If
-
-
-
-
- End Sub
-
- Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
-
- Dim dt As New DataTable
-
- sql = "select date as 日期,cust as 客户,card as 卡号,color as 颜色,source as 皮源, cast(SUM(sf) as numeric(10,1)) AS 尺数 from rt_measure_daily where color like N'%" & TextBox6.Text & "%' group by date,cust,card,color,source order by Date desc"
- cmd.CommandText = sql
- da.SelectCommand = cmd
-
- da.Fill(dt)
-
- dgv_color.DataSource = dt
-
- dgv_color.Columns(2).Width = 150
- dgv_color.Columns(3).Width = 200
- dgv_color.Columns(4).Width = 200
-
- sql = "SELECT top(30) date as 日期, custname as 客户, name as 品名, cast(SUM(qty) as numeric(10,1)) AS 尺数 FROM rt_ship_temp_1 WHERE name like N'%" & TextBox6.Text & "%' GROUP BY date, cust, color1, name, custname
- ORDER BY date DESC"
-
- cmd.CommandText = sql
- da.SelectCommand = cmd
-
- dt = New DataTable
-
- da.Fill(dt)
-
- dgv_out.DataSource = dt
-
-
- dgv_out.Columns(1).Width = 120
- dgv_out.Columns(2).Width = 220
-
-
-
- End Sub
-
- Private Sub TextBox7_TextChanged(sender As Object, e As EventArgs) Handles TextBox7.TextChanged
-
- End Sub
-
- Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click ' 汇出(毛)
-
-
-
- ' Dim xlApp As Microsoft.Office.Interop.Excel.Application
- ' Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
- ' Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
-
-
-
- ' xlApp = CreateObject("Excel.Application")
-
- ' xlBook = xlApp.Workbooks.Add
-
-
- ' xlApp.DisplayAlerts = False
- ' xlBook.Activate()
- ' xlBook.Parent.Windows(1).Visible = True
- ' xlSheet = xlBook.Worksheets.Add
- ' xlSheet.Activate()
- ' xlApp.Visible = True
-
-
- ' Dim xx As Integer = 0
- ' Dim y As Integer = 0
- ' Dim P1 As Image
- ' Dim P2 As Image
- ' Dim P3 As Image
- ' Dim P4 As Image
- ' Dim P5 As Image
- ' Dim P6 As Image
- ' Dim P7 As Image
- ' Dim P8 As Image
- ' Dim P9 As Image
-
-
- ' Dim FILE_NAME As String
- ' Dim FILE_NAME1 As String
-
-
-
-
-
-
-
- ' sql = "SELECT RT_SYS_CHEM_MAIN.name AS 化料名称, RT_SYS_CHEM_MAIN.DEP AS 使用部门,
- ' RT_SYS_CHEM_MAIN.CLASS1 AS 化工分类, RT_SYS_CHEM_MAIN.CLASS2 AS 海关分类,
- ' RT_CHEM_MSDS.SUPPLIER AS 供应商, RT_CHEM_MSDS.D1, RT_CHEM_MSDS.D2, RT_CHEM_MSDS.D3,
- ' RT_CHEM_MSDS.D4, RT_CHEM_MSDS.D5, RT_CHEM_MSDS.D6, RT_CHEM_MSDS.D7, RT_CHEM_MSDS.D8,
- ' RT_CHEM_MSDS.D9, RT_SYS_CHEM_MAIN.stock1, RT_SYS_CHEM_MAIN.stock2, RT_SYS_CHEM_MAIN.stock3,
- ' RT_CHEM_MSDS.SUPPLIER
- 'FROM RT_SYS_CHEM_MAIN LEFT OUTER JOIN
- ' RT_CHEM_MSDS ON RT_SYS_CHEM_MAIN.name = RT_CHEM_MSDS.SYS_NAME
- 'WHERE (RT_SYS_CHEM_MAIN.stock1 + RT_SYS_CHEM_MAIN.stock2 + RT_SYS_CHEM_MAIN.stock3 <> 0)"
-
- ' Dim DT As New DataTable
- ' cmd.CommandText = sql
- ' da.SelectCommand = cmd
- ' da.Fill(DT)
-
-
-
-
-
-
- ' Dim z1 As Integer = 0
-
- ' For x As Integer = 0 To DT.Rows.Count - 1
-
-
- ' Dim MY_CHEM As String
-
- ' MY_CHEM = DT.Rows(x).Item("化料名称").ToString
- ' MY_CHEM = MY_CHEM.Replace(" ", "_")
- ' ' MY_CHEM = MY_CHEM.Replace("-", "_")
- ' MY_CHEM = MY_CHEM.Replace("/", "-")
-
-
- ' ' xlSheet = xlBook.Worksheets.Add
- ' 'xlSheet.Name = MY_CHEM
- ' 'xlSheet.Activate()
- ' ' xlSheet.Hyperlinks.Add(Anchor:=xlSheet.Cells(1, 1), Address:="", SubAddress:="总表!A1", TextToDisplay:="总表")
-
-
- ' xlSheet.Cells(x * 16 + 1, 1) = DT.Rows(x).Item("化料名称")
- ' xlSheet.Cells(x * 16 + 1, 1).font.bold = True
- ' xlSheet.Cells(x * 16 + 1, 1).font.size = 24
-
- ' xlApp.Range(xlSheet.Cells(x * 16 + 1, 1), xlSheet.Cells(x * 16 + 1, 8)).Select()
- ' ' xlApp.Range("E2").Activate()
- ' xlApp.Selection.Merge
- ' xlApp.Selection.HorizontalAlignment = xlCenter
- ' With xlApp.Selection.Borders(xlEdgeLeft)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeTop)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeBottom)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeRight)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
-
-
- ' xlSheet.Cells(x * 16 + 7, 1) = "化 工 分 类 :"
- ' xlSheet.Cells(x * 16 + 7, 1).font.bold = True
- ' xlSheet.Cells(x * 16 + 7, 1).font.size = 12
- ' xlSheet.Cells(x * 16 + 7, 3) = DT.Rows(x).Item("化工分类")
- ' xlSheet.Cells(x * 16 + 7, 3).font.bold = True
- ' xlSheet.Cells(x * 16 + 7, 3).font.size = 12
- ' xlSheet.Cells(x * 16 + 4, 1) = "供 应 商 :"
- ' xlSheet.Cells(x * 16 + 4, 1).font.bold = True
- ' xlSheet.Cells(x * 16 + 4, 1).font.size = 12
- ' xlSheet.Cells(x * 16 + 4, 3) = DT.Rows(x).Item("供应商")
- ' xlSheet.Cells(x * 16 + 4, 3).font.bold = True
- ' xlSheet.Cells(x * 16 + 4, 3).font.size = 12
- ' xlSheet.Cells(x * 16 + 12, 1) = "验收日期/批号 :"
- ' xlSheet.Cells(x * 16 + 12, 1).font.bold = True
- ' xlSheet.Cells(x * 16 + 12, 1).font.size = 12
-
- ' xlSheet.Cells(x * 16 + 15, 1) = "有 效 期 限 : 二 年"
- ' xlSheet.Cells(x * 16 + 15, 1).font.bold = True
- ' xlSheet.Cells(x * 16 + 15, 1).font.size = 12
-
-
-
- ' xlApp.Range(xlSheet.Cells(x * 16 + 6, 5), xlSheet.Cells(x * 16 + 15, 8)).Select()
- ' ' xlApp.Range("E2").Activate()
- ' '
- ' ' xlApp.Selection.Merge
- ' ' xlApp.Selection.HorizontalAlignment = xlCenter
- ' With xlApp.Selection.Borders(xlEdgeLeft)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeTop)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeBottom)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeRight)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
-
-
-
-
- ' xlApp.Range(xlSheet.Cells(x * 16 + 4, 8), xlSheet.Cells(x * 16 + 5, 8)).Select()
- ' ' xlApp.Range("E2").Activate()
- ' '
- ' xlApp.Selection.Merge
- ' xlApp.Selection.FormulaR1C1 = "危险"
- ' xlApp.Selection.HorizontalAlignment = xlCenter
-
- ' '-----边框
- ' With xlApp.Selection.Borders(xlEdgeLeft)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeTop)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeBottom)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
- ' With xlApp.Selection.Borders(xlEdgeRight)
- ' .LineStyle = xlContinuous
- ' .ColorIndex = 0
- ' .TintAndShade = 0
- ' .Weight = xlMedium
- ' End With
-
-
-
- ' '------字体
- ' With xlApp.Selection.Interior
- ' .Pattern = xlSolid
- ' .PatternColorIndex = xlAutomatic
- ' .ThemeColor = xlThemeColorLight1
- ' .TintAndShade = 0
- ' .PatternTintAndShade = 0
- ' End With
- ' With xlApp.Selection.Font
- ' .ThemeColor = xlThemeColorDark1
- ' .TintAndShade = 0
- ' End With
- ' With xlApp.Selection.Font
- ' .Size = 18
- ' .ThemeColor = xlThemeColorDark1
- ' .ThemeFont = xlThemeFontMinor
- ' End With
-
-
-
-
- ' Dim zzz As Integer = 0
- ' For z As Integer = 1 To 9
-
- ' If Not (IsDBNull(DT.Rows(x).Item("d" & z))) Then
-
- ' System.Windows.Forms.Clipboard.SetDataObject(p(z), True) '复制到剪贴板
-
- ' If zzz < 4 Then
-
- ' Dim range1 As Excel.Range = xlSheet.Range(xlApp.Cells(x * 16 + 6, zzz Mod 4 + 5), xlApp.Cells(x * 16 + 6, zzz Mod 4 + 5)) '粘贴图片的位置
- ' xlSheet.Paste(range1, p(z))
-
- ' Else
-
- ' Dim range1 As Excel.Range = xlSheet.Range(xlApp.Cells(x * 16 + 11, zzz Mod 4 + 5), xlApp.Cells(x * 16 + 11, zzz Mod 4 + 5)) '粘贴图片的位置
- ' xlSheet.Paste(range1, p(z))
-
- ' End If
-
-
-
- ' Dim pic1 As String
- ' pic1 = "picture " & z1 + 1
-
- ' xlApp.ActiveSheet.Shapes.Range(pic1).Select
- ' xlApp.Selection.ShapeRange.ScaleWidth(0.025, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoScaleFrom.msoScaleFromTopLeft)
- ' xlApp.Selection.ShapeRange.Incrementtop(5)
- ' xlApp.Selection.ShapeRange.Incrementleft(5)
-
-
- ' zzz = zzz + 1
- ' z1 = z1 + 1
- ' End If
-
-
- ' Next
-
-
-
-
-
-
- ' Dim r As String
- ' r = "A" & (x + 1) * 16 + 1
-
- ' xlApp.ActiveSheet.HPageBreaks.Add(xlApp.Range(r))
-
-
-
-
-
-
- ' Next
-
- ' ''xlApp.ActiveSheet.PageSetup.PrintArea = "$A$1:$E$660"
-
- ' 'xlApp.ActiveSheet.PageSetup.PrintArea = "$a$1:$E$" & y * 13
- ' '' xlSheet.Columns("C:C").ColumnWidth = 10.75
-
-
-
-
-
- ' xlApp.ActiveWindow.View = Microsoft.Office.Interop.Excel.XlWindowView.xlPageBreakPreview
-
-
-
-
-
-
- ' 'DT2.DefaultView.Sort = "项次 "
-
- ' MsgBox("输出完成")
-
-
-
- End Sub
-
- Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
-
- sql = "SELECT filename, CAST(SUM(qty) AS numeric(10, 1)) AS 尺数
- FROM rt_ship_temp_1
- WHERE (filename LIKE 'C:\a\11%')
- GROUP BY filename ORDER BY filename desc"
- cmd.CommandText = sql
-
- da.SelectCommand = cmd
-
- Dim dt As New DataTable
-
- da.Fill(dt)
-
- DataGridView1.DataSource = dt
-
- DataGridView1.Columns(0).Width = 300
-
-
- End Sub
- End Class
|