|
|
@@ -33,8 +33,9 @@ export default {
|
|
|
repostCurd('sql',sql).then(response => {
|
|
|
if (response.variables.data && response.variables.data.length > 0) {
|
|
|
response.variables.data[0].jie_yang_shu_lian = 1
|
|
|
+ response.variables.data[0].jie_yang_zhuang_t = '已确认'
|
|
|
this.listData.push(response.variables.data[0])
|
|
|
- this.OriginalPosition.push(response.variables.data[0].shi_fou_liu_yang_ == "是" ? response.variables.data[0].liu_yang_wei_zhi_ : response.variables.data[0].shou_yang_wei_zhi)
|
|
|
+ // this.OriginalPosition.push(response.variables.data[0].shi_fou_liu_yang_ == "是" ? response.variables.data[0].liu_yang_wei_zhi_ : response.variables.data[0].shou_yang_wei_zhi)
|
|
|
}else{
|
|
|
this.cancelScan();
|
|
|
}
|
|
|
@@ -95,7 +96,9 @@ export default {
|
|
|
let ypmcList = []
|
|
|
|
|
|
for(let yp in ypInfoList){
|
|
|
+ let cfwzObj = []
|
|
|
let cfwz = ''
|
|
|
+ cfwzObj.push(ypInfoList[yp].shou_yang_wei_zhi) //取位置信息
|
|
|
if(ypInfoList[yp].jie_yang_shu_lian > ypInfoList[yp].shou_yang_shu_lia){
|
|
|
this_.$message.error('操作失败,['+ypInfoList[yp].yang_pin_ming_che+'] 接收确认数量不得大于收样数量。')
|
|
|
return;
|
|
|
@@ -109,47 +112,49 @@ export default {
|
|
|
this_.$message.error("你要留样的话,存放位置不能为空哦!")
|
|
|
return;
|
|
|
}
|
|
|
- if(ypInfoList[yp].shou_yang_wei_zhi != undefined && ypInfoList[yp].shou_yang_wei_zhi != ''){
|
|
|
- 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_
|
|
|
- }
|
|
|
-
|
|
|
- }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
|
|
|
- }
|
|
|
+ // 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_)
|
|
|
- cfwzIdList.push(cfwz)
|
|
|
+ // cfwzIdList.push(cfwz)
|
|
|
+ cfwzIdList.push(cfwzObj)
|
|
|
|
|
|
ypIdList.push('{"id_":"' + ypInfoList[yp].id_ + '"}')
|
|
|
ypWeiZhi.push(ypInfoList[yp].shou_yang_wei_zhi) // 收样存放位置
|
|
|
@@ -169,57 +174,148 @@ 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){
|
|
|
+ // 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
|
|
|
+ for(let index = 0; index<cfwzIdList[num].length; index++){
|
|
|
+ let sql = "select * from t_mjypcfwz where id_ = '" + cfwzIdList[num][index] + "'"
|
|
|
+ let isLiuYang = index == 1 ? "是" : "否"
|
|
|
+ repostCurd('sql', sql).then(response => {
|
|
|
+ let resArr = response.variables.data
|
|
|
+ if (resArr.length == 1) {
|
|
|
+ if (resArr[0].wei_zhi_zhuang_ta == "空余") {
|
|
|
+ if(index == 0){
|
|
|
+ firstIfEmpty = false
|
|
|
+ }else{
|
|
|
+ secondIfEmpty = false
|
|
|
+ }
|
|
|
+ let content = {
|
|
|
+ id_ : cfwzIdList[num][index]
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ wei_zhi_zhuang_ta : "占用",
|
|
|
+ ru_ku_shi_jian_ : this_.dateFormat(),
|
|
|
+ yang_pin_bian_hao : ypbh[num],
|
|
|
+ yang_pin_ming_che : ypmcList[num],
|
|
|
+ shi_fou_liu_yang_ : isLiuYang
|
|
|
+ }
|
|
|
+ let o = {
|
|
|
+ tableName:'t_mjypcfwz',
|
|
|
+ paramWhere:content,
|
|
|
+ paramCond : params
|
|
|
+ }
|
|
|
+ repostCurd('update',JSON.stringify(o)).then(res=>{
|
|
|
+ console.log("空余位置修改")
|
|
|
+ })
|
|
|
+
|
|
|
+ } 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]
|
|
|
+ cfNew["shi_fou_liu_yang_"] = isLiuYang
|
|
|
+ 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 data = res.variables.data;
|
|
|
+ let suchAs = '{"biao_zhi_uuid_":"' + uuid + '"}'
|
|
|
+ if(data.length == 1 && changeWeizhi && firstIfEmpty){
|
|
|
+ repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":'+suchAs+',"paramCond":{"shou_yang_wei_zhi":"'+data[0].id_+'"}}').then(res=>{
|
|
|
+ console.log('One 存放位置',res)
|
|
|
})
|
|
|
+ }else if(data.length == 1 && changesyWeizhi && secondIfEmpty){
|
|
|
+ repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":'+suchAs+',"paramCond":{"liu_yang_wei_zhi_":"'+data[0].id_+'"}}').then(res=>{
|
|
|
+ console.log('One 留样位置',res)
|
|
|
+ })
|
|
|
+ }else if(data.length == 2 && changeWeizhi && changesyWeizhi){
|
|
|
+ let whereL = []
|
|
|
+ whereL.push(suchAs)
|
|
|
+ repostCurd('updates', '{"tableName":"t_mjypdjb","paramWhere":['+whereL+'],"paramCond":{"shou_yang_wei_zhi":"'+data[0].id_+'","liu_yang_wei_zhi_":"'+data[1].id_+'"}}').then(res=>{
|
|
|
+ console.log('Two 收样留样位置',res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
repostCurd('selects','{"tableName":"t_mjypb","paramWhere":['+ypbhList+']}').then(response=>{
|
|
|
mjypbList = response.variables.data
|
|
|
let wjList = []
|
|
|
@@ -276,7 +372,8 @@ export default {
|
|
|
for(var i in mjypbList){
|
|
|
// console.log('坐标',i,p)
|
|
|
let rwzb = {}
|
|
|
- let wz_ = ypInfoList[i].shi_fou_liu_yang_ == "是" ? ypInfoList[i].liu_yang_wei_zhi_ : ypInfoList[i].shou_yang_wei_zhi // 对应的样品存放位置
|
|
|
+ // let wz_ = ypInfoList[i].shi_fou_liu_yang_ == "是" ? ypInfoList[i].liu_yang_wei_zhi_ : ypInfoList[i].shou_yang_wei_zhi // 对应的样品存放位置
|
|
|
+ let wz_ = ypInfoList[i].shou_yang_wei_zhi
|
|
|
rwzb["yang_pin_bian_hao"] = mjypbList[i].yang_pin_bian_hao // 取对应的样品编号
|
|
|
rwzb["yang_pin_ming_che"] = mjypbList[i].yang_pin_ming_che // 对应的样品名称
|
|
|
rwzb["yang_pin_dai_ci_"] = mjypbList[i].dai_ci_ // 对应的样品代次
|