| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835 |
- <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,
- }
- ]
- },
- 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,
- };
- }),
- 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);
- 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,
- 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>
|