CurrentStock.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <div class="container-fluid">
  3. <Navbar
  4. title="库存查询"
  5. :is-go-back="false"
  6. />
  7. <div
  8. class="flex-container"
  9. style="margin-top: 10px;"
  10. >
  11. <div class="flex-header">
  12. <div>
  13. <div
  14. class="form-inline"
  15. role="form"
  16. >
  17. <div class="form-group">
  18. SKU:
  19. <input
  20. v-model="queryNo"
  21. autocomplete="off"
  22. type="text"
  23. class="form-control"
  24. placeholder="请输入要查询物料的SKU"
  25. aria-describedby="basic-addon"
  26. style="width:250px;"
  27. @keyup.enter="queryInventory"
  28. />
  29. 物料名称:
  30. <input
  31. v-model="queryName"
  32. autocomplete="off"
  33. type="text"
  34. class="form-control"
  35. placeholder="请输入要查询物料的名称"
  36. aria-describedby="basic-addon"
  37. style="width:250px;"
  38. @keyup.enter="queryInventory"
  39. />
  40. 规格型号:
  41. <input
  42. v-model="queryType"
  43. autocomplete="off"
  44. type="text"
  45. class="form-control"
  46. placeholder="请输入要查询物料的规格型号"
  47. aria-describedby="basic-addon"
  48. style="width:250px;"
  49. @keyup.enter="queryInventory"
  50. />
  51. 物料类型:
  52. <select
  53. v-model="selectType"
  54. class="form-control"
  55. @change="changeSelectType"
  56. >
  57. <option value="0">全部</option>
  58. <option value="001">成套工具箱</option>
  59. <option value="002">散件</option>
  60. </select>
  61. </div>
  62. <div class="form-group">
  63. <button
  64. class="btn btn-default"
  65. @click="queryInventory"
  66. >
  67. 查询
  68. </button>
  69. </div>
  70. <div class="form-group">
  71. <button
  72. class="btn btn-success"
  73. @click="exportExcel"
  74. >
  75. 导出
  76. </button>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div
  82. class="flex-content"
  83. style="margin-top: 10px;"
  84. >
  85. <table class="fixed-table table-striped table-bordered">
  86. <thead>
  87. <tr>
  88. <th style="width: 50px;">
  89. 序号
  90. </th>
  91. <th style="width: 70px;">
  92. 图片
  93. </th>
  94. <th style="width: 150px;">
  95. 物料名称
  96. </th>
  97. <th style="width: 100px;">
  98. SKU
  99. </th>
  100. <th style="width: 150px;">
  101. 规格型号
  102. </th>
  103. <th style="width: 80px;">
  104. 入库总数量
  105. </th>
  106. <th style="width: 80px;">
  107. 库存数量
  108. </th>
  109. <th style="width: 80px;">
  110. 出库总数量
  111. </th>
  112. <th style="width: 80px;">
  113. RFID管理
  114. </th>
  115. <th style="width: 80px;">
  116. 物料类型
  117. </th>
  118. <th style="width: 100px;">
  119. 操作
  120. </th>
  121. </tr>
  122. </thead>
  123. <tbody class="table1">
  124. <tr v-for="(inventoryInstance, index) in inventoryInstanceDatas" :key="inventoryInstance.id">
  125. <td>
  126. {{ index + 1 + (pagination.current_page-1) * pagination.per_page }}
  127. </td>
  128. <td>
  129. <img
  130. :src="Common.getThumbnailImageSrc(className, inventoryInstance.imageName)"
  131. class="image"
  132. @click="$refs.imagePreview.preview(className, inventoryInstance.imageName)"
  133. />
  134. </td>
  135. <td>
  136. {{ inventoryInstance.inventoryName }}
  137. </td>
  138. <td>
  139. {{ inventoryInstance.inventoryNo }}
  140. </td>
  141. <td>
  142. {{ inventoryInstance.inventoryType }}
  143. </td>
  144. <td>
  145. {{ inventoryInstance.totalQuantity }}
  146. </td>
  147. <td>
  148. {{ inventoryInstance.stockQuantity }}
  149. </td>
  150. <td>
  151. {{ inventoryInstance.stockOutQuantity }}
  152. </td>
  153. <td>
  154. {{ inventoryInstance.rfidManagement == true ? '是':'否' }}
  155. </td>
  156. <td>
  157. {{ inventoryInstance.tagNo == '001' ? '成套工具箱':'散件' }}
  158. </td>
  159. <td>
  160. <button
  161. type="button"
  162. class="btn btn-link"
  163. style="width: 100%"
  164. @click="findByInventoryId(inventoryInstance)"
  165. >
  166. 查看详情
  167. </button>
  168. </td>
  169. </tr>
  170. </tbody>
  171. </table>
  172. </div>
  173. <div class="flex-footer">
  174. <div>
  175. <div class="form-group">
  176. <div class="pull-left">
  177. 共查询到<b>{{ pagination.total }}</b>条数据
  178. </div>
  179. <div class="pull-right">
  180. <VueBootstrapPagination
  181. v-if="pagination.last_page > 0"
  182. :pagination="pagination"
  183. :callback="queryInventory"
  184. />
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. <Modal
  191. v-model:show="modal"
  192. small="true"
  193. :show-canel-button="true"
  194. :show-ok-button="false"
  195. >
  196. <template #header>
  197. <p>{{ displayData.inventoryNo }}-{{ displayData.inventoryName }}>>库存详情</p>
  198. </template>
  199. <table class="fixed-table table-striped table-bordered">
  200. <thead>
  201. <tr>
  202. <th style="width: 100px;">
  203. 序号
  204. </th>
  205. <th style="width: 150px;">
  206. 物料编码
  207. </th>
  208. <th style="width: 150px;">
  209. 物料名称
  210. </th>
  211. <th style="width: 150px;">
  212. 状态
  213. </th>
  214. <th style="width: 100px;">
  215. 货位
  216. </th>
  217. <th style="width: 100px;">
  218. 项目事件
  219. </th>
  220. <th style="width: 100px;">
  221. 齐套情况
  222. </th>
  223. </tr>
  224. </thead>
  225. <tbody class="table1">
  226. <tr v-for="(data, index) in inventoryInstanceCurrentStocks" :key="data.id">
  227. <td>
  228. {{ index+1 }}
  229. </td>
  230. <td>
  231. {{ data.no }}
  232. </td>
  233. <td>
  234. {{ data.name }}
  235. </td>
  236. <td>
  237. {{ (data.positionId == undefined || data.positionId == null)? '已出库':'在库' }}
  238. </td>
  239. <td>
  240. {{ data.positionBarCode }}
  241. </td>
  242. <td>
  243. {{ data.projectItem }}
  244. </td>
  245. <td>
  246. {{ data.finished == false ? '未补齐':'已补齐' }}
  247. </td>
  248. </tr>
  249. </tbody>
  250. </table>
  251. <div class="modal-footer">
  252. <slot name="footer" />
  253. </div>
  254. </Modal>
  255. <Modal
  256. v-model:show="modal2"
  257. small="true"
  258. :show-canel-button="true"
  259. :show-ok-button="false"
  260. >
  261. <template #header>
  262. <p>{{ displayData.inventoryNo }}-{{ displayData.inventoryName }}>>库存详情</p>
  263. </template>
  264. <table class="fixed-table table-striped table-bordered">
  265. <thead>
  266. <tr>
  267. <th style="width: 100px;">
  268. 序号
  269. </th>
  270. <th style="width: 150px;">
  271. 所在成套工具箱
  272. </th>
  273. <th style="width: 150px;">
  274. 数量
  275. </th>
  276. <th style="width: 150px;">
  277. 货位
  278. </th>
  279. <th style="width: 150px;">
  280. 项目事件
  281. </th>
  282. </tr>
  283. </thead>
  284. <tbody class="table1">
  285. <tr v-for="(data, index) in inventoryInstanceCurrentStocks2" :key="data.id">
  286. <td>
  287. {{ index+1 }}
  288. </td>
  289. <td>
  290. {{ data.no }}
  291. </td>
  292. <td>
  293. {{ data.quantity }}
  294. </td>
  295. <td>
  296. {{ data.positionBarCode }}
  297. </td>
  298. <td>
  299. {{ data.projectItem }}
  300. </td>
  301. </tr>
  302. </tbody>
  303. </table>
  304. <div class="modal-footer">
  305. <slot name="footer" />
  306. </div>
  307. </Modal>
  308. <Modal
  309. v-model:show="modal3"
  310. :full="true"
  311. :show-canel-button="true"
  312. :show-ok-button="false"
  313. >
  314. <template #header>
  315. <p>{{ displayData.inventoryNo }}-{{ displayData.inventoryName }}>>出入库流水</p>
  316. </template>
  317. <div class="modal-body">
  318. <InAndOutFlow :display-data="displayData" />
  319. </div>
  320. <div class="modal-footer">
  321. <slot name="footer" />
  322. </div>
  323. </Modal>
  324. <Loading v-if="loading" />
  325. <ImagePreview ref="imagePreview" />
  326. </div>
  327. </template>
  328. <script>
  329. import Common from '../common/Common.js';
  330. import InventoryInstanceResource from '../api/common/InventoryInstanceResource.js';
  331. import InventoryInstanceBindResource from '../api/wms/InventoryInstanceBindResource.js';
  332. import CurrentStockResource from '../api/wms/CurrentStockResource.js';
  333. import InAndOutFlow from './InAndOutFlow.vue';
  334. export default {
  335. components: {
  336. InAndOutFlow,
  337. },
  338. data: function () {
  339. this.Common = Common;
  340. return {
  341. displayData: {},
  342. queryNo: '',
  343. queryName: '',
  344. queryType: '',
  345. inventoryInstanceDatas: [],
  346. inventoryInstanceCurrentStocks: [],
  347. inventoryInstanceCurrentStocks2: [],
  348. inventoryInstanceCurrentStocks3: [],
  349. recordIds: [],
  350. pagination: {
  351. total: 0,
  352. per_page: Common.pageSize, // required
  353. current_page: 1, // required
  354. last_page: 0, // required
  355. },
  356. isUpdatePage: true,
  357. className: 'com.leanwo.prodog.model.common.Inventory',
  358. allRepeatPack: [], //重复打印全部的id
  359. printType: 0,//类型 0:采购入库打印/1:扫描入库打印
  360. selectType: '0',
  361. loading: false,
  362. modal: false,
  363. modal2: false,
  364. modal3: false,
  365. };
  366. },
  367. mounted: function () {
  368. var _self = this;
  369. _self.queryInventory();
  370. $('.fixed-table').tableFixer({
  371. 'left': 3,
  372. 'head': true,
  373. });
  374. $('.fixed-table').colResizable({
  375. resizeMode: 'overflow',
  376. partialRefresh: true,
  377. });
  378. },
  379. methods: {
  380. /**
  381. * 导出excel
  382. */
  383. exportExcel: function () {
  384. var _self = this;
  385. var loginInfo = localStorage.getItem('#LoginInfo');
  386. var loginData = JSON.parse(loginInfo);
  387. var whereClause = ' totalInventory.clientId=' + loginData.loginClientId;
  388. if (_self.queryNo != null && _self.queryNo.length > 0) {
  389. whereClause = whereClause + ' AND totalInventory.no like ' + '\'%' + _self.queryNo + '%\'';
  390. if (_self.queryName != null && _self.queryName.length > 0) {
  391. whereClause = whereClause + ' OR totalInventory.name like ' + '\'%' + _self.queryName + '%\'';
  392. }
  393. if (_self.queryType != null && _self.queryType.length > 0) {
  394. whereClause = whereClause + ' OR totalInventory.type like ' + '\'%' + _self.queryType + '%\'';
  395. }
  396. } else if (_self.queryName != null && _self.queryName.length > 0) {
  397. whereClause = whereClause + ' AND totalInventory.name like ' + '\'%' + _self.queryName + '%\'';
  398. if (_self.queryType != null && _self.queryType.length > 0) {
  399. whereClause = whereClause + ' OR totalInventory.type like ' + '\'%' + _self.queryType + '%\'';
  400. }
  401. } else if (_self.queryType != null && _self.queryType.length > 0) {
  402. whereClause = whereClause + ' AND totalInventory.type like ' + '\'%' + _self.queryType + '%\'';
  403. }
  404. whereClause = encodeURIComponent(whereClause);
  405. var url = '/ureport/preview?_u=dicfile-wms:stock.ureport.xml&whereClause=' + whereClause;
  406. window.open(url);
  407. },
  408. /**
  409. * 根据存货档案id进行查询
  410. */
  411. findByInventoryId: function (data) {
  412. var _self = this;
  413. if (data.totalQuantity == undefined || data.totalQuantity == null) {
  414. Notify.error('提示', '物料暂无入库记录', false);
  415. return;
  416. }
  417. var inventoryId = data.inventoryId;
  418. var tagNo = data.tagNo;
  419. var rfidManagement = data.rfidManagement;
  420. _self.displayData = data;
  421. if (rfidManagement == true) {
  422. if (tagNo == undefined || tagNo == null || tagNo == '002') {
  423. InventoryInstanceResource.findCurrentStockByInventoryId(inventoryId).then(successData => {
  424. if(successData.errorCode == 0) {
  425. if (successData.datas && successData.datas.length > 0) {
  426. _self.inventoryInstanceCurrentStocks2 = successData.datas;
  427. _self.modal2 = true;
  428. }
  429. } else {
  430. Notify.error('错误', successData.errorMessage, false);
  431. return;
  432. }
  433. }, errorData => {
  434. Common.processException(errorData);
  435. });
  436. } else {
  437. InventoryInstanceBindResource.findByInventoryId(inventoryId).then(successData => {
  438. if(successData.errorCode == 0) {
  439. if (successData.datas) {
  440. _self.inventoryInstanceCurrentStocks = successData.datas;
  441. _self.modal = true;
  442. }
  443. }
  444. }, errorData => {
  445. Common.processException(errorData);
  446. });
  447. }
  448. } else {
  449. _self.modal3 = true;
  450. }
  451. },
  452. changeSelectType: function () {
  453. var _self = this;
  454. _self.pagination.current_page = 1;
  455. _self.queryInventory();
  456. },
  457. /**
  458. * 根据物料名称或者编号查询数据
  459. */
  460. queryInventory: function () {
  461. var _self = this;
  462. if (_self.inventoryInstanceDatas == undefined) {
  463. _self.inventoryInstanceDatas = [];
  464. }
  465. var queryNo = $.trim(_self.queryNo);
  466. var queryName = $.trim(_self.queryName);
  467. var queryType = $.trim(_self.queryType);
  468. if ((queryNo.length > 0 || queryName.length > 0 || queryType.length > 0) && !_self.isUpdatePage) {
  469. _self.pagination.current_page = 1;
  470. _self.isUpdatePage = true;
  471. } else if (queryNo.length == 0 && queryName.length == 0 && queryType.length == 0) {
  472. _self.isUpdatePage = false;
  473. }
  474. _self.inventoryInstanceDatas.splice(0, _self.inventoryInstanceDatas.length);
  475. var inventoryQueryCondition = {
  476. 'no': queryNo,
  477. 'name': queryName,
  478. 'type': queryType,
  479. 'start': (_self.pagination.current_page - 1) * _self.pagination.per_page,
  480. 'length': _self.pagination.per_page,
  481. };
  482. _self.loading=true;
  483. CurrentStockResource.findSiemensCurrentStock(inventoryQueryCondition, _self.selectType).then(successData => {
  484. _self.loading=false;
  485. if(successData.errorCode == 0) {
  486. if (successData.datas) {
  487. _self.inventoryInstanceDatas = successData.datas;
  488. _self.pagination.total = successData.total;
  489. _self.pagination.last_page = Math.ceil(_self.pagination.total / _self.pagination.per_page);
  490. }
  491. _self.fixedTableHeader();
  492. }
  493. }, errorData => {
  494. _self.loading=false;
  495. Common.processException(errorData);
  496. });
  497. },
  498. /**
  499. * 冻结表头
  500. */
  501. fixedTableHeader: function () {
  502. let _self = this;
  503. _self.$nextTick(function () {
  504. $('.fixed-table').tableFixer({
  505. 'left': 3,
  506. 'head': true,
  507. });
  508. });
  509. },
  510. },
  511. };
  512. </script>
  513. <style scoped>
  514. .flex-container {
  515. display: flex;
  516. /* 垂直*/
  517. flex-direction: column;
  518. width: 100%;
  519. /*视口被均分为100单位的vh 占据整个窗口,扣掉顶部topNav的距离后,计算得到container的高度*/
  520. height: calc(100vh - 140px);
  521. }
  522. .flex-header {
  523. /*放大缩小比例为0 */
  524. flex: 0 0 35px;
  525. }
  526. .flex-footer {
  527. height: 45px;
  528. /*放大缩小比例为0 */
  529. flex: 0 0 45px;
  530. }
  531. .flex-content {
  532. flex: 1;
  533. overflow: scroll;
  534. width: 100%;
  535. }
  536. .fixed-table {
  537. table-layout: fixed;
  538. word-wrap: break-word;
  539. word-break: break-all;
  540. }
  541. </style>
  542. <style scoped>
  543. .fixed-table {
  544. table-layout: fixed;
  545. width: 800px !important;
  546. min-width: 800px !important;
  547. }
  548. table.fixed-table tr {
  549. height: 40px;
  550. }
  551. table.fixed-table th,
  552. table.fixed-table td {
  553. overflow: hidden;
  554. white-space: nowrap;
  555. text-overflow: ellipsis;
  556. }
  557. .image {
  558. width: 40px;
  559. height: 40px;
  560. }
  561. .modal-img-box {
  562. width: 100%;
  563. text-align: center;
  564. overflow: auto;
  565. }
  566. .m-img {
  567. width: 100%;
  568. }
  569. </style>