⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 registernew_ok.java

📁 ERO系统.针对生产型、分销型、服务型企业等不同的行业特点
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		record_number=rs98.getInt("count(*)");
	}
	String design_ID="";
	double module_cost=0.0d;
	String sql16="select * from design_module where product_ID='"+product_ID+"'";
	ResultSet rs16=design_db.executeQuery(sql16) ;
	while(rs16.next()){
		design_ID=rs16.getString("design_ID");
		module_cost=rs16.getDouble("cost_price_sum")*demand_amount_sum;
	}
	double list_price_sum=price*demand_amount_sum;
	sql = "update intrmanufacture_intrmanufacture set list_price_sum='"+list_price_sum+"',list_price='"+price+"',checker='"+register+"',check_time='"+register_time+"',check_tag='2',intrmanufacture_tag='1',invoice_tag='1',gather_tag='1',stock_gather_tag='1',pay_tag='1',module_cost_price_sum='"+module_cost+"' where intrmanufacture_ID='"+intrmanufacture_ID+"'" ;
	intrmanufacture_db.executeUpdate(sql) ;
	String sql9="select * from intrmanufacture_details where intrmanufacture_ID='"+intrmanufacture_ID+"'";
	ResultSet rs9=intrmanufacture_db.executeQuery(sql9) ;
	while(rs9.next()){
		String pay_ID=NseerId.getId("stock/pay",(String)dbSession.getAttribute("unit_db_name"));
		String part_pay_ID=pay_ID+"part";
		int i=1;
		int j=0;
		double module_cost_price_sum=0.0d;
		double module_demand_amount=0.0d;
		double part_cost_price_sum=0.0d;
		double part_module_demand_amount=0.0d;
		String sql6="select * from design_module_details where design_ID='"+design_ID+"' order by details_number";
		ResultSet rs6=design_db.executeQuery(sql6) ;
		while(rs6.next()){			
			if(rs6.getString("type").equals("物料")){
			double module_cost_price=rs6.getDouble("subtotal")*rs9.getDouble("demand_amount");
			double module_demand_amount1=rs6.getDouble("amount")*rs9.getDouble("demand_amount");
			module_cost_price_sum+=module_cost_price;
			module_demand_amount+=module_demand_amount1;
			String sql7="insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,product_describe,type,amount,apply_purchase_amount,amount_unit,cost_price,subtotal) values('"+pay_ID+"','"+i+"','"+rs6.getString("product_ID")+"','"+rs6.getString("product_name")+"','"+rs6.getString("product_describe")+"','"+rs6.getString("type")+"','"+module_demand_amount1+"','"+module_demand_amount1+"','"+rs6.getString("amount_unit")+"','"+rs6.getString("cost_price")+"','"+module_cost_price+"')";
			stock_db.executeUpdate(sql7) ;
			}			
			if(rs6.getString("type").equals("部件")||rs6.getString("type").equals("委外部件")){
				double part_module_cost_price=rs6.getDouble("subtotal")*rs9.getDouble("demand_amount");
				double part_module_demand_amount1=rs6.getDouble("amount")*rs9.getDouble("demand_amount");
				part_cost_price_sum+=part_module_cost_price;
				part_module_demand_amount+=part_module_demand_amount1;
				module_cost_price_sum+=part_module_cost_price;
				module_demand_amount+=part_module_demand_amount1;
				j++;
				String sql13="insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,product_describe,type,amount,apply_purchase_amount,amount_unit,cost_price,subtotal) values('"+pay_ID+"','"+i+"','"+rs6.getString("product_ID")+"','"+rs6.getString("product_name")+"','"+rs6.getString("product_describe")+"','"+rs6.getString("type")+"','"+part_module_demand_amount1+"','0','"+rs6.getString("amount_unit")+"','"+rs6.getString("cost_price")+"','"+part_module_cost_price+"')";
				stock_db.executeUpdate(sql13) ;
				String sql18="insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,product_describe,type,amount,apply_manufacture_amount,amount_unit,cost_price,subtotal) values('"+part_pay_ID+"','"+j+"','"+rs6.getString("product_ID")+"','"+rs6.getString("product_name")+"','"+rs6.getString("product_describe")+"','"+rs6.getString("type")+"','"+part_module_demand_amount1+"','"+part_module_demand_amount1+"','"+rs6.getString("amount_unit")+"','"+rs6.getString("cost_price")+"','"+part_module_cost_price+"')";
				stock_db.executeUpdate(sql18) ;
			}
			i++;
		}
if(j==0&&vrn.validata((String)dbSession.getAttribute("unit_db_name"),"stock_pay","reasonexact",intrmanufacture_ID)<record_number){
		String sql19="insert into stock_pay(pay_ID,reason,reasonexact,reasonexact_details,demand_amount,apply_purchase_amount,cost_price_sum,register,register_time) values('"+pay_ID+"','生产领料','"+intrmanufacture_ID+"','"+rs9.getString("provider_name")+"','"+module_demand_amount+"','"+module_demand_amount+"','"+module_cost_price_sum+"','"+register+"','"+register_time+"')";
		stock_db.executeUpdate(sql19) ;

	}else if(j!=0&&vrn.validata((String)dbSession.getAttribute("unit_db_name"),"stock_pay","reasonexact",intrmanufacture_ID)<2*record_number){
		String sql20="insert into stock_pay(pay_ID,reason,reasonexact,reasonexact_details,demand_amount,apply_purchase_amount,cost_price_sum,register,register_time) values('"+pay_ID+"','生产领料','"+intrmanufacture_ID+"','"+rs9.getString("provider_name")+"','"+module_demand_amount+"','"+module_demand_amount+"','"+module_cost_price_sum+"','"+register+"','"+register_time+"')";
		stock_db.executeUpdate(sql20) ;
		String sql21="insert into stock_pay(pay_ID,reason,reasonexact,reasonexact_details,demand_amount,apply_purchase_amount,cost_price_sum,register,register_time) values('"+part_pay_ID+"','部件出库','"+intrmanufacture_ID+"','"+rs9.getString("provider_name")+"','"+part_module_demand_amount+"','"+part_module_demand_amount+"','"+part_cost_price_sum+"','"+register+"','"+register_time+"')";
		stock_db.executeUpdate(sql21) ;
	}	
	String sql22="update intrmanufacture_details set module_cost_price_sum='"+module_cost_price_sum+"' where intrmanufacture_ID='"+intrmanufacture_ID+"'";
	if(vrn.validata((String)dbSession.getAttribute("unit_db_name"),"stock_gather","reasonexact",intrmanufacture_ID)<record_number){
		double gather_cost_price_sum=rs9.getDouble("demand_cost_price_sum")+module_cost_price_sum;
		double gather_demand_price=gather_cost_price_sum/rs9.getDouble("demand_amount");
		String gather_ID=NseerId.getId("stock/gather",(String)dbSession.getAttribute("unit_db_name"));
		String sql5="insert into stock_gather(gather_ID,reason,reasonexact,reasonexact_details,demand_amount,cost_price,cost_price_sum,register,register_time) values('"+gather_ID+"','委外入库','"+intrmanufacture_ID+"','"+rs9.getString("provider_name")+"','"+rs9.getString("demand_amount")+"','"+rs9.getString("demand_price")+"','"+gather_cost_price_sum+"','"+register+"','"+register_time+"')";
		stock_db.executeUpdate(sql5) ;
		String sql17="insert into stock_gather_details(gather_ID,details_number,product_ID,product_name,amount,ungather_amount,cost_price,subtotal) values('"+gather_ID+"','1','"+product_ID+"','"+product_name+"','"+rs9.getString("demand_amount")+"','"+rs9.getString("demand_amount")+"','"+gather_demand_price+"','"+gather_cost_price_sum+"')";
		stock_db.executeUpdate(sql17) ;
	}
	}
	String sql99="select * from intrmanufacture_details where intrmanufacture_ID='"+intrmanufacture_ID+"'";
	ResultSet rs99=intrmanufacture_db.executeQuery(sql99) ;
	while(rs99.next()){
		String chain_id="";
		String chain_name="";	
		String intrmanufacturer_ID="";
		String intrmanufacturer="";
		String sql15="select * from intrmanufacture_file where provider_ID='"+rs99.getString("provider_ID")+"'";
		ResultSet rs15=intrmanufacturedb.executeQuery(sql15);
		if(rs15.next()){
			chain_id=rs15.getString("chain_id");
			chain_name=rs15.getString("chain_name");			
			intrmanufacturer_ID=rs15.getString("intrmanufacturer_ID");
			intrmanufacturer=rs15.getString("intrmanufacturer");
			if(rs99.getDouble("demand_cost_price_sum")>=0){
			double trade_amount=rs15.getDouble("trade_amount")+1;
			double trade_sum=rs15.getDouble("achievement_sum")+rs99.getDouble("demand_cost_price_sum");
			String sql90="update intrmanufacture_file set trade_amount='"+trade_amount+"',achievement_sum='"+trade_sum+"' where provider_ID='"+rs99.getString("provider_ID")+"'";
			intrmanufacture_db1.executeUpdate(sql90) ;
			}else{
			double return_amount=rs15.getDouble("return_amount")+1;
			double trade_sum=rs15.getDouble("achievement_sum")+rs99.getDouble("demand_cost_price_sum");
			double return_sum=rs15.getDouble("return_sum")+rs99.getDouble("demand_cost_price_sum");
			String sql90="update intrmanufacture_file set return_amount='"+return_amount+"',achievement_sum='"+trade_sum+"',return_sum='"+return_sum+"' where provider_ID='"+rs99.getString("provider_ID")+"'";
			intrmanufacture_db1.executeUpdate(sql90) ;
			}
		}
		String fund_ID=NseerId.getId("fund/pay",(String)dbSession.getAttribute("unit_db_name"));
		if(vrn.validata((String)dbSession.getAttribute("unit_db_name"),"fund_fund","reasonexact",intrmanufacture_ID)<record_number){
		String sql12="insert into fund_fund(fund_ID,reason,reasonexact,chain_id,chain_name,funder,funder_ID,file_chain_id,file_chain_name,demand_cost_price_sum,currency_name,personal_unit,register,register_time,sales_purchaser_ID,sales_purchaser_name) values('"+fund_ID+"','付款','"+intrmanufacture_ID+"','"+chain_id+"','"+chain_name+"','"+rs99.getString("provider_name")+"','"+rs99.getString("provider_ID")+"','2121','应付账款-委外加工费','"+rs99.getString("demand_cost_price_sum")+"','人民币','元','"+register+"','"+register_time+"','"+intrmanufacturer_ID+"','"+intrmanufacturer+"')";
		fund_db.executeUpdate(sql12) ;
		}
	}
	}else{
		Iterator ite=rsList.iterator();
		while(ite.hasNext()){
		elem=(String[])ite.next();
		sql = "insert into intrmanufacture_workflow(config_id,object_ID,describe1,describe2) values ('"+elem[0]+"','"+intrmanufacture_ID+"','"+elem[1]+"','"+elem[2]+"')" ;
		intrmanufacture_db.executeUpdate(sql) ;
		}
	}
response.sendRedirect("intrmanufacture/intrmanufacture/registerNew_choose.jsp?intrmanufacture_ID="+intrmanufacture_ID+"");
}else{
session.setAttribute("product_name",product_name);
session.setAttribute("product_ID",product_ID);
response.sendRedirect("intrmanufacture/intrmanufacture/registerNew_ok_a.jsp");
}
  }else{
session.setAttribute("product_name",product_name);
session.setAttribute("product_ID",product_ID);
response.sendRedirect("intrmanufacture/intrmanufacture/registerNew_ok_b.jsp");
}
intrmanufacture_db.commit();
	intrmanufacture_db1.commit();
	stock_db.commit();
fund_db.commit();
intrmanufacturedb.commit();
intrmanufacture_db.close();
	intrmanufacture_db1.close();
	stock_db.close();
fund_db.close();
intrmanufacturedb.close();
}else{
	response.sendRedirect("error_conn.htm");
}
}catch(Exception ex){ex.printStackTrace();}
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -