You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1086 lines
33 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <div class="customer-css" >
  3. <!-- 查询时间和产品 -->
  4. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" >
  5. <el-row>
  6. <el-col :span="24" style="">
  7. <el-form-item :label="'BU:'">
  8. <el-input v-model="searchData.buNo" style="width: 130px"></el-input>
  9. </el-form-item>
  10. <el-form-item :label="'销售出库单号:'">
  11. <el-input v-model="searchData.orderNo" style="width: 130px"></el-input>
  12. </el-form-item>
  13. <el-form-item :label="'客户编号:'">
  14. <el-input v-model="searchData.customerId" style="width: 130px"></el-input>
  15. </el-form-item>
  16. <el-form-item :label="'客户名称:'">
  17. <el-input v-model="searchData.customerName" style="width: 130px"></el-input>
  18. </el-form-item>
  19. <el-form-item :label="'单据状态'">
  20. <el-select multiple collapse-tags v-model="searchData.orderStatusList" clearable style="width: 160px">
  21. <el-option label="待包装" value="待包装"></el-option>
  22. <el-option label="待出库" value="待出库"></el-option>
  23. <el-option label="已出库" value="已出库"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item :label="' '" >
  27. <el-button class="customer-bun-min" type="primary" @click="getMainData" style="">查询</el-button>
  28. <el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. </el-form>
  33. <el-table
  34. :height="height"
  35. :data="mainDataList"
  36. border
  37. ref="mainTable"
  38. highlight-current-row
  39. @row-click="changeData"
  40. v-loading="dataListLoading"
  41. style="margin-top: 0px; width: 100%;">
  42. <!-- <el-table-column-->
  43. <!-- fixed="left"-->
  44. <!-- header-align="center"-->
  45. <!-- align="center"-->
  46. <!-- width="220"-->
  47. <!-- :label="'操作'">-->
  48. <!-- <template slot-scope="scope">-->
  49. <!-- </template>-->
  50. <!-- </el-table-column>-->
  51. <el-table-column
  52. v-for="(item,index) in columnArray1" :key="index"
  53. :sortable="item.columnSortable"
  54. :prop="item.columnProp"
  55. :header-align="item.headerAlign"
  56. :show-overflow-tooltip="item.showOverflowTooltip"
  57. :align="item.align"
  58. :fixed="item.fixed==''?false:item.fixed"
  59. :min-width="item.columnWidth"
  60. :label="item.columnLabel">
  61. <template slot-scope="scope">
  62. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  63. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  64. style="width: 100px; height: 80px"/></span>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <!-- 分页插件 -->
  69. <el-pagination style="margin-top: 0px"
  70. @size-change="sizeChangeHandle"
  71. @current-change="currentChangeHandle"
  72. :current-page="pageIndex"
  73. :page-sizes="[20, 50, 100, 200, 500]"
  74. :page-size="pageSize"
  75. :total="totalPage"
  76. layout="total, sizes, prev, pager, next, jumper">
  77. </el-pagination>
  78. <el-tabs v-model="activeName" style="margin-top: 0px; width: 99%;" @tab-click="tabClick" class="customer-tab" type="border-card">
  79. <el-tab-pane label="盒清单" name="cases">
  80. <el-form label-position="top" style="margin-left: 2px;">
  81. <el-button type="primary" size="small" @click="openCaseDialog">新增</el-button>
  82. <el-button type="danger" size="small" @click="deleteCaseRecord">删除</el-button>
  83. </el-form>
  84. <el-table
  85. ref="caseTable"
  86. :data="casesList"
  87. :height="height - 30"
  88. border
  89. @selection-change="handleCaseSelectionChange"
  90. style="width: 100%;">
  91. <el-table-column
  92. type="selection"
  93. width="55"
  94. align="center">
  95. </el-table-column>
  96. <el-table-column
  97. prop="casesNo"
  98. header-align="center"
  99. align="center"
  100. min-width="120"
  101. label="盒标签">
  102. </el-table-column>
  103. <el-table-column
  104. prop="rollNo"
  105. header-align="center"
  106. align="center"
  107. min-width="120"
  108. label="卷标签">
  109. </el-table-column>
  110. <el-table-column
  111. prop="rollQty"
  112. header-align="center"
  113. align="right"
  114. min-width="100"
  115. label="卷数量">
  116. </el-table-column>
  117. <el-table-column
  118. prop="partNo"
  119. header-align="center"
  120. align="left"
  121. min-width="120"
  122. label="物料编码">
  123. </el-table-column>
  124. <el-table-column
  125. prop="partDesc"
  126. header-align="center"
  127. align="left"
  128. min-width="200"
  129. label="物料名称">
  130. </el-table-column>
  131. <el-table-column
  132. prop="createDate"
  133. header-align="center"
  134. align="center"
  135. min-width="160"
  136. label="创建时间">
  137. </el-table-column>
  138. <el-table-column
  139. prop="createBy"
  140. header-align="center"
  141. align="center"
  142. min-width="100"
  143. label="创建人">
  144. </el-table-column>
  145. </el-table>
  146. </el-tab-pane>
  147. <el-tab-pane label="箱清单" name="boxing">
  148. <boxing ref="boxing"></boxing>
  149. </el-tab-pane>
  150. <el-tab-pane label="已扫描卷" name="rollDetail">
  151. <el-table
  152. :data="rollList"
  153. :height="height - 20"
  154. border
  155. style="width: 100%;">
  156. <el-table-column
  157. prop="orderId"
  158. header-align="center"
  159. align="center"
  160. min-width="60"
  161. label="序号">
  162. </el-table-column>
  163. <el-table-column
  164. prop="boxNo"
  165. header-align="center"
  166. align="center"
  167. min-width="100"
  168. label="箱号">
  169. </el-table-column>
  170. <el-table-column
  171. prop="finalRollNo"
  172. header-align="center"
  173. align="center"
  174. min-width="100"
  175. label="卷号">
  176. </el-table-column>
  177. <el-table-column
  178. prop="partNo"
  179. header-align="center"
  180. align="left"
  181. min-width="100"
  182. label="物料编码">
  183. </el-table-column>
  184. <el-table-column
  185. prop="rollQty"
  186. header-align="center"
  187. align="right"
  188. min-width="100"
  189. label="数量">
  190. </el-table-column>
  191. <el-table-column
  192. prop="receivedDate"
  193. header-align="center"
  194. align="center"
  195. min-width="100"
  196. label="装箱日期">
  197. </el-table-column>
  198. <el-table-column
  199. prop="receivedBy"
  200. header-align="center"
  201. align="left"
  202. min-width="100"
  203. label="装箱人">
  204. </el-table-column>
  205. <el-table-column
  206. prop="batchNo"
  207. header-align="center"
  208. align="left"
  209. min-width="100"
  210. label="合约号">
  211. </el-table-column>
  212. <el-table-column
  213. prop="wareHouseID"
  214. header-align="center"
  215. align="left"
  216. min-width="100"
  217. label="仓库">
  218. </el-table-column>
  219. <el-table-column
  220. prop="locationId"
  221. header-align="center"
  222. align="left"
  223. min-width="100"
  224. label="库位">
  225. </el-table-column>
  226. </el-table>
  227. </el-tab-pane>
  228. </el-tabs>
  229. <!-- 盒清单新增对话框 -->
  230. <el-dialog title="装盒扫描" :visible.sync="caseDialogVisible" width="70%" :close-on-click-modal="false" @close="closeCaseDialog">
  231. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  232. <el-form-item label="盒标签">
  233. <el-input ref="caseNoInput" v-model="caseForm.casesNo" @keyup.enter.native="focusRollNoInput" placeholder="请扫描盒标签" style="width: 200px"></el-input>
  234. </el-form-item>
  235. <el-form-item label="卷标签">
  236. <el-input ref="rollNoInput" v-model="caseForm.rollNo" @keyup.enter.native="scanCaseRoll" placeholder="请扫描卷标签" style="width: 200px"></el-input>
  237. </el-form-item>
  238. <span style="margin-left: 20px; font-size: 14px; display: inline-block; margin-top: 20px;">
  239. <span style="color: #606266;">盒数量</span>
  240. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{caseStatistics.casesCount}}</span>
  241. </span>
  242. <span style="margin-left: 20px; font-size: 14px; display: inline-block; margin-top: 20px;">
  243. <span style="color: #606266;">卷数量</span>
  244. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{caseStatistics.rollCount}}</span>
  245. </span>
  246. <span style="margin-left: 20px; font-size: 14px; display: inline-block; margin-top: 20px;">
  247. <span style="color: #606266;">物料总数</span>
  248. <span style="color: rgb(38, 92, 147); font-weight: bold;">{{caseStatistics.totalQty}}</span>
  249. </span>
  250. </el-form>
  251. <!-- 中部分扫描列表 -->
  252. <el-table
  253. :data="caseRollList"
  254. border
  255. height="300"
  256. style="width: 100%; margin-top: 10px;">
  257. <el-table-column
  258. type="index"
  259. label="序号"
  260. width="50"
  261. header-align="center"
  262. align="right">
  263. </el-table-column>
  264. <el-table-column
  265. prop="casesNo"
  266. label="盒标签"
  267. min-width="120"
  268. header-align="center"
  269. align="left">
  270. </el-table-column>
  271. <el-table-column
  272. prop="rollNo"
  273. label="卷标签"
  274. min-width="120"
  275. header-align="center"
  276. align="left">
  277. </el-table-column>
  278. <el-table-column
  279. prop="rollQty"
  280. label="卷数量"
  281. min-width="100"
  282. header-align="center"
  283. align="right">
  284. </el-table-column>
  285. <el-table-column
  286. prop="partNo"
  287. label="物料编码"
  288. min-width="120"
  289. header-align="center"
  290. align="left">
  291. </el-table-column>
  292. <el-table-column
  293. prop="partDesc"
  294. label="物料名称"
  295. min-width="200"
  296. header-align="center"
  297. align="left">
  298. </el-table-column>
  299. <el-table-column
  300. prop="batchNo"
  301. label="合约号"
  302. min-width="120"
  303. header-align="center"
  304. align="left">
  305. </el-table-column>
  306. <el-table-column
  307. label="操作"
  308. width="80"
  309. header-align="center"
  310. align="center">
  311. <template slot-scope="scope">
  312. <el-link style="cursor: pointer" @click="deleteRollFromList(scope.$index)">删除</el-link>
  313. </template>
  314. </el-table-column>
  315. </el-table>
  316. <el-footer style="height:35px;margin-top: 15px;text-align:center">
  317. <el-button type="primary" @click="applyCaseScan">应用</el-button>
  318. <el-button type="success" @click="saveCaseScan">保存</el-button>
  319. <el-button @click="closeCaseDialog">关闭</el-button>
  320. </el-footer>
  321. </el-dialog>
  322. </div>
  323. </template>
  324. <script>
  325. /*组件*/
  326. import excel from "@/utils/excel-util.js";
  327. import boxing from "./com_saleBoxManage_boxing.vue"
  328. import {
  329. searchRollForOrderNo,
  330. searchSoReceiveCasesData,
  331. deleteSoReceiveCasesData,
  332. validateAndScanCaseRoll,
  333. saveCaseRollList,
  334. searchOutboundNotificationWithDetail
  335. } from '../../../api/boxManage/boxManage'
  336. export default {
  337. data() {
  338. return {
  339. functionId: this.$route.meta.menuId,
  340. height: 200,
  341. currentRow: {},
  342. searchData:{
  343. orderNo:'',
  344. customerId:'',
  345. orderType:'销售出库',
  346. orderStatus: '',
  347. orderStatusList: ['待包装'],
  348. buNo:'',
  349. customerName:'',
  350. site:this.$store.state.user.site,
  351. userName:this.$store.state.user.name,
  352. page: 1,
  353. limit: 10,
  354. },
  355. pageIndex: 1,
  356. pageSize: 50,
  357. totalPage: 0,
  358. tagNo:'',
  359. rollList:[],
  360. mainDataList:[],
  361. dataListLoading: false,
  362. activeName: 'cases',
  363. // 盒清单相关数据
  364. casesList: [],
  365. caseDialogVisible: false,
  366. caseForm: {
  367. casesNo: '',
  368. rollNo: '',
  369. site: this.$store.state.user.site,
  370. buNo: '',
  371. notifyNo: '',
  372. partNo: ''
  373. },
  374. caseRollList: [],
  375. caseStatistics: {
  376. casesCount: 0,
  377. rollCount: 0,
  378. totalQty: 0
  379. },
  380. selectedCaseRecords: [],
  381. columnArray1: [
  382. {
  383. userId: this.$store.state.user.name,
  384. functionId: this.functionId,
  385. serialNumber: '750001Table1BU',
  386. tableId: "750001Table1",
  387. tableName: "销售发货清单",
  388. columnProp: "buNo",
  389. headerAlign: "center",
  390. align: "left",
  391. columnLabel: "BU",
  392. columnWidth: '60',
  393. columnHidden: false,
  394. columnImage: false,
  395. columnSortable: false,
  396. sortLv: 0,
  397. status: true,
  398. fixed: false
  399. },
  400. {
  401. userId: this.$store.state.user.name,
  402. functionId: this.functionId,
  403. serialNumber: '750001Table1OrderNo',
  404. tableId: "750001Table1",
  405. tableName: "销售发货清单",
  406. columnProp: "orderNo",
  407. headerAlign: "center",
  408. align: "left",
  409. columnLabel: "销售出库单号",
  410. columnWidth: '100',
  411. columnHidden: false,
  412. columnImage: false,
  413. columnSortable: false,
  414. sortLv: 0,
  415. status: true,
  416. fixed: false
  417. },
  418. {
  419. userId: this.$store.state.user.name,
  420. functionId: this.functionId,
  421. serialNumber: '750001Table1OrderStatus',
  422. tableId: "750001Table1",
  423. tableName: "销售发货清单",
  424. columnProp: "orderStatus",
  425. headerAlign: "center",
  426. align: "left",
  427. columnLabel: "通知单状态",
  428. columnWidth: '80',
  429. columnHidden: false,
  430. columnImage: false,
  431. columnSortable: false,
  432. sortLv: 0,
  433. status: true,
  434. fixed: false
  435. },
  436. {
  437. userId: this.$store.state.user.name,
  438. functionId: this.functionId,
  439. serialNumber: '750001Table1CustomerId',
  440. tableId: "750001Table1",
  441. tableName: "销售发货清单",
  442. columnProp: "customerId",
  443. headerAlign: "center",
  444. align: "left",
  445. columnLabel: "客户编号",
  446. columnWidth: '100',
  447. columnHidden: false,
  448. columnImage: false,
  449. columnSortable: false,
  450. sortLv: 0,
  451. status: true,
  452. fixed: false
  453. },
  454. {
  455. userId: this.$store.state.user.name,
  456. functionId: this.functionId,
  457. serialNumber: '750001Table1CustomerName',
  458. tableId: "750001Table1",
  459. tableName: "销售发货清单",
  460. columnProp: "customerName",
  461. headerAlign: "center",
  462. align: "left",
  463. columnLabel: "客户编号",
  464. columnWidth: '240',
  465. columnHidden: false,
  466. columnImage: false,
  467. columnSortable: false,
  468. sortLv: 0,
  469. status: true,
  470. fixed: false
  471. },
  472. {
  473. userId: this.$store.state.user.name,
  474. functionId: this.functionId,
  475. serialNumber: '750001Table1RequiredOutboundDate',
  476. tableId: "750001Table1",
  477. tableName: "销售发货清单",
  478. columnProp: "requiredOutboundDate",
  479. headerAlign: "center",
  480. align: "left",
  481. columnLabel: "要求发货日期",
  482. columnWidth: '120',
  483. columnHidden: false,
  484. columnImage: false,
  485. columnSortable: false,
  486. sortLv: 0,
  487. status: true,
  488. fixed: false
  489. },
  490. {
  491. userId: this.$store.state.user.name,
  492. functionId: this.functionId,
  493. serialNumber: '750001Table1RelatedOrderNo',
  494. tableId: "750001Table1",
  495. tableName: "销售发货清单",
  496. columnProp: "relatedOrderNo",
  497. headerAlign: "center",
  498. align: "left",
  499. columnLabel: "销售订单号",
  500. columnWidth: '100',
  501. columnHidden: false,
  502. columnImage: false,
  503. columnSortable: false,
  504. sortLv: 0,
  505. status: true,
  506. fixed: false
  507. },
  508. {
  509. userId: this.$store.state.user.name,
  510. functionId: this.functionId,
  511. serialNumber: '750001Table1RelatedOrderLineNo',
  512. tableId: "750001Table1",
  513. tableName: "销售发货清单",
  514. columnProp: "relatedOrderLineNo",
  515. headerAlign: "center",
  516. align: "right",
  517. columnLabel: "销售订单行号",
  518. columnWidth: '100',
  519. columnHidden: false,
  520. columnImage: false,
  521. columnSortable: false,
  522. sortLv: 0,
  523. status: true,
  524. fixed: false
  525. },
  526. {
  527. userId: this.$store.state.user.name,
  528. functionId: this.functionId,
  529. serialNumber: '750001Table1PartNo',
  530. tableId: "750001Table1",
  531. tableName: "销售发货清单",
  532. columnProp: "partNo",
  533. headerAlign: "center",
  534. align: "left",
  535. columnLabel: "物料编码",
  536. columnWidth: '120',
  537. columnHidden: false,
  538. columnImage: false,
  539. columnSortable: false,
  540. sortLv: 0,
  541. status: true,
  542. fixed: false
  543. },
  544. {
  545. userId: this.$store.state.user.name,
  546. functionId: this.functionId,
  547. serialNumber: '750001Table1PartDesc',
  548. tableId: "750001Table1",
  549. tableName: "销售发货清单",
  550. columnProp: "partDesc",
  551. headerAlign: "center",
  552. align: "left",
  553. columnLabel: "物料名称",
  554. columnWidth: '200',
  555. columnHidden: false,
  556. columnImage: false,
  557. columnSortable: false,
  558. sortLv: 0,
  559. status: true,
  560. fixed: false
  561. },
  562. {
  563. userId: this.$store.state.user.name,
  564. functionId: this.functionId,
  565. serialNumber: '750001Table1OutBatchNo',
  566. tableId: "750001Table1",
  567. tableName: "销售发货清单",
  568. columnProp: "outBatchNo",
  569. headerAlign: "center",
  570. align: "left",
  571. columnLabel: "合约号",
  572. columnWidth: '100',
  573. columnHidden: false,
  574. columnImage: false,
  575. columnSortable: false,
  576. sortLv: 0,
  577. status: true,
  578. fixed: false
  579. },
  580. {
  581. userId: this.$store.state.user.name,
  582. functionId: this.functionId,
  583. serialNumber: '750001Table1OrderQty',
  584. tableId: "750001Table1",
  585. tableName: "销售发货清单",
  586. columnProp: "orderQty",
  587. headerAlign: "center",
  588. align: "right",
  589. columnLabel: "销售订单数量",
  590. columnWidth: '100',
  591. columnHidden: false,
  592. columnImage: false,
  593. columnSortable: false,
  594. sortLv: 0,
  595. status: true,
  596. fixed: false
  597. },
  598. {
  599. userId: this.$store.state.user.name,
  600. functionId: this.functionId,
  601. serialNumber: '750001Table1RequiredQty',
  602. tableId: "750001Table1",
  603. tableName: "销售发货清单",
  604. columnProp: "requiredQty",
  605. headerAlign: "center",
  606. align: "right",
  607. columnLabel: "要求发货数量",
  608. columnWidth: '100',
  609. columnHidden: false,
  610. columnImage: false,
  611. columnSortable: false,
  612. sortLv: 0,
  613. status: true,
  614. fixed: false
  615. },
  616. {
  617. userId: this.$store.state.user.name,
  618. functionId: this.functionId,
  619. serialNumber: '750001Table1RollQty',
  620. tableId: "750001Table1",
  621. tableName: "销售发货清单",
  622. columnProp: "rollQty",
  623. headerAlign: "center",
  624. align: "right",
  625. columnLabel: "已扫描数量",
  626. columnWidth: '100',
  627. columnHidden: false,
  628. columnImage: false,
  629. columnSortable: false,
  630. sortLv: 0,
  631. status: true,
  632. fixed: false
  633. },
  634. {
  635. userId: this.$store.state.user.name,
  636. functionId: this.functionId,
  637. serialNumber: '750001Table1UnScanQty',
  638. tableId: "750001Table1",
  639. tableName: "销售发货清单",
  640. columnProp: "unScanQty",
  641. headerAlign: "center",
  642. align: "right",
  643. columnLabel: "未扫描数量",
  644. columnWidth: '100',
  645. columnHidden: false,
  646. columnImage: false,
  647. columnSortable: false,
  648. sortLv: 0,
  649. status: true,
  650. fixed: false
  651. },
  652. {
  653. userId: this.$store.state.user.name,
  654. functionId: this.functionId,
  655. serialNumber: '750001Table1Unit',
  656. tableId: "750001Table1",
  657. tableName: "销售发货清单",
  658. columnProp: "unit",
  659. headerAlign: "center",
  660. align: "left",
  661. columnLabel: "单位",
  662. columnWidth: '80',
  663. columnHidden: false,
  664. columnImage: false,
  665. columnSortable: false,
  666. sortLv: 0,
  667. status: true,
  668. fixed: false
  669. },
  670. ],
  671. exportName: '销售出库单'+this.dayjs().format('YYYYMMDDHHmmss'),
  672. }
  673. },
  674. /*组件*/
  675. components: {
  676. boxing,
  677. },
  678. mounted() {
  679. this.$nextTick(() => {
  680. this.height = ( window.innerHeight - 220)/2;
  681. })
  682. },
  683. methods: {
  684. getMainData(){
  685. this.searchData.limit = this.pageSize
  686. this.searchData.page = this.pageIndex
  687. this.searchData.orderStatus = this.searchData.orderStatusList.join(',')
  688. searchOutboundNotificationWithDetail(this.searchData).then(({data}) => {
  689. if (data.code === 0) {
  690. this.mainDataList = data.rows
  691. this.totalPage = this.mainDataList.length
  692. //判断是否全部存在数据
  693. if (this.totalPage > 0) {
  694. //设置选中行
  695. this.$refs.mainTable.setCurrentRow(this.mainDataList[0])
  696. this.changeData(this.mainDataList[0])
  697. }else {
  698. this.changeData(null)
  699. }
  700. }
  701. this.dataListLoading = false
  702. })
  703. },
  704. tabClick(tab, event){
  705. this.refreshCurrentTabTable()
  706. },
  707. // 每页数
  708. sizeChangeHandle (val) {
  709. this.pageSize = val
  710. this.pageIndex = 1
  711. this.getMainData()
  712. },
  713. // 当前页
  714. currentChangeHandle (val) {
  715. this.pageIndex = val
  716. this.getMainData()
  717. },
  718. changeData(row){
  719. this.currentRow=JSON.parse(JSON.stringify(row))
  720. this.refreshCurrentTabTable ();
  721. },
  722. refreshCurrentTabTable(){
  723. if (this.currentRow === '' || this.currentRow === null) {
  724. this.currentRow = {
  725. site: '',
  726. buNo: '',
  727. supplierNo: ''
  728. }
  729. }
  730. if(this.activeName==='boxing'){
  731. this.refreshBoxingTable();
  732. }
  733. if(this.activeName==='rollDetail'){
  734. this.refreshRollsTable();
  735. }
  736. if(this.activeName==='cases'){
  737. this.refreshCasesTable();
  738. }
  739. },
  740. async exportExcel() {
  741. this.searchData.limit = -1
  742. this.searchData.page = 1
  743. excel.exportTable({
  744. url: "/boxForNotification/searchOutboundNotificationWithDetail",
  745. columnMapping: this.columnArray1,//可以直接用table,不需要的列就剔除
  746. mergeSetting: [],//需要合并的列
  747. params: this.searchData,
  748. fileName: this.exportName+".xlsx",
  749. rowFetcher: res => res.data.rows,
  750. columnFormatter: [],
  751. dropColumns: [],//需要剔除的列,例如dropColumns: ["netWeight"],即剔除净重列
  752. });
  753. },
  754. refreshBoxingTable(){
  755. let inData={
  756. site: this.currentRow.site,
  757. buNo: this.currentRow.buNo,
  758. orderNo: this.currentRow.orderNo,
  759. boxType: this.currentRow.orderType,
  760. height:Number(this.height)-25
  761. }
  762. this.$refs.boxing.init(inData)
  763. },
  764. refreshRollsTable(){
  765. let templateData = {
  766. site: this.currentRow.site,
  767. buNo: this.currentRow.buNo,
  768. orderNo: this.currentRow.orderNo,
  769. }
  770. searchRollForOrderNo(templateData).then(({data}) => {
  771. this.rollList = data.rows
  772. })
  773. },
  774. // ===== 盒清单相关方法 =====
  775. refreshCasesTable(){
  776. let templateData = {
  777. site: this.currentRow.site,
  778. buNo: this.currentRow.buNo,
  779. notifyNo: this.currentRow.orderNo,
  780. }
  781. searchSoReceiveCasesData(templateData).then(({data}) => {
  782. this.casesList = data.rows || []
  783. })
  784. },
  785. openCaseDialog(){
  786. if(!this.currentRow || !this.currentRow.orderNo){
  787. this.$message.warning('请先选择一条出库单记录')
  788. return
  789. }
  790. this.caseDialogVisible = true
  791. this.resetCaseForm()
  792. // 对话框打开后自动聚焦到盒标签输入框
  793. this.$nextTick(() => {
  794. this.$refs.caseNoInput.focus()
  795. })
  796. },
  797. resetCaseForm(){
  798. this.caseForm = {
  799. casesNo: '',
  800. rollNo: '',
  801. site: this.currentRow.site,
  802. buNo: this.currentRow.buNo,
  803. notifyNo: this.currentRow.orderNo,
  804. partNo: ''
  805. }
  806. this.caseRollList = []
  807. this.updateCaseStatistics()
  808. },
  809. focusRollNoInput(){
  810. if(!this.caseForm.casesNo){
  811. this.$message.warning('请先扫描盒标签')
  812. return
  813. }
  814. this.$refs.rollNoInput.focus()
  815. },
  816. async scanCaseRoll(){
  817. // 校验必填项
  818. if(!this.caseForm.casesNo){
  819. this.$message.warning('请先扫描盒标签')
  820. this.$refs.caseNoInput.focus()
  821. return
  822. }
  823. if(!this.caseForm.rollNo){
  824. this.$message.warning('请扫描卷标签')
  825. return
  826. }
  827. // 从当前行获取物料编码
  828. let partNo = this.currentRow.partNo || ''
  829. this.caseForm.partNo = partNo
  830. try {
  831. const {data} = await validateAndScanCaseRoll(this.caseForm)
  832. if(data && data.code === 0){
  833. // 后端现在返回的是集合,需要遍历所有记录
  834. const rollList = data.rollInfo || []
  835. if(rollList.length === 0){
  836. this.$message.warning('未查询到卷数据')
  837. this.caseForm.rollNo = ''
  838. this.$refs.rollNoInput.focus()
  839. return
  840. }
  841. // 将所有查询到的卷信息添加到列表最前面(后扫描的在上面)
  842. rollList.forEach(rollInfo => {
  843. this.caseRollList.unshift({
  844. casesNo: this.caseForm.casesNo,
  845. rollNo: rollInfo.rollNo,
  846. rollQty: rollInfo.rollQty,
  847. partNo: rollInfo.partNo,
  848. partDesc: rollInfo.partDesc,
  849. batchNo: rollInfo.batchNo,
  850. notifyNo: this.caseForm.notifyNo,
  851. site: this.caseForm.site,
  852. buNo: this.caseForm.buNo
  853. })
  854. })
  855. // 更新统计信息
  856. this.updateCaseStatistics()
  857. // 重置两个输入框,准备下一次扫描
  858. this.caseForm.casesNo = ''
  859. this.caseForm.rollNo = ''
  860. // 光标回到盒标签输入框,继续按照规定顺序扫描
  861. this.$nextTick(() => {
  862. this.$refs.caseNoInput.focus()
  863. })
  864. this.$message.success(`扫描成功,添加了 ${rollList.length} 条记录`)
  865. } else {
  866. this.$message.error(data.msg || '扫描失败')
  867. }
  868. } catch (error) {
  869. this.$message.error(error.msg || '扫描失败,请检查')
  870. // 清空卷标签输入框
  871. this.caseForm.rollNo = ''
  872. this.$refs.rollNoInput.focus()
  873. }
  874. },
  875. updateCaseStatistics(){
  876. // 盒数量 = 去重的盒标签数量
  877. const uniqueCases = new Set(this.caseRollList.map(item => item.casesNo))
  878. this.caseStatistics.casesCount = uniqueCases.size
  879. // 卷数量 = 列表行数
  880. this.caseStatistics.rollCount = this.caseRollList.length
  881. // 物料总数 = 所有行的卷数量求和
  882. this.caseStatistics.totalQty = this.caseRollList.reduce((sum, item) => {
  883. return sum + (parseFloat(item.rollQty) || 0)
  884. }, 0)
  885. },
  886. // 从扫描列表中删除某一行
  887. deleteRollFromList(index){
  888. this.$confirm('确定删除这条扫描记录吗?', '提示', {
  889. confirmButtonText: '确定',
  890. cancelButtonText: '取消',
  891. type: 'warning'
  892. }).then(() => {
  893. this.caseRollList.splice(index, 1)
  894. this.updateCaseStatistics()
  895. this.$message.success('删除成功')
  896. }).catch(() => {})
  897. },
  898. async applyCaseScan(){
  899. if(this.caseRollList.length === 0){
  900. this.$message.warning('请先扫描卷标签')
  901. return
  902. }
  903. // 校验数量
  904. if(!await this.validateCaseQty()){
  905. return
  906. }
  907. // 应用:保存但不关闭对话框,重置输入框、计数和列表
  908. this.saveCaseData(false)
  909. },
  910. async saveCaseScan(){
  911. if(this.caseRollList.length === 0){
  912. this.$message.warning('请先扫描卷标签')
  913. return
  914. }
  915. // 校验数量
  916. if(!await this.validateCaseQty()){
  917. return
  918. }
  919. // 保存:保存后关闭对话框
  920. this.saveCaseData(true)
  921. },
  922. // 校验盒清单数量不能超过要求发货数量
  923. async validateCaseQty(){
  924. // 获取当前主信息行的要求发货数量
  925. const requiredQty = parseFloat(this.currentRow.requiredQty) || 0
  926. if(requiredQty === 0){
  927. this.$message.warning('要求发货数量为0,无需装箱')
  928. return false
  929. }
  930. // 计算新扫描的数据总量
  931. const newScanQty = this.caseRollList.reduce((sum, item) => {
  932. return sum + (parseFloat(item.rollQty) || 0)
  933. }, 0)
  934. // 查询已保存的盒清单数据,计算已装箱的总数量
  935. try {
  936. let templateData = {
  937. site: this.currentRow.site,
  938. buNo: this.currentRow.buNo,
  939. notifyNo: this.currentRow.orderNo,
  940. }
  941. const {data} = await searchSoReceiveCasesData(templateData)
  942. const existingQty = (data.rows || []).reduce((sum, item) => {
  943. // 只统计相同物料的数量
  944. if(item.partNo === this.currentRow.partNo){
  945. return sum + (parseFloat(item.rollQty) || 0)
  946. }
  947. return sum
  948. }, 0)
  949. // 总数量 = 已装箱数量 + 新扫描数量
  950. const totalQty = existingQty + newScanQty
  951. if(totalQty > requiredQty){
  952. this.$message.error(`装箱数量超出限制!要求发货数量:${requiredQty},已装箱:${existingQty},本次扫描:${newScanQty},总计:${totalQty}`)
  953. return false
  954. }
  955. return true
  956. } catch (error) {
  957. this.$message.error('校验数量失败,请重试')
  958. return false
  959. }
  960. },
  961. async saveCaseData(closeDialog){
  962. try {
  963. const {data} = await saveCaseRollList(this.caseRollList)
  964. if(data && data.code === 0){
  965. this.$message.success('保存成功')
  966. if(closeDialog){
  967. // 关闭对话框
  968. this.closeCaseDialog()
  969. } else {
  970. // 应用:重置表单继续扫描
  971. this.resetCaseForm()
  972. this.$nextTick(() => {
  973. this.$refs.caseNoInput.focus()
  974. })
  975. }
  976. // 刷新盒清单列表
  977. this.refreshCasesTable()
  978. } else {
  979. this.$message.error(data.msg || '保存失败')
  980. }
  981. } catch (error) {
  982. this.$message.error(error.msg || '保存失败')
  983. }
  984. },
  985. closeCaseDialog(){
  986. this.caseDialogVisible = false
  987. this.resetCaseForm()
  988. },
  989. handleCaseSelectionChange(selection){
  990. this.selectedCaseRecords = selection
  991. },
  992. async deleteCaseRecord(){
  993. if(this.selectedCaseRecords.length === 0){
  994. this.$message.warning('请先选择要删除的记录')
  995. return
  996. }
  997. this.$confirm('确定删除选中的记录吗?删除后将恢复库存卷的装盒状态', '提示', {
  998. confirmButtonText: '确定',
  999. cancelButtonText: '取消',
  1000. type: 'warning'
  1001. }).then(async () => {
  1002. try {
  1003. for(let record of this.selectedCaseRecords){
  1004. await deleteSoReceiveCasesData({
  1005. id: record.id,
  1006. site: record.site,
  1007. buNo: record.buNo
  1008. })
  1009. }
  1010. this.$message.success('删除成功')
  1011. this.refreshCasesTable()
  1012. } catch (error) {
  1013. this.$message.error(error.msg || '删除失败')
  1014. }
  1015. }).catch(() => {})
  1016. },
  1017. },
  1018. created() {
  1019. //查询报表的类型
  1020. this.getMainData();
  1021. },
  1022. }
  1023. </script>
  1024. <!--当前页面的标签样式-->
  1025. <style scoped lang="scss">
  1026. /deep/ .customer-tab .el-tabs__content {
  1027. padding: 5px !important;
  1028. }
  1029. </style>