|
|
@@ -3,41 +3,24 @@ import repostCurd from '@/business/platform/form/utils/custom/joinCURD.js'
|
|
|
export default {
|
|
|
methods: {
|
|
|
facilityData(page) {
|
|
|
- // this.loadData()
|
|
|
this.loadDataBySQL(page)
|
|
|
},
|
|
|
- /* 获取数据 ,开始查阅记录 */
|
|
|
- loadData() {
|
|
|
- // 扫码扫到新数据,查询 回填展示
|
|
|
- repostCurd('select', '{"tableName": "t_mjypb","paramWhere":{"jie_yang_zhuang_t":"待确认"}}').then(response => {
|
|
|
- if (response.variables.data && response.variables.data.length > 0) {
|
|
|
- for (let i in response.variables.data) {
|
|
|
- response.variables.data[i].jie_yang_shu_lian = 1
|
|
|
- response.variables.data[i].jie_yang_zhuang_t = '已确认'
|
|
|
- this.listData.push(response.variables.data[i])
|
|
|
- // this.OriginalPosition.push(response.variables.data[i].shi_fou_liu_yang_ == "是" ? response.variables.data[i].liu_yang_wei_zhi_ : response.variables.data[i].shou_yang_wei_zhi)
|
|
|
- }
|
|
|
- console.log('All data',this.listData)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
loadDataBySQL(page) {
|
|
|
// 扫码扫到新数据,查询 并分页 回填展示
|
|
|
let countSQL = `select count(*) as count from t_mjypb where jie_yang_zhuang_t = '待确认'`
|
|
|
let str = (page-1)*10
|
|
|
- let fysql = `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 = '待确认' limit ${str},10`
|
|
|
+ let fysql = `select ypb.*,sqb.fu_kuan_fang_shi_,sqb.fu_he_yuan_,sqb.ye_mian_zong_zhua,lian_xi_ren_ from t_mjypb ypb JOIN t_mjwtsqb sqb on ypb.wai_jian_ = sqb.id_ and ypb.jie_yang_zhuang_t = '待确认' order by yang_pin_bian_hao asc limit ${str},10`
|
|
|
Promise.all([repostCurd('sql', countSQL), repostCurd('sql', fysql)]).then(([res1, res]) => {
|
|
|
this.listData = []
|
|
|
this.pageCount = res1.variables.data[0].count
|
|
|
- if (res.variables.data && res.variables.data.length > 0) {
|
|
|
- for (let i in res.variables.data) {
|
|
|
- res.variables.data[i].jie_yang_shu_lian = 1
|
|
|
- res.variables.data[i].jie_yang_zhuang_t = '已确认'
|
|
|
- // res.variables.data[i].biao_zhi_uuid_ = this.uuid()
|
|
|
- this.listData.push(res.variables.data[i])
|
|
|
- // this.OriginalPosition.push(res.variables.data[i].shi_fou_liu_yang_ == "是" ? res.variables.data[i].liu_yang_wei_zhi_ : res.variables.data[i].shou_yang_wei_zhi)
|
|
|
- }
|
|
|
+ const { data } = res.variables || []
|
|
|
+ if (data.length > 0) {
|
|
|
+ data.forEach(item=>{
|
|
|
+ item.jie_yang_shu_lian = 1
|
|
|
+ item.jie_yang_zhuang_t = '已确认'
|
|
|
+ this.listData.push(item)
|
|
|
+ })
|
|
|
+ console.log('Init Data',this.listData)
|
|
|
}else{
|
|
|
this.dontHaveSample();
|
|
|
}
|
|
|
@@ -66,16 +49,65 @@ export default {
|
|
|
this.closeDialog();
|
|
|
}).catch(_ => {});
|
|
|
},
|
|
|
-
|
|
|
+ handleLocationInfo(currentPosition, isLiuYang, positionDatas, positionIds, item, currentTime) {
|
|
|
+ !positionIds.has(currentPosition) ? positionIds.add(currentPosition) : positionDatas.find(i => i.id_ === currentPosition).wei_zhi_zhuang_ta = '占用'
|
|
|
+ if (positionDatas.find(i => i.id_ === currentPosition)!=undefined && positionDatas.find(i => i.id_ === currentPosition).wei_zhi_zhuang_ta === '空余') {
|
|
|
+ let obj = {
|
|
|
+ where: {
|
|
|
+ id_: currentPosition
|
|
|
+ },
|
|
|
+ param: {
|
|
|
+ wei_zhi_zhuang_ta: "占用",
|
|
|
+ ru_ku_shi_jian_: currentTime,
|
|
|
+ yang_pin_bian_hao: item.yang_pin_bian_hao,
|
|
|
+ yang_pin_ming_che: item.yang_pin_ming_che,
|
|
|
+ shi_fou_liu_yang_: isLiuYang
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let result = {
|
|
|
+ name: 'emptyPosition',
|
|
|
+ value: obj
|
|
|
+ }
|
|
|
+ return result
|
|
|
+ } else { // 新增一条位置信息(修改它的样品编号,样品名称,入库时间,标识UUID)
|
|
|
+ let sampleInfo = {
|
|
|
+ yang_pin_bian_hao: item.yang_pin_bian_hao,
|
|
|
+ yang_pin_ming_che: item.yang_pin_ming_che,
|
|
|
+ ru_ku_shi_jian_: currentTime,
|
|
|
+ biao_zhi_uuid_: item.biao_zhi_uuid_,
|
|
|
+ shi_fou_liu_yang_: isLiuYang
|
|
|
+ }
|
|
|
+ let newPosition = this.generateNewPosition(positionDatas.find(i => i.id_ === currentPosition), sampleInfo)
|
|
|
+ let result = {
|
|
|
+ name: 'fullPosition',
|
|
|
+ value: newPosition
|
|
|
+ }
|
|
|
+ return result
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 根据旧位置数据生成新位置数据
|
|
|
+ generateNewPosition(oldLocation, sampleInfo) {
|
|
|
+ let temp = {
|
|
|
+ fang_jian_lei_xin: oldLocation.fang_jian_lei_xin,
|
|
|
+ qu_yu_: oldLocation.qu_yu_,
|
|
|
+ huo_jia_lei_xing_: oldLocation.huo_jia_lei_xing_,
|
|
|
+ huo_jia_hao_: oldLocation.huo_jia_hao_,
|
|
|
+ gua_jia_hao_:oldLocation.gua_jia_hao_ || '',
|
|
|
+ ceng_hao_: oldLocation.ceng_hao_,
|
|
|
+ wei_zhi_bian_hao_: oldLocation.wei_zhi_bian_hao_,
|
|
|
+ wei_zhi_zhuang_ta: oldLocation.wei_zhi_zhuang_ta,
|
|
|
+ cun_fang_lei_xing: oldLocation.cun_fang_lei_xing,
|
|
|
+ cun_chu_tiao_jian: oldLocation.cun_chu_tiao_jian,
|
|
|
+ yang_pin_bian_hao: sampleInfo.yang_pin_bian_hao,
|
|
|
+ yang_pin_ming_che: sampleInfo.yang_pin_ming_che,
|
|
|
+ ru_ku_shi_jian_: sampleInfo.ru_ku_shi_jian_,
|
|
|
+ shi_fou_liu_yang_: sampleInfo.shi_fou_liu_yang_,
|
|
|
+ shou_yang_ri_qi_: sampleInfo.biao_zhi_uuid_,
|
|
|
+ }
|
|
|
+ return temp
|
|
|
+ },
|
|
|
submitData(type) {
|
|
|
- // this指针
|
|
|
- let this_ = this;
|
|
|
- let changeWeizhi;
|
|
|
- let changesyWeizhi;
|
|
|
- // 回传关闭事件。隐藏当前组件。
|
|
|
- let judge = true;
|
|
|
-
|
|
|
- if (this_.listData.length == 0) {
|
|
|
+ if (this.listData.length == 0) {
|
|
|
this.$emit('callback', true)
|
|
|
this.visable = false
|
|
|
this.$message({
|
|
|
@@ -85,357 +117,232 @@ export default {
|
|
|
this.closeDialog();
|
|
|
} else {
|
|
|
this.$confirm('请再次确认 [样品接收信息]').then(_ => {
|
|
|
-
|
|
|
// 获取样品列表
|
|
|
- let ypInfoList = this_.listData
|
|
|
-
|
|
|
- let dWhere = []
|
|
|
- let ypbh = []
|
|
|
- let cfwzIdList = [] // 放置 存放位置的ID
|
|
|
- let uuidList = [] // 列表的UUID
|
|
|
-
|
|
|
- let ypIdList = [] // 样品id列表,格式转好的
|
|
|
- let ypWeiZhi = [] // 样品收样位置
|
|
|
- let ypLiuYangWeiZhi = [] // 样品留样位置
|
|
|
- let saoMaNumList = [] // 扫码确认数量列表
|
|
|
- let jieYangQueRenZTList = [] // 接样状态列表
|
|
|
-
|
|
|
- let ypbhList = [] // 样品编号列表
|
|
|
- let mjypbList = [] // 明鉴样品表
|
|
|
- let mjypbWJ = [] // 明鉴样品表外键
|
|
|
- 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;
|
|
|
+ let ypInfoList = this.listData
|
|
|
+ const currentTime = new Date(new Date().getTime() + 28800000).toJSON().slice(0, 16).replace('T', ' ')
|
|
|
+ // 优化对象
|
|
|
+ let positionArr = [] // 位置数组
|
|
|
+ let positionIdSet = new Set() // 位置ID集合
|
|
|
+ let ypdjbList = []
|
|
|
+ let ypbList = []
|
|
|
+ let ypbForeignKeyList = []
|
|
|
+ let zsbIdList = []
|
|
|
+ let taskList = []
|
|
|
+ let allUUID = []
|
|
|
+ // 1、确认样品数量,位置(数据校验)
|
|
|
+ for(let item of ypInfoList){
|
|
|
+ if(item.jie_yang_shu_lian > item.shou_yang_shu_lia){
|
|
|
+ this.$message.error('操作失败,[' +item.yang_pin_ming_che + '] 接收确认数量不得大于收样数量。')
|
|
|
+ return;
|
|
|
}
|
|
|
- if (ypInfoList[yp].jie_yang_zhuang_t == '待确认') {
|
|
|
- this_.$message.error('操作失败,[' + ypInfoList[yp].yang_pin_ming_che + '] 接收确认状态必须为已确认。')
|
|
|
- return;
|
|
|
+ if(item.jie_yang_zhuang_t == '待确认'){
|
|
|
+ this.$message.error('操作失败,[' + item.yang_pin_ming_che + '] 接收确认状态必须为已确认。')
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
- if (ypInfoList[yp].shi_fou_liu_yang_ == "是") {
|
|
|
- if (ypInfoList[yp].liu_yang_wei_zhi_ == null || ypInfoList[yp].liu_yang_wei_zhi_ == '') {
|
|
|
- this_.$message.error("你要留样的话,存放位置不能为空哦!")
|
|
|
+ if(item.shi_fou_liu_yang_ == "否" && (item.shou_yang_wei_zhi == null || item.shou_yang_wei_zhi == '') ){
|
|
|
+ this.$message.error("收样存放位置不能为空!")
|
|
|
return;
|
|
|
- }
|
|
|
- cfwzObj.push(ypInfoList[yp].liu_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(cfwzObj)
|
|
|
- ypIdList.push('{"id_":"' + ypInfoList[yp].id_ + '"}')
|
|
|
- ypWeiZhi.push(ypInfoList[yp].shou_yang_wei_zhi) // 收样存放位置
|
|
|
- ypLiuYangWeiZhi.push(ypInfoList[yp].liu_yang_wei_zhi_) // 留样存放位置
|
|
|
- saoMaNumList.push(ypInfoList[yp].jie_yang_shu_lian) // 扫码数量
|
|
|
- jieYangQueRenZTList.push(ypInfoList[yp].jie_yang_zhuang_t) // 接收确认状态
|
|
|
- ypbhList.push('{"yang_pin_bian_hao":"' + ypInfoList[yp].yang_pin_bian_hao + '"}') // 样品编号列表
|
|
|
- ypmcList.push(ypInfoList[yp].yang_pin_ming_che)
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- for (let index in ypIdList) { // 更新样品登记表 样品表
|
|
|
- let WZtem = ypWeiZhi[index] == null ? '' : ypWeiZhi[index]
|
|
|
- let LYWZtem = ypLiuYangWeiZhi[index] == null ? '' : ypLiuYangWeiZhi[index]
|
|
|
- changeWeizhi = WZtem;
|
|
|
- changesyWeizhi = LYWZtem;
|
|
|
- repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + ypbhList[index] + ',"paramCond":' + '{"shou_yang_wei_zhi":"' + WZtem + '","jie_yang_shu_lian":"' + saoMaNumList[index] + '","jie_yang_zhuang_t":"' + jieYangQueRenZTList[index] + '","liu_yang_wei_zhi_":"' + LYWZtem + '"}}')
|
|
|
-
|
|
|
- repostCurd('update','{"tableName":"t_mjypb","paramWhere":' + ypIdList[index] + ',"paramCond":' + '{"jie_yang_zhuang_t":"已确认","cun_fang_wei_zhi_":"'+WZtem+'","liu_yang_cun_fang":"'+LYWZtem+'"}}')
|
|
|
+ if(item.shi_fou_liu_yang_ == "是" && (item.liu_yang_wei_zhi_ == null || item.liu_yang_wei_zhi_ == '') ){
|
|
|
+ this.$message.error("你要留样的话,存放位置不能为空哦!")
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ positionArr.push(item.shou_yang_wei_zhi,item.liu_yang_wei_zhi_)
|
|
|
}
|
|
|
-
|
|
|
- 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
|
|
|
+ // 2、整理样品位置信息
|
|
|
+ let positionStr = positionArr.filter(i => i).join(',')
|
|
|
+ var allPositionSql = `select * from t_mjypcfwz where find_in_set(id_,'${positionStr}')`// 搜集所有选择的位置信息
|
|
|
+ repostCurd('sql', allPositionSql).then(res => {
|
|
|
+ let { data } = res.variables || []
|
|
|
+ // console.log(data)
|
|
|
+ let handleResult = []
|
|
|
+ this.emptyPosition = []
|
|
|
+ this.fullPosition = []
|
|
|
+ ypInfoList.forEach(item=>{
|
|
|
+ allUUID.push(item.biao_zhi_uuid_)
|
|
|
+ if(item.shou_yang_wei_zhi != undefined && item.shou_yang_wei_zhi){
|
|
|
+ handleResult.push(this.handleLocationInfo(item.shou_yang_wei_zhi,'否',data,positionIdSet,item,currentTime))
|
|
|
+ }
|
|
|
+ if(item.liu_yang_wei_zhi_ != undefined && item.liu_yang_wei_zhi_){
|
|
|
+ handleResult.push(this.handleLocationInfo(item.liu_yang_wei_zhi_,'是',data,positionIdSet,item,currentTime))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let allUUIDStr = allUUID.filter(i => i).join(',')
|
|
|
+ handleResult.forEach(item=>{
|
|
|
+ item.name === 'emptyPosition' ? this.emptyPosition.push(item.value) : this.fullPosition.push(item.value)
|
|
|
+ })
|
|
|
+ console.log('sample_empty_position',this.emptyPosition)
|
|
|
+ console.log('sample_full_position',this.fullPosition)
|
|
|
+ if(this.emptyPosition.length > 0){
|
|
|
+ let allParams = {
|
|
|
+ tableName: 't_mjypcfwz',
|
|
|
+ updList: this.emptyPosition
|
|
|
+ }
|
|
|
+ repostCurd('updatesByWhere',JSON.stringify(allParams))
|
|
|
+ }
|
|
|
+ repostCurd('add', '{"tableName":"t_mjypcfwz","paramWhere":' + JSON.stringify(this.fullPosition) + '}').then(res => {
|
|
|
+ // 再次查询位置表,对比当前样品列表 替换初始值为占用的样品位置id
|
|
|
+ let findPositionAgain = `select id_,shi_fou_liu_yang_,shou_yang_ri_qi_ from t_mjypcfwz where find_in_set(shou_yang_ri_qi_,'${allUUIDStr}')`
|
|
|
+ repostCurd('sql', findPositionAgain).then(res => {
|
|
|
+ const { data } = res.variables || []
|
|
|
+ console.log('add_position_res',data)
|
|
|
+ data.forEach(item=>{
|
|
|
+ let ypIndex = ypInfoList.findIndex(i => i.biao_zhi_uuid_ === item.shou_yang_ri_qi_)
|
|
|
+ if(ypIndex != -1){
|
|
|
+ item.shi_fou_liu_yang_ === '否'?ypInfoList[ypIndex].shou_yang_wei_zhi = item.id_ : ypInfoList[ypIndex].liu_yang_wei_zhi_ = item.id_
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 所有数据整理完毕 开始封装对象😊
|
|
|
+ ypInfoList.forEach(item=>{
|
|
|
+ // 3、整理样品登记表数据(更新样品登记表)
|
|
|
+ let ypdjbObj = {
|
|
|
+ where:{
|
|
|
+ yang_pin_bian_hao:item.yang_pin_bian_hao
|
|
|
+ },
|
|
|
+ param:{
|
|
|
+ shou_yang_wei_zhi:item.shou_yang_wei_zhi || '',
|
|
|
+ liu_yang_wei_zhi_:item.liu_yang_wei_zhi_ || '',
|
|
|
+ jie_yang_shu_lian:item.jie_yang_shu_lian,
|
|
|
+ jie_yang_zhuang_t:"已确认"
|
|
|
+ },
|
|
|
+ }
|
|
|
+ // 4、整理样品表数据(更新样品表)
|
|
|
+ let ypbObj = {
|
|
|
+ where:{
|
|
|
+ id_:item.id_
|
|
|
+ },
|
|
|
+ param:{
|
|
|
+ cun_fang_wei_zhi_:item.shou_yang_wei_zhi || '',
|
|
|
+ liu_yang_cun_fang:item.liu_yang_wei_zhi_ || '',
|
|
|
+ jie_yang_zhuang_t:"已确认"
|
|
|
+ },
|
|
|
+ }
|
|
|
+ // 整理任务分配表数据
|
|
|
+ let taskItem = {
|
|
|
+ yang_pin_bian_hao: item.yang_pin_bian_hao, // 取对应的样品编号
|
|
|
+ yang_pin_ming_che : item.yang_pin_ming_che, // 对应的样品名称
|
|
|
+ yang_pin_dai_ci_ : item.dai_ci_ , // 对应的样品代次
|
|
|
+ yang_pin_pi_hao_ : item.pi_hao_, // 对应的样品批号
|
|
|
+ yang_pin_shu_lian : item.yang_pin_zong_shu, // 对应的样品数量
|
|
|
+ bug_ri_qi_ : item.song_yang_ri_qi_, // 对应的送样日期
|
|
|
+ cun_fang_wei_zhi_ : item.shou_yang_wei_zhi,
|
|
|
+ wei_tuo_wai_jian_ : item.wai_jian_ , // 检测申请单id
|
|
|
+ he_tong_wai_jian_ : item.he_tong_bian_hao_, //合同id
|
|
|
+ song_yang_ri_qi_ : item.biao_zhi_uuid_, // 收样日期
|
|
|
+ wei_tuo_ren_ : item.lian_xi_ren_ , // 委托人
|
|
|
+ bao_gao_jian_ce_s : currentTime, // 检测时间
|
|
|
+ zhan_shi_biao_wai : item.ye_mian_zong_zhua,
|
|
|
+ zhuang_tai_ : "任务待分配" , // 状态
|
|
|
+ yang_pin_bei_zhu_ : item.bei_zhu_, // 样品备注
|
|
|
+ shi_fou_jia_ji_ : item.fu_kuan_fang_shi_ ,// 2023-2-24吴懿要加的
|
|
|
+ wu_jun_shi_fou_ch : item.fu_he_yuan_ // 2023-3-6 王嘎嘎加
|
|
|
+ }
|
|
|
+ // ypbForeignKeyList.push('{"id_":"'+item.wai_jian_+'"}')
|
|
|
+ // zsbIdList.push('{"shen_qing_id_":"' + item.ye_mian_zong_zhua + '"}')
|
|
|
+ ypbForeignKeyList.push({id_:item.wai_jian_})
|
|
|
+ zsbIdList.push({shen_qing_id_:item.ye_mian_zong_zhua})
|
|
|
+ ypdjbList.push(ypdjbObj)
|
|
|
+ ypbList.push(ypbObj)
|
|
|
+ taskList.push(taskItem)
|
|
|
+ })
|
|
|
+ const ypbForeignKeyFilterList = [...new Set(ypbForeignKeyList)]
|
|
|
+ const zsbIdFilterList = [...new Set(zsbIdList)] // 这步因上面存储的是对象,所以去重不了,后续优化
|
|
|
+ console.log("样品外键List",ypbForeignKeyFilterList)
|
|
|
+ console.log("展示表主键List",zsbIdFilterList)
|
|
|
+ let ypdjbParams = {
|
|
|
+ tableName: "t_mjypdjb",
|
|
|
+ updList: ypdjbList
|
|
|
}
|
|
|
- let content = {
|
|
|
- id_ : cfwzIdList[num][index]
|
|
|
+
|
|
|
+ let ypbParams = {
|
|
|
+ tableName: "t_mjypb",
|
|
|
+ updList: ypbList
|
|
|
}
|
|
|
- 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
|
|
|
+
|
|
|
+
|
|
|
+ // 5、更新t_mjwtsqb -> "zhuang_tai_":"已完成" , "jian_ce_kai_shi_s"
|
|
|
+ let up_Wtsqb_Obj = {
|
|
|
+ tableName:"t_mjwtsqb",
|
|
|
+ paramWhere:ypbForeignKeyFilterList,
|
|
|
+ paramCond:{
|
|
|
+ zhuang_tai_: "已完成",
|
|
|
+ jian_ce_kai_shi_s:currentTime
|
|
|
+ }
|
|
|
}
|
|
|
- let o = {
|
|
|
- tableName:'t_mjypcfwz',
|
|
|
- paramWhere:content,
|
|
|
- paramCond : params
|
|
|
+
|
|
|
+ // 6、更新t_mjwtzsb -> "zhuang_tai_":"任务分配进行中" 需不需要再根据样品编号比对,因为此表同个单的id是一样的
|
|
|
+ let up_zsb_Obj = {
|
|
|
+ tableName:"t_mjwtzsb",
|
|
|
+ paramWhere:zsbIdFilterList,
|
|
|
+ paramCond:{
|
|
|
+ zhuang_tai_: "任务分配进行中"
|
|
|
+ }
|
|
|
}
|
|
|
- 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)
|
|
|
+
|
|
|
+
|
|
|
+ // 7、添加 t_rwfpb 开启任务流程(遍历样品表开任务分配流程,一个样品对应多个检测时,循环开启)
|
|
|
+ let add_task_Obj = {
|
|
|
+ tableName: "t_rwfpb",
|
|
|
+ paramWhere:taskList,
|
|
|
+ defKey:"Process_04tgh24",
|
|
|
+ formKey:"mjrwfp"
|
|
|
+ }
|
|
|
+ console.log("add_taskList",add_task_Obj)
|
|
|
+ repostCurd('add', JSON.stringify(add_task_Obj)).then(res=>{
|
|
|
+ console.log('up_委托单',up_Wtsqb_Obj)
|
|
|
+ repostCurd('updates', JSON.stringify(up_Wtsqb_Obj)).then(res=>{
|
|
|
+ console.log('up_展示表',up_zsb_Obj)
|
|
|
+ repostCurd('updates', JSON.stringify(up_zsb_Obj))
|
|
|
+ }).catch(error =>{
|
|
|
+ console.log(error)
|
|
|
+ this.handleAnySituation(true,"委托单数据修改失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
+ })
|
|
|
+ console.log('up_ypb',ypbParams)
|
|
|
+ repostCurd('updatesByWhere', JSON.stringify(ypbParams)).then(res=>{
|
|
|
+ console.log('up_ypdjb',ypdjbParams)
|
|
|
+ repostCurd('updatesByWhere', JSON.stringify(ypdjbParams)).then(re=>{
|
|
|
+ this.handleAnySituation(true,"样品成功接收,正在开启任务分配!",'success')
|
|
|
+ }).catch(error =>{
|
|
|
+ console.log(error)
|
|
|
+ this.handleAnySituation(true,"样品登记表数据添加失败!请勿关闭此页面,联系开发人员解决",'error')
|
|
|
+ })
|
|
|
})
|
|
|
- }
|
|
|
})
|
|
|
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- repostCurd('selects', '{"tableName":"t_mjypb","paramWhere":[' + ypbhList + ']}').then(response => {
|
|
|
- mjypbList = response.variables.data
|
|
|
- let wjList = []
|
|
|
- let wjAll = []
|
|
|
- let wjAllList = []
|
|
|
- for (let i in mjypbList) {
|
|
|
- wjList.push(mjypbList[i].wai_jian_)
|
|
|
- wjAll.push(mjypbList[i].wai_jian_)
|
|
|
- }
|
|
|
- wjList = this_.unique(wjList)
|
|
|
- for (let i in wjList) {
|
|
|
- mjypbWJ.push('{"id_":"' + wjList[i] + '"}')
|
|
|
- }
|
|
|
- for (let i in wjAll) {
|
|
|
- wjAllList.push('{"id_":"' + wjAll[i] + '"}')
|
|
|
- }
|
|
|
- repostCurd('updates', '{"tableName":"t_mjwtsqb","paramWhere":[' + mjypbWJ + '],"paramCond":{"zhuang_tai_":"已完成"}}')
|
|
|
- let mjwtsqbAllResult = []
|
|
|
- let mjwtsqbIdList = []
|
|
|
- let mjfbbList = []
|
|
|
- let mjfbbWJList = []
|
|
|
- for (let i in wjAllList) {
|
|
|
- repostCurd('select', '{"tableName":"t_mjwtsqb","paramWhere":' + wjAllList[i] + '}').then(response => {
|
|
|
- mjfbbWJList.push('{"wei_tuo_wai_jian_":"' + response.variables.data[0].id_ + '"}')
|
|
|
- mjwtsqbAllResult.push(response.variables.data[0])
|
|
|
- mjwtsqbIdList.push('{"id_":"' + response.variables.data[0].id_ + '"}')
|
|
|
- })
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- let narr = []
|
|
|
- for (let a of mjfbbWJList) {
|
|
|
- narr.push(a)
|
|
|
- }
|
|
|
- repostCurd('selects', '{"tableName":"t_mjfbb","paramWhere":[' + narr + ']}').then(response => {
|
|
|
- mjfbbList.push(response.variables.data)
|
|
|
- })
|
|
|
- }, 1000)
|
|
|
-
|
|
|
- setTimeout(() => {
|
|
|
- let rwb = []
|
|
|
- let index = 0
|
|
|
- if (mjypbList != null && mjypbList.length >= 1) {
|
|
|
- index = mjypbList[0].jian_ce_xiang_me_.split(",").length + mjypbList[0].jian_ce_xiang_mu2
|
|
|
- .split(",").length + mjypbList[0].jian_ce_xiang_ms_
|
|
|
- .split(",").length+ mjypbList[0].jian_ce_xiang_si_
|
|
|
- .split(",").length -1
|
|
|
- }
|
|
|
- console.log('final',mjypbList)
|
|
|
- for (var i in mjypbList) {
|
|
|
- let rwzb = {}
|
|
|
- // let yplxAll = ''
|
|
|
- // if(mjypbList[i].yang_pin_lei_xy_ != null){
|
|
|
- // yplxAll += mjypbList[i].yang_pin_lei_xy_ + ","
|
|
|
- // }
|
|
|
- // if(mjypbList[i].yang_pin_lei_xe != null){
|
|
|
- // yplxAll += mjypbList[i].yang_pin_lei_xe + ","
|
|
|
- // }
|
|
|
- // if(mjypbList[i].yang_pin_lei_xs != null){
|
|
|
- // yplxAll += mjypbList[i].yang_pin_lei_xs + ","
|
|
|
- // }
|
|
|
- // if(mjypbList[i].yang_pin_lei_xsi != null){
|
|
|
- // yplxAll += mjypbList[i].yang_pin_lei_xsi + ","
|
|
|
- // }
|
|
|
- // yplxAll = yplxAll.substr(0, yplxAll.length - 1)
|
|
|
- // 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
|
|
|
- // console.log(wz_)
|
|
|
- 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_ // 对应的样品代次
|
|
|
- rwzb["yang_pin_pi_hao_"] = mjypbList[i].pi_hao_ // 对应的样品批号
|
|
|
- rwzb["yang_pin_shu_lian"] = mjypbList[i].yang_pin_zong_shu // 对应的样品数量
|
|
|
- rwzb["bug_ri_qi_"] = mjypbList[i].song_yang_ri_qi_ // 对应的送样日期
|
|
|
- rwzb["cun_fang_wei_zhi_"] = wz_
|
|
|
- rwzb["wei_tuo_wai_jian_"] = mjypbList[i].wai_jian_ // 检测申请单id
|
|
|
- rwzb["he_tong_wai_jian_"] = mjwtsqbAllResult[i].he_tong_bian_hao_ //合同id
|
|
|
- rwzb["song_yang_ri_qi_"] = mjypbList[i].biao_zhi_uuid_ // 收样日期
|
|
|
- rwzb["wei_tuo_ren_"] = mjwtsqbAllResult[i].lian_xi_ren_ // 委托人
|
|
|
- rwzb["bao_gao_jian_ce_s"] = this_.dateFormat() // 检测时间
|
|
|
- rwzb["zhan_shi_biao_wai"] = mjwtsqbAllResult[i].ye_mian_zong_zhua
|
|
|
- rwzb["zhuang_tai_"] = "任务待分配" // 状态
|
|
|
- // rwzb["gong_xian_zhi_"] = mjypbList[i].yang_pin_lei_xin // 供限值
|
|
|
- rwzb["yang_pin_bei_zhu_"] = mjypbList[i].bei_zhu_ // 样品备注
|
|
|
- // rwzb["yang_pin_lei_xing"] = yplxAll //23/1/10号 吴懿说不要了
|
|
|
- rwzb["shi_fou_jia_ji_"] = mjwtsqbAllResult[i].fu_kuan_fang_shi_ // 2023-2-24吴懿要加的
|
|
|
- rwzb["wu_jun_shi_fou_ch"] = mjwtsqbAllResult[i].fu_he_yuan_ // 2023-3-6 王嘎嘎加
|
|
|
- rwb.push(rwzb)
|
|
|
- // let str = mjypbList[i].jian_ce_xiang_mu2.split(",")
|
|
|
- // for (var p in str) {
|
|
|
- // // console.log('坐标',i,p)
|
|
|
- // let temp = index - p
|
|
|
- // let rwzb = {}
|
|
|
- // let wz_ = ypInfoList[i].shi_fou_liu_yang_ == "是" ? ypInfoList[i].liu_yang_wei_zhi_ : ypInfoList[i].shou_yang_wei_zhi // 对应的样品存放位置
|
|
|
- // rwzb["jian_ce_xiang_mu_"] = str[p] // 取当前检测项目
|
|
|
- // 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_ // 对应的样品代次
|
|
|
- // rwzb["yang_pin_pi_hao_"] = mjypbList[i].pi_hao_ // 对应的样品批号
|
|
|
- // rwzb["yang_pin_shu_lian"] = mjypbList[i].shu_liang_ // 对应的样品数量
|
|
|
- // rwzb["bug_ri_qi_"] = mjypbList[i].song_yang_ri_qi_ // 对应的送样日期
|
|
|
- // rwzb["cun_fang_wei_zhi_"] = wz_
|
|
|
- // rwzb["wei_tuo_wai_jian_"] = mjypbList[i].wai_jian_ // 检测申请单id
|
|
|
- // rwzb["he_tong_wai_jian_"] = mjwtsqbAllResult[i].he_tong_bian_hao_ //合同id
|
|
|
- // rwzb["song_yang_ri_qi_"] = mjypbList[i].biao_zhi_uuid_ // 收样日期
|
|
|
- // rwzb["wei_tuo_ren_"] = mjwtsqbAllResult[i].lian_xi_ren_ // 委托人
|
|
|
- // rwzb["bao_gao_jian_ce_s"] = this_.dateFormat() // 检测时间
|
|
|
- // rwzb["zhan_shi_biao_wai"] = mjwtsqbAllResult[i].ye_mian_zong_zhua
|
|
|
- // rwzb["zhuang_tai_"] = "任务待分配" // 状态
|
|
|
- // rwzb["shi_fou_fen_bao_"] = mjfbbList[0][temp].shi_fou_fen_bao_ // 是否分包
|
|
|
- // rwzb["qi_wang_wan_cheng"] = mjfbbList[0][temp].wan_cheng_shi_jia // 期望完成时间
|
|
|
- // rwzb["gong_xian_zhi_"] = mjypbList[i].yang_pin_lei_xin // 供限值
|
|
|
- // rwb.push(rwzb)
|
|
|
- // }
|
|
|
- // index += str.length
|
|
|
- }
|
|
|
- console.log('任务表:',rwb)
|
|
|
-
|
|
|
- repostCurd('updates', '{"tableName":"t_mjwtsqb","paramWhere":[' + mjwtsqbIdList + '],"paramCond":{"jian_ce_kai_shi_s":"' + this_.dateFormat() + '"}}')
|
|
|
- let uidList = []
|
|
|
- for (let item of mjwtsqbAllResult) {
|
|
|
- uidList.push(item.ye_mian_zong_zhua)
|
|
|
- }
|
|
|
- uidList = this_.unique(uidList)
|
|
|
- repostCurd('add', '{"tableName":"t_rwfpb","paramWhere":' + JSON.stringify(rwb) + ',"defKey":"Process_04tgh24","formKey":"mjrwfp"}')
|
|
|
- if (uidList.length > 0) {
|
|
|
- let ups = []
|
|
|
- for (let t of uidList) {
|
|
|
- ups.push('{"shen_qing_id_":"' + t + '"}')
|
|
|
- }
|
|
|
- repostCurd('updates', '{"tableName":"t_mjwtzsb","paramWhere":[' + ups + '],"paramCond":{"zhuang_tai_":"任务分配进行中"}}')
|
|
|
- }
|
|
|
- }, 5000)
|
|
|
- })
|
|
|
-
|
|
|
- // */
|
|
|
- this.$emit('callback', true)
|
|
|
- this.visable = false
|
|
|
- this.$message({
|
|
|
- message: '样品接收确认操作成功!',
|
|
|
- type: 'success'
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
- this.closeDialog();
|
|
|
}).catch(_ => {});
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
+ handleAnySituation(callBackBool,msg,type){
|
|
|
+ this.$emit('callback', callBackBool)
|
|
|
+ this.visable = false
|
|
|
+ this.$message({
|
|
|
+ message: msg,
|
|
|
+ type: type
|
|
|
+ })
|
|
|
+ this.closeDialog();
|
|
|
+ },
|
|
|
/* 去除指定行数据 使用过滤器filter过滤指定行号数据 */
|
|
|
deleteData(val) {
|
|
|
this.listData = this.listData.filter((data) => {
|
|
|
return data.id_ != val
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- unique(arr) {
|
|
|
- return arr.filter((item, index) => {
|
|
|
- return arr.indexOf(item, 0) === index;
|
|
|
- });
|
|
|
- },
|
|
|
- Update(name, where, cond) {
|
|
|
- let cont = {}
|
|
|
- cont['tableName'] = name
|
|
|
- cont['paramWhere'] = where
|
|
|
- cont['paramCond'] = cond
|
|
|
- return repostCurd('update', JSON.stringify(cont))
|
|
|
- },
|
|
|
-
|
|
|
- /* zzj add */
|
|
|
- dateFormat() { // 获取当前时间
|
|
|
- var date = new Date();
|
|
|
- var year = date.getFullYear();
|
|
|
- var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
|
|
|
- var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
|
|
- return year + "-" + month + "-" + day;
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
+ unique(arr) { // 可以去重对象的
|
|
|
+ return arr.filter((item, index) => {
|
|
|
+ return arr.indexOf(item, 0) === index;
|
|
|
+ });
|
|
|
+ },
|
|
|
/* 关闭*/
|
|
|
remRedar() {
|
|
|
this.visible = false // 列表隐藏
|
|
|
this.listData = [] // 清空列表数据
|
|
|
this.redar = false // 扫码图标隐藏
|
|
|
this.$emit('scanOff', false)
|
|
|
- },
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
}
|