| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866 |
- <template>
- <div id="inventoryAllocate">
- <el-card class="box-card">
- <header-title title="基本信息"></header-title>
- <el-form label-width="65px" label-position="left" class="ele-form-search">
- <el-row :gutter="15">
- <el-col :span="8" class="col_height">
- <el-form-item label="调拨编码:" prop="code">
- <template>
- <el-input :disabled="true" v-model="params.code"></el-input>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="8" class="col_height">
- <el-form-item label="调拨类型:" prop="warehouseId">
- <template>
- <el-select
- :disabled="isEdit"
- @change="allocateChange"
- style="width: 100%"
- v-model="allocateId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in allocationType"
- :label="item.label"
- :value="item.code"
- :key="item.code"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="8" class="col_height">
- <el-form-item label="调拨名称:" prop="name">
- <template>
- <el-input
- :disabled="isEdit"
- v-model="params.name"
- placeholder="请输入内容"
- ></el-input>
- </template>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div class="productBox">
- <div class="productsList">
- <header-title title="调出明细"></header-title>
- <el-form
- label-position="left"
- class="ele-form-search"
- @submit.native.prevent
- >
- <el-row :gutter="10">
- <el-col :span="12">
- <el-form-item
- label-width="65px"
- label="所属工厂:"
- prop="factoryId"
- >
- <el-select
- :disabled="isEdit"
- style="width: 100%"
- @change="factoryChange"
- v-model="factoryId"
- placeholder="请选择工厂"
- >
- <el-option
- v-for="item in factoryList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item
- label-width="65px"
- label="调出仓库:"
- prop="outWarehouseId"
- >
- <template>
- <el-select
- :disabled="isEdit"
- style="width: 100%"
- @change="outWarehouseChange"
- v-model="params.outWarehouseId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in outTreeList"
- :disabled="item.hiden"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item
- label-width="65px"
- label="调出库区:"
- prop="outCargoAreaId"
- >
- <template>
- <el-select
- @change="outCargoAreaChange"
- style="width: 100%"
- v-model="params.outCargoAreaId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in outCargoAreaList"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item
- label-width="65px"
- label="调出货架:"
- prop="outShelvesId"
- >
- <template>
- <el-select
- style="width: 100%"
- @change="outShelvesChange"
- v-model="params.outShelvesId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in outShelvesList"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item
- label-width="65px"
- label="调出货位:"
- prop="outFreightId"
- >
- <template>
- <el-select
- style="width: 100%"
- @change="outFreightIdChange"
- v-model="params.outFreightId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in outFreightList"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="15">
- <el-col :span="9">
- <el-form-item
- label="列表维度:"
- label-width="65px"
- prop="dimension"
- >
- <template>
- <el-select
- clearable
- @change="handledime"
- v-model="dimension"
- placeholder="请选择"
- >
- <el-option label="物品维度" value="1"> </el-option>
- <el-option label="批次维度" value="2"> </el-option>
- <el-option label="包装维度" value="3"> </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="7">
- <el-input
- placeholder="请输入名称/编码/批次号/型号/规格/客户代号/刻码"
- v-model="query.keyWord"
- class="input-with-select"
- @keyup.enter.native="querySearch"
- >
- </el-input>
- </el-col>
- <el-col :span="8">
- <div
- style="
- display: flex;
- justify-content: flex-end;
- margin-bottom: 10px;
- "
- >
- <el-button
- slot="append"
- icon="el-icon-search"
- type="primary"
- @click="querySearch"
- >搜索</el-button
- >
- <el-button
- @click="queryReset"
- icon="el-icon-refresh-left"
- size="small"
- type="primary"
- >重置</el-button
- >
- <el-button type="primary" @click="merge">调出</el-button>
- </div>
- </el-col>
- </el-row>
- </el-form>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- height="calc(100vh-300px)"
- :pageSize="20"
- :datasource="datasource"
- cache-key="wms-inventoryAllocation-add-table-left"
- :selection.sync="selection"
- row-key="id"
- :initLoad="false"
- @done="onDone"
- >
- </ele-pro-table>
- </div>
- <div class="allocateDetails">
- <header-title :title="`调入明细`"></header-title>
- <el-form
- label-position="left"
- class="ele-form-search"
- @submit.native.prevent
- >
- <el-row :gutter="15">
- <el-col :span="12">
- <el-form-item
- label-width="65px"
- label="调入工厂:"
- prop="targetFactoriesId"
- >
- <el-select
- :disabled="allocateId == 1 || isEdit"
- style="width: 100%"
- @change="targetFactoryChange"
- v-model="params.targetFactoriesId"
- placeholder="请选择工厂"
- >
- <el-option
- v-for="item in factoryList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item
- label-width="65px"
- label="调入仓库:"
- prop="inWarehouseId"
- >
- <template>
- <el-select
- :disabled="allocateId == 1 || isEdit"
- @change="inWarehouseChange"
- style="width: 100%"
- v-model="params.inWarehouseId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in inTreeList"
- :disabled="item.hiden"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item
- label-width="65px"
- label="调入库区:"
- prop="inCargoAreaId"
- >
- <template>
- <el-select
- @change="inCargoAreaChange"
- style="width: 100%"
- v-model="params.inCargoAreaId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in inCargoAreaList"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item
- label-width="65px"
- label="调入货架:"
- prop="inShelvesId"
- >
- <template>
- <el-select
- style="width: 100%"
- @change="inShelvesChange"
- v-model="params.inShelvesId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in inShelvesList"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item
- label-width="65px"
- label="调入货位:"
- prop="inFreightId"
- >
- <template>
- <el-select
- style="width: 100%"
- @change="inFreightIdChange"
- v-model="params.inFreightId"
- placeholder="请选择"
- >
- <el-option
- v-for="item in inFreightList"
- :label="item.name"
- :value="item.id"
- :key="item.name"
- >
- </el-option>
- </el-select>
- </template>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <ele-pro-table
- ref="detailTable"
- :columns="columnsRight"
- height="calc(100vh-300px)"
- :datasource="tableData"
- cache-key="wms-inventoryAllocation-add-table-right"
- :initLoad="false"
- :need-page="false"
- >
- <template v-slot:quantity="{ row }">
- <el-input-number
- v-model="row.quantity"
- controls-position="right"
- :min="0"
- :max="row.measureQuantity"
- :precision="2"
- style="width: 100%"
- ></el-input-number>
- </template>
- <template v-slot:action="scoped">
- <el-button
- @click="deleted(scoped.row, scoped.$index)"
- type="text"
- size="small"
- >删除</el-button
- >
- </template>
- </ele-pro-table>
- <div class="submit_item">
- <el-button type="primary" @click="submit(0)">保存</el-button
- ><el-button type="primary" @click="config">提交</el-button></div
- >
- </div>
- </div>
- </el-card>
- </div>
- </template>
- <script>
- import storageApi from '@/api/warehouseManagement/index.js';
- import { getCode } from '@/api/codeManagement/index.js';
- import { allocationType } from '@/utils/dict/warehouse';
- import { getWarehouseList } from '@/api/classifyManage/itemInformation';
- import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
- export default {
- data() {
- return {
- query: {},
- allocationType,
- outTreeList: [],
- inTreeList: [],
- selectionIds: [],
- selection: [],
- tableData: [],
- productList: [],
- allocateId: 2,
- currentPullAreaId: '',
- currentPullAreaName: '',
- currentTuneAreaId: '',
- currentTuneAreaName: '',
- pullLibrary: [], // 调出库
- tuneLibrary: [], // 调入库
- outWarehouseList: [],
- inWarehouseList: [],
- dimension: '2',
- // 搜索验证状态
- searchState: { hasError: false },
- params: {
- code: '',
- name: '',
- outWarehouseId: '', // 调出仓库
- outWarehouseName: '',
- outCargoAreaId: '', // 调出库区
- outCargoAreaName: '',
- outShelvesId: '', // 调出货架
- outShelvesName: '',
- outFreightId: '', // 调出货位
- outFreightName: '',
- targetFactoriesId: '', // 调入工厂
- inWarehouseId: '', // 调入仓库
- inWarehouseName: '',
- inCargoAreaId: '', // 调入库区
- inCargoAreaName: '',
- inShelvesId: '', // 调入货架
- inShelvesName: '',
- inFreightId: '', // 调入货位
- inFreightName: ''
- },
- outCargoAreaList: [], // 调出库区列表
- outShelvesList: [], // 调出货架列表
- outFreightList: [], // 调出货位列表
- inCargoAreaList: [], // 调入库区列表
- inShelvesList: [], // 调入货架列表
- inFreightList: [], // 调入货位列表
- treeLoading: false,
- currentObj: {},
- factoryList: [],
- isEdit: false,
- factoryId: '', // 工厂ID
- transferOrderId: '', // 调拨单ID
- page: 1,
- size: 20,
- total: 0,
- };
- },
- computed: {
- // 表格列配置
- columns() {
- return [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center',
- fixed: 'left'
- },
- {
- prop: 'categoryCode',
- label: '物品编码',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'categoryName',
- label: '物品名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 180
- },
- {
- prop: 'warehouseName',
- label: '仓库',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110,
- },
- {
- prop: 'areaName',
- label: '库区',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'goodsShelfName',
- label: '货架',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'goodsAllocationName',
- label: '货位',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'brandNum',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'categoryModel',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true,
- },
- ...(this.dimension != '1' ? [{
- prop: 'batchNo',
- label: '批次号',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true,
- }] : []),
- ...(this.dimension == '3' ? [
- {
- prop: 'packageNo',
- label: '包装编码',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true,
- },
- {
- prop: 'packingQuantity',
- label: '包装数量',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'packingUnit',
- label: '包装单位',
- align: 'center',
- showOverflowTooltip: true,
- }
- ] : []),
- {
- prop: 'measureQuantity',
- label: '计量数量',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'measureUnit',
- label: '计量单位',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'weight',
- label: '重量',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'weightUnit',
- label: '重量单位',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'productionDate',
- label: '生产日期',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true,
- },
- {
- prop: 'purchaseDate',
- label: '采购日期',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'barcodes',
- label: '发货条码',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'clientCode',
- label: '客户代号',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'engrave',
- label: '刻码',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'materielDesignation',
- label: '物料代号',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'saleOrderNos',
- label: '销售订单号',
- align: 'center',
- minWidth: 150,
- showOverflowTooltip: true,
- formatter(row) {
- return row.saleOrderInfo?.saleOrderNos || '';
- }
- },
- {
- prop: 'customerNames',
- label: '客户',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150,
- formatter(row) {
- return row.saleOrderInfo?.customerNames || '';
- }
- }
- ]
- },
- columnsRight() {
- return [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'categoryCode',
- label: '物品编码',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'categoryName',
- label: '物品名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 180
- },
- {
- prop: 'outWarehouseArea',
- label: '调出区域',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'inWarehouseArea',
- label: '调入区域',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 200
- },
- {
- prop: 'brandNum',
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'categoryModel',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true,
- },
- // {
- // prop: 'batchNo',
- // label: '批次号',
- // align: 'center',
- // showOverflowTooltip: true,
- // minWidth: 110
- // },
- ...(this.dimension != '1' ? [{
- prop: 'batchNo',
- label: '批次号',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true,
- }] : []),
- this.dimension == 3 ? {
- prop: 'packageNo',
- label: '包装编码',
- align: 'center',
- minWidth: 130,
- showOverflowTooltip: true,
- } : '',
- this.dimension == 3 ? {
- prop: 'packingQuantity',
- label: '包装数量',
- align: 'center',
- showOverflowTooltip: true,
- }:'',
- this.dimension == 3 ? {
- prop: 'packingUnit',
- label: '包装单位',
- align: 'center',
- showOverflowTooltip: true,
- } : '',
- {
- prop: 'measureQuantity',
- label: '计量数量',
- align: 'center',
- showOverflowTooltip: true,
- },
- {
- prop: 'quantity',
- label: '调拨数量',
- align: 'center',
- minWidth: 130,
- slot: 'quantity',
- showOverflowTooltip: true,
- // render: (h, { row, column, index }) => {
- // return h('el-input-number', {
- // props: {
- // value: row.quantity,
- // min: 0,
- // max: row.measureQuantity,
- // precision: 2
- // },
- // on: {
- // input: (val) => {
- // this.$set(row, 'quantity', val);
- // }
- // },
- // style: {
- // width: '100%'
- // }
- // });
- // }
- },
- {
- prop: 'measureUnit',
- label: '计量单位',
- align: 'center',
- showOverflowTooltip: true,
- },
- // {
- // prop: 'weight',
- // label: '重量',
- // align: 'center',
- // showOverflowTooltip: true,
- // },
- // {
- // prop: 'weightUnit',
- // label: '重量单位',
- // align: 'center',
- // showOverflowTooltip: true,
- // },
- {
- label: '操作',
- align: 'center',
- fixed: 'right',
- width: 100,
- slot: 'action'
- }
- ].filter(Boolean);
- },
- userInfo() {
- console.log('this.$store.state.user.info------', this.$store.state.user.info);
- return this.$store.state.user.info
- }
- },
- async created() {
-
- // this.getTreeData();
- await this.getFactoryList();
- if (this.$route.query.isEdit) {
- console.log('this.$route.query.isEdit------', this.$route.query.isEdit);
- this.isEdit = true;
- this.getEditInfo();
- } else {
- const code = await getCode('transfer_no');
- const name = await getCode('inventory_allocation_name');
- this.params.name = name;
- this.params.code = code;
- if(this.factoryList.find(item => item.id == this.userInfo.factoryId)?.id) {
- this.factoryId = this.userInfo.factoryId;
- this.params.targetFactoriesId = this.factoryId
- // if(this.allocateId == 1) {
- // this.params.targetFactoriesId = this.factoryId
- // }
- this.getTreeData(this.factoryId)
- }
- }
- },
- watch: {
- productList() {
- this.doLayout();
- this.$refs.table.setSelectedRowKeys(this.selectionIds);
- }
- },
- methods: {
- /* 表格数据源 */
- async datasource({ page, limit, where }) {
- // return storageApi.getAllotApplyPage({
- // pageNum: page,
- // size: limit,
- // ...where
- // });
- let params = {
- ...this.query,
- warehouseId: this.params.outWarehouseId,
- warehouseAreaId: this.params.outCargoAreaId,
- warehouseAreaGoodsId: this.params.outShelvesId,
- warehouseAreaGoodsShelvesId: this.params.outFreightId
- };
- const data = await storageApi[
- this.dimension == 1 ? 'getProductList' : this.dimension == 2 ? 'getBatchList' : 'getPackingList'
- ]({
- ...params,
- pageNum: page,
- size: limit
- });
- return data;
- },
- onDone(res) {
- console.log('res:', res);
- this.$nextTick(() => {
- // 回显选中的数据的复选框
- console.log('data------data', this.selectionIds);
- this.$refs.table.setSelectedRowKeys(this.selectionIds);
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where });
- },
- doLayout() {
- let that = this;
- this.$nextTick(() => {
- console.log('操作了!!');
- // console.log('that.$refs.table------', that.$refs.table);
- that.$refs.table.doLayout();
- });
- },
- async getEditInfo() {
- const dataList = await storageApi.getAllotDetailList({
- applyId: this.$route.query.id
- });
- const baseInfo = await storageApi.getAllotDetail(this.$route.query.id);
- // 初始化基础数据
- this.factoryId = baseInfo.factoriesId;
- this.allocateId = baseInfo.type;
- this.transferOrderId = baseInfo.id;
- await this.getTreeData(); // 初始仓库
- this.params = {
- code: baseInfo.allotCode,
- name: baseInfo.name,
- outWarehouseId: baseInfo.sourceWarehouseId, // 调出仓库
- outWarehouseName: baseInfo.sourceWarehouse,
- outCargoAreaId: '', // 调出库区
- outCargoAreaName: '',
- outShelvesId: '', // 调出货架
- outShelvesName: '',
- outFreightId: '', // 调出货位
- outFreightName: '',
- targetFactoriesId: baseInfo.targetFactoriesId, // 调入工厂
- inWarehouseId: baseInfo.targetWarehouseId, // 调入仓库
- inWarehouseName: baseInfo.targetWarehouse,
- inCargoAreaId: '', // 调入库区
- inCargoAreaName: '',
- inShelvesId: '', // 调入货架
- inShelvesName: '',
- inFreightId: '', // 调入货位
- inFreightName: ''
- };
- console.log('baseInfo------', baseInfo);
- // 兼容旧数据
- if (baseInfo.inventoryDimension == 0) {
- if (dataList?.length) {
- if (dataList[0].packageNo) {
- this.dimension = '2';
- }else{
- this.dimension = '2';
- }
- }
- } else {
- this.dimension = baseInfo.inventoryDimension + '';
- }
-
- if (this.allocateId == 1) {
- // 库内调拨
- await this.outWarehouseChange(baseInfo.sourceWarehouseId); // 加载调出库区
- } else {
- // 库外调拨
- await this.outWarehouseChange(baseInfo.sourceWarehouseId); // 加载调出库区
- this.inWarehouseChange(baseInfo.targetWarehouseId); // 加载调入库区
- }
- // 处理右边显示数据
- this.selectionIds = dataList.map((item) => item.outInDetailRecordId);
- console.log('this.selectionIds------', this.selectionIds);
- console.log('this.productList------', this.productList);
- // this.selection = this.productList.filter((item) => {
- // return this.selectionIds.includes(item.id);
- // });
- this.selection = dataList;
- // this.selection.forEach((item) => {
- // this.$refs.table.toggleRowSelection(item);
- // });
- this.$refs.table.setSelectedRowKeys(this.selectionIds);
- console.log('this.selection------', this.selection);
- this.tableData = this.selection.map((item, index) => {
- // let filterObj = dataList.filter(
- // (ite) => ite.outInDetailRecordId == item.id
- // )[0];
- // console.log('filterObj---', filterObj);
- return {
- ...item,
- // quantity: filterObj.measureQuantity,
- // warehouseId: filterObj.warehouseId,
- // warehouseName: filterObj.warehouseName,
- // areaId: filterObj.areaId,
- // areaName: filterObj.areaName,
- // goodsAllocationId: filterObj.goodsAllocationId,
- // goodsAllocationName: filterObj.goodsAllocationName,
- // goodsShelfId: filterObj.goodsShelfId,
- // goodsShelfName: filterObj.goodsShelfName,
- // targetAreaId: filterObj.targetAreaId,
- // targetAreaName: filterObj.targetAreaName,
- // targetGoodsAllocationId: filterObj.targetGoodsAllocationId,
- // targetGoodsAllocationName: filterObj.targetGoodsAllocationName,
- // targetGoodsShelfId: filterObj.targetGoodsShelfId,
- // targetGoodsShelfName: filterObj.targetGoodsShelfName,
- // targetWarehouseId: filterObj.targetWarehouseId,
- // targetWarehouseName: filterObj.targetWarehouseName,
- outWarehouseArea:
- item.warehouseName +
- (item.areaName ? '-' + item.areaName : '') +
- (item.goodsShelfName ? '-' + item.goodsShelfName : '') +
- (item.goodsAllocationName
- ? '-' + item.goodsAllocationName
- : ''),
- inWarehouseArea:
- item.targetWarehouseName +
- (item.targetAreaName ? '-' + item.targetAreaName : '') +
- (item.targetGoodsShelfName
- ? '-' + item.targetGoodsShelfName
- : '') +
- (item.targetGoodsAllocationName
- ? '-' + item.targetGoodsAllocationName
- : '')
- };
- });
- console.log('this.tableData--------!!!!!', this.tableData);
- console.log(dataList);
- console.log(baseInfo);
- },
- factoryChange() {
- // this.params.inWarehouseName = this.params.outWarehouseName;
- this.params.targetFactoriesId = this.factoryId;
- console.log('this.params------', this.params);
- this.reset();
- this.getTreeData();
- },
- targetFactoryChange() {
- // this.reset();
- // this.getTreeData();
- },
- search() {
- return new Promise((resolve, reject) => {
- // 重置错误标志
- this.searchState.hasError = false;
- if(!this.params.targetFactoriesId){
- this.searchState.hasError = true;
- const errorMsg = '调入工厂不能为空';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- if(!this.params.inWarehouseId){
- this.searchState.hasError = true;
- const errorMsg = '调入仓库不能为空';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- // 检查是否存在quantity小于等于0或无效的项
- if(this.tableData.some((item) => !item.quantity || item.quantity <= 0)) {
- this.searchState.hasError = true;
- const errorMsg = '调拨数量不能为0';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- if (this.allocateId == 1) {
- // 库内调拨
- if (this.params.inFreightId && this.params.outFreightId) {
- if (this.params.inFreightId === this.params.outFreightId) {
- this.productList = [];
- this.searchState.hasError = true;
- const errorMsg = '调入货位不能与调出货位相同';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- } else if (!this.params.inFreightId && !this.params.outFreightId) {
- if (this.params.inShelvesId && this.params.outShelvesId) {
- if (this.params.inShelvesId === this.params.outShelvesId) {
- this.productList = [];
- this.searchState.hasError = true;
- const errorMsg = '调入货架不能与调出货架相同';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- } else if (!this.params.inShelvesId && !this.params.outShelvesId) {
- if (this.params.inCargoAreaId && this.params.outCargoAreaId) {
- if (this.params.inCargoAreaId === this.params.outCargoAreaId) {
- this.productList = [];
- this.searchState.hasError = true;
- const errorMsg = '调入库区不能与调出库区相同';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- } else if (
- !this.params.inCargoAreaId &&
- !this.params.outCargoAreaId
- ) {
- this.productList = [];
- this.searchState.hasError = true;
- const errorMsg = '调入库区与调出库区不能为空';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- } else {
- this.productList = [];
- this.searchState.hasError = true;
- const errorMsg = '调入库区与调出库区必须同时填写';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- } else {
- this.productList = [];
- this.searchState.hasError = true;
- const errorMsg = '调入货架与调出货架必须同时填写';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- } else {
- this.productList = [];
- this.searchState.hasError = true;
- const errorMsg = '调入货位与调出货位必须同时填写';
- this.$message.error(errorMsg);
- return reject(new Error(errorMsg));
- }
- // 验证通过,获取产品列表
- this.getProductList();
- resolve();
- } else {
- // 库外调拨
- resolve();
- // if (!this.params.inFreightId && !this.params.outFreightId) {
- // if (!this.params.inShelvesId && !this.params.outShelvesId) {
- // if (!this.params.inCargoAreaId && !this.params.outCargoAreaId) {
- // this.productList = [];
- // this.searchState.hasError = true;
- // const errorMsg = '调入库区与调出库区不能为空';
- // this.$message.error(errorMsg);
- // return reject(new Error(errorMsg));
- // } else if (
- // this.params.inCargoAreaId &&
- // this.params.outCargoAreaId
- // ) {
- // this.getProductList();
- // this.reload();
- // resolve();
- // } else {
- // this.productList = [];
- // this.searchState.hasError = true;
- // const errorMsg = '调入库区与调出库区必须同时填写';
- // this.$message.error(errorMsg);
- // return reject(new Error(errorMsg));
- // }
- // } else if (this.params.inShelvesId && this.params.outShelvesId) {
- // this.getProductList();
- // this.reload();
- // resolve();
- // } else {
- // this.productList = [];
- // this.searchState.hasError = true;
- // const errorMsg = '调入货架与调出货架必须同时填写';
- // this.$message.error(errorMsg);
- // return reject(new Error(errorMsg));
- // }
- // } else if (this.params.inFreightId && this.params.outFreightId) {
- // this.getProductList();
- // this.reload();
- // resolve();
- // } else {
- // this.productList = [];
- // this.searchState.hasError = true;
- // const errorMsg = '调入货位与调出货位必须同时填写';
- // this.$message.error(errorMsg);
- // return reject(new Error(errorMsg));
- // }
- }
- });
- },
- reset() {
- this.params = {
- ...this.params,
- outWarehouseId: '', // 调出仓库
- outWarehouseName: '',
- outCargoAreaId: '', // 调出库区
- outCargoAreaName: '',
- outShelvesId: '', // 调出货架
- outShelvesName: '',
- outFreightId: '', // 调出货位
- outFreightName: '',
- inWarehouseId: '', // 调入仓库
- inWarehouseName: '',
- inCargoAreaId: '', // 调入库区
- inCargoAreaName: '',
- inShelvesId: '', // 调入货架
- inShelvesName: '',
- inFreightId: '', // 调入货位
- inFreightName: ''
- };
- this.total = 0;
- this.productList = [];
- this.selection = [];
- this.selectionIds = [];
- this.outCargoAreaList = []; // 调出库区列表
- this.inCargoAreaList = []; // 调入库区列表
- this.outShelvesList = []; // 调出货架列表
- this.inShelvesList = []; // 调入货架列表
- this.outFreightList = []; // 调出货位列表
- this.inFreightList = []; // 调入货位列表
- },
- queryReset() {
- this.query = {};
- this.page = 1;
- this.getProductList();
- this.reload();
- },
- querySearch() {
- this.page = 1;
- this.getProductList();
- this.reload();
- },
- //获取工厂列表
- async getFactoryList() {
- const res = await warehouseDefinition.getFactoryarea({
- pageNum: 1,
- size: 9999,
- type: 1
- });
- this.factoryList = res.list;
- },
- async outWarehouseChange(val) {
- console.log('val------', val);
- this.outCargoAreaList = this.outTreeList.filter(
- (item) => item.id == val
- )[0]?.children;
- this.params.outWarehouseName = this.outTreeList.filter(
- (item) => item.id == val
- )[0]?.name;
- this.productList = [];
- this.tableData = [];
- this.selection = [];
- this.selectionIds = [];
- this.params.outCargoAreaId = ''; // 调出库区
- this.params.outCargoAreaName = '';
- this.params.outShelvesId = ''; // 调出货架
- this.params.outShelvesName = '';
- this.params.outFreightId = ''; // 调出货位
- this.params.outFreightName = '';
- this.outShelvesList = []; // 调出货架列表
- this.outFreightList = []; // 调出货位列表
- if (this.allocateId == 2) {
- // 过滤调入库区
- this.inTreeList = this.inTreeList.map((item) => {
- if (item.id === val) {
- return {
- ...item,
- hiden: true
- };
- } else {
- return {
- ...item,
- hiden: false
- };
- }
- });
- } else {
- console.log(11111)
- this.inCargoAreaList = this.outCargoAreaList;
- this.params.inWarehouseName = this.params.outWarehouseName;
- this.params.inWarehouseId = this.params.outWarehouseId;
- this.params.inCargoAreaId = ''; // 调出库区
- this.params.inCargoAreaName = '';
- this.params.inShelvesId = ''; // 调出货架
- this.params.inShelvesName = '';
- this.params.inFreightId = ''; // 调出货位
- this.params.inFreightName = '';
- this.inShelvesList = []; // 调入货架列表
- this.inFreightList = []; // 调入货位列表
- }
- console.log('this.params------~~~', this.params);
- await this.getProductList();
- await this.reload();
- },
- outCargoAreaChange(val) {
- this.outShelvesList = this.outCargoAreaList.filter(
- (item) => item.id == val
- )[0].children;
- this.params.outCargoAreaName = this.outCargoAreaList.filter(
- (item) => item.id == val
- )[0].name;
- this.productList = [];
- this.params.outShelvesId = ''; // 调出货架
- this.params.outShelvesName = '';
- this.params.outFreightId = ''; // 调出货位
- this.params.outFreightName = '';
- this.outFreightList = []; // 调出货位列表
- this.getProductList();
- this.reload();
- },
- outShelvesChange(val) {
- this.outFreightList = this.outShelvesList.filter(
- (item) => item.id == val
- )[0].children;
- this.params.outShelvesName = this.outShelvesList.filter(
- (item) => item.id == val
- )[0].name;
- this.productList = [];
- this.params.outFreightId = ''; // 调出货位
- this.params.outFreightName = '';
- this.getProductList();
- this.reload();
- },
- outFreightIdChange(val) {
- this.params.outFreightName = this.outFreightList.filter(
- (item) => item.id == val
- )[0].name;
- this.getProductList();
- this.reload();
- },
- inWarehouseChange(val) {
- this.inCargoAreaList = this.inTreeList.filter(
- (item) => item.id == val
- )[0]?.children;
- this.params.inWarehouseName = this.inTreeList.filter(
- (item) => item.id == val
- )[0]?.name;
- // this.productList = [];
- // this.tableData = [];
- // this.selection = [];
- // this.selectionIds = [];
- this.params.inCargoAreaId = ''; // 调出库区
- this.params.inCargoAreaName = '';
- this.params.inShelvesId = ''; // 调出货架
- this.params.inShelvesName = '';
- this.params.inFreightId = ''; // 调出货位
- this.params.inFreightName = '';
- this.inShelvesList = []; // 调入货架列表
- this.inFreightList = []; // 调入货位列表
- if (this.allocateId == 2) {
- // 过滤调出库区(库外调拨)
- this.outTreeList = this.outTreeList.map((item) => {
- if (item.id === val) {
- return {
- ...item,
- hiden: true
- };
- } else {
- return {
- ...item,
- hiden: false
- };
- }
- });
- console.log(this.outTreeList);
- }
- },
- inCargoAreaChange(val) {
- this.inShelvesList = this.inCargoAreaList.filter(
- (item) => item.id == val
- )[0].children;
- this.params.inCargoAreaName = this.inCargoAreaList.filter(
- (item) => item.id == val
- )[0].name;
- // this.productList = [];
- this.params.inShelvesId = ''; // 调出货架
- this.params.inShelvesName = '';
- this.params.inFreightId = ''; // 调出货位
- this.params.inFreightName = '';
- this.inFreightList = []; // 调入货位列表
- },
- inShelvesChange(val) {
- this.inFreightList = this.inShelvesList.filter(
- (item) => item.id == val
- )[0].children;
- this.params.inShelvesName = this.inShelvesList.filter(
- (item) => item.id == val
- )[0].name;
- // this.productList = [];
- this.params.inFreightId = ''; // 调出货位
- this.params.inFreightName = '';
- },
- inFreightIdChange(val) {
- this.params.inFreightName = this.inFreightList.filter(
- (item) => item.id == val
- )[0].name;
- },
- // 调出区域改变
- outChange(val) {
- console.log(this.$refs.outTree.getNodeByValue(val));
- let obj = this.$refs.outTree.getNodeByValue(val);
- this.currentObj = obj;
- this.getProductList();
- this.reload();
- },
- // 调入区域改变
- inChange(val) {
- let obj = this.$refs.outTree.getNodeByValue(val);
- },
- handledime() {
- this.getProductList();
- this.reload();
- this.selection=[]
- this.selectionIds = []
- this.$refs.table.clearSelection()
- this.tableData=[]
- },
- async getProductList() {
- let params = {
- ...this.query,
- warehouseId: this.params.outWarehouseId,
- warehouseAreaId: this.params.outCargoAreaId,
- warehouseAreaGoodsId: this.params.outShelvesId,
- warehouseAreaGoodsShelvesId: this.params.outFreightId
- };
- const data = await storageApi[
- this.dimension == 1 ? 'getProductList' : this.dimension == 2 ? 'getBatchList' : 'getPackingList'
- ]({
- ...params,
- pageNum: this.page,
- size: this.size
- });
- this.total = data.count;
- this.productList = data.list;
- },
- async getTreeData() {
- try {
- this.treeLoading = true;
- let res = await storageApi.getWarehouseTrees({
- factoriesId: this.factoryId
- });
- this.treeLoading = false;
- if (res?.code === '0') {
- this.outTreeList = res.data;
- this.inTreeList = res.data;
- }
- } catch (error) {
- console.log(error);
- }
- this.treeLoading = false;
- },
- deleted(row, index) {
- console.log('deleted~~~', row.id, index);
- this.tableData.splice(index, 1);
- this.selectionIds = this.selectionIds.filter((item) => item != row.outInDetailRecordId);
- this.selection = this.selection.filter((item) => item.id != row.id);
- this.$refs.table.setSelectedRowKeys(this.selectionIds);
- this.$forceUpdate()
- },
- config() {
- if (this.allocateId == 1) {
- // 库内
- this.submit(2);
- } else {
- // 库外
- this.submit(1);
- }
- },
- submit(status) {
- if (!this.params.name) {
- return this.$message.error('名称不能为空!');
- }
-
- // 提交前通过search方法校验数据
- this.search().then(() => {
- // 验证通过后检查表格数据
- if (this.tableData.length > 0) {
- let params = {
- categoryCode: this.tableData
- .map((item) => item.categoryCode)
- .join(','),
- categoryName: this.tableData
- .map((item) => item.categoryName)
- .join(','),
- allotApplyAddPOBuilders: this.tableData.map((item) => {
- return {
- quantity: item.quantity,
- categoryId: item.categoryId,
- warehouseId: item.warehouseId,
- warehouseName: item.warehouseName,
- areaId: item.areaId,
- areaName: item.areaName,
- goodsAllocationId: item.goodsAllocationId,
- goodsAllocationName: item.goodsAllocationName,
- goodsShelfId: item.goodsShelfId,
- goodsShelfName: item.goodsShelfName,
- outInDetailRecordId: item.outInDetailRecordId,
- targetAreaId: item.targetAreaId,
- targetAreaName: item.targetAreaName,
- targetGoodsAllocationId: item.targetGoodsAllocationId,
- targetGoodsAllocationName: item.targetGoodsAllocationName,
- targetGoodsShelfId: item.targetGoodsShelfId,
- targetGoodsShelfName: item.targetGoodsShelfName,
- targetWarehouseId: item.targetWarehouseId || this.params.inWarehouseId,
- targetWarehouseName: item.targetWarehouseName || this.params.inWarehouseName,
- targetFactoriesId: this.params.targetFactoriesId,
- saleOrderNos: item.saleOrderNos || '',
- customerNames: item.customerNames || '',
- };
- }),
- allotCode: this.params.code,
- name: this.params.name,
- id: this.transferOrderId,
- sourceWarehouse: this.params.outWarehouseName,
- sourceWarehouseId: this.params.outWarehouseId,
- targetWarehouse: this.params.inWarehouseName,
- targetWarehouseId: this.params.inWarehouseId,
- status: status,
- type: this.allocateId,
- inventoryDimension: this.dimension,
- targetFactoriesId: this.params.targetFactoriesId,
- };
- console.log('params------------', params);
- console.log('params.allotApplyAddPOBuilders------------', params);
- const customerNames = params.allotApplyAddPOBuilders.map((item) => item.customerNames);
- const saleOrderNos = params.allotApplyAddPOBuilders.map((item) => item.saleOrderNos);
-
- if (new Set(customerNames).size !== 1, new Set(saleOrderNos).size !== 1) {
- return this.$message.error('不同客户,不同销售订单的产品不允许调拨');
- }
- storageApi.allotApplySave(params).then(() => {
- this.$message.success('保存成功');
- this.$router.go(-1);
- });
- } else {
- this.$message.error('请调入相关数据');
- }
- }).catch((error) => {
- // 验证失败,不提交数据
- console.error('数据验证失败:', error);
- });
- },
- checkSelectable(row) {
- return !this.selectionIds.includes(row.id);
- },
- allocateChange(val) {
- this.allocateId = val;
- this.params = {
- ...this.params,
- outWarehouseId: '', // 调出仓库
- outWarehouseName: '',
- outCargoAreaId: '', // 调出库区
- outCargoAreaName: '',
- outShelvesId: '', // 调出货架
- outShelvesName: '',
- outFreightId: '', // 调出货位
- outFreightName: '',
- inWarehouseId: '', // 调入仓库
- inWarehouseName: '',
- inCargoAreaId: '', // 调入库区
- inCargoAreaName: '',
- inShelvesId: '', // 调入货架
- inShelvesName: '',
- inFreightId: '', // 调入货位
- inFreightName: ''
- };
- this.total = 0;
- this.productList = [];
- this.outShelvesList = [];
- this.outCargoAreaList = [];
- this.outFreightList = [];
- this.inShelvesList = [];
- this.inCargoAreaList = [];
- this.inFreightList = [];
- this.selectionIds = [];
- this.selection = [];
- this.tableData = [];
- this.$refs.table.clearSelection();
- this.getTreeData();
- // this.params = {
- // outWarehouseId: '',
- // outWarehouseName: '',
- // inWarehouseId: '',
- // inWarehouseName: ''
- // };
- // this.currentPullAreaId = '';
- // this.currentPullAreaName = '';
- // this.currentTuneAreaId = '';
- // this.currentTuneAreaName = '';
- // this.pullLibrary = [];
- // this.tuneLibrary = [];
- // this.productList = [];
- // this.tableData = [];
- // this.productList = [];
- // this.getWarehouseOptions();
- },
- pullClick(id, name) {
- if (this.currentPullAreaId == id) {
- return false;
- } else {
- console.log('-------------');
- this.currentPullAreaId = id;
- this.currentPullAreaName = name;
- this.currentTuneAreaId = '';
- this.currentTuneAreaName = '';
- }
- storageApi
- .getPackingList({
- warehouseAreaId: id,
- pageNum: 1,
- size: 9999
- })
- .then(({ list }) => {
- this.productList = list;
- });
- },
- tuneClick(id, name, boolen) {
- if (!this.currentPullAreaId) {
- return this.$message.error('请先选择调出库');
- }
- if (boolen) {
- return false;
- }
- this.currentTuneAreaId = id;
- this.currentTuneAreaName = name;
- },
- selecctedRow(val) {
- this.selection = val;
- },
- async getWarehouseOptions() {
- const { data } = await storageApi.getWarehouseTrees();
- this.outWarehouseList = data;
- this.inWarehouseList = data;
- },
- async merge() {
- if (!this.params.outWarehouseId) {
- return this.$message.error('请先选择调出仓库');
- }
- if (!this.params.inWarehouseId) {
- return this.$message.error('请先选择调入仓库');
- }
- if (this.selection.length > 0) {
- console.log(this.selection);
- console.log(this.selectionIds);
- let boolen = this.selection.every((item) =>
- this.selectionIds.includes(item.id)
- );
- console.log('boolen~~~~', boolen);
- if (this.selection.length > 0 && !boolen) {
- this.selection = this.selection.filter(
- (item) => !this.selectionIds.includes(item.id)
- );
- // // 判断货位
- // if (this.params.inFreightId) {
- // let isBoolen = this.selection.some(
- // (item) => item.goodsAllocationId == this.params.inFreightId
- // );
- // if (isBoolen) {
- // return this.$message.error('所选物品货位与调入货位重复!');
- // }
- // }
- // // 判断货架
- // if (!this.params.inFreightId && this.params.inShelvesId) {
- // let isBoolen = this.selection.some(
- // (item) => item.goodsShelfId == this.params.inShelvesId
- // );
- // if (isBoolen) {
- // return this.$message.error('所选物品货架与调入货架重复!');
- // }
- // }
- // // 判断库区
- // if (!this.params.inCargoAreaId) {
- // return this.$message.error('调入库区不能为空');
- // } else if (
- // !this.params.inFreightId &&
- // !this.params.inShelvesId &&
- // this.params.inCargoAreaId
- // ) {
- // let isBoolen = this.selection.some(
- // (item) => item.areaId == this.params.inCargoAreaId
- // );
- // if (isBoolen) {
- // return this.$message.error('所选物品库区与调入库区重复');
- // }
- // }
- if (!this.params.inFreightId && !this.params.inShelvesId) {
- // 只有调入库区
- for (let i = 0; i < this.selection.length; i++) {
- console.log(this.selection[i].areaId);
- console.log(this.params.inCargoAreaId);
- if (this.selection[i].areaId == this.params.inCargoAreaId) {
- return this.$message.error('所选物品库区与调入库区重复');
- }
- }
- } else if (this.params.inShelvesId && !this.params.inFreightId) {
- // 只有调入库区/货架
- for (let i = 0; i < this.selection.length; i++) {
- if (this.selection[i].areaId == this.params.inCargoAreaId) {
- // 库区相同
- if (
- this.selection[i].goodsShelfId == this.params.inShelvesId
- ) {
- // 货架相同
- return this.$message.error(
- '所选物品库区/货架与调入库区/货架重复'
- );
- } else {
- // 货架不同直接录入
- }
- } else {
- // 库区不同直接录入
- }
- }
- } else if (this.params.inShelvesId && this.params.inFreightId) {
- // 只有调入库区/货架/货位
- for (let i = 0; i < this.selection.length; i++) {
- if (this.selection[i].areaId == this.params.inCargoAreaId) {
- // 库区相同
- if (
- this.selection[i].goodsShelfId == this.params.inShelvesId
- ) {
- // 货架相同
- if (
- this.selection[i].goodsAllocationId ==
- this.params.inFreightId
- ) {
- // 货位相同
- return this.$message.error(
- '所选物品库区/货架/货位与调入库区/货架/货位重复'
- );
- } else {
- // 货位不同直接录入
- }
- } else {
- // 货架不同直接录入
- }
- } else {
- // 库区不同直接录入
- }
- }
- } else {
- return this.$message.error('调入库区不能为空');
- }
- this.selectionIds = this.selectionIds.concat(
- this.selection.map((item) => item.id)
- );
- console.log('this.selection---------', this.selection);
- console.log('this.selectionIds---', this.selectionIds);
- this.tableData = this.tableData.concat(
- this.selection.map((item) => {
- console.log('this.params---------', this.params);
- return {
- ...item,
- saleOrderNos: item.saleOrderInfo?.saleOrderNos || '',
- customerNames: item.saleOrderInfo?.customerNames || '',
- outInDetailRecordId: item.id,
- quantity: item.quantity || item.measureQuantity,
- categoryId: item.categoryId,
- warehouseId: this.params.outWarehouseId,
- warehouseName: this.params.outWarehouseName,
- areaId: this.params.outCargoAreaId,
- areaName: this.params.outCargoAreaName,
- goodsAllocationId: this.params.outFreightId,
- goodsAllocationName: this.params.outFreightName,
- goodsShelfId: this.params.outShelvesId,
- goodsShelfName: this.params.outShelvesName,
- targetAreaId: this.params.inCargoAreaId,
- targetAreaName: this.params.inCargoAreaName,
- targetGoodsAllocationId: this.params.inFreightId,
- targetGoodsAllocationName: this.params.inFreightName,
- targetGoodsShelfId: this.params.inShelvesId,
- targetGoodsShelfName: this.params.inShelvesName,
- targetWarehouseId: this.params.inWarehouseId,
- targetWarehouseName: this.params.inWarehouseName,
- targetFactoriesId: this.params.targetFactoriesId,
- outWarehouseArea:
- this.params.outWarehouseName +
- (this.params.outCargoAreaName
- ? '-' + this.params.outCargoAreaName
- : '') +
- (this.params.outShelvesName
- ? '-' + this.params.outShelvesName
- : '') +
- (this.params.outFreightName
- ? '-' + this.params.outFreightName
- : ''),
- inWarehouseArea:
- this.params.inWarehouseName +
- (this.params.inCargoAreaName
- ? '-' + this.params.inCargoAreaName
- : '') +
- (this.params.inShelvesName
- ? '-' + this.params.inShelvesName
- : '') +
- (this.params.inFreightName
- ? '-' + this.params.inFreightName
- : '')
- };
- })
- );
- console.log('this.tableData---------', this.tableData);
- } else {
- this.$message.error('请选择正确的行');
- }
- } else {
- this.$message.error('请选择调出物品信息');
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- #inventoryAllocate {
- height: 100%;
- .el-form-item {
- margin-bottom: 5px !important;
- }
- .submit_item {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- margin-top: 8px;
- height: 40px;
- }
- :deep(.el-form-item__label) {
- padding-right: 5px !important;
- }
- :deep(.el-card) {
- height: 100%;
- .el-card__body {
- height: 100%;
- box-sizing: border-box;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- }
- .col_height {
- height: 45px !important;
- }
- .productBox {
- display: flex;
- flex: 1;
- > div {
- flex: 1;
- overflow: hidden;
- }
- }
- .selectBox {
- padding: 20px;
- }
- .box-card {
- margin: 20px;
- }
- .productsList {
- margin-right: 10px;
- display: flex;
- flex-direction: column;
- :deep(.el-table) {
- flex: 1;
- display: flex;
- flex-direction: column;
- .el-table__body-wrapper {
- flex: 1;
- }
- }
- }
- .allocateDetails {
- display: flex;
- flex-direction: column;
- :deep(.el-table) {
- flex: 1;
- display: flex;
- flex-direction: column;
- .el-table__body-wrapper {
- flex: 1;
- }
- }
- }
- }
- </style>
|