package market.thread.interfaceInBill;

import market.Pms.Settlement.service.PurInterfaceInbillService;

import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

class InBillThread extends Thread implements Runnable {
	private static int runCopies = 0;
	WebApplicationContext _context;
	private PurInterfaceInbillService _service1;
	  
	
	InBillThread() {
		if (++runCopies == 1)
		{
			_context = ContextLoader
					.getCurrentWebApplicationContext();
			_service1 = (PurInterfaceInbillService) _context
					.getBean("PurInterfaceInbillService"); 
		}
	}

	public void run() {
		while (!InBillMgt.getShouldStop()) {
			try {
				//_service1.interfaceEquipToInBill();//资材备件
				//_service1.interfaceProductToInBill();//原料
			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				try {
					Thread.sleep(5*60*1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
