2.18-样品补送

样品补送

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/496569/1488869/218-%E6%A0%B7%E5%93%81%E8%A1%A5%E9%80%81.js

  1. function 样品补送(src){
  2. console.log('新的样品补送界面')
  3. var local_打印样品标签=localStorage.getItem('打印样品标签');
  4. var local_标颜色引物已清或不足=localStorage.getItem('标颜色引物已清或不足');
  5. var html=$('iframe[src="'+src+'"]')//页面
  6. html=html.contents().find('body').eq(0)
  7. var toolbar=html.find('.toolbar').eq(0) // 找到了toolbar工具栏
  8. var table=html.find('.ui-jqgrid-btable').eq(0) // 找到了样品的table
  9. //添加toolbar工具栏按钮
  10. 添加toolbar按钮(html)
  11. //添加toolbar工具栏按钮
  12. function 添加toolbar按钮(html){
  13. if (toolbar.find('.weiyiyici').length==0){
  14. //添加标记
  15. toolbar.addClass('weiyiyici')
  16. //改成每页100个数据
  17. html.find('#pager_center').eq(0).find("option[value='10']").eq(0).val('100')
  18. //点击 打印样品标签 按钮
  19. if (local_打印样品标签 == 'true'){
  20. toolbar.append('<button id="button_print_ypbq" onclick="return false">打印样品标签</button>')
  21. }
  22. //标颜色引物已清或不足
  23. if (local_标颜色引物已清或不足 == 'true'){
  24. toolbar.append('<button id="button_show_yinwu_yiqing_buzu" onclick="return false">查询引物已清或不足</button>')
  25. toolbar.append('<button id="button_color_yinwu_yiqing_buzu_qian" onclick="return false">当前页标颜色引物已清或不足(12点前)</button>')
  26. toolbar.append('<button id="button_color_yinwu_yiqing_buzu_hou" onclick="return false">当前页标颜色引物已清或不足(12点后)</button>')
  27. }
  28. //点击 打印样品标签 按钮
  29. toolbar.find('#button_print_ypbq').click(function(){
  30. 打印样品标签()
  31. })
  32. //点击 查询引物已清或不足 按钮
  33. toolbar.find('#button_show_yinwu_yiqing_buzu').click(function(){
  34. 函数_查询引物已清或不足()
  35. })
  36. //点击 标颜色引物已清或不足(12点前) 按钮
  37. toolbar.find('#button_color_yinwu_yiqing_buzu_qian').click(function(){
  38. 当天时间=getday_y_n()
  39. 函数_标颜色引物已清或不足(当天时间)
  40. })
  41. //点击 标颜色引物已清或不足(12点后) 按钮
  42. toolbar.find('#button_color_yinwu_yiqing_buzu_hou').click(function(){
  43. 昨天时间=getday_y_n('yestday')
  44. console.log(昨天时间)
  45. 函数_标颜色引物已清或不足(昨天时间)
  46. })
  47. }
  48. }
  49. //打印样品标签
  50. function 打印样品标签(){
  51. selecteds=table.find('tbody').find("[aria-selected='true']")
  52. if (selecteds.size()==0){return false}
  53. res="<NewDataSet>"
  54. selecteds.each(function(){
  55. shengchanbianhao=$(this).find('[aria-describedby=list_undefined]').text() //生产编号
  56. kehu_xingming=$(this).find('[aria-describedby=list_seqo_cust_name]').text() //客户姓名
  57. yangpinbianhao=$(this).find('[aria-describedby=list_seqs_sam_num]').text() //样品编号
  58. yangpinleixing=$(this).find('[aria-describedby=list_seqs_sam_type]').text() //样品类型
  59. res+="<Table1>"
  60. res+="<seqs_prod_id>"+shengchanbianhao+"</seqs_prod_id>"
  61. res+="<seqo_cust_name>"+kehu_xingming+"</seqo_cust_name>"
  62. res+="<seqs_sam_num>"+yangpinbianhao+"</seqs_sam_num>"
  63. res+="<seqs_ant_type />"
  64. res+="<seqs_sam_type>"+'质粒'+"</seqs_sam_type>"
  65. res+="<seqs_fragment_size />"
  66. 当天日期=getday_y_n('---')
  67. res+="<seqo_send_sample_time>"+当天日期+"T18:47:08+08:00</seqo_send_sample_time>"
  68. res+="</Table1>"
  69. })
  70. res+="</NewDataSet>"
  71. 保存文本到本地(res,'down.html')
  72. }
  73. //保存文本到本地
  74. function 保存文本到本地(text, filename){
  75. // 创建一个Blob实例,类型为纯文本
  76. var blob = new Blob([text], { type: 'text/plain' });
  77. // 创建一个指向Blob对象的URL
  78. var url = URL.createObjectURL(blob);
  79. // 创建一个a标签
  80. var a = document.createElement("a");
  81. // 设置a标签属性
  82. a.href = url;
  83. a.download =filename;
  84. // 模拟a标签点击,触发下载
  85. document.body.appendChild(a);
  86. a.click();
  87. // 清理临时DOM和对象URL
  88. document.body.removeChild(a);
  89. URL.revokeObjectURL(url);
  90. window.open('http://localhost//打印/print.html')
  91. }
  92. //查询引物已清或不足
  93. function 函数_查询引物已清或不足(){
  94. toolbar.find('#a_search').eq(0).find('.l-btn-left').eq(0).click(); //点击 查询按钮
  95. $('#searchForm').eq(0).find("option[value='seqs_complete']").eq(0).attr('selected','selected') //把找到的第一个查询条件改成 完成情况
  96. $('.searchOper:lt(14)').find("option[value='cn']").attr('selected','selected') //查询方式前14个变成包含
  97. $('#searchForm').eq(0).find("[class='txt02 searchString']").eq(0).val('引物')
  98. $("#AB").click()
  99. }
  100. //函数_标颜色引物已清或不足
  101. function 函数_标颜色引物已清或不足(年月日){
  102. 姓名_arr=[]
  103. 引物_arr=[]
  104. //循环每一个tr
  105. table.find('tbody').find("tr").each(function(){
  106. 姓名=$(this).find('[aria-describedby=list_seqo_cust_name]').text() //客户姓名
  107. 姓名_arr.push(姓名)
  108. 引物=$(this).find('[aria-describedby=list_seqs_primer]').text() //引物
  109. 引物_arr.push(引物)
  110. })
  111. arr=两个数组去重(姓名_arr,引物_arr)
  112. 姓名_去重后_arr=arr[0]
  113. 引物_去重后_arr=arr[1]
  114. //如果去重后长度为0 则提示没有
  115. if (姓名_去重后_arr.length == 0){
  116. alert('没有已清的引物')
  117. return false
  118. }
  119. //循环
  120. for(var i=0;i<姓名_去重后_arr.length;i++){
  121. console.log(i)
  122. 姓名=姓名_去重后_arr[i]
  123. 引物=引物_去重后_arr[i]
  124. sleep(500)
  125. //测序样品搜 添加时间=年月日 and 客户名=姓名 and 测序引物=引物 如果这都搜不到,就不用再次访问了。
  126. url='/seq/ashx/SeqSampleHandler.ashx?_search=true&nd=1732194359277&rows=10&page=1&sidx=seqs_prod_id&sord=desc&filters={"groupOp":"AND","rules":[{"field":"seqs_add_time","op":"eq","data":"'+年月日+'"},{"field":"seqo_cust_name","op":"eq","data":"'+姓名+'"},{"field":"seqs_primer","op":"eq","data":"'+引物+'"}]}'
  127. 总条数= parseInt(网址_获取总条数(url))
  128. if (总条数==0){
  129. continue
  130. }
  131. sleep(500)
  132. //测序样品搜 添加时间=年月日 and 客户名=姓名 and 测序引物=引物 and ( 引物浓度包含P 或 引物浓度包含干粉) 分成2次访问
  133. url='/seq/ashx/SeqSampleHandler.ashx?_search=true&nd=1732194359277&rows=10&page=1&sidx=seqs_prod_id&sord=desc&filters={"groupOp":"AND","rules":[{"field":"seqs_add_time","op":"eq","data":"'+年月日+'"},{"field":"seqo_cust_name","op":"eq","data":"'+姓名+'"},{"field":"seqs_primer","op":"eq","data":"'+引物+'"},{"field":"seqs_observe","op":"cn","data":"P"}]}'
  134. 总条数= parseInt(网址_获取总条数(url))
  135. if (总条数==0){
  136. sleep(500)
  137. //测序样品搜 添加时间=年月日 and 客户名=姓名 and 测序引物=引物 and 引物浓度包含干粉) 分成2次访问
  138. url='/seq/ashx/SeqSampleHandler.ashx?_search=true&nd=1732194359277&rows=10&page=1&sidx=seqs_prod_id&sord=desc&filters={"groupOp":"AND","rules":[{"field":"seqs_add_time","op":"eq","data":"'+年月日+'"},{"field":"seqo_cust_name","op":"eq","data":"'+姓名+'"},{"field":"seqs_primer","op":"eq","data":"'+引物+'"},{"field":"seqs_observe","op":"cn","data":"干粉"}]}'
  139. 总条数=网址_获取总条数(url)
  140. sleep(500)
  141. }
  142. console.log('总条数',总条数)
  143. if (总条数>0){
  144. table.find('tbody').find("tr").each(function(){
  145. tr_姓名=$(this).find('[aria-describedby=list_seqo_cust_name]').text() //客户姓名
  146. tr_引物=$(this).find('[aria-describedby=list_seqs_primer]').text() //引物
  147. if (tr_姓名==姓名 && tr_引物==引物){
  148. $(this).find('[aria-describedby=list_seqs_primer]').attr('Bgcolor','#AeEEe7') //引物标颜色
  149. $(this).find('[aria-describedby=list_seqs_observe]').attr('Bgcolor','#AeEEe7') //引物浓度标颜色
  150. }
  151. })
  152. }
  153. }
  154. alert('完毕')
  155. }
  156. }
  157.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址