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.

1467 lines
51 KiB

3 months ago
​
​
3 months ago
3 months ago
​
​
3 months ago
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
1 month ago
​
​
3 months ago
​
​
1 month 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 month ago
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
3 months ago
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
2 months ago
3 months ago
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
3 months ago
1 month ago
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
3 months ago
​
​
2 months ago
3 months ago
​
​
​
2 months ago
​
3 months ago
​
​
2 months ago
3 months ago
​
​
​
​
​
​
​
​
​
​
​
2 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
2 months ago
3 months ago
​
2 months ago
​
3 months ago
​
​
​
​
​
​
​
​
1 month ago
​
3 months ago
2 months ago
​
3 months ago
​
​
​
​
​
​
3 months ago
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
3 months ago
​
​
​
​
1 month ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
3 months ago
1 month ago
3 months ago
​
1 month ago
3 months ago
​
​
​
​
​
​
​
​
​
1 month ago
3 months ago
​
1 month ago
3 months ago
3 months ago
1 month ago
​
3 months ago
​
3 months ago
​
​
​
3 months ago
​
​
3 months ago
​
3 months ago
​
​
​
​
3 months ago
​
1 month ago
​
3 months ago
1 month ago
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
3 months ago
​
1 month ago
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
​
​
3 months ago
​
​
​
​
1 month 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
​
​
2 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
​
​
​
​
​
​
2 weeks ago
​
3 months ago
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1 month ago
​
​
​
​
3 months ago
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <template>
  2. <div class="pda-container">
  3. <div class="header-bar">
  4. <div class="header-left" :class="{ 'header-action-disabled': interfaceBusy }" @click="handleBack">
  5. <i class="el-icon-arrow-left"></i>
  6. <span>组盘入库</span>
  7. </div>
  8. <div class="header-right" :class="{ 'header-action-disabled': interfaceBusy }" @click="goHome">首页</div>
  9. </div>
  10. <div class="table-body" style="max-height: 500px; overflow-y: auto;">
  11. <div class="main-content form-section">
  12. <!-- 第一行:栈板扫描 - rqrq -->
  13. <div class="input-group">
  14. <label class="input-label">栈板编码</label>
  15. <div style="display: flex; gap: 8px;">
  16. <el-input
  17. v-model="palletCode"
  18. placeholder="请扫描栈板编码"
  19. class="form-input"
  20. style="flex: 0.75;"
  21. clearable
  22. inputmode="none"
  23. autocomplete="off"
  24. autocorrect="off"
  25. spellcheck="false"
  26. @keyup.enter.native="handlePalletScan"
  27. ref="palletInput"
  28. />
  29. <button
  30. class="action-btn secondary"
  31. style="flex: 0.25; margin: 0;"
  32. @click="handleCallPallet"
  33. :disabled="interfaceBusy"
  34. >
  35. Call栈板
  36. </button>
  37. </div>
  38. </div>
  39. <!-- 第二行:栈板类型和自动分拣 (扫描栈板后显示) - rqrq -->
  40. <div v-if="palletScanned" class="input-group">
  41. <div style="display: flex; gap: 8px; align-items: end;">
  42. <div style="flex: 0.65;">
  43. <label class="input-label">栈板类型</label>
  44. <el-select
  45. v-model="currentPalletType"
  46. placeholder="请选择栈板类型"
  47. style="width: 100%;"
  48. :disabled="palletTypeDisabled"
  49. @change="handlePalletTypeChange"
  50. >
  51. <el-option
  52. v-for="type in palletTypeOptions"
  53. :key="type.palletType"
  54. :label="`${type.palletType} - ${type.typeDesc}`"
  55. :value="type.palletType"
  56. />
  57. </el-select>
  58. </div>
  59. <div style="flex: 0.35;">
  60. <label class="input-label">自动分拣</label>
  61. <el-select
  62. v-model="currentAutoSort"
  63. placeholder="请选择"
  64. style="width: 100%;"
  65. :disabled="autoSortDisabled"
  66. @change="handleAutoSortChange"
  67. >
  68. <el-option label="是" value="Y"></el-option>
  69. <el-option label="否" value="N"></el-option>
  70. </el-select>
  71. </div>
  72. </div>
  73. </div>
  74. <div v-if="palletScanned && currentPalletType === 'A0206'" class="input-group">
  75. <label class="input-label">手工备注</label>
  76. <el-input
  77. v-model="manualRemark"
  78. type="textarea"
  79. :rows="2"
  80. maxlength="200"
  81. placeholder="请输入手工备注,离开输入框后自动保存"
  82. :disabled="manualRemarkSaving || interfaceBusy"
  83. @blur="handleManualRemarkBlur"
  84. />
  85. </div>
  86. <!-- 第2.5行:是否强制整托出库 (扫描栈板后显示) - rqrq -->
  87. <div v-if="palletScanned" class="input-group">
  88. <el-checkbox
  89. :key="forceFullPalletOutRenderKey"
  90. :value="forceFullPalletOut"
  91. :disabled="palletTypeDisabled || interfaceBusy"
  92. @change="handleForceFullPalletOutChange"
  93. style="width: 100%;"
  94. >
  95. <span :class="{ 'force-full-pallet-out-active': forceFullPalletOut }">是否强制整托出库</span>
  96. </el-checkbox>
  97. </div>
  98. <!-- 第三行:当前栈板站点显示 (扫描栈板后显示) - rqrq -->
  99. <div v-if="palletScanned" class="input-group">
  100. <label class="input-label">当前站点</label>
  101. <div style="display: flex; gap: 8px;">
  102. <el-input
  103. v-model="currentPalletStation"
  104. placeholder="栈板当前站点"
  105. class="form-input"
  106. readonly
  107. style="flex: 0.75;"
  108. />
  109. <button
  110. class="action-btn secondary"
  111. style="flex: 0.25; margin: 0; white-space: nowrap;"
  112. @click="refreshTable"
  113. :disabled="interfaceBusy"
  114. >
  115. 刷新
  116. </button>
  117. </div>
  118. </div>
  119. <!-- 第四行:扫进/扫出选择 (扫描栈板后显示) - rqrq -->
  120. <div v-if="palletScanned" class="input-group">
  121. <div style="display: flex; gap: 8px; align-items: center;">
  122. <div style="flex: 0.75;">
  123. <el-radio-group v-model="operationType" style="display: flex;">
  124. <el-radio label="in" style="margin-right: 0px; white-space: nowrap;">扫进</el-radio>
  125. <el-radio label="out" style="white-space: nowrap;">扫出</el-radio>
  126. </el-radio-group>
  127. </div>
  128. <button
  129. class="action-btn secondary"
  130. style="flex: 0.25; margin: 0; white-space: nowrap;"
  131. :disabled="interfaceBusy || currentPalletType === ''"
  132. @click="showScanModal"
  133. >
  134. 扫描条码
  135. </button>
  136. </div>
  137. </div>
  138. </div>
  139. <!-- 栈板明细表格 (扫描栈板后显示) - rqrq -->
  140. <div v-if="palletScanned" class="rma-list">
  141. <div class="list-title-row" style="display: flex; gap: 8px; align-items: center; padding: 0;">
  142. <div class="list-title" style="flex: 0.4; margin: 0;">
  143. <button class="action-btn primary" style="margin: 0;" @click="showDetailModal">
  144. {{ '明细' }}
  145. </button>
  146. </div>
  147. <button class="action-btn warning" style="flex: 0.3; margin: 0;" @click="showScanOutModal" :disabled="interfaceBusy || scanOutList.length === 0">
  148. 扫出({{ scanOutList.length }})
  149. </button>
  150. <button class="action-btn secondary" style="flex: 0.3; margin: 0;" @click="openTransportModal" :disabled="interfaceBusy || !currentPalletStation">{{ transportLoading ? '处理中...' : '运输入库' }}</button>
  151. </div>
  152. <div class="list-title" style="flex: 0.5; margin: 0;">
  153. <label style="margin-left: 5px;">条码数:{{ detailList.length }}</label>
  154. </div>
  155. <div class="detail-table">
  156. <div class="table-header">
  157. <div class="col-position">位置</div>
  158. <div class="col-layer">层数</div>
  159. <div class="col-serial">标签号</div>
  160. </div>
  161. <div
  162. v-for="(detail, index) in detailList"
  163. :key="index"
  164. class="table-row"
  165. :class="haianPalletRowClass(detail)">
  166. <div class="col-position">{{ detail.position }}</div>
  167. <div class="col-layer">{{ detail.layer }}</div>
  168. <div class="col-serial">{{ detail.serialNo }}</div>
  169. </div>
  170. <div v-if="detailList.length === 0" class="table-row empty-row">
  171. <div class="empty-hint">暂无栈板明细数据</div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <!-- 浏览明细弹窗 - rqrq -->
  177. <el-dialog
  178. :title="'已扫描数量:' + detailList.length"
  179. :visible.sync="detailModalVisible"
  180. width="90%"
  181. :close-on-click-modal="false"
  182. :show-close="false"
  183. :append-to-body="true"
  184. >
  185. <div class="table-body" style="max-height: 240px; overflow-y: auto;">
  186. <div class="detail-table">
  187. <div class="table-header">
  188. <div class="col-position">位置</div>
  189. <div class="col-layer">层数</div>
  190. <div class="col-serial">标签号</div>
  191. </div>
  192. <div v-for="(detail, index) in detailList" :key="index" class="table-row" :class="haianPalletRowClass(detail)">
  193. <div class="col-position">{{ detail.position }}</div>
  194. <div class="col-layer">{{ detail.layer }}</div>
  195. <div class="col-serial">{{ detail.serialNo }}</div>
  196. </div>
  197. <div v-if="detailList.length === 0" class="table-row empty-row">
  198. <div class="empty-hint">暂无栈板明细数据</div>
  199. </div>
  200. </div>
  201. </div>
  202. <div slot="footer" class="dialog-footer">
  203. <button class="action-btn secondary" style="margin-left: 10px;" @click="detailModalVisible = false" :disabled="interfaceBusy">取消</button>
  204. </div>
  205. </el-dialog>
  206. <!-- 查看扫出弹窗 - rqrq -->
  207. <el-dialog
  208. :title="'扫出记录 (共' + scanOutList.length + '条)'"
  209. :visible.sync="scanOutModalVisible"
  210. width="90%"
  211. :close-on-click-modal="false"
  212. :show-close="false"
  213. :append-to-body="true"
  214. >
  215. <div class="table-body" style="max-height: 300px; overflow-y: auto;">
  216. <div class="detail-table">
  217. <div class="table-header">
  218. <div class="col-position">位置</div>
  219. <div class="col-layer">层数</div>
  220. <div class="col-serial">标签号</div>
  221. </div>
  222. <div
  223. v-for="(detail, index) in scanOutList"
  224. :key="index"
  225. class="table-row"
  226. :class="haianPalletRowClass(detail)">
  227. <div class="col-position">{{ detail.position }}</div>
  228. <div class="col-layer">{{ detail.layer }}</div>
  229. <div class="col-serial">{{ detail.serialNo }}</div>
  230. </div>
  231. <div v-if="scanOutList.length === 0" class="table-row empty-row">
  232. <div class="empty-hint">暂无扫出记录</div>
  233. </div>
  234. </div>
  235. </div>
  236. <div slot="footer" class="dialog-footer">
  237. <button class="action-btn secondary" @click="scanOutModalVisible = false" :disabled="interfaceBusy">关闭</button>
  238. </div>
  239. </el-dialog>
  240. <!-- 扫码模态框:网格层数与原PDA页面保持一致 - rqrq -->
  241. <el-dialog
  242. title="扫描标签"
  243. :visible.sync="scanModalVisible"
  244. width="90%"
  245. :close-on-click-modal="false"
  246. :show-close="false"
  247. :modal="true"
  248. :modal-append-to-body="true"
  249. :append-to-body="true"
  250. >
  251. <div class="scan-modal-content">
  252. <!-- 扫进时显示层数选择和位置网格 - rqrq -->
  253. <div v-if="operationType === 'in'" class="modal-form">
  254. <!-- 单层托盘保留选层显示并默认高亮第1层,多层托盘仍可手动切换 - rqrq -->
  255. <div v-if="!currentMixedMode && scanLayerOptions.length > 0" class="input-group">
  256. <label class="input-label">层数(当前选择:第{{ scanLayer }}层)</label>
  257. <div class="layer-grid">
  258. <div
  259. v-for="layer in scanLayerOptions"
  260. :key="layer"
  261. class="layer-item"
  262. :class="{
  263. 'layer-selected': scanLayer === layer
  264. }"
  265. @click="handleLayerClick(layer)"
  266. >
  267. {{ layer }}
  268. </div>
  269. </div>
  270. </div>
  271. <!-- 始终显示位置网格;托盘仅有一个位置且可用时自动高亮,层数与位置均已选中后聚焦扫码框 - rqrq -->
  272. <div class="input-group">
  273. <label class="input-label">
  274. 位置{{ currentSelectedPosition ? `(当前选择:${currentSelectedPosition})` : '' }}
  275. <span v-if="positionGridLoading" style="color: #909399; font-size: 12px;">(加载中...)</span>
  276. </label>
  277. <div class="position-grid" :class="[
  278. {'position-grid-loading': positionGridLoading},
  279. getPositionGridClass
  280. ]">
  281. <div
  282. v-for="(item, index) in displayPositionGrid"
  283. :key="index"
  284. class="position-item"
  285. :class="{
  286. 'position-disabled': positionGridLoading || !availablePositions.includes(item.position),
  287. 'position-selected': currentSelectedPosition === item.position,
  288. 'position-loading': positionGridLoading,
  289. 'position-placeholder': item.isPlaceholder
  290. }"
  291. @click="handlePositionClick(item.position)"
  292. >
  293. <template v-if="!item.isPlaceholder">{{ item.position }}({{ item.count }})</template>
  294. </div>
  295. </div>
  296. </div>
  297. <!-- 唯一位置不可用时说明扫码口禁用原因,避免操作员误以为扫码故障 - rqrq -->
  298. <div v-if="positionGrid.length === 1 && !positionGridLoading && !currentSelectedPosition" class="input-label">
  299. 位置{{ positionGrid[0].position }}当前不可用,请检查托盘位置状态
  300. </div>
  301. </div>
  302. <!-- 标签扫描 - rqrq -->
  303. <div class="input-group">
  304. <label class="input-label">标签二维码</label>
  305. <el-input
  306. ref="scanInput"
  307. v-model="scanCode"
  308. placeholder="请扫描标签二维码"
  309. class="form-input"
  310. clearable
  311. :disabled="operationType === 'in' && !currentSelectedPosition"
  312. @keyup.enter.native="handleLabelScan"
  313. inputmode="none"
  314. autocomplete="off"
  315. autocorrect="off"
  316. spellcheck="false"
  317. />
  318. </div>
  319. </div>
  320. <div slot="footer" class="dialog-footer">
  321. <button class="action-btn secondary" style="margin-left: 10px;" @click="closeScanModal" :disabled="interfaceBusy">取消</button>
  322. </div>
  323. </el-dialog>
  324. <!-- Call空托盘弹窗 - rqrq -->
  325. <el-dialog
  326. title="调用空托盘"
  327. :visible.sync="callEmptyModalVisible"
  328. width="90%"
  329. :close-on-click-modal="false"
  330. :show-close="false"
  331. :append-to-body="true"
  332. >
  333. <div class="input-group">
  334. <label class="input-label">区域</label>
  335. <el-select v-model="callEmptyForm.areaId" placeholder="请选择区域" style="width: 100%;" @change="handleAreaChangeForCall">
  336. <el-option v-for="a in areaOptions" :key="a.areaId" :label="a.areaDesc" :value="a.areaId" />
  337. </el-select>
  338. </div>
  339. <div class="input-group">
  340. <label class="input-label">站点</label>
  341. <el-select v-model="callEmptyForm.stationCode" placeholder="请选择站点" style="width: 100%;" :disabled="!callEmptyForm.areaId">
  342. <el-option v-for="s in stationOptions" :key="s.stationCode" :label="`${s.stationCode} (${s.status || '-'})`" :value="s.stationCode" />
  343. </el-select>
  344. </div>
  345. <div class="input-group">
  346. <label class="input-label">栈板类型</label>
  347. <el-select v-model="callEmptyForm.palletType" placeholder="请选择栈板类型" style="width: 100%;">
  348. <el-option v-for="t in callEmptyPalletTypeOptions" :key="t.palletType" :label="`${t.palletType} - ${t.typeDesc}`" :value="t.palletType" />
  349. </el-select>
  350. </div>
  351. <div slot="footer" class="dialog-footer">
  352. <button class="action-btn primary" @click="submitCallEmpty" :disabled="interfaceBusy || callEmptyLoading">{{ callEmptyLoading ? '处理中...' : '确认' }}</button>
  353. <button class="action-btn secondary" style="margin-left: 8px;" @click="callEmptyModalVisible = false" :disabled="interfaceBusy || callEmptyLoading">取消</button>
  354. </div>
  355. </el-dialog>
  356. </div>
  357. </template>
  358. <script>
  359. // 海安统一展示自动发料留盘与失败状态,正常托盘明细保持原样。- rqrq
  360. import palletDetailState from './palletDetailState'
  361. import {
  362. checkPalletExists,
  363. getPalletDetails,
  364. savePalletDetail,
  365. deletePalletDetail,
  366. getPalletInfo,
  367. getPalletTypeList,
  368. updatePalletTypeAndAutoSort,
  369. updatePalletManualRemark,
  370. getAvailablePositionsForLayer,
  371. callEmptyPalletToStation,
  372. callPalletToStationWithUpdateZuPan
  373. } from '../../../api/haianAutoWarehouse/palletPacking'
  374. import { getAreaOptionsForChange, getStationsByArea } from '../../../api/haianAutoWarehouse/palletChangeStation'
  375. export default {
  376. mixins: [palletDetailState],
  377. name: 'haianPalletPacking',
  378. data() {
  379. return {
  380. site: this.$store.state.user.site,
  381. palletCode: '',
  382. palletScanned: false,
  383. operationType: 'in',
  384. currentPalletFamily: '',
  385. currentPalletType: '',
  386. currentAutoSort: 'N',
  387. currentPalletStation: '',
  388. manualRemark: '',
  389. savedManualRemark: '',
  390. manualRemarkSaving: false,
  391. forceFullPalletOut: false,
  392. // 取消未确认的勾选时重建控件,避免原生checkbox短暂显示未保存的新状态。- rqrq
  393. forceFullPalletOutRenderKey: 0,
  394. palletTypeDisabled: false,
  395. autoSortDisabled: false,
  396. currentWcsAutoSort: '',
  397. currentMaxLayer: 0,
  398. positionOptions: [],
  399. palletTypeOptions: [],
  400. callEmptyPalletTypeOptions: [],
  401. detailList: [],
  402. scanOutList: [],
  403. detailModalVisible: false,
  404. scanOutModalVisible: false,
  405. palletInfo: {
  406. palletType: '',
  407. autoSort: 'N',
  408. locationCode: ''
  409. },
  410. // 扫码模态框字段:与原PDA页面保持一致,按网格位置 + 层数扫入 - rqrq
  411. scanModalVisible: false,
  412. scanCode: '',
  413. scanPosition: '',
  414. scanLayer: 1,
  415. scanLayerOptions: [],
  416. needRefreshOnClose: false,
  417. positionGrid: [],
  418. availablePositions: [],
  419. currentSelectedPosition: '',
  420. currentMixedMode: false,
  421. positionGridLoading: false,
  422. areaOptions: [],
  423. stationOptions: [],
  424. callEmptyModalVisible: false,
  425. callEmptyLoading: false,
  426. callEmptyForm: {
  427. areaId: '',
  428. stationCode: '',
  429. palletType: ''
  430. },
  431. transportLoading: false,
  432. // 海安页面接口防连点锁:按钮触发接口期间统一置为true,返回后解锁 - rqrq
  433. palletScanLoading: false,
  434. palletConfigLoading: false,
  435. scanRequestLoading: false
  436. }
  437. },
  438. computed: {
  439. // 按托盘类型决定扫入位置图:钢四宫格菱形,平托盘两层都按行 2x2,九宫格仍按行 - rqrq
  440. getPositionGridClass() {
  441. const len = this.positionGrid.length
  442. if (len === 1) return 'position-grid-1'
  443. if (len === 2) return 'position-grid-4'
  444. if (len === 4 && this.currentPalletType === 'A0102') return 'position-grid-steel-4'
  445. if (len === 4 && this.currentPalletType === 'A0301') return 'position-grid-flat-4'
  446. if (len === 4) return 'position-grid-4'
  447. return 'position-grid-9'
  448. },
  449. // 钢托盘四宫格按现场菱形插占位;平托盘保持 1-4 原序,由按行网格画成 1 2 / 3 4 - rqrq
  450. displayPositionGrid() {
  451. const len = this.positionGrid.length
  452. if (len === 2) {
  453. const pos1 = this.positionGrid.find((p) => p.position === '1') || { position: '1', count: 0 }
  454. const pos2 = this.positionGrid.find((p) => p.position === '2') || { position: '2', count: 0 }
  455. return [
  456. { ...pos1, isPlaceholder: false },
  457. { position: '', count: 0, isPlaceholder: true },
  458. { position: '', count: 0, isPlaceholder: true },
  459. { ...pos2, isPlaceholder: false }
  460. ]
  461. }
  462. if (len === 4 && this.currentPalletType === 'A0102') {
  463. const findPos = (no) => {
  464. const found = this.positionGrid.find((p) => String(p.position) === String(no))
  465. return found ? { ...found, isPlaceholder: false } : { position: String(no), count: 0, isPlaceholder: false }
  466. }
  467. const blank = () => ({ position: '', count: 0, isPlaceholder: true })
  468. return [
  469. blank(), findPos('1'), blank(),
  470. findPos('2'), blank(), findPos('3'),
  471. blank(), findPos('4'), blank()
  472. ]
  473. }
  474. return this.positionGrid.map((p) => ({ ...p, isPlaceholder: false }))
  475. },
  476. // 统一接口忙碌状态:用于禁用按钮、回退和首页,避免请求未返回时重复触发 - rqrq
  477. interfaceBusy() {
  478. return this.palletScanLoading || this.palletConfigLoading || this.scanRequestLoading || this.callEmptyLoading || this.transportLoading
  479. }
  480. },
  481. methods: {
  482. // 统一校验site是否存在,海安接口必须显式传site - rqrq
  483. ensureSite() {
  484. if (!this.site) {
  485. this.$alert('当前用户缺少site,无法执行海安组盘业务', '提示', { confirmButtonText: '确定' })
  486. return false
  487. }
  488. return true
  489. },
  490. handleBack() {
  491. if (this.interfaceBusy) {
  492. return
  493. }
  494. // 返回首页前先清空海安组盘页面状态,避免keep-alive导致二次进入残留旧数据 - rqrq
  495. this.resetPage(false)
  496. this.$router.back()
  497. },
  498. // 接口处理中禁用首页跳转,避免用户误离开导致重复提交和状态错乱 - rqrq
  499. goHome() {
  500. if (this.interfaceBusy) {
  501. return
  502. }
  503. this.$router.push({ path: '/' })
  504. },
  505. // 海安组盘页统一重置方法:退出和重进都走同一套清理逻辑,保证状态一致性 - rqrq
  506. resetPage(needFocus = true) {
  507. this.site = this.$store.state.user.site
  508. this.palletCode = ''
  509. this.palletScanned = false
  510. this.operationType = 'in'
  511. this.currentPalletFamily = ''
  512. this.currentPalletType = ''
  513. this.currentAutoSort = 'N'
  514. this.currentPalletStation = ''
  515. this.forceFullPalletOut = false
  516. this.palletTypeDisabled = false
  517. this.autoSortDisabled = false
  518. this.currentWcsAutoSort = ''
  519. this.currentMaxLayer = 0
  520. this.positionOptions = []
  521. this.palletTypeOptions = []
  522. this.callEmptyPalletTypeOptions = []
  523. this.detailList = []
  524. this.scanOutList = []
  525. this.detailModalVisible = false
  526. this.scanOutModalVisible = false
  527. this.palletInfo = {
  528. palletType: '',
  529. autoSort: 'N',
  530. locationCode: ''
  531. }
  532. this.scanModalVisible = false
  533. this.scanCode = ''
  534. this.scanPosition = ''
  535. this.scanLayer = 1
  536. this.scanLayerOptions = []
  537. this.needRefreshOnClose = false
  538. this.positionGrid = []
  539. this.availablePositions = []
  540. this.currentSelectedPosition = ''
  541. this.currentMixedMode = false
  542. this.positionGridLoading = false
  543. this.areaOptions = []
  544. this.stationOptions = []
  545. this.callEmptyModalVisible = false
  546. this.callEmptyLoading = false
  547. this.callEmptyForm = {
  548. areaId: '',
  549. stationCode: '',
  550. palletType: ''
  551. }
  552. this.transportLoading = false
  553. this.palletScanLoading = false
  554. this.palletConfigLoading = false
  555. this.scanRequestLoading = false
  556. if (needFocus) {
  557. this.$nextTick(() => {
  558. if (this.$refs.palletInput) {
  559. this.$refs.palletInput.focus()
  560. }
  561. })
  562. }
  563. },
  564. handlePalletScan() {
  565. if (!this.ensureSite()) {
  566. return
  567. }
  568. if (this.interfaceBusy) {
  569. return
  570. }
  571. if (!this.palletCode || !this.palletCode.trim()) {
  572. this.$alert('请输入栈板编码', '提示', { confirmButtonText: '确定' })
  573. return
  574. }
  575. this.palletScanLoading = true
  576. // 组盘入库场景 sortFlag=0:后端拦截手工分拣区/被分拣站栈板,并按区域 pack_able 处理后续扫标签 - rqrq
  577. checkPalletExists({
  578. site: this.site,
  579. palletId: this.palletCode.trim(),
  580. sortFlag: 0
  581. }).then(({ data }) => {
  582. if (data && data.code === 0) {
  583. this.palletCode = data.palletId
  584. this.positionOptions = data.positions || []
  585. this.palletScanned = true
  586. this.scanOutList = []
  587. this.scanCode = ''
  588. this.scanPosition = ''
  589. this.scanLayer = 1
  590. // 新栈板先清掉旧托盘层高,后续以当前栈板类型和可用位置接口返回值为准 - rqrq
  591. this.currentMaxLayer = 0
  592. this.currentSelectedPosition = ''
  593. this.manualRemark = ''
  594. this.savedManualRemark = ''
  595. this.loadPalletInfo()
  596. this.refreshTable()
  597. } else {
  598. this.$alert((data && data.msg) || '栈板校验失败', '错误', { confirmButtonText: '确定' })
  599. }
  600. }).catch((error) => {
  601. this.$alert(error.message || '栈板校验失败', '错误', { confirmButtonText: '确定' })
  602. }).finally(() => {
  603. this.palletScanLoading = false
  604. })
  605. },
  606. loadPalletInfo() {
  607. getPalletInfo({
  608. site: this.site,
  609. palletId: this.palletCode
  610. }).then(({ data }) => {
  611. if (data && data.code === 0) {
  612. const row = data.row || {}
  613. this.currentPalletFamily = row.palletFamily || ''
  614. this.currentPalletType = row.palletType || ''
  615. this.currentAutoSort = row.autoSort || 'N'
  616. this.currentPalletStation = row.locationCode || ''
  617. this.forceFullPalletOut = Number(row.soreType) === 3
  618. this.manualRemark = row.manualRemark || ''
  619. this.savedManualRemark = this.manualRemark
  620. this.palletInfo.palletType = this.currentPalletType
  621. this.palletInfo.autoSort = this.currentAutoSort
  622. this.palletInfo.locationCode = this.currentPalletStation
  623. this.loadPalletTypeList()
  624. }
  625. })
  626. },
  627. // 当前栈板改类型时,必须按该栈板大分类过滤可选类型,避免跨大类误选 - rqrq
  628. loadPalletTypeList() {
  629. getPalletTypeList({
  630. site: this.site,
  631. palletFamily: this.currentPalletFamily || '',
  632. // 按当前托盘号收窄:G 只返回一宫格,J 只返回四宫格和九宫格 - rqrq
  633. palletId: this.palletCode,
  634. active: 'Y'
  635. }).then(({ data }) => {
  636. if (data && data.code === 0) {
  637. this.palletTypeOptions = data.rows || []
  638. const selectedType = this.palletTypeOptions.find((item) => item.palletType === this.currentPalletType)
  639. this.currentWcsAutoSort = selectedType ? (selectedType.wcsAutoSort || 'N') : ''
  640. this.currentMaxLayer = selectedType ? Number(selectedType.maxLayer || 0) : 0
  641. this.updateAutoSortControl()
  642. }
  643. })
  644. },
  645. // 调用空托盘必须获取全量可用类型,不按当前栈板大分类做过滤 - rqrq
  646. loadAllPalletTypeListForCallEmpty() {
  647. getPalletTypeList({
  648. site: this.site,
  649. palletFamily: '',
  650. active: 'Y'
  651. }).then(({ data }) => {
  652. if (data && data.code === 0) {
  653. this.callEmptyPalletTypeOptions = data.rows || []
  654. const hasSelectedType = this.callEmptyPalletTypeOptions.some((item) => item.palletType === this.callEmptyForm.palletType)
  655. if (!hasSelectedType) {
  656. this.callEmptyForm.palletType = ''
  657. }
  658. } else {
  659. this.callEmptyPalletTypeOptions = []
  660. this.callEmptyForm.palletType = ''
  661. }
  662. }).catch(() => {
  663. this.callEmptyPalletTypeOptions = []
  664. this.callEmptyForm.palletType = ''
  665. })
  666. },
  667. refreshTable() {
  668. getPalletDetails({
  669. site: this.site,
  670. palletId: this.palletCode,
  671. position: '',
  672. layer: null
  673. }).then(({ data }) => {
  674. if (data && data.code === 0) {
  675. this.detailList = data.details || []
  676. } else {
  677. this.detailList = []
  678. }
  679. // 明细存在时锁定托盘类型,避免已组盘后改类型导致规则不一致 - rqrq
  680. this.palletTypeDisabled = this.detailList.length > 0
  681. this.updateAutoSortControl()
  682. }).catch(() => {
  683. this.detailList = []
  684. this.palletTypeDisabled = false
  685. this.updateAutoSortControl()
  686. })
  687. },
  688. handlePalletTypeChange() {
  689. const selectedType = this.palletTypeOptions.find((item) => item.palletType === this.currentPalletType)
  690. this.applyPalletTypeDefaults(selectedType)
  691. this.savePalletTypeConfig()
  692. },
  693. // 改小类时全部选项回到类型主数据:强制整托看wcs_sore_type=3,自动分拣看wcs_auto_sort;从强制改到非强制必须取消勾选 - rqrq
  694. applyPalletTypeDefaults(selectedType) {
  695. this.currentWcsAutoSort = selectedType ? (selectedType.wcsAutoSort || 'N') : 'N'
  696. this.currentMaxLayer = selectedType ? Number(selectedType.maxLayer || 0) : 0
  697. const wcsSoreType = selectedType && selectedType.wcsSoreType != null ? Number(selectedType.wcsSoreType) : 0
  698. this.forceFullPalletOut = wcsSoreType === 3
  699. || this.currentPalletType === 'A0103'
  700. || this.currentPalletType === 'A0206'
  701. this.currentAutoSort = this.currentWcsAutoSort
  702. this.updateAutoSortControl()
  703. },
  704. handleAutoSortChange() {
  705. this.savePalletTypeConfig()
  706. },
  707. // 勾选变化先保持原值;操作员确认后才更新强制整托标记并保存,取消时不触发接口。- rqrq
  708. handleForceFullPalletOutChange (nextValue) {
  709. this.forceFullPalletOutRenderKey += 1
  710. this.$nextTick(() => {
  711. this.$confirm('是否修改强制整托出库标记', '提示', {
  712. confirmButtonText: '确认',
  713. cancelButtonText: '取消',
  714. type: 'warning',
  715. closeOnClickModal: false
  716. }).then(() => {
  717. const previousForceFullPalletOut = this.forceFullPalletOut
  718. const previousAutoSort = this.currentAutoSort
  719. this.forceFullPalletOut = nextValue
  720. this.updateAutoSortControl()
  721. // 确认后保存;接口拒绝或网络失败时恢复原勾选和自动分拣状态,避免页面值与海安托盘配置不一致。- rqrq
  722. this.savePalletTypeConfig().then((saved) => {
  723. if (!saved) {
  724. this.forceFullPalletOut = previousForceFullPalletOut
  725. this.currentAutoSort = previousAutoSort
  726. this.updateAutoSortControl()
  727. }
  728. })
  729. }).catch(() => {
  730. // 取消或关闭弹框时受控勾选框保持原值,不修改托盘配置。- rqrq
  731. })
  732. })
  733. },
  734. // A0206失焦才保存手工备注;内容和上次成功值相同则不请求,失败保留输入供再次离开重试 - rqrq
  735. handleManualRemarkBlur() {
  736. if (!this.palletScanned || this.currentPalletType !== 'A0206' || this.manualRemarkSaving) {
  737. return
  738. }
  739. const nextRemark = (this.manualRemark || '').trim()
  740. this.manualRemark = nextRemark
  741. if (nextRemark === this.savedManualRemark) {
  742. return
  743. }
  744. this.manualRemarkSaving = true
  745. updatePalletManualRemark({
  746. site: this.site,
  747. palletId: this.palletCode,
  748. manualRemark: nextRemark
  749. }).then(({ data }) => {
  750. if (data && data.code === 0) {
  751. this.savedManualRemark = nextRemark
  752. } else {
  753. this.$alert((data && data.msg) || '手工备注保存失败', '错误', { confirmButtonText: '确定' })
  754. }
  755. }).catch(() => {
  756. this.$alert('手工备注保存失败', '错误', { confirmButtonText: '确定' })
  757. }).finally(() => {
  758. this.manualRemarkSaving = false
  759. })
  760. },
  761. // 根据托盘类型能力与强制整托规则动态控制自动分拣可编辑性 - rqrq
  762. updateAutoSortControl() {
  763. if (this.forceFullPalletOut || this.currentPalletType === 'A0103') {
  764. this.currentAutoSort = 'N'
  765. this.autoSortDisabled = true
  766. return
  767. }
  768. if (this.currentWcsAutoSort === 'N') {
  769. this.currentAutoSort = 'N'
  770. this.autoSortDisabled = true
  771. return
  772. }
  773. this.autoSortDisabled = this.detailList.length > 0
  774. },
  775. // 更新托盘类型与自动分拣设置,保持海安后端状态一致 - rqrq
  776. // 保存海安托盘配置并返回是否成功;失败由页面提示,勾选确认调用方据此恢复原状态。- rqrq
  777. savePalletTypeConfig () {
  778. if (this.interfaceBusy) {
  779. return Promise.resolve(false)
  780. }
  781. this.palletConfigLoading = true
  782. return updatePalletTypeAndAutoSort({
  783. site: this.site,
  784. palletId: this.palletCode,
  785. palletType: this.currentPalletType,
  786. autoSort: this.currentAutoSort,
  787. forceFullPalletOut: this.forceFullPalletOut
  788. }).then(({ data }) => {
  789. if (data && data.code === 0) {
  790. this.palletInfo.palletType = this.currentPalletType
  791. this.palletInfo.autoSort = this.currentAutoSort
  792. this.$message.success('托盘配置已更新')
  793. return true
  794. } else {
  795. this.$alert((data && data.msg) || '托盘配置更新失败', '错误', { confirmButtonText: '确定' })
  796. return false
  797. }
  798. }).catch((error) => {
  799. this.$message.error(error.message || '托盘配置更新失败')
  800. return false
  801. }).finally(() => {
  802. this.palletConfigLoading = false
  803. })
  804. },
  805. // 沿用原页面入口命名,点击Call栈板时打开空托盘调用弹窗 - rqrq
  806. handleCallPallet() {
  807. if (this.interfaceBusy) {
  808. return
  809. }
  810. this.openCallEmptyModal()
  811. },
  812. // 打开扫码弹窗并初始化网格数据;A0206禁止主动扫进,扫出仍允许 - rqrq
  813. showScanModal() {
  814. // A0206不允许组盘入库主动扫入标签,被分拣场景不走本页 - rqrq
  815. if (this.operationType === 'in' && this.currentPalletType === 'A0206') {
  816. this.$alert('A0206类型栈板不允许主动扫入标签', '错误', { confirmButtonText: '确定' })
  817. return
  818. }
  819. this.scanModalVisible = true
  820. this.scanCode = ''
  821. // 每次打开扫码弹窗清除上次托盘的位置,防止尚未加载新位置时误扫到旧位置 - rqrq
  822. this.scanPosition = ''
  823. this.currentSelectedPosition = ''
  824. this.positionGrid = []
  825. this.availablePositions = []
  826. this.needRefreshOnClose = false
  827. if (this.operationType === 'in') {
  828. this.scanLayer = 1
  829. this.loadLayerOptions()
  830. } else {
  831. this.$nextTick(() => {
  832. if (this.$refs.scanInput) {
  833. this.$refs.scanInput.focus()
  834. }
  835. })
  836. }
  837. },
  838. showDetailModal() {
  839. this.detailModalVisible = true
  840. },
  841. showScanOutModal() {
  842. this.scanOutModalVisible = true
  843. },
  844. // 计算当前可选层数并刷新位置网格,保持“按层扫描”体验一致 - rqrq
  845. loadLayerOptions() {
  846. getPalletDetails({
  847. site: this.site,
  848. palletId: this.palletCode,
  849. position: '',
  850. layer: null
  851. }).then(({ data }) => {
  852. if (data && data.code === 0) {
  853. const details = data.details || []
  854. let maxExistingLayer = 0
  855. if (details.length > 0) {
  856. maxExistingLayer = Math.max(...details.map((d) => d.layer || 0))
  857. }
  858. if (this.currentMaxLayer === 0) {
  859. this.currentMixedMode = false
  860. this.scanLayerOptions = Array.from({ length: maxExistingLayer + 1 }, (_, i) => i + 1)
  861. } else {
  862. this.currentMixedMode = false
  863. this.scanLayerOptions = Array.from({ length: this.currentMaxLayer }, (_, i) => i + 1)
  864. }
  865. this.loadAvailablePositions()
  866. } else {
  867. this.$alert((data && data.msg) || '获取栈板信息失败', '错误', { confirmButtonText: '确定' })
  868. }
  869. }).catch(() => {
  870. this.$alert('获取栈板信息失败', '错误', { confirmButtonText: '确定' })
  871. })
  872. },
  873. // 按层加载位置网格与可扫位置,确保禁用态/加载态与原页面一致 - rqrq
  874. loadAvailablePositions() {
  875. // 刷新位置期间暂停扫码,返回后仅恢复仍可用的上次选择;失败时保持禁用,避免误写已占用位置 - rqrq
  876. const selectedPosition = this.currentSelectedPosition
  877. this.positionGridLoading = true
  878. this.availablePositions = []
  879. this.currentSelectedPosition = ''
  880. this.scanPosition = ''
  881. getPalletDetails({
  882. site: this.site,
  883. palletId: this.palletCode,
  884. position: '',
  885. layer: this.scanLayer
  886. }).then(({ data: detailData }) => {
  887. const positionCountMap = {}
  888. if (detailData && detailData.code === 0) {
  889. const details = detailData.details || []
  890. details.forEach((detail) => {
  891. const pos = detail.position
  892. positionCountMap[pos] = (positionCountMap[pos] || 0) + 1
  893. })
  894. }
  895. return getAvailablePositionsForLayer({
  896. site: this.site,
  897. palletId: this.palletCode,
  898. layer: this.scanLayer
  899. }).then(({ data }) => {
  900. if (data && data.code === 0) {
  901. const result = data.data || {}
  902. const positions = result.positions || []
  903. // 以当前栈板接口返回的层高为准,避免类型清单尚未加载时把单层托盘当成不限高 - rqrq
  904. if (result.maxLayer != null) {
  905. this.currentMaxLayer = Number(result.maxLayer)
  906. if (this.currentMaxLayer > 0) {
  907. this.scanLayerOptions = Array.from({ length: this.currentMaxLayer }, (_, i) => i + 1)
  908. }
  909. }
  910. this.availablePositions = result.availablePositions || []
  911. this.positionGrid = positions.map((position) => ({
  912. position,
  913. count: positionCountMap[position] || 0
  914. }))
  915. // 单位置托盘只在位置可用时默认选中;不可用或多位置时清理失效选择,避免扫码提交到错误位置 - rqrq
  916. if (positions.length === 1 && this.availablePositions.includes(positions[0])) {
  917. this.currentSelectedPosition = positions[0]
  918. this.scanPosition = positions[0]
  919. this.moveFocusToScanInput()
  920. } else if (this.availablePositions.includes(selectedPosition)) {
  921. this.currentSelectedPosition = selectedPosition
  922. this.scanPosition = selectedPosition
  923. this.moveFocusToScanInput()
  924. }
  925. } else {
  926. this.availablePositions = []
  927. this.positionGrid = []
  928. this.$alert((data && data.msg) || '获取位置信息失败', '错误', { confirmButtonText: '确定' })
  929. }
  930. })
  931. }).catch(() => {
  932. this.availablePositions = []
  933. this.positionGrid = []
  934. this.$alert('获取位置信息失败', '错误', { confirmButtonText: '确定' })
  935. }).finally(() => {
  936. this.positionGridLoading = false
  937. })
  938. },
  939. handleLayerClick(layer) {
  940. if (this.scanLayer === layer) {
  941. return
  942. }
  943. this.scanLayer = layer
  944. this.currentSelectedPosition = ''
  945. this.loadAvailablePositions()
  946. },
  947. handlePositionClick(position) {
  948. if (this.positionGridLoading) {
  949. this.$message.warning('位置信息加载中,请稍候')
  950. return
  951. }
  952. if (!this.availablePositions.includes(position)) {
  953. this.$message.warning('该位置不可用')
  954. return
  955. }
  956. this.currentSelectedPosition = position
  957. this.scanPosition = position
  958. this.$nextTick(() => {
  959. if (this.$refs.scanInput) {
  960. this.$refs.scanInput.focus()
  961. }
  962. })
  963. },
  964. moveFocusToScanInput() {
  965. this.$nextTick(() => {
  966. if (this.$refs.scanInput) {
  967. this.$refs.scanInput.focus()
  968. }
  969. })
  970. },
  971. closeScanModal() {
  972. this.scanModalVisible = false
  973. if (this.needRefreshOnClose) {
  974. this.refreshTable()
  975. this.needRefreshOnClose = false
  976. }
  977. },
  978. // 扫码提交:扫进用网格位置信息,扫出沿用原有删除逻辑 - rqrq
  979. handleLabelScan() {
  980. if (!this.ensureSite()) {
  981. return
  982. }
  983. if (this.interfaceBusy) {
  984. return
  985. }
  986. if (!this.scanCode || !this.scanCode.trim()) {
  987. this.scanCode = ''
  988. this.$alert('请输入标签编码', '错误', { confirmButtonText: '确定' })
  989. this.moveFocusToScanInput()
  990. return
  991. }
  992. if (this.operationType === 'in') {
  993. if (!this.scanPosition) {
  994. this.scanCode = ''
  995. this.$alert('请选择位置', '错误', { confirmButtonText: '确定' })
  996. this.moveFocusToScanInput()
  997. return
  998. }
  999. if (!this.scanLayer) {
  1000. this.scanCode = ''
  1001. this.$alert('请选择层数', '错误', { confirmButtonText: '确定' })
  1002. this.moveFocusToScanInput()
  1003. return
  1004. }
  1005. this.scanRequestLoading = true
  1006. // 提交前再拦一次A0206,避免改类型后仍走扫进接口 - rqrq
  1007. if (this.currentPalletType === 'A0206') {
  1008. this.scanRequestLoading = false
  1009. this.scanCode = ''
  1010. this.$alert('A0206类型栈板不允许主动扫入标签', '错误', { confirmButtonText: '确定' })
  1011. this.moveFocusToScanInput()
  1012. return
  1013. }
  1014. savePalletDetail({
  1015. site: this.site,
  1016. palletId: this.palletCode,
  1017. position: this.scanPosition,
  1018. layer: this.scanLayer,
  1019. serialNo: this.scanCode,
  1020. sortFlag: 0
  1021. }).then(({ data }) => {
  1022. if (data && data.code === 0) {
  1023. this.$message.success('扫进成功')
  1024. this.needRefreshOnClose = true
  1025. this.scanCode = ''
  1026. this.loadLayerOptions()
  1027. this.moveFocusToScanInput()
  1028. } else {
  1029. this.scanCode = ''
  1030. this.$alert((data && data.msg) || '扫进失败', '错误', { confirmButtonText: '确定' })
  1031. this.moveFocusToScanInput()
  1032. }
  1033. }).catch((error) => {
  1034. this.scanCode = ''
  1035. this.$alert(error.message || '扫进失败', '错误', { confirmButtonText: '确定' })
  1036. this.moveFocusToScanInput()
  1037. }).finally(() => {
  1038. this.scanRequestLoading = false
  1039. })
  1040. } else {
  1041. const scanOutItem = this.detailList.find((item) => item.serialNo === this.scanCode)
  1042. this.scanRequestLoading = true
  1043. deletePalletDetail({
  1044. site: this.site,
  1045. palletId: this.palletCode,
  1046. serialNo: this.scanCode,
  1047. sortFlag: 0
  1048. }).then(({ data }) => {
  1049. if (data && data.code === 0) {
  1050. if (scanOutItem) {
  1051. this.scanOutList.push({
  1052. position: scanOutItem.position,
  1053. layer: scanOutItem.layer,
  1054. serialNo: scanOutItem.serialNo,
  1055. wcsFlag: scanOutItem.wcsFlag
  1056. })
  1057. }
  1058. this.$message.success('扫出成功')
  1059. this.needRefreshOnClose = true
  1060. this.scanCode = ''
  1061. this.moveFocusToScanInput()
  1062. } else {
  1063. this.scanCode = ''
  1064. this.$alert((data && data.msg) || '扫出失败', '错误', { confirmButtonText: '确定' })
  1065. this.moveFocusToScanInput()
  1066. }
  1067. }).catch((error) => {
  1068. this.scanCode = ''
  1069. this.$alert(error.message || '扫出失败', '错误', { confirmButtonText: '确定' })
  1070. this.moveFocusToScanInput()
  1071. }).finally(() => {
  1072. this.scanRequestLoading = false
  1073. })
  1074. }
  1075. },
  1076. loadAreaOptions() {
  1077. getAreaOptionsForChange({ site: this.site }).then(({ data }) => {
  1078. if (data && data.code === 0) {
  1079. this.areaOptions = data.rows || []
  1080. } else {
  1081. this.areaOptions = []
  1082. }
  1083. }).catch(() => {
  1084. this.areaOptions = []
  1085. })
  1086. },
  1087. openCallEmptyModal() {
  1088. if (!this.ensureSite()) {
  1089. return
  1090. }
  1091. this.callEmptyForm = { areaId: '', stationCode: '', palletType: this.currentPalletType || '' }
  1092. this.stationOptions = []
  1093. this.loadAreaOptions()
  1094. // 调用空托盘弹窗固定加载全量类型,不能复用当前栈板“按大分类过滤”的下拉 - rqrq
  1095. this.loadAllPalletTypeListForCallEmpty()
  1096. this.callEmptyModalVisible = true
  1097. },
  1098. handleAreaChangeForCall() {
  1099. this.callEmptyForm.stationCode = ''
  1100. if (!this.callEmptyForm.areaId) {
  1101. this.stationOptions = []
  1102. return
  1103. }
  1104. getStationsByArea({
  1105. site: this.site,
  1106. areaId: this.callEmptyForm.areaId
  1107. }).then(({ data }) => {
  1108. if (data && data.code === 0) {
  1109. this.stationOptions = data.rows || []
  1110. } else {
  1111. this.stationOptions = []
  1112. }
  1113. }).catch(() => {
  1114. this.stationOptions = []
  1115. })
  1116. },
  1117. submitCallEmpty() {
  1118. if (this.interfaceBusy) {
  1119. return
  1120. }
  1121. if (!this.callEmptyForm.areaId || !this.callEmptyForm.stationCode || !this.callEmptyForm.palletType) {
  1122. this.$alert('请完整选择区域、站点和栈板类型', '提示', { confirmButtonText: '确定' })
  1123. return
  1124. }
  1125. this.callEmptyLoading = true
  1126. callEmptyPalletToStation({
  1127. site: this.site,
  1128. // 调用空托盘下发时,targetArea传业务区域ID,由后端映射haian_area.wcs_area_code - rqrq
  1129. areaId: this.callEmptyForm.areaId,
  1130. targetArea: this.callEmptyForm.areaId,
  1131. stationCode: this.callEmptyForm.stationCode,
  1132. palletType: this.callEmptyForm.palletType
  1133. }).then(({ data }) => {
  1134. if (data && data.code === 0) {
  1135. this.$message.success('调用空托盘成功')
  1136. this.callEmptyModalVisible = false
  1137. } else {
  1138. this.$alert((data && data.msg) || '调用空托盘失败', '错误', { confirmButtonText: '确定' })
  1139. }
  1140. }).catch((error) => {
  1141. this.$alert(error.message || '调用空托盘失败', '错误', { confirmButtonText: '确定' })
  1142. }).finally(() => {
  1143. this.callEmptyLoading = false
  1144. })
  1145. },
  1146. openTransportModal() {
  1147. if (!this.ensureSite()) {
  1148. return
  1149. }
  1150. if (this.interfaceBusy) {
  1151. return
  1152. }
  1153. if (!this.palletScanned) {
  1154. this.$alert('请先扫描栈板', '提示', { confirmButtonText: '确定' })
  1155. return
  1156. }
  1157. // 栈板未绑定当前库位时禁止手工触发运输入库,避免无站点上下文误发请求 - rqrq
  1158. if (!this.currentPalletStation || !this.currentPalletStation.trim()) {
  1159. this.$alert('当前栈板没有库位,不允许执行运输入库', '提示', { confirmButtonText: '确定' })
  1160. return
  1161. }
  1162. this.$confirm('是否对此栈板发起入库请求?', '提示', {
  1163. confirmButtonText: '确认',
  1164. cancelButtonText: '取消',
  1165. type: 'warning'
  1166. }).then(() => {
  1167. this.submitTransport()
  1168. }).catch(() => {
  1169. // 用户取消确认弹框时不执行任何操作,避免误触后仍发请求 - rqrq
  1170. })
  1171. },
  1172. submitTransport() {
  1173. if (this.interfaceBusy) {
  1174. return
  1175. }
  1176. this.transportLoading = true
  1177. // 海安运输入库不再选择目标区域/站点,只对当前栈板发起入库请求 - rqrq
  1178. callPalletToStationWithUpdateZuPan({
  1179. site: this.site,
  1180. palletId: this.palletCode,
  1181. // 组盘运输入库不选高度,固定传空,由后端按空值下发 - rqrq
  1182. height: '',
  1183. startStation: this.palletInfo.locationCode || ''
  1184. }).then(({ data }) => {
  1185. if (data && data.code === 0) {
  1186. this.$message.success('运输入库任务已提交')
  1187. // 与老组盘页一致:运输入库成功后清空整页,避免继续操作已提交入库的栈板 - rqrq
  1188. this.resetPage(true)
  1189. } else {
  1190. this.$alert((data && data.msg) || '运输入库失败', '错误', { confirmButtonText: '确定' })
  1191. }
  1192. }).catch((error) => {
  1193. this.$alert(error.message || '运输入库失败', '错误', { confirmButtonText: '确定' })
  1194. }).finally(() => {
  1195. this.transportLoading = false
  1196. })
  1197. }
  1198. },
  1199. // keep-alive页面每次重新激活都强制重置,避免“退出再进入”出现旧数据残留 - rqrq
  1200. activated() {
  1201. this.resetPage(true)
  1202. },
  1203. // 离开海安组盘页时统一清理状态,防止返回菜单后缓存脏数据 - rqrq
  1204. beforeRouteLeave(to, from, next) {
  1205. this.resetPage(false)
  1206. next()
  1207. },
  1208. mounted() {
  1209. this.resetPage(true)
  1210. }
  1211. }
  1212. </script>
  1213. <style scoped>
  1214. .force-full-pallet-out-active {
  1215. color: #8b1e1e;
  1216. font-weight: 700;
  1217. }
  1218. .header-action-disabled {
  1219. opacity: 0.5;
  1220. pointer-events: none;
  1221. }
  1222. .detail-table {
  1223. background: white;
  1224. border-radius: 6px;
  1225. overflow: hidden;
  1226. border: 1px solid #e0e0e0;
  1227. }
  1228. .table-header,
  1229. .table-row {
  1230. display: flex;
  1231. align-items: center;
  1232. padding: 8px;
  1233. border-bottom: 1px solid #e0e0e0;
  1234. }
  1235. .table-header {
  1236. background: #f5f5f5;
  1237. font-weight: bold;
  1238. font-size: 14px;
  1239. }
  1240. .col-position {
  1241. flex: 1;
  1242. text-align: center;
  1243. }
  1244. .col-layer {
  1245. flex: 1;
  1246. text-align: center;
  1247. }
  1248. .col-serial {
  1249. flex: 4;
  1250. text-align: center;
  1251. word-break: break-all;
  1252. }
  1253. .empty-row {
  1254. justify-content: center;
  1255. align-items: center;
  1256. padding: 20px;
  1257. border-bottom: none;
  1258. }
  1259. .empty-hint {
  1260. text-align: center;
  1261. color: #999;
  1262. width: 100%;
  1263. }
  1264. .scan-modal-content {
  1265. padding: 10px 0;
  1266. }
  1267. .modal-form {
  1268. margin-bottom: 16px;
  1269. }
  1270. .dialog-footer {
  1271. text-align: center;
  1272. }
  1273. .action-btn:disabled {
  1274. opacity: 0.6;
  1275. cursor: not-allowed;
  1276. background-color: #ccc !important;
  1277. border-color: #ccc !important;
  1278. }
  1279. .action-btn.warning {
  1280. background-color: #f59e0b;
  1281. border-color: #f59e0b;
  1282. color: #fff;
  1283. }
  1284. ::v-deep .el-dialog__wrapper {
  1285. z-index: 2000 !important;
  1286. }
  1287. ::v-deep .el-overlay {
  1288. z-index: 2000 !important;
  1289. }
  1290. ::v-deep .el-radio {
  1291. margin-right: 8px !important;
  1292. }
  1293. ::v-deep .el-radio__label {
  1294. font-size: 14px;
  1295. }
  1296. /* 层数网格样式,保持与原PDA页面一致 - rqrq */
  1297. .layer-grid {
  1298. display: flex;
  1299. flex-wrap: wrap;
  1300. gap: 8px;
  1301. margin-top: 8px;
  1302. }
  1303. .layer-item {
  1304. display: flex;
  1305. align-items: center;
  1306. justify-content: center;
  1307. min-width: 50px;
  1308. height: 45px;
  1309. padding: 0 12px;
  1310. background-color: #fff;
  1311. border: 2px solid #dcdfe6;
  1312. border-radius: 6px;
  1313. font-size: 15px;
  1314. font-weight: bold;
  1315. cursor: pointer;
  1316. transition: all 0.3s;
  1317. user-select: none;
  1318. }
  1319. .layer-item:hover {
  1320. border-color: #409eff;
  1321. background-color: #ecf5ff;
  1322. }
  1323. .layer-item.layer-selected {
  1324. border-color: #409eff;
  1325. background-color: #409eff;
  1326. color: #fff;
  1327. }
  1328. /* 位置网格样式,保持与原PDA页面一致 - rqrq */
  1329. .position-grid {
  1330. display: grid;
  1331. gap: 10px;
  1332. margin-top: 8px;
  1333. position: relative;
  1334. }
  1335. .position-grid.position-grid-1 {
  1336. grid-template-columns: 1fr;
  1337. grid-template-rows: 1fr;
  1338. }
  1339. .position-grid.position-grid-4 {
  1340. grid-template-columns: repeat(2, 1fr);
  1341. grid-template-rows: repeat(2, 1fr);
  1342. grid-auto-flow: column;
  1343. }
  1344. /* 钢托盘四宫格:3x3 里只留十字,上1 左2 右3 下4 - rqrq */
  1345. .position-grid.position-grid-steel-4 {
  1346. grid-template-columns: repeat(3, 1fr);
  1347. grid-template-rows: repeat(3, 1fr);
  1348. grid-auto-flow: row;
  1349. }
  1350. /* 平托盘两层都是4格,按行铺成 1 2 / 3 4 - rqrq */
  1351. .position-grid.position-grid-flat-4 {
  1352. grid-template-columns: repeat(2, 1fr);
  1353. grid-template-rows: repeat(2, 1fr);
  1354. grid-auto-flow: row;
  1355. }
  1356. .position-grid.position-grid-9 {
  1357. grid-template-columns: repeat(3, 1fr);
  1358. grid-template-rows: repeat(3, 1fr);
  1359. grid-auto-flow: row;
  1360. }
  1361. .position-item.position-placeholder {
  1362. background-color: #f0f0f0 !important;
  1363. border: 1px dashed #d0d0d0 !important;
  1364. color: transparent !important;
  1365. cursor: not-allowed !important;
  1366. pointer-events: none !important;
  1367. }
  1368. .position-grid.position-grid-loading {
  1369. opacity: 0.7;
  1370. pointer-events: none;
  1371. }
  1372. .position-item {
  1373. display: flex;
  1374. align-items: center;
  1375. justify-content: center;
  1376. height: 60px;
  1377. background-color: #fff;
  1378. border: 2px solid #dcdfe6;
  1379. border-radius: 6px;
  1380. font-size: 16px;
  1381. font-weight: bold;
  1382. cursor: pointer;
  1383. transition: all 0.3s;
  1384. user-select: none;
  1385. }
  1386. .position-item:hover:not(.position-disabled) {
  1387. border-color: #409eff;
  1388. background-color: #ecf5ff;
  1389. }
  1390. .position-item.position-selected {
  1391. border-color: #409eff;
  1392. background-color: #409eff;
  1393. color: #fff;
  1394. }
  1395. .position-item.position-disabled {
  1396. background-color: #f5f7fa;
  1397. color: #c0c4cc;
  1398. cursor: not-allowed;
  1399. opacity: 0.6;
  1400. }
  1401. .position-item.position-loading {
  1402. background: linear-gradient(90deg, #f5f7fa 25%, #e4e7ed 50%, #f5f7fa 75%);
  1403. background-size: 200% 100%;
  1404. animation: loading 1.5s ease-in-out infinite;
  1405. }
  1406. @keyframes loading {
  1407. 0% {
  1408. background-position: 200% 0;
  1409. }
  1410. 100% {
  1411. background-position: -200% 0;
  1412. }
  1413. }
  1414. </style>