sampleConfirmationJS.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. import repostCurd from '@/business/platform/form/utils/custom/joinCURD.js'
  2. export default {
  3. methods: {
  4. /* 唤醒扫码 前端脚本直接调用*/
  5. openRedar(type) {
  6. this.redar = true // 扫码图标显示
  7. this.visible = false // 结果列表,一开始为false
  8. this.$refs.redarInput.focus(); // 聚焦input
  9. this.listData = [] // 清空列表
  10. },
  11. facilityData(id) {
  12. if (!id) return // 无参直接反
  13. this.loadData(id)
  14. //开始查询设备
  15. this.facilityId = ''
  16. },
  17. /* 获取数据 ,开始查阅记录 */
  18. loadData(id) {
  19. // let this_ = this
  20. let flag = true // 重复扫码标志位
  21. for (let index in this.listData) { // 判断是否重复,重复扫码 数量自增
  22. if (this.listData[index].yang_pin_bian_hao == id) {
  23. this.listData[index].jie_yang_shu_lian = this.listData[index].jie_yang_shu_lian + 1
  24. flag = false
  25. }
  26. }
  27. // 扫码扫到新数据,查询 回填展示
  28. if(flag){
  29. // repostCurd('select','{"tableName": "t_mjypdjb","paramWhere":{"yang_pin_bian_hao":"S220909-1053"}}').then(response => {
  30. 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}'`
  31. repostCurd('sql',sql).then(response => {
  32. if (response.variables.data && response.variables.data.length > 0) {
  33. response.variables.data[0].jie_yang_shu_lian = 1
  34. response.variables.data[0].jie_yang_zhuang_t = '已确认'
  35. this.listData.push(response.variables.data[0])
  36. // 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)
  37. }else{
  38. this.cancelScan();
  39. }
  40. })
  41. }
  42. },
  43. /* 列表失去焦点*/
  44. handleChange(){
  45. this.$refs.redarInput.focus(); //聚焦input
  46. },
  47. /* 扫出的样品不符合条件 */
  48. cancelScan(){
  49. this.redar = false // 扫码图标显示
  50. this.$confirm('该样品可能已经接收过了,无需重复接收!').then(_ => {
  51. this.closeDialog();
  52. })
  53. },
  54. /* 关闭弹出列表框*/
  55. closeDialog() {
  56. this.remRedar()
  57. //回传关闭事件。隐藏当前组件。
  58. },
  59. handleClose(){
  60. this.handleChange()
  61. this.$confirm('确认关闭扫码列表页面?').then(_ => {
  62. this.closeDialog();
  63. }).catch(_ => {
  64. });
  65. },
  66. submitData(type) {
  67. // this指针
  68. let this_ = this;
  69. let changeWeizhi;
  70. let changesyWeizhi;
  71. // 回传关闭事件。隐藏当前组件。
  72. let judge = true;
  73. this.$confirm('请再次确认 [样品接收信息]').then(_ => {
  74. // 获取样品列表
  75. let ypInfoList = this_.listData
  76. // console.log(ypInfoList)
  77. let dWhere = []
  78. let ypbh = []
  79. let cfwzIdList = [] // 放置 存放位置的ID
  80. let uuidList = [] // 列表的UUID
  81. let ypIdList = [] // 样品id列表,格式转好的
  82. let ypWeiZhi = [] // 样品收样位置
  83. let ypLiuYangWeiZhi = [] // 样品留样位置
  84. let saoMaNumList = [] // 扫码确认数量列表
  85. let jieYangQueRenZTList = [] // 接样状态列表
  86. let ypbhList = [] // 样品编号列表
  87. let mjypbList = [] // 明鉴样品表
  88. let mjypbWJ = [] // 明鉴样品表外键
  89. let ypmcList = []
  90. for(let yp in ypInfoList){
  91. let cfwzObj = []
  92. let cfwz = ''
  93. cfwzObj.push(ypInfoList[yp].shou_yang_wei_zhi) //取位置信息
  94. if(ypInfoList[yp].jie_yang_shu_lian > ypInfoList[yp].shou_yang_shu_lia){
  95. this_.$message.error('操作失败,['+ypInfoList[yp].yang_pin_ming_che+'] 接收确认数量不得大于收样数量。')
  96. return;
  97. }
  98. if(ypInfoList[yp].jie_yang_zhuang_t == '待确认'){
  99. this_.$message.error('操作失败,['+ypInfoList[yp].yang_pin_ming_che+'] 接收确认状态必须为已确认。')
  100. return;
  101. }
  102. if(ypInfoList[yp].shi_fou_liu_yang_ == "是"){
  103. if(ypInfoList[yp].liu_yang_wei_zhi_ == null || ypInfoList[yp].liu_yang_wei_zhi_ == ''){
  104. this_.$message.error("你要留样的话,存放位置不能为空哦!")
  105. return;
  106. }
  107. // if(ypInfoList[yp].shou_yang_wei_zhi != undefined && ypInfoList[yp].shou_yang_wei_zhi != ''){
  108. // this_.$message.error("你要留样的话,就不要选收样存放位置!")
  109. // return;
  110. // }
  111. let isLy = ypInfoList[yp].liu_yang_wei_zhi_
  112. // if(isLy.substr(-2,isLy.length -1) == "占用" || isLy.substr(-2,isLy.length -1) == "空余"){
  113. // let sql = "select `id` from MJ_yp_position_status where positionAndStatus = '" + isLy + "' limit 1"
  114. // repostCurd('sql',sql).then(response=>{
  115. // cfwz = response.variables.data[0].id
  116. // ypInfoList[yp].liu_yang_wei_zhi_ = cfwz
  117. // console.log('?question time')
  118. // })
  119. // }else{
  120. // cfwz = ypInfoList[yp].liu_yang_wei_zhi_
  121. // }
  122. cfwzObj.push(ypInfoList[yp].liu_yang_wei_zhi_) //取位置信息
  123. }
  124. // else{
  125. // if(ypInfoList[yp].shou_yang_wei_zhi == null || ypInfoList[yp].shou_yang_wei_zhi == ''){
  126. // this_.$message.error("你正常收样的话,样品存放位置不能为空哦!")
  127. // return;
  128. // }
  129. // if(ypInfoList[yp].liu_yang_wei_zhi_ != undefined && ypInfoList[yp].liu_yang_wei_zhi_ != ''){
  130. // this_.$message.error("你正常收样的话,就不要选择留样存放位置!")
  131. // return;
  132. // }
  133. // let isZC = ypInfoList[yp].shou_yang_wei_zhi
  134. // if(isZC.substr(-2,isZC.length -1) == "占用" || isZC.substr(-2,isZC.length -1) == "空余"){
  135. // let sql = "select `id` from MJ_yp_position_status where positionAndStatus = '" + isZC + "' limit 1"
  136. // repostCurd('sql',sql).then(response=>{
  137. // cfwz = response.variables.data[0].id
  138. // ypInfoList[yp].shou_yang_wei_zhi = cfwz
  139. // console.log('?question time')
  140. // })
  141. // }else{
  142. // cfwz = ypInfoList[yp].shou_yang_wei_zhi
  143. // }
  144. // }
  145. dWhere.push('{"id_":"' + cfwz + '"}')
  146. ypbh.push(ypInfoList[yp].yang_pin_bian_hao)
  147. uuidList.push(ypInfoList[yp].biao_zhi_uuid_)
  148. // cfwzIdList.push(cfwz)
  149. cfwzIdList.push(cfwzObj)
  150. ypIdList.push('{"id_":"' + ypInfoList[yp].id_ + '"}')
  151. ypWeiZhi.push(ypInfoList[yp].shou_yang_wei_zhi) // 收样存放位置
  152. ypLiuYangWeiZhi.push(ypInfoList[yp].liu_yang_wei_zhi_) // 留样存放位置
  153. saoMaNumList.push(ypInfoList[yp].jie_yang_shu_lian) // 扫码数量
  154. jieYangQueRenZTList.push(ypInfoList[yp].jie_yang_zhuang_t) // 接收确认状态
  155. ypbhList.push('{"yang_pin_bian_hao":"' + ypInfoList[yp].yang_pin_bian_hao + '"}') // 样品编号列表
  156. ypmcList.push(ypInfoList[yp].yang_pin_ming_che)
  157. }
  158. for(let index in ypIdList){
  159. let WZtem = ypWeiZhi[index]==null?'':ypWeiZhi[index]
  160. let LYWZtem = ypLiuYangWeiZhi[index]==null?'':ypLiuYangWeiZhi[index]
  161. changeWeizhi = WZtem;
  162. changesyWeizhi = LYWZtem;
  163. repostCurd('update','{"tableName":"t_mjypdjb","paramWhere":'+ypIdList[index]+',"paramCond":'+'{"shou_yang_wei_zhi":"'+WZtem+'","jie_yang_shu_lian":"'+saoMaNumList[index]+'","jie_yang_zhuang_t":"'+jieYangQueRenZTList[index]+'","liu_yang_wei_zhi_":"'+ LYWZtem + '"}}')
  164. repostCurd('update','{"tableName":"t_mjypb","paramWhere":' + ypIdList[index] + ',"paramCond":' + '{"jie_yang_zhuang_t":"已确认","cun_fang_wei_zhi_":"'+WZtem+'","liu_yang_cun_fang":"'+LYWZtem+'"}}')
  165. }
  166. // for(let num in dWhere){
  167. // if(this.OriginalPosition[num] != cfwzIdList[num]){
  168. // let sql = "select * from t_mjypcfwz where id_ = '" + cfwzIdList[num] + "'"
  169. // repostCurd('sql',sql).then(response=>{
  170. // let resArr = response.variables.data
  171. // if(resArr.length == 1){
  172. // if(resArr[0].wei_zhi_zhuang_ta == "空余"){
  173. // 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] + '"}}')
  174. // }else if(resArr[0].wei_zhi_zhuang_ta == "占用"){
  175. // // 新增一条新的位置记录,使用旧的位置记录 修改它的样品编号,入库时间,标识UUID
  176. // let cfNewList = []
  177. // let cfNew = {}
  178. // cfNew["fang_jian_lei_xin"] = resArr[0].fang_jian_lei_xin
  179. // cfNew["huo_jia_lei_xing_"] = resArr[0].huo_jia_lei_xing_
  180. // cfNew["huo_jia_hao_"] = resArr[0].huo_jia_hao_
  181. // cfNew["qu_yu_"] = resArr[0].qu_yu_
  182. // cfNew["gua_jia_hao_"] = resArr[0].gua_jia_hao_
  183. // cfNew["ceng_hao_"] = resArr[0].ceng_hao_
  184. // cfNew["wei_zhi_bian_hao_"] = resArr[0].wei_zhi_bian_hao_
  185. // cfNew["wei_zhi_zhuang_ta"] = resArr[0].wei_zhi_zhuang_ta
  186. // cfNew["cun_fang_lei_xing"] = resArr[0].cun_fang_lei_xing
  187. // cfNew["cun_chu_tiao_jian"] = resArr[0].cun_chu_tiao_jian
  188. // cfNew["yang_pin_bian_hao"] = ypbh[num]
  189. // cfNew["yang_pin_ming_che"] = ypmcList[num]
  190. // cfNew["ru_ku_shi_jian_"] = this_.dateFormat()
  191. // cfNew["shou_yang_ri_qi_"] = uuidList[num]
  192. // cfNewList.push(cfNew)
  193. // let uuid = cfNew["shou_yang_ri_qi_"];
  194. // repostCurd('add', '{"tableName":"t_mjypcfwz","paramWhere":' + JSON.stringify(cfNewList) + '}').then(res => {
  195. // let selectsql = "select id_ from t_mjypcfwz where shou_yang_ri_qi_='" + uuid + "'";
  196. // repostCurd('sql', selectsql).then(res => {
  197. // let dataid = res.variables.data[0].id_;
  198. // // console.log(res.variables.data)
  199. // let abc = '{"biao_zhi_uuid_":"' + uuid + '"}'
  200. // // console.log('zzj abc ',abc)
  201. // if (changeWeizhi && !changesyWeizhi) {
  202. // repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"shou_yang_wei_zhi":"' + dataid + '"}}').then(res => {
  203. // })
  204. // } else {
  205. // repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"liu_yang_wei_zhi_":"' + dataid + '"}}').then(res => {
  206. // })
  207. // }
  208. // })
  209. // })
  210. // }
  211. // }
  212. // })
  213. // }
  214. // }
  215. for (let num in dWhere) {
  216. let firstIfEmpty = true
  217. let secondIfEmpty = true
  218. for(let index = 0; index<cfwzIdList[num].length; index++){
  219. let sql = "select * from t_mjypcfwz where id_ = '" + cfwzIdList[num][index] + "'"
  220. let isLiuYang = index == 1 ? "是" : "否"
  221. repostCurd('sql', sql).then(response => {
  222. let resArr = response.variables.data
  223. if (resArr.length == 1) {
  224. if (resArr[0].wei_zhi_zhuang_ta == "空余") {
  225. if(index == 0){
  226. firstIfEmpty = false
  227. }else{
  228. secondIfEmpty = false
  229. }
  230. let content = {
  231. id_ : cfwzIdList[num][index]
  232. }
  233. let params = {
  234. wei_zhi_zhuang_ta : "占用",
  235. ru_ku_shi_jian_ : this_.dateFormat(),
  236. yang_pin_bian_hao : ypbh[num],
  237. yang_pin_ming_che : ypmcList[num],
  238. shi_fou_liu_yang_ : isLiuYang
  239. }
  240. let o = {
  241. tableName:'t_mjypcfwz',
  242. paramWhere:content,
  243. paramCond : params
  244. }
  245. repostCurd('update',JSON.stringify(o)).then(res=>{
  246. console.log("空余位置修改")
  247. })
  248. } else if (resArr[0].wei_zhi_zhuang_ta == "占用") {
  249. // 新增一条新的位置记录,使用旧的位置记录 修改它的样品编号,入库时间,标识UUID
  250. let cfNewList = []
  251. let cfNew = {}
  252. cfNew["fang_jian_lei_xin"] = resArr[0].fang_jian_lei_xin
  253. cfNew["huo_jia_lei_xing_"] = resArr[0].huo_jia_lei_xing_
  254. cfNew["huo_jia_hao_"] = resArr[0].huo_jia_hao_
  255. cfNew["qu_yu_"] = resArr[0].qu_yu_
  256. cfNew["gua_jia_hao_"] = resArr[0].gua_jia_hao_
  257. cfNew["ceng_hao_"] = resArr[0].ceng_hao_
  258. cfNew["wei_zhi_bian_hao_"] = resArr[0].wei_zhi_bian_hao_
  259. cfNew["wei_zhi_zhuang_ta"] = resArr[0].wei_zhi_zhuang_ta
  260. cfNew["cun_fang_lei_xing"] = resArr[0].cun_fang_lei_xing
  261. cfNew["cun_chu_tiao_jian"] = resArr[0].cun_chu_tiao_jian
  262. cfNew["yang_pin_bian_hao"] = ypbh[num]
  263. cfNew["yang_pin_ming_che"] = ypmcList[num]
  264. cfNew["ru_ku_shi_jian_"] = this_.dateFormat()
  265. cfNew["shou_yang_ri_qi_"] = uuidList[num]
  266. cfNew["shi_fou_liu_yang_"] = isLiuYang
  267. cfNewList.push(cfNew)
  268. let uuid = cfNew["shou_yang_ri_qi_"];
  269. repostCurd('add', '{"tableName":"t_mjypcfwz","paramWhere":' + JSON.stringify(cfNewList) + '}').then(res => {
  270. let selectsql = "select id_ from t_mjypcfwz where shou_yang_ri_qi_='" + uuid + "'";
  271. repostCurd('sql', selectsql).then(res => {
  272. let data = res.variables.data;
  273. let suchAs = '{"biao_zhi_uuid_":"' + uuid + '"}'
  274. if(data.length == 1 && changeWeizhi && firstIfEmpty){
  275. repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":'+suchAs+',"paramCond":{"shou_yang_wei_zhi":"'+data[0].id_+'"}}').then(res=>{
  276. console.log('One 存放位置',res)
  277. })
  278. }else if(data.length == 1 && changesyWeizhi && secondIfEmpty){
  279. repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":'+suchAs+',"paramCond":{"liu_yang_wei_zhi_":"'+data[0].id_+'"}}').then(res=>{
  280. console.log('One 留样位置',res)
  281. })
  282. }else if(data.length == 2 && changeWeizhi && changesyWeizhi){
  283. let whereL = []
  284. whereL.push(suchAs)
  285. repostCurd('updates', '{"tableName":"t_mjypdjb","paramWhere":['+whereL+'],"paramCond":{"shou_yang_wei_zhi":"'+data[0].id_+'","liu_yang_wei_zhi_":"'+data[1].id_+'"}}').then(res=>{
  286. console.log('Two 收样留样位置',res)
  287. })
  288. }
  289. })
  290. })
  291. }
  292. }
  293. })
  294. }
  295. }
  296. repostCurd('selects','{"tableName":"t_mjypb","paramWhere":['+ypbhList+']}').then(response=>{
  297. mjypbList = response.variables.data
  298. let wjList = []
  299. let wjAll = []
  300. let wjAllList = []
  301. for(let i in mjypbList){
  302. wjList.push(mjypbList[i].wai_jian_)
  303. wjAll.push(mjypbList[i].wai_jian_)
  304. }
  305. wjList = this_.unique(wjList)
  306. for(let i in wjList){
  307. mjypbWJ.push('{"id_":"' + wjList[i]+ '"}')
  308. }
  309. for(let i in wjAll){
  310. wjAllList.push('{"id_":"' + wjAll[i]+ '"}')
  311. }
  312. repostCurd('updates','{"tableName":"t_mjwtsqb","paramWhere":['+mjypbWJ+'],"paramCond":{"zhuang_tai_":"已完成"}}')
  313. let mjwtsqbAllResult = []
  314. let mjwtsqbIdList = []
  315. let mjfbbList = []
  316. let mjfbbWJList = []
  317. for(let i in wjAllList){
  318. repostCurd('select','{"tableName":"t_mjwtsqb","paramWhere":'+wjAllList[i]+'}').then(response=>{
  319. mjfbbWJList.push('{"wei_tuo_wai_jian_":"' + response.variables.data[0].id_ + '"}')
  320. mjwtsqbAllResult.push(response.variables.data[0])
  321. mjwtsqbIdList.push('{"id_":"' + response.variables.data[0].id_ + '"}')
  322. })
  323. }
  324. setTimeout(()=>{
  325. let narr = []
  326. for(let a of mjfbbWJList){
  327. narr.push(a)
  328. }
  329. repostCurd('selects','{"tableName":"t_mjfbb","paramWhere":['+narr+']}').then(response=>{
  330. mjfbbList.push(response.variables.data)
  331. })
  332. }, 1000)
  333. setTimeout(()=>{
  334. /* 分包
  335. repostCurd('select','{"tableName":"t_mjfbb","paramWhere":'+mjwtsqbIdList[i]+'}').then(response=>{
  336. console.log(response.variables.data)
  337. mjfbbList.push(response.variables.data)
  338. })*/
  339. let rwb = []
  340. let index = 0
  341. if(mjypbList != null && mjypbList.length >= 1){
  342. index = mjypbList[0].jian_ce_xiang_me_.split(",").length + mjypbList[0].jian_ce_xiang_mu2
  343. .split(",").length + mjypbList[0].jian_ce_xiang_ms_
  344. .split(",").length+ mjypbList[0].jian_ce_xiang_si_
  345. .split(",").length -1
  346. }
  347. console.log('final',mjypbList)
  348. for(var i in mjypbList){
  349. // console.log('坐标',i,p)
  350. let rwzb = {}
  351. // let wz_ = ypInfoList[i].shi_fou_liu_yang_ == "是" ? ypInfoList[i].liu_yang_wei_zhi_ : ypInfoList[i].shou_yang_wei_zhi // 对应的样品存放位置
  352. let wz_ = ypInfoList[i].shou_yang_wei_zhi
  353. rwzb["yang_pin_bian_hao"] = mjypbList[i].yang_pin_bian_hao // 取对应的样品编号
  354. rwzb["yang_pin_ming_che"] = mjypbList[i].yang_pin_ming_che // 对应的样品名称
  355. rwzb["yang_pin_dai_ci_"] = mjypbList[i].dai_ci_ // 对应的样品代次
  356. rwzb["yang_pin_pi_hao_"] = mjypbList[i].pi_hao_ // 对应的样品批号
  357. rwzb["yang_pin_shu_lian"] = mjypbList[i].shu_liang_ // 对应的样品数量
  358. rwzb["bug_ri_qi_"] = mjypbList[i].song_yang_ri_qi_ // 对应的送样日期
  359. rwzb["cun_fang_wei_zhi_"] = wz_
  360. rwzb["wei_tuo_wai_jian_"] = mjypbList[i].wai_jian_ // 检测申请单id
  361. rwzb["he_tong_wai_jian_"] = mjwtsqbAllResult[i].he_tong_bian_hao_ //合同id
  362. rwzb["song_yang_ri_qi_"] = mjypbList[i].biao_zhi_uuid_ // 收样日期
  363. rwzb["wei_tuo_ren_"] = mjwtsqbAllResult[i].lian_xi_ren_ // 委托人
  364. rwzb["bao_gao_jian_ce_s"] = this_.dateFormat() // 检测时间
  365. rwzb["zhan_shi_biao_wai"] = mjwtsqbAllResult[i].ye_mian_zong_zhua
  366. rwzb["zhuang_tai_"] = "任务待分配" // 状态
  367. // rwzb["gong_xian_zhi_"] = mjypbList[i].yang_pin_lei_xin // 供限值
  368. rwzb["yang_pin_bei_zhu_"] = mjypbList[i].bei_zhu_ // 样品备注
  369. rwzb["shi_fou_jia_ji_"] = mjwtsqbAllResult[i].fu_kuan_fang_shi_ // 2023-2-24吴懿要加的
  370. rwzb["wu_jun_shi_fou_ch"] = mjwtsqbAllResult[i].fu_he_yuan_ // 2023-3-6 王嘎嘎加
  371. rwb.push(rwzb)
  372. // let str = mjypbList[i].jian_ce_xiang_mu2.split(",")
  373. // for (var p in str) {
  374. // // console.log('坐标',i,p)
  375. // let temp = index - p
  376. // let rwzb = {}
  377. // let wz_ = ypInfoList[i].shi_fou_liu_yang_ == "是" ? ypInfoList[i].liu_yang_wei_zhi_ : ypInfoList[i].shou_yang_wei_zhi // 对应的样品存放位置
  378. // rwzb["jian_ce_xiang_mu_"] = str[p] // 取当前检测项目
  379. // rwzb["yang_pin_bian_hao"] = mjypbList[i].yang_pin_bian_hao // 取对应的样品编号
  380. // rwzb["yang_pin_ming_che"] = mjypbList[i].yang_pin_ming_che // 对应的样品名称
  381. // rwzb["yang_pin_dai_ci_"] = mjypbList[i].dai_ci_ // 对应的样品代次
  382. // rwzb["yang_pin_pi_hao_"] = mjypbList[i].pi_hao_ // 对应的样品批号
  383. // rwzb["yang_pin_shu_lian"] = mjypbList[i].shu_liang_ // 对应的样品数量
  384. // rwzb["bug_ri_qi_"] = mjypbList[i].song_yang_ri_qi_ // 对应的送样日期
  385. // rwzb["cun_fang_wei_zhi_"] = wz_
  386. // rwzb["wei_tuo_wai_jian_"] = mjypbList[i].wai_jian_ // 检测申请单id
  387. // rwzb["he_tong_wai_jian_"] = mjwtsqbAllResult[i].he_tong_bian_hao_ //合同id
  388. // rwzb["song_yang_ri_qi_"] = mjypbList[i].biao_zhi_uuid_ // 收样日期
  389. // rwzb["wei_tuo_ren_"] = mjwtsqbAllResult[i].lian_xi_ren_ // 委托人
  390. // rwzb["bao_gao_jian_ce_s"] = this_.dateFormat() // 检测时间
  391. // rwzb["zhan_shi_biao_wai"] = mjwtsqbAllResult[i].ye_mian_zong_zhua
  392. // rwzb["zhuang_tai_"] = "任务待分配" // 状态
  393. // rwzb["shi_fou_fen_bao_"] = mjfbbList[0][temp].shi_fou_fen_bao_ // 是否分包
  394. // rwzb["qi_wang_wan_cheng"] = mjfbbList[0][temp].wan_cheng_shi_jia // 期望完成时间
  395. // rwzb["gong_xian_zhi_"] = mjypbList[i].yang_pin_lei_xin // 供限值
  396. // rwb.push(rwzb)
  397. // }
  398. // index += str.length
  399. }
  400. console.log('任务表:',rwb)
  401. repostCurd('updates', '{"tableName":"t_mjwtsqb","paramWhere":['+mjwtsqbIdList+'],"paramCond":{"jian_ce_kai_shi_s":"' + this_.dateFormat() + '"}}')
  402. let uidList = []
  403. for(let item of mjwtsqbAllResult){
  404. uidList.push(item.ye_mian_zong_zhua)
  405. }
  406. uidList = this_.unique(uidList)
  407. repostCurd('add', '{"tableName":"t_rwfpb","paramWhere":'+JSON.stringify(rwb)+',"defKey":"Process_04tgh24","formKey":"mjrwfp"}' )
  408. if(uidList.length > 0 ){
  409. let ups = []
  410. for(let t of uidList){
  411. ups.push('{"shen_qing_id_":"'+t+'"}')
  412. }
  413. repostCurd('updates', '{"tableName":"t_mjwtzsb","paramWhere":['+ups+'],"paramCond":{"zhuang_tai_":"任务分配进行中"}}')
  414. }
  415. },2000)
  416. })
  417. this.$emit('callback',true)
  418. this.visable = false
  419. this.$message({
  420. message:'样品接收确认操作成功!',
  421. type:'success'
  422. })
  423. this.closeDialog();
  424. }).catch(_ => {});
  425. },
  426. /* 去除指定行数据 使用过滤器filter过滤指定行号数据 */
  427. deleteData(val){
  428. this.listData = this.listData.filter((data) =>{
  429. return data.id_!=val
  430. })
  431. },
  432. unique(arr) {
  433. return arr.filter((item, index) => {
  434. return arr.indexOf(item, 0) === index;
  435. });
  436. },
  437. Update (name,where,cond) {
  438. let cont = {}
  439. cont['tableName'] = name
  440. cont['paramWhere'] = where
  441. cont['paramCond'] = cond
  442. return repostCurd('update',JSON.stringify(cont))
  443. },
  444. /* zzj add */
  445. dateFormat() { // 获取当前时间
  446. var date=new Date();
  447. var year=date.getFullYear();
  448. var month= date.getMonth()+1<10 ? "0"+(date.getMonth()+1) : date.getMonth()+1;
  449. var day=date.getDate()<10 ? "0"+date.getDate() : date.getDate();
  450. return year+"-"+month+"-"+day;
  451. },
  452. /* 关闭*/
  453. remRedar() {
  454. this.visible = false // 列表隐藏
  455. this.listData = [] // 清空列表数据
  456. this.redar = false // 扫码图标隐藏
  457. this.$emit('scanOff',false)
  458. },
  459. }
  460. }