123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881 |
- <template>
- <view class="app-container">
- <uni-nav-bar dark :fixed="true" shadow background-color="#007AFF" status-bar :title="formData.billTypeName"
- left-icon="left" left-text="返回" @clickLeft="handleBack"
- right-icon="refreshempty" @clickRight="SendNumEmpty"/>
- <view class="scan-header">
- <uni-forms-item name="barCode" :label="specialScanName" :label-width="lableWidth" labelAlign="right"
- style="margin-bottom: 0px; padding: 0px 15px 0px 15px;" >
- <uni-easyinput type="text" :inputBorder="true" v-model="barCode"
- :clearable="false" @confirm="scanSearch" ></uni-easyinput>
- <view class="icon" @click="handleScanClick">
- <uni-icons type="scan" size="20"></uni-icons>
- </view>
- </uni-forms-item>
- </view>
- <view class="cpck-content">
- <scroll-view :scroll-top="scrollTop" :show-scrollbar="true" scroll-y="true" class="scroll-Y">
- <view class="form-container">
- <uni-forms
- :rules="rules"
- :value="formData"
- ref="form"
- validate-trigger="submit"
- err-show-type="toast"
- >
- <!--<uni-forms-item name="billTypeCode" :required="rulesStar('billTypeCode')" v-show="fieldHidden('billTypeCode')" label="单据类型" :label-width="lableWidth" labelAlign="right">
- <uni-data-select
- v-model="formData.billTypeCode"
- :localdata="billTypeOption"
- @change="ywlxChange"
- ></uni-data-select>
- </uni-forms-item>-->
- <uni-forms-item name="taskMoveCode" :required="rulesStar('taskMoveCode')" v-show="fieldHidden('taskMoveCode')" label="任务编码" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.taskMoveCode" suffixIcon="search" @iconClick="searchIconClick('task')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="deptCodeOut" :required="rulesStar('deptCodeOut')" v-show="fieldHidden('deptCodeOut')" label="移出部门" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.deptNameOut" suffixIcon="search" @iconClick="searchIconClick('deptOut')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="deptCodeIn" :required="rulesStar('deptCodeIn')" v-show="fieldHidden('deptCodeIn')" label="移入部门" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.deptNameIn" suffixIcon="search" @iconClick="searchIconClick('deptIn')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="employeeCodeOut" :required="rulesStar('employeeCodeOut')" v-show="fieldHidden('employeeCodeOut')" label="移出职员" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.employeeNameOut" suffixIcon="search" @iconClick="searchIconClick('emplOut')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="employeeCodeIn" :required="rulesStar('employeeCodeIn')" v-show="fieldHidden('employeeCodeIn')" label="移入职员" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.employeeNameIn" suffixIcon="search" @iconClick="searchIconClick('emplIn')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="warehouseCodeOut" :required="rulesStar('warehouseCodeOut')" v-show="fieldHidden('warehouseCodeOut')" label="移出仓库" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.warehouseNameOut" suffixIcon="search" @iconClick="searchIconClick('wareOut')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="warehouseCodeIn" :required="rulesStar('warehouseCodeIn')" v-show="fieldHidden('warehouseCodeIn')" label="移入仓库" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.warehouseNameIn" suffixIcon="search" @iconClick="searchIconClick('wareIn')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="extendCode01" :required="rulesStar('extendCode01')" v-show="fieldHidden('extendCode01')" label="出库类别" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.extendName01" suffixIcon="search" @iconClick="searchIconClick('ext01')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="extendCode02" :required="rulesStar('extendCode02')" v-show="fieldHidden('extendCode02')" label="入库类别" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.extendName02" suffixIcon="search" @iconClick="searchIconClick('ext02')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="customerCodeIn" :required="rulesStar('customerCodeIn')" v-show="fieldHidden('customerCodeIn')" label="移入客户" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.customerNameIn" suffixIcon="search" @iconClick="searchIconClick('custIn')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="extendCode03" :required="rulesStar('extendCode03')" v-show="fieldHidden('extendCode03')" label="要货单号" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" @focus="specialScan('看板')" @blur="specialScan(false)"
- :styles="styleInput" :inputBorder="true" v-model="formData.extendName03">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="extendCode04" :required="rulesStar('extendNCode04')" v-show="fieldHidden('extendCode04')" label="审核人" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.extendName04" suffixIcon="search" @iconClick="searchIconClick('ext04')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="extendCode05" :required="rulesStar('extendCode05')" v-show="fieldHidden('extendCode05')" label="发货时间" :label-width="lableWidth" labelAlign="right">
- <uni-datetime-picker type="datetime" v-model="formData.extendCode05" placeholder="年-月-日 --:--" :hideSecond="true"/>
- </uni-forms-item>
-
- <uni-forms-item name="locationCodeOut" :required="rulesStar('locationCodeOut')" v-show="isLabelScan && fieldHidden('locationCodeOut')" label="移出货位" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.locationNameOut" :suffixIcon="formData.labelCode ? 'search' : ''" @iconClick="searchIconClick('locaOut')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="locationCodeIn" :required="rulesStar('locationCodeIn')" v-show="fieldHidden('locationCodeIn')" label="移入货位" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.locationNameIn" suffixIcon="search" @iconClick="searchIconClick('locaIn')">
- </uni-easyinput>
- </uni-forms-item>
- <template v-show="isLabelScan">
- <uni-forms-item name="labelCode" :required="rulesStar('labelCode')" v-show="fieldHidden('labelCode')" label="标签编码" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.labelCode" suffixIcon="compose" @iconClick="searchIconClick('Label')"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="materialCode" :required="rulesStar('materialCode')" v-show="fieldHidden('materialCode')" label="物料" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.materialName">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="batch" :required="rulesStar('batch')" v-show="fieldHidden('batch')" label="批号" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true" v-model="formData.batch"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="palletCodeOut" :required="rulesStar('palletCodeOut')" v-show="isLabelScan && fieldHidden('palletCodeOut')" label="调出托盘" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true" v-model="formData.palletCodeOut" >
- </uni-easyinput>
- </uni-forms-item>
- </template>
- <uni-forms-item name="palletCodeIn" :required="rulesStar('palletCodeIn')" v-show="fieldHidden('palletCodeIn')" label="调入托盘" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.palletCodeIn" suffixIcon="search" @iconClick="searchIconClick('pallIn')">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="packageCodeOut" :required="rulesStar('packageCodeOut')" v-show="isLabelScan && fieldHidden('packageCodeOut')" label="调出包装" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.packageCodeOut"></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="packageCodeIn" :required="rulesStar('packageCodeIn')" v-show="fieldHidden('packageCodeIn')" label="调入包装" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true"
- v-model="formData.packageCodeIn" suffixIcon="search" @iconClick="searchIconClick('packIn')"></uni-easyinput>
- </uni-forms-item>
- <template v-show="isLabelScan">
- <uni-forms-item name="unitCode" :required="rulesStar('unitCode')" v-show="fieldHidden('unitCode')" label="单位" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true" v-model="formData.unitName">
- </uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="stockQty" :required="rulesStar('stockQty')" v-show="fieldHidden('stockQty')" label="数量" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="number" :inputBorder="true"
- v-model="formData.stockQty" @input="bqslInputHandle" ></uni-easyinput>
- </uni-forms-item>
- <uni-forms-item name="rwQty" :required="rulesStar('rwQty')" v-show="fieldHidden('rwQty')" label="任务数量" :label-width="lableWidth" labelAlign="right">
- <uni-easyinput type="text" :disabled="true" :styles="styleInput" :inputBorder="true" v-model="formData.rwQty"></uni-easyinput>
- </uni-forms-item>
- </template>
- <uni-card v-for="(item, index) in labelList" :key="index">
- <text class="uni-body" style="font-size: 16px;">
- <p><span class="titleV">标签:</span><span class="detailV">{{item.labelCode}}</span></p>
- <p><span class="titleV">物料:</span><span class="detailV">{{item.materialCode}}</span></p>
- <p><span class="titleV">单位:</span><span class="detailV">{{item.unitCode}}</span></p>
- <p><span class="titleV">批次:</span><span class="detailV">{{item.batch}}</span></p>
- <p v-if="item.batch1"><span class="titleV">批次1:</span><span class="detailV">{{item.batch1}}</span></p>
- <p v-if="item.batch2"><span class="titleV">批次2:</span><span class="detailV">{{item.batch2}}</span></p>
- <p v-if="item.tasksQty>=0">
- <span class="titleV">任务数量:</span>
- <span class="detailV">
- {{item.tasksQty}}<template v-if="sumlabelList[item.materialCode] && item.tasksQty-sumlabelList[item.materialCode]<0">(超任务{{item.tasksQty - sumlabelList[item.materialCode]}})</template>
- </span>
- </p>
- </text>
- <view slot="actions" class="card-actions">
- <view class="card-actions-item" @click="delLabelList(index)">
- <uni-icons type="closeempty" size="18" color="#999"></uni-icons>
- </view>
- <view class="card-actions-item">
- <uni-number-box :min="0" :max="item.maxQty" :value="item.stockQty"
- @change="labelListQtyChange(item, $event)" />
- </view>
- </view>
- </uni-card>
- </uni-forms>
- </view>
- </scroll-view>
- </view>
-
- <view class="page-bottom">
- <view class="p-b-btn">
- <uni-badge class="uni-badge-left-margin" :text="mxNum" :max-num="999" absolute="rightTop" :offset="[-3, -3]" size="small">
- <view class="box"><text class="box-text" @click="handleMx">明细</text></view>
- </uni-badge>
- </view>
- <view class="p-b-btn" @click="$noMultipleClicks($noMultipleClicks(handleSave))">
- <text class="box-text" v-show="isShowSaveButton">暂存</text>
- </view>
- <view class="p-b-btn" @click="handleAuto">
- <text class="box-text">{{autoButtonTitle}}</text>
- </view>
- <view class="p-b-btn" @click="handleBack">
- <text class="box-text">返回</text>
- </view>
- </view>
-
- <scan-code />
- <!-- 明细弹窗 -->
- <MxPopup ref="mxPopup" @sendNum="getSendNum" :formData="formData" @sendData="getSendData"/>
- <!-- 任务清单 -->
- <RwbmPopup ref="rwbmPopup" :title="rwbmTitle" :idxFlag="rwbmFlag" :formData="formData" @sendData="getSendData" />
- <!-- 仓库 -->
- <wareOutPopup ref="wareOutPopup" :title="wareOutTitle" :idxFlag="wareOutFlag" :formData="formData" @sendData="getSendData"/>
- <wareInPopup ref="wareInPopup" :title="wareInTitle" :idxFlag="wareInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 部门 -->
- <BmOutPopup ref="bmOutPopup" :title="bmOutTitle" :idxFlag="bmOutFlag" :formData="formData" @sendData="getSendData"/>
- <BmInPopup ref="bmInPopup" :title="bmInTitle" :idxFlag="bmInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 职员 -->
- <ZyOutPopup ref="zyOutPopup" :title="zyOutTitle" :idxFlag="zyOutFlag" :formData="formData" @sendData="getSendData"/>
- <ZyInPopup ref="zyInPopup" :title="zyInTitle" :idxFlag="zyInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 出入库类型 -->
- <SflbOutPopup ref="sflbOutPopup" :title="sflbOutTitle" :idxFlag="sflbOutFlag" :formData="formData" @sendData="getSendData"/>
- <SflbInPopup ref="sflbInPopup" :title="sflbInTitle" :idxFlag="sflbInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 移入客户 -->
- <KhInPopup ref="khInPopup" :title="khInTitle" :idxFlag="khInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 托盘 -->
- <TpInPopup ref="tpInPopup" :title="tpInTitle" :idxFlag="tpInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 包装 -->
- <BzInPopup ref="bzInPopup" :title="bzInTitle" :idxFlag="bzInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 审核人 -->
- <shrPopup ref="shrPopup" :title="shrTitle" :idxFlag="shrFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 出入货位 -->
- <locaOutPopup ref="locaOutPopup" :title="locaOutTitle" :idxFlag="locaOutFlag" :formData="formData" @sendData="getSendData"/>
- <locaInPopup ref="locaInPopup" :title="locaInTitle" :idxFlag="locaInFlag" :formData="formData" @sendData="getSendData"/>
- <!-- 标签选任务子表 -->
- <selectTaskMoves ref="selectTaskMoves" title="任务选择" :formData="formData" @sendData="getSendDataTaskMoves"/>
-
- </view>
- </template>
-
- <script>
- import scanCode from "@/components/scan/scan.vue";
- import { getDicts } from "@/api/system/dict/data"; // 字典
- import RwbmPopup from './popup/commonpopup.vue' // 任务编码
- import BmOutPopup from './popup/commonpopup.vue' // 部门
- import BmInPopup from './popup/commonpopup.vue'
- import ZyOutPopup from './popup/commonpopup.vue' // 职员
- import ZyInPopup from './popup/commonpopup.vue'
- import wareOutPopup from './popup/commonpopup.vue' // 仓库
- import wareInPopup from './popup/commonpopup.vue'
- import SflbOutPopup from './popup/commonpopup.vue' // 收发类别
- import SflbInPopup from './popup/commonpopup.vue'
- import KhInPopup from './popup/commonpopup.vue' //客户
- import TpInPopup from './popup/commonpopup.vue' // 托盘
- import BzInPopup from './popup/commonpopup.vue' // 包装
- import LabelPopup from './popup/commonpopup.vue' // 标签
- import shrPopup from './popup/commonpopup.vue' // 审核人
- import locaOutPopup from './popup/commonpopup.vue' // 移出货位
- import locaInPopup from './popup/commonpopup.vue' // 移入货位
-
- import selectTaskMoves from './popup/selectTaskMoves' // 标签选任务子表
- import MxPopup from './popup/mxPopup.vue'
- import {addStockMove, checkAddStockMove, listStockMove, listLocation, listTaskMove, listCurrent, listWarehouse, listPallet, listPackage,listExtend,getMoveReviewerList,getListFieldSetting, queryBillTypeCache } from '@/api/wms/stockMove.js'
- import { listFieldDefault } from '@/api/wms/report.js'
- import storage from '@/utils/storage'
- import { nanoid } from 'nanoid'; //唯一值 nanoid
-
- export default {
- components: {
- scanCode,
- RwbmPopup,
- BmOutPopup,
- BmInPopup,
- wareOutPopup,
- wareInPopup,
- MxPopup,
- ZyOutPopup,
- ZyInPopup,
- SflbOutPopup,
- SflbInPopup,
- KhInPopup,
- shrPopup,
- TpInPopup,
- BzInPopup,
- locaOutPopup,
- locaInPopup,
- selectTaskMoves
- },
- props: {},
- async onLoad(option) {
- //下面请求如果失败改为false
- let isRequest = true;
- //字段设置
- try {
- const res = await this.retryRequest(getListFieldSetting, { billCode: "stockMove" });
- // 处理响应数据
- this.fieldSetting=res.rows;
- let obj = {"field": "billTypeCode","fieldName": "单据类型","required": null,"requiredCondition": null,"hidden": null,"hiddenCondition": null}
- obj.hidden = 1;
- this.setFieldSetting(obj);
- } catch (error) {
- isRequest = false;
- }
- //单据类型
- try {
- const res = await this.retryRequest(queryBillTypeCache, {billCode: "stockMove"});
- // 处理响应数据
- let tmpData = res.rows;
- this.billTypeOption = tmpData.filter(item => item.isEnableApp == 0 && item.status == 0)
- .map(item => ({
- billTypeCode: item.billTypeCode,
- billTypeName: item.billTypeName,
- value: item.billTypeCode,
- text: item.billTypeName,
- taskValue: item.taskBillTypeCode ? "'" + item.taskBillTypeCode.replace(/,/g, "','") + "'" : '',
- isControlTask: item.backTaskBillTypeCode ? item.isControlTask : 0,
- }));
- //触发单据类型变更
- this.ywlxChange(option.ywlx);
- } catch (error) {
- isRequest = false;
- }
-
- //审核人
- try {
- const res = await this.retryRequest(getMoveReviewerList);
- // 处理响应数据
- if(res && res.rows && res.rows[0] && res.rows[0].setDefaultSettings){
- if(res.rows[0].setDefaultSettings.settingFlag == "审核人"){
- this.formData.extendCode04 = res.rows[0].setDefaultSettings.settingCode;
- this.formData.extendName04 = res.rows[0].setDefaultSettings.settingName;
- this.formData.userids = res.rows[0].setDefaultSettings.settingValues == "" ? null : res.rows[0].setDefaultSettings.settingValues;
- }
- }
- } catch (error) {
- isRequest = false;
- }
- //任务有传参;执行扫任务
- if(option.taskCode){
- this.getScanRwList(option.taskCode);
- }
- if(isRequest==false){
- uni.showModal({
- title: '获取单据信息失败',
- content: '请返回菜单重新进入',
- showCancel: false ,//不显示取消按钮
- success: function (res) {
- if (res.confirm) {
- uni.navigateBack();
- }
- }
- })
- }else{
- this.isRequest=true
- }
-
- if(option.ywlx == 1){
- // 创建一个Date对象表示当前日期和时间
- const now = new Date();
- const year = now.getFullYear();
- const month = String(now.getMonth() + 1).padStart(2, '0');
- const date = String(now.getDate()).padStart(2, '0');
- const hours = String(now.getHours()).padStart(2, '0');
- const minutes = String(now.getMinutes()).padStart(2, '0');
- const formattedDateTime = `${year}-${month}-${date} ${hours}:${minutes}`;
- this.formData.extendCode05 = formattedDateTime;
- }
- },
- onUnload(){
- uni.removeStorageSync('stock_key');
- },
- onBackPress(options) {
- if (options.from === 'navigateBack') {
- // 来自于导航条返回按钮或者系统返回按钮的事件
- return false;
- }
- // 双击返回的逻辑
- const now = Date.now();
- if (this.lastBackPress && now - this.lastBackPress < 1000) {
- // 如果两次点击的间隔小于1000毫秒,则可以认为是双击
- //这时退出
- return false;
- } else {
- this.lastBackPress = now;
- uni.showToast({
- title: '再按一次退出',
- icon: 'none'
- });
- setTimeout(() => {
- this.lastBackPress = null;
- }, 1000);
- return true;
- }
- },
- data() {
- return {
- isRequest: false, //onLoad请求成功时改为true,否则不允许保存
- isLabelScan: true, //true是扫标签;false是扫托或包装,多行保存
- specialScanName: '条码', //不是条码时,执行特殊扫码(看板:扫到货单号)
- labelList: [], //扫托或包装获得的标签list
- remarkFocus: false,
- mxNum: 0, //明细按钮数量
- isShowSaveButton: false, //是否显示保存按钮
- // 必填项
- autoButtonTitle: '自动',
- scrollTop: 0,
- old: {
- scrollTop: 0
- },
- billTypeOption: [], // 业务类型字典选择框数据
- barCode: '', //条码
- formData: {
- // 单据类型
- billTypeCode: "", // 单据类型
- billTypeName: "",// 单据类型的名称(显示使用)
- taskBillTypeCode: "", //单据类型对应的任务类型
- isControlTask: null, //任务用,是否可超量
- // 任务编码
- taskMoveId: "",
- taskMoveCode: "",
- // 部门
- deptCodeOut: "",
- deptNameOut: "",
- deptCodeIn: "",
- deptNameIn: "",
- // 职员
- employeeCodeOut: "",
- employeeNameOut: "",
- employeeCodeIn: "",
- employeeNameIn: "",
- // 仓库
- warehouseCodeOut: "",
- warehouseNameOut: "",
- warehouseCodeIn: "",
- warehouseNameIn: "",
- // 出库类别
- extendName01: "",
- extendCode01: "",
- // 入库类别
- extendName02: "",
- extendCode02: "",
- // 要货单号
- extendName03: "",
- extendCode03: "",
- // 审核人
- extendName04: "",
- extendCode04: "",
- // 发货时间
- extendName05: "",
- extendCode05: "",
- // 移入客户
- customerCodeIn: "",
- customerNameIn: "",
- // 组id
- appGroupId: "",
- // ===== 以下 保存时转化为 wmsStockOutsList=====
- //任务子表id
- taskMovesId: "",
- taskMovesCode: "",
- // 货位
- locationCodeOut: "",
- locationNameOut: "",
- locationCodeIn: "",
- locationNameIn: "",
- // 标签
- labelCode: "", // 标签编码
- // 物料
- materialCode: "", // 物料编码
- materialName: "", //物料名称
- // 批号
- batch: "", //批号
- // 托盘
- palletCodeOut: "",
- palletNameOut: "",
- palletCodeIn: "",
- palletNameIn: "",
- // 包装
- packageCodeOut: "",
- packageNameOut: "",
- packageCodeIn: "",
- packageNameIn: "",
- //单位
- unitCode: "", //单位编码
- unitName: "", //单位名称
-
- stockQty: "", // 标签数量
- rwQty: "",// 任务数量
- batch1: "", //批号1
- batch2: "", //批号2
- materialSpecification: "", //物料规格
- userids:null, //选择审核人用,有值则只显示设置的人员
- isLocationOut:"",
- isPackageOut:"",
- isPalletOut:"",
- isLocationIn:"",
- isPackageIn:"",
- isPalletIn:"",
- },
-
- lableWidth: '80px',
- styleInput: {
- color: '#333',
- backgroundColor: '#fff',
- disableColor: '#fff',
- borderColor: '#e5e5e5',
- },
- fieldSetting: [], //单据字段设置
- // 任务编码
- rwbmTitle: "任务",
- rwbmFlag: "rwbm",
- // 职员
- zyOutTitle: "职员",
- zyOutFlag: "zyOut",
- zyInTitle: "职员",
- zyInFlag: "zyIn",
- // 部门
- bmOutTitle: "部门",
- bmOutFlag: "bmOut",
- bmInTitle: "部门",
- bmInFlag: "bmIn",
- // 收发类别
- sflbOutTitle: "收发类别",
- sflbOutFlag: "sflbOut",
- sflbInTitle: "收发类别",
- sflbInFlag: "sflbIn",
- // 移入客户
- khInTitle: "客户",
- khInFlag: "khIn",
- // 托盘
- tpInTitle: "托盘",
- tpInFlag: "tpIn",
- // 包装
- bzInTitle: "包装",
- bzInFlag: "bzIn",
- // 标签
- LabelPopup: "托盘",
- LabelFlag: "tpOut",
- // 仓库
- wareOutTitle: "移出仓库",
- wareOutFlag: "wareOut",
- wareInTitle: "移入仓库",
- wareInFlag: "wareIn",
- // 货位
- locaOutTitle: "移出货位",
- locaOutFlag: "locaOut",
- locaInTitle: "移入货位",
- locaInFlag: "locaIn",
- // 审核人
- shrTitle: "审核人",
- shrFlag: "shr",
- //配合$noMultipleClicks防止重复点击
- noClick:true,
- //记录物料号(用来处理任务有多行相同物料时弹窗)
- tempTaskMaterialCode:"",//记录物料
- tempTaskMovesId:"",//记录任务子表id
- isNewTaskMaterial:false,//true时弹窗选择任务行
- }
- },
- methods: {
- upper: function(e) {},
- lower: function(e) {},
- scroll: function(e) {
- this.old.scrollTop = e.detail.scrollTop
- },
- async retryRequest(requestFunction, requestParams, maxRetries = 1) {
- let retriesLeft = maxRetries;
- while (retriesLeft > 0) {
- try {
- // 调用请求函数并传入参数
- const response = await requestFunction(requestParams);
- if (response && response.code === 200) {
- return response; // 请求成功,返回响应
- } else {
- // 请求失败,但还有重试机会
- //console.warn(`请求失败,正在尝试第 ${maxRetries - retriesLeft + 1} 次重试...`);
- retriesLeft--;
- }
- } catch (error) {
- // 请求发生异常,但还有重试机会
- //console.error('请求发生异常,正在尝试重试...', error);
- retriesLeft--;
- }
- }
- // 所有重试都失败了,抛出错误
- throw new Error('获取信息失败');
- },
- onShow() {
- let that = this;
- uni.$off("scancode"); // 每次进来先 移除全局自定义事件监听器
- uni.$on("scancode", (data) => {
- // 扫描PCS码
- if(data && data !== ''){
- that.barCode = data;
- this.getDataByRemark(that.barCode);
- }else{
- uni.showToast({
- title: '扫码失败!',
- icon:'none',
- duration: 2000
- });
- }
- });
- },
- handleScanClick:function(){// 条码右侧扫码按钮事件
- let that = this;
- uni.scanCode({
- success: function(res) {
- // 播放音效
- // this.playMusic();
-
- // {"scanType":"QR_CODE","path":"","charSet":"ISO8859_1","result":"PT|04-A-1-1","errMsg":"scanCode:ok"}
- if(res.errMsg == "scanCode:ok"){
- that.barCode = res.result;
- this.getDataByRemark(that.barCode);
- }else{
- uni.showToast({
- title: '扫码失败!',
- icon:'none',
- duration: 2000
- });
- }
-
- },
- fail: (err) => {
- },
- complete: () => {
- }
- });
- },
- getDataByRemark(remark){ // 根据扫码数据查询其他formItem数据
- if(this.specialScanName=='看板'){
- this.formData.extendName03=remark
- uni.hideKeyboard()
- }
-
- let that = this;
- remark = remark.replace(/^\s+|\s+$/g, '');
- var splitPre = remark.split("|")[0];
- var splitLast = remark.slice(splitPre.length+1);
- // 条码空 不执行
- if(splitLast == ""){
- return true;
- }
- //任务子表弹窗时,不可以扫标签
- if(this.isNewTaskMaterial){
- return true;
- }
- // 扫码
- switch (splitPre){
- case "PT": // 货位 PT|04-A-1-1
- this.getScanHwList(splitLast);
- break;
- case "WH": // 仓库 WH|01
- this.getScanCkList(splitLast);
- break;
- case "RW": // 任务扫码 RW|
- this.getScanRwList(splitLast);
- break;
- case "L": // 标签 L|L2311060002
- this.getScanBqList(splitLast);
- break;
- case "P": // 托盘 P|0002
- this.getScanTpList(splitLast);
- break;
- case "PA": // 包装 PA|0002
- this.getScanBzList(splitLast);
- break;
- default:
- uni.showToast({
- title: "条码不合法",
- icon: "none"
- })
- break;
- }
- },
- scanSearch(remark){ // 条码框 回车
- this.getDataByRemark(remark);
- },
- //业务类型变更
- async ywlxChange(value) {
- if(value === ''){
- this.formData.billTypeCode = "";
- this.formData.billTypeName = "";
- this.formData.taskBillTypeCode = "";
- this.formData.isControlTask = "";
- }else {
- let status = this.billTypeOption.find(item => item.value == value);
- if(status){
- this.formData.billTypeCode = status.value;
- this.formData.billTypeName = status.text;
- this.formData.taskBillTypeCode = status.taskValue;
- this.formData.isControlTask = status.isControlTask
- }
- }
- // 监听业务类型变更,变更后。清空任务、客户、收发类别、审核人、发货时间、要货单号、清空明细查询出的数据、清空单号和单号数组
- //清空任务
- this.taskMoveId = "";
- this.taskMoveCode = "";
- this.taskMovesId = "";
- this.taskMovesCode = "";
- //清空客户
- this.formData.customerCodeIn = "";
- this.formData.customerNameIn = "";
- //清空收发类别、审核人、发货时间、要货单号
- this.formData.extendCode01 = "";
- this.formData.extendName01 = "";
- this.formData.extendCode02 = "";
- this.formData.extendName02 = "";
- this.formData.extendCode03 = "";
- this.formData.extendName03 = "";
- this.formData.extendCode04 = "";
- this.formData.extendName04 = "";
- this.formData.extendCode05 = "";
- this.formData.extendName05 = "";
- // 清空明细数据
- if (this.$refs.mxPopup) {
- this.$refs.mxPopup.listData = [];
- }
- // 清空单号和单号数组
- uni.removeStorageSync('stock_key');
- //更新唯一值
- this.formData.appGroupId = nanoid(19);
- if(value!='' && value!=null){
- //默认值
- const res = await this.retryRequest(listFieldDefault, { "billTypeCode":value, "billCode": 'stockMove' });
- if(res.code === 200){
- let fieldDefault = res.rows; //字段默认值
- let fieldSetting = this.fieldSetting.filter(item => item.defaults == '1'); //字段信息
- let form = this.formData; //新增的信息
- /*
- * 遍历字段信息,如果字段默认值和头信息中存在,则用字段中的keyCode、keyName和默认值中的settingCode、settingName赋值给from
- */
- for (let i = 0; i < fieldSetting.length; i++) {
- let fieldD = fieldDefault.filter(item => item.settingFlag == fieldSetting[i].field);
- //如果字段默认值和头信息中存在
- if (fieldD.length>0 && fieldSetting[i].field in form) {
- //仓库触发一次扫码
- if(fieldD[0].settingFlag=="warehouseCodeOut" && fieldD[0].settingCode){
- this.getScanCkList(fieldD[0].settingCode , "out")
- continue
- }else if(fieldD[0].settingFlag=="warehouseCodeIn" && fieldD[0].settingCode){
- this.getScanCkList(fieldD[0].settingCode , "in")
- continue
- }
- //赋值code(实际值)
- if(fieldSetting[i]["keyCode"]){
- form[ fieldSetting[i]["keyCode"] ] = fieldD[0].settingCode;
- }
- //赋值name(显示值)
- if(fieldSetting[i]["keyName"]){
- form[ fieldSetting[i]["keyName"] ] = fieldD[0].settingName;
- }
- }
- }
- }
- }
- },
- getSendData(res){ //基础资料
- let cFlag = res.currentFlag;
- let obj = {};
- switch (cFlag){
- case "rwbm": // 赋值任务
- if(this.formData.billTypeCode == '2'){
- break;
- }
- this.formData.taskMoveCode = res.selectData.taskCode;
- this.formData.taskMoveId = res.selectData.id;
- // 赋值部门
- this.formData.deptCodeOut = res.selectData.deptCodeOut;
- this.formData.deptNameOut = res.selectData.deptNameOut;
- this.formData.deptCodeIn = res.selectData.deptCodeIn;
- this.formData.deptNameIn = res.selectData.deptNameIn;
- // 赋值职员
- this.formData.employeeCodeOut = res.selectData.employeeCodeOut;
- this.formData.employeeNameOut = res.selectData.employeeNameOut;
- this.formData.employeeCodeIn = res.selectData.employeeCodeIn;
- this.formData.employeeNameIn = res.selectData.employeeNameIn;
- // 赋值仓库
- this.formData.warehouseCodeOut = res.selectData.warehouseCodeOut;
- this.formData.warehouseNameOut = res.selectData.warehouseNameOut;
- this.formData.warehouseCodeIn = res.selectData.warehouseCodeIn;
- this.formData.warehouseNameIn = res.selectData.warehouseNameIn;
- //清空记录物料号
- this.tempTaskMaterialCode = ""
- this.tempTaskMovesId = ""
- this.isNewTaskMaterial = false
- break;
- case "bmOut": // 出部门
- this.formData.deptCodeOut = res.selectData.deptCode;
- this.formData.deptNameOut = res.selectData.deptName;
-
- // 职员清空
- this.formData.employeeCodeOut = "";
- this.formData.employeeNameOut = "";
- break;
- case "bmIn": // 入部门
- this.formData.deptCodeIn = res.selectData.deptCode;
- this.formData.deptNameIn = res.selectData.deptName;
-
- // 职员清空
- this.formData.employeeCodeIn = "";
- this.formData.employeeNameIn = "";
- break;
- case "zyOut": // 出职员
- this.formData.employeeCodeOut = res.selectData.employeeCode;
- this.formData.employeeNameOut = res.selectData.employeeName;
- break;
- case "zyIn": // 入职员
- this.formData.employeeCodeIn = res.selectData.employeeCode;
- this.formData.employeeNameIn = res.selectData.employeeName;
- break;
- case "sflbOut": // 出类别
- this.formData.extendName01 = res.selectData.extendName;
- this.formData.extendCode01 = res.selectData.extendCode;
- break;
- case "sflbIn": // 入类别
- this.formData.extendName02 = res.selectData.extendName;
- this.formData.extendCode02 = res.selectData.extendCode;
- break;
- case "wareOut": // 出仓库
- this.formData.warehouseCodeOut = res.selectData.warehouseCode;
- this.formData.warehouseNameOut = res.selectData.warehouseName;
- this.formData.isLocationOut = res.selectData.isLocation
- // 清空子表
- this.EmptyEntry();
- this.formData.rwQty = "";
- break;
- case "wareIn": // 入仓库
- this.formData.warehouseCodeIn = res.selectData.warehouseCode;
- this.formData.warehouseNameIn = res.selectData.warehouseName;
- // 是否移入货位 必录
- obj = {"field": "locationCodeIn","fieldName": "移入货位","required": null,"requiredCondition": null,"hidden": null,"hiddenCondition": null}
- obj.required = res.selectData.isLocation == "1" ? null : 1;
- obj.hidden = res.selectData.isLocation == "1" ? 1 : null;
- this.setFieldSetting(obj);
- this.formData.isLocationIn = res.selectData.isLocation
- // 清空子表
- this.EmptyEntry();
- this.formData.rwQty = "";
- this.formData.locationCodeIn = "";
- this.formData.locationNameIn = "";
- break;
- case "locaOut": // 出货位
- this.formData.stockQty = res.selectData.stockQty;
- if(this.formData.taskCode == '' || this.formData.taskCode == null){
- this.formData.rwQty = res.selectData.stockQty;
- }
-
- // 赋值货位
- this.formData.locationCodeOut = res.selectData.locationCode;
- this.formData.locationNameOut = res.selectData.locationName;
- // 赋值托、包装
- this.formData.palletCodeOut = res.selectData.palletCode;
- this.formData.palletNameOut = res.selectData.palletName;
- this.formData.packageCodeOut = res.selectData.packageCode;
- this.formData.isLocationOut = 0
- break;
- case "locaIn": // 入货位
- this.formData.warehouseCodeIn = res.selectData.warehouseCode;
- this.formData.warehouseNameIn = res.selectData.warehouseName;
- this.formData.locationCodeIn = res.selectData.locationCode;
- this.formData.locationNameIn = res.selectData.locationName;
- // 是否移入货位 必录
- obj = {"field": "locationCodeIn","fieldName": "移入货位","required": null,"requiredCondition": null,"hidden": null,"hiddenCondition": null}
- obj.required = 1;
- this.formData.isLocationIn = 0
- this.setFieldSetting(obj);
- break;
- case "khIn": // 入客户
- this.formData.customerCodeIn = res.selectData.extendCode
- this.formData.customerNameIn = res.selectData.extendName
- break;
- case "shr": // 审核人
- this.formData.extendName04 = res.selectData.nickName;
- this.formData.extendCode04 = res.selectData.userId;
- break;
- case "bzIn": // 包装
- this.formData.packageCodeIn = res.selectData.packageCode;
- this.formData.packageNameIn = res.selectData.packageName;
- if(res.selectData.warehouseCode){
- this.formData.warehouseCodeIn = res.selectData.warehouseCode;
- this.formData.warehouseNameIn = res.selectData.warehouseName;
- }
- if(res.selectData.locationCode){
- this.formData.locationCodeIn = res.selectData.locationCode;
- this.formData.locationNameIn = res.selectData.locationName;
- }
- if(res.selectData.palletCode){
- this.formData.palletCodeIn = res.selectData.palletCode;
- this.formData.palletNameIn = res.selectData.palletName;
- }
- break;
- case "tpIn": // 托盘
- this.formData.palletCodeIn = res.selectData.palletCode;
- this.formData.palletNameIn = res.selectData.palletName;
- if(res.selectData.warehouseCode){
- this.formData.warehouseCodeIn = res.selectData.warehouseCode;
- this.formData.warehouseNameIn = res.selectData.warehouseName;
- }
- if(res.selectData.locationCode){
- this.formData.locationCodeIn = res.selectData.locationCode;
- this.formData.locationNameIn = res.selectData.locationName;
- }
- this.formData.packageCodeIn = '';
- this.formData.packageNameIn = '';
- break;
- case "stock": // 其它单据
- let billType = this.billTypeOption.find(item => item.value == res.selectData.billTypeCode);
- this.formData = {
- billTypeCode: billType.value,
- billTypeName: billType.text,
- taskBillTypeCode: billType.taskValue,
- isControlTask: billType.isControlTask,
- taskMoveId: res.selectData.taskMoveId,
- taskMoveCode: res.selectData.taskMoveCode,
- deptCodeOut: res.selectData.deptCodeOut,
- deptNameOut: res.selectData.deptNameOut,
- deptCodeIn: res.selectData.deptCodeIn,
- deptNameIn: res.selectData.deptNameIn,
- employeeCodeOut: res.selectData.employeeCodeOut,
- employeeNameOut: res.selectData.employeeNameOut,
- employeeCodeIn: res.selectData.employeeCodeIn,
- employeeNameIn: res.selectData.employeeNameIn,
- warehouseCodeOut: res.selectData.warehouseCodeOut,
- warehouseNameOut: res.selectData.warehouseNameOut,
- warehouseCodeIn: res.selectData.warehouseCodeIn,
- warehouseNameIn: res.selectData.warehouseNameIn,
- extendName01: res.selectData.extendName01,
- extendCode01: res.selectData.extendCode01,
- extendName02: res.selectData.extendName02,
- extendCode02: res.selectData.extendCode02,
- extendName03: res.selectData.extendName03,
- extendCode03: res.selectData.extendCode03,
- extendName04: res.selectData.extendName04,
- extendCode04: res.selectData.extendCode04,
- extendName05: res.selectData.extendName05,
- extendCode05: res.selectData.extendCode05,
- appGroupId: res.selectData.appGroupId,
- // ===== 以下 保存时转化为 wmsStockOutsList=====
- locationCodeOut: "",
- locationNameOut: "",
- locationCodeIn: "",
- locationNameIn: "",
- labelCode: "",
- materialCode: "",
- materialName: "",
- batch: "",
- palletCodeOut: "",
- palletNameOut: "",
- palletCodeIn: "",
- palletNameIn: "",
- unitCode: "",
- unitName: "",
- stockQty: "",
- rwQty: "",
- batch1: "",
- batch2: "",
- materialSpecification: "",
- }
- break;
- default:
- break;
- }
- },
- getSendDataTaskMoves(res){ // 任务物料多行时,选择任务行回调
- this.isNewTaskMaterial = false;
- this.tempTaskMovesId = res.wmsTaskMoves.id;
- },
- searchIconClick(type){ // easyinput后面放大镜点击
- switch (type){
- case "task": // 任务编码
- this.$refs.rwbmPopup.showPopup();
- break;
- case "deptOut": // 出部门
- this.$refs.bmOutPopup.showPopup();
- break;
- case "deptIn": // 人部门
- this.$refs.bmInPopup.showPopup();
- break;
- case "emplOut": // 出职员
- this.$refs.zyOutPopup.showPopup();
- break;
- case "emplIn": // 入职员
- this.$refs.zyInPopup.showPopup();
- break;
- case "ext01": // 出类别
- this.$refs.sflbOutPopup.showPopup();
- break;
- case "ext02": // 入类别
- this.$refs.sflbInPopup.showPopup();
- break;
- case "custIn": // 客户
- this.$refs.khInPopup.showPopup();
- break;
- case "ext04": // 审核人
- this.$refs.shrPopup.showPopup();
- break;
- case "locaOut": // 移出货位
- this.$refs.locaOutPopup.showPopup();
- break;
- case "locaIn": // 移入货位
- this.$refs.locaInPopup.showPopup();
- break;
- case "pallIn": // 移入托盘
- this.$refs.tpInPopup.showPopup();
- break;
- case "packIn": // 移入包装
- this.$refs.bzInPopup.showPopup();
- break;
- case "wareOut": // 移出仓库
- this.$refs.wareOutPopup.showPopup();
- break;
- case "wareIn": // 移入仓库
- this.$refs.wareInPopup.showPopup();
- break;
- default:
- break;
- }
- },
- remarkGetFocus(){
- this.remarkFocus = false;
- this.$nextTick(() => {
- this.remarkFocus = true
- })
- },
- setScan(str){//赋值条码框 光标聚焦
- this.barCode = str + "|";
- this.remarkGetFocus();
- },
- bqslInputHandle(value){ //数量输入完成校验
- let rwsl = this.formData.rwQty;
- if(rwsl != ""){
- if(value > parseFloat(rwsl)){
- uni.showToast({
- title: "数量大于可出数量",
- icon: "none"
- })
- return;
- }
- }
- },
- handleMx(){ // 下面工具栏 明细点击 事件
- this.$refs.mxPopup.showDrawer();
- },
- //根据index删除LabelList
- delLabelList(index) {
- this.labelList.splice(index, 1);
- },
- labelListQtyChange(item, newValue) {
- item.stockQty = newValue;
- },
- handleSave() { //保存事件
- //获取信息失败时不可以保存
- if(this.isRequest==false){
- uni.showToast({
- title: '获取单据信息失败,请返回菜单重新进入',
- icon: "none"
- })
- return true;
- }
- if (this.isShowSaveButton) {
- uni.showToast({
- title: '保存中,请稍等',
- icon: 'none',
- duration:2000
- })
- }
- //如果唯一值空,生成唯一值
- if(this.formData.appGroupId=='' || this.formData.appGroupId==null){
- this.formData.appGroupId = nanoid(19)
- }
-
- let that = this;
- that.$refs.form.validate().then(res => {
- let wmsStockMovesList = [];
- // true用普通保存;false用list保存多行
- if (that.isLabelScan == true) {
- let tmpWms = {
- locationCodeOut: that.formData.locationCodeOut, // 移出货位
- locationCodeIn: that.formData.locationCodeIn, // 移入货位
- palletCodeOut: that.formData.palletCodeOut, // 移出托盘编码
- palletCodeIn: that.formData.palletCodeIn, // 移入托盘编码
- packageCodeOut: that.formData.packageCodeOut, // 移出包装编码
- packageCodeIn: that.formData.packageCodeIn, // 移入包装编码
- labelCode:that.formData.labelCode, // 标签编码
- materialCode: that.formData.materialCode, // 物料编码
- batch: that.formData.batch, //批号
- batch1: that.formData.batch1, //批号
- batch2: that.formData.batch2, //批号
- unitCode: that.formData.unitCode, //单位编码
- stockQty: that.formData.stockQty, // 标签数量
- taskMovesId: that.formData.taskMovesId,
- isLocationIn: that.formData.isLocationIn,
- isPackageIn: that.formData.isPackageIn,
- isPalletIn: that.formData.isPalletIn,
- isPackageOut: that.formData.isPackageOut,
- isPalletOut: that.formData.isPalletOut,
- };
- wmsStockMovesList.push(tmpWms);
- } else if (that.isLabelScan == false && that.labelList.length > 0) {
- wmsStockMovesList = that.labelList.map(item => ({
- locationCodeOut: item.locationCode, // 移出货位
- locationCodeIn: that.formData.locationCodeIn, // 移入货位
- palletCodeOut: item.palletCode, // 移出托盘编码
- palletCodeIn: that.formData.palletCodeIn, // 移入托盘编码
- packageCodeOut: item.packageCode, // 移出包装编码
- packageCodeIn: that.formData.packageCodeIn, // 移入包装编码
- labelCode: item.labelCode, // 标签编码
- materialCode: item.materialCode, // 物料编码
- batch: item.batch, //批号
- batch1: item.batch1, //批号
- batch2: item.batch2, //批号
- unitCode: item.unitCode, //单位编码
- stockQty: item.stockQty, // 标签数量
- taskMovesId: item.tasksId,
- isPackageIn: that.formData.isPackageIn,
- isPalletIn: that.formData.isPalletIn,
- isPackageOut: that.formData.isPackageOut,
- isPalletOut: that.formData.isPalletOut,
- }))
- } else {
- return true;
- }
- let params = {
- guid: that.getHashId,
- appGroupId: that.formData.appGroupId,
- status: "1",
- billTypeCode: that.formData.billTypeCode, // 单据类型
- taskMoveCode: that.formData.taskMoveCode,//任务
- taskMoveId: that.formData.taskMoveId,
- deptCodeOut: that.formData.deptCodeOut, //移出部门
- deptNameOut: that.formData.deptNameOut,
- deptCodeIn: that.formData.deptCodeIn, //移入部门
- deptNameIn: that.formData.deptNameIn,
- employeeCodeOut: that.formData.employeeCodeOut, // 移出职员
- employeeNameOut: that.formData.employeeNameOut,
- employeeCodeIn: that.formData.employeeCodeIn, // 移入职员
- employeeNameIn: that.formData.employeeNameIn,
- warehouseCodeOut: that.formData.warehouseCodeOut, // 移出仓库
- warehouseNameOut: that.formData.warehouseNameOut,
- warehouseCodeIn: that.formData.warehouseCodeIn, // 移入仓库
- warehouseNameIn: that.formData.warehouseNameIn,
- extendName01: that.formData.extendName01, // 出库类别
- extendCode01: that.formData.extendCode01,
- extendName02: that.formData.extendName02, // 入库类别
- extendCode02: that.formData.extendCode02,
- customerCodeIn: that.formData.customerCodeIn, //客户
- extendCode03: that.formData.extendCode03,//要货单号
- extendCode04: that.formData.extendCode04,
- extendName04: that.formData.extendName04,
- extendCode05: that.formData.extendCode05,
- wmsStockMovesList: wmsStockMovesList,
- isLocationIn: that.formData.isLocationIn,
- isLocationOut: that.formData.isLocationOut,
- }
- checkAddStockMove(params).then(res => {
- if(res.code === 200 && res.msg && res.msg != ""){
- uni.vibrateLong({});
- uni.showModal({
- title: '提示',
- content: res.msg,
- success: (res) => {
- if (res.confirm) {
- saveStock();
- } else if (res.cancel) {
- // 不保存
- }
- }
- });
- }else if(res.code === 200 && res.msg == ""){
- saveStock();
- }
- })
-
- async function saveStock(){
- await addStockMove(params).then(res => {
- if(res.code === 200){
- that.mxNum += that.isLabelScan ? 1 : that.labelList.length;
- // 保存单号
- if(res.msg !== ""){
- let storageData = uni.getStorageSync('stock_key');
- if(storageData){
- let stockIdList = storageData.stockIdList;
- stockIdList.push(res.msg);
- let data = {
- "stockId": res.msg,
- "stockIdList": stockIdList
- }
- uni.setStorageSync('stock_key', data);
- }else{
- let tmpList = [];
- tmpList.push(res.msg);
- let data = {
- "stockId": res.msg,
- "stockIdList": tmpList
- }
- uni.setStorageSync('stock_key', data);
- }
- }
- // 扫码后任务数量 - 标签数量
- let rwQty = that.formData.rwQty;
- if(rwQty!=0 && rwQty!="" && !isNaN(parseFloat(rwQty)) && isFinite(rwQty)){
- that.formData.rwQty = rwQty - that.formData.stockQty;
- }
-
- //如果任务数量0,清空tempTaskMovesId(相同物料会继续弹窗)
- if(that.formData.rwQty == 0){
- that.tempTaskMovesId = ""
- }
-
- // 清空子表信息
- that.EmptyEntry();
-
- if (that.isShowSaveButton) {
- uni.showToast({
- title: '保存成功',
- icon: 'none',
- duration:2000
- })
- }
- }else{
- uni.vibrateLong({});
- uni.showToast({
- title: "保存失败!",
- icon: "none"
- })
- }
- }).catch((err) => {
- uni.vibrateLong({});
- });
- }
- }).catch((err) => {
- uni.vibrateLong({});
- });
- },
- getScanRwList(barCode){ // 任务扫码请求
- if(this.formData.billTypeCode == '2'){ //货位转移不执行任务扫码
- return true;
- }
- let that = this;
- let params = {
- billTypeCode: that.formData.taskBillTypeCode,
- params: {
- "barCode":barCode,
- "limit":1,
- "isControlTask": that.formData.isControlTask,
- },
- }
- //扫码
- listTaskMove(params).then(res => {
- if(res.code === 200){
- let data = res.rows ? res.rows[0] : {};
- if(data && Object.keys(data).length !== 0){
- // 赋值任务
- this.formData.taskMoveCode = data.taskCode;
- this.formData.taskMoveId = data.id;
- // 赋值部门;
- this.formData.deptCodeOut = data.deptCodeOut;
- this.formData.deptNameOut = data.deptNameOut;
- this.formData.deptCodeIn = data.deptCodeIn;
- this.formData.deptNameIn = data.deptNameIn;
- // 赋值职员
- this.formData.employeeCodeOut = data.employeeCodeOut;
- this.formData.employeeNameOut = data.employeeNameOut;
- this.formData.employeeCodeIn = data.employeeCodeIn;
- this.formData.employeeNameIn = data.employeeNameIn;
- //仓库
- this.formData.warehouseCodeIn = data.warehouseCodeIn;
- this.formData.warehouseNameIn = data.warehouseNameIn;
- this.formData.warehouseCodeOut = data.warehouseCodeOut;
- this.formData.warehouseNameOut = data.warehouseNameOut;
- //客户
- this.formData.customerCodeIn = data.customerCodeIn
- this.formData.customerNameIn = data.customerNameIn
- //清空记录物料号
- this.tempTaskMaterialCode = ""
- this.tempTaskMovesId = ""
- this.isNewTaskMaterial = false
- }else{
- uni.showToast({
- title: "无数据",
- icon: 'none',
- })
- }
- }
- });
- },
- getScanCkList(barCode,inOut){ // 仓库扫码请求
- let that = this;
- let params = {
- status: "0", // (固定)
- params: {
- "barCode":barCode,
- "limit":1
- },
- }
- // 仓库网络请求
- listWarehouse(params).then(res => {
- if(res.code === 200){
- let data = res.rows ? res.rows[0] : {};
- if(data && Object.keys(data).length !== 0){
- if(inOut == 'out'){
- // 赋值仓库、货位
- that.formData.warehouseCodeOut = data.warehouseCode;
- that.formData.warehouseNameOut = data.warehouseName;
- that.formData.locationCodeOut = "";
- that.formData.locationNameOut = "";
- that.formData.isLocationOut = data.isLocation
- // 货位转移赋值移出仓库
- if(that.formData.billTypeCode == '2'){
- that.formData.warehouseCodeIn = data.warehouseCode;
- that.formData.warehouseNameIn = data.warehouseName;
- that.formData.locationCodeIn = "";
- that.formData.locationNameIn = "";
- // 是否移入货位 必录
- let obj = {"field": "locationCodeIn","fieldName": "移入货位","required": null,"requiredCondition": null,"hidden": null,"hiddenCondition": null}
- obj.required = data.isLocation == "1" ? null : 1;
- obj.hidden = data.isLocation == "1" ? 1 : null;
- that.formData.isLocationIn = data.isLocation
- that.setFieldSetting(obj);
- }
- }else{
- // 赋值仓库、货位
- that.formData.warehouseCodeIn = data.warehouseCode;
- that.formData.warehouseNameIn = data.warehouseName;
- that.formData.locationCodeIn = "";
- that.formData.locationNameIn = "";
- // 货位转移赋值移出仓库
- if(that.formData.billTypeCode == '2'){
- that.formData.warehouseCodeOut = data.warehouseCode;
- that.formData.warehouseNameOut = data.warehouseName;
- that.formData.locationCodeOut = "";
- that.formData.locationNameOut = "";
- }
- // 清空包装托盘
- that.formData.palletCodeIn = '';
- that.formData.palletNameIn = '';
- that.formData.packageCodeIn = '';
- that.formData.packageNameIn = '';
- // 是否移入货位 必录
- let obj = {"field": "locationCodeIn","fieldName": "移入货位","required": null,"requiredCondition": null,"hidden": null,"hiddenCondition": null}
- obj.required = data.isLocation == "1" ? null : 1;
- obj.hidden = data.isLocation == "1" ? 1 : null;
- that.formData.isLocationIn = data.isLocation
- that.setFieldSetting(obj);
- }
- // 清空子表
- that.EmptyEntry();
- that.formData.rwQty = "";
- }else if(this.barCode){
- uni.showToast({
- title: "无数据",
- icon: 'none',
- })
- }
- }
- });
- },
- //收发类别扫码请求(但不是给扫码用的,在加载时调用)
- getScanSflbList(barCode,inOut){
- let that = this;
- let params = {
- extendClassCode: inOut == 'out' ? "01.02":"01.01",
- params: {
- "keyWord":barCode,
- "limit":1
- },
- }
- // 收发类别网络请求
- listExtend(params).then(res => {
- if(res.code === 200){
- let data = res.rows ? res.rows[0] : {};
- if(data && Object.keys(data).length !== 0){
- if(inOut == 'out'){
- // 收发类别
- that.formData.extendCode01 = data.extendCode;
- that.formData.extendName01 = data.extendName;
- }else{
- // 收发类别
- that.formData.extendCode02 = data.extendCode;
- that.formData.extendName02 = data.extendName;
- }
- }else if(this.barCode){
- uni.showToast({
- title: "无数据",
- icon: "none"
- })
- }
- }
- });
- },
- getScanHwList(barCode){ // 货位扫码请求
- let that = this;
- let params = {
- status: "0", // (固定)
- params: {
- "barCode":barCode,
- "limit":1
- },
- }
- // 货位网络请求
- listLocation(params).then(res => {
- if(res.code === 200){
- let data = res.rows ? res.rows[0] : {};
- if(data && Object.keys(data).length !== 0){
- that.EmptyEntry();
- // 赋值仓库
- that.formData.locationCodeIn = data.locationCode;
- that.formData.locationNameIn = data.locationName;
- that.formData.warehouseCodeIn = data.warehouseCode;
- that.formData.warehouseNameIn = data.warehouseName;
- //显示货位
- that.formData.isLocationIn = 0
- // 货位转移赋值移出仓库
- if(that.formData.billTypeCode == '2'){
- that.formData.warehouseCodeOut = data.warehouseCode;
- that.formData.warehouseNameOut = data.warehouseName;
-
- that.formData.isLocationOut = 0
- }
- // 清空包装托盘
- that.formData.palletCodeIn = '';
- that.formData.palletNameIn = '';
- that.formData.packageCodeIn = '';
- that.formData.packageNameIn = '';
- }else{
- uni.showToast({
- title: "无数据",
- icon: 'none',
- })
- }
- }
- });
- },
- //托盘扫码请求
- getScanTpList(barCode){
- let that = this;
- let params = {
- palletCode: barCode,
- params: {
- taskMoveId:that.formData.taskMoveId,
- }
- }
-
- // 托盘网络请求
- listCurrent(params).then(res => {
- if (res.code === 200) {
- that.isLabelScan = false;
- let data = res.rows ? res.rows : [];
- if (Array.isArray(data) && data.length > 0 && typeof data[0] == 'object') {
- //将stockQty赋值给maxQty
- data.forEach(item => {
- if (item.hasOwnProperty('stockQty')) {
- item.maxQty = item.stockQty;
- }
- })
- that.labelList = data;
- that.formData.warehouseCodeOut = data[0].warehouseCode;
- that.formData.warehouseNameOut = data[0].warehouseName;
- that.formData.locationCodeOut = data[0].locationCode;
- that.formData.locationNameOut = data[0].locationName;
- that.formData.palletCodeOut = data[0].palletCode;
- that.formData.palletNameOut = data[0].palletName;
- that.formData.palletCodeIn = data[0].palletCode;
- that.formData.palletNameIn = data[0].palletName;
- that.formData.labelCode = data[0].labelCode;
- that.formData.stockQty = data[0].stockQty;
- //如果不显示保存按钮则自动保存
- if (!that.isShowSaveButton) {
- setTimeout(() => {
- that.handleSave();
- }, 10)
- }
- } else {
- uni.vibrateLong({});
- uni.showToast({
- title: "托盘无效",
- icon: "none"
- })
- }
- }
- }).catch((err) => {
- uni.vibrateLong({});
- });
- },
- //包装扫码请求
- getScanBzList(barCode){
- let that = this;
- let params = {
- packageCode: barCode,
- params: {
- taskMoveId:that.formData.taskMoveId
- }
- }
-
- // 包装网络请求
- listCurrent(params).then(res => {
- if (res.code === 200) {
- that.isLabelScan = false;
- let data = res.rows ? res.rows : [];
- if (Array.isArray(data) && data.length > 0 && typeof data[0] == 'object') {
- //将stockQty赋值给maxQty
- data.forEach(item => {
- if (item.hasOwnProperty('stockQty')) {
- item.maxQty = item.stockQty;
- }
- })
- that.labelList = data;
- that.formData.warehouseCodeOut = data[0].warehouseCode;
- that.formData.warehouseNameOut = data[0].warehouseName;
- that.formData.locationCodeOut = data[0].locationCode;
- that.formData.locationNameOut = data[0].locationName;
- that.formData.palletCodeOut = data[0].palletCode;
- that.formData.palletNameOut = data[0].palletName;
- that.formData.palletCodeIn = data[0].palletCode;
- that.formData.palletNameIn = data[0].palletName;
- that.formData.packageCodeOut = data[0].packageCode;
- that.formData.packageNameOut = data[0].packageName;
- that.formData.packageCodeIn = data[0].packageCode;
- that.formData.packageNameIn = data[0].packageName;
- that.formData.labelCode = data[0].labelCode;
- that.formData.stockQty = data[0].stockQty;
- //如果不显示保存按钮则自动保存
- if (!that.isShowSaveButton) {
- setTimeout(() => {
- that.handleSave();
- }, 10)
- }
- } else {
- uni.vibrateLong({});
- uni.showToast({
- title: "包装无效",
- icon: "none"
- })
- }
- }
- }).catch((err) => {
- uni.vibrateLong({});
- });
- },
- async getScanBqList(barCode){ // 标签扫码请求
- let that = this;
- if(this.formData.warehouseNameOut==''){
- uni.showToast({
- title: "请先选择移出仓库",
- icon: "none",
- duration: 3000
- })
- return true;
- }
- let params = {
- // status: "0", //固定
- params: {
- "barCode":barCode,
- "limit":1,
- "noLocationCode":this.formData.locationCodeIn,
- "taskMoveId":this.formData.taskMoveId,
- "tempTaskMaterialCode":this.tempTaskMaterialCode,
- "tempTaskMovesId":this.tempTaskMovesId
- },
- warehouseCode: this.formData.warehouseCodeOut,
- }
- // 标签网络请求
- try {
- const res = await listCurrent(params);
- if(res.code === 200){
- this.isLabelScan = true;
- this.labelList = [];
- let data = res.rows ? res.rows[0] : {};
- if(data && Object.keys(data).length !== 0){
- // 赋值标签数量
- this.formData.stockQty = data.stockQty;
- // 赋值任务数量
- this.formData.rwQty = data.stockQty < data.tasksQty ? data.stockQty : data.tasksQty;
-
- // 赋值标签
- this.formData.labelCode = data.labelCode;
- //赋值任务
- this.formData.taskMovesId = data.tasksId
- this.formData.taskMovesCode = data.tasksCode
-
- // 赋值物料编码,物料名称 , 规格
- this.formData.materialName = data.materialName;
- this.formData.materialCode = data.materialCode;
- this.formData.materialSpecification = data.materialSpecification; //规格
- // 赋值批号
- this.formData.batch = data.batch;
- this.formData.batch1 = data.batch1;
- this.formData.batch2 = data.batch2;
- // 赋值单位
- this.formData.unitCode = data.unitCode;
- this.formData.unitName = data.unitName;
- // 赋值货位
- this.formData.locationCodeOut = data.locationCode;
- this.formData.locationNameOut = data.locationName;
- // 赋值托、包装
- this.formData.palletCodeOut = data.palletCode;
- this.formData.palletNameOut = data.palletName;
- this.formData.packageCodeOut = data.packageCode;
- //赋值是否托、是否包装
- this.formData.isPackageOut = data.isPackage
- this.formData.isPalletOut = data.isPallet
- this.formData.isPackageIn = data.isPackage
- this.formData.isPalletIn = data.isPallet
-
- // 查询物料对应任务子表信息。任务不为空、物料和记录的物料不同
- if(this.formData.taskMoveCode!=null && this.formData.taskMoveCode!="" && this.tempTaskMaterialCode!=data.materialCode){
- this.tempTaskMaterialCode=this.formData.materialCode
- this.tempTaskMovesId=""
- //查询有多行时显示弹窗,不执行自动保存
- //this.isNewTaskMaterial=true
- this.isNewTaskMaterial = await this.$refs.selectTaskMoves.getRwbmList();
- }
-
- //如果不显示保存按钮则自动保存
- if (!this.isShowSaveButton && this.isNewTaskMaterial == false) {
- setTimeout(() => {
- this.handleSave();
- },10)
- }
- }else{
- uni.vibrateLong({});
- uni.showToast({
- title: "标签无效或已扫描",
- icon: "none"
- })
- }
- }
- } catch (err) {
- uni.vibrateLong({});
- }
- },
- specialScan(name){ //到货单号焦点触发,
- if(name){
- this.specialScanName=name
- }else{
- this.specialScanName="条码"
- }
- },
- handleAuto(){
- if(this.autoButtonTitle === "自动"){ //手动
- this.autoButtonTitle = "手动";
- this.isShowSaveButton = true;
- }else{ //自动
- this.autoButtonTitle = "自动";
- this.isShowSaveButton = false;
- }
- },
- handleBack(){
- uni.showModal({
- title: '提示',
- content: '确认返回?',
- success: function (res) {
- if (res.confirm) {
- uni.navigateBack();
- } else if (res.cancel) {
-
- }
- }
- });
- },
- getSendNum(num){
- this.mxNum = num;
- if(num == 0){
- this.formData.appGroupId=''
- }
- },
- SendNumEmpty(){
- let that = this;
- if(this.mxNum>0){
- uni.showModal({
- title: '新单',
- content: '是否要明细归零,录入新单?',
- success: function (res) {
- if (res.confirm) {
- that.mxNum = 0;
- let data = {
- "stockId": "",
- "stockIdList": []
- }
- uni.setStorageSync('stock_key', data);
- //清空唯一值
- that.formData.appGroupId = '';
- }
- }
- });
- }
- },
- EmptyTest(){//清空任务
- this.formData.taskMovesCode = "";
- this.formData.taskMovesId = "";
- },
- EmptyEntry(){ //清空子表信息
- this.formData.labelCode = "";
- this.formData.taskMovesCode = "";
- this.formData.taskMovesId = "";
- this.formData.materialCode = "";
- this.formData.materialName = "";
- this.formData.batch = "";
- this.formData.unitCode = "";
- this.formData.unitName = "";
- this.formData.stockQty = "";
- // this.formData.rwQty = "";
- this.formData.batch1 = "";
- this.formData.locationCodeOut = "";
- this.formData.locationNameOut = "";
- // this.formData.locationCodeIn = "";
- // this.formData.locationNameIn = "";
- this.formData.palletCodeOut = "";
- this.formData.palletNameOut = "";
- this.formData.palletCodeIn = "";
- this.formData.palletNameIn = "";
- this.formData.packageCodeOut = "";
- this.formData.packageNameOut = "";
- this.formData.packageCodeIn = "";
- this.formData.packageNameIn = "";
- this.formData.materialSpecification = "";
- },
- rulesStar(str){
- let rules=this.rules;
- if(rules[str] && rules[str].rules[0] && rules[str].rules[0].required){
- return true;
- }else{
- return false;
- }
- },
- fieldHidden(str){
- let rules=this.rules;
- if(rules[str] && rules[str].rules[0] && rules[str].rules[0].hidden){
- return !true;
- }else{
- return !false;
- }
- },
- setFieldSetting(obj){ //修改字段设置
- let index = this.fieldSetting.findIndex(item => item.field == obj.field);
- if (index !== -1) {
- // 如果找到匹配项,则使用 obj 的属性覆盖 fieldSetting 中的相应属性
- Object.assign(this.fieldSetting[index], obj);
- } else {
- // 如果没有找到匹配项,则将 obj 添加到 fieldSetting 中
- this.fieldSetting.push(obj);
- }
- },
- formatDate(date,type) { //date:日期字符串('2024-12-12 10-30-01' 或 '2024-12-12 10:30');type:0('2024-12-12 10-30-01')和1('2024-12-12 10:30'),指定返回的格式。
- return date;
- }
- },
- computed: {
- rules() {
- let form = this.formData;
- let rules = {};
- if(!Array.isArray(this.fieldSetting) && this.fieldSetting.length>0){
- return rules;
- }
- //转数组
- for(let i=0;i<this.fieldSetting.length;i++){
- let field = this.fieldSetting[i];
- rules[field.field] = {
- rules: [{ required: false, errorMessage: field.fieldName + '不能为空', hidden: false }],
- }
- if(field.required==1 && field.field){ //判断是否必录
- //判断是否必录
- if(!field.requiredCondition){ //条件为空
- rules[field.field].rules[0].required = true;
- }else{ //有条件;form中对应属性满足正则
- //先赋值true;正则不满足再赋值false
- rules[field.field].rules[0].required = true;
- //判断必录用正则数组
- let regArr = [];
- try {
- if(field.requiredCondition){
- let arr = JSON.parse(field.requiredCondition);
- if(arr!=null){
- regArr = arr.map(([key, value]) => [key, new RegExp(value)]);
- }
- }
- }catch(err) {
- console.error("err",err)
- }
- for(let j=0;j<regArr.length;j++){
- if(regArr[j].length==2 && regArr[j][1].test( form[regArr[j][0]] )){
- rules[field.field].rules[0].required = true;
- }else{
- rules[field.field].rules[0].required = false;
- break;
- }
- }
- }
- }
- if(field.hidden==1 && field.field){ //判断是否隐藏
- //判断是否隐藏
- if(!field.hiddenCondition){ //条件为空
- rules[field.field].rules[0].hidden = true;
- }else{ //有条件;form中对应属性满足正则
- //先赋值true;正则不满足再赋值false
- rules[field.field].rules[0].hidden = true;
- //判断隐藏用正则数组
- let regArr = [];
- try {
- if(field.hiddenCondition){
- let arr = JSON.parse(field.hiddenCondition);
- if(arr!=null){
- regArr = arr.map(([key, value]) => [key, new RegExp(value)]);
- }
- }
- }catch(err) {
- console.error("err",err)
- }
- for(let j=0;j<regArr.length;j++){
- if(regArr[j].length==2 && regArr[j][1].test( form[regArr[j][0]] )){
- rules[field.field].rules[0].hidden = true;
- }else{
- rules[field.field].rules[0].hidden = false;
- break;
- }
- }
- }
- }
- }
- return rules;
- },
- getHashId(){
- //生成哈希值
- const crypto = require('crypto');
- function hashString(str) {
- const hash = crypto.createHash('sha256');
- hash.update(str);
- return hash.digest('hex');
- }
- //null和undefined返回空
- function IFNULL(str){
- return (str==null || str==undefined) ? "" : str + "";
- }
- //使用头信息和nanoid来生成唯一值
- let groupJson = {
- appGroupId : this.formData.appGroupId,
- billTypeCode : IFNULL(this.formData.billTypeCode),
- taskMoveId : '',
- deptCodeIn : IFNULL(this.formData.deptCodeIn),
- deptCodeOut : IFNULL(this.formData.deptCodeOut),
- employeeCodeIn : IFNULL(this.formData.employeeCodeIn),
- employeeCodeOut : IFNULL(this.formData.employeeCodeOut),
- warehouseCodeIn : IFNULL(this.formData.warehouseCodeIn),
- warehouseCodeOut : IFNULL(this.formData.warehouseCodeOut),
- extendCode01 : IFNULL(this.formData.extendCode01),
- extendCode02 : IFNULL(this.formData.extendCode02),
- extendCode03 : IFNULL(this.formData.extendCode03),
- extendCode04 : IFNULL(this.formData.extendCode04),
- extendCode05 : IFNULL(this.formData.extendCode05),
- }
- let groupStr = JSON.stringify(groupJson)
- const hash = hashString(groupStr)
- return hash
- },
- sumlabelList() {// 汇总标签数组,每个物料的总量,用来卡片显示任务后面括弧超多少
- const summary = {};
- const data = this.labelList;
- // 遍历数据数组
- data.forEach(item => {
- const materialCode = item.materialCode;
- const stockQty = item.stockQty;
-
- // 如果summary中已经有了这个materialCode的条目,则累加stockQty
- if (summary[materialCode]) {
- summary[materialCode] += stockQty;
- } else {
- // 否则创建一个新的条目
- summary[materialCode] = stockQty;
- }
- });
-
- return summary;
- },
- }
- }
- </script>
-
- <style>
- @import "@/static/scss/stock.css";
- </style>
|