add.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331
  1. <template>
  2. <div id="inventoryAllocate">
  3. <el-card class="box-card">
  4. <header-title title="基本信息"></header-title>
  5. <el-form
  6. label-width="90px"
  7. :model="params"
  8. :rules="rules"
  9. label-position="left"
  10. class="ele-form-search"
  11. >
  12. <el-row :gutter="15">
  13. <el-col :span="8" class="col_height">
  14. <el-form-item label="拣货单:" prop="code">
  15. <template>
  16. <el-input :disabled="true" v-model="params.code"></el-input>
  17. </template>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="8" class="col_height">
  21. <el-form-item label="拣货名称:" prop="name">
  22. <template>
  23. <el-input
  24. v-model="params.name"
  25. placeholder="请输入内容"
  26. ></el-input>
  27. </template>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="8" class="col_height">
  31. <el-form-item label="关联领料单:" prop="sourceBizNo">
  32. <template>
  33. <el-input
  34. placeholder="请选择"
  35. v-model="params.sourceBizNo"
  36. @click.native="openDocumentSourceDialog"
  37. >
  38. </el-input>
  39. </template>
  40. </el-form-item>
  41. </el-col>
  42. </el-row>
  43. </el-form>
  44. <div class="receiveBox">
  45. <div class="productsList">
  46. <header-title title="领料产品清单"></header-title>
  47. <el-table
  48. ref="table"
  49. :data="receiveList"
  50. row-key="id"
  51. :max-height="300"
  52. tooltip-effect="dark"
  53. border
  54. >
  55. <!-- <el-table-column
  56. align="center"
  57. width="50"
  58. :reserve-selection="true"
  59. :selectable="checkSelectable"
  60. type="selection"
  61. ></el-table-column> -->
  62. <el-table-column width="55" align="center">
  63. <template slot-scope="scope">
  64. <el-radio
  65. class="radio"
  66. @input="receiveListSelect(scope.row)"
  67. :disabled="scope.row.isConfig"
  68. :label="scope.row.id"
  69. v-model="radioValue"
  70. >&emsp;&emsp;&emsp;</el-radio
  71. >
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="序号" type="index" width="50">
  75. </el-table-column>
  76. <el-table-column
  77. label="物品编码"
  78. width="150"
  79. prop="categoryCode"
  80. :show-overflow-tooltip="true"
  81. ></el-table-column>
  82. <el-table-column
  83. label="物品名称"
  84. prop="categoryName"
  85. :show-overflow-tooltip="true"
  86. ></el-table-column>
  87. <el-table-column
  88. label="批次号"
  89. prop="batchNo"
  90. :show-overflow-tooltip="true"
  91. ></el-table-column>
  92. <el-table-column
  93. label="牌号"
  94. prop="brandNum"
  95. :show-overflow-tooltip="true"
  96. >
  97. </el-table-column>
  98. <el-table-column
  99. label="型号"
  100. prop="categoryModel"
  101. :show-overflow-tooltip="true"
  102. >
  103. </el-table-column>
  104. <el-table-column
  105. label="规格"
  106. prop="specification"
  107. :show-overflow-tooltip="true"
  108. >
  109. </el-table-column>
  110. <el-table-column
  111. label="包装编码"
  112. prop="packageNo"
  113. :show-overflow-tooltip="true"
  114. ></el-table-column>
  115. <el-table-column
  116. label="包装数量"
  117. prop="packingQuantity"
  118. :show-overflow-tooltip="true"
  119. ></el-table-column>
  120. <el-table-column
  121. label="包装单位"
  122. prop="packingUnit"
  123. :show-overflow-tooltip="true"
  124. ></el-table-column>
  125. <el-table-column
  126. label="计量数量"
  127. prop="measureQuantity"
  128. :show-overflow-tooltip="true"
  129. ></el-table-column>
  130. <el-table-column
  131. label="计量单位"
  132. prop="measuringUnit"
  133. :show-overflow-tooltip="true"
  134. ></el-table-column>
  135. <el-table-column
  136. label="重量"
  137. prop="weight"
  138. :show-overflow-tooltip="true"
  139. ></el-table-column>
  140. <el-table-column
  141. label="重量单位"
  142. prop="weightUnit"
  143. :show-overflow-tooltip="true"
  144. ></el-table-column>
  145. <el-table-column
  146. label="仓库"
  147. width="200"
  148. prop="warehouseName"
  149. :show-overflow-tooltip="true"
  150. ></el-table-column>
  151. </el-table>
  152. </div>
  153. </div>
  154. <div class="productBox">
  155. <div class="productsList">
  156. <header-title title="库存台账"></header-title>
  157. <el-form
  158. label-position="left"
  159. class="ele-form-search"
  160. @keyup.enter.native="search"
  161. @submit.native.prevent
  162. >
  163. <el-row :gutter="10">
  164. <el-col :span="6">
  165. <el-form-item label="列表维度:" prop="dimension">
  166. <template>
  167. <el-select
  168. @change="getProductList"
  169. v-model="dimension"
  170. placeholder="请选择"
  171. >
  172. <el-option label="批次维度" value="2"> </el-option>
  173. <el-option label="包装维度" value="3"> </el-option>
  174. </el-select>
  175. </template>
  176. </el-form-item>
  177. </el-col>
  178. <el-col :span="6">
  179. <el-form-item
  180. label-width="65px"
  181. label="拣货策略:"
  182. prop="warehouseId"
  183. >
  184. <template>
  185. <el-button type="primary" @click="automatic"
  186. >按件</el-button
  187. >
  188. <el-button type="primary" @click="automatic"
  189. >按批</el-button
  190. >
  191. <!-- <el-button type="primary" @click="automatic">手动</el-button> -->
  192. </template>
  193. </el-form-item>
  194. </el-col>
  195. <el-col :span="12">
  196. <div class="flex-right">
  197. <el-button type="primary" @click="disposal('拆包')"
  198. >拆包</el-button
  199. >
  200. <el-button type="primary" @click="disposal('打包')"
  201. >打包</el-button
  202. >
  203. <el-button type="primary" @click="confirm">确认</el-button>
  204. </div>
  205. </el-col>
  206. </el-row>
  207. </el-form>
  208. <!-- <el-form
  209. label-position="left"
  210. class="ele-form-search"
  211. @keyup.enter.native="search"
  212. @submit.native.prevent
  213. >
  214. <el-row :gutter="10">
  215. <el-col :span="12">
  216. <el-form-item
  217. label-width="65px"
  218. label="所属工厂:"
  219. prop="factoryId"
  220. >
  221. <el-select
  222. :disabled="isEdit"
  223. style="width: 100%"
  224. @change="factoryChange"
  225. v-model="factoryId"
  226. placeholder="请选择工厂"
  227. >
  228. <el-option
  229. v-for="item in factoryList"
  230. :key="item.id"
  231. :label="item.name"
  232. :value="item.id"
  233. ></el-option>
  234. </el-select>
  235. </el-form-item>
  236. </el-col>
  237. <el-col :span="12">
  238. <el-form-item
  239. label-width="65px"
  240. label="仓库:"
  241. prop="warehouseId"
  242. >
  243. <template>
  244. <el-select
  245. :disabled="isEdit"
  246. style="width: 100%"
  247. @change="outWarehouseChange"
  248. v-model="params.warehouseId"
  249. placeholder="请选择"
  250. >
  251. <el-option
  252. v-for="item in warehouseList"
  253. :disabled="item.hiden"
  254. :label="item.name"
  255. :value="item.id"
  256. :key="item.name"
  257. >
  258. </el-option>
  259. </el-select>
  260. </template>
  261. </el-form-item>
  262. </el-col>
  263. </el-row>
  264. <el-row :gutter="15">
  265. <el-col :span="18">
  266. <el-input
  267. placeholder="请输入名称/编码/批次号/型号/规格/客户代号/刻码"
  268. v-model="query.keyWord"
  269. class="input-with-select"
  270. >
  271. <el-button
  272. slot="append"
  273. icon="el-icon-search"
  274. type="primary"
  275. @click="getProductList"
  276. >搜索</el-button
  277. >
  278. </el-input>
  279. </el-col>
  280. <el-col :span="6">
  281. <div
  282. style="
  283. display: flex;
  284. justify-content: flex-end;
  285. margin-bottom: 10px;
  286. "
  287. >
  288. <el-button
  289. @click="queryReset"
  290. icon="el-icon-refresh-left"
  291. size="small"
  292. type="primary"
  293. >重置</el-button
  294. >
  295. <el-button type="primary" @click="merge">{{
  296. typeName
  297. }}</el-button>
  298. </div>
  299. </el-col>
  300. </el-row>
  301. </el-form> -->
  302. <el-table
  303. ref="productListTable"
  304. :max-height="300"
  305. :data="productList"
  306. row-key="id"
  307. @selection-change="selecctedRow"
  308. tooltip-effect="dark"
  309. border
  310. >
  311. <el-table-column
  312. v-if="dimension == 3"
  313. align="center"
  314. width="50"
  315. :reserve-selection="true"
  316. :selectable="checkSelectable"
  317. type="selection"
  318. ></el-table-column>
  319. <el-table-column label="序号" type="index" width="50">
  320. </el-table-column>
  321. <el-table-column
  322. label="物品编码"
  323. prop="categoryCode"
  324. :show-overflow-tooltip="true"
  325. ></el-table-column>
  326. <el-table-column
  327. label="物品名称"
  328. prop="categoryName"
  329. :show-overflow-tooltip="true"
  330. ></el-table-column>
  331. <el-table-column
  332. label="批次号"
  333. prop="batchNo"
  334. :show-overflow-tooltip="true"
  335. ></el-table-column>
  336. <el-table-column
  337. label="牌号"
  338. prop="brandNum"
  339. :show-overflow-tooltip="true"
  340. >
  341. </el-table-column>
  342. <el-table-column
  343. label="型号"
  344. prop="categoryModel"
  345. :show-overflow-tooltip="true"
  346. >
  347. </el-table-column>
  348. <el-table-column
  349. label="规格"
  350. prop="specification"
  351. :show-overflow-tooltip="true"
  352. >
  353. </el-table-column>
  354. <el-table-column
  355. label="包装编码"
  356. prop="packageNo"
  357. :show-overflow-tooltip="true"
  358. ></el-table-column>
  359. <el-table-column
  360. label="包装数量"
  361. prop="packingQuantity"
  362. :show-overflow-tooltip="true"
  363. ></el-table-column>
  364. <el-table-column
  365. label="包装单位"
  366. prop="packingUnit"
  367. :show-overflow-tooltip="true"
  368. ></el-table-column>
  369. <el-table-column
  370. label="计量数量"
  371. prop="measureQuantity"
  372. :show-overflow-tooltip="true"
  373. ></el-table-column>
  374. <el-table-column
  375. label="计量单位"
  376. prop="measureUnit"
  377. :show-overflow-tooltip="true"
  378. ></el-table-column>
  379. <el-table-column
  380. label="重量"
  381. prop="weight"
  382. :show-overflow-tooltip="true"
  383. ></el-table-column>
  384. <el-table-column
  385. label="重量单位"
  386. prop="weightUnit"
  387. :show-overflow-tooltip="true"
  388. ></el-table-column>
  389. <el-table-column
  390. label="仓库"
  391. prop="warehouseName"
  392. :show-overflow-tooltip="true"
  393. ></el-table-column>
  394. </el-table>
  395. <el-pagination
  396. background
  397. layout="total, sizes, prev, pager, next, jumper"
  398. :total="total"
  399. :page-sizes="[10, 20, 50, 100]"
  400. :page-size.sync="query.size"
  401. :current-page.sync="query.pageNum"
  402. @current-change="getProductList"
  403. @size-change="getProductList"
  404. >
  405. </el-pagination>
  406. </div>
  407. <!-- <div class="allocateDetails">
  408. <header-title :title="`${typeName}明细`"></header-title>
  409. <el-table
  410. :max-height="627"
  411. ref="detailTable"
  412. :data="tableData"
  413. tooltip-effect="dark"
  414. border
  415. >
  416. <el-table-column label="序号" type="index" width="50">
  417. </el-table-column>
  418. <el-table-column
  419. label="物品编码"
  420. prop="categoryCode"
  421. :show-overflow-tooltip="true"
  422. ></el-table-column>
  423. <el-table-column
  424. label="物品名称"
  425. prop="categoryName"
  426. :show-overflow-tooltip="true"
  427. ></el-table-column>
  428. <el-table-column
  429. label="批次号"
  430. prop="batchNo"
  431. :show-overflow-tooltip="true"
  432. ></el-table-column>
  433. <el-table-column
  434. label="牌号"
  435. prop="brandNum"
  436. :show-overflow-tooltip="true"
  437. >
  438. </el-table-column>
  439. <el-table-column
  440. label="型号"
  441. prop="categoryModel"
  442. :show-overflow-tooltip="true"
  443. >
  444. </el-table-column>
  445. <el-table-column
  446. label="规格"
  447. prop="specification"
  448. :show-overflow-tooltip="true"
  449. >
  450. </el-table-column>
  451. <el-table-column
  452. label="包装编码"
  453. prop="packageNo"
  454. :show-overflow-tooltip="true"
  455. ></el-table-column>
  456. <el-table-column
  457. label="包装数量"
  458. prop="packingQuantity"
  459. :show-overflow-tooltip="true"
  460. ></el-table-column>
  461. <el-table-column
  462. label="包装单位"
  463. prop="packingUnit"
  464. :show-overflow-tooltip="true"
  465. ></el-table-column>
  466. <el-table-column
  467. label="计量数量"
  468. prop="measureQuantity"
  469. :show-overflow-tooltip="true"
  470. ></el-table-column>
  471. <el-table-column
  472. label="计量单位"
  473. prop="measureUnit"
  474. :show-overflow-tooltip="true"
  475. ></el-table-column>
  476. <el-table-column
  477. label="重量"
  478. prop="weight"
  479. :show-overflow-tooltip="true"
  480. ></el-table-column>
  481. <el-table-column
  482. label="重量单位"
  483. prop="weightUnit"
  484. :show-overflow-tooltip="true"
  485. ></el-table-column>
  486. <el-table-column
  487. label="仓库"
  488. prop="warehouseName"
  489. :show-overflow-tooltip="true"
  490. ></el-table-column>
  491. <el-table-column
  492. label="货区"
  493. prop="areaName"
  494. :show-overflow-tooltip="true"
  495. ></el-table-column>
  496. <el-table-column
  497. label="货架"
  498. prop="goodsAllocationName"
  499. :show-overflow-tooltip="true"
  500. >
  501. </el-table-column>
  502. <el-table-column
  503. label="货位"
  504. prop="goodsShelfName"
  505. :show-overflow-tooltip="true"
  506. >
  507. </el-table-column>
  508. <el-table-column
  509. label="生产日期"
  510. prop="productionDate"
  511. :show-overflow-tooltip="true"
  512. >
  513. </el-table-column>
  514. <el-table-column
  515. label="采购日期"
  516. prop="purchaseDate"
  517. :show-overflow-tooltip="true"
  518. >
  519. </el-table-column>
  520. <el-table-column
  521. label="发货条码"
  522. prop="barcodes"
  523. :show-overflow-tooltip="true"
  524. >
  525. </el-table-column>
  526. <el-table-column
  527. label="客户代号"
  528. prop="clientCode"
  529. :show-overflow-tooltip="true"
  530. >
  531. </el-table-column>
  532. <el-table-column
  533. label="刻码"
  534. prop="engrave"
  535. :show-overflow-tooltip="true"
  536. >
  537. </el-table-column>
  538. <el-table-column
  539. label="物料代号"
  540. prop="materielDesignation"
  541. :show-overflow-tooltip="true"
  542. >
  543. </el-table-column>
  544. </el-table>
  545. <div class="submit_item">
  546. <el-button type="primary" @click="submit">保存</el-button></div
  547. >
  548. </div> -->
  549. </div>
  550. <div class="pickingBox">
  551. <div class="productsList">
  552. <header-title title="拣货清单"></header-title>
  553. <el-table
  554. ref="table"
  555. :data="pickingList"
  556. row-key="id"
  557. @selection-change="selecctedRow"
  558. tooltip-effect="dark"
  559. border
  560. >
  561. <el-table-column label="序号" type="index" width="50">
  562. </el-table-column>
  563. <el-table-column
  564. label="物品编码"
  565. width="150"
  566. prop="categoryCode"
  567. :show-overflow-tooltip="true"
  568. ></el-table-column>
  569. <el-table-column
  570. label="物品名称"
  571. prop="categoryName"
  572. :show-overflow-tooltip="true"
  573. ></el-table-column>
  574. <el-table-column
  575. label="批次号"
  576. prop="batchNo"
  577. :show-overflow-tooltip="true"
  578. ></el-table-column>
  579. <el-table-column
  580. label="牌号"
  581. prop="brandNum"
  582. :show-overflow-tooltip="true"
  583. >
  584. </el-table-column>
  585. <el-table-column
  586. label="型号"
  587. prop="categoryModel"
  588. :show-overflow-tooltip="true"
  589. >
  590. </el-table-column>
  591. <el-table-column
  592. label="规格"
  593. prop="specification"
  594. :show-overflow-tooltip="true"
  595. >
  596. </el-table-column>
  597. <el-table-column
  598. label="包装编码"
  599. prop="packageNo"
  600. :show-overflow-tooltip="true"
  601. ></el-table-column>
  602. <el-table-column
  603. label="包装数量"
  604. prop="packingQuantity"
  605. :show-overflow-tooltip="true"
  606. ></el-table-column>
  607. <el-table-column
  608. label="包装单位"
  609. prop="packingUnit"
  610. :show-overflow-tooltip="true"
  611. ></el-table-column>
  612. <el-table-column
  613. label="计量数量"
  614. prop="measureQuantity"
  615. :show-overflow-tooltip="true"
  616. ></el-table-column>
  617. <el-table-column
  618. label="计量单位"
  619. prop="measureUnit"
  620. :show-overflow-tooltip="true"
  621. ></el-table-column>
  622. <el-table-column
  623. label="重量"
  624. prop="weight"
  625. :show-overflow-tooltip="true"
  626. ></el-table-column>
  627. <el-table-column
  628. label="重量单位"
  629. prop="weightUnit"
  630. :show-overflow-tooltip="true"
  631. ></el-table-column>
  632. <el-table-column
  633. label="仓库"
  634. width="200"
  635. prop="warehouseName"
  636. :show-overflow-tooltip="true"
  637. ></el-table-column>
  638. <el-table-column label="操作">
  639. <template v-slot="{ row, $index }">
  640. <el-button size="mini" type="text" @click="deleted(row, $index)"
  641. >删除</el-button
  642. >
  643. </template>
  644. </el-table-column>
  645. </el-table>
  646. </div>
  647. </div>
  648. <div class="control">
  649. <el-button type="primary" v-if="type == '新增'" @click="save(true)"
  650. >保存</el-button
  651. >
  652. <el-button type="primary" v-else @click="save(false)">修改</el-button>
  653. <el-button type="primary" v-if="type == '新增'" @click="config(true)"
  654. >提交</el-button
  655. >
  656. <el-button type="primary" v-else @click="config(false)">提交</el-button>
  657. </div>
  658. </el-card>
  659. <outboundRequisitionDialog
  660. ref="outboundRequisitionDialogRef"
  661. @detailData="outboundRequisitionSelection"
  662. type="2"
  663. />
  664. <disassembleDialog ref="disassembleDialogRef" @flushed="reFlushed" />
  665. </div>
  666. </template>
  667. <script>
  668. import outboundRequisitionDialog from './components/outboundRequisitionDialog.vue';
  669. import storageApi from '@/api/warehouseManagement/index.js';
  670. import { getCode } from '@/api/codeManagement/index.js';
  671. import { getWarehouseList } from '@/api/classifyManage/itemInformation';
  672. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  673. import disassembleDialog from './components/disassembleDialog.vue';
  674. export default {
  675. components: {
  676. outboundRequisitionDialog,
  677. disassembleDialog
  678. },
  679. data() {
  680. return {
  681. query: {
  682. warehouseId: '',
  683. categoryCode: '',
  684. pageNum: 1,
  685. size: 10
  686. },
  687. dimension: '3',
  688. typeOptions: [
  689. {
  690. label: '拆包',
  691. value: 1
  692. },
  693. {
  694. label: '打包',
  695. value: 2
  696. }
  697. ],
  698. radioValue: '',
  699. pickingList: [],
  700. receiveList: [],
  701. warehouseList: [],
  702. inTreeList: [],
  703. selectionIds: [],
  704. selection: [],
  705. tableData: [],
  706. productList: [],
  707. typeId: 1,
  708. typeName: '拆包',
  709. currentPullAreaId: '',
  710. currentPullAreaName: '',
  711. currentTuneAreaId: '',
  712. currentTuneAreaName: '',
  713. pullLibrary: [], // 调出库
  714. tuneLibrary: [], // 调入库
  715. outWarehouseList: [],
  716. inWarehouseList: [],
  717. rules: {
  718. name: [
  719. { required: true, message: '拣货名称不能为空', trigger: 'blur' }
  720. ],
  721. sourceBizNo: [
  722. {
  723. required: true,
  724. message: '关联领料单不能为空',
  725. trigger: ['blur', 'change']
  726. }
  727. ]
  728. },
  729. params: {
  730. code: '',
  731. name: '',
  732. sourceBizNo: '', // 领料单
  733. warehouseId: '', // 仓库ID
  734. warehouseName: '' // 仓库名称
  735. },
  736. queryList: {},
  737. outCargoAreaList: [], // 调出库区列表
  738. outShelvesList: [], // 调出货架列表
  739. outFreightList: [], // 调出货位列表
  740. inCargoAreaList: [], // 调入库区列表
  741. inShelvesList: [], // 调入货架列表
  742. inFreightList: [], // 调入货位列表
  743. treeLoading: false,
  744. currentObj: {},
  745. factoryList: [],
  746. isEdit: false,
  747. isView: false,
  748. factoryId: '', // 工厂ID
  749. transferOrderId: '', // 调拨单ID
  750. type: '', // 类型
  751. page: 1,
  752. size: 10,
  753. total: 0
  754. };
  755. },
  756. async created() {
  757. this.type = this.$route.query.type;
  758. if (this.$route.query.type == '新增') {
  759. const code = await getCode('transfer_no');
  760. this.params.code = code;
  761. } else {
  762. if (this.$route.query.type == '详情') {
  763. this.isView = true;
  764. }
  765. this.getEditInfo(this.$route.query.id);
  766. }
  767. },
  768. methods: {
  769. deleted(row, index) {
  770. this.pickingList.splice(index, 1);
  771. this.radioValue = '';
  772. this.receiveList = this.receiveList.map((item) => {
  773. if (item.categoryId == row.categoryId) {
  774. return {
  775. ...item,
  776. isConfig: false
  777. };
  778. }
  779. return item;
  780. });
  781. },
  782. automatic() {
  783. if (this.radioValue) {
  784. this.$message.error('库存台账不满足策略,请手动进行选择操作');
  785. } else {
  786. this.$message.error('请选择领料产品清单物品');
  787. }
  788. },
  789. async save(isSave) {
  790. console.log(isSave);
  791. if (!this.params.name) {
  792. return this.$message.error('请输入拣货名称');
  793. }
  794. if (!this.params.sourceBizNo) {
  795. return this.$message.error('请选择关联领料单');
  796. }
  797. if (this.pickingList.length > 0) {
  798. if (isSave) {
  799. console.log('新增保存');
  800. try {
  801. await storageApi.savePickgoods({
  802. code: this.params.code,
  803. name: this.params.name,
  804. sourceNo: this.params.sourceBizNo,
  805. warehouseId: this.pickingList[0].warehouseId,
  806. warehouseName: this.pickingList[0].warehouseName,
  807. status: 0, // 拣货中
  808. info: this.pickingList
  809. });
  810. this.$message.success('保存成功');
  811. this.$router.go(-1);
  812. } catch (error) {
  813. this.$message.error('保存失败');
  814. }
  815. } else {
  816. console.log('新增修改');
  817. try {
  818. await storageApi.updatePickgoods({
  819. id: this.params.id,
  820. code: this.params.code,
  821. name: this.params.name,
  822. sourceNo: this.params.sourceBizNo,
  823. warehouseId: this.pickingList[0].warehouseId,
  824. warehouseName: this.pickingList[0].warehouseName,
  825. status: 0, // 拣货中
  826. info: this.pickingList
  827. });
  828. this.$message.success('修改成功');
  829. this.$router.go(-1);
  830. } catch (error) {
  831. this.$message.error('修改失败');
  832. }
  833. }
  834. } else {
  835. this.$message.error('拣货清单不能为空');
  836. }
  837. },
  838. async confirm() {
  839. if (this.selection.length == 1) {
  840. let currentPackingUnit = this.receiveList.filter(
  841. (item) => item.id == this.radioValue
  842. )[0].packingUnit;
  843. if (currentPackingUnit == this.selection[0].packingUnit) {
  844. this.pickingList = this.pickingList.concat(this.selection);
  845. this.receiveList = this.receiveList.map((item) => {
  846. if (item.id == this.radioValue) {
  847. return {
  848. ...item,
  849. isConfig: true
  850. };
  851. } else {
  852. return {
  853. ...item
  854. };
  855. }
  856. });
  857. this.productList = [];
  858. this.selection = [];
  859. this.total = 0;
  860. this.$refs.productListTable.clearSelection();
  861. console.log(this.receiveList);
  862. } else {
  863. return this.$message.error('所选物品与清单包装单位不一致');
  864. }
  865. } else {
  866. this.$message.error('请选选择对应包装规格数量的拣货的物品');
  867. }
  868. },
  869. disposal(typeName) {
  870. console.log(typeName);
  871. if (this.selection.length > 0) {
  872. this.$refs.disassembleDialogRef.open(this.selection, typeName);
  873. } else {
  874. this.$message.error(`请选择需要${typeName}的物品`);
  875. }
  876. },
  877. receiveListSelect(data) {
  878. console.log(data);
  879. this.selection = [];
  880. this.$refs.productListTable.clearSelection();
  881. this.query.warehouseId = data.warehouseId;
  882. this.query.categoryCode = data.categoryCode;
  883. this.getProductList();
  884. },
  885. async config(isSave) {
  886. console.log(isSave);
  887. if (!this.params.name) {
  888. return this.$message.error('请输入拣货名称');
  889. }
  890. if (!this.params.sourceBizNo) {
  891. return this.$message.error('请选择关联领料单');
  892. }
  893. if (this.receiveList.length === this.pickingList.length) {
  894. if (isSave) {
  895. console.log('提交保存');
  896. try {
  897. await storageApi.savePickgoods({
  898. code: this.params.code,
  899. name: this.params.name,
  900. sourceNo: this.params.sourceBizNo,
  901. warehouseId: this.pickingList[0].warehouseId,
  902. warehouseName: this.pickingList[0].warehouseName,
  903. status: 2, // 出库
  904. info: this.pickingList
  905. });
  906. this.$message.success('出库成功');
  907. this.$router.go(-1);
  908. } catch (error) {
  909. this.$message.error('出库失败');
  910. }
  911. } else {
  912. console.log('提交修改');
  913. try {
  914. await storageApi.updatePickgoods({
  915. id: this.params.id,
  916. code: this.params.code,
  917. name: this.params.name,
  918. sourceNo: this.params.sourceBizNo,
  919. warehouseId: this.pickingList[0].warehouseId,
  920. warehouseName: this.pickingList[0].warehouseName,
  921. status: 2, // 出库
  922. info: this.pickingList
  923. });
  924. this.$message.success('出库成功');
  925. this.$router.go(-1);
  926. } catch (error) {
  927. this.$message.error('出库失败');
  928. }
  929. }
  930. } else {
  931. this.$message.error('请核对拣货清单是否与领料单是否一致');
  932. }
  933. },
  934. outboundRequisitionSelection(data, sourceBizNo) {
  935. this.params.sourceBizNo = sourceBizNo;
  936. this.receiveList = data.map((item) => {
  937. return {
  938. ...item,
  939. isConfig: false
  940. };
  941. });
  942. // 清空
  943. this.productList = [];
  944. this.pickingList = [];
  945. this.selection = [];
  946. this.$refs.productListTable.clearSelection();
  947. },
  948. reFlushed() {
  949. this.selection = [];
  950. this.$refs.productListTable.clearSelection();
  951. this.getProductList();
  952. },
  953. clearDocumentSource() {
  954. this.params.sourceBizNo = '';
  955. },
  956. // 打开单据来源弹窗
  957. openDocumentSourceDialog() {
  958. this.$refs.outboundRequisitionDialogRef.open();
  959. },
  960. async getEditInfo(id) {
  961. storageApi.getPickgoodsDetails(id).then((data) => {
  962. console.log(data);
  963. this.params.id = data.id;
  964. this.params.sourceBizNo = data.sourceNo;
  965. this.params.code = data.code;
  966. this.params.name = data.name;
  967. this.pickingList = data.info;
  968. let categoryCodeList = data.info.map((item) => item.categoryCode);
  969. this.receiveList = data.list.map((item) => {
  970. return {
  971. ...item,
  972. isConfig: categoryCodeList.includes(item.categoryCode)
  973. };
  974. });
  975. });
  976. },
  977. factoryChange() {
  978. this.reset();
  979. this.getTreeData();
  980. },
  981. search() {
  982. this.getProductList();
  983. },
  984. reset() {
  985. this.params = {
  986. ...this.params
  987. };
  988. this.total = 0;
  989. this.productList = [];
  990. this.selection = [];
  991. this.selectionIds = [];
  992. },
  993. queryReset() {
  994. if (this.params.warehouseId) {
  995. this.query = {};
  996. this.getProductList();
  997. }
  998. },
  999. //获取工厂列表
  1000. async getFactoryList() {
  1001. const res = await warehouseDefinition.getFactoryarea({
  1002. pageNum: 1,
  1003. size: 9999,
  1004. type: 1
  1005. });
  1006. this.factoryList = res.list;
  1007. },
  1008. async outWarehouseChange(val) {
  1009. this.outCargoAreaList = this.warehouseList.filter(
  1010. (item) => item.id == val
  1011. )[0].children;
  1012. this.params.warehouseName = this.warehouseList.filter(
  1013. (item) => item.id == val
  1014. )[0].name;
  1015. this.productList = [];
  1016. this.tableData = [];
  1017. this.selection = [];
  1018. this.selectionIds = [];
  1019. await this.getProductList();
  1020. },
  1021. async getProductList() {
  1022. let data = null;
  1023. if (this.dimension == 2) {
  1024. // 批次维度
  1025. data = await storageApi.getBatchList(this.query);
  1026. } else {
  1027. // 包装维度
  1028. data = await storageApi.getPackingList(this.query);
  1029. }
  1030. this.total = data.count;
  1031. this.productList = data.list;
  1032. },
  1033. async getTreeData() {
  1034. try {
  1035. this.treeLoading = true;
  1036. let res = await storageApi.getWarehouseTrees({
  1037. factoriesId: this.factoryId
  1038. });
  1039. this.treeLoading = false;
  1040. if (res?.code === '0') {
  1041. this.warehouseList = res.data;
  1042. }
  1043. } catch (error) {
  1044. console.log(error);
  1045. }
  1046. this.treeLoading = false;
  1047. },
  1048. // deleted(row, index) {
  1049. // this.tableData.splice(index, 1);
  1050. // console.log(this.selectionIds);
  1051. // this.selectionIds = this.selectionIds.filter((item) => item !== row.id);
  1052. // },
  1053. submit() {
  1054. if (this.tableData.length > 0) {
  1055. } else {
  1056. this.$message.error('请调入相关数据');
  1057. }
  1058. },
  1059. checkSelectable(row) {
  1060. return !this.selectionIds.includes(row.id);
  1061. },
  1062. allocateChange(val) {
  1063. this.typeId = val;
  1064. this.typeName = this.typeOptions.filter(
  1065. (item) => item.value == val
  1066. )[0].label;
  1067. this.total = 0;
  1068. this.productList = [];
  1069. this.selectionIds = [];
  1070. this.selection = [];
  1071. this.tableData = [];
  1072. this.params.warehouseId = '';
  1073. this.$refs.table.clearSelection();
  1074. this.getTreeData();
  1075. },
  1076. selecctedRow(val) {
  1077. this.selection = val;
  1078. },
  1079. async getWarehouseOptions() {
  1080. const { data } = await storageApi.getWarehouseTrees();
  1081. this.outWarehouseList = data;
  1082. this.inWarehouseList = data;
  1083. },
  1084. async merge() {
  1085. if (this.selection.length > 0) {
  1086. console.log(this.selection);
  1087. console.log(this.selectionIds);
  1088. let boolen = this.selection.every((item) =>
  1089. this.selectionIds.includes(item.id)
  1090. );
  1091. if (this.selection.length > 0 && !boolen) {
  1092. this.selection = this.selection.filter(
  1093. (item) => !this.selectionIds.includes(item.id)
  1094. );
  1095. console.log('this.selection---------', this.selection);
  1096. console.log('this.selectionIds---', this.selectionIds);
  1097. if (this.typeName == '拆包') {
  1098. // 拆包
  1099. // 获取包装维度
  1100. let packingSpecification =
  1101. await storageApi.getCategoryPackageDisposition({
  1102. categoryIds: this.selection.map((item) => item.categoryId)
  1103. });
  1104. let packingSpecificationOption = this.selection.map((item) => {
  1105. return packingSpecification
  1106. .filter((ite) => item.categoryId == ite.categoryId)
  1107. .sort((a, b) => a.sort - b.sort);
  1108. });
  1109. let isBoolen = this.selection.every(
  1110. (item, index) =>
  1111. item.packingUnit !==
  1112. packingSpecificationOption[index][0].packageUnit
  1113. );
  1114. if (isBoolen) {
  1115. let list = this.selection.map((item, index) => {
  1116. let splitIndex = packingSpecificationOption[index].findIndex(
  1117. (ite) =>
  1118. ite.conversionUnit != ite.packageUnit &&
  1119. item.packingUnit == ite.conversionUnit
  1120. );
  1121. // 计算最小计量数量和数量
  1122. let measureQuantity = 1;
  1123. let reduceIndex = splitIndex;
  1124. for (; reduceIndex > 0; reduceIndex--) {
  1125. measureQuantity = this.$math.format(
  1126. measureQuantity *
  1127. packingSpecificationOption[index][reduceIndex - 1]
  1128. .packageCell,
  1129. 14
  1130. );
  1131. }
  1132. return {
  1133. ...item,
  1134. packingQuantity: 1,
  1135. packingUnit:
  1136. packingSpecificationOption[index][splitIndex].packageUnit,
  1137. num: packingSpecificationOption[index][splitIndex]
  1138. .packageCell,
  1139. measureUnit:
  1140. packingSpecificationOption[index][1].packageUnit,
  1141. measureQuantity,
  1142. weight: this.$math.format(
  1143. item.weight /
  1144. packingSpecificationOption[index][splitIndex]
  1145. .packageCell,
  1146. 14
  1147. )
  1148. };
  1149. });
  1150. list.forEach((item) => {
  1151. for (let i = 0; i < item.num; i++) {
  1152. this.tableData.push({ ...item });
  1153. }
  1154. });
  1155. console.log(list);
  1156. } else {
  1157. return this.$message.error(
  1158. `请选择需要正确${this.typeName}选项`
  1159. );
  1160. }
  1161. console.log(
  1162. 'packingSpecificationOption-----',
  1163. packingSpecificationOption
  1164. );
  1165. } else {
  1166. // 打包
  1167. let isBoolen = this.selection.every(
  1168. (item) =>
  1169. item.categoryId == this.selection[0].categoryId &&
  1170. item.packingUnit == this.selection[0].packingUnit
  1171. );
  1172. if (isBoolen) {
  1173. let packingSpecification =
  1174. await storageApi.getCategoryPackageDisposition({
  1175. categoryIds: [this.selection[0].categoryId]
  1176. });
  1177. let packingSpecificationOption = packingSpecification.sort(
  1178. (a, b) => a.sort - b.sort
  1179. );
  1180. let splitIndex = packingSpecificationOption.findIndex(
  1181. (ite) =>
  1182. ite.conversionUnit != ite.packageUnit &&
  1183. this.selection[0].packingUnit == ite.packageUnit
  1184. );
  1185. console.log(packingSpecificationOption);
  1186. console.log(splitIndex);
  1187. if (splitIndex < 0) {
  1188. return this.$message.error(
  1189. '已经为最大包装维度,不能进行打包'
  1190. );
  1191. }
  1192. if (
  1193. this.selection.length <=
  1194. packingSpecificationOption[splitIndex].packageCell
  1195. ) {
  1196. this.tableData.push({
  1197. ...this.selection[0],
  1198. packingQuantity: 1,
  1199. packingUnit:
  1200. packingSpecificationOption[splitIndex].conversionUnit,
  1201. measureQuantity: this.selection.reduce(
  1202. (a, b) =>
  1203. this.$math.format(
  1204. Number(a) + Number(b.measureQuantity),
  1205. 14
  1206. ),
  1207. 0
  1208. ),
  1209. weight: this.selection.reduce(
  1210. (a, b) =>
  1211. this.$math.format(Number(a) + Number(b.weight), 14),
  1212. 0
  1213. )
  1214. });
  1215. } else {
  1216. return this.$message.error('打包数量超出最大包装数量');
  1217. }
  1218. } else {
  1219. return this.$message.error(
  1220. `请选择需要正确${this.typeName}选项`
  1221. );
  1222. }
  1223. }
  1224. this.selectionIds = this.selectionIds.concat(
  1225. this.selection.map((item) => item.id)
  1226. );
  1227. } else {
  1228. this.$message.error('请选择正确的行');
  1229. }
  1230. } else {
  1231. this.$message.error('请选择调出物品信息');
  1232. }
  1233. }
  1234. }
  1235. };
  1236. </script>
  1237. <style lang="scss" scoped>
  1238. #inventoryAllocate {
  1239. height: 1000px;
  1240. .submit_item {
  1241. display: flex;
  1242. justify-content: flex-end;
  1243. align-items: center;
  1244. margin-top: 8px;
  1245. height: 40px;
  1246. }
  1247. :deep(.el-form-item__label) {
  1248. padding-right: 5px !important;
  1249. }
  1250. :deep(.el-card) {
  1251. height: 100%;
  1252. .el-card__body {
  1253. height: 100%;
  1254. box-sizing: border-box;
  1255. overflow: hidden;
  1256. display: flex;
  1257. flex-direction: column;
  1258. }
  1259. }
  1260. .col_height {
  1261. height: 45px !important;
  1262. }
  1263. .receiveBox,
  1264. .pickingBox {
  1265. display: flex;
  1266. flex: 2;
  1267. > div {
  1268. flex: 1;
  1269. overflow: hidden;
  1270. }
  1271. }
  1272. .productBox {
  1273. display: flex;
  1274. flex: 3;
  1275. > div {
  1276. flex: 1;
  1277. overflow: hidden;
  1278. }
  1279. }
  1280. .selectBox {
  1281. padding: 20px;
  1282. }
  1283. .box-card {
  1284. margin: 20px;
  1285. }
  1286. .flex-right {
  1287. display: flex;
  1288. justify-content: flex-end;
  1289. }
  1290. .productsList {
  1291. margin-right: 10px;
  1292. display: flex;
  1293. flex-direction: column;
  1294. :deep(.el-table) {
  1295. flex: 1;
  1296. display: flex;
  1297. flex-direction: column;
  1298. .el-table__body-wrapper {
  1299. flex: 1 0 auto;
  1300. height: 0;
  1301. }
  1302. }
  1303. }
  1304. .allocateDetails {
  1305. display: flex;
  1306. flex-direction: column;
  1307. :deep(.el-table) {
  1308. flex: 1;
  1309. display: flex;
  1310. flex-direction: column;
  1311. .el-table__body-wrapper {
  1312. flex: 1;
  1313. }
  1314. }
  1315. }
  1316. .control {
  1317. display: flex;
  1318. justify-content: flex-end;
  1319. padding: 10px 10px 0 10px;
  1320. box-sizing: border-box;
  1321. }
  1322. :deep(.el-radio__input.is-disabled .el-radio__inner) {
  1323. background-color: #1890ff !important;
  1324. border-color: #1890ff !important;
  1325. }
  1326. :deep(.el-radio__input.is-disabled.is-checked .el-radio__inner::after) {
  1327. background-color: #1890ff !important;
  1328. }
  1329. }
  1330. </style>