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.

1096 lines
40 KiB

12 months ago
1 month ago
12 months ago
1 month ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
1 month ago
9 months ago
1 month ago
1 month ago
1 month ago
1 month ago
12 months ago
1 month ago
1 month ago
1 month ago
12 months ago
12 months ago
1 month ago
1 month ago
12 months ago
1 month ago
1 month ago
1 month ago
12 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
12 months ago
12 months ago
12 months ago
1 month ago
12 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
11 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
9 months ago
1 month ago
9 months ago
1 month ago
9 months ago
1 month ago
1 month ago
1 month ago
1 month ago
12 months ago
12 months ago
12 months ago
12 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
12 months ago
1 month ago
12 months ago
12 months ago
12 months ago
12 months ago
1 month ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
12 months ago
11 months ago
11 months ago
1 month ago
12 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
12 months ago
12 months ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top">
  4. <el-form-item :label="$t('warehouse.label.inStockStatus')">
  5. <el-select v-model="queryHeaderData.inStockFlag" :placeholder="$t('warehouse.common.select')" style="width: 120px;">
  6. <el-option :label="$t('warehouse.common.all')" value=""></el-option>
  7. <el-option :label="$t('warehouse.label.notInStock')" value="X"></el-option>
  8. <el-option :label="$t('warehouse.label.outbound')" value="N"></el-option>
  9. <el-option :label="$t('warehouse.label.inStock')" value="Y"></el-option>
  10. </el-select>
  11. </el-form-item>
  12. <!-- 本期盘点筛选=全部不入 SQL - rqrq -->
  13. <el-form-item :label="$t('warehouse.label.countFlag')">
  14. <el-select v-model="queryHeaderData.countFlag" :placeholder="$t('warehouse.common.select')" style="width: 120px;">
  15. <el-option :label="$t('warehouse.label.countFlagAll')" value=""></el-option>
  16. <el-option label="Y" value="Y"></el-option>
  17. <el-option label="N" value="N"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item :label="$t('warehouse.label.partNoLike')">
  21. <el-input style="width: 120px;" v-model="queryHeaderData.partNo" :placeholder="$t('warehouse.label.partNoLikePlaceholder')" @keyup.enter.native="getDataList()"></el-input>
  22. </el-form-item>
  23. <el-form-item :label="$t('warehouse.label.batchNo')">
  24. <el-input style="width: 120px;" v-model="queryHeaderData.batchNo" :placeholder="$t('warehouse.label.batchNoPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
  25. </el-form-item>
  26. <el-form-item :label="$t('warehouse.label.location')">
  27. <el-input style="width: 120px;" v-model="queryHeaderData.locationId" :placeholder="$t('warehouse.label.locationPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
  28. </el-form-item>
  29. <el-form-item :label="$t('warehouse.label.labelNo')">
  30. <el-input style="width: 120px;" v-model="queryHeaderData.unitId" :placeholder="$t('warehouse.label.labelNoPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
  31. </el-form-item>
  32. <el-form-item :label="$t('warehouse.label.partDesc')">
  33. <el-input style="width: 120px;" v-model="queryHeaderData.partDesc" :placeholder="$t('warehouse.label.partDescPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
  34. </el-form-item>
  35. <el-form-item :label="$t('warehouse.label.supplierBatchNo')">
  36. <el-input style="width: 120px;" v-model="queryHeaderData.supplierBatchNo" :placeholder="$t('warehouse.label.supplierBatchNoPlaceholder')" @keyup.enter.native="getDataList()"></el-input>
  37. </el-form-item>
  38. <el-form-item :label="$t('warehouse.label.sourceType')">
  39. <el-select v-model="queryHeaderData.sourceType" :placeholder="$t('warehouse.common.select')" style="width: 120px;">
  40. <el-option :label="$t('warehouse.common.all')" value=""></el-option>
  41. <el-option :label="$t('warehouse.label.sourceInit')" value="IFS_INIT"></el-option>
  42. <el-option :label="$t('warehouse.label.sourcePoReceive')" value="PO_RECEIVE"></el-option>
  43. <el-option :label="$t('warehouse.label.sourceShopOrderReceive')" value="SHOP_ORDER_RECEIVEY"></el-option>
  44. <el-option :label="$t('warehouse.label.sourceSalesReturn')" value="SALES_RETURN_RECEIVE"></el-option>
  45. <el-option :label="$t('warehouse.label.sourceProreCreate')" value="PRORE_CREATE"></el-option>
  46. <el-option :label="$t('warehouse.label.sourceOutreCreate')" value="OUTRE_CREATE"></el-option>
  47. <el-option :label="$t('warehouse.label.sourceSplit')" value="SPLIT"></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item :label="$t('warehouse.label.createdDate')">
  51. <el-date-picker
  52. v-model="queryHeaderData.startDate"
  53. type="date"
  54. :placeholder="$t('warehouse.label.datePlaceholder')"
  55. style="width: 120px;">
  56. </el-date-picker>
  57. </el-form-item>
  58. <el-form-item :label="$t('warehouse.common.to')">
  59. <el-date-picker
  60. v-model="queryHeaderData.endDate"
  61. type="date"
  62. :placeholder="$t('warehouse.label.datePlaceholder')"
  63. style="width: 120px;">
  64. </el-date-picker>
  65. </el-form-item>
  66. <el-form-item style="margin-top: 20px;">
  67. <el-button @click="getDataList()" type="primary">{{ $t('warehouse.common.search') }}</el-button>
  68. <el-button @click="resetQuery()" type="default">{{ $t('warehouse.common.reset') }}</el-button>
  69. <el-button @click="showOtherInboundDialog()" type="success">{{ $t('warehouse.label.otherInboundPrint') }}</el-button>
  70. <el-button @click="showFailedPrintTasksDialog()" type="warning">{{ $t('warehouse.label.failedPrintRetry') }}</el-button>
  71. <!-- 导出按钮 - rqrq -->
  72. <download-excel
  73. :fields="fields()"
  74. :data="exportData"
  75. type="xls"
  76. :name="exportName"
  77. :header="exportHeader"
  78. :footer="exportFooter"
  79. :fetch="createExportData"
  80. :before-generate="startDownload"
  81. :before-finish="finishDownload"
  82. :worksheet="$t('warehouse.common.exportWorksheet')"
  83. class="el-button el-button--primary el-button--medium">
  84. {{ $t('warehouse.common.download') }}
  85. </download-excel>
  86. </el-form-item>
  87. </el-form>
  88. <el-table
  89. id="labelQueryTable"
  90. :height="height"
  91. :data="dataList"
  92. border
  93. v-loading="dataListLoading || printLoading"
  94. :element-loading-text="loadingText"
  95. style="width: 100%; margin-bottom: 15px;">
  96. <!-- 动态列配置 - rqrq -->
  97. <el-table-column
  98. v-for="(item,index) in columnList" :key="index"
  99. :sortable="item.columnSortable"
  100. :prop="item.columnProp"
  101. :header-align="item.headerAlign"
  102. :show-overflow-tooltip="item.showOverflowTooltip"
  103. :align="item.align"
  104. :fixed="item.fixed==''?false:item.fixed"
  105. :min-width="item.columnWidth"
  106. :label="item.columnLabel">
  107. <template slot-scope="scope">
  108. <span v-if="item.columnProp === 'inStockFlag'">
  109. <span v-if="scope.row.inStockFlag === 'Y'" type="success">{{ $t('warehouse.label.inStock') }}</span>
  110. <span v-else-if="scope.row.inStockFlag === 'N'" type="info">{{ $t('warehouse.label.outbound') }}</span>
  111. <span v-else-if="scope.row.inStockFlag === 'X'" type="warning">{{ $t('warehouse.label.notInStock') }}</span>
  112. <span v-else>{{ scope.row.inStockFlag }}</span>
  113. </span>
  114. <span v-else-if="item.columnProp === 'lastPrintDate' || item.columnProp === 'createdDate' || item.columnProp === 'lastCountDate'">
  115. {{ formatDate(scope.row[item.columnProp]) }}
  116. </span>
  117. <span v-else-if="item.columnProp === 'countFlag'">
  118. <span v-if="scope.row.countFlag === 'Y'">Y</span>
  119. <span v-else-if="scope.row.countFlag === 'N'">N</span>
  120. <span v-else>{{ scope.row.countFlag }}</span>
  121. </span>
  122. <span v-else-if="item.columnProp === 'reserveFlag'">
  123. {{ scope.row.reserveFlag === 'Y' ? $t('warehouse.common.yes') : $t('warehouse.common.no') }}
  124. </span>
  125. <span v-else>{{ scope.row[item.columnProp] }}</span>
  126. </template>
  127. </el-table-column>
  128. <!-- 操作列 - rqrq -->
  129. <el-table-column :label="$t('warehouse.common.operation')" min-width="150" fixed="right" header-align="center" align="center">
  130. <template slot-scope="scope">
  131. <a
  132. @click="reprintLabel(scope.row)"
  133. type="primary"
  134. :loading="scope.row.printing">
  135. {{ $t('warehouse.label.reprintLabel') }}
  136. </a>
  137. <a
  138. @click="deleteLabel(scope.row)"
  139. type="danger"
  140. style="color: #f56c6c;">
  141. {{ $t('warehouse.common.delete') }}
  142. </a>
  143. </template>
  144. </el-table-column>
  145. </el-table>
  146. <el-pagination
  147. @size-change="sizeChangeHandle"
  148. @current-change="currentChangeHandle"
  149. :current-page="pageIndex"
  150. :page-sizes="[20, 50, 100]"
  151. :page-size="pageSize"
  152. :total="totalPage"
  153. layout="total, sizes, prev, pager, next, jumper">
  154. </el-pagination>
  155. <!-- 其它入库标签打印弹窗 -->
  156. <el-dialog
  157. :title="$t('warehouse.label.otherInboundDialogTitle')"
  158. :visible.sync="otherInboundVisible"
  159. width="450px"
  160. :close-on-click-modal="false">
  161. <el-form :model="otherInboundForm" ref="otherInboundForm" class="other-inbound-form">
  162. <el-row :gutter="20">
  163. <el-col :span="12">
  164. <el-form-item :label="$t('warehouse.inventory.part')" prop="partNo" class="form-item-vertical">
  165. <el-input v-model="otherInboundForm.partNo" :placeholder="$t('warehouse.label.partNoPlaceholder')"></el-input>
  166. </el-form-item>
  167. </el-col>
  168. <el-col :span="12">
  169. <el-form-item :label="$t('warehouse.inventory.description')" prop="partDesc" class="form-item-vertical">
  170. <el-input v-model="otherInboundForm.partDesc" :placeholder="$t('warehouse.label.partDescPlaceholder')"></el-input>
  171. </el-form-item>
  172. </el-col>
  173. </el-row>
  174. <el-row :gutter="20">
  175. <el-col :span="12">
  176. <el-form-item :label="$t('warehouse.label.batchNo')" prop="batchNo" class="form-item-vertical">
  177. <el-input v-model="otherInboundForm.batchNo" :placeholder="$t('warehouse.label.batchNoPlaceholder')"></el-input>
  178. </el-form-item>
  179. </el-col>
  180. <el-col :span="12">
  181. <el-form-item label="WDR" prop="wdr" class="form-item-vertical">
  182. <el-input v-model="otherInboundForm.wdr" :placeholder="$t('warehouse.label.wdrPlaceholder')" value="*"></el-input>
  183. </el-form-item>
  184. </el-col>
  185. </el-row>
  186. <el-row :gutter="20">
  187. <el-col :span="12">
  188. <el-form-item :label="$t('warehouse.inventory.qty')" prop="qty" class="form-item-vertical">
  189. <el-input
  190. v-model="otherInboundForm.qty"
  191. :min="0.01"
  192. :precision="2"
  193. style="width: 100%"
  194. :placeholder="$t('warehouse.label.qtyPlaceholder')">
  195. </el-input>
  196. </el-form-item>
  197. </el-col>
  198. <el-col :span="12">
  199. <el-form-item :label="$t('warehouse.label.packageCount')" prop="packageCount" class="form-item-vertical">
  200. <el-input
  201. v-model="otherInboundForm.packageCount"
  202. :min="1"
  203. style="width: 100%"
  204. :placeholder="$t('warehouse.label.packageCountPlaceholder')">
  205. </el-input>
  206. </el-form-item>
  207. </el-col>
  208. </el-row>
  209. <el-row :gutter="20">
  210. <el-col :span="12">
  211. <el-form-item :label="$t('warehouse.label.height')" prop="height" class="form-item-vertical">
  212. <el-input v-model="otherInboundForm.height"></el-input>
  213. </el-form-item>
  214. </el-col>
  215. <el-col :span="12">
  216. <el-form-item :label="$t('warehouse.label.expiredDate')" class="form-item-vertical">
  217. <el-date-picker
  218. v-model="otherInboundForm.expiredDate"
  219. type="date"
  220. :placeholder="$t('warehouse.label.expiredDatePlaceholder')"
  221. style="width: 100%"
  222. format="yyyy-MM-dd"
  223. value-format="yyyy-MM-dd">
  224. </el-date-picker>
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. </el-form>
  229. <div slot="footer" class="dialog-footer">
  230. <el-button @click="otherInboundVisible = false">{{ $t('warehouse.common.cancel') }}</el-button>
  231. <el-button type="primary" @click="createOtherInboundHU()" :loading="otherInboundLoading">{{ $t('warehouse.label.saveAndPrint') }}</el-button>
  232. </div>
  233. </el-dialog>
  234. <!-- 失败打印任务重试弹窗 -->
  235. <el-dialog
  236. :title="$t('warehouse.label.failedPrintTasksTitle')"
  237. :visible.sync="failedPrintTasksVisible"
  238. width="600px"
  239. :close-on-click-modal="false">
  240. <el-table
  241. :data="failedPrintTasksList"
  242. border
  243. stripe
  244. v-loading="failedPrintTasksLoading"
  245. max-height="400"
  246. style="width: 100%">
  247. <el-table-column
  248. prop="unitId"
  249. :label="$t('warehouse.label.labelNo')"
  250. min-width="150"
  251. align="center"
  252. header-align="center">
  253. </el-table-column>
  254. <el-table-column
  255. prop="printerIp"
  256. :label="$t('warehouse.label.printerIp')"
  257. min-width="120"
  258. align="center"
  259. header-align="center">
  260. </el-table-column>
  261. <el-table-column
  262. prop="retryCount"
  263. :label="$t('warehouse.label.printTimes')"
  264. width="80"
  265. align="center"
  266. header-align="center">
  267. </el-table-column>
  268. <el-table-column
  269. prop="createdDate"
  270. :label="$t('warehouse.label.createdTime')"
  271. min-width="150"
  272. align="center"
  273. header-align="center">
  274. <template slot-scope="scope">
  275. {{ formatDate(scope.row.createdDate) }}
  276. </template>
  277. </el-table-column>
  278. </el-table>
  279. <div slot="footer" class="dialog-footer">
  280. <el-button @click="failedPrintTasksVisible = false">{{ $t('warehouse.common.cancel') }}</el-button>
  281. <el-button type="primary" @click="retryAllFailedTasks()" :loading="retryLoading">{{ $t('warehouse.label.retryAll') }}</el-button>
  282. </div>
  283. </el-dialog>
  284. </div>
  285. </template>
  286. <script>
  287. import { getHandlingUnitLabelList, reprintLabel, deleteLabel, getFailedPrintTasks, retryFailedPrintTasks } from '@/api/warehouse/labelQuery'
  288. import { searchSysLanguagePackList, saveUserFavorite, searchUserFavorite } from '@/api/sysLanguage'
  289. import { createOtherInboundHU, printLabel } from '@/api/warehouse/otherInbound'
  290. export default {
  291. data() {
  292. return {
  293. dataForm: {
  294. key: ''
  295. },
  296. dataList: [],
  297. pageIndex: 1,
  298. pageSize: 50,
  299. totalPage: 0,
  300. dataListLoading: false,
  301. printLoading: false,
  302. loadingText: this.$t('warehouse.common.loading'),
  303. dataListSelections: [],
  304. favorite: false,
  305. height: 500,
  306. // 表格列配置 - rqrq
  307. columnList: [
  308. {
  309. columnProp: "unitId",
  310. headerAlign: "center",
  311. align: "center",
  312. columnLabel: this.$t('warehouse.label.labelNo'),
  313. columnWidth: 150,
  314. columnSortable: false,
  315. showOverflowTooltip: true,
  316. fixed: ""
  317. },
  318. {
  319. columnProp: "partNo",
  320. headerAlign: "center",
  321. align: "center",
  322. columnLabel: this.$t('warehouse.inventory.part'),
  323. columnWidth: 120,
  324. columnSortable: false,
  325. showOverflowTooltip: true,
  326. fixed: ""
  327. },
  328. {
  329. columnProp: "partDesc",
  330. headerAlign: "center",
  331. align: "center",
  332. columnLabel: this.$t('warehouse.inventory.description'),
  333. columnWidth: 150,
  334. columnSortable: false,
  335. showOverflowTooltip: true,
  336. fixed: ""
  337. },
  338. {
  339. columnProp: "batchNo",
  340. headerAlign: "center",
  341. align: "center",
  342. columnLabel: this.$t('warehouse.label.batchNo'),
  343. columnWidth: 120,
  344. columnSortable: false,
  345. showOverflowTooltip: true,
  346. fixed: ""
  347. },
  348. {
  349. columnProp: "locationId",
  350. headerAlign: "center",
  351. align: "center",
  352. columnLabel: this.$t('warehouse.label.location'),
  353. columnWidth: 100,
  354. columnSortable: false,
  355. showOverflowTooltip: true,
  356. fixed: ""
  357. },
  358. {
  359. columnProp: "warehouseId",
  360. headerAlign: "center",
  361. align: "center",
  362. columnLabel: this.$t('warehouse.warehouse.code'),
  363. columnWidth: 100,
  364. columnSortable: false,
  365. showOverflowTooltip: true,
  366. fixed: ""
  367. },
  368. {
  369. columnProp: "wdr",
  370. headerAlign: "center",
  371. align: "center",
  372. columnLabel: "WDR",
  373. columnWidth: 100,
  374. columnSortable: false,
  375. showOverflowTooltip: true,
  376. fixed: ""
  377. },
  378. {
  379. columnProp: "engChgLevel",
  380. headerAlign: "center",
  381. align: "center",
  382. columnLabel: "engChgLevel",
  383. columnWidth: 100,
  384. columnSortable: false,
  385. showOverflowTooltip: true,
  386. fixed: ""
  387. },
  388. {
  389. columnProp: "expiredDate",
  390. headerAlign: "center",
  391. align: "center",
  392. columnLabel: this.$t('warehouse.label.expiredDate'),
  393. columnWidth: 130,
  394. columnSortable: false,
  395. showOverflowTooltip: true,
  396. fixed: ""
  397. },
  398. {
  399. columnProp: "qty",
  400. headerAlign: "center",
  401. align: "right",
  402. columnLabel: this.$t('warehouse.inventory.qty'),
  403. columnWidth: 80,
  404. columnSortable: false,
  405. showOverflowTooltip: true,
  406. fixed: ""
  407. },
  408. {
  409. columnProp: "inStockFlag",
  410. headerAlign: "center",
  411. align: "center",
  412. columnLabel: this.$t('warehouse.label.inStockStatus'),
  413. columnWidth: 80,
  414. columnSortable: false,
  415. showOverflowTooltip: true,
  416. fixed: ""
  417. },
  418. {
  419. columnProp: "supplierBatchNo",
  420. headerAlign: "center",
  421. align: "center",
  422. columnLabel: this.$t('warehouse.label.supplierBatchNo'),
  423. columnWidth: 100,
  424. columnSortable: false,
  425. showOverflowTooltip: true,
  426. fixed: ""
  427. },
  428. {
  429. columnProp: "supplierManufactureDate",
  430. headerAlign: "center",
  431. align: "center",
  432. columnLabel: this.$t('warehouse.label.supplierManufactureDate'),
  433. columnWidth: 100,
  434. columnSortable: false,
  435. showOverflowTooltip: true,
  436. fixed: ""
  437. },
  438. {
  439. columnProp: "countFlag",
  440. headerAlign: "center",
  441. align: "center",
  442. columnLabel: this.$t('warehouse.label.countFlag'),
  443. columnWidth: 90,
  444. columnSortable: false,
  445. showOverflowTooltip: true,
  446. fixed: ""
  447. },
  448. {
  449. columnProp: "lastCountDate",
  450. headerAlign: "center",
  451. align: "center",
  452. columnLabel: this.$t('warehouse.label.lastCountDate'),
  453. columnWidth: 150,
  454. columnSortable: false,
  455. showOverflowTooltip: true,
  456. fixed: ""
  457. },
  458. {
  459. columnProp: "printCount",
  460. headerAlign: "center",
  461. align: "center",
  462. columnLabel: this.$t('warehouse.label.printTimes'),
  463. columnWidth: 80,
  464. columnSortable: false,
  465. showOverflowTooltip: true,
  466. fixed: ""
  467. },
  468. {
  469. columnProp: "lastPrintDate",
  470. headerAlign: "center",
  471. align: "center",
  472. columnLabel: this.$t('warehouse.label.lastPrintTime'),
  473. columnWidth: 150,
  474. columnSortable: false,
  475. showOverflowTooltip: true,
  476. fixed: ""
  477. },
  478. {
  479. columnProp: "createdDate",
  480. headerAlign: "center",
  481. align: "center",
  482. columnLabel: this.$t('warehouse.label.createdTime'),
  483. columnWidth: 150,
  484. columnSortable: false,
  485. showOverflowTooltip: true,
  486. fixed: ""
  487. },
  488. {
  489. columnProp: "height",
  490. headerAlign: "center",
  491. align: "right",
  492. columnLabel: this.$t('warehouse.label.height'),
  493. columnWidth: 100,
  494. columnSortable: false,
  495. showOverflowTooltip: true,
  496. fixed: ""
  497. },
  498. {
  499. columnProp: "sourceType",
  500. headerAlign: "center",
  501. align: "left",
  502. columnLabel: this.$t('warehouse.label.sourceType'),
  503. columnWidth: 100,
  504. columnSortable: false,
  505. showOverflowTooltip: true,
  506. fixed: ""
  507. },
  508. {
  509. columnProp: "remark",
  510. headerAlign: "center",
  511. align: "left",
  512. columnLabel: this.$t('warehouse.label.remark'),
  513. columnWidth: 100,
  514. columnSortable: false,
  515. showOverflowTooltip: true,
  516. fixed: ""
  517. },
  518. {
  519. columnProp: "reserveFlag",
  520. headerAlign: "center",
  521. align: "center",
  522. columnLabel: this.$t('warehouse.label.reserveFlag'),
  523. columnWidth: 80,
  524. columnSortable: false,
  525. showOverflowTooltip: true,
  526. fixed: ""
  527. },
  528. {
  529. columnProp: "reserveOrderRef1",
  530. headerAlign: "center",
  531. align: "center",
  532. columnLabel: this.$t('warehouse.label.reserveOrderRef1'),
  533. columnWidth: 120,
  534. columnSortable: false,
  535. showOverflowTooltip: true,
  536. fixed: ""
  537. },
  538. {
  539. columnProp: "reserveOrderRef2",
  540. headerAlign: "center",
  541. align: "center",
  542. columnLabel: this.$t('warehouse.label.reserveOrderRef2'),
  543. columnWidth: 120,
  544. columnSortable: false,
  545. showOverflowTooltip: true,
  546. fixed: ""
  547. },
  548. {
  549. columnProp: "reserveOrderRef3",
  550. headerAlign: "center",
  551. align: "center",
  552. columnLabel: this.$t('warehouse.label.reserveOrderRef3'),
  553. columnWidth: 120,
  554. columnSortable: false,
  555. showOverflowTooltip: true,
  556. fixed: ""
  557. }
  558. ],
  559. queryHeaderData: {
  560. inStockFlag: '',
  561. countFlag: '',
  562. partNo: '',
  563. batchNo: '',
  564. locationId: '',
  565. unitId: '',
  566. partDesc: '',
  567. sourceType: '',
  568. startDate: '',
  569. endDate: '',
  570. },
  571. // 打印相关配置
  572. reportId: 'HU_LABEL', // 默认报表ID,可根据实际情况调整
  573. zplCode: '', // ZPL代码
  574. paperSize: 'A4',
  575. orientation: 'portrait',
  576. dpi: 203,
  577. // 其它入库标签打印相关
  578. otherInboundVisible: false,
  579. otherInboundLoading: false,
  580. otherInboundForm: {
  581. partNo: '',
  582. partDesc: '',
  583. batchNo: '',
  584. locationId: '',
  585. warehouseId: '',
  586. wdr: '*',
  587. qty: 1,
  588. umId: '个',
  589. packageCount: 1,
  590. manufactureDate: '',
  591. expiredDate: '',
  592. remark: ''
  593. },
  594. // 导出相关 - rqrq
  595. exportData: [],
  596. exportName: this.$t('warehouse.label.query') + this.dayjs().format('YYYYMMDDHHmmss'),
  597. exportHeader: [this.$t('warehouse.label.query')],
  598. exportFooter: [],
  599. otherInboundRules: {
  600. partNo: [
  601. { required: true, message: this.$t('warehouse.label.partNoRequired'), trigger: 'blur' }
  602. ],
  603. partDesc: [
  604. { required: true, message: this.$t('warehouse.label.partDescRequired'), trigger: 'blur' }
  605. ],
  606. batchNo: [
  607. { required: true, message: this.$t('warehouse.label.batchNoRequired'), trigger: 'blur' }
  608. ],
  609. locationId: [
  610. { required: true, message: this.$t('warehouse.label.locationRequired'), trigger: 'blur' }
  611. ],
  612. warehouseId: [
  613. { required: true, message: this.$t('warehouse.label.warehouseRequired'), trigger: 'blur' }
  614. ],
  615. qty: [
  616. { required: true, message: this.$t('warehouse.inventory.qtyRequired'), trigger: 'blur' },
  617. { type: 'number', min: 0.01, message: this.$t('warehouse.inventory.qtyPositive'), trigger: 'blur' }
  618. ],
  619. umId: [
  620. { required: true, message: this.$t('warehouse.label.umIdRequired'), trigger: 'blur' }
  621. ],
  622. packageCount: [
  623. { required: true, message: this.$t('warehouse.label.packageCountRequired'), trigger: 'blur' },
  624. { type: 'number', min: 1, message: this.$t('warehouse.label.packageCountMin'), trigger: 'blur' }
  625. ]
  626. },
  627. // 失败打印任务相关
  628. failedPrintTasksVisible: false,
  629. failedPrintTasksLoading: false,
  630. failedPrintTasksList: [],
  631. retryLoading: false
  632. }
  633. },
  634. activated() {
  635. this.getDataList()
  636. this.getHeight()
  637. },
  638. mounted() {
  639. this.getDataList()
  640. this.getHeight()
  641. },
  642. methods: {
  643. // 获取数据列表
  644. getDataList() {
  645. this.dataListLoading = true
  646. const params = {
  647. page: this.pageIndex,
  648. size: this.pageSize,
  649. site: localStorage.getItem('site'),
  650. ...this.queryHeaderData
  651. }
  652. getHandlingUnitLabelList(params).then(({ data }) => {
  653. if (data && data.code === 0) {
  654. this.dataList = data.page.list || []
  655. this.totalPage = data.page.totalCount || 0
  656. } else {
  657. this.dataList = []
  658. this.totalPage = 0
  659. this.$alert(data.msg || this.$t('warehouse.message.queryFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  660. }
  661. this.dataListLoading = false
  662. }).catch(() => {
  663. this.dataList = []
  664. this.totalPage = 0
  665. this.dataListLoading = false
  666. })
  667. },
  668. // 重置查询条件
  669. resetQuery() {
  670. this.queryHeaderData = {
  671. inStockFlag: '',
  672. countFlag: '',
  673. partNo: '',
  674. batchNo: '',
  675. locationId: '',
  676. unitId: '',
  677. partDesc: '',
  678. sourceType: '',
  679. startDate: '',
  680. endDate: '',
  681. }
  682. this.pageIndex = 1
  683. this.getDataList()
  684. },
  685. // 重打标签
  686. async reprintLabel(row) {
  687. try {
  688. // 设置页面打印状态
  689. this.printLoading = true
  690. this.loadingText = this.$t('warehouse.label.printingByUnit', { unitId: row.unitId })
  691. // 设置行打印状态
  692. this.$set(row, 'printing', true)
  693. let printLabelType;
  694. if (row.partNo && row.partNo.startsWith("80")) {
  695. printLabelType = '库存成品标签';
  696. } else {
  697. printLabelType = 'BIL标签';
  698. }
  699. const printRequest = {
  700. reportId: this.reportId,
  701. zplCode: this.zplCode,
  702. paperSize: this.paperSize,
  703. orientation: this.orientation,
  704. dpi: this.dpi,
  705. userId: localStorage.getItem('userName'),
  706. username: localStorage.getItem('userName'),
  707. site: localStorage.getItem('site'),
  708. unitId: row.unitId,
  709. labelType:printLabelType
  710. }
  711. const { data } = await reprintLabel(printRequest)
  712. if (data && data.code === 0) {
  713. this.$message.success(this.$t('warehouse.label.printSuccess'))
  714. // 刷新当前行数据
  715. this.getDataList()
  716. } else {
  717. this.$alert(data.msg || this.$t('warehouse.label.printFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  718. }
  719. } catch (error) {
  720. this.$alert(this.$t('warehouse.label.printFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  721. } finally {
  722. // 清除页面打印状态
  723. this.printLoading = false
  724. this.loadingText = this.$t('warehouse.common.loading')
  725. // 清除行打印状态
  726. this.$set(row, 'printing', false)
  727. }
  728. },
  729. // 删除标签
  730. deleteLabel(row) {
  731. this.$confirm(this.$t('warehouse.label.deleteConfirmContent', { unitId: row.unitId }), this.$t('warehouse.label.deleteConfirmTitle'), {
  732. confirmButtonText: this.$t('warehouse.label.deleteConfirmButton'),
  733. cancelButtonText: this.$t('warehouse.common.cancel'),
  734. type: 'warning'
  735. }).then(async () => {
  736. try {
  737. this.dataListLoading = true
  738. const { data } = await deleteLabel({
  739. site: localStorage.getItem('site'),
  740. unitId: row.unitId
  741. })
  742. if (data && data.code === 0) {
  743. this.$message.success(this.$t('warehouse.message.deleteSuccess'))
  744. // 刷新数据列表
  745. this.getDataList()
  746. } else {
  747. this.$alert(data.msg || this.$t('warehouse.message.deleteFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  748. }
  749. } catch (error) {
  750. this.$alert(this.$t('warehouse.label.deleteFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  751. } finally {
  752. this.dataListLoading = false
  753. }
  754. }).catch(() => {
  755. // 用户取消删除
  756. })
  757. },
  758. // 每页数
  759. sizeChangeHandle(val) {
  760. this.pageSize = val
  761. this.pageIndex = 1
  762. this.getDataList()
  763. },
  764. // 当前页
  765. currentChangeHandle(val) {
  766. this.pageIndex = val
  767. this.getDataList()
  768. },
  769. // 格式化日期
  770. formatDate(date) {
  771. if (!date) return ''
  772. const d = new Date(date)
  773. const year = d.getFullYear()
  774. const month = String(d.getMonth() + 1).padStart(2, '0')
  775. const day = String(d.getDate()).padStart(2, '0')
  776. const hours = String(d.getHours()).padStart(2, '0')
  777. const minutes = String(d.getMinutes()).padStart(2, '0')
  778. const seconds = String(d.getSeconds()).padStart(2, '0')
  779. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  780. },
  781. // 导出相关方法 - rqrq
  782. async createExportData() {
  783. const queryParams = {
  784. site: localStorage.getItem('site'),
  785. ...this.queryHeaderData,
  786. page: 1,
  787. size: 999999 // 设置一个很大的数字来获取全部数据 - rqrq
  788. }
  789. const {data} = await getHandlingUnitLabelList(queryParams)
  790. if (data && data.code === 0) {
  791. return (data.page.list || []).map(item => {
  792. return {
  793. ...item,
  794. inStockFlag: item.inStockFlag === 'Y' ? this.$t('warehouse.label.inStock') : item.inStockFlag === 'N' ? this.$t('warehouse.label.outbound') : item.inStockFlag === 'X' ? this.$t('warehouse.label.notInStock') : item.inStockFlag,
  795. reserveFlag: item.reserveFlag === 'Y' ? this.$t('warehouse.common.yes') : this.$t('warehouse.common.no'),
  796. lastPrintDate: this.formatDate(item.lastPrintDate),
  797. createdDate: this.formatDate(item.createdDate),
  798. lastCountDate: this.formatDate(item.lastCountDate)
  799. }
  800. })
  801. }
  802. return []
  803. },
  804. startDownload() {
  805. // 开始导出 - rqrq
  806. },
  807. finishDownload() {
  808. // 导出完成 - rqrq
  809. },
  810. fields() {
  811. let json = "{"
  812. this.columnList.forEach((item, index) => {
  813. if (index == this.columnList.length - 1) {
  814. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  815. } else {
  816. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  817. }
  818. })
  819. json += "}"
  820. let s = eval("(" + json + ")")
  821. return s
  822. },
  823. // 获取表格高度
  824. getHeight() {
  825. this.$nextTick(() => {
  826. this.height = window.innerHeight - 280
  827. })
  828. },
  829. // 显示其它入库标签打印对话框
  830. showOtherInboundDialog() {
  831. this.otherInboundVisible = true
  832. // 重置表单
  833. this.otherInboundForm = {
  834. partNo: '',
  835. partDesc: '',
  836. batchNo: '',
  837. locationId: '',
  838. warehouseId: '',
  839. wdr: '*',
  840. qty: 1,
  841. umId: '个',
  842. packageCount: 1,
  843. manufactureDate: '',
  844. expiredDate: '',
  845. remark: '',
  846. height: '',
  847. }
  848. this.$nextTick(() => {
  849. if (this.$refs['otherInboundForm']) {
  850. this.$refs['otherInboundForm'].clearValidate()
  851. }
  852. })
  853. },
  854. // 创建其它入库HandlingUnit
  855. async createOtherInboundHU() {
  856. try {
  857. // 基本验证
  858. if (!this.otherInboundForm.partNo) {
  859. this.$alert(this.$t('warehouse.label.partNoRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  860. return
  861. }
  862. if (!this.otherInboundForm.partDesc) {
  863. this.$alert(this.$t('warehouse.label.partDescRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  864. return
  865. }
  866. if (!this.otherInboundForm.batchNo) {
  867. this.$alert(this.$t('warehouse.label.batchNoRequired'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  868. return
  869. }
  870. if (!this.otherInboundForm.qty || parseFloat(this.otherInboundForm.qty) <= 0) {
  871. this.$alert(this.$t('warehouse.inventory.qtyPositive'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  872. return
  873. }
  874. if (!this.otherInboundForm.packageCount || parseInt(this.otherInboundForm.packageCount) <= 0) {
  875. this.$alert(this.$t('warehouse.label.packageCountGreaterThanZero'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  876. return
  877. }
  878. this.otherInboundLoading = true
  879. // 准备创建HU的数据
  880. const createData = {
  881. site: localStorage.getItem('site'),
  882. warehouseId: this.otherInboundForm.warehouseId,
  883. partNo: this.otherInboundForm.partNo,
  884. partDesc: this.otherInboundForm.partDesc,
  885. batchNo: this.otherInboundForm.batchNo,
  886. wdr: this.otherInboundForm.wdr,
  887. locationId: this.otherInboundForm.locationId,
  888. umid: this.otherInboundForm.umId,
  889. perPackageQty: parseFloat(this.otherInboundForm.qty),
  890. packageCount: parseInt(this.otherInboundForm.packageCount),
  891. manufactureDate: this.otherInboundForm.manufactureDate || null,
  892. expiredDate: this.otherInboundForm.expiredDate || null,
  893. remark: this.otherInboundForm.remark,
  894. height: this.otherInboundForm.height || null,
  895. }
  896. // 创建HandlingUnit
  897. const { data } = await createOtherInboundHU(createData)
  898. if (data && data.code === 0) {
  899. this.$message.success(this.$t('warehouse.ifs.createSuccess'))
  900. // 确定标签类型
  901. let printLabelType
  902. if (this.otherInboundForm.partNo && this.otherInboundForm.partNo.startsWith("80")) {
  903. printLabelType = '库存成品标签'
  904. } else {
  905. printLabelType = 'BIL标签'
  906. }
  907. // 创建成功后进行打印
  908. await this.printHandlingUnits(data.unitIds, printLabelType)
  909. this.otherInboundVisible = false
  910. this.getDataList() // 刷新列表
  911. } else {
  912. this.$alert(data.msg || this.$t('warehouse.ifs.createFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  913. }
  914. } catch (error) {
  915. this.$alert(this.$t('warehouse.label.createFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  916. } finally {
  917. this.otherInboundLoading = false
  918. }
  919. },
  920. // 打印HandlingUnit标签
  921. async printHandlingUnits(unitIds, printLabelType) {
  922. if (!unitIds || unitIds.length === 0) {
  923. return
  924. }
  925. try {
  926. // 逐个打印每个HandlingUnit
  927. for (const unitId of unitIds) {
  928. await this.printViaServer(unitId, printLabelType)
  929. }
  930. this.$message.success(this.$t('warehouse.label.printSuccessWithCount', { count: unitIds.length }))
  931. } catch (error) {
  932. this.$alert(this.$t('warehouse.label.printFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  933. }
  934. },
  935. // 通过服务器打印
  936. async printViaServer(unitId, printLabelType) {
  937. try {
  938. const printRequest = {
  939. reportId: this.reportId,
  940. zplCode: this.zplCode,
  941. paperSize: this.paperSize,
  942. orientation: this.orientation,
  943. dpi: this.dpi,
  944. userId: localStorage.getItem('userName'),
  945. username: localStorage.getItem('userName'),
  946. site: localStorage.getItem('site'),
  947. unitId: unitId,
  948. labelType: printLabelType
  949. }
  950. const { data } = await printLabel(printRequest)
  951. if (data.code === 200) {
  952. return Promise.resolve()
  953. } else {
  954. return Promise.reject(new Error(data.msg || this.$t('warehouse.label.printFailed')))
  955. }
  956. } catch (error) {
  957. return Promise.reject(error)
  958. }
  959. },
  960. /**
  961. * 显示失败打印任务对话框
  962. */
  963. async showFailedPrintTasksDialog() {
  964. this.failedPrintTasksVisible = true
  965. this.failedPrintTasksLoading = true
  966. try {
  967. const { data } = await getFailedPrintTasks({
  968. site: localStorage.getItem('site')
  969. })
  970. if (data && data.code === 0) {
  971. this.failedPrintTasksList = data.rows || []
  972. if (this.failedPrintTasksList.length === 0) {
  973. this.$message.warning(this.$t('warehouse.label.noFailedTasks'))
  974. }
  975. } else {
  976. this.$alert(data.msg || this.$t('warehouse.message.queryFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  977. this.failedPrintTasksList = []
  978. }
  979. } catch (error) {
  980. this.$alert(this.$t('warehouse.label.queryFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  981. this.failedPrintTasksList = []
  982. } finally {
  983. this.failedPrintTasksLoading = false
  984. }
  985. },
  986. /**
  987. * 重试全部失败的打印任务
  988. */
  989. async retryAllFailedTasks() {
  990. if (this.failedPrintTasksList.length === 0) {
  991. this.$message.warning(this.$t('warehouse.label.noRetry'))
  992. return
  993. }
  994. this.$confirm(this.$t('warehouse.label.retryConfirmContent', { count: this.failedPrintTasksList.length }), this.$t('warehouse.label.retryConfirmTitle'), {
  995. confirmButtonText: this.$t('warehouse.common.confirm'),
  996. cancelButtonText: this.$t('warehouse.common.cancel'),
  997. type: 'warning'
  998. }).then(async () => {
  999. this.retryLoading = true
  1000. try {
  1001. const { data } = await retryFailedPrintTasks({
  1002. site: localStorage.getItem('site')
  1003. })
  1004. if (data && data.code === 0) {
  1005. this.$message.success(this.$t('warehouse.label.retryEnqueueSuccess', { count: data.count || 0 }))
  1006. // 关闭对话框
  1007. this.failedPrintTasksVisible = false
  1008. // 清空列表
  1009. this.failedPrintTasksList = []
  1010. } else {
  1011. this.$alert(data.msg || this.$t('warehouse.label.retryFailed'), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  1012. }
  1013. } catch (error) {
  1014. this.$alert(this.$t('warehouse.label.retryFailedWithReason', { reason: error.message }), this.$t('warehouse.common.error'), { confirmButtonText: this.$t('warehouse.common.confirm') })
  1015. } finally {
  1016. this.retryLoading = false
  1017. }
  1018. }).catch(() => {
  1019. // 用户取消重试
  1020. })
  1021. }
  1022. }
  1023. }
  1024. </script>
  1025. <style>
  1026. .mod-config .el-form-item {
  1027. margin-bottom: 15px;
  1028. }
  1029. .sl-svg {
  1030. font-size: 20px;
  1031. cursor: pointer;
  1032. color: #409EFF;
  1033. }
  1034. /* 其它入库标签打印表单样式 */
  1035. .other-inbound-form .form-item-vertical {
  1036. margin-bottom: 20px;
  1037. }
  1038. .other-inbound-form .form-item-vertical .el-form-item__label {
  1039. display: block;
  1040. text-align: left;
  1041. padding: 0 0 8px 0;
  1042. line-height: 1.5;
  1043. font-weight: 500;
  1044. }
  1045. .other-inbound-form .form-item-vertical .el-form-item__content {
  1046. margin-left: 0 !important;
  1047. }
  1048. .other-inbound-form .el-row {
  1049. margin-bottom: 0;
  1050. }
  1051. </style>