ZZJ 3 лет назад
Родитель
Сommit
067228be61

+ 64 - 24
src/views/system/jbdScan/goods/sampleTag.vue

@@ -87,6 +87,7 @@ import VueBarcode from 'vue-barcode';
 import vueEasyPrint from "vue-easy-print";
 import repostCurd from '@/business/platform/form/utils/custom/joinCURD.js';
 import { resolve } from 'path';
+import { async } from 'q';
 
 export default {
   components: {
@@ -145,10 +146,43 @@ export default {
     },
     async getInit() {
       let this_ = this;
-      // console.log('getInit:',this.obj)
-      this.jcxmList = []
-      var idStr = '';
-      var wjStr = '';
+    //   console.log('getInit:',this.obj)
+        let jcxmList = []
+        let idStr = ''
+        let wjStr = ''
+       if(this.obj.length > 0 && this.obj[0].indexOf(" ") != -1){
+        for(let item of this.obj){
+            idStr += item.split(" ")[0] + ','
+            wjStr += item.split(" ")[1] + ','
+            jcxmList.push(item.split(" ")[2].split(','))
+        }
+        idStr = idStr.substring(0,idStr.length-1);
+        wjStr = wjStr.substring(0,wjStr.length-1);
+        this.getLookJCXM(idStr,wjStr,jcxmList) 
+
+        //  this.obj.forEach((item,index)=>{
+        //     let jcxmList = []
+        //     let tcxmList = []
+        //     let idStr = item.split(" ")[0];
+        //     let wjStr = item.split(" ")[1];
+        //     // idStr += item.split(" ")[0] + ','
+        //     // wjStr += item.split(" ")[1] + ','
+        //     jcxmList.push(item.split(" ")[2].split(','))
+        //     tcxmList.push(item.split(" ")[3].split(','))
+        //     this.getLookJCXM(idStr,wjStr,jcxmList,tcxmList) 
+        //     if(index === this.obj.length -1){
+        //         this.list = this.finalList
+        //     }
+        // })
+        // setTimeout(() => {
+        //     console.log('obj',this.obj.length)
+        //     console.log('finalList',this.finalList.length)
+        //     console.log('finalList',this.finalList)
+        //     this.list = this.finalList
+        // }, 3000);
+      }
+      
+/*
       if(this.obj.length > 0 && this.obj[0].indexOf(" ") != -1){
         this.obj.forEach(item=>{
         idStr += item.split(" ")[0] + ','
@@ -158,7 +192,8 @@ export default {
         idStr = idStr.substring(0,idStr.length-1);
         wjStr = wjStr.substring(0,wjStr.length-1);
         this.getLookJCXM(idStr,wjStr,this.jcxmList) 
-      }else{
+      }
+      */else{
         // 列表标签打印
         let ypInfo = []
         for(let item of this.obj){
@@ -237,32 +272,37 @@ export default {
       this.list = list;
     },
     getLookJCXM(id,wjStr,jcxmList){
-      // console.log(id,wjStr,jcxmList)
-      let jcxmSQL = `select xiang_mu_bian_hao from t_mjjcnlfw where find_in_set(id_,'${jcxmList}')`
+    //   console.log(id,wjStr,jcxmList)    
+    //   let jcxmSQL = `select xiang_mu_bian_hao from t_mjjcnlfw where find_in_set(id_,'${jcxmList}') union all select xiang_mu_bian_hao from t_mjjcnlfw where find_in_set(id_,'${tcxmList}')`
+      let jcxmSQL = `select id_,xiang_mu_bian_hao from t_mjjcnlfw`
       let sql = `select yang_pin_ming_che,yang_pin_bian_hao from t_mjypb where find_in_set(id_,'${id}')`
+    //   console.log(sql)
       let wtsql = `select wei_tuo_ri_qi_ from t_mjwtsqb where find_in_set(id_,'${wjStr}')`
-      Promise.all([repostCurd("sql", jcxmSQL),repostCurd("sql", sql),repostCurd('sql',wtsql)]).then((res1,res2,res3)=>{
-          // console.log(res1[0].variables.data)
-          // console.log(res1[1].variables.data)
-          // console.log(res1[2].variables.data)
+      Promise.all([repostCurd("sql", jcxmSQL),repostCurd("sql", sql),repostCurd('sql',wtsql)]).then((res1)=>{
           let jcxmInfo = res1[0].variables.data
-          let ypInfo = res1[1].variables.data
-          let rq = res1[2].variables.data
+          let jcxmArr  = []
+          jcxmList.forEach(item=>{
+            let temp = []
+            item.forEach(i=>{
+                temp.push(jcxmInfo.find(x => x.id_ == i).xiang_mu_bian_hao)
+            })
+            jcxmArr.push(temp)
+          })
+          let ypInfo = res1[1].variables.data.reverse()
+        //   console.log(ypInfo)
           let list = []
           ypInfo.forEach((item,index) => {
-            rq.forEach((a,b)=>{
-              jcxmInfo.forEach((it,ind)=>{
-              let o = {
-                  name: item.yang_pin_ming_che,
-                  serial: item.yang_pin_bian_hao,
-                  type: a.wei_tuo_ri_qi_,
-                  condition: it.xiang_mu_bian_hao
-                }
-                list.push(o)
-            })
-            })
+                jcxmArr[index].forEach((it,ind)=>{
+                    let o = {
+                        name: item.yang_pin_ming_che,
+                        serial: item.yang_pin_bian_hao,
+                        condition: it
+                    }
+                    list.push(o)
+                })
           })
           this.list = list
+          console.log(this.list.length)
       })
       /*
       let sql = `select * from t_mjypb where find_in_set(id_,'${id}')`

+ 0 - 91
src/views/system/jbdScan/js/manualConfirmationJS.js

@@ -88,7 +88,6 @@ export default {
 
           // 获取样品列表
           let ypInfoList = this_.listData
-          // console.log(ypInfoList, "样品信息")
 
           let dWhere = []
           let ypbh = []
@@ -123,44 +122,8 @@ export default {
                 this_.$message.error("你要留样的话,存放位置不能为空哦!")
                 return;
               }
-              // if (ypInfoList[yp].shou_yang_wei_zhi != undefined && ypInfoList[yp].shou_yang_wei_zhi != '') {
-              //   this_.$message.error("你要留样的话,就不要选收样存放位置!")
-              //   return;
-              // }
-              let isLy = ypInfoList[yp].liu_yang_wei_zhi_
-              // if (isLy.substr(-2, isLy.length - 1) == "占用" || isLy.substr(-2, isLy.length - 1) == "空余") { //?
-              //   let sql = "select 'id' from MJ_yp_position_status where positionAndStatus = '" + isLy + "' limit 1"
-              //   repostCurd('sql', sql).then(response => {
-              //     cfwz = response.variables.data[0].id
-              //     ypInfoList[yp].liu_yang_wei_zhi_ = cfwz
-              //     console.log('?question time留样')
-              //   })
-              // } else {
-              //   cfwz = ypInfoList[yp].liu_yang_wei_zhi_
-              // }
               cfwzObj.push(ypInfoList[yp].liu_yang_wei_zhi_) //取位置信息
             }
-            //  else {
-            //   if (ypInfoList[yp].shou_yang_wei_zhi == null || ypInfoList[yp].shou_yang_wei_zhi == '') {
-            //     this_.$message.error("你正常收样的话,样品存放位置不能为空哦!")
-            //     return;
-            //   }
-            //   // if (ypInfoList[yp].liu_yang_wei_zhi_ != undefined && ypInfoList[yp].liu_yang_wei_zhi_ != '') {
-            //   //   this_.$message.error("你正常收样的话,就不要选择留样存放位置!")
-            //   //   return;
-            //   // }
-            //   let isZC = ypInfoList[yp].shou_yang_wei_zhi
-            //   if (isZC.substr(-2, isZC.length - 1) == "占用" || isZC.substr(-2, isZC.length - 1) == "空余") { //?
-            //     let sql1 = "select `id` from MJ_yp_position_status where positionAndStatus = '" + isZC + "' limit 1"
-            //     repostCurd('sql', sql1).then(response => {
-            //       cfwz = response.variables.data[0].id
-            //       ypInfoList[yp].shou_yang_wei_zhi = cfwz //查询位置状态表 取值位置的id
-            //       console.log('?question time')
-            //     })
-            //   } else {
-            //     cfwz = ypInfoList[yp].shou_yang_wei_zhi //取位置信息
-            //   }
-            // }
             dWhere.push('{"id_":"' + cfwz + '"}')
             ypbh.push(ypInfoList[yp].yang_pin_bian_hao)
             uuidList.push(ypInfoList[yp].biao_zhi_uuid_)
@@ -186,60 +149,6 @@ export default {
             repostCurd('update','{"tableName":"t_mjypb","paramWhere":' + ypIdList[index] + ',"paramCond":' + '{"jie_yang_zhuang_t":"已确认","cun_fang_wei_zhi_":"'+WZtem+'","liu_yang_cun_fang":"'+LYWZtem+'"}}')
           }
 
-/*
-          for (let num in dWhere) {
-            // if (this.OriginalPosition[num] != cfwzIdList[num]) {
-              let sql = "select * from t_mjypcfwz where id_ = '" + cfwzIdList[num] + "'"
-              repostCurd('sql', sql).then(response => {
-                let resArr = response.variables.data
-                console.log(resArr)
-                if (resArr.length == 1) {
-                  if (resArr[0].wei_zhi_zhuang_ta == "空余") {
-                    repostCurd('update', '{"tableName":"t_mjypcfwz","paramWhere":' + dWhere[num] + ',"paramCond":' + '{"wei_zhi_zhuang_ta":"占用","yang_pin_bian_hao":"' + ypbh[num] +'","yang_pin_ming_che":"'  + ypmcList[num] + '","ru_ku_shi_jian_":"' + this_.dateFormat() + '","shou_yang_ri_qi_":"' + uuidList[num] + '"}}').then(res => {
-                      console.log(res, "原本位置为空余 ,新位置更新成功")
-                      // alert('样品货位状态更新成功')
-                    })
-                  } else if (resArr[0].wei_zhi_zhuang_ta == "占用") {
-                    // 新增一条新的位置记录,使用旧的位置记录 修改它的样品编号,入库时间,标识UUID
-                    let cfNewList = []
-                    let cfNew = {}
-                    cfNew["fang_jian_lei_xin"] = resArr[0].fang_jian_lei_xin
-                    cfNew["huo_jia_lei_xing_"] = resArr[0].huo_jia_lei_xing_
-                    cfNew["huo_jia_hao_"] = resArr[0].huo_jia_hao_
-                    cfNew["qu_yu_"] = resArr[0].qu_yu_
-                    cfNew["gua_jia_hao_"] = resArr[0].gua_jia_hao_
-                    cfNew["ceng_hao_"] = resArr[0].ceng_hao_
-                    cfNew["wei_zhi_bian_hao_"] = resArr[0].wei_zhi_bian_hao_
-                    cfNew["wei_zhi_zhuang_ta"] = resArr[0].wei_zhi_zhuang_ta
-                    cfNew["cun_fang_lei_xing"] = resArr[0].cun_fang_lei_xing
-                    cfNew["cun_chu_tiao_jian"] = resArr[0].cun_chu_tiao_jian
-                    cfNew["yang_pin_bian_hao"] = ypbh[num]
-                    cfNew["yang_pin_ming_che"] = ypmcList[num]
-                    cfNew["ru_ku_shi_jian_"] = this_.dateFormat()
-                    cfNew["shou_yang_ri_qi_"] = uuidList[num]
-                    cfNewList.push(cfNew)
-                    let uuid = cfNew["shou_yang_ri_qi_"];
-                    repostCurd('add', '{"tableName":"t_mjypcfwz","paramWhere":' + JSON.stringify(cfNewList) + '}').then(res => {
-                      let selectsql = "select id_ from t_mjypcfwz where shou_yang_ri_qi_='" + uuid + "'";
-                      repostCurd('sql', selectsql).then(res => {
-                        let dataid = res.variables.data[0].id_;
-                        let abc = '{"biao_zhi_uuid_":"' + uuid + '"}'
-                        if (changeWeizhi && !changesyWeizhi) {
-                          repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"shou_yang_wei_zhi":"' + dataid + '"}}')
-                        } else {
-                          repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"liu_yang_wei_zhi_":"' + dataid + '"}}')
-                        }
-                      })
-
-                    })
-                  }
-                }
-              })
-            // }
-
-          }
-          */
-
           for (let num in dWhere) {
             let firstIfEmpty = true
             let secondIfEmpty = true

+ 0 - 87
src/views/system/jbdScan/js/sampleConfirmationJS.js

@@ -28,7 +28,6 @@ export default {
 
       // 扫码扫到新数据,查询 回填展示
       if(flag){
-         // repostCurd('select','{"tableName": "t_mjypdjb","paramWhere":{"yang_pin_bian_hao":"S220909-1053"}}').then(response => {
           let sql = `select ypb.*,sqb.fu_kuan_fang_shi_,sqb.fu_he_yuan_ from t_mjypb ypb  JOIN t_mjwtsqb sqb on ypb.wai_jian_ = sqb.id_ and ypb.jie_yang_zhuang_t = '待确认' and ypb.yang_pin_bian_hao = '${id}'`
          repostCurd('sql',sql).then(response => {
           if (response.variables.data && response.variables.data.length > 0) {
@@ -112,44 +111,9 @@ export default {
                   this_.$message.error("你要留样的话,存放位置不能为空哦!")
                   return;
                 }
-                // if(ypInfoList[yp].shou_yang_wei_zhi != undefined && ypInfoList[yp].shou_yang_wei_zhi != ''){
-                //   this_.$message.error("你要留样的话,就不要选收样存放位置!")
-                //   return;
-                // }
                 let isLy = ypInfoList[yp].liu_yang_wei_zhi_
-                // if(isLy.substr(-2,isLy.length -1) == "占用" || isLy.substr(-2,isLy.length -1) == "空余"){
-                //   let sql = "select `id` from MJ_yp_position_status where positionAndStatus = '" + isLy + "' limit 1"
-                //    repostCurd('sql',sql).then(response=>{
-                //      cfwz = response.variables.data[0].id
-                //      ypInfoList[yp].liu_yang_wei_zhi_ = cfwz
-                //      console.log('?question time')
-                //    })
-                // }else{
-                //   cfwz = ypInfoList[yp].liu_yang_wei_zhi_
-                // }
                 cfwzObj.push(ypInfoList[yp].liu_yang_wei_zhi_) //取位置信息
               }
-              // else{
-              //   if(ypInfoList[yp].shou_yang_wei_zhi == null || ypInfoList[yp].shou_yang_wei_zhi == ''){
-              //     this_.$message.error("你正常收样的话,样品存放位置不能为空哦!")
-              //     return;
-              //   }
-              //   if(ypInfoList[yp].liu_yang_wei_zhi_ != undefined && ypInfoList[yp].liu_yang_wei_zhi_ != ''){
-              //     this_.$message.error("你正常收样的话,就不要选择留样存放位置!")
-              //     return;
-              //   }
-              //   let isZC = ypInfoList[yp].shou_yang_wei_zhi
-              //   if(isZC.substr(-2,isZC.length -1) == "占用" || isZC.substr(-2,isZC.length -1) == "空余"){
-              //     let sql = "select `id` from MJ_yp_position_status where positionAndStatus = '" + isZC + "' limit 1"
-              //      repostCurd('sql',sql).then(response=>{
-              //        cfwz = response.variables.data[0].id
-              //        ypInfoList[yp].shou_yang_wei_zhi = cfwz
-              //        console.log('?question time')
-              //      })
-              //   }else{
-              //     cfwz = ypInfoList[yp].shou_yang_wei_zhi
-              //   }
-              // }
               dWhere.push('{"id_":"' + cfwz + '"}')
               ypbh.push(ypInfoList[yp].yang_pin_bian_hao)
               uuidList.push(ypInfoList[yp].biao_zhi_uuid_)
@@ -174,57 +138,6 @@ export default {
 
                 repostCurd('update','{"tableName":"t_mjypb","paramWhere":' + ypIdList[index] + ',"paramCond":' + '{"jie_yang_zhuang_t":"已确认","cun_fang_wei_zhi_":"'+WZtem+'","liu_yang_cun_fang":"'+LYWZtem+'"}}')
             }
-            // for(let num in dWhere){
-            //   if(this.OriginalPosition[num] != cfwzIdList[num]){
-            //     let sql = "select * from t_mjypcfwz where id_ = '" + cfwzIdList[num] + "'"
-            //     repostCurd('sql',sql).then(response=>{
-            //         let resArr = response.variables.data
-            //         if(resArr.length == 1){
-            //             if(resArr[0].wei_zhi_zhuang_ta == "空余"){
-            //               repostCurd('update','{"tableName":"t_mjypcfwz","paramWhere":'+dWhere[num]+',"paramCond":'+'{"wei_zhi_zhuang_ta":"占用","yang_pin_bian_hao":"'+ ypbh[num] +'","yang_pin_ming_che":"'  + ypmcList[num] + '","ru_ku_shi_jian_":"'+ this_.dateFormat() + '","shou_yang_ri_qi_":"'+ uuidList[num] + '"}}')
-            //             }else if(resArr[0].wei_zhi_zhuang_ta == "占用"){
-            //               // 新增一条新的位置记录,使用旧的位置记录 修改它的样品编号,入库时间,标识UUID
-            //                     let cfNewList = []
-            //                     let cfNew = {}
-            //                     cfNew["fang_jian_lei_xin"] = resArr[0].fang_jian_lei_xin
-            //                     cfNew["huo_jia_lei_xing_"] = resArr[0].huo_jia_lei_xing_
-            //                     cfNew["huo_jia_hao_"] = resArr[0].huo_jia_hao_
-            //                     cfNew["qu_yu_"] = resArr[0].qu_yu_
-            //                     cfNew["gua_jia_hao_"] = resArr[0].gua_jia_hao_
-            //                     cfNew["ceng_hao_"] = resArr[0].ceng_hao_
-            //                     cfNew["wei_zhi_bian_hao_"] = resArr[0].wei_zhi_bian_hao_
-            //                     cfNew["wei_zhi_zhuang_ta"] = resArr[0].wei_zhi_zhuang_ta
-            //                     cfNew["cun_fang_lei_xing"] = resArr[0].cun_fang_lei_xing
-            //                     cfNew["cun_chu_tiao_jian"] = resArr[0].cun_chu_tiao_jian
-            //                     cfNew["yang_pin_bian_hao"] = ypbh[num]
-            //                     cfNew["yang_pin_ming_che"] = ypmcList[num]
-            //                     cfNew["ru_ku_shi_jian_"] = this_.dateFormat()
-            //                     cfNew["shou_yang_ri_qi_"] = uuidList[num]
-            //                     cfNewList.push(cfNew)
-            //                     let uuid = cfNew["shou_yang_ri_qi_"];
-            //                     repostCurd('add', '{"tableName":"t_mjypcfwz","paramWhere":' + JSON.stringify(cfNewList) + '}').then(res => {
-            //                       let selectsql = "select id_ from t_mjypcfwz where shou_yang_ri_qi_='" + uuid + "'";
-            //                       repostCurd('sql', selectsql).then(res => {
-            //                         let dataid = res.variables.data[0].id_;
-            //                         // console.log(res.variables.data)
-            //                         let abc = '{"biao_zhi_uuid_":"' + uuid + '"}'
-            //                         // console.log('zzj abc ',abc)
-            //                         if (changeWeizhi && !changesyWeizhi) {
-            //                           repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"shou_yang_wei_zhi":"' + dataid + '"}}').then(res => {
-            //                           })
-            //                         } else {
-            //                           repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"liu_yang_wei_zhi_":"' + dataid + '"}}').then(res => {
-            //                           })
-            //                         }
-            //                       })
-
-            //                     })
-            //             }
-            //         }
-            //     })
-            //   }
-
-            // }
             for (let num in dWhere) {
               let firstIfEmpty = true
               let secondIfEmpty = true