📄 dealwith_ok.java
字号:
if(rs.next()){
id=rs.getString("id");
}
List rsList = GetWorkflow.getList(qcs_db, "crm_config_workflow", "04");
int service_count=0;
int pay_amount_sum=0;
double sale_price_sum=0.0d;
double cost_price_sum=0.0d;
double real_cost_price_sum=0.0d;
int stock_number=1;
double stock_product_number=0;
double stock_price=0.0d;
double order_sale_bonus_sum=0.00d;
double order_profit_bonus_sum=0.00d;
String sale_bonus_type="";
String bonus_cost_for_profit_type="";
String sql_hr2="select * from hr_config_public_char where kind='订单销售绩效计算方式'";
ResultSet rs_hr2=qcs_db.executeQuery(sql_hr2);
if(rs_hr2.next()){
sale_bonus_type=rs_hr2.getString("type_name");
bonus_cost_for_profit_type=rs_hr2.getString("bonus_cost_for_profit_type");
}
String sql0="select * from design_file where product_id='"+product_id+"'";
rs=qcs_db.executeQuery(sql0);
if(rs.next()){
Double amount_d=Double.parseDouble(amount)*(-1);
Double subtotal=rs.getDouble("list_price")*amount_d;
cost_price_sum=rs.getDouble("cost_price")*amount_d;
real_cost_price_sum=rs.getDouble("real_cost_price")*amount_d;
String sql1 = "insert into crm_order_details(order_id,details_number,product_id,product_name,product_describe,list_price,amount,cost_price,real_cost_price,subtotal,amount_unit) values ('"+order_id+"','1','"+product_id+"','"+product_name+"','"+rs.getString("product_describe")+"','"+rs.getString("list_price")+"','"+amount_d+"','"+rs.getString("cost_price")+"','"+rs.getString("real_cost_price")+"','"+subtotal+"','"+rs.getString("amount_unit")+"')" ;
qcs_db.executeUpdate(sql1);
String sql2="update crm_order set sale_price_sum='"+subtotal+"',uninvoice_sum='"+subtotal+"',ungather_sum='"+subtotal+"',cost_price_sum='"+cost_price_sum+"',real_cost_price_sum='"+real_cost_price_sum+"',pay_amount_sum='"+amount_d+"',unpay_amount_sum='"+amount_d+"' where order_id='"+order_id+"'";
qcs_db.executeUpdate(sql2);
String mod1="/erp/stock_pay_register_ok";
int filenum1=count.readTime((String)dbSession.getAttribute("unit_db_name"),mod1);
String pay_ID=time+filenum1;
count.writeTime((String)dbSession.getAttribute("unit_db_name"),mod1);String main_code2="";
String first_code2="";
String second_code2="";
sqlb="select * from document_first where main_kind_name='stock' and first_kind_name='pay' ";
ResultSet rsb=crm_db.executeQuery(sqlb) ;
if(rsb.next()){
main_code2=rsb.getString("main_code");
first_code2=rsb.getString("first_code");
second_code2=rsb.getString("second_code");
}
pay_ID=main_code2+first_code2+second_code2+pay_ID;
if(rsList.size()==0){
double order_sale_bonus_subtotal=getRateFromID.getRateFromID((String)dbSession.getAttribute("unit_db_name"),"design_file","product_id",product_id,"order_sale_bonus_rate")*subtotal/100;
double order_profit_bonus_subtotal=0.0d;
String product_type="";
String sql16="select * from design_file where product_id='"+product_id+"'";
ResultSet rs16=qcs_db.executeQuery(sql16);
if(rs16.next()){
product_type=rs16.getString("type");
}
if(product_type.equals("物料")||product_type.equals("外购商品")){
stock_product_number+=Double.parseDouble(amount);
stock_price+=cost_price_sum;
String sql6="insert into stock_pay_details(pay_ID,details_number,product_id,product_name,product_describe,type,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"+pay_ID+"','"+stock_number+"','"+product_id+"','"+product_name+"','','"+product_type+"','','"+cost_price_sum+"','"+amount+"','"+amount+"','0','"+amount+"')";
qcs_db.executeUpdate(sql6);
stock_number+=1;
}else if(product_type.equals("商品")||product_type.equals("部件")||product_type.equals("委外部件")){
stock_product_number+=Double.parseDouble(amount);
stock_price+=cost_price_sum;
String sql6="insert into stock_pay_details(pay_ID,details_number,product_id,product_name,product_describe,type,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"+pay_ID+"','"+stock_number+"','"+product_id+"','"+product_name+"','"+product_describe+"','"+product_type+"','','"+cost_price_sum+"','"+amount+"','"+amount+"','"+amount+"','0')";
qcs_db.executeUpdate(sql6);
stock_number+=1;
}else if(product_type.equals("服务型产品")){
service_count++;
}
sql2="";
if(service_count==num){
sql2="update crm_order set sale_price_sum='"+sale_price_sum+"',uninvoice_sum='"+sale_price_sum+"',ungather_sum='"+sale_price_sum+"',cost_price_sum='"+cost_price_sum+"',pay_amount_sum='"+pay_amount_sum+"',unpay_amount_sum='"+pay_amount_sum+"',check_tag='1',modify_tag='0',manufacture_tag='1',pay_tag='3',logistics_tag='3',receive_tag='3',gather_tag='1',invoice_tag='1',order_tag='1',order_status='执行',order_sale_bonus_sum='"+order_sale_bonus_sum+"' ,order_profit_bonus_sum='"+order_profit_bonus_sum+"',bonus_calculate_type='"+sale_bonus_type+"' where id='"+id+"'";
}else{
sql2="update crm_order set sale_price_sum='"+sale_price_sum+"',uninvoice_sum='"+sale_price_sum+"',ungather_sum='"+sale_price_sum+"',cost_price_sum='"+cost_price_sum+"',pay_amount_sum='"+pay_amount_sum+"',unpay_amount_sum='"+pay_amount_sum+"',check_tag='1',modify_tag='0',manufacture_tag='1',pay_tag='1',gather_tag='1',invoice_tag='1',order_tag='1',logistics_tag='1',receive_tag='1',order_status='执行',order_sale_bonus_sum='"+order_sale_bonus_sum+"' ,order_profit_bonus_sum='"+order_profit_bonus_sum+"',bonus_calculate_type='"+sale_bonus_type+"' where id='"+id+"'";
}
qcs_db.executeUpdate(sql2) ;
int trade_amount=0;
double achievement_sum=0.0d;
int return_amount=0;
double return_sum=0.0d;
sql3="select * from crm_file where customer_id='"+customer_id+"'";
ResultSet rs3=qcs_db.executeQuery(sql3);
if(rs3.next()){
trade_amount=rs3.getInt("trade_amount");
achievement_sum=rs3.getDouble("achievement_sum");
return_amount=rs3.getInt("return_amount");
return_sum=rs3.getDouble("return_sum");
}
if(sale_price_sum>0){
trade_amount+=1;
achievement_sum+=sale_price_sum;
}else{
trade_amount+=1;
return_amount+=1;
achievement_sum+=sale_price_sum;
return_sum+=sale_price_sum;
}
String sql4="update crm_file set trade_amount='"+trade_amount+"',return_amount='"+return_amount+"',achievement_sum='"+achievement_sum+"',return_sum='"+return_sum+"',lately_trade_time='"+time+"' where customer_id='"+customer_id+"'";
qcs_db.executeUpdate(sql4);
double cost_price1=stock_price/stock_product_number;
if(service_count!=num){
if(!vr.validata((String)dbSession.getAttribute("unit_db_name"),"stock_pay","reasonexact",order_id)){
String sql5="insert into stock_pay(pay_ID,reason,reasonexact,demand_amount,cost_price,cost_price_sum) values('"+pay_ID+"','销售出库','"+order_id+"','"+stock_product_number+"','"+cost_price1+"','"+stock_price+"')";
qcs_db.executeUpdate(sql5);
}
}
if(!vr.validata((String)dbSession.getAttribute("unit_db_name"),"fund_fund","reasonexact",order_id)){
String fund_ID=NseerId.getId("fund/gather",(String)dbSession.getAttribute("unit_db_name"));
String sql14="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+"','收款','"+order_id+"','"+chain_id+"','"+chain_name+"','"+customer_name+"','"+customer_id+"','1131','应收账款','"+sale_price_sum+"','人民币','元','','"+time+"','','')";
qcs_db.executeUpdate(sql14) ;
}
}else{
String sql="update crm_order set sale_price_sum='"+sale_price_sum+"',uninvoice_sum='"+sale_price_sum+"',ungather_sum='"+sale_price_sum+"',cost_price_sum='"+cost_price_sum+"',real_cost_price_sum='"+real_cost_price_sum+"',pay_amount_sum='"+pay_amount_sum+"',unpay_amount_sum='"+pay_amount_sum+"' where order_id='"+order_id+"'";
qcs_db.executeUpdate(sql) ;
Iterator ite=rsList.iterator();
while(ite.hasNext()){
String[] elem=(String[])ite.next();
sql = "insert into crm_workflow(config_id,object_ID,describe1,describe2) values ('"+elem[0]+"','"+order_id+"','"+elem[1]+"','"+elem[2]+"')" ;
qcs_db.executeUpdate(sql) ;
}
}
}
}
}
qcs_db.close();
crm_db.close();
stock_db.close();
response.sendRedirect("qcs/other/dealwith_ok.jsp?finished_tag=0");
}catch(Exception ex){
ex.printStackTrace();
response.sendRedirect("qcs/other/dealwith_ok.jsp?finished_tag=1");
}
}else{
response.sendRedirect("error_conn.htm");
}
}catch(Exception ex){
ex.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -