调整票据明细
parent
18c3d12db6
commit
d90a4dd80f
|
|
@ -42,7 +42,7 @@ public class InvoiceUseService {
|
|||
Integer order_state
|
||||
) {
|
||||
String logsql = "select \n" +
|
||||
" t.id rowkey, t.invoice_number, t.`code` invoice_code, t.state invoice_state, t.settlement_user_name, t.settlement_time, t.settlement_time create_time, t.invalid_time, t.invalid_memo, t.invoice_type, t.invalid_user_name\n" +
|
||||
" t.id rowkey, t.invoice_number, t.`code` invoice_code, t.state invoice_state, t.settlement_user_name, t.settlement_time, t.create_time, t.invalid_time, t.invalid_memo, t.invoice_type, t.invalid_user_name\n" +
|
||||
" , r.receive_user_name, r.create_time receive_time, r.supermarket_id\n" +
|
||||
" , o.sn order_sn, o.weight, o.total_price, o.unit_price, o.truck_license, o.customer_id, o.customer_texpayer_name, o.customer_texpayer_num, o.isprepaid, o.state order_state\n" +
|
||||
" , s.name supermarket_name " +
|
||||
|
|
@ -50,7 +50,7 @@ public class InvoiceUseService {
|
|||
" left join invoice_receive r on t.invoice_receive_id = r.id\n" +
|
||||
" left join order_temp o on o.sn = t.order_sn \n" +
|
||||
" left join supermarket s on s.id = r.supermarket_id \n" +
|
||||
" where 1 = 1 \n";
|
||||
" where t.state = 9 \n";
|
||||
|
||||
String ordsql = "select\n" +
|
||||
" t.uuid rowkey, t.invoice_number, t.invoice_code, null invoice_state, t.settlement_user_name, null settlement_time, t.create_time, null invalid_time, null invalid_memo, t.invoice_type, null invalid_user_name\n" +
|
||||
|
|
@ -58,15 +58,14 @@ public class InvoiceUseService {
|
|||
" , t.sn order_sn, t.weight, t.total_price, t.unit_price, t.truck_license, t.customer_id, t.customer_texpayer_name, t.customer_texpayer_num, t.isprepaid, t.state order_state \n" +
|
||||
" , s.name supermarket_name " +
|
||||
" from order_temp t \n" +
|
||||
" left join invoice_log l on l.order_sn = t.sn \n" +
|
||||
" left join invoice_log l on l.invoice_number = t.invoice_number and l.code = t.invoice_code and l.order_sn = t.sn \n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id \n" +
|
||||
" where t.invoice_type = 2 \n" +
|
||||
" and l.id is null\n";
|
||||
" where 1=1 \n";
|
||||
|
||||
List<Object> paramlog = new ArrayList<>();
|
||||
List<Object> paramord = new ArrayList<>();
|
||||
|
||||
logsql += " and t.settlement_time >= ? and t.settlement_time < date_add(?, interval 1 day)\n";
|
||||
logsql += " and t.create_time >= ? and t.create_time < date_add(?, interval 1 day)\n";
|
||||
ordsql += " and t.create_time >= ? and t.create_time < date_add(?, interval 1 day)\n";
|
||||
|
||||
paramlog.add(tm);
|
||||
|
|
@ -115,8 +114,10 @@ public class InvoiceUseService {
|
|||
}
|
||||
|
||||
if (invoice_state != null) {
|
||||
logsql += " and t.state = ? \n";
|
||||
paramlog.add(invoice_state);
|
||||
if (invoice_state == 9) {
|
||||
logsql += " and t.state = ? \n";
|
||||
paramlog.add(invoice_state);
|
||||
}
|
||||
}
|
||||
|
||||
if (order_state != null) {
|
||||
|
|
@ -127,26 +128,26 @@ public class InvoiceUseService {
|
|||
paramord.add(order_state);
|
||||
}
|
||||
|
||||
if (invoice_type != null) {
|
||||
logsql += " and t.invoice_type = ? \n";
|
||||
ordsql += " and t.invoice_type = ? \n";
|
||||
|
||||
paramlog.add(invoice_type);
|
||||
paramord.add(invoice_type);
|
||||
}
|
||||
|
||||
List<Record> list = new ArrayList<>();
|
||||
|
||||
if (invoice_state != null) {
|
||||
list = Db.find(logsql + " order by t.create_time", paramlog.toArray());
|
||||
} else {
|
||||
if (invoice_type != null && invoice_type == 1) {
|
||||
if(invoice_state == 9){
|
||||
list = Db.find(logsql + " order by t.create_time", paramlog.toArray());
|
||||
} else {
|
||||
if (invoice_type != null && invoice_type == 2) {
|
||||
logsql += " and t.invoice_type = ? \n";
|
||||
ordsql += " and t.invoice_type = ? \n";
|
||||
|
||||
paramlog.add(invoice_type);
|
||||
paramord.add(invoice_type);
|
||||
}
|
||||
|
||||
paramlog.addAll(paramord);
|
||||
|
||||
list = Db.find("select * from (" + logsql + "\n union \n " + ordsql + ") a order by a.create_time ", paramlog.toArray());
|
||||
}else if(invoice_state == 5){
|
||||
list = Db.find(ordsql + " order by t.create_time", paramord.toArray());
|
||||
}
|
||||
} else {
|
||||
paramlog.addAll(paramord);
|
||||
|
||||
list = Db.find("select * from (" + logsql + "\n union \n " + ordsql + ") a order by a.create_time ", paramlog.toArray());
|
||||
}
|
||||
|
||||
Record out = new Record();
|
||||
|
|
|
|||
Loading…
Reference in New Issue