| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219 |
- @extends('layouts.app')
- @section('title')库存盘点-库存管理@endsection
- @section('content')
- <div class="text-center h5 mt-2" id="loadingPage">
- 载入中……
- </div>
- <div id="list" class="d-none container-fluid" >
- <div class="mt-3">
- <span class="mt-3" >
- @can('库存管理-盘点-完结')
- <span><button class="btn btn-sm btn-outline-info" v-if="inventory.status==='复盘中' &&!listMode" @click="完结盘点任务(inventory.id,inventory.owner.name,inventory.type)">完结</button></span>
- @endcan
- @can('库存管理-盘点-查看')
- <button class="btn btn-sm" @click="listMode?listMode=false:listMode=true" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode">切换为列表</button>
- @endcan
- @can('库存管理-盘点')
- <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>
- @endcan
- </span>
- @include('inventory.stockInventory._outOnlineModal')
- <span class="dropdown">
- <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
- :class="[checkData.length>0?'btn-dark text-light':'']"
- data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
- 导出Excel
- </button>
- <div class="dropdown-menu">
- <a class="dropdown-item" @click="inventoryAccountMissionExport(false)" href="javascript:">导出勾选内容</a>
- <a class="dropdown-item" @click="inventoryAccountMissionExport(true)" href="javascript:">导出所有</a>
- </div>
- </span>
- <span>
- <button class="btn btn-sm" @click="盲收()" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode&&!blindReceive">盲收</button>
- <button class="btn btn-sm" @click="正常盘点()" :class="blindReceive?'btn-dark':'btn-outline-dark'" v-if="blindReceive">正常盘点</button>
- </span>
- <span>
- <button class="btn btn-outline-dark btn-sm form-control-sm tooltipTarget"
- @click="批量跳过或确认差异()" title="勾选指定盘点记录行,进行批量跳过或批量确认差异">
- 批量跳过
- </button>
- </span>
- <span>
- <button class="btn btn-sm btn-info" @click="新增盘点记录()" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode&&!addInventoryMission">新增盘点记录</button>
- <button class="btn btn-sm" @click="收起新增()" :class="addInventoryMission?'btn-dark':'btn-outline-dark'" v-if="addInventoryMission">收起新增</button>
- </span>
- <button class="btn btn-sm btn-success" @click="outToULine()" v-if="!listMode&&ideLocArr.length>0">出库</button>
- <span class="form-group mb-5">
- <label class="text-muted">货主:</label><span class="font-weight-bold">@{{ inventory.owner.name }}</span>
- </span>
- <span class="form-group p-2 mb-5">
- <label >盘点单号:</label><span>@{{ inventory.id }}</span>
- </span>
- <span class="form-group p-2 mb-5">
- <label class="text-muted">时间范围:</label><span>@{{ inventory.start_at }} 至 @{{ inventory.end_at }}</span>
- </span>
- </div>
- <div class="mt-3">
- <span class="h5">
- <span class="form-group mb-5" v-if="inventory.status==='盘点中' || inventory.status==='待盘点'">
- <label class=" font-weight-bold">已盘点:</label><span>@{{ inventory.processed }}/总数:@{{ inventory.total }}</span>
- </span>
- <span class="form-group mb-5" v-if="inventory.status==='盘点中' || inventory.status==='待盘点'">
- <label class=" font-weight-bold">剩余数:</label><span>@{{ inventory.surplus }}</span>
- </span>
- <span class="form-group mb-5" v-if="inventory.status==='复盘中'&&未复盘有差异列">
- <label class=" font-weight-bold">有差异未复盘数:</label><span>@{{ 未复盘有差异列.length }}</span>
- </span>
- <span class="form-group mb-5" v-if="inventory.status==='复盘中'&&未盘列">
- <label class=" font-weight-bold">未盘点数:</label><span>@{{ 未盘列.length }}</span>
- </span>
- <span class="form-group mb-5" v-if="inventory.status==='复盘中'">
- <label class=" font-weight-bold">总数:</label><span>@{{ inventory.total }}</span>
- </span>
- </span>
- </div>
- <div class="mt-3" >
- <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'">
- @{{ inventory.type }}
- </span>
- <span v-if="!listMode">
- @can('库存管理-盘点-结束初盘')
- <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>
- @endcan
- <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>
- </span>
- </div>
- <div v-if="blindReceive">
- <audio src="{{asset('sound/warning_otherBarcode.mp3')}}" controls="controls" preload id="soundWarning" hidden>
- </audio>
- <audio src="{{asset('sound/ding.mp3')}}" controls="controls" preload id="soundDing" hidden>
- </audio>
- <div class="row mt-2 mb-2 rounded" style="border:solid 3px #999999;">
- <div class="col-12" id="scanColumn">
- <div class="card" :class="borderByMode">
- <div class="card-body">
- <div class="row">
- <div class="col-12">
- <div >
- <div class="text-danger font-weight-bold">
- 库位(必填项):
- </div>
- <input type="text" class="form-control mb-2" v-model="location" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
- </div>
- <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='regular'">常规:可输入效期,相同条码记录不会合并</p>
- <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='increasing'">逐一扫描:处理单一重复商品,每扫一次对应隔口总数量自动递增,扫到不同条码会提示</p>
- <p class="text-muted" style="font-size: 0.5em" v-if="inputMode=='multiIncreasing'">边扫边分:处理多种商品,自动将扫到的不同条码数量递增到各自隔口号</p>
- <ul class="nav nav-tabs mb-4 mt-n3">
- <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='regular'?'active':''"
- @click="inputMode='regular';changeToManualInputAmount();cleanInputs();inputting.fromIncreasing=false">常规</a></li>
- <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='increasing'?'active':''"
- @click="inputMode='increasing';changeToScanInputAmount();cleanInputs();inputting.fromIncreasing=true;">逐一扫描</a></li>
- <li class="nav-item"><a href="#" class="nav-link" :class="inputMode=='multiIncreasing'?'active':''"
- @click="inputMode='multiIncreasing';changeToScanInputAmount();cleanInputs();inputting.fromIncreasing=true">边扫边分</a></li>
- </ul>
- </div>
- <div class="col-6">
- <div v-if="inputMode=='regular'">
- <div class="btn btn-sm btn-outline-primary"
- v-if="!isManualInputtingBarcode" @click="changeToManualInputBarcode">手动输入</div>
- <div class="btn btn-sm btn-outline-danger"
- @click="changeToScanInputBarcode" v-if="isManualInputtingBarcode">扫描输入</div>
- </div>
- <input type="text" id="barcode" class="form-control" :disabled="status.barcodeDisable" placeholder="扫入条码" @focusin="focusOutDocument" @focusout="focusDocument" v-model="inputting.barcode" autocomplete="off">
- <div v-if="inputMode=='regular'">
- <div class="card-title">
- 生产日期:
- </div>
- <input type="date" class="form-control mb-2" v-model="inputting.produce_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
- </div>
- <div v-if="inputMode=='regular'">
- <div class="card-title">
- 失效日期:
- </div>
- <input type="date" class="form-control mb-2" v-model="inputting.valid_date" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
- </div>
- </div>
- <div class="col-6">
- <div class="card-title" id="amountLabel">
- 手动输入数量:
- </div>
- <div class="input-group mt-n2 mb-2">
- <input type="number" id="amount" class="form-control" placeholder="" :disabled="status.amountDisable"
- v-model="inputting.amount" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"
- style='height: 40px;font-size: 1.6em;color:blue;font-weight: bolder;padding: 3px;text-align: center'>
- </div>
- {{-- <div class="card-title">--}}
- {{-- 格口号:--}}
- {{-- </div>--}}
- {{-- <input type="number" id="bin" class="form-control mt-n2 mb-2"--}}
- {{-- v-model="inputting.bin"--}}
- {{-- :disabled="status.binDisable" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}
- {{-- style='height: 80px;font-size: 5em;color:red;font-weight: bolder;padding: 3px;text-align: center'>--}}
- <div v-if="inputMode=='regular'">
- <div class="card-title">
- 批次号:
- </div>
- <input type="text" class="form-control mb-2" v-model="inputting.batch_number" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter">
- </div>
- </div>
- <div class="col-12" v-if="commitButtonVisible && inputMode=='regular'" >
- <button class="btn btn-success btn form-control" @click="commitGoods">确定</button>
- </div>
- </div>
- <p class="card-text text-muted mt-3 mb-n3 text-center">
- 已完成:
- </p>
- <hr>
- <table class="table table-sm table-striped" v-if="goodses.length>0">
- <tr>
- {{-- <th>隔口号</th>--}}
- <th>数量</th>
- <th>条码</th>
- <th>生产日期</th>
- <th>失效日期</th>
- <th>批次号</th>
- <th>操作</th>
- </tr>
- <tr v-for="goods in goodses" @click="selectedColor(goods.id,$event)">
- {{-- <td>@{{ goods.bin }}</td>--}}
- <td>@{{ goods.amount }}</td>
- <td>@{{ goods.barcode }}</td>
- <td>@{{ goods.produce_date }}</td>
- <td>@{{ goods.valid_date }}</td>
- <td>@{{ goods.batch_number }}</td>
- <td>
- <button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button>
- </td>
- </tr>
- </table>
- <hr>
- <span class="btn btn-outline-dark btn form-control" style="cursor: pointer" @click="submitStockInventory">结束并生成盘点</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <form id="form">
- <div v-if="!blindReceive">
- <div class="mt-3 form-inline " v-if="!listMode" :class="inventory.status=='盘点中' ||inventory.status=='待盘点'?'row-cols-3':'row-cols-5'">
- <span class="form-group">
- <label for="location" class="text-secondary font-weight-bold">请输库位</label>
- <input id="locationInput" @keypress="locationPress($event)"
- @change="locationChange($event)"
- name="location" type="text" class="form-control input" autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
- </span>
- <span class="form-group ml-4" v-if="addInventoryMission">
- <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
- <input id="barcodeInput" name="barcode" @keypress="barcodePress($event)"
- @change="barcodeChange($event)"
- type="text" value="@if(old('barcode')){{old('barcode')}}@endif" class="form-control input" autocomplete="off">
- </span>
- <span class="form-group ml-4" v-if="dataExtraStatus.addingNew&&addInventoryMission" id="countBlock">
- <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
- <input type="number" id="amountInput" @keypress="amountPress($event)"
- name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif" autocomplete="off">
- </span>
- <span class="btn btn-sm btn-outline-danger ml-4" v-if="inputs().location" style="max-width: 160px" @click="stockInventoryByLocation()">盘点该库位下所有记录</span>
- </div>
- </div>
- <!--相同库位和条码 pc端-->
- <div class="row d-none d-xl-block">
- <div class="col-12 col-md-12 col-sm-12 showBlueTable d-none">
- <table class="table table-sm table-bordered table-info mt-2" :class="!listMode?'':'d-none'" id="blueTablePc">
- <tr>
- <td class="font-weight-bold">输入盘点数</td>
- <td>操作</td>
- <td>库位</td>
- <td>产品名</td>
- <td>产品条码</td>
- <td>产品编码</td>
- <td>生产日期</td>
- <td>失效时期</td>
- <td>批号</td>
- <th>属性仓</th>
- <th>质量状态</th>
- <td>盘点数量</td>
- <td>复盘数量</td>
- <td>复盘差异</td>
- </tr>
- <tr class="selectingRow" id="blueTrPc">
- <td>
- <input type="number" onkeypress="listVue.selectingRow(event)" name="amount" class="form-control-sm blueAmountPc" autocomplete="off" oninput="inputs.amount=event.target.value">
- </td>
- <td>
- <span class="btn btn-sm btn-outline-primary stockButtonPc" onclick="listVue.盘点选中任务(event)">选定盘点</span>
- </td>
- <td class="location"></td>
- <td class="commodity_name"></td>
- <td class="commodity_barcode"></td>
- <td class="commodity_sku"></td>
- <td><input type="date" class="form-control-sm produced_at" name="produced_at" onchange="producedAtChange(event)"></td>
- <td><input type="date" class="form-control-sm valid_at" name="valid_at" onchange="validAtChange(event)"></td>
- <td><input type="text" class="form-control-sm batch_number" name="batch_number" onchange="batchNumberChange(event)"></td>
- <td class="erp_type_position"></td>
- <td class="quality"></td>
- <td class="verified_amount font-weight-bold text-success"></td>
- <td class="re_checked_amount"></td>
- <td class="difference_amount"></td>
- </tr>
- </table>
- </div>
- </div>
- <!--相同库位和条码 移动端-->
- <div class="showBlueTable d-none">
- <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">
- <tr class="selectingRow移动端" id="blueTr">
- <td style="filter:grayscale(30%); ">
- <div class="mt-3">
- <div>
- <span class="mr-3 text-nowrap"><span class="font-weight-bold">输入盘点数:</span>
- <span>
- <input type="number" onkeypress="listVue.selectingRow(event)" name="amount" class="form-control-sm blueAmount" autocomplete="off" oninput="inputs.amount=event.target.value">
- </span>
- </span>
- <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>
- </div>
- <div style="transform:scale(0.9)" class="pl-0">
- <span class="mr-3 text-nowrap"><span class="font-weight-bold">库位:</span><span class="location"></span></span>
- <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品名称:</span><span class="commodity_name"></span></span>
- <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品条码:</span><span class="commodity_barcode"></span>
- </span>
- <span class="mr-3 text-nowrap"><span class="font-weight-bold">产品编码:</span><span class="commodity_sku"></span></span>
- <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>
- <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>
- <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>
- <span class="mr-3 text-nowrap"><span>属性仓:</span><span class="erp_type_position"></span></span>
- <span class="mr-3 text-nowrap"><span>质量状态:</span><span class="quality"></span></span>
- <div>
- <span class="mr-3 text-nowrap"><span style="color:#783000">盘点数量:</span><span class="verified_amount font-weight-bold text-success"></span></span>
- <span class="mr-3 text-nowrap"><span style="color:#783000">复盘数量:</span><span style="color:#af7651" class="re_checked_amount"></span></span>
- <span class="mr-3 text-nowrap"><span style="color:#783000">盘点差异:</span><span class="difference_amount"></span></span>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </form>
- <div class="card-body pt-1">
- <table class="table table-sm table-striped d-none d-xl-block p-0 text-nowrap table-bordered td-min-width-80"
- id="table" ref="boxPc">
- <tr>
- <th>
- <label for="all" class="d-none" id="cloneCheckAll">
- <input id="all" type="checkbox" @click="checkAll($event)">全选
- </label>
- </th>
- <th class="text-center">序号</th>
- <th class="text-center">库位</th>
- <th class="text-center">产品名</th>
- <th class="text-center">产品条码</th>
- <th class="text-center">产品编码</th>
- <th class="text-center">生产日期</th>
- <th class="text-center">失效日期</th>
- <th class="text-center">批号</th>
- <th class="text-center">盘点人</th>
- <th class="text-center">ERP属性仓</th>
- <th class="text-center">质量状态</th>
- <th class="text-center">库存数量</th>
- <th class="text-center">可用数量</th>
- <th class="text-center">盘点数量</th>
- <th class="text-center">复盘数量</th>
- <th class="text-center">复盘差异</th>
- <th class="text-center">分配数量</th>
- <th class="text-center">操作</th>
- </tr>
- <tr v-for="(inventoryMission, i) in 显示记录列" :key="i"
- :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':'','opacity': inventoryMission.mark==='确认差异'?'0.7':''}" :class="[
- inventoryMission.mark==='已复盘有差异'?'td-cool':'',
- inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
- inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
- inventoryMission.mark==='确认差异'?'td-warm font-weight-bold':'',
- inventoryMission.mark==='无差异'?'text-muted':'',
- inventoryMission.mark==='未盘'?'td-yellow':'',
- inventoryMission.mark==='跳过'?'text-muted':'',
- ]">
- <td>
- <input type="checkbox" :value="inventoryMission" v-model="checkData">
- <span :id="'lockLine'+(i+1)"></span>
- </td>
- <td><span>@{{ i+1 }}</span></td>
- <td><span>@{{ inventoryMission.location }}</span></td>
- <td >
- <span v-if="inventoryMission.commodity">
- <span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.commodity.name }}</span>
- </span>
- </td>
- <td>
- <span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
- <span
- v-if="inventoryMission.commodity_barcodes && inventoryMission.commodity_barcodes.length>0">
- <span v-if="inventoryMission.commodity_barcodes.length==1">
- @{{ inventoryMission.commodity_barcodes[0].code }}
- </span>
- <span v-if="inventoryMission.commodity_barcodes.length>1">
- <small
- v-for="barcode in inventoryMission.commodity_barcodes">@{{ barcode.code }}<br></small>
- </span>
- </span>
- </span>
- </td>
- <td >
- <span v-if="inventoryMission.commodity">
- <span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.commodity.sku }}</span>
- </span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.produced_at }}</span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.valid_at }}</span>
- </td>
- <td class="text-muted"><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.batch_number }}</span>
- </td>
- <td v-if="inventoryMission.stockInventoryPersons" class="text-muted"
- :rowspan="inventoryMission.is_multi_row?2:''">
- <span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
- <a href="#" v-if="inventoryMission.stockInventoryPersons.length>0" class="dropdown-toggle"
- data-toggle="dropdown">
- @{{ inventoryMission.stockInventoryPersons[0].mark }}<b class="caret"></b>
- </a>
- <div
- style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto"
- class="small mt-0 dropdown-menu">
- <table class="table table-sm table-striped table-bordered">
- <tr>
- <th>盘点人</th>
- <th>时间</th>
- </tr>
- <tr v-for="stockInventoryPerson in inventoryMission.stockInventoryPersons">
- <td>@{{ stockInventoryPerson.mark }}</td>
- <td>@{{ stockInventoryPerson.created_at }}</td>
- </tr>
- </table>
- </div>
- </span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.erp_type_position }}</span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
- <span v-if="listMode">@{{ inventoryMission.quality }}</span>
- <select v-else class="form-control-sm" name="quality" id="quality"
- v-model="inventoryMission.quality"
- @change="updateQuality(inventoryMission.id,inventoryMission.location,inventoryMission.commodity.sku,inventoryMission.quality,inventory.owner.code)">
- <option value="正品">正品</option>
- <option value="残次">残次</option>
- </select>
- </span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.stored_amount }}</span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.valid_amount }}</span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.verified_amount }}
- <span v-if="inventoryMission.checked==='跳过'" class="badge badge-pill badge-secondary">跳过</span></span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.re_checked_amount }}</span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.difference_amount }}</span>
- </td>
- <td><span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">@{{ inventoryMission.occupied_amount }}</span>
- </td>
- @can('库存管理-盘点')
- <td>
- {{-- <span class="btn btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>--}}
- <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'"
- @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
- <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.mark==='已复盘有差异'||inventoryMission.mark==='未复盘有差异'"
- @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
- <span class="btn btn-sm btn-outline-secondary"
- v-if="inventory.type=='动盘'&& inventoryMission.mark=='未盘' &&!listMode"
- @click="选中盘点起始位置(inventoryMission.id,inventoryMission.location)">以此为起点</span>
- </td>
- @endcan
- </tr>
- </table>
- </div>
- <!--盘点记录移动端-->
- <table id="listOnPad" class="table table-striped table-sm table-bordered table-hover p-0 d-table d-xl-none"
- style="background: rgb(255, 255, 255);" ref="box">
- <tbody>
- <tr {{--v-for="(inventoryMission,i) in 显示记录列"--}} v-for="(inventoryMission, i) in 显示记录列" :key="i"
- :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':'','opacity': inventoryMission.mark==='确认差异'?'0.7':''}"
- :class="[
- inventoryMission.mark==='已复盘有差异'?'td-cool':'',
- inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
- inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
- inventoryMission.mark==='确认差异'?'td-warm font-weight-bold':'',
- inventoryMission.mark==='无差异'?'text-muted':'',
- inventoryMission.mark==='未盘'?'td-yellow':'',
- inventoryMission.mark==='跳过'?'text-muted':'',
- ]">
- <td style="filter:grayscale(30%); ">
- <span :id="'lockLinePhone'+(i+1)"></span>
- <div class="mt-3">
- <div style="transform:scale(0.9)" class="pl-0">
- <span type="hidden">@{{ i+1 }}</span>
- <span class="mr-3 text-nowrap"><span class="font-weight-bold">库位:</span><span
- style="color:#af7651">
- @{{ inventoryMission.location }}</span></span>
- <span class="mr-3 text-nowrap"
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode"><span
- class="font-weight-bold">产品名称:</span><span style="color:#af7651"
- v-if="inventoryMission.commodity">
- @{{ inventoryMission.commodity.name }}</span></span>
- <span class="mr-3 text-nowrap"
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
- <span class="font-weight-bold">质量状态:</span>
- <span v-if="listMode">@{{ inventoryMission.quality }}</span>
- <select v-else class="form-control-sm" name="quality" id="quality"
- v-model="inventoryMission.quality"
- @change="updateQuality(inventoryMission.id,inventoryMission.location,inventoryMission.commodity.sku,inventoryMission.quality,inventory.owner.code)">
- <option value="正品">正品</option>
- <option value="残次">残次</option>
- </select>
- </span>
- <span class="mr-3 text-nowrap"
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
- <span class="font-weight-bold">产品条码:</span>
- <span
- v-if="inventoryMission.checked==='是'||inventoryMission.checked==='确认差异'||inventoryMission.checked==='跳过'||inventory.status==='复盘中'||listMode">
- <span
- v-if="inventoryMission.commodity_barcodes && inventoryMission.commodity_barcodes.length>0">
- <span v-if="inventoryMission.commodity_barcodes.length==1">
- @{{ inventoryMission.commodity_barcodes[0].code }}
- </span>
- <span v-if="inventoryMission.commodity_barcodes.length>1">
- <small
- v-for="barcode in inventoryMission.commodity_barcodes">@{{ barcode.code }}<br></small>
- </span>
- </span>
- </span>
- </span>
- <div v-if="inventory.status==='复盘中'">
- <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点数量:</span><span
- style="color:#af7651">
- @{{ inventoryMission.verified_amount }}</span></span>
- <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">复盘数量:</span><span
- style="color:#af7651">
- @{{ inventoryMission.re_checked_amount }}</span></span>
- <span class="mr-3 text-nowrap"><span style="color:#783000" class="font-weight-bold">盘点差异:</span><span>
- @{{ inventoryMission.difference_amount }}</span></span>
- </div>
- @can('库存管理-盘点')
- <div>
- <span class="mr-3 text-nowrap" v-if="!listMode"><span
- class="font-weight-bold">操作:</span>
- {{-- <span class="btn btn-sm btn-outline-danger" @click="删除盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">删除</span>--}}
- <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'"
- @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
- <span class="btn btn-sm btn-outline-secondary" v-if="inventoryMission.mark==='已复盘有差异'||inventoryMission.mark==='未复盘有差异'"
- @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
- <span class="btn btn-sm btn-outline-secondary"
- v-if="inventory.type=='动盘'&& inventoryMission.mark=='未盘' &&!listMode"
- @click="选中盘点起始位置(inventoryMission.id,inventoryMission.location)">以此为起点</span>
- </span>
- </div>
- @endcan
- </div>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <!--上次盘点记录-->
- <div class="modal" id="lastStockInventoryRecord" tabindex="-1" role="dialog">
- <div class="modal-dialog modal-xl">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title font-weight-bold">该盘点记录已存在,是否覆盖之前记录?</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <table class="table table-sm table-striped table-bordered">
- <tr class="text-muted text-center">
- <th>库位</th>
- <th>产品条码</th>
- <th>盘点人</th>
- <th>盘点数量</th>
- <th>产品名</th>
- <th>产品编号</th>
- <th>属性仓</th>
- <th>质量状态</th>
- <th>库存数量</th>
- <th>盘点差异</th>
- <th>时间</th>
- </tr>
- <tr class="text-center ">
- <td>@{{ lastStockInventoryRecord.location }}</td>
- <td><span v-if="lastStockInventoryRecord.commodity">@{{ lastStockInventoryRecord.commodity.barcode }}</span></td>
- <td><span v-if="stockInventoryPersons.length>0">@{{ stockInventoryPersons[stockInventoryPersons.length-1].mark }}</span></td>
- <td>@{{ lastStockInventoryRecord.verified_amount }}</td>
- <td><span v-if="lastStockInventoryRecord.commodity">@{{ lastStockInventoryRecord.commodity_name }}</span></td>
- <td><span v-if="lastStockInventoryRecord.commodity">@{{ lastStockInventoryRecord.commodity.sku }}</span>
- </td>
- <td>@{{ lastStockInventoryRecord.erp_type_position }}</td>
- <td>@{{ lastStockInventoryRecord.quality }}</td>
- <td>@{{ lastStockInventoryRecord.stored_amount }}</td>
- <td>@{{ lastStockInventoryRecord.difference_amount }}</td>
- <td><span v-if="stockInventoryPersons.length>0">@{{ stockInventoryPersons[stockInventoryPersons.length-1].created_at }}</span>
- </td>
- </tr>
- </table>
- </div>
- <div class="modal-footer">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true" class="btn btn-outline-secondary" @click="不覆盖()">否</span>
- </button>
- <button type="button" class="btn btn-primary" data-dismiss="modal" @click="覆盖()">是</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
- <script>
- let hideHeaderTitle = function () {
- let $listOnPad = $('#listOnPad');
- let $headerRoll = $('#headerRoll');
- if ($listOnPad.css('display') !== 'none') {
- $headerRoll.attr('hidden', true)
- } else {
- $headerRoll.attr('hidden', false)
- $headerRoll.find('tr').css('width', $(document).width());
- }
- };
- window.onresize = hideHeaderTitle;
- window.onscroll = hideHeaderTitle;
- let $showBlueTable=null;
- let $barcodeInput=null;
- let $locationInput=null;
- let $amountInput=null;
- let $prototype_ = null;
- let $blueTable = null;
- let $prototypePc_ = null;
- let $blueTablePc = null;
- let inputs={location:'',barcode:'',amount:'',produced_at:'',valid_at:'',batch_number:''};//双向绑定在本页太慢,所以用外部变量
- let $appointInventoryList=[];
- let $jqueryTable=[];
- function producedAtChange(e){
- inputs.produced_at = e.target.value;
- }
- function validAtChange(e){
- inputs.valid_at = e.target.value;
- }
- function batchNumberChange(e){
- inputs.batch_number = e.target.value;
- }
- let listVue = new Vue({
- el: "#list",
- data: {
- selectingId:'',
- dataExtraStatus:{addingNew:false, displayingLastCounting:false,showBlueTable:false},
- inventory:{!! $inventoryAccount!!},
- inventoryMissions : [
- @foreach($inventoryAccountMissions as $inventoryMission)
- {
- id: '{{$inventoryMission->id}}',
- location: '{{$inventoryMission->location}}',
- created_at: '{{$inventoryMission->created_at}}',
- commodity_name: '{{$inventoryMission->commodity ? $inventoryMission->commodity->name : ''}}',
- commodity_sku: '{{$inventoryMission->commodity ? $inventoryMission->commodity->sku : ''}}',
- commodity_barcode: '{{$inventoryMission->commodity ? $inventoryMission->commodity->barcode : ''}}',
- commodity:{!! $inventoryMission->commodity ?? null !!},
- stockInventoryPersons:{!! $inventoryMission->stockInventoryPersons !!},
- commodity_barcodes: [
- @foreach($inventoryMission->commodity ? $inventoryMission->commodity->barcodes ?? [] : [] as $barcode)
- {code: '{{$barcode->code}}'},
- @endforeach
- ],
- stock_persons: [
- @foreach($inventoryMission->stockInventoryPersons ? $inventoryMission->stockInventoryPersons ?? [] : [] as $person)
- {name: '{{$person->mark}}'},
- @endforeach
- ],
- produced_at: '{{$inventoryMission->produced_at}}',
- valid_at: '{{$inventoryMission->valid_at}}',
- verified_amount: '{{$inventoryMission->verified_amount}}',
- stored_amount: '{{$inventoryMission->stored_amount}}',
- valid_amount: '{{$inventoryMission->valid_amount}}',
- stored_at: '{{$inventoryMission->stored_at}}',
- batch_number: '{{$inventoryMission->batch_number}}',
- erp_type_position: '{{$inventoryMission->erp_type_position}}',
- quality: '{{$inventoryMission->quality}}',
- difference_amount: '{{$inventoryMission->difference_amount}}',
- occupied_amount: '{{$inventoryMission->occupied_amount}}',
- checked: '{{$inventoryMission->checked}}',
- returned: '{{$inventoryMission->returned}}',
- re_checked_amount: '{{$inventoryMission->re_checked_amount}}'
- },
- @endforeach
- ],
- 库位盘点记录:[],
- 条码索引_记录: {},
- 库位索引_记录: {},
- selectedStyle:'',
- 指定盘点记录列:[],
- checkData: [],
- lastStockInventoryRecord:{},
- stockInventoryPersons:[],
- inventoryAccountMissions:[],
- listMode:false,
- blindReceive:false,
- addInventoryMission:false,
- 分割位置id:null,
- 显示记录列:[],
- focusing:'document',
- commitButtonVisible:false,
- isManualInputtingBarcode:false,
- isManualInputtingAmount:true,
- lastScannedBarcode:'',
- inputMode:'regular',
- location:'',
- inputting:{
- barcode:'',amount:'',bin:'',produce_date:'',valid_date:'',batch_number:'',fromIncreasing:false
- },
- status:{
- scanEndInputted:false,binDisable:false,barcodeDisable:true,amountDisable:false,
- },
- goodses:[],
- selectTr:'',
- materialBoxCodes:'',
- outOnLineAmount:'',
- ideLocArr:[],
- errors:{},
- },
- beforeMount: function () {
- this.重排序并标记全列表类型();
- this.加载下方数据并置空上方数据()//初始化先调用一次
- },
- watch: {
- checkData: {
- handler() {
- if (this.checkData.length === this.inventoryMissions.length) {
- document.querySelector('#all').checked = true;
- } else {
- document.querySelector('#all').checked = false;
- }
- },
- deep: true
- }
- },
- destroyed() {
- window.removeEventListener('scroll', this.lazy)
- },
- updated: function () {
- $barcodeInput=$('#barcodeInput');
- $locationInput=$('#locationInput');
- $amountInput=$('#amountInput');
- },
- mounted: function () {
- let _this = this;
- _this.lazy();
- $('#cloneCheckAll').removeClass('d-none')
- window.addEventListener('scroll', this.lazy);
- (function 显示渲染后页面(){
- $('#loadingPage').remove();
- $('#list').removeClass('d-none');
- })()
- $(".tooltipTarget").tooltip({'trigger': 'hover'});
- $barcodeInput=$('#barcodeInput');
- $locationInput=$('#locationInput');
- $amountInput=$('#amountInput');
- $showBlueTable=$('.showBlueTable');
- $prototype_ = $('#blueTr');
- $blueTable = $('#blueTable');
- $prototypePc_ = $('#blueTrPc');
- $blueTablePc = $('#blueTablePc');
- this.放置焦点光标至正确位置();
- (function 初始化列表模式() {
- let listMode = getGetVal('listMode')
- if (listMode === 'true') {
- _this.listMode = true;
- return;
- }
- _this.listMode = false;
- })();
- _this.建立记录索引();
- //将库位含有ide的料想存入数组
- _this.未盘列.forEach(function (inventoryMission){
- if (inventoryMission.location.indexOf('IDE')>-1){
- _this.ideLocArr.push(inventoryMission.location)
- }
- });
- },
- methods:{
- outToULine(){
- this.ideLocArr=this.unique(this.ideLocArr);
- $("#change-outOnLineAmount").modal('show');
- },
- //根据输入数量 截取库位 出库
- outToULineEnsure(){
- let _this=this;
- let error = {};
- if (_this.outOnLineAmount>_this.ideLocArr.length)error.outOnLineAmount = ["出库料箱数大于当前任务料想总数"];
- if (JSON.stringify(error)!=='{}'){this.errors = error;return;}
- if(!confirm('确定要将当前盘点任务涉及的IDE料箱号出至输送线吗?')){return;}
- let selectedArr = _this.ideLocArr.slice(0,_this.outOnLineAmount);
- _this.materialBoxCodes='';
- selectedArr.forEach(function (item){
- _this.materialBoxCodes += item + ','
- });
- if (_this.materialBoxCodes.length > 0) {
- _this.materialBoxCodes = _this.materialBoxCodes.substr(0,_this.materialBoxCodes.length - 1);
- }
- let text=_this.materialBoxCodes;
- if(!text){
- alert('当前盘点任务未查询到IDE料箱号!')
- return;
- }
- let url = '{{url('inventory/stockInventory/outToLineUpdateInventoryMissions')}}';
- window.axios.post(url,{inventory:_this.inventory,location:text})
- .then(res=>{
- if (res.data.success){
- $("#change-outOnLineAmount").modal('hide');
- _this.outOnLineAmount='';
- _this.dispatchHaiq(text);
- }else {
- window.tempTip.setDuration(2000);
- window.tempTip.show(res.data.data);
- }
- }).catch(err=>{
- window.tempTip.setDuration(2000);
- window.tempTip.show("网络错误:"+err);
- })
- },
- dispatchHaiq(text){
- axios.post('{{url('/api/thirdPart/haiq/storage/takeOutToULine')}}',{codes:text})
- .then(function(response){
- tempTip.okWindow(response.data.result,'确定')
- window.location.reload();
- }).catch(function(err){
- tempTip.okWindow(err,'确定')
- window.location.reload();
- })
- },
- checkAll(e) {
- if (e.target.checked) {
- this.inventoryMissions.forEach((el,i)=>{
- if (this.checkData.indexOf(el) == '-1'){
- this.checkData.push(el);
- }
- });
- } else {
- this.checkData = [];
- }
- },
- selectedColor(id,e){
- $('#headerParent tr[class=focusing]').removeClass('focusing')
- if (id==this.selectTr){
- this.selectTr='';
- return;
- }
- this.selectTr=id;
- $(e.target).parent('tr').addClass('focusing')
- },
- lazy(){
- let _this=this;
- let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;//滚动条距离顶部的高度
- let scrollHeight = $(document).height();//当前页面的总高度
- let clientHeight=window.innerHeight;//当前可视的页面高度
- let count = parseFloat(clientHeight) + parseFloat(scrollTop);//浏览器底部位置
- if (scrollHeight - count < 40) {
- if (_this.显示记录列.length < _this.inventoryMissions.length) {
- _this.加载下方数据并置空上方数据()
- }
- }
- },
- 加载下方数据并置空上方数据(){
- let _this=this;
- const count = _this.显示记录列.length;
- if (count > 30) {
- _this.inventoryMissions.map((inventoryMission, index) => {
- if (_this.显示记录列.length < 5 + count) {
- if (_this.显示记录列.length < _this.inventoryMissions.length) {
- _this.显示记录列.push(_this.inventoryMissions[_this.显示记录列.length]);
- }
- }
- })
- } else {
- _this.inventoryMissions.map((inventoryMission, index) => {
- if (_this.显示记录列.length < 25 + count) {
- if (_this.显示记录列.length < _this.inventoryMissions.length) {
- _this.显示记录列.push(_this.inventoryMissions[_this.显示记录列.length])
- }
- }
- })
- }
- },
- cloneBlueTrDom($appointInventoryList) {
- for(let i =0;i<$appointInventoryList.length;i++){
- let newDom= $prototype_.clone();
- newDom.find('.location').text($appointInventoryList[i].location);
- newDom.find('.commodity_name').text($appointInventoryList[i].commodity_name);
- newDom.find('.commodity_barcode').text($appointInventoryList[i].commodity_barcode);
- newDom.find('.commodity_sku').text($appointInventoryList[i].commodity_sku);
- newDom.find('.produced_at').val($appointInventoryList[i].produced_at.substr(0,10));
- newDom.find('.valid_at').val($appointInventoryList[i].valid_at.substr(0,10));
- newDom.find('.batch_number').val($appointInventoryList[i].batch_number);
- newDom.find('.erp_type_position').text($appointInventoryList[i].erp_type_position);
- newDom.find('.quality').text($appointInventoryList[i].quality);
- newDom.find('.verified_amount').text($appointInventoryList[i].verified_amount);
- newDom.find('.re_checked_amount').text($appointInventoryList[i].re_checked_amount);
- newDom.find('.difference_amount').text($appointInventoryList[i].difference_amount);
- newDom.show();
- newDom.find('.blueAmount').attr('data_id', $appointInventoryList[i].id);
- newDom.find('.blueAmount').attr('stored_amount', $appointInventoryList[i].stored_amount);
- newDom.find('.stockButton').attr('data_id', $appointInventoryList[i].id);
- newDom.addClass('blueTr'+i);
- newDom.appendTo($blueTable);
- $jqueryTable.push(newDom);
- }
- $prototype_.hide();
- },
- cloneBlueTrPcDom($appointInventoryList) {
- for(let i =0;i<$appointInventoryList.length;i++){
- let newDom= $prototypePc_.clone();
- newDom.find('.location').text($appointInventoryList[i].location);
- newDom.find('.commodity_name').text($appointInventoryList[i].commodity_name);
- newDom.find('.commodity_barcode').text($appointInventoryList[i].commodity_barcode);
- newDom.find('.commodity_sku').text($appointInventoryList[i].commodity_sku);
- newDom.find('.produced_at').val($appointInventoryList[i].produced_at.substr(0,10));
- newDom.find('.valid_at').val($appointInventoryList[i].valid_at.substr(0,10));
- newDom.find('.batch_number').val($appointInventoryList[i].batch_number);
- newDom.find('.erp_type_position').text($appointInventoryList[i].erp_type_position);
- newDom.find('.quality').text($appointInventoryList[i].quality);
- newDom.find('.verified_amount').text($appointInventoryList[i].verified_amount);
- newDom.find('.re_checked_amount').text($appointInventoryList[i].re_checked_amount);
- newDom.find('.difference_amount').text($appointInventoryList[i].difference_amount);
- newDom.show();
- newDom.find('.blueAmountPc').attr('data_id', $appointInventoryList[i].id);
- newDom.find('.blueAmountPc').attr('stored_amount', $appointInventoryList[i].stored_amount);
- newDom.find('.stockButtonPc').attr('data_id', $appointInventoryList[i].id);
- newDom.addClass('blueTrPc'+i);
- newDom.appendTo($blueTablePc);
- $jqueryTable.push(newDom);
- }
- $prototypePc_.hide();
- },
- inputs() {
- return inputs;
- },
- barcodePress(e){
- if(e.key==='Enter') {
- this.barcodeChange(e);
- }
- },
- barcodeChange(e){
- this.inputs().barcode = e.target.value;
- this.提交部分输入();
- },
- amountPress(e){
- if(e.key==='Enter'){
- this.提交新增(e);
- }
- },
- locationPress(e){
- if(e.key==='Enter'){
- this.locationChange(e);
- }
- },
- locationChange(e){
- this.inputs().location = e.target.value;
- this.提交部分输入();
- if(!this.addInventoryMission){
- this.location=this.inputs().location ;
- this.$forceUpdate()
- }
- },
- 提交部分输入:_.throttle(function(){
- let _this = this;
- this.放置焦点光标至正确位置();
- _this.显示盘点计数input_按情况();
- (new Promise(function (resolve, reject) {
- resolve()
- })).then(function () {
- if(_this.addInventoryMission){
- _this.提交库位和条码();
- }else{
- _this.提交库位();
- }
- _this.显示盘点计数input_按情况();
- })
- },100,{trailing:false}),
- 提交新增:_.throttle(function(e){
- this.inputs().amount=e.target.value;
- this.提交新增并盘点();
- },100,{trailing:false}),
- selectingRow(e){
- let _this=this;
- let id = $(e.target).attr('data_id');
- _this.selectingId=id;
- if(e.key==='Enter'){
- _this.提交盘点();
- }
- },
- 提交库位和条码:_.throttle(async function(){
- let _this=this;
- this.清空指定盘点记录列();
- if (!_this.inputs().barcode) return;
- if(!(await this.is条码存在于WMS(_this.inputs().barcode))){
- tempTip.setDuration(2000);
- tempTip.show('输入的商品条码没有对应的商品!');
- }
- this.筛选出记录(_this.inputs().location,_this.inputs().barcode);
- },100,{ 'trailing': false }),
- 提交库位:_.throttle(async function(){
- let _this=this;
- this.清空指定盘点记录列();
- this.筛选库位出记录(_this.inputs().location);
- },100,{ 'trailing': false }),
- 建立记录索引(){
- let _this=this;
- _this.inventoryMissions.forEach(function (inventoryMission) {
- inventoryMission.commodity_barcodes.forEach(function (barcode) {
- if(!Array.isArray(_this.条码索引_记录[barcode.code])) _this.条码索引_记录[barcode.code]=[];
- _this.条码索引_记录[barcode.code].push(inventoryMission);
- })
- if(!Array.isArray(_this.库位索引_记录[inventoryMission.location])) _this.库位索引_记录[inventoryMission.location]=[];
- _this.库位索引_记录[inventoryMission.location].push(inventoryMission);
- });
- },
- 清空指定盘点记录列(){
- let _this=this;
- $jqueryTable.forEach(function (newDom,i) {
- newDom.remove();
- })
- $appointInventoryList=[];
- $showBlueTable.attr('class','d-none');
- _this.selectingId='';
- _this.location='';
- _this.库位盘点记录=[];
- },
- 显示盘点计数input_按情况(){
- let _this=this;
- setTimeout(function(){
- if($appointInventoryList.length>0){
- _this.dataExtraStatus.addingNew=false;
- }else{
- _this.dataExtraStatus.addingNew=true;
- }
- },10)
- },
- async 筛选出记录(库位, 条码){
- 条码=条码.trim();
- 库位=库位.trim();
- let _this=this;
- if(!库位)return false;
- if(!条码)return false;;
- if (!_this.库位索引_记录[库位]
- ||(!_this.条码索引_记录[条码]
- &&!(await _this.is条码存在于WMS(条码)))
- ) return;
- if(Array.isArray(_this.条码索引_记录[条码])){
- _this.条码索引_记录[条码].forEach(function(inventoryMission){
- if (inventoryMission.location===库位){
- $appointInventoryList.push(inventoryMission);
- $appointInventoryList=_this.unique($appointInventoryList);
- }
- });
- $showBlueTable.removeClass('d-none');
- _this.cloneBlueTrDom($appointInventoryList);
- _this.cloneBlueTrPcDom($appointInventoryList);
- }
- },
- async 筛选库位出记录(库位){
- 库位=库位.trim();
- let _this=this;
- if(!库位)return false;
- if (!_this.库位索引_记录[库位]) return;
- if(Array.isArray(_this.库位索引_记录[库位])){
- _this.库位索引_记录[库位].forEach(function(inventoryMission){
- if (inventoryMission.location===库位){
- $appointInventoryList.push(inventoryMission);
- if ((!inventoryMission.verified_amount ||inventoryMission.verified_amount==0))$appointInventoryList.unshift(inventoryMission);
- $appointInventoryList=_this.unique($appointInventoryList);
- }
- });
- $showBlueTable.removeClass('d-none');
- _this.cloneBlueTrDom($appointInventoryList);
- _this.cloneBlueTrPcDom($appointInventoryList);
- }
- },
- unique(arr){
- return Array.from(new Set(arr));
- },
- 放置焦点光标至正确位置:_.throttle(function(){
- let _this=this;
- _this.显示盘点计数input_按情况();
- if (!$locationInput.val().trim()){
- $locationInput.focus();
- return;
- }
- if (_this.addInventoryMission){
- if (!$barcodeInput.val().trim()){
- $barcodeInput.focus();
- return;
- }
- }
- setTimeout(function(){
- if(_this.dataExtraStatus.addingNew){
- let $count = $('#amountInput');
- if (!$count.val().trim()){
- $count.focus();
- return;
- }
- }
- if ($appointInventoryList.length >0) {
- $blueTablePc.find('.blueTrPc0 input').first().focus();
- $blueTable.find('.blueTr0 input').first().focus();
- }
- },10)
- },100,{ 'trailing': false }),
- async is条码存在于WMS(条码){
- 条码=条码.trim();
- let _this=this;
- if (!条码) return false;
- if (_this.条码索引_记录[条码]) return true;
- if (_this.条码索引_记录[条码] === false) return false;
- let url = '{{url('inventory/stockInventory/searchCommodityByBarcode')}}';
- let is成功 = false;
- await axios.post(url, {
- barcode: 条码,
- owner_code: _this.inventory.owner.code
- }).then(function (response) {
- if (response.data.success) {
- is成功 = true;
- _this.条码索引_记录[条码] = {barcodeExsitingAtWMS: true};
- } else {
- _this.条码索引_记录[条码] = false;
- }
- }).catch(function (err) {
- tempTip.setDuration(2000);
- tempTip.show('网络错误' + err);
- });
- return is成功;
- },
- is条码存在于当前记录(条码) {
- 条码 = 条码.trim();
- let _this = this;
- if (!条码) return false;
- return !!_this.条码索引_记录[条码];
- },
- is库位存在于当前记录(库位) {
- 库位 = 库位.trim();
- let _this = this;
- if (!库位) return false;
- return !!_this.库位索引_记录[库位];
- },
- 提交新增并盘点:async function(){
- let _this=this;
- let inventoryId=_this.inventory.id;
- if(!_this.inputs().location.trim()|| !_this.inputs().barcode.trim() || !_this.inputs().amount.trim())return false;
- let 条码存在于当前记录 = _this.is条码存在于当前记录(_this.inputs().barcode);
- let 条码存在于WMS = await _this.is条码存在于WMS(_this.inputs().barcode);
- let 库位存在于当前记录 = _this.is库位存在于当前记录(_this.inputs().location);
- if(!条码存在于当前记录 && !条码存在于WMS)return false;
- if(库位存在于当前记录 && 条码存在于当前记录)return false;
- if(!confirm('该'+_this.inputs().barcode+'条码和'+_this.inputs().location+'库位相加的条件于WAS系统盘点记录中不存在! 是否确定需要添加至系统盘点记录中?')){return false};
- let 新增字段标记='';
- if(!库位存在于当前记录&&!条码存在于当前记录)新增字段标记='库位和商品新增';
- if(!库位存在于当前记录)新增字段标记='库位新增';
- if(!条码存在于当前记录)新增字段标记='商品新增';
- _this.增加系统之外的盘点记录(_this.inputs().location,_this.inputs().barcode,_this.inputs().amount,inventoryId,_this.inventory.owner.code,新增字段标记);
- return true;
- },
- 提交盘点:_.throttle(function(){
- let _this=this;
- let 条码=_this.inputs().barcode.trim();
- let 库位=_this.inputs().location.trim();
- let 盘点数=_this.inputs().amount.trim();
- let 选定盘点记录id=_this.selectingId;
- let isInventory=false;
- $appointInventoryList.forEach(function (inventoryMission) {
- if (inventoryMission.location === 库位) {
- if (inventoryMission.stockInventoryPersons.length > 0 && inventoryMission.id === _this.selectingId) {
- _this.lastStockInventoryRecord = inventoryMission;
- _this.stockInventoryPersons = inventoryMission.stockInventoryPersons;
- if (_this.inventory.status !== '复盘中'){
- $("#lastStockInventoryRecord").modal('show');
- isInventory=true;
- return;
- }
- }
- }
- });
- if (!isInventory){
- _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
- _this.清空指定盘点记录列();
- }
- },100,{ 'trailing': false }),
- //结束初盘任务
- stockInventoryEnd(id) {
- let _this = this;
- let url = '{{url('inventory/stockInventoryEnd')}}';
- if (!confirm('确定要结束初盘任务,进入复盘吗?')) {return;}
- axios.post(url, {id: id}).then(function (response) {
- if (!response.data.success) {
- tempTip.setDuration(2000);
- tempTip.show('结束初盘失败!' + ' ' + response.data.data);
- } else {
- _this.inventory.status = response.data.data;
- tempTip.setDuration(2000);
- tempTip.showSuccess('结束初盘,进入复盘!');
- }
- }).catch(function (err) {
- tempTip.setDuration(2000);
- tempTip.show('结束初盘失败!' + '网络错误' + err);
- })
- },
- updateQuality(id, location, sku, quality, ownerCode) {
- let url = '{{url('inventory/修改质量状态')}}';
- axios.post(url, {
- id: id,
- location: location,
- sku: sku,
- quality: quality,
- ownerCode: ownerCode
- }).then(function (response) {
- if (!response.data.success) {
- tempTip.setDuration(3000);
- tempTip.show('修改质量状态失败!' + ' ' + response.data.data);
- } else {
- tempTip.setDuration(2000);
- tempTip.showSuccess('修改质量状态成功!');
- }
- }).catch(function (err) {
- tempTip.setDuration(2000);
- tempTip.show('修改质量状态失败!' + '网络错误' + err);
- })
- },
- 重排序并标记全列表类型() {
- let _this = this;
- _this.已复盘有差异列 = [];
- _this.未复盘有差异列 = [];
- _this.已复盘无差异列 = [];
- _this.确认差异列=[];
- _this.无差异列 = [];
- _this.未盘列 = [];
- _this.跳过列 = [];
- _this.未盘列总 = [];
- _this.未盘列1 = [];
- _this.未盘列2 = [];
- _this.inventoryMissions.forEach(function (mission, i) {
- switch (mission.checked) {
- case '已复核':
- if (parseInt(mission.difference_amount)) {
- _this.已复盘有差异列.push(mission);
- mission.mark = '已复盘有差异';
- return;
- }
- _this.已复盘无差异列.push(mission);
- mission.mark = '已复盘无差异';
- return;
- case '是':
- if (parseInt(mission.difference_amount)) {
- _this.未复盘有差异列.push(mission);
- mission.mark = '未复盘有差异';
- return;
- }
- _this.无差异列.push(mission);
- mission.mark = '无差异';
- return;
- case '确认差异':
- _this.确认差异列.push(mission);
- mission.mark = '确认差异';
- return;
- case '否':
- _this.未盘列.push(mission);
- mission.mark = '未盘';
- return;
- case '跳过':
- _this.跳过列.push(mission);
- mission.mark = '跳过';
- return;
- }
- });
- _this.已复盘有差异列 = _this.按库位排序_且合并SKU一起(_this.已复盘有差异列);
- _this.未复盘有差异列 = _this.按库位排序_且合并SKU一起(_this.未复盘有差异列);
- _this.已复盘无差异列 = _this.按库位排序_且合并SKU一起(_this.已复盘无差异列);
- _this.无差异列 = _this.按库位排序_且合并SKU一起(_this.无差异列);
- _this.未盘列 = _this.按库位排序_且合并SKU一起(_this.未盘列);
- if (_this.未盘列.length>0&&!_this.分割位置id) _this.分割位置id = _this.未盘列[0].id;
- _this.分割位置id = _this.更新分割位置(_this.未盘分隔列2, _this.分割位置id);
- _this.未盘分隔列 = _this.分隔_基于分割位置(_this.未盘列, _this.分割位置id);
- _this.未盘分隔列1 = _this.按库位排序_且合并SKU一起(_this.未盘分隔列[0]);
- _this.未盘分隔列2 = _this.按库位排序_且合并SKU一起(_this.未盘分隔列[1]);
- _this.确认差异列 = _this.按库位排序_且合并SKU一起(_this.确认差异列);
- _this.跳过列 = _this.按库位排序_且合并SKU一起(_this.跳过列);
- _this.inventoryMissions = [];
- _this.重推入(_this.inventoryMissions, _this.已复盘有差异列);
- _this.重推入(_this.inventoryMissions, _this.未复盘有差异列);
- _this.重推入(_this.inventoryMissions, _this.未盘分隔列2);
- _this.重推入(_this.inventoryMissions, _this.未盘分隔列1);
- _this.重推入(_this.inventoryMissions, _this.确认差异列);
- _this.重推入(_this.inventoryMissions, _this.已复盘无差异列);
- _this.重推入(_this.inventoryMissions, _this.无差异列);
- _this.重推入(_this.inventoryMissions, _this.跳过列);
- },
- 更新分割位置(上次分割列, 旧分割位置id) {
- if (!上次分割列) return 旧分割位置id;
- let is不更新 = false;
- 上次分割列.some(function (行) {
- if (行.id === 旧分割位置id && 行.mark === '未盘') {
- is不更新 = true;
- return true;
- }
- });
- if (is不更新) return 旧分割位置id;
- let 新分割位置id = 旧分割位置id;
- 上次分割列.some(function (行) {
- if (行.mark !== '未盘') return false;
- 新分割位置id = 行.id;
- return true;
- });
- return 新分割位置id;
- },
- 重推入(目标数组, 推入数组) {
- 推入数组.forEach(function (元素) {
- 目标数组.push(元素);
- })
- },
- 按库位排序_且合并SKU一起(inventoryMissions) {
- let 结果列 = [];
- let 已出现字典列 = [];
- inventoryMissions.sort(function (a, b) {
- if (a.location > b.location) return 1;
- if (a.location < b.location) return -1;
- return 0;
- });
- function 迭代查重转移(目标列, 进度下标) {
- if (!进度下标) {
- 进度下标 = 0;
- }
- for (; 进度下标 < 目标列.length; 进度下标++) {
- let 目标 = 目标列[进度下标];
- if (已出现字典列[目标.commodity.barcode] === true) {
- 目标列.splice(进度下标, 1)
- let 最后一次重复下标 = -1;//为了给相同条码依次排序设定
- 结果列.some(function (结果, i) {
- if (结果.commodity.barcode === 目标.commodity.barcode) {
- 最后一次重复下标 = i;
- if (最后一次重复下标 === 结果列.length - 1) {
- 结果列.splice(最后一次重复下标 + 1, 0, 目标);
- return true;
- }
- } else if (最后一次重复下标 > -1) {
- 结果列.splice(最后一次重复下标 + 1, 0, 目标);
- return true;
- }
- return false;
- })
- 迭代查重转移(目标列, 进度下标);
- return;
- }
- 已出现字典列[目标.commodity.barcode] = true;
- 结果列.push(目标);
- }
- }
- 迭代查重转移(inventoryMissions)
- return 结果列;
- },
- 选中盘点起始位置(id,location) {
- this.分割位置id = id;
- this.重排序并标记全列表类型();
- tempTip.setDuration(2000);
- tempTip.showSuccess('已将库位:' + location + '的盘点记录设置为起始盘点记录');
- },
- 分隔_基于分割位置(未盘列,分割位置id) { // return [arr1,arr2]
- let 分割位置=null;
- 未盘列.forEach(function(行,下标){
- if(行.id===分割位置id){
- 分割位置=下标;
- }
- });
- let 未盘列1=未盘列.slice(0,分割位置);
- let 未盘列2=未盘列.slice(分割位置,未盘列.length);
- return [未盘列1,未盘列2];
- },
- 删除盘点记录(inventoryAccountMissionId, inventoryAccountId, name) {
- let _this = this;
- if (!confirm('确定要删除商品为:“' + name + '”的盘点记录吗?')) {
- return
- }
- ;
- let url = '{{url('inventory/删除盘点记录')}}';
- axios.post(url, {
- inventoryAccountMissionId: inventoryAccountMissionId,
- inventoryAccountId: inventoryAccountId
- }).then(
- function (response) {
- if (!response.data.success) {
- tempTip.setDuration(2000);
- tempTip.show('盘点单号:' + inventoryAccountMissionId + '删除失败!' + response.data.data);
- } else {
- _this.inventoryMissions.every(function (inventoryAccountMission, i) {
- if (response.data.data > 0 && inventoryAccountMission.id === inventoryAccountMissionId) {
- _this.inventoryMissions.splice(i, 1);
- return false;
- }
- return true
- });
- tempTip.setDuration(2000);
- tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '删除成功!');
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('删除失败,网络链接错误!' + err);
- });
- },
- 跳过盘点记录(inventoryAccountMissionId, inventoryAccountId, name) {
- let _this = this;
- if (!confirm('确定要跳过商品为:“' + name + '”的盘点记录吗?')) {return ;}
- let url = '{{url('inventory/跳过盘点记录')}}';
- axios.post(url, {
- inventoryAccountMissionId: inventoryAccountMissionId,
- inventoryAccountId: inventoryAccountId
- }).then(
- function (response) {
- if (!response.data.success) {
- tempTip.setDuration(3000);
- tempTip.show('盘点单号:' + inventoryAccountMissionId + '跳过盘点失败!' + response.data.data);
- } else {
- _this.inventoryMissions.every(function (inventoryAccountMission) {
- if (inventoryAccountMission.id === inventoryAccountMissionId) {
- inventoryAccountMission.checked = response.data.inventoryAccountMission.checked;
- return false;
- }
- return true
- });
- }
- _this.重排序并显示();
- tempTip.setDuration(3000);
- tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '跳过盘点成功!');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('跳过盘点记录失败,网络链接错误!' + err);
- });
- },
- 确认盘点差异(inventoryAccountMissionId, inventoryAccountId, name) {
- let _this = this;
- if (!confirm('确定提交商品为:“' + name + '”的盘点差异吗?')) {return ;}
- let url = '{{url('inventory/确认盘点差异')}}';
- axios.post(url, {
- inventoryAccountMissionId: inventoryAccountMissionId,
- inventoryAccountId: inventoryAccountId
- }).then(
- function (response) {
- if (!response.data.success) {
- tempTip.setDuration(3000);
- tempTip.show('盘点单号:' + inventoryAccountMissionId + '提交盘点差异失败!' + response.data.data);
- } else {
- _this.inventoryMissions.every(function (inventoryAccountMission) {
- if (inventoryAccountMission.id === inventoryAccountMissionId) {
- inventoryAccountMission.checked = response.data.inventoryAccountMission.checked;
- return false;
- }
- return true
- });
- }
- _this.重排序并显示();
- tempTip.setDuration(3000);
- tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '提交盘点差异成功!');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('提交盘点差异记录失败,网络链接错误!' + err);
- });
- },
- 批量跳过或确认差异(){
- let _this = this;
- if (!confirm('确定对勾选内容进行批量操作吗?')) {return ;}
- let url = '{{url('inventory/批量跳过或确认差异')}}';
- axios.post(url, {checkData: _this.checkData}).then(
- function (response) {
- if (!response.data.success) {
- tempTip.setDuration(3000);
- tempTip.show('批量操作失败!' + response.data.data);
- } else {
- response.data.inventoryAccountMissions.forEach(function (mission) {
- _this.库位索引_记录[mission.location].forEach(function(missionInIndex){
- if(parseInt(missionInIndex.id)===parseInt(mission.id)){
- missionInIndex.checked=mission.checked;
- }
- });
- });
- }
- _this.重排序并显示();
- _this.清空checkbox();
- tempTip.setDuration(3000);
- tempTip.showSuccess('批量操作成功!');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('批量操作失败,网络链接错误!' + err);
- });
- },
- 重排序并显示(){
- let _this=this;
- _this.显示记录列=[];
- _this.重排序并标记全列表类型(_this.inventoryMissions);
- _this.加载下方数据并置空上方数据();
- },
- 完结盘点任务(id, owner_name, type) {
- if (!confirm('确定完结货主为:“' + owner_name + '”的“' + type + '”任务吗?')) {
- return;
- }
- let url = '{{url('inventory/完结盘点任务')}}/' + id;
- axios.get(url).then(function (response) {
- if (!response.data.success) {
- tempTip.setDuration(3000);
- tempTip.show('修改完结状态失败!');
- } else {
- if (response.data.data.id === id) {
- tempTip.setDuration(3000);
- tempTip.showSuccess('货主为:“' + owner_name + '”的“' + type + '”任务完结成功');
- window.setTimeout(function () {
- window.location.href = '{{url('inventory/stockInventory/mission')}}';
- }, 1000);
- }
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('修改完结状态失败! ' + err);
- })
- },
- 增加系统之外的盘点记录(location, barcode, count, inventoryId, owner_code, param) {
- let _this = this;
- let url = '{{url('inventory/增加系统之外的盘点记录')}}';
- axios.post(url, {location:location,barcode:barcode,count:count,inventoryId:inventoryId,owner_code:owner_code,param:param}).then(
- function (response) {
- if (!response.data.success) {
- tempTip.setDuration(3000);
- tempTip.show('增加系统之外的盘点记录失败!');
- } else {
- let inventoryAccountMission=response.data.inventoryAccountMission;
- inventoryAccountMission.commodity_barcodes = response.data.inventoryAccountMission.commodity.barcodes;
- inventoryAccountMission.commodity_name = response.data.inventoryAccountMission.commodity.name;
- inventoryAccountMission.stockInventoryPersons = response.data.stockInventoryPersons;
- inventoryAccountMission.produced_at = '';
- inventoryAccountMission.valid_at = '';
- _this.inventoryMissions.push(inventoryAccountMission);
- inventoryAccountMission.commodity_barcodes.forEach(function(barcode){
- if(!Array.isArray(_this.条码索引_记录[barcode.code])) _this.条码索引_记录[barcode.code]=[];
- _this.条码索引_记录[barcode.code].push(inventoryAccountMission);
- });
- if(!Array.isArray(_this.库位索引_记录[location])) _this.库位索引_记录[location]=[];
- _this.库位索引_记录[location].push(inventoryAccountMission);
- _this.重排序并显示();
- _this.清空inputs();
- tempTip.setDuration(3000);
- tempTip.showSuccess('增加系统之外的盘点记录成功!');
- }
- }
- ).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('增加系统之外的盘点记录失败,网络链接错误!' + err);
- });
- },
- 将相邻同样条目总数匹配的标记_供样式使用(inventoryMissions) {
- for (let i = 0; i < inventoryMissions.length; i++) {
- let 相同条码组 = [];
- function 抽出紧邻相同条码(起始下标) {
- let 下标B = 起始下标 + 1;
- if (下标B >= inventoryMissions.length) return;
- if (inventoryMissions[起始下标].commodity.barcode === inventoryMissions[下标B].commodity.barcode) {
- if (相同条码组.length <= 1 || 相同条码组[相同条码组.length - 1].id !== inventoryMissions[起始下标].id) {
- 相同条码组.push(inventoryMissions[起始下标]);
- }
- 相同条码组.push(inventoryMissions[下标B]);
- return 抽出紧邻相同条码(下标B);
- }
- return 下标B;
- }
- i = 抽出紧邻相同条码(i);
- let 库存总数 = 0;
- let 实盘总数 = 0;
- 相同条码组.forEach(function (目标) {
- 库存总数 += 目标.stored_amount;
- 实盘总数 += 目标.verified_amount;
- })
- if (库存总数 === 实盘总数)
- 相同条码组.forEach(function (目标) {
- 目标.hasLinkingGroup = true;
- })
- }
- ;
- },
- 清理标记(mission) {
- mission.hasLinkingGroup = false;
- },
- 盘点(id, location, barcode, inventoryId, count) {
- let _this = this;
- let url = '{{url('inventory/stockInventory')}}';
- axios.post(url, {id:id,location:location,barcode:barcode,count:count,inventoryId:inventoryId})
- .then(function (response) {
- if (!response.data.success) {
- tempTip.setDuration(2000);
- tempTip.show('盘点失败!' + ' ' + response.data.data);
- return;
- }
- if (_this.inventory.id === response.data.inventory.id) {
- _this.inventory.processed = response.data.inventory.processed;
- _this.inventory.surplus = response.data.inventory.surplus;
- _this.inventory.check_surplus = response.data.inventory.check_surplus;
- }
- _this.inventoryMissions.every(function (inventoryMission, i) {
- if (parseInt(inventoryMission.id) === parseInt(response.data.inventoryMission.id)) {
- inventoryMission.checked = response.data.inventoryMission.checked;
- inventoryMission.verified_amount = response.data.inventoryMission.verified_amount;
- inventoryMission.difference_amount = response.data.inventoryMission.difference_amount;
- inventoryMission.re_checked_amount = response.data.inventoryMission.re_checked_amount;
- inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
- _this.inventoryMissions.splice(i, 1)
- _this.inventoryMissions.unshift(inventoryMission);
- return false;
- }
- return true;
- });
- _this.重排序并显示();
- if (response.data.inventoryMission.difference_amount!=0){_this.初盘有盘点差异_确认是否重盘();}
- if (response.data.inventoryMission.difference_amount==0){
- _this.清空inputs();
- tempTip.setDuration(3000);
- tempTip.showSuccess('盘点成功!');
- _this.放置焦点光标至正确位置();
- }
- }).catch(function (err) {
- tempTip.setDuration(2000);
- tempTip.show('盘点失败!' + '网络错误' + err);
- })
- },
- 初盘有盘点差异_确认是否重盘(){
- let _this=this;
- tempTip.confirm('<p class="text-danger">'+"当前盘点数量存在差异,是否重盘当前盘点记录?"+'</p>',function () {
- _this.放置焦点光标至正确位置();
- _this.提交库位和条码();
- },
- function () {
- _this.清空inputs();
- _this.放置焦点光标至正确位置();
- tempTip.setDuration(3000);
- tempTip.showSuccess('盘点成功!');
- },'是','否')
- },
- 清空inputs(){
- $locationInput.val('');
- $barcodeInput.val('');
- $amountInput.val('');
- for(let key in this.inputs()){
- this.inputs()[key]='';
- }
- },
- 清空checkbox(){
- this.checkData=[];
- },
- 不覆盖() {
- let _this = this;
- _this.清空指定盘点记录列();
- _this.清空inputs();
- },
- 覆盖(){
- let _this=this;
- let location=_this.inputs().location.trim();
- let barcode=_this.inputs().barcode.trim();
- let inventoryId=_this.inventory.id;
- let count=_this.inputs().amount.trim();
- let id=_this.selectingId;
- _this.清空指定盘点记录列();
- this.盘点(id, location, barcode, inventoryId, count);
- },
- 盘点选中任务(e){
- let _this=this;
- let id = $(e.target).attr('data_id');
- let inventoryId=_this.inventory.id;
- let count=_this.inputs().amount.trim();
- let produced_at=_this.inputs().produced_at.trim();
- let valid_at=_this.inputs().valid_at.trim();
- let batch_number=_this.inputs().batch_number.trim();
- let url = '{{url('inventory/盘点选中任务')}}';
- axios.post(url, {id:id,count:count,inventoryId:inventoryId,produced_at:produced_at,valid_at:valid_at,batch_number:batch_number}).then(function (response) {
- if (!response.data.success) {
- tempTip.setDuration(2000);
- tempTip.show('盘点失败!' + ' ' + response.data.data);
- return;
- }else {
- if (_this.inventory.id === response.data.inventory.id) {
- _this.inventory.processed = response.data.inventory.processed;
- _this.inventory.surplus = response.data.inventory.surplus;
- _this.inventory.check_surplus = response.data.inventory.check_surplus;
- }
- if (response.data.inventoryMission.length >1) {
- response.data.inventoryMission.forEach(function (mission) {
- let isToEdit=false;
- let commodity_barcodes=mission.commodity_barcodes;
- _this.库位索引_记录[_this.inputs().location.trim()].every(function (inventoryMission){
- if (parseInt(inventoryMission.id) === parseInt(mission.id)){
- isToEdit=true;
- inventoryMission.checked = mission.checked;
- inventoryMission.verified_amount = mission.verified_amount;
- inventoryMission.difference_amount =mission.difference_amount;
- inventoryMission.re_checked_amount = mission.re_checked_amount;
- inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
- return false;
- }
- return true;
- })
- if (!isToEdit){
- mission.commodity_barcodes= commodity_barcodes;
- mission.stockInventoryPersons=response.data.stockInventoryPersons;
- _this.inventoryMissions.push(mission);
- }
- });
- }else {
- _this.库位索引_记录[_this.inputs().location.trim()].every(function (inventoryMission,i) {
- if (parseInt(inventoryMission.id) === parseInt(response.data.inventoryMission.id)){
- inventoryMission.checked = response.data.inventoryMission.checked;
- inventoryMission.verified_amount = response.data.inventoryMission.verified_amount;
- inventoryMission.difference_amount = response.data.inventoryMission.difference_amount;
- inventoryMission.re_checked_amount = response.data.inventoryMission.re_checked_amount;
- inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
- _this.inventoryMissions.splice(i, 1);
- _this.inventoryMissions.unshift(inventoryMission);
- return false;
- }
- return true;
- })
- }
- _this.重排序并显示();
- _this.清空inputs();
- _this.清空指定盘点记录列();
- tempTip.setDuration(3000);
- tempTip.showSuccess('盘点成功!');
- }
- }).catch(function (err) {
- tempTip.setDuration(2000);
- tempTip.show('盘点失败!' + '网络错误' + err);
- })
- },
- inventoryAccountMissionExport(checkAllSign) {
- let url = '{{url('inventory/stockInventory/inventoryAccountMission/export')}}';
- let token = '{{ csrf_token() }}';
- let allData = [];
- if (checkAllSign) {
- allData = JSON.stringify(this.inventoryMissions);
- let allData1 = JSON.parse(allData);
- allData1.forEach(function (inventoryMission) {
- if (inventoryMission.stock_persons.length > 0) inventoryMission.stock_person = inventoryMission.stock_persons[inventoryMission.stock_persons.length - 1].name;
- if (inventoryMission.stock_persons.length<1) inventoryMission.stock_person='';
- delete inventoryMission.commodity_barcodes;
- delete inventoryMission.stock_persons;
- delete inventoryMission.stockInventoryPersons;
- delete inventoryMission.commodity;
- });
- let data = JSON.stringify(allData1);
- excelExport(false,data,url,this.sum,token);
- } else {
- this.checkData.forEach(function (inventoryMission) {
- if (inventoryMission.stock_persons.length > 0) inventoryMission.stock_person = inventoryMission.stock_persons[inventoryMission.stock_persons.length - 1].name;
- if (inventoryMission.stock_persons.length <1) inventoryMission.stock_person='';
- delete inventoryMission.commodity_barcodes;
- delete inventoryMission.stock_persons;
- delete inventoryMission.stockInventoryPersons;
- delete inventoryMission.commodity;
- });
- let data = JSON.stringify(this.checkData);
- excelExport(checkAllSign,data,url,this.sum,token);
- }
- },
- stockInventoryByLocation(){
- let _this=this;
- let inventoryId=_this.inventory.id;
- let difference=[];
- let trPc = $("#blueTablePc tr:gt(1)").get();
- let tr = $("#blueTable tr:gt(0)").get();
- $(trPc).each(function(item,key){
- input = $(key).find('.blueAmountPc');
- let obj=new Object();
- obj.id=input.attr('data_id');
- obj.stored_amount=input.attr('stored_amount');
- obj.amount=input.val();
- if (input.val()) _this.库位盘点记录.push(obj);
- });
- $(tr).each(function(item,key){
- input = $(key).find('.blueAmount');
- let obj=new Object();
- obj.id=input.attr('data_id');
- obj.stored_amount=input.attr('stored_amount');
- obj.amount=input.val();
- if (input.val()) _this.库位盘点记录.push(obj);
- });
- let url = '{{url('inventory/stockInventory/batchStockByLocation')}}';
- axios.post(url,{mission:_this.库位盘点记录,inventoryId:inventoryId}).then(function(response){
- if (!response.data.success) {
- tempTip.setDuration(2000);
- tempTip.show('盘点失败!' + ' ' + response.data.msg);
- return;
- }else {
- if (_this.inventory.id === response.data.inventory.id) {
- _this.inventory.processed = response.data.inventory.processed;
- _this.inventory.surplus = response.data.inventory.surplus;
- _this.inventory.check_surplus = response.data.inventory.check_surplus;
- }
- response.data.inventoryMission.forEach(function (mission) {
- if(mission.difference_amount>0) difference.push(mission.commodity.barcodes[0].code);
- _this.inventoryMissions.every(function (inventoryMission,i){
- if (parseInt(inventoryMission.id) === parseInt(mission.id)){
- inventoryMission.checked = mission.checked;
- inventoryMission.verified_amount = mission.verified_amount;
- inventoryMission.difference_amount =mission.difference_amount;
- inventoryMission.re_checked_amount = mission.re_checked_amount;
- inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
- _this.inventoryMissions.splice(i, 1);
- _this.inventoryMissions.unshift(inventoryMission);
- return false;
- }
- return true;
- })
- });
- _this.重排序并显示();
- _this.清空inputs();
- _this.清空指定盘点记录列();
- tempTip.setDuration(5000);
- if (difference.length>0){
- tempTip.show('给库位下:条码为'+difference+'存在差异,如需重盘请针对该条码重新盘点!');
- difference=[];
- }else {
- tempTip.showSuccess('盘点成功!');
- }
- }
- }).catch(function (err) {
- tempTip.setDuration(2000);
- tempTip.show('盘点失败!' + '网络错误' + err);
- })
- },
- 新增盘点记录(){
- let _this=this;
- _this.addInventoryMission=true;
- _this.清空指定盘点记录列();
- },
- 收起新增(){
- let _this=this;
- _this.addInventoryMission=false;
- _this.清空指定盘点记录列();
- },
- 盲收(){
- let _this=this;
- _this.blindReceive=true;
- _this.scanListening();
- },
- 正常盘点(){
- let _this=this;
- _this.blindReceive=false;
- $(document).off('keypress');
- },
- changeToManualInputAmount:function(){
- this.status.amountDisable=false;
- this.isManualInputtingAmount=true;
- $('#amountLabel').text('输入数量:');
- },
- changeToScanInputAmount:function(){
- this.status.amountDisable=true;
- this.isManualInputtingAmount=false;
- $('#amountLabel').text('自动扫入数量:');
- },
- changeToManualInputBarcode:function(){
- this.status.barcodeDisable=false;
- this.isManualInputtingBarcode=true;
- $('#barcode').attr('placeholder','手工输入条码');
- },
- changeToScanInputBarcode:function(){
- let data = this;
- this.isManualInputtingBarcode=false;
- this.inputting.barcode='';
- let $barcode = $('#barcode');
- this.status.barcodeDisable=false;
- setTimeout(function () {
- $barcode.focus();
- data.status.barcodeDisable=true;
- },20);
- $barcode.attr('placeholder','扫入条码');
- },
- oninputEnter:function(e){
- if (e.key === 'Enter') {
- this.focusDocument();
- }
- },
- focusDocument: function () {
- this.focusing = 'document';
- this.showCommitButton();
- },
- focusOutDocument: function () {
- this.focusing = '';
- this.autoFillBin();
- },
- scanListening: function () {
- let data = this;
- $(document).on('keypress', function (e) {
- if(data.focusing!=='document'){return}
- if(data.isManualInputtingBarcode){return}
- if (e.keyCode !== 13) {
- if(data.status.scanEndInputted){
- data.lastScannedBarcode=data.inputting.barcode;
- data.inputting.barcode='';
- data.status.scanEndInputted=false;
- }
- data.inputting.barcode += String.fromCharCode(e.keyCode);
- } else {
- if(data.inputting.barcode.length<=1){
- window.tempTip.setDuration(4500);
- window.tempTip.show('未扫入条码,请检查扫码枪设置,尝试调至“直接键盘输出”模式');
- return;
- }
- data.status.scanEndInputted = true;
- data.showCommitButton();
- data.autoFillBin();
- switch(data.inputMode){
- case 'increasing': data.commitGoodsOnIncreasingMode();break;
- case 'multiIncreasing': data.commitGoodsOnMultiIncreasingMode();break;
- }
- }
- });
- },
- commitGoodsOnIncreasingMode: function () {
- let data = this;
- function doIt(){
- let repeatedBarcode=data.repeatedIncreasingBarcodeFromSaved();
- function increase(){
- data.inputting.bin=repeatedBarcode.bin;
- repeatedBarcode.amount++;
- data.inputting.amount=repeatedBarcode.amount;
- window.tempTip.setDuration(500);
- window.tempTip.showSuccess(repeatedBarcode.amount);
- data.focusDocument();
- data.audioDing();
- }
- if(!repeatedBarcode){
- data.focusOutDocument();
- data.alertVibrate();
- window.tempTip.setInputType('number');
- data.inputting.amount=1;
- data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
- data.status.binDisable=true;
- window.tempTip.setDuration(500);
- window.tempTip.showSuccess('保存成功');
- data.focusDocument();
- data.audioDing();
- }else{
- increase();
- }
- }
- if(data.lastScannedBarcode!==data.inputting.barcode && data.lastScannedBarcode){
- data.audioWarning_otherBarcode();
- data.focusOutDocument();
- window.tempTip.confirm('扫到其它条码,是否切换至新条码并记录?',doIt,function () {
- data.inputting.barcode=data.lastScannedBarcode;
- data.focusDocument();
- })
- }else{
- doIt()
- }
- },
- commitGoodsOnMultiIncreasingMode: function () {
- let data = this;
- let repeatedBarcode=this.repeatedIncreasingBarcodeFromSaved();
- function increase(){
- data.inputting.bin=repeatedBarcode.bin;
- repeatedBarcode.amount++;
- data.inputting.amount=repeatedBarcode.amount;
- window.tempTip.setDuration(500);
- window.tempTip.showSuccess(repeatedBarcode.amount);
- data.focusDocument();
- data.audioDing();
- }
- if(!repeatedBarcode){
- data.focusOutDocument();
- data.alertVibrate();
- window.tempTip.setInputType('number');
- data.inputting.amount=1;
- data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
- data.status.binDisable=true;
- window.tempTip.setDuration(500);
- window.tempTip.showSuccess('保存成功');
- data.focusDocument();
- data.audioDing();
- }else{
- increase();
- }
- },
- audioWarning_otherBarcode: function () {
- let audio = document.getElementById('soundWarning');
- audio.currentTime = 0;//重新播放
- if(audio.paused){
- audio.play();// 播放
- }
- this.alertVibrate();
- },
- audioDing: function () {
- let audio = document.getElementById('soundDing');
- audio.currentTime = 0;//重新播放
- audio.play();// 播放
- function startVibrate(duration) {
- if (navigator.vibrate) {
- navigator.vibrate(duration);
- } else if (navigator.webkitVibrate) {
- navigator.webkitVibrate(duration);
- }
- }
- startVibrate(500);
- },
- alertVibrate: function () {
- function startVibrate(duration) {
- if (navigator.vibrate) {
- navigator.vibrate(duration);
- } else if (navigator.webkitVibrate) {
- navigator.webkitVibrate(duration);
- }
- }
- let vibrateInterval = setInterval(function() {
- startVibrate(150);
- }, 50);
- setTimeout(function() {
- clearInterval(vibrateInterval)
- }, 2000);
- },
- autoFillBin: function () {
- let data = this;
- let isNotRepeatingBarcode=this.goodses.every(function(goods){
- if(goods.barcode===data.inputting.barcode){
- data.inputting.bin=goods.bin;
- data.status.binDisable=true;
- return false;
- }
- return true;
- });
- if(isNotRepeatingBarcode){
- data.status.binDisable=false;
- }
- },
- repeatedIncreasingBarcodeFromSaved: function () {
- let data = this;
- let repeatedGoods=null;
- data.goodses.every(function(goods){
- if(goods.barcode===data.inputting.barcode && goods.fromIncreasing){
- repeatedGoods=goods;
- return false;
- }
- return true;
- });
- return repeatedGoods;
- },
- commitGoods: function () {
- let data = this;
- window.tempTip.setDuration(3500);
- if(!data.inputting.barcode){window.tempTip.show('请扫入条码');return;}
- else if(!data.inputting.amount){window.tempTip.show('请输入数量');return;}
- //else if(!data.inputting.bin){window.tempTip.show('请输入隔口号');return;}
- data.recordOrPlusGoods();
- window.tempTip.setDuration(1500);
- window.tempTip.showSuccess('成功提交:' + data.inputting.barcode);
- data.cleanInputs();
- data.audioDing();
- },
- cleanInputs: function () {
- this.changeToScanInputBarcode();
- this.inputting.barcode='';
- this.inputting.amount='';
- this.inputting.bin='';
- this.inputting.produce_date='';
- this.inputting.valid_date='';
- this.inputting.batch_number='';
- this.commitButtonVisible=false;
- this.status.binDisable=false;
- this.lastScannedBarcode='';
- },
- recordOrPlusGoods: function () {
- let data = this;
- if(this.inputMode==='regular'){
- data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
- return;
- }
- let isNotRepeating=data.goodses.every(function(goods){
- if(goods.barcode===data.inputting.barcode){
- goods.amount=parseInt(goods.amount)+parseInt(data.inputting.amount);
- return false;
- }
- return true;
- });
- if(isNotRepeating){
- data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
- }
- },
- removeGoods: function ($e,barcode) {
- if(!confirm('确定要删除条码为'+barcode+'的记录吗'))return;
- let data = this;
- data.goodses.every(function(goods,i){
- if(goods.barcode===barcode){
- data.goodses.splice(i,1)
- return false;
- }
- return true;
- })
- },
- showCommitButton: function () {
- let data = this;
- if(data.inputting.barcode && data.inputting.amount /*&& data.inputting.bin*/){
- data.commitButtonVisible=true;
- }else{
- if (this.inputMode==='regular' && this.status.barcodeDisable && !this.inputting.amount && this.inputting.barcode){
- this.focusing = '';
- document.getElementById('amount').focus();
- }
- }
- },
- submitStockInventory: function () {
- let data = this;
- data.focusOutDocument();
- if(data.goodses.length===0){
- window.tempTip.show('请先录入数据再提交盘点');return;
- }
- if(!data.location){
- window.tempTip.setDuration(1500);
- window.tempTip.show('库位为必填项');
- return;
- }
- window.tempTip.confirm('请检查表格,确定全部完成。提交后数据将全部清空,不能后退',
- function () {
- let url='{{url("inventory/stockInventory/baseOnBlindReceive")}}';
- axios.post(url,{'location':data.location,'goodses':data.goodses,'inventoryId':data.inventory.id,'owner_code':data.inventory.owner.code})
- .then(function(response){
- if(response.data.success){
- data.goodses=[];
- data.cleanInputs();
- window.tempTip.cancelWaitingTip();
- if (data.inventory.id === response.data.inventory.id) {
- data.inventory.processed = response.data.inventory.processed;
- data.inventory.surplus = response.data.inventory.surplus;
- data.inventory.check_surplus = response.data.inventory.check_surplus;
- }
- if (response.data.inventoryMissions.length >0) {
- response.data.inventoryMissions.forEach(function (mission) {
- let isToEdit=false;
- data.inventoryMissions.every(function (inventoryMission){
- if (parseInt(inventoryMission.id) === parseInt(mission.id)){
- isToEdit=true;
- inventoryMission.checked = mission.checked;
- inventoryMission.verified_amount = mission.verified_amount;
- inventoryMission.difference_amount =mission.difference_amount;
- inventoryMission.re_checked_amount = mission.re_checked_amount;
- inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
- return false;
- }
- return true;
- })
- if (!isToEdit){
- mission.commodity_barcodes = mission.commodity.barcodes;
- mission.stockInventoryPersons=response.data.stockInventoryPersons;
- data.inventoryMissions.push(mission);
- }
- });
- }
- data.重排序并标记全列表类型(data.inventoryMissions);
- window.tempTip.setDuration(1500);
- window.tempTip.showSuccess('盲收盘点成功,可返回盘点页面查看');
- data.location='';
- data.focusDocument();
- }else{
- window.tempTip.setDuration(1500);
- window.tempTip.show('盲收盘点失败:'+response.data.fail_info);
- data.focusDocument();
- data.alertVibrate()
- }
- })
- .catch(function (err) {
- window.tempTip.setDuration(3500);
- window.tempTip.show('网络或系统错误,请将以下信息提交给开发者:'+err);
- data.alertVibrate();
- });
- },function () {
- data.focusDocument();
- })
- }
- },
- computed: {
- borderByMode: function () {
- return {
- // 'border-info':this.inputMode==='regular',
- 'border-success':this.inputMode==='increasing',
- 'border-danger':this.inputMode==='multiIncreasing'
- }
- }
- }
- // 单条排序并着色(inventoryMission){
- // let _this=this;
- // let 所在临时分类列=[];
- // switch(inventoryMission.mark){
- // case '已复盘有差异':所在临时分类列=_this.已复盘有差异列;break;
- // case '已复盘无差异':所在临时分类列=_this.已复盘无差异列;break;
- // case '未复盘有差异':所在临时分类列=_this.未复盘有差异列;break;
- // case '无差异':所在临时分类列=_this.无差异列;break;
- // case '未盘':所在临时分类列=_this.未盘列;break;
- // }
- // },
- });
- </script>
- @endsection
|