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.

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