manualConfirmationJS.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. import repostCurd from '@/business/platform/form/utils/custom/joinCURD.js'
  2. export default {
  3. methods: {
  4. facilityData(page) {
  5. // this.loadData()
  6. this.loadDataBySQL(page)
  7. },
  8. /* 获取数据 ,开始查阅记录 */
  9. loadData() {
  10. // 扫码扫到新数据,查询 回填展示
  11. repostCurd('select', '{"tableName": "t_mjypb","paramWhere":{"jie_yang_zhuang_t":"待确认"}}').then(response => {
  12. if (response.variables.data && response.variables.data.length > 0) {
  13. for (let i in response.variables.data) {
  14. response.variables.data[i].jie_yang_shu_lian = 1
  15. response.variables.data[i].jie_yang_zhuang_t = '已确认'
  16. this.listData.push(response.variables.data[i])
  17. // 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)
  18. }
  19. console.log('All data',this.listData)
  20. }
  21. })
  22. },
  23. loadDataBySQL(page) {
  24. // 扫码扫到新数据,查询 并分页 回填展示
  25. let countSQL = `select count(*) as count from t_mjypb where jie_yang_zhuang_t = '待确认'`
  26. let str = (page-1)*10
  27. 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`
  28. Promise.all([repostCurd('sql', countSQL), repostCurd('sql', fysql)]).then(([res1, res]) => {
  29. this.listData = []
  30. this.pageCount = res1.variables.data[0].count
  31. if (res.variables.data && res.variables.data.length > 0) {
  32. for (let i in res.variables.data) {
  33. res.variables.data[i].jie_yang_shu_lian = 1
  34. res.variables.data[i].jie_yang_zhuang_t = '已确认'
  35. // res.variables.data[i].biao_zhi_uuid_ = this.uuid()
  36. this.listData.push(res.variables.data[i])
  37. // 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)
  38. }
  39. }
  40. })
  41. },
  42. /* 列表失去焦点*/
  43. handleChange() {
  44. this.$refs.redarInput.focus(); //聚焦input
  45. },
  46. /* 关闭弹出列表框*/
  47. closeDialog() {
  48. this.remRedar()
  49. //回传关闭事件。隐藏当前组件。
  50. },
  51. handleClose() {
  52. this.handleChange()
  53. this.$confirm('确认关闭样品列表页面?').then(_ => {
  54. this.closeDialog();
  55. }).catch(_ => {});
  56. },
  57. submitData(type) {
  58. // this指针
  59. let this_ = this;
  60. let changeWeizhi;
  61. let changesyWeizhi;
  62. // 回传关闭事件。隐藏当前组件。
  63. let judge = true;
  64. if (this_.listData.length == 0) {
  65. this.$emit('callback', true)
  66. this.visable = false
  67. this.$message({
  68. message: '暂无样品待接收确认!',
  69. type: 'error'
  70. })
  71. this.closeDialog();
  72. } else {
  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 sql1 = "select `id` from MJ_yp_position_status where positionAndStatus = '" + isZC + "' limit 1"
  136. // repostCurd('sql', sql1).then(response => {
  137. // cfwz = response.variables.data[0].id
  138. // ypInfoList[yp].shou_yang_wei_zhi = cfwz //查询位置状态表 取值位置的id
  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":' + 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 + '"}}')
  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. /*
  167. for (let num in dWhere) {
  168. // if (this.OriginalPosition[num] != cfwzIdList[num]) {
  169. let sql = "select * from t_mjypcfwz where id_ = '" + cfwzIdList[num] + "'"
  170. repostCurd('sql', sql).then(response => {
  171. let resArr = response.variables.data
  172. console.log(resArr)
  173. if (resArr.length == 1) {
  174. if (resArr[0].wei_zhi_zhuang_ta == "空余") {
  175. 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 => {
  176. console.log(res, "原本位置为空余 ,新位置更新成功")
  177. // alert('样品货位状态更新成功')
  178. })
  179. } else if (resArr[0].wei_zhi_zhuang_ta == "占用") {
  180. // 新增一条新的位置记录,使用旧的位置记录 修改它的样品编号,入库时间,标识UUID
  181. let cfNewList = []
  182. let cfNew = {}
  183. cfNew["fang_jian_lei_xin"] = resArr[0].fang_jian_lei_xin
  184. cfNew["huo_jia_lei_xing_"] = resArr[0].huo_jia_lei_xing_
  185. cfNew["huo_jia_hao_"] = resArr[0].huo_jia_hao_
  186. cfNew["qu_yu_"] = resArr[0].qu_yu_
  187. cfNew["gua_jia_hao_"] = resArr[0].gua_jia_hao_
  188. cfNew["ceng_hao_"] = resArr[0].ceng_hao_
  189. cfNew["wei_zhi_bian_hao_"] = resArr[0].wei_zhi_bian_hao_
  190. cfNew["wei_zhi_zhuang_ta"] = resArr[0].wei_zhi_zhuang_ta
  191. cfNew["cun_fang_lei_xing"] = resArr[0].cun_fang_lei_xing
  192. cfNew["cun_chu_tiao_jian"] = resArr[0].cun_chu_tiao_jian
  193. cfNew["yang_pin_bian_hao"] = ypbh[num]
  194. cfNew["yang_pin_ming_che"] = ypmcList[num]
  195. cfNew["ru_ku_shi_jian_"] = this_.dateFormat()
  196. cfNew["shou_yang_ri_qi_"] = uuidList[num]
  197. cfNewList.push(cfNew)
  198. let uuid = cfNew["shou_yang_ri_qi_"];
  199. repostCurd('add', '{"tableName":"t_mjypcfwz","paramWhere":' + JSON.stringify(cfNewList) + '}').then(res => {
  200. let selectsql = "select id_ from t_mjypcfwz where shou_yang_ri_qi_='" + uuid + "'";
  201. repostCurd('sql', selectsql).then(res => {
  202. let dataid = res.variables.data[0].id_;
  203. let abc = '{"biao_zhi_uuid_":"' + uuid + '"}'
  204. if (changeWeizhi && !changesyWeizhi) {
  205. repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"shou_yang_wei_zhi":"' + dataid + '"}}')
  206. } else {
  207. repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":' + abc + ',"paramCond":' + '{"liu_yang_wei_zhi_":"' + dataid + '"}}')
  208. }
  209. })
  210. })
  211. }
  212. }
  213. })
  214. // }
  215. }
  216. */
  217. for (let num in dWhere) {
  218. let firstIfEmpty = true
  219. let secondIfEmpty = true
  220. for(let index = 0; index<cfwzIdList[num].length; index++){
  221. let sql = "select * from t_mjypcfwz where id_ = '" + cfwzIdList[num][index] + "'"
  222. let isLiuYang = index == 1 ? "是" : "否"
  223. repostCurd('sql', sql).then(response => {
  224. let resArr = response.variables.data
  225. if (resArr.length == 1) {
  226. if (resArr[0].wei_zhi_zhuang_ta == "空余") {
  227. if(index == 0){
  228. firstIfEmpty = false
  229. }else{
  230. secondIfEmpty = false
  231. }
  232. let content = {
  233. id_ : cfwzIdList[num][index]
  234. }
  235. let params = {
  236. wei_zhi_zhuang_ta : "占用",
  237. ru_ku_shi_jian_ : this_.dateFormat(),
  238. yang_pin_bian_hao : ypbh[num],
  239. yang_pin_ming_che : ypmcList[num],
  240. shi_fou_liu_yang_ : isLiuYang
  241. }
  242. let o = {
  243. tableName:'t_mjypcfwz',
  244. paramWhere:content,
  245. paramCond : params
  246. }
  247. repostCurd('update',JSON.stringify(o)).then(res=>{
  248. console.log("空余位置修改")
  249. })
  250. } else if (resArr[0].wei_zhi_zhuang_ta == "占用") {
  251. // 新增一条新的位置记录,使用旧的位置记录 修改它的样品编号,入库时间,标识UUID
  252. let cfNewList = []
  253. let cfNew = {}
  254. cfNew["fang_jian_lei_xin"] = resArr[0].fang_jian_lei_xin
  255. cfNew["huo_jia_lei_xing_"] = resArr[0].huo_jia_lei_xing_
  256. cfNew["huo_jia_hao_"] = resArr[0].huo_jia_hao_
  257. cfNew["qu_yu_"] = resArr[0].qu_yu_
  258. cfNew["gua_jia_hao_"] = resArr[0].gua_jia_hao_
  259. cfNew["ceng_hao_"] = resArr[0].ceng_hao_
  260. cfNew["wei_zhi_bian_hao_"] = resArr[0].wei_zhi_bian_hao_
  261. cfNew["wei_zhi_zhuang_ta"] = resArr[0].wei_zhi_zhuang_ta
  262. cfNew["cun_fang_lei_xing"] = resArr[0].cun_fang_lei_xing
  263. cfNew["cun_chu_tiao_jian"] = resArr[0].cun_chu_tiao_jian
  264. cfNew["yang_pin_bian_hao"] = ypbh[num]
  265. cfNew["yang_pin_ming_che"] = ypmcList[num]
  266. cfNew["ru_ku_shi_jian_"] = this_.dateFormat()
  267. cfNew["shou_yang_ri_qi_"] = uuidList[num]
  268. cfNew["shi_fou_liu_yang_"] = isLiuYang
  269. cfNewList.push(cfNew)
  270. let uuid = cfNew["shou_yang_ri_qi_"];
  271. repostCurd('add', '{"tableName":"t_mjypcfwz","paramWhere":' + JSON.stringify(cfNewList) + '}').then(res => {
  272. let selectsql = "select id_ from t_mjypcfwz where shou_yang_ri_qi_='" + uuid + "'";
  273. repostCurd('sql', selectsql).then(res => {
  274. let data = res.variables.data;
  275. let suchAs = '{"biao_zhi_uuid_":"' + uuid + '"}'
  276. if(data.length == 1 && changeWeizhi && firstIfEmpty){
  277. repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":'+suchAs+',"paramCond":{"shou_yang_wei_zhi":"'+data[0].id_+'"}}').then(res=>{
  278. console.log('One 存放位置',res)
  279. })
  280. }else if(data.length == 1 && changesyWeizhi && secondIfEmpty){
  281. repostCurd('update', '{"tableName":"t_mjypdjb","paramWhere":'+suchAs+',"paramCond":{"liu_yang_wei_zhi_":"'+data[0].id_+'"}}').then(res=>{
  282. console.log('One 留样位置',res)
  283. })
  284. }else if(data.length == 2 && changeWeizhi && changesyWeizhi){
  285. let whereL = []
  286. whereL.push(suchAs)
  287. repostCurd('updates', '{"tableName":"t_mjypdjb","paramWhere":['+whereL+'],"paramCond":{"shou_yang_wei_zhi":"'+data[0].id_+'","liu_yang_wei_zhi_":"'+data[1].id_+'"}}').then(res=>{
  288. console.log('Two 收样留样位置',res)
  289. })
  290. }
  291. })
  292. })
  293. }
  294. }
  295. })
  296. }
  297. }
  298. repostCurd('selects', '{"tableName":"t_mjypb","paramWhere":[' + ypbhList + ']}').then(response => {
  299. mjypbList = response.variables.data
  300. let wjList = []
  301. let wjAll = []
  302. let wjAllList = []
  303. for (let i in mjypbList) {
  304. wjList.push(mjypbList[i].wai_jian_)
  305. wjAll.push(mjypbList[i].wai_jian_)
  306. }
  307. wjList = this_.unique(wjList)
  308. for (let i in wjList) {
  309. mjypbWJ.push('{"id_":"' + wjList[i] + '"}')
  310. }
  311. for (let i in wjAll) {
  312. wjAllList.push('{"id_":"' + wjAll[i] + '"}')
  313. }
  314. repostCurd('updates', '{"tableName":"t_mjwtsqb","paramWhere":[' + mjypbWJ + '],"paramCond":{"zhuang_tai_":"已完成"}}')
  315. let mjwtsqbAllResult = []
  316. let mjwtsqbIdList = []
  317. let mjfbbList = []
  318. let mjfbbWJList = []
  319. for (let i in wjAllList) {
  320. repostCurd('select', '{"tableName":"t_mjwtsqb","paramWhere":' + wjAllList[i] + '}').then(response => {
  321. mjfbbWJList.push('{"wei_tuo_wai_jian_":"' + response.variables.data[0].id_ + '"}')
  322. mjwtsqbAllResult.push(response.variables.data[0])
  323. mjwtsqbIdList.push('{"id_":"' + response.variables.data[0].id_ + '"}')
  324. })
  325. }
  326. setTimeout(() => {
  327. let narr = []
  328. for (let a of mjfbbWJList) {
  329. narr.push(a)
  330. }
  331. repostCurd('selects', '{"tableName":"t_mjfbb","paramWhere":[' + narr + ']}').then(response => {
  332. mjfbbList.push(response.variables.data)
  333. })
  334. }, 1000)
  335. setTimeout(() => {
  336. let rwb = []
  337. let index = 0
  338. if (mjypbList != null && mjypbList.length >= 1) {
  339. index = mjypbList[0].jian_ce_xiang_me_.split(",").length + mjypbList[0].jian_ce_xiang_mu2
  340. .split(",").length + mjypbList[0].jian_ce_xiang_ms_
  341. .split(",").length+ mjypbList[0].jian_ce_xiang_si_
  342. .split(",").length -1
  343. }
  344. console.log('final',mjypbList)
  345. for (var i in mjypbList) {
  346. let rwzb = {}
  347. // let yplxAll = ''
  348. // if(mjypbList[i].yang_pin_lei_xy_ != null){
  349. // yplxAll += mjypbList[i].yang_pin_lei_xy_ + ","
  350. // }
  351. // if(mjypbList[i].yang_pin_lei_xe != null){
  352. // yplxAll += mjypbList[i].yang_pin_lei_xe + ","
  353. // }
  354. // if(mjypbList[i].yang_pin_lei_xs != null){
  355. // yplxAll += mjypbList[i].yang_pin_lei_xs + ","
  356. // }
  357. // if(mjypbList[i].yang_pin_lei_xsi != null){
  358. // yplxAll += mjypbList[i].yang_pin_lei_xsi + ","
  359. // }
  360. // yplxAll = yplxAll.substr(0, yplxAll.length - 1)
  361. // let wz_ = ypInfoList[i].shi_fou_liu_yang_ == "是" ? ypInfoList[i].liu_yang_wei_zhi_ : ypInfoList[i].shou_yang_wei_zhi // 对应的样品存放位置
  362. let wz_ = ypInfoList[i].shou_yang_wei_zhi
  363. // console.log(wz_)
  364. rwzb["yang_pin_bian_hao"] = mjypbList[i].yang_pin_bian_hao // 取对应的样品编号
  365. rwzb["yang_pin_ming_che"] = mjypbList[i].yang_pin_ming_che // 对应的样品名称
  366. rwzb["yang_pin_dai_ci_"] = mjypbList[i].dai_ci_ // 对应的样品代次
  367. rwzb["yang_pin_pi_hao_"] = mjypbList[i].pi_hao_ // 对应的样品批号
  368. rwzb["yang_pin_shu_lian"] = mjypbList[i].yang_pin_zong_shu // 对应的样品数量
  369. rwzb["bug_ri_qi_"] = mjypbList[i].song_yang_ri_qi_ // 对应的送样日期
  370. rwzb["cun_fang_wei_zhi_"] = wz_
  371. rwzb["wei_tuo_wai_jian_"] = mjypbList[i].wai_jian_ // 检测申请单id
  372. rwzb["he_tong_wai_jian_"] = mjwtsqbAllResult[i].he_tong_bian_hao_ //合同id
  373. rwzb["song_yang_ri_qi_"] = mjypbList[i].biao_zhi_uuid_ // 收样日期
  374. rwzb["wei_tuo_ren_"] = mjwtsqbAllResult[i].lian_xi_ren_ // 委托人
  375. rwzb["bao_gao_jian_ce_s"] = this_.dateFormat() // 检测时间
  376. rwzb["zhan_shi_biao_wai"] = mjwtsqbAllResult[i].ye_mian_zong_zhua
  377. rwzb["zhuang_tai_"] = "任务待分配" // 状态
  378. // rwzb["gong_xian_zhi_"] = mjypbList[i].yang_pin_lei_xin // 供限值
  379. rwzb["yang_pin_bei_zhu_"] = mjypbList[i].bei_zhu_ // 样品备注
  380. // rwzb["yang_pin_lei_xing"] = yplxAll //23/1/10号 吴懿说不要了
  381. rwzb["shi_fou_jia_ji_"] = mjwtsqbAllResult[i].fu_kuan_fang_shi_ // 2023-2-24吴懿要加的
  382. rwzb["wu_jun_shi_fou_ch"] = mjwtsqbAllResult[i].fu_he_yuan_ // 2023-3-6 王嘎嘎加
  383. rwb.push(rwzb)
  384. // let str = mjypbList[i].jian_ce_xiang_mu2.split(",")
  385. // for (var p in str) {
  386. // // console.log('坐标',i,p)
  387. // let temp = index - p
  388. // let rwzb = {}
  389. // let wz_ = ypInfoList[i].shi_fou_liu_yang_ == "是" ? ypInfoList[i].liu_yang_wei_zhi_ : ypInfoList[i].shou_yang_wei_zhi // 对应的样品存放位置
  390. // rwzb["jian_ce_xiang_mu_"] = str[p] // 取当前检测项目
  391. // rwzb["yang_pin_bian_hao"] = mjypbList[i].yang_pin_bian_hao // 取对应的样品编号
  392. // rwzb["yang_pin_ming_che"] = mjypbList[i].yang_pin_ming_che // 对应的样品名称
  393. // rwzb["yang_pin_dai_ci_"] = mjypbList[i].dai_ci_ // 对应的样品代次
  394. // rwzb["yang_pin_pi_hao_"] = mjypbList[i].pi_hao_ // 对应的样品批号
  395. // rwzb["yang_pin_shu_lian"] = mjypbList[i].shu_liang_ // 对应的样品数量
  396. // rwzb["bug_ri_qi_"] = mjypbList[i].song_yang_ri_qi_ // 对应的送样日期
  397. // rwzb["cun_fang_wei_zhi_"] = wz_
  398. // rwzb["wei_tuo_wai_jian_"] = mjypbList[i].wai_jian_ // 检测申请单id
  399. // rwzb["he_tong_wai_jian_"] = mjwtsqbAllResult[i].he_tong_bian_hao_ //合同id
  400. // rwzb["song_yang_ri_qi_"] = mjypbList[i].biao_zhi_uuid_ // 收样日期
  401. // rwzb["wei_tuo_ren_"] = mjwtsqbAllResult[i].lian_xi_ren_ // 委托人
  402. // rwzb["bao_gao_jian_ce_s"] = this_.dateFormat() // 检测时间
  403. // rwzb["zhan_shi_biao_wai"] = mjwtsqbAllResult[i].ye_mian_zong_zhua
  404. // rwzb["zhuang_tai_"] = "任务待分配" // 状态
  405. // rwzb["shi_fou_fen_bao_"] = mjfbbList[0][temp].shi_fou_fen_bao_ // 是否分包
  406. // rwzb["qi_wang_wan_cheng"] = mjfbbList[0][temp].wan_cheng_shi_jia // 期望完成时间
  407. // rwzb["gong_xian_zhi_"] = mjypbList[i].yang_pin_lei_xin // 供限值
  408. // rwb.push(rwzb)
  409. // }
  410. // index += str.length
  411. }
  412. console.log('任务表:',rwb)
  413. repostCurd('updates', '{"tableName":"t_mjwtsqb","paramWhere":[' + mjwtsqbIdList + '],"paramCond":{"jian_ce_kai_shi_s":"' + this_.dateFormat() + '"}}')
  414. let uidList = []
  415. for (let item of mjwtsqbAllResult) {
  416. uidList.push(item.ye_mian_zong_zhua)
  417. }
  418. uidList = this_.unique(uidList)
  419. repostCurd('add', '{"tableName":"t_rwfpb","paramWhere":' + JSON.stringify(rwb) + ',"defKey":"Process_04tgh24","formKey":"mjrwfp"}')
  420. if (uidList.length > 0) {
  421. let ups = []
  422. for (let t of uidList) {
  423. ups.push('{"shen_qing_id_":"' + t + '"}')
  424. }
  425. repostCurd('updates', '{"tableName":"t_mjwtzsb","paramWhere":[' + ups + '],"paramCond":{"zhuang_tai_":"任务分配进行中"}}')
  426. }
  427. }, 5000)
  428. })
  429. // */
  430. this.$emit('callback', true)
  431. this.visable = false
  432. this.$message({
  433. message: '样品接收确认操作成功!',
  434. type: 'success'
  435. })
  436. this.closeDialog();
  437. }).catch(_ => {});
  438. }
  439. },
  440. /* 去除指定行数据 使用过滤器filter过滤指定行号数据 */
  441. deleteData(val) {
  442. this.listData = this.listData.filter((data) => {
  443. return data.id_ != val
  444. })
  445. },
  446. unique(arr) {
  447. return arr.filter((item, index) => {
  448. return arr.indexOf(item, 0) === index;
  449. });
  450. },
  451. Update(name, where, cond) {
  452. let cont = {}
  453. cont['tableName'] = name
  454. cont['paramWhere'] = where
  455. cont['paramCond'] = cond
  456. return repostCurd('update', JSON.stringify(cont))
  457. },
  458. /* zzj add */
  459. dateFormat() { // 获取当前时间
  460. var date = new Date();
  461. var year = date.getFullYear();
  462. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  463. var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  464. return year + "-" + month + "-" + day;
  465. },
  466. /* 关闭*/
  467. remRedar() {
  468. this.visible = false // 列表隐藏
  469. this.listData = [] // 清空列表数据
  470. this.redar = false // 扫码图标隐藏
  471. this.$emit('scanOff', false)
  472. },
  473. }
  474. }