2.22-合成订单完成

合成订单完成

Verze ze dne 16. 08. 2024. Zobrazit nejnovější verzi.

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.greatest.deepsurf.us/scripts/503810/1429211/222-%E5%90%88%E6%88%90%E8%AE%A2%E5%8D%95%E5%AE%8C%E6%88%90.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

function 合成订单完成(src){
	console.log('新的合成订单完成界面')
	var local_合成订单完成_合成入财务_不干胶式=localStorage.getItem('合成订单完成_合成入财务_不干胶式');
	var html=$('iframe[src="'+src+'"]')//页面
	html=html.contents().find('body').eq(0)
	var toolbar=html.find('.toolbar').eq(0)  // 找到了toolbar工具栏
	var sample_table=html.find('.ui-jqgrid-btable').eq(0)  // 找到了样品的table
	//添加toolbar工具栏按钮
	添加toolbar按钮(html)
	//添加toolbar工具栏按钮
	function 添加toolbar按钮(html){
		if (toolbar.find('.weiyiyici').length==0){
			//添加标记
			toolbar.addClass('weiyiyici')
			if(local_合成订单完成_合成入财务_不干胶式=='true'){
				送货单按钮=toolbar.find('#a_orderToCustmer').eq(0)
				//点击送货单按钮
				送货单按钮.click(function(){
					不干胶式(html)
				})
			}
		}
	}
	
	//不干胶式_备注带缺和不带缺
	function 不干胶式(html){
		//弹框加个按钮
		$('#uiform').find('#print_synBDT').parent().append('<button id="button_buganjiaoshi" onclick="return false">不干胶式</button>')
		//点击不干胶式按钮
		$('#uiform').find('#button_buganjiaoshi').click(function(){
			不干胶式_详细代码(html)
		})
	}
	function 不干胶式_详细代码(html){
		selecteds=sample_table.find('tbody').find("[aria-selected='true']")
		dingdanhao_arr_str=''
		selecteds.each(function(){
			dingdanhao=$(this).find('[aria-describedby=list_syno_id]').text() 	//订单号
			dingdanhao_arr_str=dingdanhao_arr_str+dingdanhao+','
		})
		$.ajaxSettings.async = false; //get请求默认是异步的,在这里改为同步
		$.get('/syn/xmldata/xmlSynStoreOut.aspx?order='+dingdanhao_arr_str+'&style=buganjiao',function(data){
			保存文本到本地(data,'down.html','http://localhost/buganjiaoBiaoqian/print_bubaohanque.html')
		 }); 
	}
	
	//保存文本到本地
	function 保存文本到本地(text, filename,bendi_url){
		// 创建一个Blob实例,类型为纯文本
		var blob = new Blob([text], { type: 'text/plain' });
	 
		// 创建一个指向Blob对象的URL
		var url = URL.createObjectURL(blob);
	 
		// 创建一个a标签
		var a = document.createElement("a");
	 
		// 设置a标签属性
		a.href = url;
		a.download =filename;
	 
		// 模拟a标签点击,触发下载
		document.body.appendChild(a);
		a.click();
	 
		// 清理临时DOM和对象URL
		document.body.removeChild(a);
		URL.revokeObjectURL(url);
		window.open(bendi_url)
	}
	//字符串全部替换部分文本
	function str_replaceAll(str, yuanwenben, xianwenben) {
	  return str.replace(new RegExp(yuanwenben, 'g'), xianwenben);
	}
}