#
zjj
2024-07-30 9b78294b36a634baadd9e0700398672a55806c75
pages/pakin/pakin.vue
@@ -7,13 +7,8 @@
               @input="barcodeInput()">
         </view>
         <view class="item">
            <view class="code-decs">物料码:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="matnr" :focus="matFocus" @input="findMat()">
            <view class="item-right">
               <button></button>
               <text style="text-align: right;color: #409EFF;" @click="selectMat()">提取+</text>
               <uni-icons type="right" color="#c1c1c1"></uni-icons>
            </view>
            <view class="code-decs">站点:</view>
            <uni-combox :candidates="staList" placeholder="请选择入库站点" v-model="sta"></uni-combox>
         </view>
      </view>
      <view class="mat-list-title">
@@ -33,18 +28,32 @@
                  </view>
               </view>
               <view class="list-left-item">
                  <view class="desc">品名:</view>
                  <view class="left-item">{{item.maktx}}</view>
                  <view class="desc">批号:</view>
                  <view class="left-item">{{item.batch}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">规格:</view>
                  <view class="desc">膜类型:</view>
                  <view class="left-item">{{item.specs}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">批号:</view>
                  <view class="left-item">
                     <uni-tag :text="item.batch" type="warning"></uni-tag>
                  </view>
                  <view class="desc">生产日期:</view>
                  <view class="left-item">{{item.manuDate}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">型号:</view>
                  <view class="left-item">{{item.model}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">宽度:</view>
                  <view class="left-item">{{item.specs}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">长度:</view>
                  <view class="left-item">{{item.length}}</view>
               </view>
               <view class="list-left-item">
                  <view class="desc">面积:</view>
                  <view class="left-item">{{item.volume}}</view>
               </view>
               <!-- <view class="list-left-item">
                  <view class="desc">重量:</view>
@@ -52,10 +61,10 @@
                     <uni-tag :text="item.weight" type="warning"></uni-tag>
                  </view>
               </view> -->
               <view class="list-left-item">
               <!-- <view class="list-left-item">
                  <view class="desc">数量:</view>
                  <view class="left-item">{{item.anfme}}</view>
               </view>
               </view> -->
            </view>
            <view class="list-right">
               <uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
@@ -66,7 +75,7 @@
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">组托</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">入库</button>
      </view>
      <!-- 弹窗 -->
      <!-- 修改数量 -->
@@ -86,16 +95,30 @@
                  <view class="popup-item-left">批号:</view>
                  <view class="popup-item-right"><input type="text" v-model="batch"></view>
               </view>
               <!-- <view class="popup-item">
                  <view class="popup-item-left">重量:</view>
                  <view class="popup-item-right"><input type="text" v-model="weight"></view>
               </view> -->
               <view class="popup-item">
                  <view class="popup-item-left">数量:</view>
                  <view class="popup-item-right" style="border: none;justify-content: center;">
                     <uni-number-box :value="count" :step='0.01' :max="9999999" color="#747474" @change="changeValue" />
                  </view>
                  <view class="popup-item-left">膜类型:</view>
                  <view class="popup-item-right"><input type="text" v-model="specs"></view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">生产日期:</view>
                  <view class="popup-item-right"><input type="text" v-model="manuDate"></view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">型号:</view>
                  <view class="popup-item-right"><input type="text" v-model="model"></view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">宽度:</view>
                  <view class="popup-item-right"><input type="text" v-model="weight"></view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">长度:</view>
                  <view class="popup-item-right"><input type="text" v-model="length"></view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">面积:</view>
                  <view class="popup-item-right"><input type="text" v-model="volume"></view>
               </view>
               <view class="btn">
                  <view class="btn-left" @click="reviseClose">取消</view>
                  <view class="btn-right" @click="reviseConfirm()">修改</view>
@@ -156,6 +179,13 @@
            matFocus: false,
            matData: '',
            removeNum: 0,
            specs:'',
            manuDate:'',
            model:'',
            length:'',
            volume:'',
            staList:[104],
            sta:''
         }
      },
      onLoad() {
@@ -165,7 +195,7 @@
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
      },
      methods: {
      methods: {
         messageToggle(type) {
            this.msgType1 = type
            this.$refs.message.open()
@@ -174,6 +204,7 @@
         barcodeInput() {
            // 不设置定时器 会出现扫入的字符串不全
            setTimeout(() => {
               let that = this;
               var len = this.barcode.length
               if (len != 8) {
                  uni.showToast({
@@ -183,6 +214,45 @@
                  });
                  this.barcodeFocuss()
                  return;
               }else{
                  uni.request({
                     url: that.baseUrl + '/waitPakin/selectByBarcode/list',
                     data: {
                        barcode: that.barcode
                     },
                     header: {
                        'token': uni.getStorageSync('token')
                     },
                     success(result) {
                        result = result.data
                        if (result.code === 200 && result.data) {
                           that.matData = result.data
                           for(var list in that.matData.records){
                              console.log(list)
                              that.checkMat(that.matData.records[list])
                           }
                        } else if (result.code == 403) {
                           uni.showToast({
                              title: result.msg,
                              icon: "none",
                              position: 'top'
                           })
                           setTimeout(() => {
                              uni.reLaunch({
                                 url: '../login/login'
                              });
                           }, 1000);
                        } else {
                           uni.showToast({
                              title: result.msg,
                              icon: "none",
                              position: 'top'
                           })
                        }
                     }
                  });
               }
               this.focuss()
            }, 200)
@@ -209,7 +279,7 @@
         findMat() {
            let that = this
            uni.request({
               url: that.baseUrl + '/mat/auth',
               url: that.baseUrl + '/mat/split',
               data: {
                  matnr: that.matnr
               },
@@ -219,25 +289,8 @@
               success(result) {
                  result = result.data
                  if (result.code === 200 && result.data) {
                     that.matData = result.data
                     that.matnr = ''
                     that.matData['batch'] = ''
                     uni.navigateTo({
                        url: "../mat/matSelected",
                        // 通过eventChannel向被打开页面传送数据
                        success: function(res) {
                           res.eventChannel.emit('mat', {
                              data: result.data
                           })
                        },
                        // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
                        events: {
                           matList: function(data) {
                              that.checkMat(data.data)
                              that.focuss()
                           },
                        },
                     });
                     that.matData = result.data
                     that.checkMat(that.matData)
                  } else if (result.code == 403) {
                     uni.showToast({
                        title: result.msg,
@@ -317,10 +370,14 @@
         },
         // 修改批号
         revise(item, i) {
            this.matnr = this.dataList[i].matnr
            this.count = this.dataList[i].anfme
            this.matnr = this.dataList[i].matnr
            this.batch = this.dataList[i].batch
            this.weight = this.dataList[i].weight
            this.specs = this.dataList[i].specs
            this.manuDate = this.dataList[i].manuDate
            this.model = this.dataList[i].model
            this.length = this.dataList[i].length
            this.volume = this.dataList[i].volume
            this.rowNum = i
            this.eject()
         },
@@ -364,7 +421,7 @@
         combConfirm(type) {
            this.msgType = type
            this.title = '警告'
            this.content = '是否现在组托!'
            this.content = '是否现在入库!'
            this.$refs.combConfirm.open()
         },
         combClose() {
@@ -383,18 +440,16 @@
               this.messageToggle('error')
               return;
            }
            for (var i = 0; i < that.dataList.length; i++) {
               if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') {
                  this.messageText = that.dataList[i].matnr + '组托数量不能为0'
                  this.messageToggle('error')
                  return;
               }
            if (that.sta === '') {
               this.messageText = "请选择站点"
               this.messageToggle('error')
               return;
            }
            uni.request({
               url: that.baseUrl + '/mobile/comb/auth',
               url: that.baseUrl + '/mobile/inbound/auth',
               data: JSON.stringify({
                  barcode: that.barcode,
                  combMats: that.dataList
                  sta: that.sta
               }),
               method: 'POST',
               header: {
@@ -404,11 +459,8 @@
                  var res = result.data
                  if (res.code === 200) {
                     that.resst();
                     that.messageText = "组托成功"
                     that.messageToggle('success')
                     const innerAudioContext = uni.createInnerAudioContext();
                     innerAudioContext.src = '/static/music/pakinOk.mp3';
                     innerAudioContext.play()
                     that.messageText = "生成入库任务成功"
                     that.messageToggle('success')
                  } else if (res.code == 403) {
                     that.messageText = res.msg
                     that.messageToggle('error')
@@ -444,6 +496,7 @@
         resst() {
            this.dataList = []
            this.barcode = ''
            this.sta = ''
            this.barcodeFocuss()
         },
      }