#
whycq
2024-04-10 e3b84d48cef3e024e4a17b4df35f47cf3e63e820
pages/phyz/stationManage/stationDetl.vue
@@ -1,7 +1,7 @@
<template>
   <view>
      <!-- 站点详情 -->
      <view class="station" :class="station.style" >
      <view class="station" :class="station.style" v-if="station">
         <view class="mt-flex">
            <view class="station-title" style="flex: 1;">{{station.devNo}}</view>
            <view><button size="mini" :loading="reload.loading" @click="reloadStation()">{{reload.loadingText}}</button></view>
@@ -11,19 +11,138 @@
         <view>站点状态:{{station.locSts$}}</view>
         <view class="mt-flex">
            <view class="station-barcode" style="flex: 1">货架码:<text>{{station.barcode ? station.barcode : '--'}}</text></view>
            <view v-if="station.barcode"><button size="mini" type="warn">解除绑定</button></view>
            <view v-if="station.barcode && station.locSts == 'F'"><button size="mini" type="warn" @click="unbind()">解除绑定</button></view>
         </view>
      </view>
      
      
      <!-- 工作档 -->
      <view class="wrkMast" v-if="wrkMast">
         <view class="wrkMast-wrkNo">
            <view style="flex:3">工作号: {{wrkMast.wrkNo}}</view>
            <view style="flex:2;text-align: right;">{{wrkMast.ioTitle}}</view>
         </view>
         <view>工作类型: {{wrkMast.ioType$}}</view>
         <view>源库位: {{wrkMast.sourceLocNo}}</view>
      </view>
      <!-- 明细 -->
      <view class="wrkDetls" v-if="wrkDetls.length > 0">
         <view style="font-weight: bold;">工作明细</view>
         <view class="wrkDetl" v-for="wrkDetl in wrkDetls">
            <view>商品名称:{{wrkDetl.maktx}}</view>
            <view>商品编码:{{wrkDetl.matnr}}</view>
            <view>销售订单号:{{wrkDetl.threeCode ? wrkDetl.threeCode : ' --'}}</view>
            <view>自由项:{{wrkDetl.deadTime ? wrkDetl.deadTime : ' --'}}</view>
            <view>数量:{{wrkDetl.anfme}}</view>
         </view>
      </view>
      <!-- 组托明细 -->
      <view class="waitPakins" v-if="waitPakins.length > 0">
         <view style="font-weight: bold;">组托明细</view>
         <view class="waitPakin" v-for="waitPakin in waitPakins">
            <view>商品名称:{{waitPakin.maktx}}</view>
            <view>商品编码:{{waitPakin.matnr}}</view>
            <view>订单编号:{{waitPakin.orderNo}}</view>
            <view>销售订单号:{{waitPakin.threeCode ? waitPakin.threeCode : ' --'}}</view>
            <view>自由项:{{waitPakin.deadTime ? waitPakin.deadTime : ' --'}}</view>
            <view>状态:{{waitPakin.ioStatus$}}</view>
            <view>入库数量:{{waitPakin.anfme}}</view>
         </view>
      </view>
      <view style="height: 140rpx;"></view>
      <!-- 弹窗 -->
      <view>
         <uni-popup ref="emptyPakin" type="dialog">
            <view class="popup">
               <!-- 标题 -->
               <view class="title">请输入空货架码</view>
               <view class="popup-item">
                  <view class="popup-item-left">货架码:</view>
                  <view class="popup-item-right"><input type="text" v-model="barcode"></view>
               </view>
               <view class="btn">
                  <view class="btn-left" @click="emptyPakinClose">取消</view>
                  <view class="btn-right" @click="emptyPakinConfirm()">入库</view>
               </view>
            </view>
         </uni-popup>
      </view>
      <!-- 弹窗 -->
      <view>
         <uni-popup ref="doContainerMoveOut" type="dialog">
            <view class="popup">
               <!-- 标题 -->
               <view class="title">请输入空货架码</view>
               <view class="popup-item">
                  <view class="popup-item-left">货架码:</view>
                  <view class="popup-item-right"><input type="text" v-model="barcode"></view>
               </view>
               <view class="btn">
                  <view class="btn-left" @click="containerMoveOutClose">取消</view>
                  <view class="btn-right" @click="containerMoveOut()">入库</view>
               </view>
            </view>
         </uni-popup>
      </view>
      <!-- 弹窗 -->
      <view>
         <uni-popup ref="doPickIn" type="dialog">
            <view class="popup">
               <!-- 标题 -->
               <view class="title">请输入空货架码</view>
               <view class="popup-item">
                  <view class="popup-item-left">货架码:</view>
                  <view class="popup-item-right"><input type="text" v-model="barcode"></view>
               </view>
               <view class="btn">
                  <view class="btn-left" @click="pickInClose">取消</view>
                  <view class="btn-right" @click="pickIn()">入库</view>
               </view>
            </view>
         </uni-popup>
      </view>
      <!-- 弹窗 -->
      <view>
         <uni-popup ref="emptyOut" type="dialog">
            <view class="popup">
               <!-- 标题 -->
               <view class="title">请选择货架类型</view>
               <view class="popup-item">
                  <view class="dropdown" @click="toggleDropdown()">
                     <input type="text" style="width: 650rpx;" v-model="containerType"  placeholder="请选择货架类型">
                     <uni-icons :type="isOpen ? 'top' : 'bottom'" color="#c1c1c1" style="margin-left: 10rpx;"></uni-icons>
                     <scroll-view scroll-y="ture" class="dropdown-content" v-if="isOpen">
                        <view class="dropdown-item" v-for="option in selects" @click="selected(option)">{{option}}</view>
                     </scroll-view>
                  </view>
               </view>
               <view class="btn">
                  <view class="btn-left" @click="emptyOutClose">取消</view>
                  <view class="btn-right" @click="emptyOutConfirm()">出库</view>
               </view>
            </view>
         </uni-popup>
      </view>
      
      
      
      
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" type="primary" @click="containerMoveOut(searchValue)">确认出库</button>
         <button size="mini" type="primary" @click="pickIn(searchValue)">已拣料回库</button>
         <button size="mini" type="primary" @click="emptyPakin()" v-if="btnType == 'emptyPakin'">空板入库</button>
         <button size="mini" type="primary" @click="emptyOut()" v-if="btnType == 'emptyPakin'">呼叫空板</button>
         <button size="mini" type="primary" @click="doContainerMoveOut()" v-if="btnType == 'out' && station.locSts == 'F'">确认出库</button>
         <button size="mini" type="primary" @click="doPickIn()" v-if="btnType == 'pick' && station.locSts == 'F'">已拣料回库</button>
         <button size="mini" type="primary" @click="startPakin()" v-if="btnType == 'start' && station.locSts == 'F'">启动入库</button>
      </view>
   </view>
