inventoryMission.blade.php 133 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219
  1. @extends('layouts.app')
  2. @section('title')库存盘点-库存管理@endsection
  3. @section('content')
  4. <div class="text-center h5 mt-2" id="loadingPage">
  5. 载入中……
  6. </div>
  7. <div id="list" class="d-none container-fluid" >
  8. <div class="mt-3">
  9. <span class="mt-3" >
  10. @can('库存管理-盘点-完结')
  11. <span><button class="btn btn-sm btn-outline-info" v-if="inventory.status==='复盘中' &&!listMode" @click="完结盘点任务(inventory.id,inventory.owner.name,inventory.type)">完结</button></span>
  12. @endcan
  13. @can('库存管理-盘点-查看')
  14. <button class="btn btn-sm" @click="listMode?listMode=false:listMode=true" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode">切换为列表</button>
  15. @endcan
  16. @can('库存管理-盘点')
  17. <button class="btn btn-sm" @click="listMode?listMode=false:listMode=true" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="listMode&&inventory.status!=='已完成'&&inventory.status!=='已审核'">切换为盘点</button>
  18. @endcan
  19. </span>
  20. @include('inventory.stockInventory._outOnlineModal')
  21. <span class="dropdown">
  22. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  23. :class="[checkData.length>0?'btn-dark text-light':'']"
  24. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  25. 导出Excel
  26. </button>
  27. <div class="dropdown-menu">
  28. <a class="dropdown-item" @click="inventoryAccountMissionExport(false)" href="javascript:">导出勾选内容</a>
  29. <a class="dropdown-item" @click="inventoryAccountMissionExport(true)" href="javascript:">导出所有</a>
  30. </div>
  31. </span>
  32. <span>
  33. <button class="btn btn-sm" @click="盲收()" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode&&!blindReceive">盲收</button>
  34. <button class="btn btn-sm" @click="正常盘点()" :class="blindReceive?'btn-dark':'btn-outline-dark'" v-if="blindReceive">正常盘点</button>
  35. </span>
  36. <span>
  37. <button class="btn btn-outline-dark btn-sm form-control-sm tooltipTarget"
  38. @click="批量跳过或确认差异()" title="勾选指定盘点记录行,进行批量跳过或批量确认差异">
  39. 批量跳过
  40. </button>
  41. </span>
  42. <span>
  43. <button class="btn btn-sm btn-info" @click="新增盘点记录()" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode&&!addInventoryMission">新增盘点记录</button>
  44. <button class="btn btn-sm" @click="收起新增()" :class="addInventoryMission?'btn-dark':'btn-outline-dark'" v-if="addInventoryMission">收起新增</button>
  45. </span>
  46. <button class="btn btn-sm btn-success" @click="outToULine()" v-if="!listMode&&ideLocArr.length>0">出库</button>
  47. <span class="form-group mb-5">
  48. <label class="text-muted">货主:</label><span class="font-weight-bold">@{{ inventory.owner.name }}</span>
  49. </span>
  50. <span class="form-group p-2 mb-5">
  51. <label >盘点单号:</label><span>@{{ inventory.id }}</span>
  52. </span>
  53. <span class="form-group p-2 mb-5">
  54. <label class="text-muted">时间范围:</label><span>@{{ inventory.start_at }} 至 @{{ inventory.end_at }}</span>
  55. </span>
  56. </div>
  57. <div class="mt-3">
  58. <span class="h5">
  59. <span class="form-group mb-5" v-if="inventory.status==='盘点中' || inventory.status==='待盘点'">
  60. <label class=" font-weight-bold">已盘点:</label><span>@{{ inventory.processed }}/总数:@{{ inventory.total }}</span>
  61. </span>
  62. <span class="form-group mb-5" v-if="inventory.status==='盘点中' || inventory.status==='待盘点'">
  63. <label class=" font-weight-bold">剩余数:</label><span>@{{ inventory.surplus }}</span>
  64. </span>
  65. <span class="form-group mb-5" v-if="inventory.status==='复盘中'&&未复盘有差异列">
  66. <label class=" font-weight-bold">有差异未复盘数:</label><span>@{{ 未复盘有差异列.length }}</span>
  67. </span>
  68. <span class="form-group mb-5" v-if="inventory.status==='复盘中'&&未盘列">
  69. <label class=" font-weight-bold">未盘点数:</label><span>@{{ 未盘列.length }}</span>
  70. </span>
  71. <span class="form-group mb-5" v-if="inventory.status==='复盘中'">
  72. <label class=" font-weight-bold">总数:</label><span>@{{ inventory.total }}</span>
  73. </span>
  74. </span>
  75. </div>
  76. <div class="mt-3" >
  77. <span v-if="!listMode" class="btn col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'bg-info':'btn-outline-info disabled'">
  78. @{{ inventory.type }}
  79. </span>
  80. <span v-if="!listMode">
  81. @can('库存管理-盘点-结束初盘')
  82. <span v-if="inventory.status==='盘点中' ||inventory.status=='待盘点'" class="btn col-md-2 font-weight-bold btn-outline-secondary" style="max-width: 160px" @click="stockInventoryEnd(inventory.id)">结束</span>
  83. @endcan
  84. <span v-if="inventory.status==='复盘中'" class="btn col-md-2 font-weight-bold" style="cursor: default;max-width: 160px" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'btn-outline-info disabled':'bg-info'">复盘</span>
  85. </span>
  86. </div>
  87. <div v-if="blindReceive">
  88. <audio src="{{asset('sound/warning_otherBarcode.mp3')}}" controls="controls" preload id="soundWarning" hidden>
  89. </audio>
  90. <audio src="{{asset('sound/ding.mp3')}}" controls="controls" preload id="soundDing" hidden>
  91. </audio>
  92. <div class="row mt-2 mb-2 rounded" style="border:solid 3px #999999;">
  93. <div class="col-12" id="scanColumn">
  94. <div class="card" :class="borderByMode">
  95. <div class="card-body">
  96. <div class="row">
  97. <div class="col-12">
  98. <div >
  99. <div class="text-danger font-weight-bold">
  100. 库位(必填项):
  101. </div>
  102. <input type="text" class="form-control mb-2" v-model="location" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
  103. </div>
  104. <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='regular'">常规:可输入效期,相同条码记录不会合并</p>
  105. <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='increasing'">逐一扫描:处理单一重复商品,每扫一次对应隔口总数量自动递增,扫到不同条码会提示</p>
  106. <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='multiIncreasing'">边扫边分:处理多种商品,自动将扫到的不同条码数量递增到各自隔口号</p>
  107. <ul class="nav nav-tabs mb-4 mt-n3">
  108. <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='regular'?'active':''"
  109. @click="inputMode='regular';changeToManualInputAmount();cleanInputs();inputting.fromIncreasing=false">常规</a></li>
  110. <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='increasing'?'active':''"
  111. @click="inputMode='increasing';changeToScanInputAmount();cleanInputs();inputting.fromIncreasing=true;">逐一扫描</a></li>
  112. <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='multiIncreasing'?'active':''"
  113. @click="inputMode='multiIncreasing';changeToScanInputAmount();cleanInputs();inputting.fromIncreasing=true">边扫边分</a></li>
  114. </ul>
  115. </div>
  116. <div class="col-6">
  117. <div v-if="inputMode=='regular'">
  118. <div class="btn btn-sm btn-outline-primary"
  119. v-if="!isManualInputtingBarcode" @click="changeToManualInputBarcode">手动输入</div>
  120. <div class="btn btn-sm btn-outline-danger"
  121. @click="changeToScanInputBarcode" v-if="isManualInputtingBarcode">扫描输入</div>
  122. </div>
  123. <input type="text" id="barcode" class="form-control" :disabled="status.barcodeDisable" placeholder="扫入条码" @focusin="focusOutDocument" @focusout="focusDocument" v-model="inputting.barcode" autocomplete="off">
  124. <div v-if="inputMode=='regular'">
  125. <div class="card-title">
  126. 生产日期:
  127. </div>
  128. <input type="date" class="form-control mb-2" v-model="inputting.produce_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
  129. </div>
  130. <div v-if="inputMode=='regular'">
  131. <div class="card-title">
  132. 失效日期:
  133. </div>
  134. <input type="date" class="form-control mb-2" v-model="inputting.valid_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
  135. </div>
  136. </div>
  137. <div class="col-6">
  138. <div class="card-title" id="amountLabel">
  139. 手动输入数量:
  140. </div>
  141. <div class="input-group mt-n2 mb-2">
  142. <input type="number" id="amount" class="form-control" placeholder="" :disabled="status.amountDisable"
  143. v-model="inputting.amount" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"
  144. style='height: 40px;font-size: 1.6em;color:blue;font-weight: bolder;padding: 3px;text-align: center'>
  145. </div>
  146. {{-- <div class="card-title">--}}
  147. {{-- 格口号:--}}
  148. {{-- </div>--}}
  149. {{-- <input type="number" id="bin" class="form-control mt-n2 mb-2"--}}
  150. {{-- v-model="inputting.bin"--}}
  151. {{-- :disabled="status.binDisable" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}
  152. {{-- style='height: 80px;font-size: 5em;color:red;font-weight: bolder;padding: 3px;text-align: center'>--}}
  153. <div v-if="inputMode=='regular'">
  154. <div class="card-title">
  155. 批次号:
  156. </div>
  157. <input type="text" class="form-control mb-2" v-model="inputting.batch_number" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
  158. </div>
  159. </div>
  160. <div class="col-12" v-if="commitButtonVisible && inputMode=='regular'" >
  161. <button class="btn btn-success btn form-control" @click="commitGoods">确定</button>
  162. </div>
  163. </div>
  164. <p class="card-text text-muted mt-3 mb-n3 text-center">
  165. 已完成:
  166. </p>
  167. <hr>
  168. <table class="table table-sm table-striped" v-if="goodses.length>0">
  169. <tr>
  170. {{-- <th>隔口号</th>--}}
  171. <th>数量</th>
  172. <th>条码</th>
  173. <th>生产日期</th>
  174. <th>失效日期</th>
  175. <th>批次号</th>
  176. <th>操作</th>
  177. </tr>
  178. <tr v-for="goods in goodses" @click="selectedColor(goods.id,$event)">
  179. {{-- <td>@{{ goods.bin }}</td>--}}
  180. <td>@{{ goods.amount }}</td>
  181. <td>@{{ goods.barcode }}</td>
  182. <td>@{{ goods.produce_date }}</td>
  183. <td>@{{ goods.valid_date }}</td>
  184. <td>@{{ goods.batch_number }}</td>
  185. <td>
  186. <button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button>
  187. </td>
  188. </tr>
  189. </table>
  190. <hr>
  191. <span class="btn btn-outline-dark btn form-control" style="cursor: pointer" @click="submitStockInventory">结束并生成盘点</span>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. <form id="form">
  198. <div v-if="!blindReceive">
  199. <div class="mt-3 form-inline " v-if="!listMode" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'row-cols-3':'row-cols-5'">
  200. <span class="form-group">
  201. <label for="location" class="text-secondary font-weight-bold">请输库位</label>
  202. <input id="locationInput" @keypress="locationPress($event)"
  203. @change="locationChange($event)"
  204. name="location" type="text" class="form-control input" autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
  205. </span>
  206. <span class="form-group ml-4" v-if="addInventoryMission">
  207. <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
  208. <input id="barcodeInput" name="barcode" @keypress="barcodePress($event)"
  209. @change="barcodeChange($event)"
  210. type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control input" autocomplete="off">
  211. </span>
  212. <span class="form-group ml-4" v-if="dataExtraStatus.addingNew&&addInventoryMission" id="countBlock">
  213. <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
  214. <input type="number" id="amountInput" @keypress="amountPress($event)"
  215. name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif" autocomplete="off">
  216. </span>
  217. <span class="btn btn-sm btn-outline-danger ml-4" v-if="inputs().location" style="max-width: 160px" @click="stockInventoryByLocation()">盘点该库位下所有记录</span>
  218. </div>
  219. </div>
  220. <!--相同库位和条码 pc端-->
  221. <div class="row d-none d-xl-block">
  222. <div class="col-12 col-md-12 col-sm-12 showBlueTable d-none">
  223. <table class="table table-sm table-bordered table-info mt-2" :class="!listMode?'':'d-none'" id="blueTablePc">
  224. <tr>
  225. <td class="font-weight-bold">输入盘点数</td>
  226. <td>操作</td>
  227. <td>库位</td>
  228. <td>产品名</td>
  229. <td>产品条码</td>
  230. <td>产品编码</td>
  231. <td>生产日期</td>
  232. <td>失效时期</td>
  233. <td>批号</td>
  234. <th>属性仓</th>
  235. <th>质量状态</th>
  236. <td>盘点数量</td>
  237. <td>复盘数量</td>
  238. <td>复盘差异</td>
  239. </tr>
  240. <tr class="selectingRow" id="blueTrPc">
  241. <td>
  242. <input type="number" onkeypress="listVue.selectingRow(event)" name="amount" class="form-control-sm blueAmountPc" autocomplete="off" oninput="inputs.amount=event.target.value">
  243. </td>
  244. <td>
  245. <span class="btn btn-sm btn-outline-primary stockButtonPc" onclick="listVue.盘点选中任务(event)">选定盘点</span>
  246. </td>
  247. <td class="location"></td>
  248. <td class="commodity_name"></td>
  249. <td class="commodity_barcode"></td>
  250. <td class="commodity_sku"></td>
  251. <td><input type="date" class="form-control-sm produced_at" name="produced_at" onchange="producedAtChange(event)"></td>
  252. <td><input type="date" class="form-control-sm valid_at" name="valid_at" onchange="validAtChange(event)"></td>
  253. <td><input type="text" class="form-control-sm batch_number" name="batch_number" onchange="batchNumberChange(event)"></td>
  254. <td class="erp_type_position"></td>
  255. <td class="quality"></td>
  256. <td class="verified_amount font-weight-bold text-success"></td>
  257. <td class="re_checked_amount"></td>
  258. <td class="difference_amount"></td>
  259. </tr>
  260. </table>
  261. </div>
  262. </div>
  263. <!--相同库位和条码 移动端-->
  264. <div class="showBlueTable d-none">
  265. <table class="table table-striped table-sm table-bordered table-hover p-0 d-xl-none mt-2" style="background: rgb(179, 214, 245);" {{--v-if="!listMode"--}} :class="!listMode?'':'d-none'" id="blueTable">
  266. <tr class="selectingRow移动端" id="blueTr">
  267. <td style="filter:grayscale(30%); ">
  268. <div class="mt-3">
  269. <div>
  270. <span class="mr-3 text-nowrap"><span class="font-weight-bold">输入盘点数:</span>
  271. <span>
  272. <input type="number" onkeypress="listVue.selectingRow(event)" name="amount" class="form-control-sm blueAmount" autocomplete="off" oninput="inputs.amount=event.target.value">
  273. </span>
  274. </span>
  275. <span class="mr-3 text-nowrap"><span class="font-weight-bold">操作:</span><span class="btn btn-sm btn-outline-primary stockButton" onclick="listVue.盘点选中任务(event)">选定盘点</span></span>
  276. </div>
  277. <div style="transform:scale(0.9)" class="pl-0">
  278. <span class="mr-3 text-nowrap"><span class="font-weight-bold">库位:</span><span class="location"></span></span>
  279. <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品名称:</span><span class="commodity_name"></span></span>
  280. <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品条码:</span><span class="commodity_barcode"></span>
  281. </span>
  282. <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品编码:</span><span class="commodity_sku"></span></span>
  283. <span class="mr-3 text-nowrap"><span class="font-weight-bold">生产日期:</span><input type="date" class="form-control-sm produced_at" name="produced_at" onchange="producedAtChange(event)"></span>
  284. <span class="mr-3 text-nowrap"><span class="font-weight-bold">失效时期:</span><input type="date" class="form-control-sm valid_at" name="valid_at" onchange="validAtChange(event)"></span>
  285. <span class="mr-3 text-nowrap"><span class="font-weight-bold">批号:</span><input type="text" class="form-control-sm batch_number" name="batch_number" onchange="batchNumberChange(event)"></span>
  286. <span class="mr-3 text-nowrap"><span>属性仓:</span><span class="erp_type_position"></span></span>
  287. <span class="mr-3 text-nowrap"><span>质量状态:</span><span class="quality"></span></span>
  288. <div>
  289. <span class="mr-3 text-nowrap"><span style="color:#783000">盘点数量:</span><span class="verified_amount font-weight-bold text-success"></span></span>
  290. <span class="mr-3 text-nowrap"><span style="color:#783000">复盘数量:</span><span style="color:#af7651" class="re_checked_amount"></span></span>
  291. <span class="mr-3 text-nowrap"><span style="color:#783000">盘点差异:</span><span class="difference_amount"></span></span>
  292. </div>
  293. </div>
  294. </div>
  295. </td>
  296. </tr>
  297. </table>
  298. </div>
  299. </form>
  300. <div class="card-body pt-1">
  301. <table class="table table-sm table-striped d-none d-xl-block p-0 text-nowrap table-bordered td-min-width-80"
  302. id="table" ref="boxPc">
  303. <tr>
  304. <th>
  305. <label for="all" class="d-none" id="cloneCheckAll">
  306. <input id="all" type="checkbox" @click="checkAll($event)">全选
  307. </label>
  308. </th>
  309. <th class="text-center">序号</th>
  310. <th class="text-center">库位</th>
  311. <th class="text-center">产品名</th>
  312. <th class="text-center">产品条码</th>
  313. <th class="text-center">产品编码</th>
  314. <th class="text-center">生产日期</th>
  315. <th class="text-center">失效日期</th>
  316. <th class="text-center">批号</th>
  317. <th class="text-center">盘点人</th>
  318. <th class="text-center">ERP属性仓</th>
  319. <th class="text-center">质量状态</th>
  320. <th class="text-center">库存数量</th>
  321. <th class="text-center">可用数量</th>
  322. <th class="text-center">盘点数量</th>
  323. <th class="text-center">复盘数量</th>
  324. <th class="text-center">复盘差异</th>
  325. <th class="text-center">分配数量</th>
  326. <th class="text-center">操作</th>
  327. </tr>
  328. <tr v-for="(inventoryMission, i) in 显示记录列" :key="i"
  329. :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':'','opacity': inventoryMission.mark==='确认差异'?'0.7':''}" :class="[
  330. inventoryMission.mark==='已复盘有差异'?'td-cool':'',
  331. inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
  332. inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
  333. inventoryMission.mark==='确认差异'?'td-warm font-weight-bold':'',
  334. inventoryMission.mark==='无差异'?'text-muted':'',
  335. inventoryMission.mark==='未盘'?'td-yellow':'',
  336. inventoryMission.mark==='跳过'?'text-muted':'',
  337. ]">
  338. <td>
  339. <input type="checkbox" :value="inventoryMission" v-model="checkData">
  340. <span :id="'lockLine'+(i+1)"></span>
  341. </td>
  342. <td><span>@{{ i+1 }}</span></td>
  343. <td><span>@{{ inventoryMission.location }}</span></td>
  344. <td >
  345. <span v-if="inventoryMission.commodity">
  346. <span
  347. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.commodity.name }}</span>
  348. </span>
  349. </td>
  350. <td>
  351. <span
  352. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
  353. <span
  354. v-if="inventoryMission.commodity_barcodes && inventoryMission.commodity_barcodes.length>0">
  355. <span v-if="inventoryMission.commodity_barcodes.length==1">
  356. @{{ inventoryMission.commodity_barcodes[0].code }}
  357. </span>
  358. <span v-if="inventoryMission.commodity_barcodes.length>1">
  359. <small
  360. v-for="barcode in inventoryMission.commodity_barcodes">@{{ barcode.code }}<br></small>
  361. </span>
  362. </span>
  363. </span>
  364. </td>
  365. <td >
  366. <span v-if="inventoryMission.commodity">
  367. <span
  368. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.commodity.sku }}</span>
  369. </span>
  370. </td>
  371. <td><span
  372. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.produced_at }}</span>
  373. </td>
  374. <td><span
  375. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.valid_at }}</span>
  376. </td>
  377. <td class="text-muted"><span
  378. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.batch_number }}</span>
  379. </td>
  380. <td v-if="inventoryMission.stockInventoryPersons" class="text-muted"
  381. :rowspan="inventoryMission.is_multi_row?2:''">
  382. <span
  383. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
  384. <a href="#" v-if="inventoryMission.stockInventoryPersons.length>0" class="dropdown-toggle"
  385. data-toggle="dropdown">
  386. @{{ inventoryMission.stockInventoryPersons[0].mark }}<b class="caret"></b>
  387. </a>
  388. <div
  389. style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto"
  390. class="small mt-0 dropdown-menu">
  391. <table class="table table-sm table-striped table-bordered">
  392. <tr>
  393. <th>盘点人</th>
  394. <th>时间</th>
  395. </tr>
  396. <tr v-for="stockInventoryPerson in inventoryMission.stockInventoryPersons">
  397. <td>@{{ stockInventoryPerson.mark }}</td>
  398. <td>@{{ stockInventoryPerson.created_at }}</td>
  399. </tr>
  400. </table>
  401. </div>
  402. </span>
  403. </td>
  404. <td><span
  405. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.erp_type_position }}</span>
  406. </td>
  407. <td><span
  408. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
  409. <span v-if="listMode">@{{ inventoryMission.quality }}</span>
  410. <select v-else class="form-control-sm" name="quality" id="quality"
  411. v-model="inventoryMission.quality"
  412. @change="updateQuality(inventoryMission.id,inventoryMission.location,inventoryMission.commodity.sku,inventoryMission.quality,inventory.owner.code)">
  413. <option value="正品">正品</option>
  414. <option value="残次">残次</option>
  415. </select>
  416. </span>
  417. </td>
  418. <td><span
  419. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.stored_amount }}</span>
  420. </td>
  421. <td><span
  422. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.valid_amount }}</span>
  423. </td>
  424. <td><span
  425. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.verified_amount }}
  426. <span v-if="inventoryMission.checked==='跳过'" class="badge badge-pill badge-secondary">跳过</span></span>
  427. </td>
  428. <td><span
  429. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.re_checked_amount }}</span>
  430. </td>
  431. <td><span
  432. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.difference_amount }}</span>
  433. </td>
  434. <td><span
  435. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.occupied_amount }}</span>
  436. </td>
  437. @can('库存管理-盘点')
  438. <td>
  439. {{-- <span class="btn btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>--}}
  440. <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'"
  441. @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
  442. <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.mark==='已复盘有差异'||inventoryMission.mark==='未复盘有差异'"
  443. @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
  444. <span class="btn btn-sm btn-outline-secondary"
  445. v-if="inventory.type=='动盘'&& inventoryMission.mark=='未盘' &&!listMode"
  446. @click="选中盘点起始位置(inventoryMission.id,inventoryMission.location)">以此为起点</span>
  447. </td>
  448. @endcan
  449. </tr>
  450. </table>
  451. </div>
  452. <!--盘点记录移动端-->
  453. <table id="listOnPad" class="table table-striped table-sm table-bordered table-hover p-0 d-table d-xl-none"
  454. style="background: rgb(255, 255, 255);" ref="box">
  455. <tbody>
  456. <tr {{--v-for="(inventoryMission,i) in 显示记录列"--}} v-for="(inventoryMission, i) in 显示记录列" :key="i"
  457. :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':'','opacity': inventoryMission.mark==='确认差异'?'0.7':''}"
  458. :class="[
  459. inventoryMission.mark==='已复盘有差异'?'td-cool':'',
  460. inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
  461. inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
  462. inventoryMission.mark==='确认差异'?'td-warm font-weight-bold':'',
  463. inventoryMission.mark==='无差异'?'text-muted':'',
  464. inventoryMission.mark==='未盘'?'td-yellow':'',
  465. inventoryMission.mark==='跳过'?'text-muted':'',
  466. ]">
  467. <td style="filter:grayscale(30%); ">
  468. <span :id="'lockLinePhone'+(i+1)"></span>
  469. <div class="mt-3">
  470. <div style="transform:scale(0.9)" class="pl-0">
  471. <span type="hidden">@{{ i+1 }}</span>
  472. <span class="mr-3 text-nowrap"><span class="font-weight-bold">库位:</span><span
  473. style="color:#af7651">
  474. @{{ inventoryMission.location }}</span></span>
  475. <span class="mr-3 text-nowrap"
  476. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode"><span
  477. class="font-weight-bold">产品名称:</span><span style="color:#af7651"
  478. v-if="inventoryMission.commodity">
  479. @{{ inventoryMission.commodity.name }}</span></span>
  480. <span class="mr-3 text-nowrap"
  481. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
  482. <span class="font-weight-bold">质量状态:</span>
  483. <span v-if="listMode">@{{ inventoryMission.quality }}</span>
  484. <select v-else class="form-control-sm" name="quality" id="quality"
  485. v-model="inventoryMission.quality"
  486. @change="updateQuality(inventoryMission.id,inventoryMission.location,inventoryMission.commodity.sku,inventoryMission.quality,inventory.owner.code)">
  487. <option value="正品">正品</option>
  488. <option value="残次">残次</option>
  489. </select>
  490. </span>
  491. <span class="mr-3 text-nowrap"
  492. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
  493. <span class="font-weight-bold">产品条码:</span>
  494. <span
  495. v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
  496. <span
  497. v-if="inventoryMission.commodity_barcodes && inventoryMission.commodity_barcodes.length>0">
  498. <span v-if="inventoryMission.commodity_barcodes.length==1">
  499. @{{ inventoryMission.commodity_barcodes[0].code }}
  500. </span>
  501. <span v-if="inventoryMission.commodity_barcodes.length>1">
  502. <small
  503. v-for="barcode in inventoryMission.commodity_barcodes">@{{ barcode.code }}<br></small>
  504. </span>
  505. </span>
  506. </span>
  507. </span>
  508. <div v-if="inventory.status==='复盘中'">
  509. <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点数量:</span><span
  510. style="color:#af7651">
  511. @{{ inventoryMission.verified_amount }}</span></span>
  512. <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">复盘数量:</span><span
  513. style="color:#af7651">
  514. @{{ inventoryMission.re_checked_amount }}</span></span>
  515. <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点差异:</span><span>
  516. @{{ inventoryMission.difference_amount }}</span></span>
  517. </div>
  518. @can('库存管理-盘点')
  519. <div>
  520. <span class="mr-3 text-nowrap" v-if="!listMode"><span
  521. class="font-weight-bold">操作:</span>
  522. {{-- <span class="btn btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>--}}
  523. <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'"
  524. @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
  525. <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.mark==='已复盘有差异'||inventoryMission.mark==='未复盘有差异'"
  526. @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
  527. <span class="btn btn-sm btn-outline-secondary"
  528. v-if="inventory.type=='动盘'&& inventoryMission.mark=='未盘' &&!listMode"
  529. @click="选中盘点起始位置(inventoryMission.id,inventoryMission.location)">以此为起点</span>
  530. </span>
  531. </div>
  532. @endcan
  533. </div>
  534. </div>
  535. </td>
  536. </tr>
  537. </tbody>
  538. </table>
  539. <!--上次盘点记录-->
  540. <div class="modal" id="lastStockInventoryRecord" tabindex="-1" role="dialog">
  541. <div class="modal-dialog modal-xl">
  542. <div class="modal-content">
  543. <div class="modal-header">
  544. <h5 class="modal-title font-weight-bold">该盘点记录已存在,是否覆盖之前记录?</h5>
  545. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  546. <span aria-hidden="true">&times;</span>
  547. </button>
  548. </div>
  549. <div class="modal-body">
  550. <table class="table table-sm table-striped table-bordered">
  551. <tr class="text-muted text-center">
  552. <th>库位</th>
  553. <th>产品条码</th>
  554. <th>盘点人</th>
  555. <th>盘点数量</th>
  556. <th>产品名</th>
  557. <th>产品编号</th>
  558. <th>属性仓</th>
  559. <th>质量状态</th>
  560. <th>库存数量</th>
  561. <th>盘点差异</th>
  562. <th>时间</th>
  563. </tr>
  564. <tr class="text-center ">
  565. <td>@{{ lastStockInventoryRecord.location }}</td>
  566. <td><span v-if="lastStockInventoryRecord.commodity">@{{ lastStockInventoryRecord.commodity.barcode }}</span></td>
  567. <td><span v-if="stockInventoryPersons.length>0">@{{ stockInventoryPersons[stockInventoryPersons.length-1].mark }}</span></td>
  568. <td>@{{ lastStockInventoryRecord.verified_amount }}</td>
  569. <td><span v-if="lastStockInventoryRecord.commodity">@{{ lastStockInventoryRecord.commodity_name }}</span></td>
  570. <td><span v-if="lastStockInventoryRecord.commodity">@{{ lastStockInventoryRecord.commodity.sku }}</span>
  571. </td>
  572. <td>@{{ lastStockInventoryRecord.erp_type_position }}</td>
  573. <td>@{{ lastStockInventoryRecord.quality }}</td>
  574. <td>@{{ lastStockInventoryRecord.stored_amount }}</td>
  575. <td>@{{ lastStockInventoryRecord.difference_amount }}</td>
  576. <td><span v-if="stockInventoryPersons.length>0">@{{ stockInventoryPersons[stockInventoryPersons.length-1].created_at }}</span>
  577. </td>
  578. </tr>
  579. </table>
  580. </div>
  581. <div class="modal-footer">
  582. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  583. <span aria-hidden="true" class="btn btn-outline-secondary" @click="不覆盖()">否</span>
  584. </button>
  585. <button type="button" class="btn btn-primary" data-dismiss="modal" @click="覆盖()">是</button>
  586. </div>
  587. </div>
  588. </div>
  589. </div>
  590. </div>
  591. @endsection
  592. @section('lastScript')
  593. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  594. <script>
  595. let hideHeaderTitle = function () {
  596. let $listOnPad = $('#listOnPad');
  597. let $headerRoll = $('#headerRoll');
  598. if ($listOnPad.css('display') !== 'none') {
  599. $headerRoll.attr('hidden', true)
  600. } else {
  601. $headerRoll.attr('hidden', false)
  602. $headerRoll.find('tr').css('width', $(document).width());
  603. }
  604. };
  605. window.onresize = hideHeaderTitle;
  606. window.onscroll = hideHeaderTitle;
  607. let $showBlueTable=null;
  608. let $barcodeInput=null;
  609. let $locationInput=null;
  610. let $amountInput=null;
  611. let $prototype_ = null;
  612. let $blueTable = null;
  613. let $prototypePc_ = null;
  614. let $blueTablePc = null;
  615. let inputs={location:'',barcode:'',amount:'',produced_at:'',valid_at:'',batch_number:''};//双向绑定在本页太慢,所以用外部变量
  616. let $appointInventoryList=[];
  617. let $jqueryTable=[];
  618. function producedAtChange(e){
  619. inputs.produced_at = e.target.value;
  620. }
  621. function validAtChange(e){
  622. inputs.valid_at = e.target.value;
  623. }
  624. function batchNumberChange(e){
  625. inputs.batch_number = e.target.value;
  626. }
  627. let listVue = new Vue({
  628. el: "#list",
  629. data: {
  630. selectingId:'',
  631. dataExtraStatus:{addingNew:false, displayingLastCounting:false,showBlueTable:false},
  632. inventory:{!! $inventoryAccount!!},
  633. inventoryMissions : [
  634. @foreach($inventoryAccountMissions as $inventoryMission)
  635. {
  636. id: '{{$inventoryMission->id}}',
  637. location: '{{$inventoryMission->location}}',
  638. created_at: '{{$inventoryMission->created_at}}',
  639. commodity_name: '{{$inventoryMission->commodity ? $inventoryMission->commodity->name : ''}}',
  640. commodity_sku: '{{$inventoryMission->commodity ? $inventoryMission->commodity->sku : ''}}',
  641. commodity_barcode: '{{$inventoryMission->commodity ? $inventoryMission->commodity->barcode : ''}}',
  642. commodity:{!! $inventoryMission->commodity ?? null !!},
  643. stockInventoryPersons:{!! $inventoryMission->stockInventoryPersons !!},
  644. commodity_barcodes: [
  645. @foreach($inventoryMission->commodity ? $inventoryMission->commodity->barcodes ?? [] : [] as $barcode)
  646. {code: '{{$barcode->code}}'},
  647. @endforeach
  648. ],
  649. stock_persons: [
  650. @foreach($inventoryMission->stockInventoryPersons ? $inventoryMission->stockInventoryPersons ?? [] : [] as $person)
  651. {name: '{{$person->mark}}'},
  652. @endforeach
  653. ],
  654. produced_at: '{{$inventoryMission->produced_at}}',
  655. valid_at: '{{$inventoryMission->valid_at}}',
  656. verified_amount: '{{$inventoryMission->verified_amount}}',
  657. stored_amount: '{{$inventoryMission->stored_amount}}',
  658. valid_amount: '{{$inventoryMission->valid_amount}}',
  659. stored_at: '{{$inventoryMission->stored_at}}',
  660. batch_number: '{{$inventoryMission->batch_number}}',
  661. erp_type_position: '{{$inventoryMission->erp_type_position}}',
  662. quality: '{{$inventoryMission->quality}}',
  663. difference_amount: '{{$inventoryMission->difference_amount}}',
  664. occupied_amount: '{{$inventoryMission->occupied_amount}}',
  665. checked: '{{$inventoryMission->checked}}',
  666. returned: '{{$inventoryMission->returned}}',
  667. re_checked_amount: '{{$inventoryMission->re_checked_amount}}'
  668. },
  669. @endforeach
  670. ],
  671. 库位盘点记录:[],
  672. 条码索引_记录: {},
  673. 库位索引_记录: {},
  674. selectedStyle:'',
  675. 指定盘点记录列:[],
  676. checkData: [],
  677. lastStockInventoryRecord:{},
  678. stockInventoryPersons:[],
  679. inventoryAccountMissions:[],
  680. listMode:false,
  681. blindReceive:false,
  682. addInventoryMission:false,
  683. 分割位置id:null,
  684. 显示记录列:[],
  685. focusing:'document',
  686. commitButtonVisible:false,
  687. isManualInputtingBarcode:false,
  688. isManualInputtingAmount:true,
  689. lastScannedBarcode:'',
  690. inputMode:'regular',
  691. location:'',
  692. inputting:{
  693. barcode:'',amount:'',bin:'',produce_date:'',valid_date:'',batch_number:'',fromIncreasing:false
  694. },
  695. status:{
  696. scanEndInputted:false,binDisable:false,barcodeDisable:true,amountDisable:false,
  697. },
  698. goodses:[],
  699. selectTr:'',
  700. materialBoxCodes:'',
  701. outOnLineAmount:'',
  702. ideLocArr:[],
  703. errors:{},
  704. },
  705. beforeMount: function () {
  706. this.重排序并标记全列表类型();
  707. this.加载下方数据并置空上方数据()//初始化先调用一次
  708. },
  709. watch: {
  710. checkData: {
  711. handler() {
  712. if (this.checkData.length === this.inventoryMissions.length) {
  713. document.querySelector('#all').checked = true;
  714. } else {
  715. document.querySelector('#all').checked = false;
  716. }
  717. },
  718. deep: true
  719. }
  720. },
  721. destroyed() {
  722. window.removeEventListener('scroll', this.lazy)
  723. },
  724. updated: function () {
  725. $barcodeInput=$('#barcodeInput');
  726. $locationInput=$('#locationInput');
  727. $amountInput=$('#amountInput');
  728. },
  729. mounted: function () {
  730. let _this = this;
  731. _this.lazy();
  732. $('#cloneCheckAll').removeClass('d-none')
  733. window.addEventListener('scroll', this.lazy);
  734. (function 显示渲染后页面(){
  735. $('#loadingPage').remove();
  736. $('#list').removeClass('d-none');
  737. })()
  738. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  739. $barcodeInput=$('#barcodeInput');
  740. $locationInput=$('#locationInput');
  741. $amountInput=$('#amountInput');
  742. $showBlueTable=$('.showBlueTable');
  743. $prototype_ = $('#blueTr');
  744. $blueTable = $('#blueTable');
  745. $prototypePc_ = $('#blueTrPc');
  746. $blueTablePc = $('#blueTablePc');
  747. this.放置焦点光标至正确位置();
  748. (function 初始化列表模式() {
  749. let listMode = getGetVal('listMode')
  750. if (listMode === 'true') {
  751. _this.listMode = true;
  752. return;
  753. }
  754. _this.listMode = false;
  755. })();
  756. _this.建立记录索引();
  757. //将库位含有ide的料想存入数组
  758. _this.未盘列.forEach(function (inventoryMission){
  759. if (inventoryMission.location.indexOf('IDE')>-1){
  760. _this.ideLocArr.push(inventoryMission.location)
  761. }
  762. });
  763. },
  764. methods:{
  765. outToULine(){
  766. this.ideLocArr=this.unique(this.ideLocArr);
  767. $("#change-outOnLineAmount").modal('show');
  768. },
  769. //根据输入数量 截取库位 出库
  770. outToULineEnsure(){
  771. let _this=this;
  772. let error = {};
  773. if (_this.outOnLineAmount>_this.ideLocArr.length)error.outOnLineAmount = ["出库料箱数大于当前任务料想总数"];
  774. if (JSON.stringify(error)!=='{}'){this.errors = error;return;}
  775. if(!confirm('确定要将当前盘点任务涉及的IDE料箱号出至输送线吗?')){return;}
  776. let selectedArr = _this.ideLocArr.slice(0,_this.outOnLineAmount);
  777. _this.materialBoxCodes='';
  778. selectedArr.forEach(function (item){
  779. _this.materialBoxCodes += item + ','
  780. });
  781. if (_this.materialBoxCodes.length > 0) {
  782. _this.materialBoxCodes = _this.materialBoxCodes.substr(0,_this.materialBoxCodes.length - 1);
  783. }
  784. let text=_this.materialBoxCodes;
  785. if(!text){
  786. alert('当前盘点任务未查询到IDE料箱号!')
  787. return;
  788. }
  789. let url = '{{url('inventory/stockInventory/outToLineUpdateInventoryMissions')}}';
  790. window.axios.post(url,{inventory:_this.inventory,location:text})
  791. .then(res=>{
  792. if (res.data.success){
  793. $("#change-outOnLineAmount").modal('hide');
  794. _this.outOnLineAmount='';
  795. _this.dispatchHaiq(text);
  796. }else {
  797. window.tempTip.setDuration(2000);
  798. window.tempTip.show(res.data.data);
  799. }
  800. }).catch(err=>{
  801. window.tempTip.setDuration(2000);
  802. window.tempTip.show("网络错误:"+err);
  803. })
  804. },
  805. dispatchHaiq(text){
  806. axios.post('{{url('/api/thirdPart/haiq/storage/takeOutToULine')}}',{codes:text})
  807. .then(function(response){
  808. tempTip.okWindow(response.data.result,'确定')
  809. window.location.reload();
  810. }).catch(function(err){
  811. tempTip.okWindow(err,'确定')
  812. window.location.reload();
  813. })
  814. },
  815. checkAll(e) {
  816. if (e.target.checked) {
  817. this.inventoryMissions.forEach((el,i)=>{
  818. if (this.checkData.indexOf(el) == '-1'){
  819. this.checkData.push(el);
  820. }
  821. });
  822. } else {
  823. this.checkData = [];
  824. }
  825. },
  826. selectedColor(id,e){
  827. $('#headerParent tr[class=focusing]').removeClass('focusing')
  828. if (id==this.selectTr){
  829. this.selectTr='';
  830. return;
  831. }
  832. this.selectTr=id;
  833. $(e.target).parent('tr').addClass('focusing')
  834. },
  835. lazy(){
  836. let _this=this;
  837. let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;//滚动条距离顶部的高度
  838. let scrollHeight = $(document).height();//当前页面的总高度
  839. let clientHeight=window.innerHeight;//当前可视的页面高度
  840. let count = parseFloat(clientHeight) + parseFloat(scrollTop);//浏览器底部位置
  841. if (scrollHeight - count < 40) {
  842. if (_this.显示记录列.length < _this.inventoryMissions.length) {
  843. _this.加载下方数据并置空上方数据()
  844. }
  845. }
  846. },
  847. 加载下方数据并置空上方数据(){
  848. let _this=this;
  849. const count = _this.显示记录列.length;
  850. if (count > 30) {
  851. _this.inventoryMissions.map((inventoryMission, index) => {
  852. if (_this.显示记录列.length < 5 + count) {
  853. if (_this.显示记录列.length < _this.inventoryMissions.length) {
  854. _this.显示记录列.push(_this.inventoryMissions[_this.显示记录列.length]);
  855. }
  856. }
  857. })
  858. } else {
  859. _this.inventoryMissions.map((inventoryMission, index) => {
  860. if (_this.显示记录列.length < 25 + count) {
  861. if (_this.显示记录列.length < _this.inventoryMissions.length) {
  862. _this.显示记录列.push(_this.inventoryMissions[_this.显示记录列.length])
  863. }
  864. }
  865. })
  866. }
  867. },
  868. cloneBlueTrDom($appointInventoryList) {
  869. for(let i =0;i<$appointInventoryList.length;i++){
  870. let newDom= $prototype_.clone();
  871. newDom.find('.location').text($appointInventoryList[i].location);
  872. newDom.find('.commodity_name').text($appointInventoryList[i].commodity_name);
  873. newDom.find('.commodity_barcode').text($appointInventoryList[i].commodity_barcode);
  874. newDom.find('.commodity_sku').text($appointInventoryList[i].commodity_sku);
  875. newDom.find('.produced_at').val($appointInventoryList[i].produced_at.substr(0,10));
  876. newDom.find('.valid_at').val($appointInventoryList[i].valid_at.substr(0,10));
  877. newDom.find('.batch_number').val($appointInventoryList[i].batch_number);
  878. newDom.find('.erp_type_position').text($appointInventoryList[i].erp_type_position);
  879. newDom.find('.quality').text($appointInventoryList[i].quality);
  880. newDom.find('.verified_amount').text($appointInventoryList[i].verified_amount);
  881. newDom.find('.re_checked_amount').text($appointInventoryList[i].re_checked_amount);
  882. newDom.find('.difference_amount').text($appointInventoryList[i].difference_amount);
  883. newDom.show();
  884. newDom.find('.blueAmount').attr('data_id', $appointInventoryList[i].id);
  885. newDom.find('.blueAmount').attr('stored_amount', $appointInventoryList[i].stored_amount);
  886. newDom.find('.stockButton').attr('data_id', $appointInventoryList[i].id);
  887. newDom.addClass('blueTr'+i);
  888. newDom.appendTo($blueTable);
  889. $jqueryTable.push(newDom);
  890. }
  891. $prototype_.hide();
  892. },
  893. cloneBlueTrPcDom($appointInventoryList) {
  894. for(let i =0;i<$appointInventoryList.length;i++){
  895. let newDom= $prototypePc_.clone();
  896. newDom.find('.location').text($appointInventoryList[i].location);
  897. newDom.find('.commodity_name').text($appointInventoryList[i].commodity_name);
  898. newDom.find('.commodity_barcode').text($appointInventoryList[i].commodity_barcode);
  899. newDom.find('.commodity_sku').text($appointInventoryList[i].commodity_sku);
  900. newDom.find('.produced_at').val($appointInventoryList[i].produced_at.substr(0,10));
  901. newDom.find('.valid_at').val($appointInventoryList[i].valid_at.substr(0,10));
  902. newDom.find('.batch_number').val($appointInventoryList[i].batch_number);
  903. newDom.find('.erp_type_position').text($appointInventoryList[i].erp_type_position);
  904. newDom.find('.quality').text($appointInventoryList[i].quality);
  905. newDom.find('.verified_amount').text($appointInventoryList[i].verified_amount);
  906. newDom.find('.re_checked_amount').text($appointInventoryList[i].re_checked_amount);
  907. newDom.find('.difference_amount').text($appointInventoryList[i].difference_amount);
  908. newDom.show();
  909. newDom.find('.blueAmountPc').attr('data_id', $appointInventoryList[i].id);
  910. newDom.find('.blueAmountPc').attr('stored_amount', $appointInventoryList[i].stored_amount);
  911. newDom.find('.stockButtonPc').attr('data_id', $appointInventoryList[i].id);
  912. newDom.addClass('blueTrPc'+i);
  913. newDom.appendTo($blueTablePc);
  914. $jqueryTable.push(newDom);
  915. }
  916. $prototypePc_.hide();
  917. },
  918. inputs() {
  919. return inputs;
  920. },
  921. barcodePress(e){
  922. if(e.key==='Enter') {
  923. this.barcodeChange(e);
  924. }
  925. },
  926. barcodeChange(e){
  927. this.inputs().barcode = e.target.value;
  928. this.提交部分输入();
  929. },
  930. amountPress(e){
  931. if(e.key==='Enter'){
  932. this.提交新增(e);
  933. }
  934. },
  935. locationPress(e){
  936. if(e.key==='Enter'){
  937. this.locationChange(e);
  938. }
  939. },
  940. locationChange(e){
  941. this.inputs().location = e.target.value;
  942. this.提交部分输入();
  943. if(!this.addInventoryMission){
  944. this.location=this.inputs().location ;
  945. this.$forceUpdate()
  946. }
  947. },
  948. 提交部分输入:_.throttle(function(){
  949. let _this = this;
  950. this.放置焦点光标至正确位置();
  951. _this.显示盘点计数input_按情况();
  952. (new Promise(function (resolve, reject) {
  953. resolve()
  954. })).then(function () {
  955. if(_this.addInventoryMission){
  956. _this.提交库位和条码();
  957. }else{
  958. _this.提交库位();
  959. }
  960. _this.显示盘点计数input_按情况();
  961. })
  962. },100,{trailing:false}),
  963. 提交新增:_.throttle(function(e){
  964. this.inputs().amount=e.target.value;
  965. this.提交新增并盘点();
  966. },100,{trailing:false}),
  967. selectingRow(e){
  968. let _this=this;
  969. let id = $(e.target).attr('data_id');
  970. _this.selectingId=id;
  971. if(e.key==='Enter'){
  972. _this.提交盘点();
  973. }
  974. },
  975. 提交库位和条码:_.throttle(async function(){
  976. let _this=this;
  977. this.清空指定盘点记录列();
  978. if (!_this.inputs().barcode) return;
  979. if(!(await this.is条码存在于WMS(_this.inputs().barcode))){
  980. tempTip.setDuration(2000);
  981. tempTip.show('输入的商品条码没有对应的商品!');
  982. }
  983. this.筛选出记录(_this.inputs().location,_this.inputs().barcode);
  984. },100,{ 'trailing': false }),
  985. 提交库位:_.throttle(async function(){
  986. let _this=this;
  987. this.清空指定盘点记录列();
  988. this.筛选库位出记录(_this.inputs().location);
  989. },100,{ 'trailing': false }),
  990. 建立记录索引(){
  991. let _this=this;
  992. _this.inventoryMissions.forEach(function (inventoryMission) {
  993. inventoryMission.commodity_barcodes.forEach(function (barcode) {
  994. if(!Array.isArray(_this.条码索引_记录[barcode.code])) _this.条码索引_记录[barcode.code]=[];
  995. _this.条码索引_记录[barcode.code].push(inventoryMission);
  996. })
  997. if(!Array.isArray(_this.库位索引_记录[inventoryMission.location])) _this.库位索引_记录[inventoryMission.location]=[];
  998. _this.库位索引_记录[inventoryMission.location].push(inventoryMission);
  999. });
  1000. },
  1001. 清空指定盘点记录列(){
  1002. let _this=this;
  1003. $jqueryTable.forEach(function (newDom,i) {
  1004. newDom.remove();
  1005. })
  1006. $appointInventoryList=[];
  1007. $showBlueTable.attr('class','d-none');
  1008. _this.selectingId='';
  1009. _this.location='';
  1010. _this.库位盘点记录=[];
  1011. },
  1012. 显示盘点计数input_按情况(){
  1013. let _this=this;
  1014. setTimeout(function(){
  1015. if($appointInventoryList.length>0){
  1016. _this.dataExtraStatus.addingNew=false;
  1017. }else{
  1018. _this.dataExtraStatus.addingNew=true;
  1019. }
  1020. },10)
  1021. },
  1022. async 筛选出记录(库位, 条码){
  1023. 条码=条码.trim();
  1024. 库位=库位.trim();
  1025. let _this=this;
  1026. if(!库位)return false;
  1027. if(!条码)return false;;
  1028. if (!_this.库位索引_记录[库位]
  1029. ||(!_this.条码索引_记录[条码]
  1030. &&!(await _this.is条码存在于WMS(条码)))
  1031. ) return;
  1032. if(Array.isArray(_this.条码索引_记录[条码])){
  1033. _this.条码索引_记录[条码].forEach(function(inventoryMission){
  1034. if (inventoryMission.location===库位){
  1035. $appointInventoryList.push(inventoryMission);
  1036. $appointInventoryList=_this.unique($appointInventoryList);
  1037. }
  1038. });
  1039. $showBlueTable.removeClass('d-none');
  1040. _this.cloneBlueTrDom($appointInventoryList);
  1041. _this.cloneBlueTrPcDom($appointInventoryList);
  1042. }
  1043. },
  1044. async 筛选库位出记录(库位){
  1045. 库位=库位.trim();
  1046. let _this=this;
  1047. if(!库位)return false;
  1048. if (!_this.库位索引_记录[库位]) return;
  1049. if(Array.isArray(_this.库位索引_记录[库位])){
  1050. _this.库位索引_记录[库位].forEach(function(inventoryMission){
  1051. if (inventoryMission.location===库位){
  1052. $appointInventoryList.push(inventoryMission);
  1053. if ((!inventoryMission.verified_amount ||inventoryMission.verified_amount==0))$appointInventoryList.unshift(inventoryMission);
  1054. $appointInventoryList=_this.unique($appointInventoryList);
  1055. }
  1056. });
  1057. $showBlueTable.removeClass('d-none');
  1058. _this.cloneBlueTrDom($appointInventoryList);
  1059. _this.cloneBlueTrPcDom($appointInventoryList);
  1060. }
  1061. },
  1062. unique(arr){
  1063. return Array.from(new Set(arr));
  1064. },
  1065. 放置焦点光标至正确位置:_.throttle(function(){
  1066. let _this=this;
  1067. _this.显示盘点计数input_按情况();
  1068. if (!$locationInput.val().trim()){
  1069. $locationInput.focus();
  1070. return;
  1071. }
  1072. if (_this.addInventoryMission){
  1073. if (!$barcodeInput.val().trim()){
  1074. $barcodeInput.focus();
  1075. return;
  1076. }
  1077. }
  1078. setTimeout(function(){
  1079. if(_this.dataExtraStatus.addingNew){
  1080. let $count = $('#amountInput');
  1081. if (!$count.val().trim()){
  1082. $count.focus();
  1083. return;
  1084. }
  1085. }
  1086. if ($appointInventoryList.length >0) {
  1087. $blueTablePc.find('.blueTrPc0 input').first().focus();
  1088. $blueTable.find('.blueTr0 input').first().focus();
  1089. }
  1090. },10)
  1091. },100,{ 'trailing': false }),
  1092. async is条码存在于WMS(条码){
  1093. 条码=条码.trim();
  1094. let _this=this;
  1095. if (!条码) return false;
  1096. if (_this.条码索引_记录[条码]) return true;
  1097. if (_this.条码索引_记录[条码] === false) return false;
  1098. let url = '{{url('inventory/stockInventory/searchCommodityByBarcode')}}';
  1099. let is成功 = false;
  1100. await axios.post(url, {
  1101. barcode: 条码,
  1102. owner_code: _this.inventory.owner.code
  1103. }).then(function (response) {
  1104. if (response.data.success) {
  1105. is成功 = true;
  1106. _this.条码索引_记录[条码] = {barcodeExsitingAtWMS: true};
  1107. } else {
  1108. _this.条码索引_记录[条码] = false;
  1109. }
  1110. }).catch(function (err) {
  1111. tempTip.setDuration(2000);
  1112. tempTip.show('网络错误' + err);
  1113. });
  1114. return is成功;
  1115. },
  1116. is条码存在于当前记录(条码) {
  1117. 条码 = 条码.trim();
  1118. let _this = this;
  1119. if (!条码) return false;
  1120. return !!_this.条码索引_记录[条码];
  1121. },
  1122. is库位存在于当前记录(库位) {
  1123. 库位 = 库位.trim();
  1124. let _this = this;
  1125. if (!库位) return false;
  1126. return !!_this.库位索引_记录[库位];
  1127. },
  1128. 提交新增并盘点:async function(){
  1129. let _this=this;
  1130. let inventoryId=_this.inventory.id;
  1131. if(!_this.inputs().location.trim()|| !_this.inputs().barcode.trim() || !_this.inputs().amount.trim())return false;
  1132. let 条码存在于当前记录 = _this.is条码存在于当前记录(_this.inputs().barcode);
  1133. let 条码存在于WMS = await _this.is条码存在于WMS(_this.inputs().barcode);
  1134. let 库位存在于当前记录 = _this.is库位存在于当前记录(_this.inputs().location);
  1135. if(!条码存在于当前记录 && !条码存在于WMS)return false;
  1136. if(库位存在于当前记录 && 条码存在于当前记录)return false;
  1137. if(!confirm('该'+_this.inputs().barcode+'条码和'+_this.inputs().location+'库位相加的条件于WAS系统盘点记录中不存在! 是否确定需要添加至系统盘点记录中?')){return false};
  1138. let 新增字段标记='';
  1139. if(!库位存在于当前记录&&!条码存在于当前记录)新增字段标记='库位和商品新增';
  1140. if(!库位存在于当前记录)新增字段标记='库位新增';
  1141. if(!条码存在于当前记录)新增字段标记='商品新增';
  1142. _this.增加系统之外的盘点记录(_this.inputs().location,_this.inputs().barcode,_this.inputs().amount,inventoryId,_this.inventory.owner.code,新增字段标记);
  1143. return true;
  1144. },
  1145. 提交盘点:_.throttle(function(){
  1146. let _this=this;
  1147. let 条码=_this.inputs().barcode.trim();
  1148. let 库位=_this.inputs().location.trim();
  1149. let 盘点数=_this.inputs().amount.trim();
  1150. let 选定盘点记录id=_this.selectingId;
  1151. let isInventory=false;
  1152. $appointInventoryList.forEach(function (inventoryMission) {
  1153. if (inventoryMission.location === 库位) {
  1154. if (inventoryMission.stockInventoryPersons.length > 0 && inventoryMission.id === _this.selectingId) {
  1155. _this.lastStockInventoryRecord = inventoryMission;
  1156. _this.stockInventoryPersons = inventoryMission.stockInventoryPersons;
  1157. if (_this.inventory.status !== '复盘中'){
  1158. $("#lastStockInventoryRecord").modal('show');
  1159. isInventory=true;
  1160. return;
  1161. }
  1162. }
  1163. }
  1164. });
  1165. if (!isInventory){
  1166. _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
  1167. _this.清空指定盘点记录列();
  1168. }
  1169. },100,{ 'trailing': false }),
  1170. //结束初盘任务
  1171. stockInventoryEnd(id) {
  1172. let _this = this;
  1173. let url = '{{url('inventory/stockInventoryEnd')}}';
  1174. if (!confirm('确定要结束初盘任务,进入复盘吗?')) {return;}
  1175. axios.post(url, {id: id}).then(function (response) {
  1176. if (!response.data.success) {
  1177. tempTip.setDuration(2000);
  1178. tempTip.show('结束初盘失败!' + ' ' + response.data.data);
  1179. } else {
  1180. _this.inventory.status = response.data.data;
  1181. tempTip.setDuration(2000);
  1182. tempTip.showSuccess('结束初盘,进入复盘!');
  1183. }
  1184. }).catch(function (err) {
  1185. tempTip.setDuration(2000);
  1186. tempTip.show('结束初盘失败!' + '网络错误' + err);
  1187. })
  1188. },
  1189. updateQuality(id, location, sku, quality, ownerCode) {
  1190. let url = '{{url('inventory/修改质量状态')}}';
  1191. axios.post(url, {
  1192. id: id,
  1193. location: location,
  1194. sku: sku,
  1195. quality: quality,
  1196. ownerCode: ownerCode
  1197. }).then(function (response) {
  1198. if (!response.data.success) {
  1199. tempTip.setDuration(3000);
  1200. tempTip.show('修改质量状态失败!' + ' ' + response.data.data);
  1201. } else {
  1202. tempTip.setDuration(2000);
  1203. tempTip.showSuccess('修改质量状态成功!');
  1204. }
  1205. }).catch(function (err) {
  1206. tempTip.setDuration(2000);
  1207. tempTip.show('修改质量状态失败!' + '网络错误' + err);
  1208. })
  1209. },
  1210. 重排序并标记全列表类型() {
  1211. let _this = this;
  1212. _this.已复盘有差异列 = [];
  1213. _this.未复盘有差异列 = [];
  1214. _this.已复盘无差异列 = [];
  1215. _this.确认差异列=[];
  1216. _this.无差异列 = [];
  1217. _this.未盘列 = [];
  1218. _this.跳过列 = [];
  1219. _this.未盘列总 = [];
  1220. _this.未盘列1 = [];
  1221. _this.未盘列2 = [];
  1222. _this.inventoryMissions.forEach(function (mission, i) {
  1223. switch (mission.checked) {
  1224. case '已复核':
  1225. if (parseInt(mission.difference_amount)) {
  1226. _this.已复盘有差异列.push(mission);
  1227. mission.mark = '已复盘有差异';
  1228. return;
  1229. }
  1230. _this.已复盘无差异列.push(mission);
  1231. mission.mark = '已复盘无差异';
  1232. return;
  1233. case '是':
  1234. if (parseInt(mission.difference_amount)) {
  1235. _this.未复盘有差异列.push(mission);
  1236. mission.mark = '未复盘有差异';
  1237. return;
  1238. }
  1239. _this.无差异列.push(mission);
  1240. mission.mark = '无差异';
  1241. return;
  1242. case '确认差异':
  1243. _this.确认差异列.push(mission);
  1244. mission.mark = '确认差异';
  1245. return;
  1246. case '否':
  1247. _this.未盘列.push(mission);
  1248. mission.mark = '未盘';
  1249. return;
  1250. case '跳过':
  1251. _this.跳过列.push(mission);
  1252. mission.mark = '跳过';
  1253. return;
  1254. }
  1255. });
  1256. _this.已复盘有差异列 = _this.按库位排序_且合并SKU一起(_this.已复盘有差异列);
  1257. _this.未复盘有差异列 = _this.按库位排序_且合并SKU一起(_this.未复盘有差异列);
  1258. _this.已复盘无差异列 = _this.按库位排序_且合并SKU一起(_this.已复盘无差异列);
  1259. _this.无差异列 = _this.按库位排序_且合并SKU一起(_this.无差异列);
  1260. _this.未盘列 = _this.按库位排序_且合并SKU一起(_this.未盘列);
  1261. if (_this.未盘列.length>0&&!_this.分割位置id) _this.分割位置id = _this.未盘列[0].id;
  1262. _this.分割位置id = _this.更新分割位置(_this.未盘分隔列2, _this.分割位置id);
  1263. _this.未盘分隔列 = _this.分隔_基于分割位置(_this.未盘列, _this.分割位置id);
  1264. _this.未盘分隔列1 = _this.按库位排序_且合并SKU一起(_this.未盘分隔列[0]);
  1265. _this.未盘分隔列2 = _this.按库位排序_且合并SKU一起(_this.未盘分隔列[1]);
  1266. _this.确认差异列 = _this.按库位排序_且合并SKU一起(_this.确认差异列);
  1267. _this.跳过列 = _this.按库位排序_且合并SKU一起(_this.跳过列);
  1268. _this.inventoryMissions = [];
  1269. _this.重推入(_this.inventoryMissions, _this.已复盘有差异列);
  1270. _this.重推入(_this.inventoryMissions, _this.未复盘有差异列);
  1271. _this.重推入(_this.inventoryMissions, _this.未盘分隔列2);
  1272. _this.重推入(_this.inventoryMissions, _this.未盘分隔列1);
  1273. _this.重推入(_this.inventoryMissions, _this.确认差异列);
  1274. _this.重推入(_this.inventoryMissions, _this.已复盘无差异列);
  1275. _this.重推入(_this.inventoryMissions, _this.无差异列);
  1276. _this.重推入(_this.inventoryMissions, _this.跳过列);
  1277. },
  1278. 更新分割位置(上次分割列, 旧分割位置id) {
  1279. if (!上次分割列) return 旧分割位置id;
  1280. let is不更新 = false;
  1281. 上次分割列.some(function (行) {
  1282. if (行.id === 旧分割位置id && 行.mark === '未盘') {
  1283. is不更新 = true;
  1284. return true;
  1285. }
  1286. });
  1287. if (is不更新) return 旧分割位置id;
  1288. let 新分割位置id = 旧分割位置id;
  1289. 上次分割列.some(function (行) {
  1290. if (行.mark !== '未盘') return false;
  1291. 新分割位置id = 行.id;
  1292. return true;
  1293. });
  1294. return 新分割位置id;
  1295. },
  1296. 重推入(目标数组, 推入数组) {
  1297. 推入数组.forEach(function (元素) {
  1298. 目标数组.push(元素);
  1299. })
  1300. },
  1301. 按库位排序_且合并SKU一起(inventoryMissions) {
  1302. let 结果列 = [];
  1303. let 已出现字典列 = [];
  1304. inventoryMissions.sort(function (a, b) {
  1305. if (a.location > b.location) return 1;
  1306. if (a.location < b.location) return -1;
  1307. return 0;
  1308. });
  1309. function 迭代查重转移(目标列, 进度下标) {
  1310. if (!进度下标) {
  1311. 进度下标 = 0;
  1312. }
  1313. for (; 进度下标 < 目标列.length; 进度下标++) {
  1314. let 目标 = 目标列[进度下标];
  1315. if (已出现字典列[目标.commodity.barcode] === true) {
  1316. 目标列.splice(进度下标, 1)
  1317. let 最后一次重复下标 = -1;//为了给相同条码依次排序设定
  1318. 结果列.some(function (结果, i) {
  1319. if (结果.commodity.barcode === 目标.commodity.barcode) {
  1320. 最后一次重复下标 = i;
  1321. if (最后一次重复下标 === 结果列.length - 1) {
  1322. 结果列.splice(最后一次重复下标 + 1, 0, 目标);
  1323. return true;
  1324. }
  1325. } else if (最后一次重复下标 > -1) {
  1326. 结果列.splice(最后一次重复下标 + 1, 0, 目标);
  1327. return true;
  1328. }
  1329. return false;
  1330. })
  1331. 迭代查重转移(目标列, 进度下标);
  1332. return;
  1333. }
  1334. 已出现字典列[目标.commodity.barcode] = true;
  1335. 结果列.push(目标);
  1336. }
  1337. }
  1338. 迭代查重转移(inventoryMissions)
  1339. return 结果列;
  1340. },
  1341. 选中盘点起始位置(id,location) {
  1342. this.分割位置id = id;
  1343. this.重排序并标记全列表类型();
  1344. tempTip.setDuration(2000);
  1345. tempTip.showSuccess('已将库位:' + location + '的盘点记录设置为起始盘点记录');
  1346. },
  1347. 分隔_基于分割位置(未盘列,分割位置id) { // return [arr1,arr2]
  1348. let 分割位置=null;
  1349. 未盘列.forEach(function(行,下标){
  1350. if(行.id===分割位置id){
  1351. 分割位置=下标;
  1352. }
  1353. });
  1354. let 未盘列1=未盘列.slice(0,分割位置);
  1355. let 未盘列2=未盘列.slice(分割位置,未盘列.length);
  1356. return [未盘列1,未盘列2];
  1357. },
  1358. 删除盘点记录(inventoryAccountMissionId, inventoryAccountId, name) {
  1359. let _this = this;
  1360. if (!confirm('确定要删除商品为:“' + name + '”的盘点记录吗?')) {
  1361. return
  1362. }
  1363. ;
  1364. let url = '{{url('inventory/删除盘点记录')}}';
  1365. axios.post(url, {
  1366. inventoryAccountMissionId: inventoryAccountMissionId,
  1367. inventoryAccountId: inventoryAccountId
  1368. }).then(
  1369. function (response) {
  1370. if (!response.data.success) {
  1371. tempTip.setDuration(2000);
  1372. tempTip.show('盘点单号:' + inventoryAccountMissionId + '删除失败!' + response.data.data);
  1373. } else {
  1374. _this.inventoryMissions.every(function (inventoryAccountMission, i) {
  1375. if (response.data.data > 0 && inventoryAccountMission.id === inventoryAccountMissionId) {
  1376. _this.inventoryMissions.splice(i, 1);
  1377. return false;
  1378. }
  1379. return true
  1380. });
  1381. tempTip.setDuration(2000);
  1382. tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '删除成功!');
  1383. }
  1384. }).catch(function (err) {
  1385. tempTip.setDuration(3000);
  1386. tempTip.show('删除失败,网络链接错误!' + err);
  1387. });
  1388. },
  1389. 跳过盘点记录(inventoryAccountMissionId, inventoryAccountId, name) {
  1390. let _this = this;
  1391. if (!confirm('确定要跳过商品为:“' + name + '”的盘点记录吗?')) {return ;}
  1392. let url = '{{url('inventory/跳过盘点记录')}}';
  1393. axios.post(url, {
  1394. inventoryAccountMissionId: inventoryAccountMissionId,
  1395. inventoryAccountId: inventoryAccountId
  1396. }).then(
  1397. function (response) {
  1398. if (!response.data.success) {
  1399. tempTip.setDuration(3000);
  1400. tempTip.show('盘点单号:' + inventoryAccountMissionId + '跳过盘点失败!' + response.data.data);
  1401. } else {
  1402. _this.inventoryMissions.every(function (inventoryAccountMission) {
  1403. if (inventoryAccountMission.id === inventoryAccountMissionId) {
  1404. inventoryAccountMission.checked = response.data.inventoryAccountMission.checked;
  1405. return false;
  1406. }
  1407. return true
  1408. });
  1409. }
  1410. _this.重排序并显示();
  1411. tempTip.setDuration(3000);
  1412. tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '跳过盘点成功!');
  1413. }).catch(function (err) {
  1414. tempTip.setDuration(3000);
  1415. tempTip.show('跳过盘点记录失败,网络链接错误!' + err);
  1416. });
  1417. },
  1418. 确认盘点差异(inventoryAccountMissionId, inventoryAccountId, name) {
  1419. let _this = this;
  1420. if (!confirm('确定提交商品为:“' + name + '”的盘点差异吗?')) {return ;}
  1421. let url = '{{url('inventory/确认盘点差异')}}';
  1422. axios.post(url, {
  1423. inventoryAccountMissionId: inventoryAccountMissionId,
  1424. inventoryAccountId: inventoryAccountId
  1425. }).then(
  1426. function (response) {
  1427. if (!response.data.success) {
  1428. tempTip.setDuration(3000);
  1429. tempTip.show('盘点单号:' + inventoryAccountMissionId + '提交盘点差异失败!' + response.data.data);
  1430. } else {
  1431. _this.inventoryMissions.every(function (inventoryAccountMission) {
  1432. if (inventoryAccountMission.id === inventoryAccountMissionId) {
  1433. inventoryAccountMission.checked = response.data.inventoryAccountMission.checked;
  1434. return false;
  1435. }
  1436. return true
  1437. });
  1438. }
  1439. _this.重排序并显示();
  1440. tempTip.setDuration(3000);
  1441. tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '提交盘点差异成功!');
  1442. }).catch(function (err) {
  1443. tempTip.setDuration(3000);
  1444. tempTip.show('提交盘点差异记录失败,网络链接错误!' + err);
  1445. });
  1446. },
  1447. 批量跳过或确认差异(){
  1448. let _this = this;
  1449. if (!confirm('确定对勾选内容进行批量操作吗?')) {return ;}
  1450. let url = '{{url('inventory/批量跳过或确认差异')}}';
  1451. axios.post(url, {checkData: _this.checkData}).then(
  1452. function (response) {
  1453. if (!response.data.success) {
  1454. tempTip.setDuration(3000);
  1455. tempTip.show('批量操作失败!' + response.data.data);
  1456. } else {
  1457. response.data.inventoryAccountMissions.forEach(function (mission) {
  1458. _this.库位索引_记录[mission.location].forEach(function(missionInIndex){
  1459. if(parseInt(missionInIndex.id)===parseInt(mission.id)){
  1460. missionInIndex.checked=mission.checked;
  1461. }
  1462. });
  1463. });
  1464. }
  1465. _this.重排序并显示();
  1466. _this.清空checkbox();
  1467. tempTip.setDuration(3000);
  1468. tempTip.showSuccess('批量操作成功!');
  1469. }).catch(function (err) {
  1470. tempTip.setDuration(3000);
  1471. tempTip.show('批量操作失败,网络链接错误!' + err);
  1472. });
  1473. },
  1474. 重排序并显示(){
  1475. let _this=this;
  1476. _this.显示记录列=[];
  1477. _this.重排序并标记全列表类型(_this.inventoryMissions);
  1478. _this.加载下方数据并置空上方数据();
  1479. },
  1480. 完结盘点任务(id, owner_name, type) {
  1481. if (!confirm('确定完结货主为:“' + owner_name + '”的“' + type + '”任务吗?')) {
  1482. return;
  1483. }
  1484. let url = '{{url('inventory/完结盘点任务')}}/' + id;
  1485. axios.get(url).then(function (response) {
  1486. if (!response.data.success) {
  1487. tempTip.setDuration(3000);
  1488. tempTip.show('修改完结状态失败!');
  1489. } else {
  1490. if (response.data.data.id === id) {
  1491. tempTip.setDuration(3000);
  1492. tempTip.showSuccess('货主为:“' + owner_name + '”的“' + type + '”任务完结成功');
  1493. window.setTimeout(function () {
  1494. window.location.href = '{{url('inventory/stockInventory/mission')}}';
  1495. }, 1000);
  1496. }
  1497. }
  1498. }).catch(function (err) {
  1499. tempTip.setDuration(3000);
  1500. tempTip.show('修改完结状态失败! ' + err);
  1501. })
  1502. },
  1503. 增加系统之外的盘点记录(location, barcode, count, inventoryId, owner_code, param) {
  1504. let _this = this;
  1505. let url = '{{url('inventory/增加系统之外的盘点记录')}}';
  1506. axios.post(url, {location:location,barcode:barcode,count:count,inventoryId:inventoryId,owner_code:owner_code,param:param}).then(
  1507. function (response) {
  1508. if (!response.data.success) {
  1509. tempTip.setDuration(3000);
  1510. tempTip.show('增加系统之外的盘点记录失败!');
  1511. } else {
  1512. let inventoryAccountMission=response.data.inventoryAccountMission;
  1513. inventoryAccountMission.commodity_barcodes = response.data.inventoryAccountMission.commodity.barcodes;
  1514. inventoryAccountMission.commodity_name = response.data.inventoryAccountMission.commodity.name;
  1515. inventoryAccountMission.stockInventoryPersons = response.data.stockInventoryPersons;
  1516. inventoryAccountMission.produced_at = '';
  1517. inventoryAccountMission.valid_at = '';
  1518. _this.inventoryMissions.push(inventoryAccountMission);
  1519. inventoryAccountMission.commodity_barcodes.forEach(function(barcode){
  1520. if(!Array.isArray(_this.条码索引_记录[barcode.code])) _this.条码索引_记录[barcode.code]=[];
  1521. _this.条码索引_记录[barcode.code].push(inventoryAccountMission);
  1522. });
  1523. if(!Array.isArray(_this.库位索引_记录[location])) _this.库位索引_记录[location]=[];
  1524. _this.库位索引_记录[location].push(inventoryAccountMission);
  1525. _this.重排序并显示();
  1526. _this.清空inputs();
  1527. tempTip.setDuration(3000);
  1528. tempTip.showSuccess('增加系统之外的盘点记录成功!');
  1529. }
  1530. }
  1531. ).catch(function (err) {
  1532. tempTip.setDuration(3000);
  1533. tempTip.show('增加系统之外的盘点记录失败,网络链接错误!' + err);
  1534. });
  1535. },
  1536. 将相邻同样条目总数匹配的标记_供样式使用(inventoryMissions) {
  1537. for (let i = 0; i < inventoryMissions.length; i++) {
  1538. let 相同条码组 = [];
  1539. function 抽出紧邻相同条码(起始下标) {
  1540. let 下标B = 起始下标 + 1;
  1541. if (下标B >= inventoryMissions.length) return;
  1542. if (inventoryMissions[起始下标].commodity.barcode === inventoryMissions[下标B].commodity.barcode) {
  1543. if (相同条码组.length <= 1 || 相同条码组[相同条码组.length - 1].id !== inventoryMissions[起始下标].id) {
  1544. 相同条码组.push(inventoryMissions[起始下标]);
  1545. }
  1546. 相同条码组.push(inventoryMissions[下标B]);
  1547. return 抽出紧邻相同条码(下标B);
  1548. }
  1549. return 下标B;
  1550. }
  1551. i = 抽出紧邻相同条码(i);
  1552. let 库存总数 = 0;
  1553. let 实盘总数 = 0;
  1554. 相同条码组.forEach(function (目标) {
  1555. 库存总数 += 目标.stored_amount;
  1556. 实盘总数 += 目标.verified_amount;
  1557. })
  1558. if (库存总数 === 实盘总数)
  1559. 相同条码组.forEach(function (目标) {
  1560. 目标.hasLinkingGroup = true;
  1561. })
  1562. }
  1563. ;
  1564. },
  1565. 清理标记(mission) {
  1566. mission.hasLinkingGroup = false;
  1567. },
  1568. 盘点(id, location, barcode, inventoryId, count) {
  1569. let _this = this;
  1570. let url = '{{url('inventory/stockInventory')}}';
  1571. axios.post(url, {id:id,location:location,barcode:barcode,count:count,inventoryId:inventoryId})
  1572. .then(function (response) {
  1573. if (!response.data.success) {
  1574. tempTip.setDuration(2000);
  1575. tempTip.show('盘点失败!' + ' ' + response.data.data);
  1576. return;
  1577. }
  1578. if (_this.inventory.id === response.data.inventory.id) {
  1579. _this.inventory.processed = response.data.inventory.processed;
  1580. _this.inventory.surplus = response.data.inventory.surplus;
  1581. _this.inventory.check_surplus = response.data.inventory.check_surplus;
  1582. }
  1583. _this.inventoryMissions.every(function (inventoryMission, i) {
  1584. if (parseInt(inventoryMission.id) === parseInt(response.data.inventoryMission.id)) {
  1585. inventoryMission.checked = response.data.inventoryMission.checked;
  1586. inventoryMission.verified_amount = response.data.inventoryMission.verified_amount;
  1587. inventoryMission.difference_amount = response.data.inventoryMission.difference_amount;
  1588. inventoryMission.re_checked_amount = response.data.inventoryMission.re_checked_amount;
  1589. inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
  1590. _this.inventoryMissions.splice(i, 1)
  1591. _this.inventoryMissions.unshift(inventoryMission);
  1592. return false;
  1593. }
  1594. return true;
  1595. });
  1596. _this.重排序并显示();
  1597. if (response.data.inventoryMission.difference_amount!=0){_this.初盘有盘点差异_确认是否重盘();}
  1598. if (response.data.inventoryMission.difference_amount==0){
  1599. _this.清空inputs();
  1600. tempTip.setDuration(3000);
  1601. tempTip.showSuccess('盘点成功!');
  1602. _this.放置焦点光标至正确位置();
  1603. }
  1604. }).catch(function (err) {
  1605. tempTip.setDuration(2000);
  1606. tempTip.show('盘点失败!' + '网络错误' + err);
  1607. })
  1608. },
  1609. 初盘有盘点差异_确认是否重盘(){
  1610. let _this=this;
  1611. tempTip.confirm('<p class="text-danger">'+"当前盘点数量存在差异,是否重盘当前盘点记录?"+'</p>',function () {
  1612. _this.放置焦点光标至正确位置();
  1613. _this.提交库位和条码();
  1614. },
  1615. function () {
  1616. _this.清空inputs();
  1617. _this.放置焦点光标至正确位置();
  1618. tempTip.setDuration(3000);
  1619. tempTip.showSuccess('盘点成功!');
  1620. },'是','否')
  1621. },
  1622. 清空inputs(){
  1623. $locationInput.val('');
  1624. $barcodeInput.val('');
  1625. $amountInput.val('');
  1626. for(let key in this.inputs()){
  1627. this.inputs()[key]='';
  1628. }
  1629. },
  1630. 清空checkbox(){
  1631. this.checkData=[];
  1632. },
  1633. 不覆盖() {
  1634. let _this = this;
  1635. _this.清空指定盘点记录列();
  1636. _this.清空inputs();
  1637. },
  1638. 覆盖(){
  1639. let _this=this;
  1640. let location=_this.inputs().location.trim();
  1641. let barcode=_this.inputs().barcode.trim();
  1642. let inventoryId=_this.inventory.id;
  1643. let count=_this.inputs().amount.trim();
  1644. let id=_this.selectingId;
  1645. _this.清空指定盘点记录列();
  1646. this.盘点(id, location, barcode, inventoryId, count);
  1647. },
  1648. 盘点选中任务(e){
  1649. let _this=this;
  1650. let id = $(e.target).attr('data_id');
  1651. let inventoryId=_this.inventory.id;
  1652. let count=_this.inputs().amount.trim();
  1653. let produced_at=_this.inputs().produced_at.trim();
  1654. let valid_at=_this.inputs().valid_at.trim();
  1655. let batch_number=_this.inputs().batch_number.trim();
  1656. let url = '{{url('inventory/盘点选中任务')}}';
  1657. axios.post(url, {id:id,count:count,inventoryId:inventoryId,produced_at:produced_at,valid_at:valid_at,batch_number:batch_number}).then(function (response) {
  1658. if (!response.data.success) {
  1659. tempTip.setDuration(2000);
  1660. tempTip.show('盘点失败!' + ' ' + response.data.data);
  1661. return;
  1662. }else {
  1663. if (_this.inventory.id === response.data.inventory.id) {
  1664. _this.inventory.processed = response.data.inventory.processed;
  1665. _this.inventory.surplus = response.data.inventory.surplus;
  1666. _this.inventory.check_surplus = response.data.inventory.check_surplus;
  1667. }
  1668. if (response.data.inventoryMission.length >1) {
  1669. response.data.inventoryMission.forEach(function (mission) {
  1670. let isToEdit=false;
  1671. let commodity_barcodes=mission.commodity_barcodes;
  1672. _this.库位索引_记录[_this.inputs().location.trim()].every(function (inventoryMission){
  1673. if (parseInt(inventoryMission.id) === parseInt(mission.id)){
  1674. isToEdit=true;
  1675. inventoryMission.checked = mission.checked;
  1676. inventoryMission.verified_amount = mission.verified_amount;
  1677. inventoryMission.difference_amount =mission.difference_amount;
  1678. inventoryMission.re_checked_amount = mission.re_checked_amount;
  1679. inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
  1680. return false;
  1681. }
  1682. return true;
  1683. })
  1684. if (!isToEdit){
  1685. mission.commodity_barcodes= commodity_barcodes;
  1686. mission.stockInventoryPersons=response.data.stockInventoryPersons;
  1687. _this.inventoryMissions.push(mission);
  1688. }
  1689. });
  1690. }else {
  1691. _this.库位索引_记录[_this.inputs().location.trim()].every(function (inventoryMission,i) {
  1692. if (parseInt(inventoryMission.id) === parseInt(response.data.inventoryMission.id)){
  1693. inventoryMission.checked = response.data.inventoryMission.checked;
  1694. inventoryMission.verified_amount = response.data.inventoryMission.verified_amount;
  1695. inventoryMission.difference_amount = response.data.inventoryMission.difference_amount;
  1696. inventoryMission.re_checked_amount = response.data.inventoryMission.re_checked_amount;
  1697. inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
  1698. _this.inventoryMissions.splice(i, 1);
  1699. _this.inventoryMissions.unshift(inventoryMission);
  1700. return false;
  1701. }
  1702. return true;
  1703. })
  1704. }
  1705. _this.重排序并显示();
  1706. _this.清空inputs();
  1707. _this.清空指定盘点记录列();
  1708. tempTip.setDuration(3000);
  1709. tempTip.showSuccess('盘点成功!');
  1710. }
  1711. }).catch(function (err) {
  1712. tempTip.setDuration(2000);
  1713. tempTip.show('盘点失败!' + '网络错误' + err);
  1714. })
  1715. },
  1716. inventoryAccountMissionExport(checkAllSign) {
  1717. let url = '{{url('inventory/stockInventory/inventoryAccountMission/export')}}';
  1718. let token = '{{ csrf_token() }}';
  1719. let allData = [];
  1720. if (checkAllSign) {
  1721. allData = JSON.stringify(this.inventoryMissions);
  1722. let allData1 = JSON.parse(allData);
  1723. allData1.forEach(function (inventoryMission) {
  1724. if (inventoryMission.stock_persons.length > 0) inventoryMission.stock_person = inventoryMission.stock_persons[inventoryMission.stock_persons.length - 1].name;
  1725. if (inventoryMission.stock_persons.length<1) inventoryMission.stock_person='';
  1726. delete inventoryMission.commodity_barcodes;
  1727. delete inventoryMission.stock_persons;
  1728. delete inventoryMission.stockInventoryPersons;
  1729. delete inventoryMission.commodity;
  1730. });
  1731. let data = JSON.stringify(allData1);
  1732. excelExport(false,data,url,this.sum,token);
  1733. } else {
  1734. this.checkData.forEach(function (inventoryMission) {
  1735. if (inventoryMission.stock_persons.length > 0) inventoryMission.stock_person = inventoryMission.stock_persons[inventoryMission.stock_persons.length - 1].name;
  1736. if (inventoryMission.stock_persons.length <1) inventoryMission.stock_person='';
  1737. delete inventoryMission.commodity_barcodes;
  1738. delete inventoryMission.stock_persons;
  1739. delete inventoryMission.stockInventoryPersons;
  1740. delete inventoryMission.commodity;
  1741. });
  1742. let data = JSON.stringify(this.checkData);
  1743. excelExport(checkAllSign,data,url,this.sum,token);
  1744. }
  1745. },
  1746. stockInventoryByLocation(){
  1747. let _this=this;
  1748. let inventoryId=_this.inventory.id;
  1749. let difference=[];
  1750. let trPc = $("#blueTablePc tr:gt(1)").get();
  1751. let tr = $("#blueTable tr:gt(0)").get();
  1752. $(trPc).each(function(item,key){
  1753. input = $(key).find('.blueAmountPc');
  1754. let obj=new Object();
  1755. obj.id=input.attr('data_id');
  1756. obj.stored_amount=input.attr('stored_amount');
  1757. obj.amount=input.val();
  1758. if (input.val()) _this.库位盘点记录.push(obj);
  1759. });
  1760. $(tr).each(function(item,key){
  1761. input = $(key).find('.blueAmount');
  1762. let obj=new Object();
  1763. obj.id=input.attr('data_id');
  1764. obj.stored_amount=input.attr('stored_amount');
  1765. obj.amount=input.val();
  1766. if (input.val()) _this.库位盘点记录.push(obj);
  1767. });
  1768. let url = '{{url('inventory/stockInventory/batchStockByLocation')}}';
  1769. axios.post(url,{mission:_this.库位盘点记录,inventoryId:inventoryId}).then(function(response){
  1770. if (!response.data.success) {
  1771. tempTip.setDuration(2000);
  1772. tempTip.show('盘点失败!' + ' ' + response.data.msg);
  1773. return;
  1774. }else {
  1775. if (_this.inventory.id === response.data.inventory.id) {
  1776. _this.inventory.processed = response.data.inventory.processed;
  1777. _this.inventory.surplus = response.data.inventory.surplus;
  1778. _this.inventory.check_surplus = response.data.inventory.check_surplus;
  1779. }
  1780. response.data.inventoryMission.forEach(function (mission) {
  1781. if(mission.difference_amount>0) difference.push(mission.commodity.barcodes[0].code);
  1782. _this.inventoryMissions.every(function (inventoryMission,i){
  1783. if (parseInt(inventoryMission.id) === parseInt(mission.id)){
  1784. inventoryMission.checked = mission.checked;
  1785. inventoryMission.verified_amount = mission.verified_amount;
  1786. inventoryMission.difference_amount =mission.difference_amount;
  1787. inventoryMission.re_checked_amount = mission.re_checked_amount;
  1788. inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
  1789. _this.inventoryMissions.splice(i, 1);
  1790. _this.inventoryMissions.unshift(inventoryMission);
  1791. return false;
  1792. }
  1793. return true;
  1794. })
  1795. });
  1796. _this.重排序并显示();
  1797. _this.清空inputs();
  1798. _this.清空指定盘点记录列();
  1799. tempTip.setDuration(5000);
  1800. if (difference.length>0){
  1801. tempTip.show('给库位下:条码为'+difference+'存在差异,如需重盘请针对该条码重新盘点!');
  1802. difference=[];
  1803. }else {
  1804. tempTip.showSuccess('盘点成功!');
  1805. }
  1806. }
  1807. }).catch(function (err) {
  1808. tempTip.setDuration(2000);
  1809. tempTip.show('盘点失败!' + '网络错误' + err);
  1810. })
  1811. },
  1812. 新增盘点记录(){
  1813. let _this=this;
  1814. _this.addInventoryMission=true;
  1815. _this.清空指定盘点记录列();
  1816. },
  1817. 收起新增(){
  1818. let _this=this;
  1819. _this.addInventoryMission=false;
  1820. _this.清空指定盘点记录列();
  1821. },
  1822. 盲收(){
  1823. let _this=this;
  1824. _this.blindReceive=true;
  1825. _this.scanListening();
  1826. },
  1827. 正常盘点(){
  1828. let _this=this;
  1829. _this.blindReceive=false;
  1830. $(document).off('keypress');
  1831. },
  1832. changeToManualInputAmount:function(){
  1833. this.status.amountDisable=false;
  1834. this.isManualInputtingAmount=true;
  1835. $('#amountLabel').text('输入数量:');
  1836. },
  1837. changeToScanInputAmount:function(){
  1838. this.status.amountDisable=true;
  1839. this.isManualInputtingAmount=false;
  1840. $('#amountLabel').text('自动扫入数量:');
  1841. },
  1842. changeToManualInputBarcode:function(){
  1843. this.status.barcodeDisable=false;
  1844. this.isManualInputtingBarcode=true;
  1845. $('#barcode').attr('placeholder','手工输入条码');
  1846. },
  1847. changeToScanInputBarcode:function(){
  1848. let data = this;
  1849. this.isManualInputtingBarcode=false;
  1850. this.inputting.barcode='';
  1851. let $barcode = $('#barcode');
  1852. this.status.barcodeDisable=false;
  1853. setTimeout(function () {
  1854. $barcode.focus();
  1855. data.status.barcodeDisable=true;
  1856. },20);
  1857. $barcode.attr('placeholder','扫入条码');
  1858. },
  1859. oninputEnter:function(e){
  1860. if (e.key === 'Enter') {
  1861. this.focusDocument();
  1862. }
  1863. },
  1864. focusDocument: function () {
  1865. this.focusing = 'document';
  1866. this.showCommitButton();
  1867. },
  1868. focusOutDocument: function () {
  1869. this.focusing = '';
  1870. this.autoFillBin();
  1871. },
  1872. scanListening: function () {
  1873. let data = this;
  1874. $(document).on('keypress', function (e) {
  1875. if(data.focusing!=='document'){return}
  1876. if(data.isManualInputtingBarcode){return}
  1877. if (e.keyCode !== 13) {
  1878. if(data.status.scanEndInputted){
  1879. data.lastScannedBarcode=data.inputting.barcode;
  1880. data.inputting.barcode='';
  1881. data.status.scanEndInputted=false;
  1882. }
  1883. data.inputting.barcode += String.fromCharCode(e.keyCode);
  1884. } else {
  1885. if(data.inputting.barcode.length<=1){
  1886. window.tempTip.setDuration(4500);
  1887. window.tempTip.show('未扫入条码,请检查扫码枪设置,尝试调至“直接键盘输出”模式');
  1888. return;
  1889. }
  1890. data.status.scanEndInputted = true;
  1891. data.showCommitButton();
  1892. data.autoFillBin();
  1893. switch(data.inputMode){
  1894. case 'increasing': data.commitGoodsOnIncreasingMode();break;
  1895. case 'multiIncreasing': data.commitGoodsOnMultiIncreasingMode();break;
  1896. }
  1897. }
  1898. });
  1899. },
  1900. commitGoodsOnIncreasingMode: function () {
  1901. let data = this;
  1902. function doIt(){
  1903. let repeatedBarcode=data.repeatedIncreasingBarcodeFromSaved();
  1904. function increase(){
  1905. data.inputting.bin=repeatedBarcode.bin;
  1906. repeatedBarcode.amount++;
  1907. data.inputting.amount=repeatedBarcode.amount;
  1908. window.tempTip.setDuration(500);
  1909. window.tempTip.showSuccess(repeatedBarcode.amount);
  1910. data.focusDocument();
  1911. data.audioDing();
  1912. }
  1913. if(!repeatedBarcode){
  1914. data.focusOutDocument();
  1915. data.alertVibrate();
  1916. window.tempTip.setInputType('number');
  1917. data.inputting.amount=1;
  1918. data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
  1919. data.status.binDisable=true;
  1920. window.tempTip.setDuration(500);
  1921. window.tempTip.showSuccess('保存成功');
  1922. data.focusDocument();
  1923. data.audioDing();
  1924. }else{
  1925. increase();
  1926. }
  1927. }
  1928. if(data.lastScannedBarcode!==data.inputting.barcode && data.lastScannedBarcode){
  1929. data.audioWarning_otherBarcode();
  1930. data.focusOutDocument();
  1931. window.tempTip.confirm('扫到其它条码,是否切换至新条码并记录?',doIt,function () {
  1932. data.inputting.barcode=data.lastScannedBarcode;
  1933. data.focusDocument();
  1934. })
  1935. }else{
  1936. doIt()
  1937. }
  1938. },
  1939. commitGoodsOnMultiIncreasingMode: function () {
  1940. let data = this;
  1941. let repeatedBarcode=this.repeatedIncreasingBarcodeFromSaved();
  1942. function increase(){
  1943. data.inputting.bin=repeatedBarcode.bin;
  1944. repeatedBarcode.amount++;
  1945. data.inputting.amount=repeatedBarcode.amount;
  1946. window.tempTip.setDuration(500);
  1947. window.tempTip.showSuccess(repeatedBarcode.amount);
  1948. data.focusDocument();
  1949. data.audioDing();
  1950. }
  1951. if(!repeatedBarcode){
  1952. data.focusOutDocument();
  1953. data.alertVibrate();
  1954. window.tempTip.setInputType('number');
  1955. data.inputting.amount=1;
  1956. data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
  1957. data.status.binDisable=true;
  1958. window.tempTip.setDuration(500);
  1959. window.tempTip.showSuccess('保存成功');
  1960. data.focusDocument();
  1961. data.audioDing();
  1962. }else{
  1963. increase();
  1964. }
  1965. },
  1966. audioWarning_otherBarcode: function () {
  1967. let audio = document.getElementById('soundWarning');
  1968. audio.currentTime = 0;//重新播放
  1969. if(audio.paused){
  1970. audio.play();// 播放
  1971. }
  1972. this.alertVibrate();
  1973. },
  1974. audioDing: function () {
  1975. let audio = document.getElementById('soundDing');
  1976. audio.currentTime = 0;//重新播放
  1977. audio.play();// 播放
  1978. function startVibrate(duration) {
  1979. if (navigator.vibrate) {
  1980. navigator.vibrate(duration);
  1981. } else if (navigator.webkitVibrate) {
  1982. navigator.webkitVibrate(duration);
  1983. }
  1984. }
  1985. startVibrate(500);
  1986. },
  1987. alertVibrate: function () {
  1988. function startVibrate(duration) {
  1989. if (navigator.vibrate) {
  1990. navigator.vibrate(duration);
  1991. } else if (navigator.webkitVibrate) {
  1992. navigator.webkitVibrate(duration);
  1993. }
  1994. }
  1995. let vibrateInterval = setInterval(function() {
  1996. startVibrate(150);
  1997. }, 50);
  1998. setTimeout(function() {
  1999. clearInterval(vibrateInterval)
  2000. }, 2000);
  2001. },
  2002. autoFillBin: function () {
  2003. let data = this;
  2004. let isNotRepeatingBarcode=this.goodses.every(function(goods){
  2005. if(goods.barcode===data.inputting.barcode){
  2006. data.inputting.bin=goods.bin;
  2007. data.status.binDisable=true;
  2008. return false;
  2009. }
  2010. return true;
  2011. });
  2012. if(isNotRepeatingBarcode){
  2013. data.status.binDisable=false;
  2014. }
  2015. },
  2016. repeatedIncreasingBarcodeFromSaved: function () {
  2017. let data = this;
  2018. let repeatedGoods=null;
  2019. data.goodses.every(function(goods){
  2020. if(goods.barcode===data.inputting.barcode && goods.fromIncreasing){
  2021. repeatedGoods=goods;
  2022. return false;
  2023. }
  2024. return true;
  2025. });
  2026. return repeatedGoods;
  2027. },
  2028. commitGoods: function () {
  2029. let data = this;
  2030. window.tempTip.setDuration(3500);
  2031. if(!data.inputting.barcode){window.tempTip.show('请扫入条码');return;}
  2032. else if(!data.inputting.amount){window.tempTip.show('请输入数量');return;}
  2033. //else if(!data.inputting.bin){window.tempTip.show('请输入隔口号');return;}
  2034. data.recordOrPlusGoods();
  2035. window.tempTip.setDuration(1500);
  2036. window.tempTip.showSuccess('成功提交:' + data.inputting.barcode);
  2037. data.cleanInputs();
  2038. data.audioDing();
  2039. },
  2040. cleanInputs: function () {
  2041. this.changeToScanInputBarcode();
  2042. this.inputting.barcode='';
  2043. this.inputting.amount='';
  2044. this.inputting.bin='';
  2045. this.inputting.produce_date='';
  2046. this.inputting.valid_date='';
  2047. this.inputting.batch_number='';
  2048. this.commitButtonVisible=false;
  2049. this.status.binDisable=false;
  2050. this.lastScannedBarcode='';
  2051. },
  2052. recordOrPlusGoods: function () {
  2053. let data = this;
  2054. if(this.inputMode==='regular'){
  2055. data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
  2056. return;
  2057. }
  2058. let isNotRepeating=data.goodses.every(function(goods){
  2059. if(goods.barcode===data.inputting.barcode){
  2060. goods.amount=parseInt(goods.amount)+parseInt(data.inputting.amount);
  2061. return false;
  2062. }
  2063. return true;
  2064. });
  2065. if(isNotRepeating){
  2066. data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
  2067. }
  2068. },
  2069. removeGoods: function ($e,barcode) {
  2070. if(!confirm('确定要删除条码为'+barcode+'的记录吗'))return;
  2071. let data = this;
  2072. data.goodses.every(function(goods,i){
  2073. if(goods.barcode===barcode){
  2074. data.goodses.splice(i,1)
  2075. return false;
  2076. }
  2077. return true;
  2078. })
  2079. },
  2080. showCommitButton: function () {
  2081. let data = this;
  2082. if(data.inputting.barcode && data.inputting.amount /*&& data.inputting.bin*/){
  2083. data.commitButtonVisible=true;
  2084. }else{
  2085. if (this.inputMode==='regular' && this.status.barcodeDisable && !this.inputting.amount && this.inputting.barcode){
  2086. this.focusing = '';
  2087. document.getElementById('amount').focus();
  2088. }
  2089. }
  2090. },
  2091. submitStockInventory: function () {
  2092. let data = this;
  2093. data.focusOutDocument();
  2094. if(data.goodses.length===0){
  2095. window.tempTip.show('请先录入数据再提交盘点');return;
  2096. }
  2097. if(!data.location){
  2098. window.tempTip.setDuration(1500);
  2099. window.tempTip.show('库位为必填项');
  2100. return;
  2101. }
  2102. window.tempTip.confirm('请检查表格,确定全部完成。提交后数据将全部清空,不能后退',
  2103. function () {
  2104. let url='{{url("inventory/stockInventory/baseOnBlindReceive")}}';
  2105. axios.post(url,{'location':data.location,'goodses':data.goodses,'inventoryId':data.inventory.id,'owner_code':data.inventory.owner.code})
  2106. .then(function(response){
  2107. if(response.data.success){
  2108. data.goodses=[];
  2109. data.cleanInputs();
  2110. window.tempTip.cancelWaitingTip();
  2111. if (data.inventory.id === response.data.inventory.id) {
  2112. data.inventory.processed = response.data.inventory.processed;
  2113. data.inventory.surplus = response.data.inventory.surplus;
  2114. data.inventory.check_surplus = response.data.inventory.check_surplus;
  2115. }
  2116. if (response.data.inventoryMissions.length >0) {
  2117. response.data.inventoryMissions.forEach(function (mission) {
  2118. let isToEdit=false;
  2119. data.inventoryMissions.every(function (inventoryMission){
  2120. if (parseInt(inventoryMission.id) === parseInt(mission.id)){
  2121. isToEdit=true;
  2122. inventoryMission.checked = mission.checked;
  2123. inventoryMission.verified_amount = mission.verified_amount;
  2124. inventoryMission.difference_amount =mission.difference_amount;
  2125. inventoryMission.re_checked_amount = mission.re_checked_amount;
  2126. inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
  2127. return false;
  2128. }
  2129. return true;
  2130. })
  2131. if (!isToEdit){
  2132. mission.commodity_barcodes = mission.commodity.barcodes;
  2133. mission.stockInventoryPersons=response.data.stockInventoryPersons;
  2134. data.inventoryMissions.push(mission);
  2135. }
  2136. });
  2137. }
  2138. data.重排序并标记全列表类型(data.inventoryMissions);
  2139. window.tempTip.setDuration(1500);
  2140. window.tempTip.showSuccess('盲收盘点成功,可返回盘点页面查看');
  2141. data.location='';
  2142. data.focusDocument();
  2143. }else{
  2144. window.tempTip.setDuration(1500);
  2145. window.tempTip.show('盲收盘点失败:'+response.data.fail_info);
  2146. data.focusDocument();
  2147. data.alertVibrate()
  2148. }
  2149. })
  2150. .catch(function (err) {
  2151. window.tempTip.setDuration(3500);
  2152. window.tempTip.show('网络或系统错误,请将以下信息提交给开发者:'+err);
  2153. data.alertVibrate();
  2154. });
  2155. },function () {
  2156. data.focusDocument();
  2157. })
  2158. }
  2159. },
  2160. computed: {
  2161. borderByMode: function () {
  2162. return {
  2163. // 'border-info':this.inputMode==='regular',
  2164. 'border-success':this.inputMode==='increasing',
  2165. 'border-danger':this.inputMode==='multiIncreasing'
  2166. }
  2167. }
  2168. }
  2169. // 单条排序并着色(inventoryMission){
  2170. // let _this=this;
  2171. // let 所在临时分类列=[];
  2172. // switch(inventoryMission.mark){
  2173. // case '已复盘有差异':所在临时分类列=_this.已复盘有差异列;break;
  2174. // case '已复盘无差异':所在临时分类列=_this.已复盘无差异列;break;
  2175. // case '未复盘有差异':所在临时分类列=_this.未复盘有差异列;break;
  2176. // case '无差异':所在临时分类列=_this.无差异列;break;
  2177. // case '未盘':所在临时分类列=_this.未盘列;break;
  2178. // }
  2179. // },
  2180. });
  2181. </script>
  2182. @endsection