TWarehousebillsMapper.xml 203 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper">
  6. <resultMap type="TWarehousebills" id="TWarehousebillsResult">
  7. <result property="fId" column="f_id" />
  8. <result property="fBillno" column="f_billno" />
  9. <result property="fCustomsdeclartion" column="f_customsdeclartion" />
  10. <result property="fOriginalbillno" column="f_originalbillno" />
  11. <result property="fDeptid" column="f_deptid" />
  12. <result property="fBsdeptid" column="f_bsdeptid" />
  13. <result property="fContacts" column="f_contacts" />
  14. <result property="fTel" column="f_tel" />
  15. <result property="fCorpid" column="f_corpid" />
  16. <result property="fShipper" column="f_shipper" />
  17. <result property="fTocorpid" column="f_tocorpid" />
  18. <result property="fStltypeid" column="f_stltypeid" />
  19. <result property="fBscorpno" column="f_bscorpno" />
  20. <result property="fWarehouseid" column="f_warehouseid" />
  21. <result property="fStorekeeper" column="f_storekeeper" />
  22. <result property="fChargedate" column="f_chargedate" />
  23. <result property="fBsdate" column="f_bsdate" />
  24. <result property="fPlanqty" column="f_planqty" />
  25. <result property="fPlangrossweight" column="f_plangrossweight" />
  26. <result property="fPlannetweight" column="f_plannetweight" />
  27. <result property="fPlanvolumn" column="f_planvolumn" />
  28. <result property="fQty" column="f_qty" />
  29. <result property="fGrossweight" column="f_grossweight" />
  30. <result property="fNetweight" column="f_netweight" />
  31. <result property="fVolumn" column="f_volumn" />
  32. <result property="fTrademodeid" column="f_trademodeid" />
  33. <result property="fBillingway" column="f_billingway" />
  34. <result property="fSbu" column="f_sbu" />
  35. <result property="fFeetunit" column="f_feetunit" />
  36. <result property="fMblno" column="f_mblno" />
  37. <result property="fEmblno" column="f_emblno" />
  38. <result property="fCompany" column="f_company" />
  39. <result property="fVslvoy" column="f_vslvoy" />
  40. <result property="fEta" column="f_eta" />
  41. <result property="fMarks" column="f_marks" />
  42. <result property="fCustomno" column="f_customno" />
  43. <result property="fEmsSeqNo" column="f_ems_seq_no" />
  44. <result property="fIfweigh" column="f_ifweigh" />
  45. <result property="fIfpledge" column="f_ifpledge" />
  46. <result property="fIfdamage" column="f_ifdamage" />
  47. <result property="fBankcorpid" column="f_bankcorpid" />
  48. <result property="fBilltype" column="f_billtype" />
  49. <result property="fBillstatus" column="f_billstatus" />
  50. <result property="delFlag" column="del_flag" />
  51. <result property="createBy" column="create_by" />
  52. <result property="createTime" column="create_time" />
  53. <result property="fItemsStatus" column="f_items_status" />
  54. <result property="updateBy" column="update_by" />
  55. <result property="updateTime" column="update_time" />
  56. <result property="remark" column="remark" />
  57. <result property="fBillingDeadline" column="f_billing_deadline" />
  58. <result property="fProductName" column="f_product_name" />
  59. <result property="fReviewDate" column="f_review_date" />
  60. <result property="fTruckno" column="f_truckno" />
  61. <result property="fDriverName" column="f_driver_name" />
  62. <result property="fDriverTel" column="f_driver_tel" />
  63. <result property="fDriverIdCar" column="f_driver_id_car" />
  64. <result property="fBusinessType" column="f_business_type" />
  65. <result property="fLabour" column="f_labour" />
  66. <result property="fFleet" column="f_fleet" />
  67. <result property="fInwarehouseid" column="f_inwarehouseid" />
  68. <result property="fBstime" column="f_bstime" />
  69. <result property="fCartype" column="f_cartype" />
  70. <result property="fGoodsid" column="f_goodsid" />
  71. <result property="fNewTrademodeid" column="f_new_trademodeid" />
  72. <result property="fLoadportid" column="f_loadportid" />
  73. <result property="fDestportid" column="f_destportid" />
  74. <result property="fServiceitems" column="f_serviceitems" />
  75. <result property="fInvoceobj" column="f_invoceobj" />
  76. <result property="fSign" column="f_sign" />
  77. <result property="fDetentioncargo" column="f_detentioncargo" />
  78. <result property="fBooksmarks" column="f_booksmarks" />
  79. <result property="fShippername" column="f_shippername" />
  80. <result property="fShipperattn" column="f_shipperattn" />
  81. <result property="fShippertel" column="f_shippertel" />
  82. <result property="fConsigneername" column="f_consigneername" />
  83. <result property="fConsigneeattn" column="f_consigneeattn" />
  84. <result property="fConsigneetel" column="f_consigneetel" />
  85. <result property="fInsurance" column="f_insurance" />
  86. <result property="fInsuranceamt" column="f_insuranceamt" />
  87. <result property="fClosedate" column="f_closedate" />
  88. <result property="fDocmentdate" column="f_docmentdate" />
  89. <result property="fVslid" column="f_vslid" />
  90. <result property="fVoyid" column="f_voyid" />
  91. <result property="fTypeid" column="f_typeid" />
  92. <result property="fPaymode" column="f_paymode" />
  93. <result property="fLaneid" column="f_laneid" />
  94. <result property="fCntval" column="f_cntval" />
  95. <result property="freeContainerDate" column="free_container_date" />
  96. <result property="fBusinessAttribution" column="f_business_attribution" />
  97. <result property="fSupervisionUnit" column="f_supervision_unit" />
  98. <result property="fDeclarationElements" column="f_declaration_elements" />
  99. <result property="fPartNumber" column="f_part_number" />
  100. <result property="fIfinspection" column="f_ifinspection" />
  101. <result property="fValue" column="f_value" />
  102. <result property="fWeighingDate" column="f_weighing_date" />
  103. <result property="fIfsampling" column="f_ifsampling" />
  104. <result property="sendSampleDate" column="send_sample_date" />
  105. <result property="fIfweightRecovery" column="f_ifweight_recovery" />
  106. <result property="weightRecoveryDate" column="weight_recovery_date" />
  107. <result property="warehouseStatus" column="warehouse_status" />
  108. <result property="fTimes" column="f_times" />
  109. <result property="fDateChanged" column="f_date_changed"/>
  110. <result property="fChargetype" column="f_chargetype"/>
  111. <result property="fWeighWeight" column="f_weigh_weight" />
  112. <result property="fPredictBranch" column="f_predict_branch" />
  113. <result property="fGrade" column="f_grade" />
  114. <result property="fDeliveryDetails" column="f_delivery_details" />
  115. <result property="fSalesmanId" column="f_salesman_id" />
  116. <result property="fItemstatus" column="f_itemstatus" />
  117. <result property="fUpdeteStatus" column="f_updete_status"/>
  118. <result property="fSubmitUpdate" column="f_submit_update"/>
  119. <result property="fDeleteStatus" column="f_delete_status"/>
  120. <result property="fRemarksFees" column="f_remarks_fees" />
  121. <result property="fCargoPlanning" column="f_cargo_planning" />
  122. <result property="fArrivalStatus" column="f_arrival_status" />
  123. <result property="fDismountStatus" column="f_dismount_status" />
  124. <result property="fFeeStatus" column="f_fee_status" />
  125. <result property="fServiceitemsNew" column="f_serviceitems_new" />
  126. <result property="fReceivable" column="f_receivable" />
  127. <result property="fRecycle" column="f_recycle" />
  128. <result property="fDue" column="f_due" />
  129. <result property="fPay" column="f_pay" />
  130. <result property="fCaregoStatus" column="f_carego_status" />
  131. <result property="fShipTwo" column="f_ship_two" />
  132. <result property="fVoyTwo" column="f_voy_two" />
  133. <result property="pickUpPerson" column="pick_up_person" />
  134. <result property="pickUpTime" column="pick_up_time" />
  135. <result property="facilityPerson" column="facility_person" />
  136. <result property="facilityTime" column="facility_time" />
  137. <result property="isPledge" column="is_pledge" />
  138. <result property="documentSummary" column="document_summary" />
  139. <result property="financialBillType" column="financial_bill_type" />
  140. <result property="checklists" column="checklists" />
  141. </resultMap>
  142. <resultMap type="WarehouseBillsVO" id="WarehousebillsVOResult">
  143. <result property="fId" column="f_id" />
  144. <result property="fBillno" column="f_billno" />
  145. <result property="fMblno" column="f_mblno" />
  146. <result property="fBsdate" column="f_bsdate" />
  147. <result property="fQty" column="f_qty" />
  148. <result property="fGrossweight" column="f_grossweight" />
  149. <result property="fNetweight" column="f_netweight" />
  150. <result property="fBilltype" column="f_billtype" />
  151. </resultMap>
  152. <sql id="selectTWarehousebillsVo">
  153. select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_tel, f_corpid, f_shipper, f_tocorpid, f_stltypeid, f_bscorpno,
  154. f_warehouseid, f_storekeeper, f_chargedate, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight,
  155. f_volumn, f_billingway, f_trademodeid, f_sbu, f_feetunit, f_mblno, f_emblno, f_company, f_marks, f_vslvoy, f_eta, f_customno, f_ems_seq_no, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid,
  156. f_billtype, f_billstatus, f_items_status, del_flag, create_by, create_time, update_by, update_time, remark, f_billing_deadline, f_product_name, f_review_date,
  157. f_truckno, f_driver_name, f_driver_tel, f_driver_id_car, f_business_type, f_labour, f_fleet, f_inwarehouseid, f_bstime, f_cartype, f_goodsid, f_new_trademodeid,
  158. f_loadportid, f_destportid, f_serviceitems, f_invoceobj, f_sign, f_detentioncargo, f_booksmarks, f_shippername, f_shipperattn, f_shippertel, f_consigneername,
  159. f_consigneeattn, f_consigneetel, f_insurance, f_insuranceamt, f_closedate, f_docmentdate, f_vslid, f_voyid, f_typeid, f_paymode, f_laneid, f_cntval,
  160. free_container_date, f_business_attribution, f_fee_status, f_supervision_unit, f_declaration_elements, f_part_number, f_ifinspection, f_value, f_weighing_date,
  161. f_ifsampling, send_sample_date, f_ifweight_recovery, weight_recovery_date, warehouse_status, f_times ,f_date_changed, f_chargetype,f_weigh_weight,
  162. f_predict_branch,f_grade,f_delivery_details,f_salesman_id,f_itemstatus,f_updete_status, f_submit_update, f_delete_status,f_remarks_fees,f_cargo_planning,
  163. f_arrival_status,f_dismount_status,f_serviceitems_new,f_receivable,f_recycle,f_due,f_pay,f_carego_status, f_ship_two, f_voy_two, pick_up_person, pick_up_time, facility_person, facility_time,is_pledge,
  164. document_summary,financial_bill_type,checklists from t_warehousebills
  165. </sql>
  166. <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  167. select
  168. ware.*
  169. from
  170. t_warehousebills ware
  171. left join sys_user u on ware.create_by = u.user_name
  172. left join sys_dept d on ware.f_bsdeptid = d.dept_id
  173. <where>
  174. ware.f_typeid IS NULL
  175. and ware.del_flag = '0'
  176. <if test="fBillno != null and fBillno != ''">and f_billno = #{fBillno}</if>
  177. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and f_customsdeclartion =
  178. #{fCustomsdeclartion}
  179. </if>
  180. <if test="fOriginalbillno != null and fOriginalbillno != ''">and f_originalbillno = #{fOriginalbillno}</if>
  181. <if test="fDeptid != null ">and f_deptid = #{fDeptid}</if>
  182. <if test="fBsdeptid != null ">and f_bsdeptid = #{fBsdeptid}</if>
  183. <if test="fInwarehouseid != null ">and f_inwarehouseid = #{fInwarehouseid}</if>
  184. <if test="fContacts != null and fContacts != ''">and f_contacts = #{fContacts}</if>
  185. <if test="fTel != null and fTel != ''">and f_tel = #{fTel}</if>
  186. <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
  187. <if test="fShipper != null and fShipper != ''">and f_shipper like concat('%', #{fShipper}, '%')</if>
  188. <if test="fTocorpid != null ">and f_tocorpid = #{fTocorpid}</if>
  189. <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
  190. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  191. and f_bsdate &gt;= #{timeInterval[0]}
  192. </if>
  193. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  194. and f_bsdate &lt;= #{timeInterval[1]}
  195. </if>
  196. <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
  197. <if test="fBscorpno != null and fBscorpno != ''">and f_bscorpno = #{fBscorpno}</if>
  198. <if test="fWarehouseid != null ">and f_warehouseid = #{fWarehouseid}</if>
  199. <if test="fStorekeeper != null and fStorekeeper != ''">and f_storekeeper = #{fStorekeeper}</if>
  200. <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
  201. <if test="fPlanqty != null ">and f_planqty = #{fPlanqty}</if>
  202. <if test="fProductName != null and fProductName != ''">and f_product_name like concat('%', #{fProductName},
  203. '%')
  204. </if>
  205. <if test="fPlangrossweight != null ">and f_plangrossweight = #{fPlangrossweight}</if>
  206. <if test="fPlannetweight != null ">and f_plannetweight = #{fPlannetweight}</if>
  207. <if test="fPlanvolumn != null ">and f_planvolumn = #{fPlanvolumn}</if>
  208. <if test="fQty != null ">and f_qty = #{fQty}</if>
  209. <if test="fMarks != null and fMarks != ''">and f_marks = #{fMarks}</if>
  210. <if test="fGrossweight != null ">and f_grossweight = #{fGrossweight}</if>
  211. <if test="fNetweight != null ">and f_netweight = #{fNetweight}</if>
  212. <if test="fVolumn != null ">and f_volumn = #{fVolumn}</if>
  213. <if test="fTrademodeid != null ">and f_trademodeid = #{fTrademodeid}</if>
  214. <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
  215. <if test="fSbu != null ">and f_sbu = #{fSbu}</if>
  216. <if test="fFeetunit != null and fFeetunit != ''">and f_feetunit = #{fFeetunit}</if>
  217. <if test="fMblno != null and fMblno != ''">and f_mblno = #{fMblno}</if>
  218. <if test="fEmblno != null and fEmblno != ''">and f_emblno = #{fEmblno}</if>
  219. <if test="fVslvoy != null and fVslvoy != ''">and f_vslvoy = #{fVslvoy}</if>
  220. <if test="fEta != null ">and f_eta = #{fEta}</if>
  221. <if test="fCustomno != null and fCustomno != ''">and f_customno = #{fCustomno}</if>
  222. <if test="fIfweigh != null and fIfweigh != ''">and f_ifweigh = #{fIfweigh}</if>
  223. <if test="fIfpledge != null and fIfpledge != ''">and f_ifpledge = #{fIfpledge}</if>
  224. <if test="fIfdamage != null and fIfdamage != ''">and f_ifdamage = #{fIfdamage}</if>
  225. <if test="fBankcorpid != null ">and f_bankcorpid = #{fBankcorpid}</if>
  226. <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
  227. <if test="fBilltype != null and fBilltype != ''">and f_billtype = #{fBilltype}</if>
  228. <if test="fBillstatus != null and fBillstatus != ''">and f_billstatus = #{fBillstatus}</if>
  229. <if test="fNewTrademodeid != null ">and f_new_trademodeid = #{fNewTrademodeid}</if>
  230. <if test="isPledge != null and isPledge != ''">and is_pledge = #{isPledge}</if>
  231. <if test="checklists != null and checklists != ''">and checklists = #{checklists}</if>
  232. </where>
  233. ORDER BY ware.create_time desc
  234. ${params.dataScope}
  235. </select>
  236. <select id="selectWarehouseBusinessList" parameterType="TWarehousebills" resultType="Map">
  237. SELECT
  238. DISTINCT
  239. bill.f_id AS fId,
  240. corp.f_name AS fCorpid,
  241. corpTo.f_name AS fTocorpid,
  242. bill.f_shipper AS fShipper,
  243. bill.f_mblno AS fMblno,
  244. bill.f_emblno AS fEmblno,
  245. bill.f_company AS fCompany,
  246. corpSub.f_name AS fSbu,
  247. bill.f_marks AS fMarks,
  248. bill.remark AS remark,
  249. bill.f_planqty AS fPlanqty,
  250. bill.f_plangrossweight AS fPlangrossweight,
  251. bill.f_plannetweight AS fPlannetweight,
  252. bill.f_planvolumn AS fPlanvolumn,
  253. bill.f_bsdate AS fBsdate,
  254. bill.f_trademodeid AS fTrademodeid,
  255. bill.f_truckno AS fTruckno,
  256. bill.f_driver_name AS fDriverName,
  257. bill.f_driver_tel AS fDriverTel,
  258. bill.f_driver_id_car AS fDriverIdCar,
  259. dictIn.dict_label AS fBusinessType,
  260. ware.f_name AS fWarehouseid,
  261. bill.f_qty AS fQty,
  262. bill.f_cntval AS fCntval,
  263. bill.f_netweight AS fNetweight,
  264. bill.create_time AS createTime,
  265. ware1.f_name AS fInwarehouseid,
  266. bill.f_chargetype AS fChargetype,
  267. bill.create_by AS createBy,
  268. bill.f_grossweight AS fGrossweight,
  269. bill.f_product_name AS fProductName,
  270. bill.f_billing_deadline AS fBillingDeadline,
  271. bill.free_container_date AS freeContainerDate,
  272. bill.warehouse_status AS warehouseStatus,
  273. CASE
  274. WHEN bill.f_fee_status = '0'THEN ''
  275. WHEN bill.f_fee_status = '1'THEN '暂存'
  276. WHEN bill.f_fee_status = '2'THEN '部分入账'
  277. WHEN bill.f_fee_status = '3'THEN '全部入账'
  278. END AS fFeeStatus,
  279. CASE WHEN bill.f_billstatus = '1' THEN '录入'
  280. WHEN bill.f_billstatus = '2' THEN '暂存'
  281. WHEN bill.f_billstatus = '3' THEN '驳回'
  282. WHEN bill.f_billstatus = '4' THEN '请核'
  283. WHEN bill.f_billstatus = '5' THEN '审核中'
  284. WHEN bill.f_billstatus = '6' THEN '全部入账'
  285. END
  286. AS fBillstatus,
  287. CASE
  288. WHEN bill.f_billtype = 'SJRK'
  289. AND bill.f_items_status = '1' THEN
  290. '计划'
  291. WHEN bill.f_billtype = 'SJRK'
  292. AND bill.f_items_status = '2' THEN
  293. '待入库'
  294. WHEN bill.f_billtype = 'SJRK'
  295. AND bill.f_items_status = '3' THEN
  296. '入库中'
  297. WHEN bill.f_billtype = 'SJRK'
  298. AND bill.f_items_status = '4' THEN
  299. '已入库'
  300. WHEN bill.f_billtype = 'SJCK'
  301. AND bill.f_items_status = '1' THEN
  302. '计划'
  303. WHEN bill.f_billtype = 'SJCK'
  304. AND bill.f_items_status = '2' THEN
  305. '待出库'
  306. WHEN bill.f_billtype = 'SJCK'
  307. AND bill.f_items_status = '3' THEN
  308. '出库中'
  309. WHEN bill.f_billtype = 'SJCK'
  310. AND bill.f_items_status = '4' THEN
  311. '已出库'
  312. WHEN bill.f_billtype = 'CKDB'
  313. AND bill.f_items_status = '1' THEN
  314. '计划'
  315. WHEN bill.f_billtype = 'CKDB'
  316. AND bill.f_items_status = '2' THEN
  317. '待调拨'
  318. WHEN bill.f_billtype = 'CKDB'
  319. AND bill.f_items_status = '3' THEN
  320. '调拨中'
  321. WHEN bill.f_billtype = 'CKDB'
  322. AND bill.f_items_status = '4' THEN
  323. '已调拨'
  324. WHEN bill.f_billtype = 'HWTG'
  325. AND bill.f_items_status = '1' THEN
  326. '计划'
  327. WHEN bill.f_billtype = 'HWTG'
  328. AND bill.f_items_status = '2' THEN
  329. '待通关'
  330. WHEN bill.f_billtype = 'HWTG'
  331. AND bill.f_items_status = '3' THEN
  332. '通关中'
  333. WHEN bill.f_billtype = 'HWTG'
  334. AND bill.f_items_status = '4' THEN
  335. '已通关'
  336. WHEN bill.f_billtype = 'CDZZ'
  337. AND bill.f_items_status = '1' THEN
  338. '计划'
  339. WHEN bill.f_billtype = 'CDZZ'
  340. AND bill.f_items_status = '2' THEN
  341. '待直装'
  342. WHEN bill.f_billtype = 'CDZZ'
  343. AND bill.f_items_status = '3' THEN
  344. '直装中'
  345. WHEN bill.f_billtype = 'CDZZ'
  346. AND bill.f_items_status = '4' THEN
  347. '已直装'
  348. END AS fItemsStatus,
  349. bill.f_billno AS fBillno,
  350. g.f_name AS fGoodsid,
  351. bill.f_vslid AS fVslid,
  352. bill.f_voyid AS fVoyid,
  353. bill.f_storekeeper AS fStorekeeper,
  354. bill.f_remarks_fees AS fRemarksFees,
  355. twfD.f_amount as fReceivable,
  356. twfD.f_accamount as fRecycle,
  357. twfC.f_amount as fDue,
  358. twfC.f_accamount as fPay,
  359. twfD.f_invamount AS fApplyMoney,
  360. twfD.f_invnos AS invoiceNo,
  361. twfD.f_invoicing_date AS fAccbilldate,
  362. bill.is_pledge AS isPledge,
  363. bill.document_summary AS documentSummary,
  364. bill.financial_bill_type AS financialBillType,
  365. bill.checklists AS checklists
  366. FROM
  367. t_warehousebills bill
  368. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  369. left join sys_user u on bill.create_by = u.user_name
  370. left join sys_user u1 on bill.f_storekeeper = u1.user_name
  371. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  372. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  373. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  374. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  375. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  376. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  377. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  378. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  379. LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = bill.f_business_type and dictIn.dict_type in ('st_in_type','st_out_type','st_trans_type')
  380. LEFT JOIN (
  381. SELECT
  382. f_id,
  383. f_pid,
  384. SUM(f_amount) AS f_amount,
  385. SUM(f_accamount) AS f_accamount,
  386. GROUP_CONCAT(f_invnos SEPARATOR ',') AS f_invnos,
  387. GROUP_CONCAT(f_invamount SEPARATOR ',') AS f_invamount,
  388. GROUP_CONCAT(f_invoicing_date SEPARATOR ',') AS f_invoicing_date
  389. FROM
  390. t_warehousebillsfees
  391. WHERE f_dc = 'D' and del_flag = '0'
  392. GROUP BY f_pid
  393. ) twfD ON twfD.f_pid = bill.f_id
  394. LEFT JOIN (
  395. SELECT
  396. f_id,
  397. f_pid,
  398. SUM(f_amount) AS f_amount,
  399. SUM(f_accamount) AS f_accamount
  400. FROM
  401. t_warehousebillsfees
  402. WHERE f_dc = 'C' and del_flag = '0'
  403. GROUP BY f_pid
  404. ) twfC ON twfC.f_pid = bill.f_id
  405. <where>
  406. bill.del_flag = '0'
  407. and item.del_flag = '0'
  408. <if test="fTypeid == null or fTypeid == ''">and bill.f_typeid IS NULL</if>
  409. <if test="fTypeid != null and fTypeid != ''">and bill.f_typeid = #{fTypeid}</if>
  410. <if test="fFeeStatus != null and fFeeStatus != ''">and bill.f_fee_status = #{fFeeStatus}</if>
  411. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  412. <if test="fTruckno != null and fTruckno != ''">and item.f_truckno like concat('%', #{fTruckno}, '%')</if>
  413. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  414. #{fCustomsdeclartion}
  415. </if>
  416. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  417. #{fOriginalbillno}
  418. </if>
  419. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  420. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  421. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  422. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  423. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  424. and bill.f_bsdate &gt;= #{timeInterval[0]}
  425. </if>
  426. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  427. and bill.f_bsdate &lt;= #{timeInterval[1]}
  428. </if>
  429. <if test='freeContainerList != null and freeContainerList[0] != null and freeContainerList[0]!= ""'>
  430. and bill.free_container_date &gt;= #{freeContainerList[0]}
  431. </if>
  432. <if test='freeContainerList != null and freeContainerList[1] != null and freeContainerList[1]!= ""'>
  433. and bill.free_container_date &lt;= #{freeContainerList[1]}
  434. </if>
  435. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  436. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  437. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  438. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  439. <if test="fShipper != null and fShipper != ''">and bill.f_shipper like concat('%', #{fShipper}, '%')</if>
  440. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  441. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  442. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  443. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  444. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  445. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  446. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  447. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  448. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  449. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  450. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  451. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  452. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  453. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  454. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  455. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  456. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  457. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  458. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  459. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  460. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  461. <if test="fMblno != null and fMblno != ''">and (bill.f_mblno like concat('%', #{fMblno}, '%') or item.f_mblno like concat('%', #{fMblno}, '%'))</if>
  462. <if test="fEmblno != null and fEmblno != ''">and bill.f_emblno like concat('%', #{fEmblno}, '%')</if>
  463. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  464. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  465. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  466. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  467. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  468. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  469. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  470. <if test="fBilltype != null">and bill.f_billtype = #{fBilltype}</if>
  471. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  472. and bill.f_bsdate &gt;= #{timeInterval[0]}
  473. </if>
  474. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  475. and bill.f_bsdate &lt;= #{timeInterval[1]}
  476. </if>
  477. <if test="fBilltype != null and fBilltype == 'SJRK'">
  478. AND dictIn.dict_type = 'st_in_type'
  479. AND dictIn.status = '0'
  480. </if>
  481. <if test="fBilltype != null and fBilltype == 'SJCK'">
  482. AND dictIn.dict_type = 'st_out_type'
  483. AND dictIn.status = '0'
  484. </if>
  485. <if test="fBilltype != null and fBilltype == 'CKDB'">
  486. AND dictIn.dict_type = 'st_trans_type'
  487. AND dictIn.status = '0'
  488. </if>
  489. <if test="fBilltype != null and fBilltype == 'HWTG'">
  490. AND dictIn.dict_type = 'st_trans_type'
  491. AND dictIn.status = '0'
  492. </if>
  493. <if test="fBilltype != null and fBilltype == 'CDZZ'"><!-- 场地直装 仿出库 -->
  494. AND dictIn.dict_type = 'st_out_type'
  495. AND dictIn.status = '0'
  496. </if>
  497. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  498. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  499. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  500. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  501. <if test="warehouseStatus != null and warehouseStatus != ''">and bill.warehouse_status = #{warehouseStatus}</if>
  502. <if test="fVslid != null ">and bill.f_vslid = #{fVslid}</if>
  503. <if test="fVoyid != null ">and bill.f_voyid = #{fVoyid}</if>
  504. <if test="isPledge != null and isPledge != ''">and bill.is_pledge = #{isPledge}</if>
  505. <if test="checklists != null and checklists != ''">and bill.checklists = #{checklists}</if>
  506. <if test="remark != null and remark != ''">and bill.remark like concat('%', #{remark}, '%')</if>
  507. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  508. and bill.f_bsdate &gt;= #{timeInterval[0]}
  509. </if>
  510. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  511. and bill.f_bsdate &lt;= #{timeInterval[1]}
  512. </if>
  513. </where>
  514. ${params.dataScope}
  515. ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
  516. </select>
  517. <select id="selectWarehouseBusinessList1" parameterType="TWarehousebills" resultType="Map">
  518. SELECT
  519. DISTINCT
  520. bill.f_id AS fId,
  521. corp.f_name AS fCorpid,
  522. corpTo.f_name AS fTocorpid,
  523. bill.f_shipper AS fShipper,
  524. bill.f_mblno AS fMblno,
  525. bill.f_emblno AS fEmblno,
  526. bill.f_company AS fCompany,
  527. corpSub.f_name AS fSbu,
  528. bill.f_marks AS fMarks,
  529. bill.remark AS remark,
  530. bill.f_planqty AS fPlanqty,
  531. bill.f_plangrossweight AS fPlangrossweight,
  532. bill.f_plannetweight AS fPlannetweight,
  533. bill.f_planvolumn AS fPlanvolumn,
  534. bill.f_bsdate AS fBsdate,
  535. dict.dict_label AS fTrademodeid,
  536. bill.f_truckno AS fTruckno,
  537. bill.f_driver_name AS fDriverName,
  538. bill.f_driver_tel AS fDriverTel,
  539. bill.f_driver_id_car AS fDriverIdCar,
  540. ware.f_name AS fWarehouseid,
  541. bill.f_qty AS fQty,
  542. bill.f_cntval AS fCntval,
  543. bill.f_chargetype AS fChargetype,
  544. bill.f_netweight AS fNetweight,
  545. bill.create_time AS createTime,
  546. ware1.f_name AS fInwarehouseid,
  547. bill.create_by AS createBy,
  548. bill.f_grossweight AS fGrossweight,
  549. bill.f_product_name AS fProductName,
  550. bill.f_billing_deadline AS fBillingDeadline,
  551. bill.free_container_date AS freeContainerDate,
  552. bill.warehouse_status AS warehouseStatus,
  553. CASE
  554. WHEN bill.f_fee_status = '0'THEN ''
  555. WHEN bill.f_fee_status = '1'THEN '暂存'
  556. WHEN bill.f_fee_status = '2'THEN '部分入账'
  557. WHEN bill.f_fee_status = '3'THEN '全部入账'
  558. END AS fFeeStatus,
  559. CASE
  560. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '1' THEN '录入'
  561. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '2' THEN '暂存'
  562. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '3' THEN '驳回'
  563. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '4' THEN '请核'
  564. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '5' THEN '审核中'
  565. WHEN bill.f_billtype = 'HQZY' AND bill.f_billstatus = '6' THEN '全部入账'
  566. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '1' THEN '新建'
  567. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '2' THEN '暂存'
  568. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '3' THEN '审核驳回'
  569. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '4' THEN '提交审核'
  570. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '5' THEN '审核中'
  571. WHEN bill.f_billtype = 'JSCCF' AND bill.f_billstatus = '6' THEN '审核通过'
  572. END
  573. AS fBillstatus,
  574. CASE
  575. WHEN bill.f_billtype = 'HQZY'
  576. AND bill.f_items_status = '1' THEN
  577. '计划'
  578. WHEN bill.f_billtype = 'HQZY'
  579. AND bill.f_items_status = '2' THEN
  580. '待货转'
  581. WHEN bill.f_billtype = 'HQZY'
  582. AND bill.f_items_status = '3' THEN
  583. '货转中'
  584. WHEN bill.f_billtype = 'HQZY'
  585. AND bill.f_items_status = '4' THEN
  586. '已货转'
  587. END
  588. AS fItemsStatus,
  589. bill.f_billno AS fBillno,
  590. g.f_name AS fGoodsid,
  591. bill.f_storekeeper AS fStorekeeper,
  592. bill.f_remarks_fees AS fRemarksFees,
  593. tf.f_apply_money AS fApplyMoney,
  594. tf.invoice_no AS invoiceNo,
  595. tf.f_accbilldate AS fAccbilldate,
  596. bill.is_pledge AS isPledge,
  597. bill.checklists AS checklists
  598. FROM
  599. t_warehousebills bill
  600. LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
  601. left join sys_user u on bill.create_by = u.user_name
  602. left join sys_user u1 on bill.f_storekeeper = u1.user_name
  603. left join sys_dept d on bill.f_bsdeptid = d.dept_id
  604. LEFT JOIN t_corps corp ON corp.f_id = bill.f_corpid
  605. LEFT JOIN t_corps corpTo ON corpTo.f_id = bill.f_tocorpid
  606. LEFT JOIN t_corps corpSub ON corpSub.f_id = bill.f_sbu
  607. LEFT JOIN t_warehouse ware ON ware.f_id = bill.f_warehouseid
  608. LEFT JOIN t_warehouse ware1 ON ware1.f_id = bill.f_inwarehouseid
  609. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  610. LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
  611. LEFT JOIN sys_dict_data dict ON dict.dict_value = bill.f_trademodeid
  612. LEFT JOIN t_fee tf on tf.t_mblno = bill.f_mblno
  613. <where>
  614. dict.status = '0'
  615. and bill.del_flag = '0'
  616. and item.del_flag = '0'
  617. AND dict.dict_type = 'data_trademodes'
  618. AND bill.f_typeid IS NULL
  619. <if test="fFeeStatus != null and fFeeStatus != ''">and bill.f_fee_status = #{fFeeStatus}</if>
  620. <if test="fBillno != null and fBillno != ''">and bill.f_billno like concat('%', #{fBillno}, '%')</if>
  621. <if test="fTruckno != null and fTruckno != ''">and item.f_truckno like concat('%', #{fTruckno}, '%')</if>
  622. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and bill.f_customsdeclartion =
  623. #{fCustomsdeclartion}
  624. </if>
  625. <if test="fOriginalbillno != null and fOriginalbillno != ''">and bill.f_originalbillno =
  626. #{fOriginalbillno}
  627. </if>
  628. <if test="fDeptid != null ">and bill.f_deptid = #{fDeptid}</if>
  629. <if test="fInwarehouseid != null ">and bill.f_inwarehouseid = #{fInwarehouseid}</if>
  630. <if test="fBsdeptid != null ">and bill.f_bsdeptid = #{fBsdeptid}</if>
  631. <if test="fChargedate != null ">and bill.f_chargedate = #{fChargedate}</if>
  632. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  633. and bill.f_bsdate &gt;= #{timeInterval[0]}
  634. </if>
  635. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  636. and bill.f_bsdate &lt;= #{timeInterval[1]}
  637. </if>
  638. <if test='freeContainerList != null and freeContainerList[0] != null and freeContainerList[0]!= ""'>
  639. and bill.free_container_date &gt;= #{freeContainerList[0]}
  640. </if>
  641. <if test='freeContainerList != null and freeContainerList[1] != null and freeContainerList[1]!= ""'>
  642. and bill.free_container_date &lt;= #{freeContainerList[1]}
  643. </if>
  644. <if test="fGoodsid != null and fGoodsid != ''">and item.f_goodsid = #{fGoodsid}</if>
  645. <if test="fContacts != null and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
  646. <if test="fTel != null and fTel != ''">and bill.f_tel = #{fTel}</if>
  647. <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
  648. <if test="fShipper != null and fShipper != ''">and bill.f_shipper like concat('%', #{fShipper}, '%')</if>
  649. <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
  650. <if test='timeInterval2 != null and timeInterval2[0] != null and timeInterval2[0]!= ""'><!-- 仓储费增加计费截止日期区间查询 -->
  651. and bill.f_billing_deadline &gt;= #{timeInterval2[0]}
  652. </if>
  653. <if test='timeInterval2 != null and timeInterval2[1] != null and timeInterval2[1]!= ""'>
  654. and bill.f_billing_deadline &lt;= #{timeInterval2[1]}
  655. </if>
  656. <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
  657. <if test="fMarks != null and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
  658. <if test="fStltypeid != null ">and bill.f_stltypeid = #{fStltypeid}</if>
  659. <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
  660. <if test="fBscorpno != null and fBscorpno != ''">and bill.f_bscorpno = #{fBscorpno}</if>
  661. <if test="fWarehouseid != null ">and bill.f_warehouseid = #{fWarehouseid}</if>
  662. <if test="fStorekeeper != null and fStorekeeper != ''">and bill.f_storekeeper = #{fStorekeeper}</if>
  663. <if test="fBsdate != null ">and bill.f_bsdate = #{fBsdate}</if>
  664. <if test="fPlanqty != null ">and bill.f_planqty = #{fPlanqty}</if>
  665. <if test="fPlangrossweight != null ">and bill.f_plangrossweight = #{fPlangrossweight}</if>
  666. <if test="fPlannetweight != null ">and bill.f_plannetweight = #{fPlannetweight}</if>
  667. <if test="fPlanvolumn != null ">and bill.f_planvolumn = #{fPlanvolumn}</if>
  668. <if test="fQty != null ">and bill.f_qty = #{fQty}</if>
  669. <if test="fGrossweight != null ">and bill.f_grossweight = #{fGrossweight}</if>
  670. <if test="fNetweight != null ">and bill.f_netweight = #{fNetweight}</if>
  671. <if test="fVolumn != null ">and bill.f_volumn = #{fVolumn}</if>
  672. <if test="fTrademodeid != null ">and bill.f_trademodeid = #{fTrademodeid}</if>
  673. <if test="fBillingway != null ">and bill.f_billingway = #{fBillingway}</if>
  674. <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
  675. <if test="fFeetunit != null and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
  676. <if test="fMblno != null and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
  677. <if test="fEmblno != null and fEmblno != ''">and bill.f_emblno like concat('%', #{fEmblno}, '%')</if>
  678. <if test="fVslvoy != null and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
  679. <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
  680. <if test="fCustomno != null and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
  681. <if test="fIfweigh != null and fIfweigh != ''">and bill.f_ifweigh = #{fIfweigh}</if>
  682. <if test="fIfpledge != null and fIfpledge != ''">and bill.f_ifpledge = #{fIfpledge}</if>
  683. <if test="fIfdamage != null and fIfdamage != ''">and bill.f_ifdamage = #{fIfdamage}</if>
  684. <if test="fBankcorpid != null ">and bill.f_bankcorpid = #{fBankcorpid}</if>
  685. <if test="fBilltype != null and fBilltype != ''">
  686. and bill.f_billtype = #{fBilltype}
  687. </if>
  688. <if test="fBillstatus != null and fBillstatus != ''">and bill.f_billstatus = #{fBillstatus}</if>
  689. <if test="fItemsStatus != null and fItemsStatus != ''">and bill.f_items_status = #{fItemsStatus}</if>
  690. <if test="createBy != null and createBy != ''">and bill.create_by = #{createBy}</if>
  691. <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
  692. <if test="warehouseStatus != null and warehouseStatus != ''">and bill.warehouse_status = #{warehouseStatus}</if>
  693. <if test="isPledge != null and isPledge != ''">and bill.is_pledge = #{isPledge}</if>
  694. <if test="checklists != null and checklists != ''">and bill.checklists = #{checklists}</if>
  695. </where>
  696. ${params.dataScope}
  697. ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
  698. </select>
  699. <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
  700. <include refid="selectTWarehousebillsVo"/>
  701. where f_id = #{fId} and del_flag = '0'
  702. ORDER BY f_bsdate desc
  703. </select>
  704. <select id="getOtherFinance" resultType="com.ruoyi.warehouseBusiness.excel.OtherFinanceExcel">
  705. select
  706. tw.f_bsdate AS fBsdate,
  707. tw.document_summary as documentSummary,
  708. tw.financial_bill_type as financialBillType,
  709. d.damount as amountD,
  710. d.tfdname as feesNameD,
  711. d.dremark as remarkD,
  712. c.camount as amountC,
  713. c.tfcname as feesNameC,
  714. c.cremark as remarkC,
  715. tw.remark as remark
  716. from t_warehousebills tw
  717. LEFT JOIN (
  718. SELECT
  719. twfd.f_pid,
  720. ROUND( IFNULL( SUM( twfd.f_amount ), '' )) AS damount,
  721. tf.f_name as tfdname,
  722. twfd.remark as dremark
  723. FROM t_warehousebills tw
  724. left join t_warehousebillsfees twfd on twfd.f_pid = tw.f_id and twfd.f_dc = "D"
  725. left join t_fees tf on tf.f_id = twfd.f_feeid
  726. GROUP BY
  727. twfd.f_pid
  728. ) d ON d.f_pid = tw.f_id
  729. LEFT JOIN (
  730. SELECT
  731. twfc.f_pid,
  732. ROUND( IFNULL( SUM( twfc.f_amount ), '' )) AS camount,
  733. tf.f_name as tfcname,
  734. twfc.remark as cremark
  735. FROM t_warehousebills tw
  736. left join t_warehousebillsfees twfc on twfc.f_pid = tw.f_id and twfc.f_dc = "C"
  737. left join t_fees tf on tf.f_id = twfc.f_feeid
  738. GROUP BY
  739. twfc.f_pid
  740. ) c ON c.f_pid = tw.f_id
  741. WHERE
  742. tw.f_billtype = 'QTZW'
  743. <if test="remark != null and remark != ''">and tw.remark like concat('%', #{remark}, '%')</if>
  744. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  745. and tw.f_bsdate &gt;= #{timeInterval[0]}
  746. </if>
  747. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  748. and tw.f_bsdate &lt;= #{timeInterval[1]}
  749. </if>
  750. </select>
  751. <select id="selectTWarehousebillsItemsList"
  752. resultType="com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems">
  753. SELECT
  754. ( @ii := @ii + 1 ) AS fId,
  755. CASE
  756. wi.f_billtype
  757. WHEN 'SJRK' THEN
  758. '入库'
  759. WHEN 'SJCK' THEN
  760. '出库'
  761. WHEN 'KCZZ' THEN
  762. '库存总账'
  763. END AS fBilltype,
  764. ware.f_name AS warehouseName,
  765. wi.f_mblno AS fMblno,
  766. wi.f_product_name AS fGoodsid,
  767. wi.f_marks AS fMarks,
  768. wi.f_bsdate AS fBsdate,
  769. dict.dict_label AS fFeeUnitid,
  770. wi.f_billing_qty AS fBillingQty,
  771. wi.f_chargedate AS fChargedate,
  772. wi.f_billing_deadline AS fBillingDeadline,
  773. wi.f_billing_days AS fBillingDays,
  774. wi.f_inventory_days AS fInventoryDays,
  775. wi.f_amt AS fAmt,
  776. wi.price_date_remarks AS priceDateRemarks,
  777. wi.remark AS remark
  778. FROM
  779. t_warehousebills w
  780. LEFT JOIN t_warehousebillsfees wi ON w.f_id = wi.f_pid
  781. LEFT JOIN t_warehouse ware ON ware.f_id = wi.f_warehouseid
  782. LEFT JOIN sys_dict_data dict ON dict.dict_value = wi.f_billingway,
  783. ( SELECT @ii := 0 ) AS ii
  784. WHERE w.f_id = #{fId}
  785. AND w.f_typeid IS NULL
  786. AND dict.status = '0'
  787. AND dict.dict_type = 'data_unitfees'
  788. </select>
  789. <select id="selectInStockDetail" resultType="com.ruoyi.warehouseBusiness.excel.StorageDetail">
  790. SELECT
  791. wi.f_mblno AS fMblno,
  792. tg.f_name AS fProductName,
  793. wi.f_packagespecs AS fPackagespecs,
  794. dict.dict_label AS fBusinessType,
  795. wi.f_bsdate AS inStockDate,
  796. wi.f_qty AS fQtyD,
  797. wi.f_grossweight AS fGrossweightD
  798. FROM t_warehousebillsitems wi
  799. LEFT JOIN t_warehousebills w ON wi.f_pid = w.f_id
  800. LEFT JOIN t_goods tg ON wi.f_goodsid = tg.f_id
  801. LEFT JOIN sys_dict_data dict ON w.f_business_type = dict.dict_value
  802. WHERE
  803. wi.f_billstatus = 40
  804. AND dict.status = 0
  805. <if test="billType != null and billType!= '' and billType== 'SJRK'">
  806. AND wi.f_billtype = 'SJRK'
  807. AND dict.dict_type = 'st_in_type'
  808. <if test="fId != null and fId!= ''">
  809. AND wi.f_mblno = (select distinct f_mblno from t_warehousebills where f_id = #{fId})
  810. AND wi.f_warehouselocid in (
  811. SELECT DISTINCT * FROM (
  812. SELECT wi.f_warehouselocid
  813. FROM t_warehousebillsitems wi
  814. LEFT JOIN t_warehousebillsfees wf ON wf.src_id = wi.f_id
  815. WHERE wf.f_pid = #{fId} and wf.f_billtype = 'SJCK'
  816. UNION ALL
  817. SELECT wh.f_warehouse_locationid
  818. FROM t_whgenleg wh
  819. LEFT JOIN t_warehousebillsfees wf ON wf.src_id = wh.f_id
  820. WHERE wf.f_pid = #{fId} and wf.f_billtype = 'KCZZ'
  821. ) as wh
  822. )
  823. </if>
  824. </if>
  825. <if test="billType != null and billType!= '' and billType== 'CKDB'">
  826. AND wi.f_billtype = 'CKDB'
  827. AND dict.dict_type = 'st_trans_type'
  828. <if test="fId != null and fId!= ''">
  829. AND wi.f_mblno = (select distinct f_mblno from t_warehousebills where f_id = #{fId})
  830. AND wi.f_transfer_warehouselocid in (
  831. SELECT DISTINCT * FROM (
  832. SELECT wi.f_warehouselocid
  833. FROM t_warehousebillsitems wi
  834. LEFT JOIN t_warehousebillsfees wf ON wf.src_id = wi.f_id
  835. WHERE wf.f_pid = #{fId} and wf.f_billtype = 'SJCK'
  836. UNION ALL
  837. SELECT wh.f_warehouse_locationid
  838. FROM t_whgenleg wh
  839. LEFT JOIN t_warehousebillsfees wf ON wf.src_id = wh.f_id
  840. WHERE wf.f_pid = #{fId} and wf.f_billtype = 'KCZZ'
  841. ) as wh
  842. )
  843. </if>
  844. </if>
  845. <if test="fId != null and fId!= ''">
  846. AND wi.f_bsdate &gt;= (select min(f_chargedate) from t_warehousebillsfees where f_pid = #{fId})
  847. </if>
  848. </select>
  849. <select id="selectNotInStockDetail" resultType="com.ruoyi.warehouseBusiness.excel.StorageDetail">
  850. SELECT
  851. wf.f_mblno AS fMblno,
  852. wf.f_product_name AS fProductName,
  853. wi.f_packagespecs AS fPackagespecs,
  854. dict.dict_label AS fBusinessType,
  855. wf.f_chargedate AS inStockDate,
  856. wf.f_billing_deadline AS outStockDate,
  857. wi.f_truckno AS fTruckno,
  858. wi.f_qty AS fQtyC,
  859. wi.f_grossweight AS fGrossweightC,
  860. dictF.dict_label AS fBillingway,
  861. wf.f_billing_qty AS fBillingQty,
  862. wf.f_billing_days AS fBillingDays,
  863. wf.f_amount AS fAmount
  864. FROM t_warehousebillsfees wf
  865. LEFT JOIN t_warehousebillsitems wi ON wi.f_id = wf.src_id
  866. LEFT JOIN t_warehousebills w ON w.f_id = wi.f_pid
  867. LEFT JOIN sys_dict_data dict ON w.f_business_type = dict.dict_value
  868. LEFT JOIN sys_dict_data dictF ON wf.f_billingway = dictF.dict_value
  869. WHERE w.f_typeid IS NULL
  870. AND dict.status = '0'
  871. AND dictF.status = '0'
  872. AND dictF.dict_type = 'data_unitfees'
  873. <if test="fId != null and fId!= ''">AND wf.f_pid = #{fId}</if>
  874. <if test="billType != null and billType!= '' and billType== 'SJCK'">
  875. AND wf.f_billtype = 'SJCK'
  876. AND dict.dict_type = 'st_out_type'
  877. </if>
  878. <if test="billType != null and billType!= '' and billType== 'HQZY'">
  879. AND wf.f_billtype = 'HQZY'
  880. AND dict.dict_type = 'st_goodstf_type'
  881. </if>
  882. </select>
  883. <select id="selectInventoryDetail" resultType="com.ruoyi.warehouseBusiness.excel.StorageDetail">
  884. SELECT
  885. wf.f_mblno AS fMblno,
  886. wf.f_product_name AS fProductName,
  887. wi.f_packagespecs AS fPackagespecs,
  888. '在库' AS fBusinessType,
  889. wf.f_bsdate AS inStockDate,
  890. dictF.dict_label AS fBillingway,
  891. wf.f_billing_qty AS fBillingQty,
  892. wf.f_billing_days AS fBillingDays,
  893. wf.f_amount AS fAmount
  894. FROM t_warehousebillsfees wf
  895. LEFT JOIN t_warehousebillsitems wi ON wi.f_id = wf.src_id
  896. LEFT JOIN t_warehousebills w ON w.f_id = wi.f_pid
  897. LEFT JOIN sys_dict_data dictF ON wf.f_billingway = dictF.dict_value
  898. WHERE w.f_typeid IS NULL
  899. AND dictF.status = '0'
  900. AND dictF.dict_type = 'data_unitfees'
  901. AND wf.f_billtype = 'KCZZ'
  902. <if test="fId != null and fId!= ''">AND wf.f_pid = #{fId}</if>
  903. </select>
  904. <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="Map">
  905. SELECT
  906. leg.f_id AS fId,
  907. co.f_name AS fName,
  908. leg.f_shipper AS fShipper,
  909. it.f_bsdate AS fBsdate,
  910. leg.f_mblno AS fMblno,
  911. it.f_business_type AS fBusinessType,
  912. dict.dict_label AS fBusinessTypes,
  913. it.f_marks AS fMarks ,
  914. goo.f_name AS fGoodsName,
  915. it.f_warehouse_information AS fWarehouseLocationids,
  916. dicttr.dict_label AS fTrademodeid,
  917. it.f_qty AS fQty,
  918. it.f_grossweight AS fGrossweight,
  919. it.f_netweight AS fNetweight,
  920. it.f_driver_name AS fDriverName,
  921. it.f_truckno AS fTruckno,
  922. it.f_driver_id_car AS fDriverIdCar,
  923. CASE
  924. it.f_billtype
  925. WHEN 'SJRK' THEN
  926. '入库'
  927. WHEN 'SJCK' THEN
  928. '出库'
  929. WHEN 'CKDB' THEN
  930. '调拨'
  931. END AS fBilltype
  932. FROM
  933. t_warehousebills leg
  934. left join sys_user u on leg.create_by = u.user_name
  935. left join sys_user u1 on leg.f_salesman_id = u1.user_name
  936. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  937. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  938. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  939. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  940. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  941. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  942. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  943. <where>
  944. dict.status = '0'
  945. AND leg.f_typeid IS NULL
  946. AND dict.dict_type = 'storage_type'
  947. AND dicttr.STATUS = '0'
  948. AND dicttr.dict_type = 'data_trademodes'
  949. AND leg.f_billtype in ('SJRK','CKDB')
  950. AND it.f_billstatus = 40
  951. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  952. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  953. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  954. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  955. <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
  956. <if test="fMblno != null ">and it.f_mblno like concat('%',#{fMblno},'%')</if>
  957. <if test="fEmblno != null ">and it.f_emblno like concat('%',#{fEmblno},'%')</if>
  958. <if test="fLocation != null and fLocation ==1 ">
  959. and it.f_warehouselocid = #{fWarehouseid}
  960. </if>
  961. <if test="fLocation != null and fLocation ==0 ">
  962. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  963. </if>
  964. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  965. and it.f_bsdate &gt;= #{timeInterval[0]}
  966. </if>
  967. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  968. and it.f_bsdate &lt;= #{timeInterval[1]}
  969. </if>
  970. </where>
  971. ${params.dataScope}
  972. </select>
  973. <select id="selectInventorySJCKList" parameterType="TWarehousebills" resultType="Map">
  974. SELECT
  975. leg.f_id AS fId,
  976. co.f_name AS fName,
  977. leg.f_shipper AS fShipper,
  978. it.f_bsdate AS fBsdate,
  979. leg.f_mblno AS fMblno,
  980. it.f_business_type AS fBusinessType,
  981. dict.dict_label AS fBusinessTypes,
  982. it.f_marks AS fMarks ,
  983. goo.f_name AS fGoodsName,
  984. dicttr.dict_label AS fTrademodeid,
  985. it.f_qty AS fQty,
  986. it.f_grossweight AS fGrossweight,
  987. it.f_netweight AS fNetweight,
  988. it.f_driver_name AS fDriverName,
  989. it.f_truckno AS fTruckno,
  990. it.f_driver_id_car AS fDriverIdCar,
  991. CASE
  992. it.f_billtype
  993. WHEN 'SJRK' THEN
  994. '入库'
  995. WHEN 'SJCK' THEN
  996. '出库'
  997. WHEN 'CKDB' THEN
  998. '调拨'
  999. END AS fBilltype ,
  1000. CASE
  1001. it.f_billtype
  1002. WHEN 'SJRK' THEN
  1003. it.f_warehouse_information
  1004. WHEN 'SJCK' THEN
  1005. it.f_warehouse_information
  1006. WHEN 'CKDB' THEN
  1007. it.f_orgwarehouse_information
  1008. END AS fWarehouseLocationids
  1009. FROM
  1010. t_warehousebills leg
  1011. left join sys_user u on leg.create_by = u.user_name
  1012. left join sys_user u1 on leg.f_salesman_id = u1.user_name
  1013. left join sys_dept d on leg.f_bsdeptid = d.dept_id
  1014. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  1015. LEFT JOIN t_goods goo ON it.f_goodsid = goo.f_id
  1016. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  1017. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  1018. LEFT JOIN t_warehouse ware ON ware.f_id = it.f_warehouselocid
  1019. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid
  1020. <where>
  1021. dict.status = '0'
  1022. AND leg.f_typeid IS NULL
  1023. AND dict.dict_type = 'storage_type'
  1024. AND dicttr.STATUS = '0'
  1025. AND dicttr.dict_type = 'data_trademodes'
  1026. AND leg.f_billtype in ('SJCK','CKDB')
  1027. AND it.f_billstatus = 40
  1028. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  1029. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  1030. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  1031. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  1032. <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
  1033. <if test="fMblno != null ">and it.f_mblno like concat('%',#{fMblno},'%')</if>
  1034. <if test="fEmblno != null ">and it.f_emblno like concat('%',#{fEmblno},'%')</if>
  1035. <if test="fLocation != null and fLocation ==1 ">
  1036. and it.f_warehouselocid = #{fWarehouseid}
  1037. </if>
  1038. <if test="fLocation != null and fLocation ==0 ">
  1039. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  1040. </if>
  1041. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1042. and it.f_bsdate &gt;= #{timeInterval[0]}
  1043. </if>
  1044. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1045. and it.f_bsdate &lt;= #{timeInterval[1]}
  1046. </if>
  1047. </where>
  1048. ${params.dataScope}
  1049. </select>
  1050. <select id="selectTWarehousebillsItemList"
  1051. resultType="com.ruoyi.reportManagement.domain.TWareHouseItemsExcel">
  1052. SELECT
  1053. ( @ii := @ii + 1 ) AS fId,
  1054. co.f_name AS fCorpid,
  1055. leg.f_shipper AS fShipper,
  1056. it.f_bsdate AS fBsdate,
  1057. leg.f_mblno AS fMblno,
  1058. CASE
  1059. leg.f_billtype
  1060. WHEN 'SJRK' THEN
  1061. '入库'
  1062. WHEN 'SJCK' THEN
  1063. '出库'
  1064. WHEN 'CKDB' THEN
  1065. '调拨'
  1066. WHEN 'HQZY' THEN
  1067. '货权转移'
  1068. END AS fBilltype ,
  1069. dict.dict_label AS fBusinessType,
  1070. it.f_marks AS fMarks,
  1071. go.f_name AS fGoodsid,
  1072. it.f_warehouse_information AS fWarehouseInformation,
  1073. dicttr.dict_label AS fTrademodeid,
  1074. it.f_qty AS fQty,
  1075. it.f_grossweight AS fGrossweight,
  1076. it.f_netweight AS fNetweight,
  1077. it.f_driver_name AS fDrivername,
  1078. it.f_truckno AS fTruckno,
  1079. it.f_driver_id_car AS fDriverIdCar
  1080. FROM
  1081. t_warehousebills leg
  1082. LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid
  1083. LEFT JOIN t_goods go ON it.f_goodsid = go.f_id
  1084. LEFT JOIN t_corps co ON leg.f_corpid = co.f_id
  1085. LEFT JOIN sys_dict_data dict ON dict.dict_value = it.f_business_type
  1086. LEFT JOIN t_warehouse_area area ON area.f_id = it.f_warehouselocid
  1087. LEFT JOIN sys_dict_data dicttr ON dicttr.dict_value = leg.f_trademodeid,(
  1088. SELECT
  1089. @ii := 0
  1090. ) AS ii
  1091. WHERE
  1092. dict.STATUS = '0'
  1093. AND leg.f_typeid IS NULL
  1094. AND dict.dict_type = 'storage_type'
  1095. AND dicttr.STATUS = '0'
  1096. AND dicttr.dict_type = 'data_trademodes'
  1097. AND leg.f_billtype IN (
  1098. 'SJRk',
  1099. 'SJCK'
  1100. )
  1101. <if test="fBilltype != null">AND leg.f_billtype = #{fBilltype}</if>
  1102. <if test="fGoodsid != null ">and it.f_goodsid = #{fGoodsid}</if>
  1103. <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
  1104. <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
  1105. <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
  1106. <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
  1107. <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
  1108. <if test="fEmblno != null ">and leg.f_emblno = #{fEmblno}</if>
  1109. <if test="fLocation != null and fLocation ==1 ">
  1110. and it.f_warehouselocid = #{fWarehouseid}
  1111. </if>
  1112. <if test="fLocation != null and fLocation ==0 ">
  1113. and ware.ancestors LIKE concat('%', #{fWarehouseid}, '%')
  1114. </if>
  1115. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  1116. and it.f_bsdate &gt;= #{timeInterval[0]}
  1117. </if>
  1118. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  1119. and it.f_bsdate &lt;= #{timeInterval[1]}
  1120. </if>
  1121. </select>
  1122. <select id="selectContainMblno" parameterType="TWarehousebills" resultType="int">
  1123. SELECT
  1124. count( f_id )
  1125. FROM
  1126. t_warehousebills
  1127. where
  1128. f_mblno = #{fMblno}
  1129. and del_flag = '0'
  1130. AND f_bsdate = #{fBsdate}
  1131. AND f_billtype = #{fBilltype}
  1132. </select>
  1133. <insert id="insertTWarehousebills" parameterType="TWarehousebills" useGeneratedKeys="true" keyProperty="fId">
  1134. insert into t_warehousebills
  1135. <trim prefix="(" suffix=")" suffixOverrides=",">
  1136. <if test="fBillno != null">f_billno,</if>
  1137. <if test="fCustomsdeclartion != null">f_customsdeclartion,</if>
  1138. <if test="fOriginalbillno != null">f_originalbillno,</if>
  1139. <if test="fDeptid != null">f_deptid,</if>
  1140. <if test="fBsdeptid != null">f_bsdeptid,</if>
  1141. <if test="fContacts != null">f_contacts,</if>
  1142. <if test="fTel != null">f_tel,</if>
  1143. <if test="fCorpid != null">f_corpid,</if>
  1144. <if test="fShipper != null">f_shipper,</if>
  1145. <if test="fTocorpid != null">f_tocorpid,</if>
  1146. <if test="fStltypeid != null">f_stltypeid,</if>
  1147. <if test="fBscorpno != null">f_bscorpno,</if>
  1148. <if test="fWarehouseid != null">f_warehouseid,</if>
  1149. <if test="fStorekeeper != null">f_storekeeper,</if>
  1150. <if test="fChargedate != null">f_chargedate,</if>
  1151. <if test="fBsdate != null">f_bsdate,</if>
  1152. <if test="fPlanqty != null">f_planqty,</if>
  1153. <if test="fPlangrossweight != null">f_plangrossweight,</if>
  1154. <if test="fPlannetweight != null">f_plannetweight,</if>
  1155. <if test="fPlanvolumn != null">f_planvolumn,</if>
  1156. <if test="fQty != null">f_qty,</if>
  1157. <if test="fGrossweight != null">f_grossweight,</if>
  1158. <if test="fNetweight != null">f_netweight,</if>
  1159. <if test="fVolumn != null">f_volumn,</if>
  1160. <if test="fTrademodeid != null">f_trademodeid,</if>
  1161. <if test="fBillingway != null">f_billingway,</if>
  1162. <if test="fSbu != null">f_sbu,</if>
  1163. <if test="fFeetunit != null">f_feetunit,</if>
  1164. <if test="fMblno != null">f_mblno,</if>
  1165. <if test="fEmblno != null">f_emblno,</if>
  1166. <if test="fCompany != null">f_company,</if>
  1167. <if test="fVslvoy != null">f_vslvoy,</if>
  1168. <if test="fEta != null">f_eta,</if>
  1169. <if test="fMarks != null">f_marks,</if>
  1170. <if test="fCustomno != null">f_customno,</if>
  1171. <if test="fEmsSeqNo != null">f_ems_seq_no,</if>
  1172. <if test="fIfweigh != null">f_ifweigh,</if>
  1173. <if test="fIfpledge != null">f_ifpledge,</if>
  1174. <if test="fIfdamage != null">f_ifdamage,</if>
  1175. <if test="fBankcorpid != null">f_bankcorpid,</if>
  1176. <if test="fBilltype != null">f_billtype,</if>
  1177. <if test="fBillstatus != null">f_billstatus,</if>
  1178. <if test="delFlag != null">del_flag,</if>
  1179. <if test="createBy != null">create_by,</if>
  1180. <if test="createTime != null">create_time,</if>
  1181. <if test="fItemsStatus != null">f_items_status,</if>
  1182. <if test="updateBy != null">update_by,</if>
  1183. <if test="updateTime != null">update_time,</if>
  1184. <if test="remark != null">remark,</if>
  1185. <if test="fBillingDeadline != null">f_billing_deadline,</if>
  1186. <if test="fProductName != null">f_product_name,</if>
  1187. <if test="fReviewDate != null">f_review_date,</if>
  1188. <if test="fTruckno != null">f_truckno,</if>
  1189. <if test="fDriverName != null">f_driver_name,</if>
  1190. <if test="fDriverTel != null">f_driver_tel,</if>
  1191. <if test="fDriverIdCar != null">f_driver_id_car,</if>
  1192. <if test="fBusinessType != null">f_business_type,</if>
  1193. <if test="fLabour != null">f_labour,</if>
  1194. <if test="fFleet != null">f_fleet,</if>
  1195. <if test="fInwarehouseid != null">f_inwarehouseid,</if>
  1196. <if test="fBstime != null">f_bstime,</if>
  1197. <if test="fCartype != null">f_cartype,</if>
  1198. <if test="fGoodsid != null">f_goodsid,</if>
  1199. <if test="fNewTrademodeid != null">f_new_trademodeid,</if>
  1200. <if test="fLoadportid != null">f_loadportid,</if>
  1201. <if test="fDestportid != null">f_destportid,</if>
  1202. <if test="fServiceitems != null">f_serviceitems,</if>
  1203. <if test="fInvoceobj != null">f_invoceobj,</if>
  1204. <if test="fSign != null">f_sign,</if>
  1205. <if test="fDetentioncargo != null">f_detentioncargo,</if>
  1206. <if test="fBooksmarks != null">f_booksmarks,</if>
  1207. <if test="fShippername != null">f_shippername,</if>
  1208. <if test="fShipperattn != null">f_shipperattn,</if>
  1209. <if test="fShippertel != null">f_shippertel,</if>
  1210. <if test="fConsigneername != null">f_consigneername,</if>
  1211. <if test="fConsigneeattn != null">f_consigneeattn,</if>
  1212. <if test="fConsigneetel != null">f_consigneetel,</if>
  1213. <if test="fInsurance != null">f_insurance,</if>
  1214. <if test="fInsuranceamt != null">f_insuranceamt,</if>
  1215. <if test="fClosedate != null">f_closedate,</if>
  1216. <if test="fDocmentdate != null">f_docmentdate,</if>
  1217. <if test="fVslid != null">f_vslid,</if>
  1218. <if test="fVoyid != null">f_voyid,</if>
  1219. <if test="fTypeid != null">f_typeid,</if>
  1220. <if test="fPaymode != null">f_paymode,</if>
  1221. <if test="fLaneid != null">f_laneid,</if>
  1222. <if test="fCntval != null">f_cntval,</if>
  1223. <if test="freeContainerDate != null">free_container_date,</if>
  1224. <if test="fBusinessAttribution != null">f_business_attribution,</if>
  1225. <if test="fSupervisionUnit != null">f_supervision_unit,</if>
  1226. <if test="fDeclarationElements != null">f_declaration_elements,</if>
  1227. <if test="fPartNumber != null">f_part_number,</if>
  1228. <if test="fIfinspection != null">f_ifinspection,</if>
  1229. <if test="fValue != null">f_value,</if>
  1230. <if test="fWeighingDate != null">f_weighing_date,</if>
  1231. <if test="fIfsampling != null">f_ifsampling,</if>
  1232. <if test="sendSampleDate != null">send_sample_date,</if>
  1233. <if test="fIfweightRecovery != null">f_ifweight_recovery,</if>
  1234. <if test="weightRecoveryDate != null">weight_recovery_date,</if>
  1235. <if test="warehouseStatus != null">warehouse_status,</if>
  1236. <if test="fTimes != null">f_times,</if>
  1237. <if test="fDateChanged != null">f_date_changed,</if>
  1238. <if test="fChargetype != null">f_chargetype,</if>
  1239. <if test="fWeighWeight != null">f_weigh_weight,</if>
  1240. <if test="fPredictBranch != null">f_predict_branch,</if>
  1241. <if test="fGrade != null">f_grade,</if>
  1242. <if test="fDeliveryDetails != null">f_delivery_details,</if>
  1243. <if test="fSalesmanId != null">f_salesman_id,</if>
  1244. <if test="fItemstatus != null">f_itemstatus,</if>
  1245. <if test="fUpdeteStatus != null">f_updete_status,</if>
  1246. <if test="fSubmitUpdate != null">f_submit_update,</if>
  1247. <if test="fDeleteStatus != null">f_delete_status,</if>
  1248. <if test="fRemarksFees != null">f_remarks_fees,</if>
  1249. <if test="fCargoPlanning != null">f_cargo_planning,</if>
  1250. <if test="fFeeStatus != null">f_fee_status,</if>
  1251. <if test="fArrivalStatus != null">f_arrival_status,</if>
  1252. <if test="fDismountStatus != null">f_dismount_status,</if>
  1253. <if test="fServiceitemsNew != null">f_serviceitems_new,</if>
  1254. <if test="fReceivable != null">f_receivable,</if>
  1255. <if test="fRecycle != null">f_recycle,</if>
  1256. <if test="fDue != null">f_due,</if>
  1257. <if test="fPay != null">f_pay,</if>
  1258. <if test="fCaregoStatus != null">f_carego_status,</if>
  1259. <if test="fShipTwo != null">f_ship_two,</if>
  1260. <if test="fVoyTwo != null">f_voy_two,</if>
  1261. <if test="pickUpPerson != null">pick_up_person,</if>
  1262. <if test="pickUpTime != null">pick_up_time,</if>
  1263. <if test="facilityPerson != null">facility_person,</if>
  1264. <if test="facilityTime != null">facility_time,</if>
  1265. <if test="isPledge != null and isPledge != ''">is_pledge,</if>
  1266. <if test="documentSummary != null and documentSummary != ''">document_summary,</if>
  1267. <if test="financialBillType != null and financialBillType != ''">financial_bill_type,</if>
  1268. <if test="checklists != null and checklists != ''">checklists,</if>
  1269. </trim>
  1270. <trim prefix="values (" suffix=")" suffixOverrides=",">
  1271. <if test="fBillno != null">#{fBillno},</if>
  1272. <if test="fCustomsdeclartion != null">#{fCustomsdeclartion},</if>
  1273. <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
  1274. <if test="fDeptid != null">#{fDeptid},</if>
  1275. <if test="fBsdeptid != null">#{fBsdeptid},</if>
  1276. <if test="fContacts != null">#{fContacts},</if>
  1277. <if test="fTel != null">#{fTel},</if>
  1278. <if test="fCorpid != null">#{fCorpid},</if>
  1279. <if test="fShipper != null">#{fShipper},</if>
  1280. <if test="fTocorpid != null">#{fTocorpid},</if>
  1281. <if test="fStltypeid != null">#{fStltypeid},</if>
  1282. <if test="fBscorpno != null">#{fBscorpno},</if>
  1283. <if test="fWarehouseid != null">#{fWarehouseid},</if>
  1284. <if test="fStorekeeper != null">#{fStorekeeper},</if>
  1285. <if test="fChargedate != null">#{fChargedate},</if>
  1286. <if test="fBsdate != null">#{fBsdate},</if>
  1287. <if test="fPlanqty != null">#{fPlanqty},</if>
  1288. <if test="fPlangrossweight != null">#{fPlangrossweight},</if>
  1289. <if test="fPlannetweight != null">#{fPlannetweight},</if>
  1290. <if test="fPlanvolumn != null">#{fPlanvolumn},</if>
  1291. <if test="fQty != null">#{fQty},</if>
  1292. <if test="fGrossweight != null">#{fGrossweight},</if>
  1293. <if test="fNetweight != null">#{fNetweight},</if>
  1294. <if test="fVolumn != null">#{fVolumn},</if>
  1295. <if test="fTrademodeid != null">#{fTrademodeid},</if>
  1296. <if test="fBillingway != null">#{fBillingway},</if>
  1297. <if test="fSbu != null">#{fSbu},</if>
  1298. <if test="fFeetunit != null">#{fFeetunit},</if>
  1299. <if test="fMblno != null">#{fMblno},</if>
  1300. <if test="fEmblno != null">#{fEmblno},</if>
  1301. <if test="fCompany != null">#{fCompany},</if>
  1302. <if test="fVslvoy != null">#{fVslvoy},</if>
  1303. <if test="fEta != null">#{fEta},</if>
  1304. <if test="fMarks != null">#{fMarks},</if>
  1305. <if test="fCustomno != null">#{fCustomno},</if>
  1306. <if test="fEmsSeqNo != null">#{fEmsSeqNo},</if>
  1307. <if test="fIfweigh != null">#{fIfweigh},</if>
  1308. <if test="fIfpledge != null">#{fIfpledge},</if>
  1309. <if test="fIfdamage != null">#{fIfdamage},</if>
  1310. <if test="fBankcorpid != null">#{fBankcorpid},</if>
  1311. <if test="fBilltype != null">#{fBilltype},</if>
  1312. <if test="fBillstatus != null">#{fBillstatus},</if>
  1313. <if test="delFlag != null">#{delFlag},</if>
  1314. <if test="createBy != null">#{createBy},</if>
  1315. <if test="createTime != null">#{createTime},</if>
  1316. <if test="fItemsStatus != null">#{fItemsStatus},</if>
  1317. <if test="updateBy != null">#{updateBy},</if>
  1318. <if test="updateTime != null">#{updateTime},</if>
  1319. <if test="remark != null">#{remark},</if>
  1320. <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
  1321. <if test="fProductName != null">#{fProductName},</if>
  1322. <if test="fReviewDate != null">#{fReviewDate},</if>
  1323. <if test="fTruckno != null">#{fTruckno},</if>
  1324. <if test="fDriverName != null">#{fDriverName},</if>
  1325. <if test="fDriverTel != null">#{fDriverTel},</if>
  1326. <if test="fDriverIdCar != null">#{fDriverIdCar},</if>
  1327. <if test="fBusinessType != null">#{fBusinessType},</if>
  1328. <if test="fLabour != null">#{fLabour},</if>
  1329. <if test="fFleet != null">#{fFleet},</if>
  1330. <if test="fInwarehouseid != null">#{fInwarehouseid},</if>
  1331. <if test="fBstime != null">#{fBstime},</if>
  1332. <if test="fCartype != null">#{fCartype},</if>
  1333. <if test="fGoodsid != null">#{fGoodsid},</if>
  1334. <if test="fNewTrademodeid != null">#{fNewTrademodeid},</if>
  1335. <if test="fLoadportid != null">#{fLoadportid},</if>
  1336. <if test="fDestportid != null">#{fDestportid},</if>
  1337. <if test="fServiceitems != null">#{fServiceitems},</if>
  1338. <if test="fInvoceobj != null">#{fInvoceobj},</if>
  1339. <if test="fSign != null">#{fSign},</if>
  1340. <if test="fDetentioncargo != null">#{fDetentioncargo},</if>
  1341. <if test="fBooksmarks != null">#{fBooksmarks},</if>
  1342. <if test="fShippername != null">#{fShippername},</if>
  1343. <if test="fShipperattn != null">#{fShipperattn},</if>
  1344. <if test="fShippertel != null">#{fShippertel},</if>
  1345. <if test="fConsigneername != null">#{fConsigneername},</if>
  1346. <if test="fConsigneeattn != null">#{fConsigneeattn},</if>
  1347. <if test="fConsigneetel != null">#{fConsigneetel},</if>
  1348. <if test="fInsurance != null">#{fInsurance},</if>
  1349. <if test="fInsuranceamt != null">#{fInsuranceamt},</if>
  1350. <if test="fClosedate != null">#{fClosedate},</if>
  1351. <if test="fDocmentdate != null">#{fDocmentdate},</if>
  1352. <if test="fVslid != null">#{fVslid},</if>
  1353. <if test="fVoyid != null">#{fVoyid},</if>
  1354. <if test="fTypeid != null">#{fTypeid},</if>
  1355. <if test="fPaymode != null">#{fPaymode},</if>
  1356. <if test="fLaneid != null">#{fLaneid},</if>
  1357. <if test="fCntval != null">#{fCntval},</if>
  1358. <if test="freeContainerDate != null">#{freeContainerDate},</if>
  1359. <if test="fBusinessAttribution != null">#{fBusinessAttribution},</if>
  1360. <if test="fSupervisionUnit != null">#{fSupervisionUnit},</if>
  1361. <if test="fDeclarationElements != null">#{fDeclarationElements},</if>
  1362. <if test="fPartNumber != null">#{fPartNumber},</if>
  1363. <if test="fIfinspection != null">#{fIfinspection},</if>
  1364. <if test="fValue != null">#{fValue},</if>
  1365. <if test="fWeighingDate != null">#{fWeighingDate},</if>
  1366. <if test="fIfsampling != null">#{fIfsampling},</if>
  1367. <if test="sendSampleDate != null">#{sendSampleDate},</if>
  1368. <if test="fIfweightRecovery != null">#{fIfweightRecovery},</if>
  1369. <if test="weightRecoveryDate != null">#{weightRecoveryDate},</if>
  1370. <if test="warehouseStatus != null">#{warehouseStatus},</if>
  1371. <if test="fTimes != null">#{fTimes},</if>
  1372. <if test="fDateChanged != null">#{fDateChanged},</if>
  1373. <if test="fChargetype != null">#{fChargetype},</if>
  1374. <if test="fWeighWeight != null">#{fWeighWeight},</if>
  1375. <if test="fPredictBranch != null">#{fPredictBranch},</if>
  1376. <if test="fGrade != null">#{fGrade},</if>
  1377. <if test="fDeliveryDetails != null">#{fDeliveryDetails},</if>
  1378. <if test="fSalesmanId != null">#{fSalesmanId},</if>
  1379. <if test="fItemstatus != null">#{fItemstatus},</if>
  1380. <if test="fUpdeteStatus != null">#{fUpdeteStatus},</if>
  1381. <if test="fSubmitUpdate != null">#{fSubmitUpdate},</if>
  1382. <if test="fDeleteStatus != null">#{fDeleteStatus},</if>
  1383. <if test="fRemarksFees != null">#{fRemarksFees},</if>
  1384. <if test="fCargoPlanning != null">#{fCargoPlanning},</if>
  1385. <if test="fFeeStatus != null">#{fFeeStatus},</if>
  1386. <if test="fArrivalStatus != null">#{fArrivalStatus},</if>
  1387. <if test="fDismountStatus != null">#{fDismountStatus},</if>
  1388. <if test="fServiceitemsNew != null">#{fServiceitemsNew},</if>
  1389. <if test="fReceivable != null">#{fReceivable},</if>
  1390. <if test="fRecycle != null">#{fRecycle},</if>
  1391. <if test="fDue != null">#{fDue},</if>
  1392. <if test="fPay != null">#{fPay},</if>
  1393. <if test="fCaregoStatus != null">#{fCaregoStatus},</if>
  1394. <if test="fShipTwo != null">#{fShipTwo},</if>
  1395. <if test="fVoyTwo != null">#{fVoyTwo},</if>
  1396. <if test="pickUpPerson != null">#{pickUpPerson},</if>
  1397. <if test="pickUpTime != null">#{pickUpTime},</if>
  1398. <if test="facilityPerson != null">#{facilityPerson},</if>
  1399. <if test="facilityTime != null">#{facilityTime},</if>
  1400. <if test="isPledge != null and isPledge != ''">#{isPledge},</if>
  1401. <if test="documentSummary != null and documentSummary != ''">#{documentSummary},</if>
  1402. <if test="financialBillType != null and financialBillType != ''">#{financialBillType},</if>
  1403. <if test="checklists != null and checklists != ''">#{checklists},</if>
  1404. </trim>
  1405. </insert>
  1406. <update id="updateTWarehousebills" parameterType="TWarehousebills">
  1407. update t_warehousebills
  1408. <trim prefix="SET" suffixOverrides=",">
  1409. <if test="fBillno != null">f_billno = #{fBillno},</if>
  1410. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  1411. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  1412. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  1413. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  1414. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  1415. <if test="fTel != null">f_tel = #{fTel},</if>
  1416. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  1417. <if test="fShipper != null">f_shipper = #{fShipper},</if>
  1418. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  1419. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  1420. <if test="fBscorpno != null">f_bscorpno = #{fBscorpno},</if>
  1421. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  1422. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  1423. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  1424. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  1425. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  1426. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  1427. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  1428. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  1429. <if test="fQty != null">f_qty = #{fQty},</if>
  1430. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  1431. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  1432. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  1433. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  1434. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  1435. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  1436. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  1437. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  1438. <if test="fEmblno != null">f_emblno = #{fEmblno},</if>
  1439. f_company = #{fCompany},
  1440. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  1441. <if test="fEta != null">f_eta = #{fEta},</if>
  1442. <if test="fMarks != null">f_marks = #{fMarks},</if>
  1443. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  1444. <if test="fEmsSeqNo != null">f_ems_seq_no = #{fEmsSeqNo},</if>
  1445. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  1446. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  1447. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  1448. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  1449. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  1450. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  1451. <if test="delFlag != null">del_flag = #{delFlag},</if>
  1452. <if test="createBy != null">create_by = #{createBy},</if>
  1453. <if test="createTime != null">create_time = #{createTime},</if>
  1454. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  1455. <if test="updateBy != null">update_by = #{updateBy},</if>
  1456. <if test="updateTime != null">update_time = #{updateTime},</if>
  1457. <if test="remark != null">remark = #{remark},</if>
  1458. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  1459. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  1460. <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
  1461. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  1462. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  1463. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  1464. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  1465. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  1466. f_labour = #{fLabour},
  1467. f_fleet = #{fFleet},
  1468. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  1469. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  1470. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  1471. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  1472. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  1473. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  1474. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  1475. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  1476. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  1477. <if test="fSign != null">f_sign = #{fSign},</if>
  1478. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  1479. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  1480. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  1481. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  1482. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  1483. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  1484. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  1485. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  1486. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  1487. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  1488. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  1489. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  1490. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  1491. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  1492. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  1493. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  1494. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  1495. <if test="fCntval != null">f_cntval = #{fCntval},</if>
  1496. <if test="freeContainerDate != null">free_container_date = #{freeContainerDate},</if>
  1497. <if test="fBusinessAttribution != null">f_business_attribution = #{fBusinessAttribution},</if>
  1498. <if test="fSupervisionUnit != null">f_supervision_unit = #{fSupervisionUnit},</if>
  1499. <if test="fDeclarationElements != null">f_declaration_elements = #{fDeclarationElements},</if>
  1500. <if test="fPartNumber != null">f_part_number = #{fPartNumber},</if>
  1501. <if test="fIfinspection != null">f_ifinspection = #{fIfinspection},</if>
  1502. <if test="fValue != null">f_value = #{fValue},</if>
  1503. <if test="fWeighingDate != null">f_weighing_date = #{fWeighingDate},</if>
  1504. <if test="fIfsampling != null">f_ifsampling = #{fIfsampling},</if>
  1505. <if test="sendSampleDate != null">send_sample_date = #{sendSampleDate},</if>
  1506. <if test="fIfweightRecovery != null">f_ifweight_recovery = #{fIfweightRecovery},</if>
  1507. <if test="weightRecoveryDate != null">weight_recovery_date = #{weightRecoveryDate},</if>
  1508. <if test="warehouseStatus != null">warehouse_status = #{warehouseStatus},</if>
  1509. <if test="fTimes != null">f_times = #{fTimes},</if>
  1510. <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
  1511. <if test="fChargetype != null">f_chargetype = #{fChargetype},</if>
  1512. <if test="fWeighWeight != null">f_weigh_weight = #{fWeighWeight},</if>
  1513. <if test="fPredictBranch != null">f_predict_branch = #{fPredictBranch},</if>
  1514. <if test="fGrade != null">f_grade = #{fGrade},</if>
  1515. <if test="fDeliveryDetails != null">f_delivery_details = #{fDeliveryDetails},</if>
  1516. <if test="fSalesmanId != null">f_salesman_id = #{fSalesmanId},</if>
  1517. <if test="fItemstatus != null">f_itemstatus = #{fItemstatus},</if>
  1518. <if test="fUpdeteStatus != null">f_updete_status = #{fUpdeteStatus},</if>
  1519. <if test="fSubmitUpdate != null">f_submit_update = #{fSubmitUpdate},</if>
  1520. <if test="fDeleteStatus != null">f_delete_status = #{fDeleteStatus},</if>
  1521. <if test="fRemarksFees != null">f_remarks_fees = #{fRemarksFees},</if>
  1522. <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
  1523. <if test="fFeeStatus != null">f_fee_status = #{fFeeStatus},</if>
  1524. <if test="fArrivalStatus != null">f_arrival_status = #{fArrivalStatus},</if>
  1525. <if test="fDismountStatus != null">f_dismount_status = #{fDismountStatus},</if>
  1526. <if test="fServiceitemsNew != null">f_serviceitems_new = #{fServiceitemsNew},</if>
  1527. <if test="fReceivable != null">f_receivable = #{fReceivable},</if>
  1528. <if test="fRecycle != null">f_recycle = #{fRecycle},</if>
  1529. <if test="fDue != null">f_due = #{fDue},</if>
  1530. <if test="fPay != null">f_pay = #{fPay},</if>
  1531. <if test="fCaregoStatus != null">f_carego_status = #{fCaregoStatus},</if>
  1532. <if test="fShipTwo != null">f_ship_two = #{fShipTwo},</if>
  1533. <if test="fVoyTwo != null">f_voy_two = #{fVoyTwo},</if>
  1534. <if test="pickUpPerson != null">pick_up_person = #{pickUpPerson},</if>
  1535. <if test="pickUpTime != null">pick_up_time = #{pickUpTime},</if>
  1536. <if test="facilityPerson != null">facility_person = #{facilityPerson},</if>
  1537. <if test="facilityTime != null">facility_time = #{facilityTime},</if>
  1538. <if test="isPledge != null and isPledge != ''">is_pledge = #{isPledge},</if>
  1539. <if test="documentSummary != null and documentSummary != ''">document_summary = #{documentSummary},</if>
  1540. <if test="financialBillType != null and financialBillType != ''">financial_bill_type = #{financialBillType},</if>
  1541. <if test="checklists != null and checklists != ''">checklists = #{checklists},</if>
  1542. </trim>
  1543. where f_id = #{fId}
  1544. </update>
  1545. <update id="updateKaHeOrder" parameterType="TWarehousebills">
  1546. update t_warehousebills
  1547. <trim prefix="SET" suffixOverrides=",">
  1548. <if test="fBillno != null">f_billno = #{fBillno},</if>
  1549. <if test="fCustomsdeclartion != null">f_customsdeclartion = #{fCustomsdeclartion},</if>
  1550. <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
  1551. <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
  1552. <if test="fBsdeptid != null">f_bsdeptid = #{fBsdeptid},</if>
  1553. <if test="fContacts != null">f_contacts = #{fContacts},</if>
  1554. <if test="fTel != null">f_tel = #{fTel},</if>
  1555. <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
  1556. <if test="fShipper != null">f_shipper = #{fShipper},</if>
  1557. <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
  1558. <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
  1559. <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno = #{fBscorpno},</if>
  1560. <if test="fWarehouseid != null">f_warehouseid = #{fWarehouseid},</if>
  1561. <if test="fStorekeeper != null">f_storekeeper = #{fStorekeeper},</if>
  1562. <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
  1563. <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
  1564. <if test="fPlanqty != null">f_planqty = #{fPlanqty},</if>
  1565. <if test="fPlangrossweight != null">f_plangrossweight = #{fPlangrossweight},</if>
  1566. <if test="fPlannetweight != null">f_plannetweight = #{fPlannetweight},</if>
  1567. <if test="fPlanvolumn != null">f_planvolumn = #{fPlanvolumn},</if>
  1568. <if test="fQty != null">f_qty = #{fQty},</if>
  1569. <if test="fGrossweight != null">f_grossweight = #{fGrossweight},</if>
  1570. <if test="fNetweight != null">f_netweight = #{fNetweight},</if>
  1571. <if test="fVolumn != null">f_volumn = #{fVolumn},</if>
  1572. <if test="fTrademodeid != null">f_trademodeid = #{fTrademodeid},</if>
  1573. <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
  1574. <if test="fSbu != null">f_sbu = #{fSbu},</if>
  1575. <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
  1576. <if test="fMblno != null">f_mblno = #{fMblno},</if>
  1577. <if test="fEmblno != null">f_emblno = #{fEmblno},</if>
  1578. <if test="fCompany != null">f_company = #{fCompany},</if>
  1579. <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
  1580. <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
  1581. <if test="fEta != null">f_eta = #{fEta},</if>
  1582. <if test="fCustomno != null">f_customno = #{fCustomno},</if>
  1583. <if test="fIfweigh != null">f_ifweigh = #{fIfweigh},</if>
  1584. <if test="fIfpledge != null">f_ifpledge = #{fIfpledge},</if>
  1585. <if test="fIfdamage != null">f_ifdamage = #{fIfdamage},</if>
  1586. <if test="fBankcorpid != null">f_bankcorpid = #{fBankcorpid},</if>
  1587. <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
  1588. <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
  1589. <if test="delFlag != null">del_flag = #{delFlag},</if>
  1590. <if test="createBy != null">create_by = #{createBy},</if>
  1591. <if test="createTime != null">create_time = #{createTime},</if>
  1592. <if test="fItemsStatus != null">f_items_status = #{fItemsStatus},</if>
  1593. <if test="updateBy != null">update_by = #{updateBy},</if>
  1594. <if test="updateTime != null">update_time = #{updateTime},</if>
  1595. <if test="remark != null">remark = #{remark},</if>
  1596. <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
  1597. <if test="fProductName != null">f_product_name = #{fProductName},</if>
  1598. <if test="fReviewDate != null and fBillstatus == 11" >f_review_date = #{fReviewDate},</if>
  1599. <if test="fReviewDate != null and fBillstatus != 11">f_review_date = null,</if>
  1600. <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
  1601. <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
  1602. <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
  1603. <if test="fDriverIdCar != null">f_driver_id_car = #{fDriverIdCar},</if>
  1604. <if test="fBusinessType != null">f_business_type = #{fBusinessType},</if>
  1605. <if test="fReviewDate == null">f_review_date = null,</if>
  1606. <if test="fLabour != null">f_labour = #{fLabour },</if>
  1607. <if test="fFleet != null">f_fleet = #{fFleet},</if>
  1608. <if test="fInwarehouseid != null">f_inwarehouseid = #{fInwarehouseid},</if>
  1609. <if test="fBstime != null">f_bstime = #{fBstime},</if>
  1610. <if test="fCartype != null">f_cartype = #{fCartype},</if>
  1611. <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
  1612. <if test="fNewTrademodeid != null">f_new_trademodeid = #{fNewTrademodeid},</if>
  1613. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  1614. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  1615. <if test="fServiceitems != null">f_serviceitems = #{fServiceitems},</if>
  1616. <if test="fInvoceobj != null">f_invoceobj = #{fInvoceobj},</if>
  1617. <if test="fSign != null">f_sign = #{fSign},</if>
  1618. <if test="fDetentioncargo != null">f_detentioncargo = #{fDetentioncargo},</if>
  1619. <if test="fBooksmarks != null">f_booksmarks = #{fBooksmarks},</if>
  1620. <if test="fShippername != null">f_shippername = #{fShippername},</if>
  1621. <if test="fShipperattn != null">f_shipperattn = #{fShipperattn},</if>
  1622. <if test="fShippertel != null">f_shippertel = #{fShippertel},</if>
  1623. <if test="fConsigneername != null">f_consigneername = #{fConsigneername},</if>
  1624. <if test="fConsigneeattn != null">f_consigneeattn = #{fConsigneeattn},</if>
  1625. <if test="fConsigneetel != null">f_consigneetel = #{fConsigneetel},</if>
  1626. <if test="fInsurance != null">f_insurance = #{fInsurance},</if>
  1627. <if test="fInsuranceamt != null">f_insuranceamt = #{fInsuranceamt},</if>
  1628. <if test="fClosedate != null">f_closedate = #{fClosedate},</if>
  1629. <if test="fDocmentdate != null">f_docmentdate = #{fDocmentdate},</if>
  1630. <if test="fVslid != null">f_vslid = #{fVslid},</if>
  1631. <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
  1632. <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
  1633. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  1634. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  1635. <if test="freeContainerDate != null">free_container_date = #{freeContainerDate},</if>
  1636. <if test="fBusinessAttribution != null">f_business_attribution = #{fBusinessAttribution},</if>
  1637. <if test="fSupervisionUnit != null">f_supervision_unit = #{fSupervisionUnit},</if>
  1638. <if test="fDeclarationElements != null">f_declaration_elements = #{fDeclarationElements},</if>
  1639. <if test="fPartNumber != null">f_part_number = #{fPartNumber},</if>
  1640. <if test="fIfinspection != null">f_ifinspection = #{fIfinspection},</if>
  1641. <if test="fValue != null">f_value = #{fValue},</if>
  1642. <if test="fWeighingDate != null">f_weighing_date = #{fWeighingDate},</if>
  1643. <if test="fIfsampling != null">f_ifsampling = #{fIfsampling},</if>
  1644. <if test="sendSampleDate != null">send_sample_date = #{sendSampleDate},</if>
  1645. <if test="fIfweightRecovery != null">f_ifweight_recovery = #{fIfweightRecovery},</if>
  1646. <if test="weightRecoveryDate != null">weight_recovery_date = #{weightRecoveryDate},</if>
  1647. <if test="warehouseStatus != null">warehouse_status = #{warehouseStatus},</if>
  1648. <if test="fTimes != null">f_times = #{fTimes},</if>
  1649. <if test="fDateChanged != null">f_date_changed = #{fDateChanged},</if>
  1650. <if test="fChargetype != null">f_chargetype = #{fChargetype},</if>
  1651. <if test="fWeighWeight != null">f_weigh_weight = #{fWeighWeight},</if>
  1652. <if test="fPredictBranch != null">f_predict_branch = #{fPredictBranch},</if>
  1653. <if test="fGrade != null">f_grade = #{fGrade},</if>
  1654. <if test="fDeliveryDetails != null">f_delivery_details = #{fDeliveryDetails},</if>
  1655. <if test="fSalesmanId != null">f_salesman_id = #{fSalesmanId},</if>
  1656. <if test="fItemstatus != null">f_itemstatus = #{fItemstatus},</if>
  1657. <if test="fUpdeteStatus != null">f_updete_status = #{fUpdeteStatus},</if>
  1658. <if test="fSubmitUpdate != null">f_submit_update = #{fSubmitUpdate},</if>
  1659. <if test="fDeleteStatus != null">f_delete_status = #{fDeleteStatus},</if>
  1660. <if test="fRemarksFees != null">f_remarks_fees = #{fRemarksFees},</if>
  1661. <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
  1662. <if test="fFeeStatus != null">f_fee_status = #{fFeeStatus},</if>
  1663. <if test="fArrivalStatus != null">f_arrival_status = #{fArrivalStatus},</if>
  1664. <if test="fDismountStatus != null">f_dismount_status = #{fDismountStatus},</if>
  1665. <if test="fServiceitemsNew != null">f_serviceitems_new = #{fServiceitemsNew},</if>
  1666. <if test="fReceivable != null">f_receivable = #{fReceivable},</if>
  1667. <if test="fRecycle != null">f_recycle = #{fRecycle},</if>
  1668. <if test="fDue != null">f_due = #{fDue},</if>
  1669. <if test="fPay != null">f_pay = #{fPay},</if>
  1670. <if test="fCaregoStatus != null">f_carego_status = #{fCaregoStatus},</if>
  1671. <if test="fShipTwo != null">f_ship_two = #{fShipTwo},</if>
  1672. <if test="fVoyTwo != null">f_voy_two = #{fVoyTwo},</if>
  1673. <if test="pickUpPerson != null">pick_up_person = #{pickUpPerson},</if>
  1674. <if test="pickUpTime != null">pick_up_time = #{pickUpTime},</if>
  1675. <if test="facilityPerson != null">facility_person = #{facilityPerson},</if>
  1676. <if test="facilityTime != null">facility_time = #{facilityTime},</if>
  1677. <if test="isPledge != null and isPledge != ''">is_pledge = #{isPledge},</if>
  1678. <if test="checklists != null and checklists != ''">checklists = #{checklists},</if>
  1679. </trim>
  1680. where f_id = #{fId}
  1681. </update>
  1682. <delete id="deleteTWarehousebillsById" parameterType="Long">
  1683. UPDATE t_warehousebills SET del_flag = '1'
  1684. where f_id = #{fId}
  1685. </delete>
  1686. <!-- delete
  1687. item.*,
  1688. elabel.*,
  1689. bill.*,
  1690. fess.*,
  1691. enclosure.*
  1692. from
  1693. t_warehousebills bill
  1694. LEFT JOIN t_warehousebillsfees fess ON fess.f_pid = bill.f_id
  1695. LEFT JOIN t_enclosure enclosure ON enclosure.f_pid = bill.f_id
  1696. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  1697. LEFT JOIN t_warehousebillsitems_elabel elabel ON elabel.f_pid = item.f_id
  1698. where
  1699. bill.f_id in
  1700. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1701. #{fId}
  1702. </foreach>-->
  1703. <delete id="deleteTWarehousebillsByIds" parameterType="String">
  1704. UPDATE
  1705. t_warehousebills bill
  1706. LEFT JOIN t_warehousebillsfees fess ON fess.f_pid = bill.f_id
  1707. LEFT JOIN t_enclosure enclosure ON enclosure.f_pid = bill.f_id
  1708. LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
  1709. LEFT JOIN t_warehousebillsitems_elabel elabel ON elabel.f_pid = item.f_id
  1710. set bill.del_flag = '1',
  1711. fess.del_flag = '1',
  1712. enclosure.del_flag = '1',
  1713. item.del_flag = '1'
  1714. where
  1715. bill.f_id in
  1716. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1717. #{fId}
  1718. </foreach>
  1719. </delete>
  1720. <!--delete
  1721. bill.*,
  1722. fess.*,
  1723. enclosure.*
  1724. from
  1725. t_warehousebills bill
  1726. LEFT JOIN t_warehousebills_cntr fess ON fess.f_pid = bill.f_id
  1727. LEFT JOIN t_warehousebills_cntritems enclosure ON enclosure.f_pid = bill.f_id
  1728. where
  1729. bill.f_id in
  1730. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1731. #{fId}
  1732. </foreach>-->
  1733. <delete id="deleteKHTWarehousebillsByIds" parameterType="String">
  1734. UPDATE
  1735. t_warehousebills bill
  1736. LEFT JOIN t_warehousebills_cntr fess ON fess.f_pid = bill.f_id
  1737. LEFT JOIN t_warehousebills_cntritems enclosure ON enclosure.f_pid = bill.f_id
  1738. set bill.del_flag = '1',
  1739. fess.del_flag = '1' ,
  1740. enclosure.del_flag = '1'
  1741. where
  1742. bill.f_id in
  1743. <foreach item="fId" collection="array" open="(" separator="," close=")">
  1744. #{fId}
  1745. </foreach>
  1746. </delete>
  1747. <update id="warehouseFollowUpdate">
  1748. update
  1749. t_warehousebills
  1750. <trim prefix="SET" suffixOverrides=",">
  1751. <if test="fettle != null">f_billstatus = #{fettle},</if>
  1752. <if test="auditItem != null and fettle == 6">f_review_date = #{auditItem},</if>
  1753. <if test="auditItem != null and fettle != 6">f_review_date = null,</if>
  1754. </trim>
  1755. where f_id = #{fPid}
  1756. </update>
  1757. <update id="warehouseApprovalUpdate">
  1758. update
  1759. t_warehousebills
  1760. SET ${auditItem.fidStatus} = #{fettle}
  1761. where f_id = #{auditItem.billId}
  1762. </update>
  1763. <select id="selectDetailedList" resultType="java.util.Map">
  1764. SELECT
  1765. t.f_id AS fId,
  1766. item.f_id AS fItemsId,
  1767. C.f_name AS fcorpid,
  1768. t.f_shipper AS fShipper,
  1769. t.f_mblno AS fMblno,
  1770. g.f_name AS fGoodsid,
  1771. dict.dict_label AS fBusinessType,
  1772. t.f_marks AS fMarks,
  1773. CASE
  1774. WHEN t.f_billtype = 'SJRK' THEN
  1775. '入库'
  1776. WHEN t.f_billtype = 'SJCK' THEN
  1777. '出库'
  1778. WHEN t.f_billtype = 'CKDB' THEN
  1779. '调拨'
  1780. WHEN t.f_billtype = 'HQZY' THEN
  1781. '货权转移'
  1782. WHEN t.f_billtype = 'HWTG' THEN
  1783. '货物通关'
  1784. END AS fBilltype,
  1785. item.f_bsdate AS fBsdate,
  1786. item.f_warehouse_information AS fWarehouseInformation,
  1787. dictTra.dict_label AS fTrademodeid,
  1788. CASE
  1789. WHEN t.f_billtype = 'SJRK' THEN
  1790. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1791. END AS fQtyRK,
  1792. CASE
  1793. WHEN t.f_billtype = 'SJRK' THEN
  1794. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1795. END AS fGrossweightRK,
  1796. CASE
  1797. WHEN t.f_billtype = 'SJRK' THEN
  1798. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1799. END AS fNetweightRK,
  1800. CASE
  1801. WHEN t.f_billtype = 'SJCK' THEN
  1802. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1803. END AS fQtyCK,
  1804. CASE
  1805. WHEN t.f_billtype = 'SJCK' THEN
  1806. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1807. END AS fGrossweightCK,
  1808. CASE
  1809. WHEN t.f_billtype = 'SJCK' THEN
  1810. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1811. END AS fNetweightCK,
  1812. CASE
  1813. WHEN t.f_billtype = 'CKDB' THEN
  1814. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1815. END AS fQtyDB,
  1816. CASE
  1817. WHEN t.f_billtype = 'CKDB' THEN
  1818. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1819. END AS fGrossweightDB,
  1820. CASE
  1821. WHEN t.f_billtype = 'CKDB' THEN
  1822. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1823. END AS fNetweightDB,
  1824. CASE
  1825. WHEN t.f_billtype = 'HQZY' THEN
  1826. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1827. END AS fQtyHZ,
  1828. CASE
  1829. WHEN t.f_billtype = 'HQZY' THEN
  1830. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1831. END AS fGrossweightHZ,
  1832. CASE
  1833. WHEN t.f_billtype = 'HQZY' THEN
  1834. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1835. END AS fNetweightHZ,
  1836. CASE
  1837. WHEN t.f_billtype = 'HWTG' THEN
  1838. ( SELECT SUM( it.f_qty ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1839. END AS fQtyTG,
  1840. CASE
  1841. WHEN t.f_billtype = 'HWTG' THEN
  1842. ( SELECT SUM( it.f_grossweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1843. END AS fGrossweightTG,
  1844. CASE
  1845. WHEN t.f_billtype = 'HWTG' THEN
  1846. ( SELECT SUM( it.f_netweight ) FROM t_warehousebillsitems it WHERE it.f_pid = item.f_pid ) ELSE 0
  1847. END AS fNetweightTG
  1848. FROM t_warehousebills t
  1849. LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
  1850. LEFT JOIN t_goods g ON item.f_goodsid = g.f_id
  1851. LEFT JOIN t_corps C ON t.f_corpid = C.f_id
  1852. LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
  1853. LEFT JOIN sys_dict_data dictTra ON dictTra.dict_value = t.f_trademodeid
  1854. WHERE dict.STATUS = '0'
  1855. AND t.f_typeid IS NULL
  1856. AND dict.dict_type = 'storage_type'
  1857. AND dictTra.STATUS = '0'
  1858. AND dictTra.dict_type = 'data_trademodes'
  1859. AND item.f_billstatus = 40
  1860. AND item.f_mblno = #{fMblno}
  1861. AND (item.f_warehouselocid = #{fWarehouseLocationid} or
  1862. item.f_transfer_warehouselocid = #{fWarehouseLocationid})
  1863. AND t.f_trademodeid = #{fTrademodeids}
  1864. AND item.f_business_type = #{fBusinessType}
  1865. AND item.f_goodsid = #{fGoodsid}
  1866. AND item.f_marks = #{fMarks}
  1867. AND t.f_corpid = #{fCorpIds}
  1868. GROUP BY t.f_id
  1869. </select>
  1870. <select id="webVersionOrderList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  1871. SELECT
  1872. tw.f_id,
  1873. tw.f_billno,
  1874. tw.f_customsdeclartion,
  1875. tw.f_originalbillno,
  1876. tw.f_deptid,
  1877. tw.f_bsdeptid,
  1878. tw.f_contacts,
  1879. tw.f_tel,
  1880. tw.f_corpid,
  1881. tw.f_shipper,
  1882. tc.f_name corpName,
  1883. tw.f_tocorpid,
  1884. tw.f_stltypeid,
  1885. tw.f_bscorpno,
  1886. tw.f_warehouseid,
  1887. tw.f_storekeeper,
  1888. tw.f_chargedate,
  1889. tw.f_bsdate,
  1890. tw.f_planqty,
  1891. tw.f_plangrossweight,
  1892. tw.f_plannetweight,
  1893. tw.f_planvolumn,
  1894. tw.f_qty,
  1895. tw.f_grossweight,
  1896. tw.f_netweight,
  1897. tw.f_volumn,
  1898. tw.f_billingway,
  1899. tw.f_trademodeid,
  1900. tw.f_sbu,
  1901. tw.f_feetunit,
  1902. tw.f_mblno,
  1903. tw.f_marks,
  1904. tw.f_vslvoy,
  1905. tw.f_eta,
  1906. tw.f_customno,
  1907. tw.f_ifweigh,
  1908. tw.f_ifpledge,
  1909. tw.f_ifdamage,
  1910. tw.f_bankcorpid,
  1911. tw.f_billtype,
  1912. tw.f_billstatus,
  1913. tw.f_items_status,
  1914. tw.del_flag,
  1915. tw.create_by,
  1916. tw.create_time,
  1917. tw.update_by,
  1918. tw.update_time,
  1919. tw.remark,
  1920. tw.f_billing_deadline,
  1921. tw.f_product_name,
  1922. tw.f_review_date,
  1923. tw.f_truckno,
  1924. tw.f_driver_name,
  1925. tw.f_driver_tel,
  1926. tw.f_driver_id_car,
  1927. tw.f_business_type,
  1928. tw.f_labour,
  1929. tw.f_fleet,
  1930. tw.f_inwarehouseid,
  1931. tw.f_bstime,
  1932. tw.f_cartype,
  1933. tw.f_goodsid,
  1934. tw.f_new_trademodeid,
  1935. tw.f_loadportid,
  1936. address.f_name loadportidName,
  1937. tw.f_destportid,
  1938. ta.f_name destportidName,
  1939. tw.f_serviceitems,
  1940. sd.dict_label serviceitemsName,
  1941. tw.f_invoceobj,
  1942. sdi.dict_label invoceobjName,
  1943. tw.f_sign,
  1944. sdc.dict_label signName,
  1945. tw.f_detentioncargo,
  1946. sdt.dict_label detentioncargoName,
  1947. tw.f_booksmarks,
  1948. tw.f_shippername,
  1949. tw.f_shipperattn,
  1950. tw.f_shippertel,
  1951. tw.f_consigneername,
  1952. tw.f_consigneeattn,
  1953. tw.f_consigneetel,
  1954. tw.f_insurance,
  1955. sdd.dict_label insuranceName,
  1956. tw.f_insuranceamt,
  1957. tw.f_closedate,
  1958. tw.f_docmentdate,
  1959. tw.f_vslid,
  1960. tv.f_name vslidName,
  1961. tw.f_voyid,
  1962. ty.f_no voyidName,
  1963. tw.f_typeid,
  1964. tw.f_paymode,
  1965. sda.dict_label paymodeName,
  1966. tw.f_laneid,
  1967. tr.f_name laneidName,
  1968. tw.f_updete_status,
  1969. tw.f_submit_update,
  1970. tw.f_delete_status,
  1971. tw.f_cargo_planning,
  1972. tw.f_arrival_status,
  1973. tw.f_dismount_status,
  1974. tw.f_serviceitems_new
  1975. FROM t_warehousebills tw
  1976. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  1977. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  1978. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  1979. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  1980. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  1981. AND sd.dict_type = 'f_serviceitems'
  1982. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  1983. AND sdi.dict_type = 'f_invoceobj'
  1984. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  1985. AND sdc.dict_type = 'f_sign'
  1986. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  1987. AND sdt.dict_type = 'f_detentioncargo'
  1988. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  1989. AND sdd.dict_type = 'f_insurance'
  1990. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  1991. AND sda.dict_type = 'f_paymode'
  1992. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  1993. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  1994. <where>
  1995. tw.f_typeid = '1'
  1996. and tw.del_flag = '0'
  1997. <if test="fId != null">and tw.f_id = #{fId}</if>
  1998. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  1999. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =#{fCustomsdeclartion}</if>
  2000. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}</if>
  2001. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  2002. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  2003. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  2004. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  2005. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  2006. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%', #{fShipper}, '%')</if>
  2007. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  2008. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  2009. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  2010. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  2011. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  2012. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  2013. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  2014. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  2015. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  2016. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  2017. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  2018. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  2019. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  2020. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  2021. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  2022. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  2023. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  2024. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  2025. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  2026. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  2027. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  2028. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  2029. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  2030. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  2031. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  2032. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  2033. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  2034. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  2035. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  2036. <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
  2037. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  2038. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  2039. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  2040. #{fProductName}, '%')
  2041. </if>
  2042. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  2043. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  2044. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  2045. '%')
  2046. </if>
  2047. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  2048. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  2049. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  2050. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  2051. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  2052. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  2053. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  2054. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  2055. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  2056. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  2057. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  2058. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  2059. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2060. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  2061. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  2062. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  2063. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  2064. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  2065. #{fShippername}, '%')
  2066. </if>
  2067. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  2068. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  2069. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  2070. #{fConsigneername}, '%')
  2071. </if>
  2072. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  2073. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  2074. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  2075. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  2076. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  2077. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  2078. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2079. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2080. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  2081. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  2082. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  2083. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2084. and tw.create_time &gt;= #{timeInterval[0]}
  2085. </if>
  2086. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2087. and tw.create_time &lt;= #{timeInterval[1]}
  2088. </if>
  2089. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  2090. <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
  2091. <if test="billList != null "> and tw.f_mblno in
  2092. <foreach item="fMblno" collection="billList" open="(" separator="," close=")">
  2093. #{fMblno}
  2094. </foreach>
  2095. </if>
  2096. </where>
  2097. ORDER BY tw.create_time DESC, tw.f_id DESC
  2098. </select>
  2099. <select id="ruoYiVersionOrderList" parameterType="TWarehousebills" resultType="map">
  2100. SELECT
  2101. DISTINCT
  2102. tw.f_id fId,
  2103. tw.f_billno fBillno,
  2104. tw.f_originalbillno fOriginalbillno,
  2105. tw.f_shipper fShipper,
  2106. tw.f_mblno fMblno,
  2107. sd.dict_label fServiceitems,
  2108. tk.dict_label fDestportMode,
  2109. tw.f_consigneername fConsigneername,
  2110. tw.f_consigneetel fConsigneetel,
  2111. tw.f_eta fEta,
  2112. tw.f_marks fMarks,
  2113. ta.f_name fName,
  2114. tw.f_bsdate fBsdate,
  2115. ty.f_ATD fAtd,
  2116. ty.f_ATA fAta,
  2117. tc.f_cntrcount fCntrcount,
  2118. tc.f_no fNo,
  2119. tv.f_name vslName,
  2120. ty.f_no voyNo,
  2121. tw.f_corpid fCorpid,
  2122. tp.f_name corpName,
  2123. tp.f_no shipAgentNo,
  2124. tw.create_by createBy,
  2125. tw.create_time createTime,
  2126. tw.f_loadportid fLoadportid,
  2127. tre.f_name loadportName,
  2128. tw.f_destportid fDestportid,
  2129. ts.f_name destportName,
  2130. tc.f_name goodsName,
  2131. CASE
  2132. WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2133. '下单新建'
  2134. WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2135. '下单暂存'
  2136. WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2137. '下单驳回'
  2138. WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2139. '下单提交'
  2140. WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2141. '下单审批中'
  2142. WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2143. '下单审批通过'
  2144. WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2145. '配船暂存'
  2146. WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2147. '配船驳回'
  2148. WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2149. '配船提交'
  2150. WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2151. '配船审批中'
  2152. WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2153. '配船审批通过'
  2154. WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2155. '运单变更'
  2156. WHEN tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2157. '申请变更驳回'
  2158. WHEN tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2159. '申请变更提交'
  2160. WHEN tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2161. '申请变更审批中'
  2162. WHEN tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2163. '申请变更通过'
  2164. WHEN tw.f_submit_update = '3' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2165. '提交变更驳回'
  2166. WHEN tw.f_submit_update = '4' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2167. '提交变更审批'
  2168. WHEN tw.f_submit_update = '5' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2169. '提交变更审批中'
  2170. WHEN tw.f_submit_update = '6' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2171. '提交变更通过'
  2172. WHEN tw.f_delete_status = '3' and tw.f_dismount_status = '2' THEN
  2173. '申请删单驳回'
  2174. WHEN tw.f_delete_status = '4' and tw.f_dismount_status = '2' THEN
  2175. '申请删单提交'
  2176. WHEN tw.f_delete_status = '5' and tw.f_dismount_status = '2' THEN
  2177. '申请删单审批中'
  2178. WHEN tw.f_delete_status = '6' and tw.f_dismount_status = '2' THEN
  2179. '申请删单通过'
  2180. WHEN tw.f_dismount_status = '3' THEN
  2181. '拆单审批驳回'
  2182. WHEN tw.f_dismount_status = '4' THEN
  2183. '拆单审批提交'
  2184. WHEN tw.f_dismount_status = '5' THEN
  2185. '拆单审批中'
  2186. WHEN tw.f_dismount_status = '6' THEN
  2187. '拆单审批通过'
  2188. END AS fBillstatus,
  2189. CASE
  2190. WHEN tf.f_billstatus = '1' THEN
  2191. '新建'
  2192. WHEN tf.f_billstatus = '2' THEN
  2193. '暂存'
  2194. WHEN tf.f_billstatus = '3' THEN
  2195. '驳回'
  2196. WHEN tf.f_billstatus = '4' THEN
  2197. '提交'
  2198. WHEN tf.f_billstatus = '5' THEN
  2199. '审批中'
  2200. WHEN tf.f_billstatus = '6' THEN
  2201. '审批通过'
  2202. END AS moneyStatus,
  2203. tw.f_updete_status fUpdeteStatus,
  2204. tw.f_submit_update fSubmitUpdate,
  2205. tw.f_delete_status fDeleteStatus,
  2206. tw.f_cargo_planning fCargoPlanning,
  2207. tw.f_arrival_status fArrivalStatus,
  2208. tw.f_vslid fVslid,
  2209. tw.f_voyid fVoyid,
  2210. tw.remark remark,
  2211. IFNULL(tcntr.loadCntr,0) AS loadCntr,
  2212. tw.f_serviceitems_new AS fServiceitemsNew,
  2213. tw.f_receivable AS fReceivable,
  2214. tw.f_recycle AS fRecycle,
  2215. tw.f_due AS fDue,
  2216. tw.f_pay AS fPay,
  2217. CASE
  2218. WHEN tw.f_carego_status = '0' THEN '录入'
  2219. WHEN tw.f_carego_status = '1' THEN '未放货'
  2220. WHEN tw.f_carego_status = '2' THEN '放货'
  2221. WHEN tw.f_carego_status = '3' THEN '扣货'
  2222. END AS fCaregoStatus,
  2223. tv1.f_name fShipTwoName,
  2224. ty1.f_no fVoyTwoName,
  2225. tw.pick_up_person AS pickUpPerson,
  2226. tw.pick_up_time AS pickUpTime,
  2227. tw.facility_person AS facilityPerson,
  2228. tw.facility_time AS facilityTime,
  2229. tv.f_ename AS vesselNameEn,
  2230. tp.f_typeid AS sendType,
  2231. tp.f_contractno AS contractNo,
  2232. tv.f_imo AS imo,
  2233. ta.f_no AS mtdm,
  2234. tv.f_ower AS shipCompany,
  2235. tw.f_billtype AS billType,
  2236. tw.f_paymode AS fPaymode
  2237. FROM
  2238. t_warehousebills tw
  2239. LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
  2240. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  2241. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  2242. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
  2243. LEFT JOIN sys_dict_data tk ON tk.dict_value = tw.f_serviceitems_new AND tk.dict_type = 'f_serviceitems'
  2244. <if test="fCntrno != null and fCntrno != ''">
  2245. LEFT JOIN t_warehousebills_cntritems items ON tw.f_id = items.f_pid
  2246. </if>
  2247. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2248. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2249. LEFT JOIN t_vessel tv1 ON tw.f_ship_two = tv1.f_id
  2250. LEFT JOIN t_voyage ty1 ON tw.f_voy_two = ty1.f_id
  2251. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  2252. LEFT JOIN (
  2253. SELECT
  2254. th.f_pid,
  2255. th.f_cntrcount,
  2256. tr.f_no,
  2257. th.f_cntrid,
  2258. tg.f_name
  2259. FROM
  2260. t_warehousebills_cntr th
  2261. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  2262. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  2263. ) tc ON tc.f_pid = tw.f_id
  2264. LEFT JOIN (SELECT f_pid,f_billstatus FROM t_warehousebillsfees GROUP BY f_pid)tf ON tf.f_pid = tw.f_id
  2265. LEFT JOIN (
  2266. SELECT
  2267. th.f_pid,
  2268. count(th.f_pid) loadCntr
  2269. FROM
  2270. t_warehousebills_cntritems th
  2271. GROUP BY th.f_pid
  2272. ) tcntr ON tcntr.f_pid = tw.f_id
  2273. <where>
  2274. tw.f_typeid = '1'
  2275. and tw.del_flag = '0'
  2276. <if test="fId != null">and tw.f_id = #{fId}</if>
  2277. <if test="fCaregoStatus != null and fCaregoStatus != ''">and tw.f_carego_status = #{fCaregoStatus}</if>
  2278. <if test="fCntrno != null and fCntrno != ''">and items.f_cntrno like concat('%', #{fCntrno}, '%')</if>
  2279. <if test="fBillno != null and fBillno != ''">and tw.f_billno like concat('%',#{fBillno}, '%')</if>
  2280. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  2281. #{fCustomsdeclartion}
  2282. </if>
  2283. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  2284. </if>
  2285. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  2286. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  2287. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  2288. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  2289. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  2290. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%', #{fShipper}, '%')</if>
  2291. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  2292. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  2293. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  2294. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  2295. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  2296. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  2297. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  2298. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  2299. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  2300. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  2301. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  2302. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  2303. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  2304. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  2305. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  2306. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  2307. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  2308. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  2309. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  2310. <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%',
  2311. #{fMblno}, '%')</if>
  2312. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  2313. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  2314. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  2315. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  2316. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  2317. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  2318. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  2319. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  2320. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  2321. <if test="fBillstatus != null and (fBillstatus == 4 or fBillstatus == 6 or fBillstatus == 9 or fBillstatus == 11)">
  2322. and tw.f_billstatus = #{fBillstatus}
  2323. and tw.f_updete_status = 2
  2324. and tw.f_submit_update = 2
  2325. and tw.f_delete_status = 2
  2326. </if>
  2327. <if test="fBillstatus != null and fBillstatus == 10">
  2328. and tw.f_billstatus in ('3','8')
  2329. and tw.f_updete_status in ('2','3')
  2330. and tw.f_submit_update in ('2','3')
  2331. and tw.f_delete_status in ('2','3')
  2332. </if>
  2333. <if test="fBillstatus != null and fBillstatus == 12">
  2334. AND (tw.f_updete_status != 2
  2335. OR tw.f_submit_update != 2
  2336. OR tw.f_delete_status != 2 )
  2337. </if>
  2338. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  2339. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  2340. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  2341. #{fProductName}, '%')
  2342. </if>
  2343. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  2344. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  2345. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  2346. '%')
  2347. </if>
  2348. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  2349. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  2350. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  2351. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  2352. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  2353. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  2354. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  2355. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  2356. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  2357. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  2358. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  2359. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  2360. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2361. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  2362. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  2363. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  2364. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  2365. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  2366. #{fShippername}, '%')
  2367. </if>
  2368. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  2369. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  2370. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  2371. #{fConsigneername}, '%')
  2372. </if>
  2373. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  2374. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  2375. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  2376. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  2377. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  2378. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  2379. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2380. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2381. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  2382. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  2383. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  2384. <if test='startTime != null'>
  2385. and tw.create_time &gt;= #{startTime}
  2386. </if>
  2387. <if test='endTime != null'>
  2388. and tw.create_time &lt;= #{endTime}
  2389. </if>
  2390. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  2391. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  2392. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  2393. #{vslidName}, '%')
  2394. </if>
  2395. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  2396. #{voyidName}, '%')
  2397. </if>
  2398. <if test="boxNumber != null and boxNumber != ''">and tc.f_no like concat('%',
  2399. #{boxNumber}, '%')
  2400. </if>
  2401. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  2402. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  2403. and tw.create_time &gt;= #{cLoadDate[0]}
  2404. </if>
  2405. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  2406. and tw.create_time &lt;= #{cLoadDate[1]}
  2407. </if>
  2408. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2409. and ty.f_ATD &gt;= #{timeInterval[0]}
  2410. </if>
  2411. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2412. and ty.f_ATD &lt;= #{timeInterval[1]}
  2413. </if>
  2414. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  2415. <if test="fArrivalStatus != null and fArrivalStatus != 3"> and tw.f_arrival_status = #{fArrivalStatus}</if>
  2416. <if test="fArrivalStatus != null and fArrivalStatus == 3"> and tw.f_arrival_status != '2'</if>
  2417. <if test="fShipTwo != null "> and tw.f_ship_two = #{fShipTwo}</if>
  2418. <if test="fVoyTwo != null "> and tw.f_voy_two = #{fVoyTwo}</if>
  2419. </where>
  2420. ORDER BY tw.create_time DESC, tw.f_id DESC
  2421. </select>
  2422. <select id="ruoYiVersionOrderList1" parameterType="TWarehousebills" resultType="map">
  2423. SELECT
  2424. tw.f_id fId,
  2425. tw.f_billno fBillno,
  2426. tw.f_originalbillno fOriginalbillno,
  2427. tw.f_shipper fShipper,
  2428. tw.f_mblno fMblno,
  2429. sd.dict_label fServiceitems,
  2430. tw.f_consigneername fConsigneername,
  2431. ta.f_name fName,
  2432. tw.f_bsdate fBsdate,
  2433. tc.f_cntrcount fCntrcount,
  2434. tc.f_no fNo,
  2435. tv.f_name vslName,
  2436. ty.f_no voyNo,
  2437. tw.f_corpid fCorpid,
  2438. tp.f_name corpName,
  2439. tw.create_by createBy,
  2440. tw.create_time createTime,
  2441. tw.f_loadportid fLoadportid,
  2442. tre.f_name loadportName,
  2443. tw.f_destportid fDestportid,
  2444. ts.f_name destportName,
  2445. tc.f_name goodsName,
  2446. tw.f_billstatus fBillstatus,
  2447. CASE
  2448. WHEN tw.f_billstatus = '1' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2449. '下单新建'
  2450. WHEN tw.f_billstatus = '2' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2451. '下单暂存'
  2452. WHEN tw.f_billstatus = '3' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2453. '下单驳回'
  2454. WHEN tw.f_billstatus = '4' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2455. '下单提交'
  2456. WHEN tw.f_billstatus = '5' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2457. '下单审批中'
  2458. WHEN tw.f_billstatus = '6' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2459. '下单审批通过'
  2460. WHEN tw.f_billstatus = '7' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2461. '配船暂存'
  2462. WHEN tw.f_billstatus = '8' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2463. '配船驳回'
  2464. WHEN tw.f_billstatus = '9' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2465. '配船提交'
  2466. WHEN tw.f_billstatus = '10' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2467. '配船审批中'
  2468. WHEN tw.f_billstatus = '11' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2469. '配船审批通过'
  2470. WHEN tw.f_billstatus = '12' and tw.f_updete_status = '2'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2471. '运单变更'
  2472. WHEN tw.f_updete_status = '3'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2473. '申请变更驳回'
  2474. WHEN tw.f_updete_status = '4'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2475. '申请变更提交'
  2476. WHEN tw.f_updete_status = '5'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2477. '申请变更审批中'
  2478. WHEN tw.f_updete_status = '6'and tw.f_submit_update = '2' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2479. '申请变更通过'
  2480. WHEN tw.f_submit_update = '3' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2481. '提交变更驳回'
  2482. WHEN tw.f_submit_update = '4' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2483. '提交变更审批'
  2484. WHEN tw.f_submit_update = '5' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2485. '提交变更审批中'
  2486. WHEN tw.f_submit_update = '6' and tw.f_delete_status = '2' and tw.f_dismount_status = '2' THEN
  2487. '提交变更通过'
  2488. WHEN tw.f_delete_status = '3' and tw.f_dismount_status = '2' THEN
  2489. '申请删单驳回'
  2490. WHEN tw.f_delete_status = '4' and tw.f_dismount_status = '2' THEN
  2491. '申请删单提交'
  2492. WHEN tw.f_delete_status = '5' and tw.f_dismount_status = '2' THEN
  2493. '申请删单审批中'
  2494. WHEN tw.f_delete_status = '6' and tw.f_dismount_status = '2' THEN
  2495. '申请删单通过'
  2496. WHEN tw.f_dismount_status = '3' THEN
  2497. '拆单审批驳回'
  2498. WHEN tw.f_dismount_status = '4' THEN
  2499. '拆单审批提交'
  2500. WHEN tw.f_dismount_status = '5' THEN
  2501. '拆单审批中'
  2502. WHEN tw.f_dismount_status = '6' THEN
  2503. '拆单审批通过'
  2504. END AS fBillstatusName,
  2505. CASE
  2506. WHEN tf.f_billstatus = '1' THEN
  2507. '新建'
  2508. WHEN tf.f_billstatus = '2' THEN
  2509. '暂存'
  2510. WHEN tf.f_billstatus = '3' THEN
  2511. '驳回'
  2512. WHEN tf.f_billstatus = '4' THEN
  2513. '提交'
  2514. WHEN tf.f_billstatus = '5' THEN
  2515. '审批中'
  2516. WHEN tf.f_billstatus = '6' THEN
  2517. '审批通过'
  2518. END AS moneyStatus,
  2519. tw.f_updete_status fUpdeteStatus,
  2520. tw.f_submit_update fSubmitUpdate,
  2521. tw.f_delete_status fDeleteStatus,
  2522. ROUND(IFNULL(tf.fAmount,0),2) fAmount,
  2523. tw.f_cargo_planning fCargoPlanning,
  2524. tw.f_arrival_status,
  2525. tw.remark remark,
  2526. tw.f_serviceitems_new AS fServiceitemsNew
  2527. FROM
  2528. t_warehousebills tw
  2529. LEFT JOIN t_address ta ON ta.f_id = tw.f_laneid
  2530. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  2531. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  2532. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  2533. AND sd.dict_type = 'f_serviceitems'
  2534. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  2535. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  2536. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  2537. LEFT JOIN (
  2538. SELECT
  2539. th.f_pid,
  2540. th.f_cntrcount,
  2541. tr.f_no,
  2542. th.f_cntrid,
  2543. tg.f_name
  2544. FROM
  2545. t_warehousebills_cntr th
  2546. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  2547. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  2548. ) tc ON tc.f_pid = tw.f_id
  2549. LEFT JOIN (SELECT f_pid,f_billstatus,IFNULL(SUM(f_amount),0) fAmount FROM t_warehousebillsfees GROUP BY f_pid)tf ON tf.f_pid = tw.f_id
  2550. <where>
  2551. tw.f_typeid = '1'
  2552. and tw.del_flag = '0'
  2553. <if test="fId != null">and tw.f_id = #{fId}</if>
  2554. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  2555. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  2556. #{fCustomsdeclartion}
  2557. </if>
  2558. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  2559. </if>
  2560. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  2561. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  2562. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  2563. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  2564. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  2565. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%', #{fShipper}, '%')</if>
  2566. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  2567. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  2568. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  2569. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  2570. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  2571. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  2572. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  2573. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  2574. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  2575. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  2576. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  2577. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  2578. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  2579. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  2580. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  2581. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  2582. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  2583. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  2584. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  2585. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  2586. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  2587. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  2588. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  2589. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  2590. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  2591. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  2592. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  2593. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  2594. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  2595. <if test="fBillstatus != null and (fBillstatus == 4 or fBillstatus == 6 or fBillstatus == 9 or fBillstatus == 11)">
  2596. and tw.f_billstatus = #{fBillstatus}
  2597. and tw.f_updete_status = 2
  2598. and tw.f_submit_update = 2
  2599. and tw.f_delete_status = 2
  2600. </if>
  2601. <if test="fBillstatus != null and fBillstatus == 10">
  2602. and tw.f_billstatus in ('3','8')
  2603. and tw.f_updete_status in ('2','3')
  2604. and tw.f_submit_update in ('2','3')
  2605. and tw.f_delete_status in ('2','3')
  2606. </if>
  2607. <if test="fBillstatus != null and fBillstatus == 12">
  2608. AND (tw.f_updete_status != 2
  2609. OR tw.f_submit_update != 2
  2610. OR tw.f_delete_status != 2 )
  2611. </if>
  2612. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  2613. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  2614. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  2615. #{fProductName}, '%')
  2616. </if>
  2617. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  2618. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  2619. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  2620. '%')
  2621. </if>
  2622. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  2623. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  2624. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  2625. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  2626. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  2627. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  2628. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  2629. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  2630. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  2631. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  2632. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  2633. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  2634. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  2635. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  2636. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  2637. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  2638. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  2639. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  2640. #{fShippername}, '%')
  2641. </if>
  2642. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  2643. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  2644. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  2645. #{fConsigneername}, '%')
  2646. </if>
  2647. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  2648. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  2649. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  2650. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  2651. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  2652. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  2653. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  2654. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  2655. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  2656. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  2657. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  2658. <if test='startTime != null'>
  2659. and tw.create_time &gt;= #{startTime}
  2660. </if>
  2661. <if test='endTime != null'>
  2662. and tw.create_time &lt;= #{endTime}
  2663. </if>
  2664. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  2665. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  2666. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  2667. #{vslidName}, '%')
  2668. </if>
  2669. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  2670. #{voyidName}, '%')
  2671. </if>
  2672. <if test="boxNumber != null and boxNumber != ''">and tc.f_no like concat('%',
  2673. #{voyidName}, '%')
  2674. </if>
  2675. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  2676. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  2677. and tw.f_bsdate &gt;= #{cLoadDate[0]}
  2678. </if>
  2679. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  2680. and tw.f_bsdate &lt;= #{cLoadDate[1]}
  2681. </if>
  2682. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  2683. <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
  2684. <if test="fShipTwo != null "> and tw.f_ship_two = #{fShipTwo}</if>
  2685. <if test="fVoyTwo != null "> and tw.f_voy_two = #{fVoyTwo}</if>
  2686. </where>
  2687. ORDER BY tw.create_time DESC, tw.f_id DESC
  2688. </select>
  2689. <select id="webVersionOrderById" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  2690. SELECT tw.f_id,
  2691. tw.f_billno,
  2692. tw.f_customsdeclartion,
  2693. tw.f_originalbillno,
  2694. tw.f_deptid,
  2695. tw.f_bsdeptid,
  2696. tw.f_contacts,
  2697. tw.f_tel,
  2698. tw.f_shipper,
  2699. tw.f_corpid,
  2700. tc.f_name corpName,
  2701. tw.f_tocorpid,
  2702. tw.f_stltypeid,
  2703. tw.f_bscorpno,
  2704. tw.f_warehouseid,
  2705. tw.f_storekeeper,
  2706. tw.f_chargedate,
  2707. tw.f_bsdate,
  2708. tw.f_planqty,
  2709. tw.f_plangrossweight,
  2710. tw.f_plannetweight,
  2711. tw.f_planvolumn,
  2712. tw.f_qty,
  2713. tw.f_grossweight,
  2714. tw.f_netweight,
  2715. tw.f_volumn,
  2716. tw.f_billingway,
  2717. tw.f_trademodeid,
  2718. tw.f_sbu,
  2719. tw.f_feetunit,
  2720. tw.f_mblno,
  2721. tw.f_marks,
  2722. tw.f_vslvoy,
  2723. tw.f_eta,
  2724. tw.f_customno,
  2725. tw.f_ifweigh,
  2726. tw.f_ifpledge,
  2727. tw.f_ifdamage,
  2728. tw.f_bankcorpid,
  2729. tw.f_billtype,
  2730. tw.f_billstatus,
  2731. tw.f_items_status,
  2732. tw.del_flag,
  2733. tw.create_by,
  2734. tw.create_time,
  2735. tw.update_by,
  2736. tw.update_time,
  2737. tw.remark,
  2738. tw.f_billing_deadline,
  2739. tw.f_product_name,
  2740. tw.f_review_date,
  2741. tw.f_truckno,
  2742. tw.f_driver_name,
  2743. tw.f_driver_tel,
  2744. tw.f_driver_id_car,
  2745. tw.f_business_type,
  2746. tw.f_labour,
  2747. tw.f_fleet,
  2748. tw.f_inwarehouseid,
  2749. tw.f_bstime,
  2750. tw.f_cartype,
  2751. tw.f_goodsid,
  2752. tw.f_new_trademodeid,
  2753. tw.f_loadportid,
  2754. address.f_name loadportidName,
  2755. tw.f_destportid,
  2756. ta.f_name destportidName,
  2757. tw.f_serviceitems,
  2758. sd.dict_label serviceitemsName,
  2759. tw.f_invoceobj,
  2760. sdi.dict_label invoceobjName,
  2761. tw.f_sign,
  2762. sdc.dict_label signName,
  2763. tw.f_detentioncargo,
  2764. sdt.dict_label detentioncargoName,
  2765. tw.f_booksmarks,
  2766. tw.f_shippername,
  2767. tw.f_shipperattn,
  2768. tw.f_shippertel,
  2769. tw.f_consigneername,
  2770. tw.f_consigneeattn,
  2771. tw.f_consigneetel,
  2772. tw.f_insurance,
  2773. sdd.dict_label insuranceName,
  2774. tw.f_insuranceamt,
  2775. tw.f_closedate,
  2776. tw.f_docmentdate,
  2777. tw.f_vslid,
  2778. tv.f_name vslidName,
  2779. tw.f_voyid,
  2780. ty.f_no voyidName,
  2781. tw.f_typeid,
  2782. tw.f_paymode,
  2783. sda.dict_label paymodeName,
  2784. tw.f_laneid,
  2785. tr.f_name laneidName,
  2786. tw.f_updete_status,
  2787. tw.f_submit_update,
  2788. tw.f_delete_status,
  2789. tw.f_cargo_planning,
  2790. tw.f_arrival_status,
  2791. tw.f_dismount_status,
  2792. tw.f_serviceitems_new,
  2793. tw.f_receivable,
  2794. tw.f_recycle,
  2795. tw.f_due,
  2796. tw.f_pay,
  2797. CASE
  2798. WHEN tw.f_carego_status = '0' THEN '录入'
  2799. WHEN tw.f_carego_status = '1' THEN '未放货'
  2800. WHEN tw.f_carego_status = '2' THEN '放货'
  2801. WHEN tw.f_carego_status = '3' THEN '扣货'
  2802. END AS fCaregoStatus,
  2803. tv1.f_name fShipTwoName,
  2804. ty1.f_no fVoyTwoName,
  2805. tw.f_ship_two,
  2806. tw.f_voy_two,
  2807. tw.pick_up_person,
  2808. tw.pick_up_time,
  2809. tw.facility_person,
  2810. tw.facility_time
  2811. FROM t_warehousebills tw
  2812. LEFT JOIN t_address address ON address.f_id = tw.f_loadportid
  2813. LEFT JOIN t_address ta ON ta.f_id = tw.f_loadportid
  2814. LEFT JOIN t_address tr ON tr.f_id = tw.f_laneid
  2815. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  2816. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  2817. AND sd.dict_type = 'f_serviceitems'
  2818. LEFT JOIN sys_dict_data sdi ON sdi.dict_value = tw.f_invoceobj
  2819. AND sdi.dict_type = 'f_invoceobj'
  2820. LEFT JOIN sys_dict_data sdc ON sdc.dict_value = tw.f_sign
  2821. AND sdc.dict_type = 'f_sign'
  2822. LEFT JOIN sys_dict_data sdt ON sdt.dict_value = tw.f_detentioncargo
  2823. AND sdt.dict_type = 'f_detentioncargo'
  2824. LEFT JOIN sys_dict_data sdd ON sdd.dict_value = tw.f_insurance
  2825. AND sdd.dict_type = 'f_insurance'
  2826. LEFT JOIN sys_dict_data sda ON sda.dict_value = tw.f_paymode
  2827. AND sda.dict_type = 'f_paymode'
  2828. LEFT JOIN t_vessel tv ON tv.f_id = tw.f_vslid
  2829. LEFT JOIN t_voyage ty ON ty.f_id = tw.f_voyid
  2830. LEFT JOIN t_vessel tv1 ON tv1.f_id = tw.f_ship_two
  2831. LEFT JOIN t_voyage ty1 ON ty1.f_id = tw.f_voy_two
  2832. where 1= 1
  2833. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno} </if>
  2834. <if test="fId != null ">and tw.f_id = #{fId} </if>
  2835. </select>
  2836. <select id="selectTWarehousebillsfMblno" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
  2837. SELECT
  2838. f_id,
  2839. f_mblno
  2840. FROM
  2841. t_warehousebills
  2842. WHERE
  2843. f_typeid = '1'
  2844. and del_flag = '0'
  2845. and f_mblno = #{fMblno}
  2846. </select>
  2847. <select id="selectAppStockList" parameterType="TWarehousebills" resultType="Map">
  2848. SELECT DISTINCT
  2849. w.f_id fId,
  2850. w.f_corpid fCorpid,
  2851. c.f_name corpName,
  2852. w.f_shipper fShipper,
  2853. w.f_bsdate fBsdate,
  2854. g.f_name goodsName,
  2855. w.f_mblno fMblno,
  2856. w.f_qty fQty,
  2857. w.f_cntval fCntval,
  2858. w.f_planqty fPlanqty,
  2859. t.f_name fWarehouseName,
  2860. w.f_planvolumn fPlanvolumn,
  2861. w.f_plannetweight fPlannetweight,
  2862. w.f_plangrossweight fPlangrossweight,
  2863. IFNULL(ROUND(w.f_grossweight/1000,2),0) fGrossweight,
  2864. IFNULL(ROUND(w.f_netweight/1000,2),0) fNetweight,
  2865. w.f_grossweight fGrossweights,
  2866. w.f_storekeeper fStorekeeper,
  2867. w.create_by createBy,
  2868. w.f_warehouseid fWarehouseid,
  2869. w.f_driver_tel fDriverTel,
  2870. w.f_trademodeid fTrademodeid,
  2871. w.f_product_name fProductName,
  2872. CASE
  2873. WHEN w.f_billtype = 'SJRK'
  2874. AND w.f_items_status = '1' THEN
  2875. '计划'
  2876. WHEN w.f_billtype = 'SJRK'
  2877. AND w.f_items_status = '2' THEN
  2878. '待入库'
  2879. WHEN w.f_billtype = 'SJRK'
  2880. AND w.f_items_status = '3' THEN
  2881. '入库中'
  2882. WHEN w.f_billtype = 'SJRK'
  2883. AND w.f_items_status = '4' THEN
  2884. '已入库'
  2885. WHEN w.f_billtype = 'SJCK'
  2886. AND w.f_items_status = '1' THEN
  2887. '计划'
  2888. WHEN w.f_billtype = 'SJCK'
  2889. AND w.f_items_status = '2' THEN
  2890. '待出库'
  2891. WHEN w.f_billtype = 'SJCK'
  2892. AND w.f_items_status = '3' THEN
  2893. '出库中'
  2894. WHEN w.f_billtype = 'SJCK'
  2895. AND w.f_items_status = '4' THEN
  2896. '已出库'
  2897. WHEN w.f_billtype = 'CKDB'
  2898. AND w.f_items_status = '1' THEN
  2899. '计划'
  2900. WHEN w.f_billtype = 'CKDB'
  2901. AND w.f_items_status = '2' THEN
  2902. '待调拨'
  2903. WHEN w.f_billtype = 'CKDB'
  2904. AND w.f_items_status = '3' THEN
  2905. '调拨中'
  2906. WHEN w.f_billtype = 'CKDB'
  2907. AND w.f_items_status = '4' THEN
  2908. '已调拨'
  2909. WHEN w.f_billtype = 'HWTG'
  2910. AND w.f_items_status = '1' THEN
  2911. '计划'
  2912. WHEN w.f_billtype = 'HWTG'
  2913. AND w.f_items_status = '2' THEN
  2914. '待调拨'
  2915. WHEN w.f_billtype = 'HWTG'
  2916. AND w.f_items_status = '3' THEN
  2917. '调拨中'
  2918. WHEN w.f_billtype = 'HWTG'
  2919. AND w.f_items_status = '4' THEN
  2920. '已调拨'
  2921. END AS fBillstatus
  2922. FROM
  2923. t_warehousebills w
  2924. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2925. LEFT JOIN t_goods g ON g.f_id = w.f_goodsid
  2926. LEFT JOIN t_warehouse t ON t.f_id = w.f_warehouseid
  2927. left join sys_user u on w.create_by = u.user_name
  2928. left join sys_user u1 on w.f_storekeeper = u1.user_name
  2929. left join sys_dept d on w.f_bsdeptid = d.dept_id
  2930. where
  2931. w.f_billtype = #{fBilltype}
  2932. AND w.f_billstatus != 6
  2933. <if test="fItemsStatus == null and timeInterval == null and fMblno == null">
  2934. and IF( w.f_planqty IS NOT NULL, w.f_planqty != w.f_qty, w.f_id != '')
  2935. </if>
  2936. <if test="fCorpid != null and fCorpid != ''">and w.f_corpid = #{fCorpid}</if>
  2937. <if test="fShipper != null and fShipper != ''">and w.f_shipper like concat('%', #{fShipper}, '%')</if>
  2938. <if test="fMblno != null ">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  2939. <if test="fItemsStatus != null ">and w.f_items_status = #{fItemsStatus}</if>
  2940. <if test="fBillstatus != null ">and w.f_billstatus = #{fBillstatus}</if>
  2941. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  2942. and w.f_bsdate &gt;= #{timeInterval[0]}
  2943. </if>
  2944. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  2945. and w.f_bsdate &lt;= #{timeInterval[1]}
  2946. </if>
  2947. <if test="external != null and external != ''">
  2948. and w.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  2949. </if>
  2950. <if test="external == null or external == ''">${params.dataScope}</if>
  2951. order by w.f_id desc
  2952. </select>
  2953. <select id="selectWarehouseItemListById" resultType="java.util.Map">
  2954. SELECT
  2955. t.f_id fId,
  2956. t.f_pid fPid,
  2957. w.f_shipper fShipper,
  2958. c.f_name corpName,
  2959. t.f_bsdate fBsdate,
  2960. g.f_name goodsName,
  2961. t.f_mblno fMblno,
  2962. t.f_warehouse_information fWarehouseInformation,
  2963. t.f_forkliftman fForkliftman,
  2964. t.f_truckno fTruckno,
  2965. t.f_cntrno fCntrno,
  2966. cntr.f_name cntrtypes,
  2967. t.f_cntrtype fCntrtype,
  2968. t.f_qty fQty,
  2969. IFNULL(ROUND(w.f_grossweight/1000,2),0) fGrossweight,
  2970. IFNULL(ROUND(w.f_netweight/1000,2),0) fNetweight,
  2971. t.f_grossweight fGrossweights,
  2972. t.f_cntqty fCntqty,
  2973. fleet.f_name fleetName,
  2974. t.f_driver_name fDriverName,
  2975. t.f_driver_tel fDriverTel,
  2976. CASE
  2977. WHEN t.f_billstatus = '10' THEN
  2978. '计划'
  2979. WHEN t.f_billstatus = '20' THEN
  2980. IF(w.f_billtype = 'SJRK', '待入库', IF(w.f_billtype = 'SJCK','待出库', IF(w.f_billtype = 'CKDB', '待调拨',IF(w.f_billtype = 'HWTG', '待通关', IF(w.f_billtype = 'HQZY', '待转移', '无')))))
  2981. WHEN t.f_billstatus = '30' THEN
  2982. IF(w.f_billtype = 'SJRK', '入库中', IF(w.f_billtype = 'SJCK','出库中', IF(w.f_billtype = 'CKDB', '调拨中',IF(w.f_billtype = 'HWTG', '通关中', IF(w.f_billtype = 'HQZY', '转移中', '无')))))
  2983. WHEN t.f_billstatus = '40' THEN
  2984. IF(w.f_billtype = 'SJRK', '已入库', IF(w.f_billtype = 'SJCK','已出库', IF(w.f_billtype = 'CKDB', '已调拨',IF(w.f_billtype = 'HWTG', '已通关', IF(w.f_billtype = 'HQZY', '已转移', '无')))))
  2985. END fBillstatus
  2986. FROM
  2987. t_warehousebills w
  2988. LEFT JOIN t_warehousebillsitems t ON t.f_pid = w.f_id
  2989. LEFT JOIN t_corps fleet ON fleet.f_id = t.f_fleet
  2990. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  2991. LEFT JOIN t_goods g ON g.f_id = t.f_goodsid
  2992. LEFT JOIN t_cntr cntr ON cntr.f_id = t.f_cntrtype
  2993. where
  2994. t.f_pid = #{fId}
  2995. </select>
  2996. <select id="selectSingleAnalysis" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel">
  2997. SELECT
  2998. DISTINCT
  2999. c.f_name corpName,
  3000. w.f_mblno fMblno,
  3001. w.f_product_name goodsName,
  3002. w.f_emblno fEmblno,
  3003. d.dict_label fBusinessType,
  3004. w.f_cntval fCntval,
  3005. ware.f_warehouse_information fWName,
  3006. dict.dict_label AS fBusinessTypes,
  3007. w.f_marks AS fMarks,
  3008. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB', date_format( item.f_bsdate, '%Y-%m-%d' ), NULL) inBsdate,
  3009. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB' AND ware.f_id = item.f_transfer_warehouselocid, item.f_qty, 0) inQty,
  3010. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB' AND ware.f_id = item.f_transfer_warehouselocid, item.f_grossweight, 0.00) inGrossweight,
  3011. IF(item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY', date_format( item.f_bsdate, '%Y-%m-%d' ), NULL ) outBsdate,
  3012. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY', item.f_qty, 0 ) outQty,
  3013. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY', item.f_grossweight, 0.00 ) outGrossweight,
  3014. CASE
  3015. WHEN item.f_billtype = 'SJRK' THEN
  3016. '入库'
  3017. WHEN item.f_billtype = 'SJCK' THEN
  3018. '出库'
  3019. WHEN item.f_billtype = 'CKDB' and ware.f_charg = 1 THEN
  3020. '调拨'
  3021. WHEN item.f_billtype = 'HQZY' THEN
  3022. '货权转移'
  3023. WHEN item.f_billtype = 'HWTG' THEN
  3024. '货物通关'
  3025. END AS fBilltype,
  3026. (
  3027. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB' AND ware.f_id = item.f_transfer_warehouselocid, item.f_qty, 0)
  3028. -
  3029. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY', item.f_qty, 0 )
  3030. ) AS fQtyblc,
  3031. (
  3032. IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB' AND ware.f_id = item.f_transfer_warehouselocid, item.f_grossweight, 0.00)
  3033. -
  3034. IF( item.f_billtype = 'SJCK' || item.f_billtype = 'HQZY', item.f_grossweight, 0.00 )
  3035. ) AS fGrossweightblc,
  3036. item.f_truckno fTruckno,
  3037. tf.f_billing_days fBillingDays,
  3038. tf.f_amt fAmt,
  3039. item.remark
  3040. FROM
  3041. t_warehousebills w
  3042. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  3043. LEFT JOIN t_warehousebillsfees tf ON item.f_id = tf.src_id
  3044. LEFT JOIN t_corps c ON c.f_id = w.f_corpid
  3045. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  3046. LEFT JOIN sys_dict_data d ON d.dict_value = w.f_business_type
  3047. LEFT JOIN sys_dict_data dict ON dict.dict_value = item.f_business_type
  3048. WHERE
  3049. dict.status = '0' AND
  3050. dict.dict_type = 'storage_type'
  3051. <if test="fCorpid != null and fCorpid != ''">
  3052. and w.f_corpid = #{fCorpid}
  3053. </if>
  3054. <if test="fMblno != null and fMblno != ''">
  3055. AND item.f_mblno = #{fMblno}
  3056. </if>
  3057. AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id != '', w.f_id != '')
  3058. AND IF(item.f_billtype = 'CDZZ', d.dict_type = 'st_out_type',IF( item.f_billtype = 'SJRK', d.dict_type = 'st_in_type', IF(item.f_billtype = 'SJCK', d.dict_type = 'st_out_type', d.dict_type = 'st_trans_type')))
  3059. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  3060. AND item.f_bsdate &gt;= #{bsdateList[0]}
  3061. </if>
  3062. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  3063. AND item.f_bsdate &lt;= #{bsdateList[1]}
  3064. </if>
  3065. <if test="fEmblno != null and fEmblno != ''">
  3066. and w.f_emblno like concat('%', #{fEmblno}, '%')
  3067. </if>
  3068. order by item.f_bsdate asc
  3069. </select>
  3070. <select id="selectSingleAnalysisFees" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel">
  3071. SELECT
  3072. DISTINCT
  3073. f.f_id,
  3074. date_format( f.create_time, '%Y-%m-%d' ) createTime,
  3075. d.dict_label fBusinessType,
  3076. fee.f_name fFeeid,
  3077. f.f_qty fQty,
  3078. f.f_unitprice fUnitprice,
  3079. f.f_amount fAmount,
  3080. CASE
  3081. WHEN f.f_dc = 'D' THEN '收'
  3082. WHEN f.f_dc = 'C' THEN '付'
  3083. END AS fDc,
  3084. tc.f_name as fCName,
  3085. f.remark
  3086. FROM
  3087. t_warehousebills w
  3088. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  3089. LEFT JOIN t_warehousebillsfees f ON f.f_pid = w.f_id
  3090. LEFT JOIN t_corps tc ON tc.f_id = f.f_corpid
  3091. LEFT JOIN t_fees fee ON fee.f_id = f.f_feeid
  3092. LEFT JOIN t_warehouse ware ON IF(item.f_billtype = 'CKDB', ware.f_id = item.f_transfer_warehouselocid, ware.f_id = item.f_warehouselocid)
  3093. LEFT JOIN sys_dict_data d ON d.dict_value = f.f_business_type
  3094. WHERE
  3095. IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id != '', w.f_id != '')
  3096. AND IF(item.f_billtype = 'CDZZ', d.dict_type = 'st_out_type',IF( item.f_billtype = 'SJRK', d.dict_type = 'st_in_type', IF(item.f_billtype = 'SJCK', d.dict_type = 'st_out_type', d.dict_type = 'st_trans_type')))
  3097. <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
  3098. AND item.f_bsdate &gt;= #{bsdateList[0]}
  3099. </if>
  3100. <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
  3101. AND item.f_bsdate &lt;= #{bsdateList[1]}
  3102. </if>
  3103. <if test="fMblno != null and fMblno != ''">
  3104. and item.f_mblno = #{fMblno}
  3105. </if>
  3106. <if test="fEmblno != null and fEmblno != ''">
  3107. and w.f_emblno like concat('%', #{fEmblno}, '%')
  3108. </if>
  3109. order by f.create_time asc
  3110. </select>
  3111. <!--凯和导出清单根据船名航次-->
  3112. <select id="deriveInventory" parameterType="TWarehousebills" resultType="com.ruoyi.shipping.excel.DeriveInventoryExcel">
  3113. SELECT
  3114. @rank:=@rank + 1 AS rankNo,
  3115. a.*
  3116. FROM
  3117. (
  3118. SELECT
  3119. tw.f_mblno AS fMblno, /*提单号*/
  3120. twc.f_cntrno AS fCntrno, /*箱号*/
  3121. twc.f_sealno AS fSealno, /*铅封号*/
  3122. substring(tr.f_no,1,2) AS measure, /*尺寸*/
  3123. substring(tr.f_no,3,2) AS genre, /*类型*/
  3124. twc.f_cntrweight AS fCntrweight, /*重量*/
  3125. CASE
  3126. WHEN tcr.f_soc = '0' THEN tc.f_name
  3127. WHEN tcr.f_soc = '1' THEN '凯和志诚'
  3128. END AS boxCompany,/*箱公司最新*/
  3129. pro.dict_label AS boxCompanyOld, /*箱公司旧*/
  3130. td.f_name AS portOfDeparture, /*始发港*/
  3131. ts.f_name AS destinationPort, /*目的港*/
  3132. tg.f_name AS goodName, /*货名*/
  3133. concat_ws('-', sd.dict_label, tk.dict_label) AS transitClause, /*运输条款*/
  3134. tc.f_name AS bookingCompany, /*订舱公司*/
  3135. tw.f_consigneername AS fConsigneername, /*收货公司名称*/
  3136. tw.f_consigneeattn AS fConsigneeattn, /*收货公司地址*/
  3137. tw.f_consigneetel AS fConsigneetel /*收货公司电话*/
  3138. FROM
  3139. t_warehousebills_cntritems twc
  3140. LEFT JOIN t_warehousebills tw ON twc.f_pid = tw.f_id
  3141. LEFT JOIN t_warehousebills_cntr tcr ON tcr.f_pid = tw.f_id
  3142. LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
  3143. LEFT JOIN t_cntr tr ON tr.f_id = twc.f_cntrid
  3144. LEFT JOIN t_cntrno tro ON tro.f_no = twc.f_cntrno
  3145. LEFT JOIN sys_dict_data pro ON pro.dict_value = tro.f_owner AND pro.dict_type = 'f_owner'
  3146. LEFT JOIN t_address td ON td.f_id = tw.f_loadportid
  3147. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  3148. LEFT JOIN t_goods tg ON tg.f_id = tcr.f_goodsid
  3149. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
  3150. LEFT JOIN sys_dict_data tk ON tk.dict_value = tw.f_serviceitems_new AND tk.dict_type = 'f_serviceitems'
  3151. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  3152. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  3153. <where>
  3154. tw.f_typeid = '1'
  3155. and tw.del_flag = '0'
  3156. <if test="fBillno != null and fBillno != ''">and tw.f_billno = #{fBillno}</if>
  3157. <if test="fCntrid != null ">and tcr.f_cntrid = #{fCntrid}</if>
  3158. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  3159. <if test="fMblno != null and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
  3160. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  3161. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  3162. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  3163. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  3164. #{fConsigneername}, '%')
  3165. </if>
  3166. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  3167. and tw.create_time &gt;= #{cLoadDate[0]}
  3168. </if>
  3169. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  3170. and tw.create_time &lt;= #{cLoadDate[1]}
  3171. </if>
  3172. <if test="fCargoPlanning != null "> and tw.f_cargo_planning = #{fCargoPlanning}</if>
  3173. <if test="fArrivalStatus != null "> and tw.f_arrival_status = #{fArrivalStatus}</if>
  3174. <if test="fId != null">and tw.f_id = #{fId}</if>
  3175. <if test="fCaregoStatus != null and fCaregoStatus != ''">and tw.f_carego_status = #{fCaregoStatus}</if>
  3176. <if test="fCntrno != null and fCntrno != ''">and twc.f_cntrno like concat('%', #{fCntrno}, '%')</if>
  3177. <if test="fCustomsdeclartion != null and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
  3178. #{fCustomsdeclartion}
  3179. </if>
  3180. <if test="fOriginalbillno != null and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
  3181. </if>
  3182. <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
  3183. <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
  3184. <if test="fContacts != null and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
  3185. <if test="fTel != null and fTel != ''">and tw.f_tel = #{fTel}</if>
  3186. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  3187. <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%', #{fShipper}, '%')</if>
  3188. <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
  3189. <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
  3190. <if test="fBscorpno != null and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
  3191. <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
  3192. <if test="fStorekeeper != null and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
  3193. <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
  3194. <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
  3195. <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
  3196. <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
  3197. <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
  3198. <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
  3199. <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
  3200. <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
  3201. <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
  3202. <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
  3203. <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
  3204. <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
  3205. <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
  3206. <if test="fFeetunit != null and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
  3207. <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%',
  3208. #{fMblno}, '%')</if>
  3209. <if test="fMarks != null and fMarks != ''">and tw.f_marks = #{fMarks}</if>
  3210. <if test="fVslvoy != null and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
  3211. <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
  3212. <if test="fCustomno != null and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
  3213. <if test="fIfweigh != null and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
  3214. <if test="fIfpledge != null and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
  3215. <if test="fIfdamage != null and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
  3216. <if test="fBankcorpid != null and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
  3217. <if test="fBilltype != null and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
  3218. <if test="fBillstatus != null and (fBillstatus == 4 or fBillstatus == 6 or fBillstatus == 9 or fBillstatus == 11)">
  3219. and tw.f_billstatus = #{fBillstatus}
  3220. and tw.f_updete_status = 2
  3221. and tw.f_submit_update = 2
  3222. and tw.f_delete_status = 2
  3223. </if>
  3224. <if test="fBillstatus != null and fBillstatus == 10">
  3225. and tw.f_billstatus in ('3','8')
  3226. and tw.f_updete_status in ('2','3')
  3227. and tw.f_submit_update in ('2','3')
  3228. and tw.f_delete_status in ('2','3')
  3229. </if>
  3230. <if test="fBillstatus != null and fBillstatus == 12">
  3231. AND (tw.f_updete_status != 2
  3232. OR tw.f_submit_update != 2
  3233. OR tw.f_delete_status != 2 )
  3234. </if>
  3235. <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
  3236. <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
  3237. <if test="fProductName != null and fProductName != ''">and tw.f_product_name like concat('%',
  3238. #{fProductName}, '%')
  3239. </if>
  3240. <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
  3241. <if test="fTruckno != null and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
  3242. <if test="fDriverName != null and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
  3243. '%')
  3244. </if>
  3245. <if test="fDriverTel != null and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
  3246. <if test="fDriverIdCar != null and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
  3247. <if test="fBusinessType != null and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
  3248. <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
  3249. <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
  3250. <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
  3251. <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
  3252. <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
  3253. <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
  3254. <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
  3255. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  3256. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  3257. <if test="fServiceitems != null and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
  3258. <if test="fInvoceobj != null and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
  3259. <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
  3260. <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
  3261. <if test="fBooksmarks != null and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
  3262. <if test="fShippername != null and fShippername != ''">and tw.f_shippername like concat('%',
  3263. #{fShippername}, '%')
  3264. </if>
  3265. <if test="fShipperattn != null and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
  3266. <if test="fShippertel != null and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
  3267. <if test="fConsigneername != null and fConsigneername != ''">and tw.f_consigneername like concat('%',
  3268. #{fConsigneername}, '%')
  3269. </if>
  3270. <if test="fConsigneeattn != null and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
  3271. <if test="fConsigneetel != null and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
  3272. <if test="fInsurance != null and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
  3273. <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
  3274. <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
  3275. <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
  3276. <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
  3277. <if test="fPaymode != null">and tw.f_paymode = #{fPaymode},</if>
  3278. <if test="fLaneid != null">and tw.f_laneid = #{fLaneid},</if>
  3279. <if test='startTime != null'>
  3280. and tw.create_time &gt;= #{startTime}
  3281. </if>
  3282. <if test='endTime != null'>
  3283. and tw.create_time &lt;= #{endTime}
  3284. </if>
  3285. <if test="fCntrid != null ">and tc.f_cntrid = #{fCntrid}</if>
  3286. <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</if>
  3287. <if test="vslidName != null and vslidName != ''">and tv.f_name like concat('%',
  3288. #{vslidName}, '%')
  3289. </if>
  3290. <if test="voyidName != null and voyidName != ''">and ty.f_no like concat('%',
  3291. #{voyidName}, '%')
  3292. </if>
  3293. <if test="boxNumber != null and boxNumber != ''">and twc.f_cntrno like concat('%',
  3294. #{boxNumber}, '%')
  3295. </if>
  3296. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  3297. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3298. and ty.f_ATD &gt;= #{timeInterval[0]}
  3299. </if>
  3300. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3301. and ty.f_ATD &lt;= #{timeInterval[1]}
  3302. </if>
  3303. <if test="fShipTwo != null "> and tw.f_ship_two = #{fShipTwo}</if>
  3304. <if test="fVoyTwo != null "> and tw.f_voy_two = #{fVoyTwo}</if>
  3305. </where>
  3306. ORDER BY tw.f_mblno,twc.f_cntrno
  3307. )a,
  3308. (SELECT @rank:= 0) b
  3309. </select>
  3310. <!--凯和导出清单根据船名航次-->
  3311. <select id="voyageDetails" parameterType="TWarehousebills" resultType="map">
  3312. SELECT
  3313. @rank:=@rank + 1 AS rankNo,
  3314. a.*
  3315. FROM
  3316. (
  3317. SELECT DISTINCT
  3318. tw.f_id fId,
  3319. tw.f_mblno fMblno,
  3320. ty.f_no voyNo,
  3321. tc.f_no fCntrno,
  3322. tc.f_cntrcount fCntrcount,
  3323. tre.f_name loadportName,
  3324. ts.f_name destportName,
  3325. sd.dict_label fLoadportMode,
  3326. tk.dict_label fDestportMode,
  3327. tc.f_name goodsName,
  3328. date_format(ty.f_ETD, '%Y-%m-%d') fEtd,
  3329. date_format(ty.f_ETA, '%Y-%m-%d') fEta,
  3330. tcp.f_name corpName,
  3331. tw.f_shippername fShippername,
  3332. tw.f_consigneername fConsigneername,
  3333. tw.f_consigneeattn fConsigneeattn,
  3334. tw.f_consigneetel fConsigneetel
  3335. FROM
  3336. t_warehousebills tw
  3337. LEFT JOIN t_corps tcp ON tcp.f_id = tw.f_corpid
  3338. LEFT JOIN t_address tre ON tre.f_id = tw.f_loadportid
  3339. LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
  3340. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
  3341. LEFT JOIN sys_dict_data tk ON tk.dict_value = tw.f_serviceitems_new AND tk.dict_type = 'f_serviceitems'
  3342. <if test="fCntrno != null and fCntrno != ''">
  3343. LEFT JOIN t_warehousebills_cntritems items ON tw.f_id = items.f_pid
  3344. </if>
  3345. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  3346. LEFT JOIN (
  3347. SELECT
  3348. th.f_pid,
  3349. th.f_cntrcount,
  3350. tr.f_no,
  3351. th.f_cntrid,
  3352. tg.f_name
  3353. FROM
  3354. t_warehousebills_cntr th
  3355. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  3356. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  3357. ) tc ON tc.f_pid = tw.f_id
  3358. <where>
  3359. tw.f_typeid = '1'
  3360. and tw.del_flag = '0'
  3361. <if test="fCntrno != null and fCntrno != ''">and items.f_cntrno like concat('%', #{fCntrno}, '%')</if>
  3362. <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
  3363. <if test="fMblno != null and fMblno != ''">and tw.f_mblno like concat('%', #{fMblno}, '%')</if>
  3364. <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
  3365. <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
  3366. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  3367. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  3368. <if test="createBy != null and createBy != ''">and tw.create_by = #{createBy}</if>
  3369. <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
  3370. and tw.create_time &gt;= #{cLoadDate[0]}
  3371. </if>
  3372. <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
  3373. and tw.create_time &lt;= #{cLoadDate[1]}
  3374. </if>
  3375. <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
  3376. and ty.f_ATD &gt;= #{timeInterval[0]}
  3377. </if>
  3378. <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
  3379. and ty.f_ATD &lt;= #{timeInterval[1]}
  3380. </if>
  3381. </where>
  3382. ORDER BY tw.create_time DESC, tw.f_id DESC
  3383. ) a,
  3384. (SELECT @rank:= 0) b
  3385. </select>
  3386. <select id="selectTWarehousebillsByIds" parameterType="String" resultMap="TWarehousebillsResult">
  3387. select f_id,f_vslid, f_voyid,f_arrival_status,f_billno,f_cargo_planning from t_warehousebills
  3388. where f_id in
  3389. <foreach item="fId" collection="array" open="(" separator="," close=")">
  3390. #{fId}
  3391. </foreach>
  3392. </select>
  3393. <update id="updateTWarehousebillsByIds">
  3394. update
  3395. t_warehousebills
  3396. <trim prefix="SET" suffixOverrides=",">
  3397. <if test="fVessel != null">f_vslid = #{fVessel},</if>
  3398. <if test="fVoyage != null">f_voyid = #{fVoyage},</if>
  3399. <if test="fCargoPlanning != null">f_cargo_planning = #{fCargoPlanning},</if>
  3400. <if test="fLoadportid != null">f_loadportid = #{fLoadportid},</if>
  3401. <if test="fDestportid != null">f_destportid = #{fDestportid},</if>
  3402. <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
  3403. </trim>
  3404. where f_id in
  3405. <foreach item="fId" collection="fIds" open="(" separator="," close=")">
  3406. #{fId}
  3407. </foreach>
  3408. </update>
  3409. <!--凯和单航次配船-->
  3410. <select id="singleVoyageByShip" parameterType="TWarehousebills" resultType="com.ruoyi.shipping.excel.SingleVoyageByShipExcel">
  3411. SELECT
  3412. tv.f_name vslName,
  3413. ty.f_no voyNo,
  3414. ty.f_ATD fAtd,
  3415. ty.f_ATA fAta,
  3416. ta.f_name fName,
  3417. tre.f_name loadportName,
  3418. ts.f_name destportName,
  3419. tw.f_vslid fVslid,
  3420. tw.f_voyid fVoyid,
  3421. tw.f_arrival_status fArrivalStatus
  3422. FROM
  3423. t_warehousebills tw
  3424. LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems
  3425. AND sd.dict_type = 'f_serviceitems'
  3426. LEFT JOIN t_vessel tv ON tw.f_vslid = tv.f_id
  3427. LEFT JOIN t_voyage ty ON tw.f_voyid = ty.f_id
  3428. LEFT JOIN t_address ta ON ta.f_id = ty.f_laneid
  3429. LEFT JOIN t_address tre ON tre.f_id = ty.f_portofloadid
  3430. LEFT JOIN t_address ts ON ts.f_id = ty.f_distinationid
  3431. LEFT JOIN t_corps tp ON tw.f_corpid = tp.f_id
  3432. LEFT JOIN (
  3433. SELECT
  3434. th.f_pid,
  3435. th.f_cntrcount,
  3436. tr.f_no,
  3437. th.f_cntrid,
  3438. tg.f_name
  3439. FROM
  3440. t_warehousebills_cntr th
  3441. LEFT JOIN t_cntr tr ON th.f_cntrid = tr.f_id
  3442. LEFT JOIN t_goods tg ON th.f_goodsid = tg.f_id
  3443. ) tc ON tc.f_pid = tw.f_id
  3444. LEFT JOIN (SELECT f_pid,f_billstatus FROM t_warehousebillsfees GROUP BY f_pid,f_billstatus)tf ON tf.f_pid = tw.f_id
  3445. where
  3446. tw.f_typeid = '1'
  3447. and tw.del_flag = '0'
  3448. and tw.f_cargo_planning = '0'
  3449. and tw.f_arrival_status != '2'
  3450. <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
  3451. <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
  3452. GROUP BY tw.f_vslid,tw.f_voyid
  3453. </select>
  3454. <select id="selectByItemId" resultMap="TWarehousebillsResult">
  3455. SELECT
  3456. w.f_id,
  3457. w.f_billno,
  3458. w.is_calculate_storage_fees
  3459. FROM
  3460. t_warehousebills w
  3461. LEFT JOIN t_warehousebillsitems i ON i.f_pid = w.f_id
  3462. where i.f_id = #{id}
  3463. </select>
  3464. <select id="selectByMblnoOrCntrnoCount" resultType="int">
  3465. SELECT COUNT(DISTINCT w.f_id) FROM
  3466. t_warehousebills w
  3467. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  3468. <where>
  3469. w.f_mblno = #{dto.fMblno}
  3470. and w.f_bsdate = #{dto.fBsdate}
  3471. <if test="dto.fCntrno != null ">and item.f_cntrno = #{dto.fCntrno}</if>
  3472. </where>
  3473. </select>
  3474. <select id="selectWhgenlegDetailById" resultMap="WarehousebillsVOResult">
  3475. SELECT w.f_id, w.f_mblno, w.f_bsdate, SUM( item.f_qty ) f_qty, SUM( item.f_grossweight ) f_grossweight,
  3476. SUM( item.f_netweight ) f_netweight, w.f_billtype
  3477. FROM
  3478. t_whgenleg leg
  3479. LEFT JOIN t_warehousebills w ON w.f_corpid = leg.f_corpid
  3480. AND leg.f_trademodeid = w.f_trademodeid
  3481. LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  3482. AND item.f_marks = leg.f_marks
  3483. AND item.f_business_type = leg.f_business_type
  3484. AND item.f_originalbilldate = leg.f_bsdate
  3485. AND item.f_warehouselocid = leg.f_warehouse_locationid
  3486. AND item.f_goodsid = leg.f_goodsid
  3487. WHERE
  3488. leg.f_id = #{id}
  3489. AND w.f_billtype IN ( 'SJRK', 'SJCK' )
  3490. AND item.f_billstatus = 40
  3491. AND IF ( w.f_billtype = 'SJCK', item.f_mblno = leg.f_mblno, leg.f_mblno = w.f_mblno )
  3492. GROUP BY
  3493. w.f_id
  3494. </select>
  3495. <select id="selecStorageFeeList" resultType="Map">
  3496. SELECT DISTINCT w.f_id AS fId, w.f_billno AS fBillno, corp.f_name AS fCorpid, w.f_billing_deadline AS fBillingDeadline, w.remark,
  3497. w.f_billstatus AS fBillstatus, w.create_by AS createBy, w.create_time AS createTime, w.f_fee_status fFeeStatus,
  3498. w.f_trademodeid AS fTrademodeid,dict.dict_label AS fTrademodeName ,w.checklists AS checklists
  3499. FROM t_warehousebills w LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
  3500. LEFT JOIN t_corps corp ON corp.f_id = w.f_corpid
  3501. left join sys_user u on w.create_by = u.user_name
  3502. left join sys_user u1 on w.f_storekeeper = u1.user_name
  3503. left join sys_dept d on w.f_bsdeptid = d.dept_id
  3504. LEFT JOIN sys_dict_data dict ON dict.dict_value = w.f_trademodeid
  3505. <where>
  3506. w.f_billtype = 'JSCCF'
  3507. and w.del_flag = '0'
  3508. and dict.dict_type = 'data_trademodes'
  3509. <if test="fFeeStatus != null and fFeeStatus != ''">and w.f_fee_status = #{fFeeStatus}</if>
  3510. <if test="fBillstatus != null and fBillstatus != ''">and w.f_billstatus = #{fBillstatus}</if>
  3511. <if test="fMarks != null and fMarks != ''">and w.f_marks = #{fMarks}</if>
  3512. <if test="createBy != null and createBy != ''">and w.create_by = #{createBy}</if>
  3513. <if test='timeInterval2 != null and timeInterval2[0] != null and timeInterval2[1]!= ""'>
  3514. and w.f_billing_deadline BETWEEN #{timeInterval2[0]} AND #{timeInterval2[1]}
  3515. </if>
  3516. <if test="fBillno != null and fBillno != ''">and w.f_billno like concat('%', #{fBillno}, '%')</if>
  3517. <if test="fMblno != null and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
  3518. <if test="fCorpid != null and fCorpid != ''">and w.f_corpid = #{fCorpid}</if>
  3519. <if test="fTrademodeid != null and fTrademodeid != ''">and w.f_trademodeid = #{fTrademodeid}</if>
  3520. <if test="checklists != null and checklists != ''">and w.checklists = #{checklists}</if>
  3521. </where>
  3522. ${params.dataScope}
  3523. ORDER BY w.f_bsdate DESC, w.f_bstime DESC,w.f_id DESC,w.f_billstatus
  3524. </select>
  3525. <select id="inAndOutStockList" resultType="map">
  3526. select
  3527. tb.f_mblno as fMblno,
  3528. tg.f_name as goodsName,
  3529. tb.f_marks as fMarks,
  3530. tb.f_bsdate as fBsdate,
  3531. tb.f_planqty as fPlanqty,
  3532. case tb.f_billtype when 'SJRK' then '入库' when 'SJCK' then '出库' end as fBilltype,
  3533. case
  3534. when tb.f_billtype = 'SJRK' and tb.f_items_status = '1' then '计划'
  3535. when tb.f_billtype = 'SJRK' and tb.f_items_status = '2' then '待入库'
  3536. when tb.f_billtype = 'SJRK' and tb.f_items_status = '3' then '入库中'
  3537. when tb.f_billtype = 'SJRK' and tb.f_items_status = '4' then '已入库'
  3538. when tb.f_billtype = 'SJCK' and tb.f_items_status = '1' then '计划'
  3539. when tb.f_billtype = 'SJCK' and tb.f_items_status = '2' then '待出库'
  3540. when tb.f_billtype = 'SJCK' and tb.f_items_status = '3' then '出库中'
  3541. when tb.f_billtype = 'SJCK' and tb.f_items_status = '4' then '已出库'
  3542. end as fBillstatus
  3543. from t_warehousebills tb
  3544. left join t_goods tg on tg.f_id = tb.f_goodsid
  3545. where
  3546. if(tb.f_planqty is not null, tb.f_planqty != tb.f_qty, tb.f_id != '')
  3547. and tb.f_billstatus != 6
  3548. and tb.f_billtype in ('SJRK', 'SJCK')
  3549. <if test="external != null and external != ''">
  3550. and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
  3551. </if>
  3552. order by tb.f_bsdate desc
  3553. </select>
  3554. <select id="getActiveCorpCount" resultType="int">
  3555. select count(fName) from (
  3556. select t1.f_bsdate as fBsdate, t3.f_name as fName
  3557. from t_warehousebillsitems t1
  3558. left join t_warehousebills t2 on t2.f_id = t1.f_pid
  3559. left join t_corps t3 on t3.f_id = t2.f_corpid
  3560. where t1.f_billtype = 'SJRK'
  3561. and t1.f_billstatus = 40
  3562. and t1.del_flag = '0'
  3563. and t2.del_flag = '0'
  3564. group by fName
  3565. ) temp
  3566. <where>
  3567. <if test="beginTime != null and beginTime != ''">and fBsdate &gt;= #{beginTime}</if>
  3568. <if test="endTime != null and endTime != ''">and fBsdate &lt;= #{endTime}</if>
  3569. </where>
  3570. </select>
  3571. <select id="getInactiveCorpList" resultType="com.ruoyi.warehouseBusiness.excel.CorpAnalysis">
  3572. select * from (
  3573. select t1.f_bsdate as fBsdate, t3.f_name as fName
  3574. from t_warehousebillsitems t1
  3575. left join t_warehousebills t2 on t2.f_id = t1.f_pid
  3576. left join t_corps t3 on t3.f_id = t2.f_corpid
  3577. where t1.f_billtype = 'SJRK'
  3578. and t1.f_billstatus = 40
  3579. and t1.del_flag = '0'
  3580. and t2.del_flag = '0'
  3581. group by fName
  3582. ) temp
  3583. <where>
  3584. <if test="beginTime != null and beginTime != ''">and fBsdate &gt;= #{beginTime}</if>
  3585. <if test="endTime != null and endTime != ''">and fBsdate &lt;= #{endTime}</if>
  3586. </where>
  3587. order by fBsdate desc
  3588. </select>
  3589. <select id="selectWareIdAndItemId" parameterType="java.util.Map" resultType="java.util.Map">
  3590. SELECT
  3591. ware.f_id AS fId,
  3592. item.f_id AS itemId,
  3593. item.f_mblno AS fMblno
  3594. FROM
  3595. t_warehousebills ware
  3596. LEFT JOIN t_warehousebillsitems item ON ware.f_id = item.f_pid
  3597. LEFT JOIN t_corps tc ON ware.f_corpid = tc.f_id
  3598. LEFT JOIN t_goods tg ON item.f_goodsid = tg.f_id
  3599. LEFT JOIN sys_dict_data sdd ON item.f_business_type = sdd.dict_value
  3600. WHERE
  3601. ware.del_flag = 0
  3602. AND item.del_flag = 0
  3603. AND sdd.dict_type = 'storage_type'
  3604. AND item.f_billtype = 'SJRK'
  3605. <if test="fCorpid != null ">AND ware.f_corpid = #{fCorpid}</if>
  3606. <if test="fMblno != null and fMblno != ''">AND item.f_mblno = #{fMblno}</if>
  3607. <if test="fOriginalbilldate != null ">AND item.f_originalbilldate = date_format(#{fOriginalbilldate},'%Y-%m-%d')</if>
  3608. <if test="fGoodsid != null ">AND item.f_goodsid = #{fGoodsid}</if>
  3609. <if test="fMarks != null and fMarks != ''">AND item.f_marks = #{fMarks}</if>
  3610. <if test="fBusinessType != null ">AND item.f_business_type = #{fBusinessType}</if>
  3611. </select>
  3612. <select id="selectBYOriginalBillNo" resultMap="TWarehousebillsResult">
  3613. <include refid="selectTWarehousebillsVo"/>
  3614. WHERE
  3615. del_flag = '0'
  3616. and f_billno = #{originalBillNo}
  3617. </select>
  3618. </mapper>