统计-票据明细统计表加入多商品支持

dev
wuwenxiong 2021-09-14 17:37:07 +08:00
parent 85ae9a2da2
commit b03dbc62cd
2 changed files with 19 additions and 8 deletions

View File

@ -21,12 +21,12 @@ public class InvoiceUseController extends Controller {
String order_sn = get("order_sn");
String truck_license = get("truck_license");
Integer order_state = getInt("order_state");
Integer product_id = getInt("product_id");
int export = getInt("export", 0);
if (export == 0) {
renderJson(Result.success(InvoiceUseService.me.statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state)));
renderJson(Result.success(InvoiceUseService.me.statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state, product_id)));
}else{
Workbook wb = InvoiceUseService.me.statuseExport(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state);
Workbook wb = InvoiceUseService.me.statuseExport(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state, product_id);
render(new ExcelRender(tm + "_票据使用记录_" + System.currentTimeMillis() + ".xlsx", wb));
}
}

View File

@ -39,12 +39,13 @@ public class InvoiceUseService {
String ticket_code,
String order_sn,
String truck_license,
Integer order_state
Integer order_state,
Integer product_id
) {
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.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, o.ticket_code\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, o.ticket_code,o.product_id,o.product_name\n" +
" , s.name supermarket_name " +
" from invoice_log t\n" +
" left join invoice_receive r on t.invoice_receive_id = r.id\n" +
@ -55,7 +56,7 @@ public class InvoiceUseService {
String ordsql = "select\n" +
" t.uuid rowkey, t.invoice_number, t.invoice_code, l.state invoice_state, t.settlement_user_name, l.settlement_time, t.create_time, l.invalid_time, l.invalid_memo, t.invoice_type, l.invalid_user_name\n" +
" , r.receive_user_name, r.create_time receive_time, t.supermarket_id \n" +
" , 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, t.ticket_code \n" +
" , 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, t.ticket_code,t.product_id,t.product_name \n" +
" , s.name supermarket_name \n" +
" from order_temp t \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" +
@ -121,6 +122,13 @@ public class InvoiceUseService {
paramlog.add("%" + ticket_code.trim() + "%");
paramord.add("%" + ticket_code.trim() + "%");
}
if (product_id!=null && product_id>0) {
logsql += " and o.product_id = ? \n";
ordsql += " and t.product_id = ? \n";
paramlog.add(product_id);
paramord.add(product_id);
}
if (invoice_state != null) {
if (invoice_state == 9) {
@ -238,9 +246,10 @@ public class InvoiceUseService {
String ticket_code,
String order_sn,
String truck_license,
Integer order_state
Integer order_state,
Integer product_id
) {
Record ret = statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state);
Record ret = statuse(tm, supermarket_id, invoice_type, invoice_number, invoice_code, invoice_state, ticket_code, order_sn, truck_license, order_state, product_id);
List<Record> list = ret.get("list");
@ -251,6 +260,7 @@ public class InvoiceUseService {
Row row = sheet.createRow(0);
int a = 0;
row.createCell(a++).setCellValue("序号");
row.createCell(a++).setCellValue("品类");
row.createCell(a++).setCellValue("订单号");
row.createCell(a++).setCellValue("新建时间");
row.createCell(a++).setCellValue("砂站");
@ -280,6 +290,7 @@ public class InvoiceUseService {
row = sheet.createRow(i + 1);
a = 0;
row.createCell(a++).setCellValue(i + 1);
row.createCell(a++).setCellValue(order.getStr("product_name"));
row.createCell(a++).setCellValue(order.getStr("order_sn"));
row.createCell(a++).setCellValue(DateTimeUtil.sdfhms.get().format(order.getDate("create_time")));
row.createCell(a++).setCellValue(order.getStr("supermarket_name"));