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.

1198 lines
44 KiB

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