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.

1200 lines
38 KiB

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