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.

596 lines
19 KiB

6 months ago
6 months ago
6 months ago
3 days ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 查询表单 - rqrq -->
  4. <el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;">
  5. <el-form-item label="站点ID">
  6. <el-input v-model="queryData.searchStationId" style="width: 120px" placeholder="站点ID" clearable @keyup.enter.native="getDataList()"></el-input>
  7. </el-form-item>
  8. <el-form-item label="RCS站点编码">
  9. <el-input v-model="queryData.searchStationCode" style="width: 120px" placeholder="站点编码" clearable @keyup.enter.native="getDataList()"></el-input>
  10. </el-form-item>
  11. <el-form-item label="站点名称">
  12. <el-input v-model="queryData.searchStationName" style="width: 120px" placeholder="站点名称" clearable @keyup.enter.native="getDataList()"></el-input>
  13. </el-form-item>
  14. <el-form-item label=" ">
  15. <el-button type="primary" @click="getDataList()">查询</el-button>
  16. <el-button @click="resetQuery()">重置</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <!-- 数据表格 - rqrq -->
  20. <el-table
  21. :data="dataList"
  22. :height="height"
  23. border
  24. highlight-current-row
  25. v-loading="dataListLoading"
  26. style="width: 100%;">
  27. <el-table-column
  28. v-for="(item,index) in columnList" :key="index"
  29. :sortable="item.columnSortable"
  30. :prop="item.columnProp"
  31. :header-align="item.headerAlign"
  32. :show-overflow-tooltip="item.showOverflowTooltip"
  33. :align="item.align"
  34. :fixed="item.fixed==''?false:item.fixed"
  35. :min-width="item.columnWidth"
  36. :label="item.columnLabel">
  37. <template slot-scope="scope">
  38. <span v-if="item.columnProp === 'active'">
  39. <el-tag
  40. :type="scope.row.active === 'Y' ? 'success' : 'danger'"
  41. size="small">
  42. {{ scope.row.active === 'Y' ? '启用' : '禁用' }}
  43. </el-tag>
  44. </span>
  45. <span v-else-if="item.columnProp === 'autoCallBlankPallet'">
  46. {{ scope.row.autoCallBlankPallet === 'Y' ? '是' : '否' }}
  47. </span>
  48. <!-- 站点状态根据statusDb映射显示 - rqrq -->
  49. <span v-else-if="item.columnProp === 'statusDb'">
  50. <el-tag
  51. :type="getStatusType(scope.row.statusDb)"
  52. size="small">
  53. {{ getStatusText(scope.row.statusDb) }}
  54. </el-tag>
  55. </span>
  56. <span v-else>{{ scope.row[item.columnProp] }}</span>
  57. </template>
  58. </el-table-column>
  59. <!-- 操作列 - rqrq -->
  60. <el-table-column
  61. header-align="center"
  62. align="center"
  63. fixed="right"
  64. width="220"
  65. label="操作">
  66. <template slot-scope="scope">
  67. <a type="text" @click="correctStatus(scope.row)" v-if="!scope.row.correctLoading&&scope.row.stationCode!=='D1'&&scope.row.stationCode!=='D2'">纠正状态</a>
  68. <span v-if="scope.row.correctLoading" style="color: #999;">处理中...</span>
  69. <a type="text" @click="viewPallets(scope.row)" style="margin-left: 10px;" v-if="scope.row.stationCode!=='D1'&&scope.row.stationCode!=='D2'">查看栈板</a>
  70. <a type="text" @click="openAutoCallSetting(scope.row)" style="margin-left: 10px;" v-if="scope.row.stationCode!=='D1'&&scope.row.stationCode!=='D2'
  71. &&scope.row.stationCode!=='R1'&&scope.row.stationCode!=='R2'&&scope.row.stationCode!=='R3'&&scope.row.stationCode!=='R4'
  72. &&scope.row.stationCode!=='J1'&&scope.row.stationCode!=='J2'&&scope.row.stationCode!=='J3'&&scope.row.stationCode!=='J4'">续盘设置</a>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <!-- 分页 - rqrq -->
  77. <el-pagination
  78. @size-change="sizeChangeHandle"
  79. @current-change="currentChangeHandle"
  80. :current-page="pageIndex"
  81. :page-sizes="[20, 50, 100, 1000]"
  82. :page-size="pageSize"
  83. :total="totalPage"
  84. layout="total, sizes, prev, pager, next, jumper">
  85. </el-pagination>
  86. <!-- 查看栈板弹窗 - rqrq -->
  87. <el-dialog
  88. :title="'站点【' + currentStation.stationCode + '】栈板列表'"
  89. :visible.sync="palletDialogVisible"
  90. :close-on-click-modal="false"
  91. v-drag
  92. width="700px">
  93. <el-table
  94. :data="palletList"
  95. height="300"
  96. border
  97. v-loading="palletLoading"
  98. style="width: 100%;">
  99. <el-table-column
  100. prop="palletId"
  101. header-align="center"
  102. align="center"
  103. label="栈板编码"
  104. min-width="150">
  105. </el-table-column>
  106. <el-table-column
  107. prop="callingFlag"
  108. header-align="center"
  109. align="center"
  110. label="是否调用"
  111. width="100">
  112. <template slot-scope="scope">
  113. <el-tag
  114. :type="scope.row.callingFlag === 'Y' ? 'warning' : 'info'"
  115. size="small">
  116. {{ scope.row.callingFlag === 'Y' ? '调用中' : '未调用' }}
  117. </el-tag>
  118. </template>
  119. </el-table-column>
  120. <el-table-column
  121. prop="palletType"
  122. header-align="center"
  123. align="center"
  124. label="托盘类型"
  125. width="100">
  126. </el-table-column>
  127. <el-table-column
  128. header-align="center"
  129. align="center"
  130. label="操作"
  131. width="100">
  132. <template slot-scope="scope">
  133. <a type="text" style="color: #F56C6C;" @click="removePallet(scope.row)" v-if="!scope.row.removeLoading">手工移出</a>
  134. <span v-if="scope.row.removeLoading" style="color: #999;">移出中...</span>
  135. </template>
  136. </el-table-column>
  137. </el-table>
  138. <div slot="footer" class="dialog-footer">
  139. <el-button @click="palletDialogVisible = false">关闭</el-button>
  140. </div>
  141. </el-dialog>
  142. <!-- 续盘设置弹窗 - rqrq -->
  143. <el-dialog
  144. :title="'站点【' + currentStation.stationCode + '】续盘设置'"
  145. :visible.sync="autoCallDialogVisible"
  146. :close-on-click-modal="false"
  147. v-drag
  148. width="400px">
  149. <el-form :model="autoCallForm" label-position="top" style="margin-top: 1px; margin-left: 0px;">
  150. <el-row :gutter="20">
  151. <el-col :span="24">
  152. <el-form-item label="是否续盘">
  153. <el-select v-model="autoCallForm.autoCallBlankPallet" placeholder="请选择" style="width: 100%">
  154. <el-option label="是" value="Y"></el-option>
  155. <el-option label="否" value="N"></el-option>
  156. </el-select>
  157. </el-form-item>
  158. </el-col>
  159. </el-row>
  160. <el-row :gutter="20">
  161. <el-col :span="24">
  162. <el-form-item label="续什么盘">
  163. <el-select v-model="autoCallForm.autoCallBlankPalletType" placeholder="请选择托盘类型" style="width: 100%" clearable>
  164. <el-option
  165. v-for="item in palletTypeOptions"
  166. :key="item.palletType"
  167. :label="item.typeDesc"
  168. :value="item.palletType">
  169. </el-option>
  170. </el-select>
  171. </el-form-item>
  172. </el-col>
  173. </el-row>
  174. </el-form>
  175. <div slot="footer" class="dialog-footer">
  176. <el-button type="primary" @click="saveAutoCallSetting" :disabled="saveAutoCallLoading">
  177. {{ saveAutoCallLoading ? '保存中...' : '确定' }}
  178. </el-button>
  179. <el-button @click="autoCallDialogVisible = false" :disabled="saveAutoCallLoading">取消</el-button>
  180. </div>
  181. </el-dialog>
  182. </div>
  183. </template>
  184. <script>
  185. import {
  186. getAgvStationList,
  187. correctAgvStationStatus,
  188. getPalletsByStation,
  189. removePalletFromStation,
  190. getPalletTypeOptions,
  191. updateAutoCallSetting
  192. } from '@/api/wcsSystem/agvStationSpecialAction.js'
  193. export default {
  194. data() {
  195. return {
  196. // 查询条件 - rqrq
  197. queryData: {
  198. searchStationCode: '',
  199. searchStationName: '',
  200. searchStationId: '',
  201. stationType: '正式站点',
  202. active: 'Y',
  203. page: 1,
  204. limit: 20
  205. },
  206. // 表格高度 - rqrq
  207. height: 450,
  208. // 表格列配置 - rqrq
  209. columnList: [
  210. {
  211. columnProp: "stationCode",
  212. headerAlign: "center",
  213. align: "center",
  214. columnLabel: "站点编码",
  215. columnWidth: 120,
  216. columnSortable: false,
  217. showOverflowTooltip: true,
  218. fixed: ""
  219. },
  220. {
  221. columnProp: "stationName",
  222. headerAlign: "center",
  223. align: "center",
  224. columnLabel: "站点名称",
  225. columnWidth: 120,
  226. columnSortable: false,
  227. showOverflowTooltip: true,
  228. fixed: ""
  229. },
  230. {
  231. columnProp: "areaType",
  232. headerAlign: "center",
  233. align: "center",
  234. columnLabel: "区域类型",
  235. columnWidth: 100,
  236. columnSortable: false,
  237. showOverflowTooltip: true,
  238. fixed: ""
  239. },
  240. {
  241. columnProp: "stationArea",
  242. headerAlign: "center",
  243. align: "center",
  244. columnLabel: "站点区域",
  245. columnWidth: 120,
  246. columnSortable: false,
  247. showOverflowTooltip: true,
  248. fixed: ""
  249. },
  250. {
  251. columnProp: "statusDb",
  252. headerAlign: "center",
  253. align: "center",
  254. columnLabel: "站点状态",
  255. columnWidth: 100,
  256. columnSortable: false,
  257. showOverflowTooltip: true,
  258. fixed: ""
  259. },
  260. {
  261. columnProp: "autoCallBlankPallet",
  262. headerAlign: "center",
  263. align: "center",
  264. columnLabel: "自动续盘",
  265. columnWidth: 80,
  266. columnSortable: false,
  267. showOverflowTooltip: true,
  268. fixed: ""
  269. },
  270. {
  271. columnProp: "autoCallBlankPalletTypeDesc",
  272. headerAlign: "center",
  273. align: "center",
  274. columnLabel: "续盘类型",
  275. columnWidth: 100,
  276. columnSortable: false,
  277. showOverflowTooltip: true,
  278. fixed: ""
  279. },
  280. {
  281. columnProp: "stationType",
  282. headerAlign: "center",
  283. align: "center",
  284. columnLabel: "站点类型",
  285. columnWidth: 100,
  286. columnSortable: false,
  287. showOverflowTooltip: true,
  288. fixed: ""
  289. },
  290. {
  291. columnProp: "warehouseCode",
  292. headerAlign: "center",
  293. align: "center",
  294. columnLabel: "仓库编码",
  295. columnWidth: 100,
  296. columnSortable: false,
  297. showOverflowTooltip: true,
  298. fixed: ""
  299. },
  300. {
  301. columnProp: "locationCode",
  302. headerAlign: "center",
  303. align: "center",
  304. columnLabel: "库位编码",
  305. columnWidth: 120,
  306. columnSortable: false,
  307. showOverflowTooltip: true,
  308. fixed: ""
  309. },
  310. {
  311. columnProp: "remark",
  312. headerAlign: "center",
  313. align: "left",
  314. columnLabel: "备注",
  315. columnWidth: 200,
  316. columnSortable: false,
  317. showOverflowTooltip: true,
  318. fixed: ""
  319. }
  320. ],
  321. // 数据列表 - rqrq
  322. dataList: [],
  323. // 分页参数 - rqrq
  324. pageIndex: 1,
  325. pageSize: 20,
  326. totalPage: 0,
  327. dataListLoading: false,
  328. // 栈板弹窗相关 - rqrq
  329. palletDialogVisible: false,
  330. palletLoading: false,
  331. palletList: [],
  332. currentStation: {},
  333. // 续盘设置弹窗相关 - rqrq
  334. autoCallDialogVisible: false,
  335. saveAutoCallLoading: false,
  336. autoCallForm: {
  337. autoCallBlankPallet: '',
  338. autoCallBlankPalletType: ''
  339. },
  340. palletTypeOptions: []
  341. }
  342. },
  343. mounted() {
  344. this.$nextTick(() => {
  345. // 计算表格高度 - rqrq
  346. this.height = window.innerHeight - 220;
  347. })
  348. },
  349. activated() {
  350. this.getDataList()
  351. },
  352. methods: {
  353. // 获取数据列表 - rqrq
  354. getDataList() {
  355. this.dataListLoading = true
  356. this.queryData.page = this.pageIndex
  357. this.queryData.limit = this.pageSize
  358. getAgvStationList(this.queryData).then(({data}) => {
  359. this.dataListLoading = false
  360. if (data && data.code === 0) {
  361. // 给每条数据添加loading状态 - rqrq
  362. let list = data.page.list || []
  363. list.forEach(item => {
  364. item.correctLoading = false
  365. })
  366. this.dataList = list
  367. this.totalPage = data.page.totalCount || 0
  368. } else {
  369. this.dataList = []
  370. this.totalPage = 0
  371. this.$alert(data.msg || '查询失败', '错误', { confirmButtonText: '确定' })
  372. }
  373. }).catch(error => {
  374. this.dataListLoading = false
  375. console.error('查询AGV站点列表失败:', error)
  376. this.$alert('查询失败', '错误', { confirmButtonText: '确定' })
  377. })
  378. },
  379. // 重置查询条件 - rqrq
  380. resetQuery() {
  381. this.queryData = {
  382. searchStationCode: '',
  383. searchStationName: '',
  384. searchStationId: '',
  385. stationType: '正式站点',
  386. active: 'Y',
  387. page: 1,
  388. limit: 20
  389. }
  390. this.pageIndex = 1
  391. this.getDataList()
  392. },
  393. // 每页数量变化 - rqrq
  394. sizeChangeHandle(val) {
  395. this.pageSize = val
  396. this.pageIndex = 1
  397. this.getDataList()
  398. },
  399. // 当前页变化 - rqrq
  400. currentChangeHandle(val) {
  401. this.pageIndex = val
  402. this.getDataList()
  403. },
  404. // 纠正站点状态 - rqrq
  405. correctStatus(row) {
  406. this.$confirm('确定要纠正站点【' + row.stationCode + '】的状态吗?系统将根据栈板实际情况更新站点状态。', '提示', {
  407. confirmButtonText: '确定',
  408. cancelButtonText: '取消',
  409. type: 'warning'
  410. }).then(() => {
  411. row.correctLoading = true
  412. correctAgvStationStatus({
  413. stationId: row.stationId,
  414. stationCode: row.stationCode
  415. }).then(({data}) => {
  416. if (data && data.code === 0) {
  417. this.$message.success(data.msg || '纠正成功')
  418. this.getDataList()
  419. } else {
  420. this.$alert(data.msg || '纠正失败', '错误')
  421. }
  422. }).catch(error => {
  423. console.error('纠正站点状态失败:', error)
  424. this.$alert('纠正失败', '错误', { confirmButtonText: '确定' })
  425. }).finally(() => {
  426. row.correctLoading = false
  427. })
  428. }).catch(() => {
  429. // 取消操作
  430. })
  431. },
  432. // 查看栈板 - rqrq
  433. viewPallets(row) {
  434. this.currentStation = row
  435. this.palletDialogVisible = true
  436. this.loadPalletList()
  437. },
  438. // 加载栈板列表 - rqrq
  439. loadPalletList() {
  440. this.palletLoading = true
  441. this.palletList = []
  442. getPalletsByStation({
  443. stationCode: this.currentStation.stationCode
  444. }).then(({data}) => {
  445. if (data && data.code === 0) {
  446. // 给每条数据添加loading状态 - rqrq
  447. let list = data.rows || []
  448. list.forEach(item => {
  449. item.removeLoading = false
  450. })
  451. this.palletList = list
  452. } else {
  453. this.palletList = []
  454. this.$alert(data.msg || '查询栈板失败', '错误', { confirmButtonText: '确定' })
  455. }
  456. }).catch(error => {
  457. console.error('查询站点栈板失败:', error)
  458. this.$alert('查询栈板失败', '错误', { confirmButtonText: '确定' })
  459. }).finally(() => {
  460. this.palletLoading = false
  461. })
  462. },
  463. // 手工移出栈板 - rqrq
  464. removePallet(row) {
  465. this.$confirm('确定要将栈板【' + row.palletId + '】从站点移出吗?移出后该栈板将不再关联任何站点。', '提示', {
  466. confirmButtonText: '确定',
  467. cancelButtonText: '取消',
  468. type: 'warning'
  469. }).then(() => {
  470. row.removeLoading = true
  471. removePalletFromStation({
  472. palletId: row.palletId,
  473. stationCode: this.currentStation.stationCode
  474. }).then(({data}) => {
  475. if (data && data.code === 0) {
  476. this.$message.success(data.msg || '移出成功')
  477. // 刷新栈板列表 - rqrq
  478. this.loadPalletList()
  479. // 刷新站点列表 - rqrq
  480. this.getDataList()
  481. } else {
  482. this.$alert(data.msg || '移出失败', '错误')
  483. }
  484. }).catch(error => {
  485. console.error('移出栈板失败:', error)
  486. this.$alert('移出失败', '错误', { confirmButtonText: '确定' })
  487. }).finally(() => {
  488. row.removeLoading = false
  489. })
  490. }).catch(() => {
  491. // 取消操作
  492. })
  493. },
  494. // 打开续盘设置弹窗 - rqrq
  495. openAutoCallSetting(row) {
  496. this.currentStation = row
  497. this.autoCallForm = {
  498. autoCallBlankPallet: row.autoCallBlankPallet || 'N',
  499. autoCallBlankPalletType: row.autoCallBlankPalletType || ''
  500. }
  501. this.autoCallDialogVisible = true
  502. this.loadPalletTypeOptions()
  503. },
  504. // 加载托盘类型选项 - rqrq
  505. loadPalletTypeOptions() {
  506. getPalletTypeOptions({}).then(({data}) => {
  507. if (data && data.code === 0) {
  508. this.palletTypeOptions = data.rows || []
  509. } else {
  510. this.palletTypeOptions = []
  511. }
  512. }).catch(error => {
  513. console.error('获取托盘类型选项失败:', error)
  514. this.palletTypeOptions = []
  515. })
  516. },
  517. // 获取站点状态文本 - rqrq
  518. getStatusText(statusDb) {
  519. const statusMap = {
  520. 0: '空闲',
  521. 1: '有货',
  522. 2: '待放货',
  523. 3: '待取货'
  524. }
  525. return statusMap[statusDb] !== undefined ? statusMap[statusDb] : '未知'
  526. },
  527. // 获取站点状态标签类型 - rqrq
  528. getStatusType(statusDb) {
  529. const typeMap = {
  530. 0: 'success', // 空闲 - 绿色
  531. 1: 'warning', // 有货 - 橙色
  532. 2: 'primary', // 待放货 - 蓝色
  533. 3: 'danger' // 待取货 - 红色
  534. }
  535. return typeMap[statusDb] !== undefined ? typeMap[statusDb] : 'info'
  536. },
  537. // 保存续盘设置 - rqrq
  538. saveAutoCallSetting() {
  539. this.saveAutoCallLoading = true
  540. updateAutoCallSetting({
  541. stationCode: this.currentStation.stationCode,
  542. autoCallBlankPallet: this.autoCallForm.autoCallBlankPallet,
  543. autoCallBlankPalletType: this.autoCallForm.autoCallBlankPalletType
  544. }).then(({data}) => {
  545. if (data && data.code === 0) {
  546. this.$message.success('保存成功')
  547. this.autoCallDialogVisible = false
  548. this.getDataList()
  549. } else {
  550. this.$alert(data.msg || '保存失败', '错误')
  551. }
  552. }).catch(error => {
  553. console.error('保存续盘设置失败:', error)
  554. this.$alert('保存失败', '错误', { confirmButtonText: '确定' })
  555. }).finally(() => {
  556. this.saveAutoCallLoading = false
  557. })
  558. }
  559. }
  560. }
  561. </script>
  562. <style scoped>
  563. /* 表格样式优化 - rqrq */
  564. .mod-config {
  565. padding: 10px;
  566. }
  567. </style>