</template>
@@ -36,10 +155,19 @@
            reload: {
               loading: false,
               loadingText: '更新状态'
            }
            },
            btnType: 'emptyPakin',
            barcode: '',
            containerType: '',
            selects: [],
            option: '',
            isOpen: false,
            wrkMast:  '',
            wrkDetls: [],
            waitPakins: []
         }
      },
      onLoad() {
      onShow() {
         let _this = this
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
@@ -47,11 +175,12 @@
         const eventChannel = this.getOpenerEventChannel();
         // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
         eventChannel.on('item', function(data) {
            console.log(data);
            _this.station = data.item
            _this.reloadStation()
         })
      },
      methods: {
         // 更新站点
         reloadStation()  {
            let _this = this
            _this.reload.loading = true
@@ -59,15 +188,19 @@
            uni.request({
               url: `${_this.baseUrl}/agv/basDevp/list/auth`,
               header: {'token': uni.getStorageSync('token')},
               data: {
                  curr: 1,
                  limit: 1000,
                  dev_no: _this.station.devNo
               },
               data: { curr: 1, limit: 1000,  dev_no: _this.station.devNo },
               method: 'GET',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     if (res.data.records[0].locSts == 'O') {
                        _this.btnType = 'emptyPakin'
                     } else if (res.data.records[0].locSts == 'F') {
                        _this.btnType = 'pakin'
                     } else {
                        _this.btnType = 'working'
                     }
                     setTimeout(()=>{
                        for  (let k of res.data.records) {
                           if (k.locSts != 'O') {
@@ -79,34 +212,353 @@
                        _this.station = res.data.records[0]
                        _this.reload.loading = false
                        _this.reload.loadingText = '更新状态'
                        _this.getContainerType()
                     },500)
                     _this.getWrkMast(res.data.records[0].barcode)
                     uni.showToast({ title: '更新成功!', icon: "none", position: 'top' })
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         }
         },
         // 站点解绑
         unbind() {
            let  _this = this
            let data = {param: JSON.stringify(_this.station)}
            uni.request({
               url: `${_this.baseUrl}/agv/basDevp/unbind/auth`,
               header: {
                  'token': uni.getStorageSync('token'),
                  'content-type': 'application/x-www-form-urlencoded'
               },
               data: data,
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     _this.reloadStation()
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         },
         // 空板入库确认
         emptyPakin() {
            this.$refs.emptyPakin.open()
         },
         emptyPakinClose() {
            this.$refs.emptyPakin.close()
         },
         emptyPakinConfirm() {
            let _this = this;
            if (this.barcode.length != 6) {
               uni.showToast({ title: '货架条码异常', icon: "error", position: 'top' })
               return
            }
            let params = []
            let param = { devNo: this.station.devNo, containerCode: this.barcode, }
            params.push(param)
            this.emptyPakinClose()
            uni.request({
               url: `${_this.baseUrl}/agvMobile/pakin/empty/auth`,
               data: { pad: params },
               method: 'POST',
               header: { 'token': uni.getStorageSync('token') },
               success(res) {
                  var res = res.data
                  if (res.code === 200) {
                     setTimeout(()=> {
                        _this.barcode = ''
                        _this.reloadStation()
                     },1000)
                     uni.showToast({ title: '启动入库', icon: "success", position: 'top' })
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            });
         },
         emptyOut() {
            this.$refs.emptyOut.open()
         },
         emptyOutClose() {
            this.$refs.emptyOut.close()
         },
         emptyOutConfirm() {
            this.emptyOutClose()
            let _this = this;
            let params = []
            let param = { devNo: this.station.devNo, containerType: this.containerType, }
            params.push(param)
            uni.request({
               url: `${_this.baseUrl}/agvMobile/pakout/empty/auth`,
               data: { pad: params },
               method: 'POST',
               header: { 'token': uni.getStorageSync('token') },
               success(res) {
                  var res = result.data
                  if (res.code === 200) {
                     setTimeout(()=> {
                        _this.containerType = ''
                        _this.reloadStation()
                     },1000)
                     uni.showToast({ title: '呼叫成功', icon: "success", position: 'top' })
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            });
         },
         getContainerType() {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/agvMobile/pakout/empty/container/selector/auth`,
               header: {'token': uni.getStorageSync('token')},
               data: JSON.stringify({devNo: _this.station.devNo}),
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     _this.selects = res.data
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         },
         // 开启 / 关闭下拉框
         toggleDropdown() {
            this.isOpen = !this.isOpen
         },
         // 选择货架类型
         selected(option) {
            this.containerType = option
         },
         // 查询工作档
         getWrkMast(barcode) {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/agv/wrkMast/list/auth`,
               header: {'token': uni.getStorageSync('token')},
               data: {
                  curr: 1,
                  limit: 1000,
                  condition:  _this.station.devNo
               },
               method: 'GET',
               success(res) {
                  res = res.data
                  if (res.code === 200 && res.data.records.length > 0) {
                     let mast = null
                     for (let wrkMast of res.data.records) {
                        if (wrkMast.ioType == 1) {
                           wrkMast['ioTitle'] = '入库'
                        } else if (wrkMast.ioType == 10) {
                           wrkMast['ioTitle'] = '空板入库'
                        } else if (wrkMast.ioType == 53) {
                           wrkMast['ioTitle'] = '拣料回库'
                        } else if (wrkMast.ioType == 101) {
                           wrkMast['ioTitle'] = '全板出库'
                           _this.btnType = 'out'
                        } else if (wrkMast.ioType == 103) {
                           wrkMast['ioTitle'] = '拣料出库'
                           _this.btnType = 'pick'
                        } else if (wrkMast.ioType == 110) {
                           wrkMast['ioTitle'] = '空板出库'
                        }
                        if (wrkMast.barcode == barcode) {
                           mast = wrkMast
                        }
                     }
                     _this.wrkMast = mast
                     _this.getWrkDetl(mast.wrkNo)
                  } else if (res.code === 200 && res.data.records.length == 0) {
                     _this.wrkMast = null
                     _this.wrkDetls = []
                     if (_this.station.barcode != '') {
                        _this.getWaitPakin(_this.station.barcode)
                     }
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         },
         // 获取工作明细
         getWrkDetl(wrkNo) {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/agv/wrkDetl/list/auth`,
               header: {'token': uni.getStorageSync('token')},
               data: {
                  curr: 1,
                  limit: 1000,
                  wrk_no: wrkNo
               },
               method: 'GET',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     _this.wrkDetls = res.data.records
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         },
         // 获取组托档
         getWaitPakin(barcode) {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/agv/waitPakin/list/auth`,
               header: {'token': uni.getStorageSync('token')},
               data: {
                  curr: 1,
                  limit: 1000,
                  supp_code: barcode
               },
               method: 'GET',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     _this.waitPakins = res.data.records
                     _this.btnType = 'start'
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         },
         // 全板出库 确认出库
         doContainerMoveOut() {
            this.$refs.doContainerMoveOut.open()
         },
         containerMoveOutClose() {
            this.$refs.doContainerMoveOut.close()
         },
         containerMoveOut() {
            let _this = this
            let devNo = {devNo:[this.station.devNo],barcode: _this.barcode}
            uni.request({
               url: `${_this.baseUrl}/agv/basDevp/visualized/container/moveOut`,
               data: JSON.stringify(devNo),
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     _this.$refs.doContainerMoveOut.close()
                     setTimeout(()=> {
                        _this.barcode = ''
                        _this.reloadStation()
                     },1000)
                     uni.showToast({ title: '确认完成', icon: "success", position: 'top' })
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         },
         // 拣料出库 确认后回库
         doPickIn() {
            this.$refs.doPickIn.open()
         },
         pickInClose() {
            this.$refs.doPickIn.close()
         },
         pickIn() {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/agv/basDevp/visualized/container/pickIn`,
               data: {devNo: _this.station.devNo,barcode: _this.barcode},
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     _this.$refs.doPickIn.close()
                     _this.barcode = ''
                     _this.reloadStation()
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            })
         },
         // 启动入库
         startPakin(type) {
            let that = this
            let params = []
            let param = { devNo: this.station.devNo, containerCode: this.station.barcode, }
            params.push(param)
            uni.request({
               url: that.baseUrl + '/agvMobile/pakin/empty/auth',
               data: {pad: params},
               method: 'POST',
               header: {'token': uni.getStorageSync('token')},
               success(result) {
                  var res = result.data
                  if (res.code === 200) {
                     setTimeout(()=> {
                        _this.barcode = ''
                        _this.reloadStation()
                     },1000)
                     uni.showToast({ title: '启动入库', icon: "success", position: 'top' })
                  } else if (res.code == 403) {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                     setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
                  } else {
                     uni.showToast({ title: res.msg, icon: "error", position: 'top' })
                  }
               }
            });
         },
      }
   }
</script>
<style>
   @import url('../../../static/css/common/order.css');
   .station {
      font-size: 18px;
      padding: 24rpx;
   }
   .station-title {
      font-size: 32px;
      font-weight: bold;
      padding: 24rpx 0;
   }
   .station {
      font-size: 18px;
      padding: 24rpx;
   }
   .station-barcode {
      font-size: 24px;
@@ -121,4 +573,141 @@
      background-color: #3eb689;
      color: #fff;
   }
   .wrkMast {
      background-color: #0083ff;
      color: #fff;
      margin-top: 10rpx;
      font-size: 18px;
      padding: 24rpx;
   }
   .wrkMast-wrkNo {
      font-size: 32px;
      font-weight: bold;
      padding: 24rpx 0;
      display: flex;
   }
   .wrkDetls {
      background-color: #2299ff;
      color: #fff;
      margin-top: 10rpx;
      font-size: 18px;
      padding: 24rpx;
   }
   .wrkDetl {
      padding: 16rpx 0;
      border-bottom: 1px solid #FFF;
   }
   .wrkDetl:last-child {
      border-bottom: none;
   }
   .waitPakins {
      background-color: #c494ed;
      color: #fff;
      margin-top: 10rpx;
      font-size: 18px;
      padding: 24rpx;
   }
   .waitPakin {
      padding: 16rpx 0;
      border-bottom: 1px solid #FFF;
   }
   .waitPakin:last-child {
      border-bottom: none;
   }
   .popup {
      width: 80vw;
      min-height: 100rpx;
      background-color: #FFF;
      border-radius: 25rpx;
      position: relative;
   }
   .title {
      height: 100rpx;
      line-height: 100rpx;
      width: 100%;
      color: #606266;
      text-align: center;
      font-size: 16px;
   }
   .popup-item {
      position: relative;
      height: 80rpx;
      line-height: 80rpx;
      display: flex;
      align-items: center;
      font-size: 14px;
   }
   .popup-item-left {
      width: 16vw;
      padding-right: 20rpx;
      text-align: right;
      color: #606266;
   }
   .popup-item-right {
      display: flex;
      align-items: center;
      width: 50vw;
      height: 50rpx;
      padding: 2px 5px;
      border: 1px solid #E4E7ED;
      border-radius: 5rpx;
   }
   .popup-item-right input{
      color: #606266;
   }
   .btn {
      display: flex;
      height: 90rpx;
      margin-top: 20rpx;
      border-top: 1px solid #DCDFE6;
      justify-content: center;
      align-items: center;
   }
   .btn-left {
      display: flex;
      flex: 1;
      height: 100%;
      justify-content: center;
      align-items: center;
      color: #606266;
      border-right: 1px solid #DCDFE6;
   }
   .btn-right {
      display: flex;
      flex: 1;
      justify-content: center;
      align-items: center;
      color: #409EFF;
   }
   .dropdown {
      position: relative;
      display: flex;
      width: 93%;
      align-items: center;
      padding: 0rpx 20rpx;
   }
   .dropdown-content {
      position: absolute;
      top: calc(100% + 15rpx);
      left: 0;
      width: calc(100% - 20rpx);
      max-height: 300rpx;
      background-color: #fff;
      box-shadow: 0 0px 6px rgba(0, 0, 0, 0.3);
      border-radius: 8rpx;
      z-index: 10;
   }
   .dropdown-item {
      padding: 12rpx;
      line-height: 1.2;
      font-size: 22px;
      color: #3a3a3a;
   }
</style>