2024-12-18 10:38:31 +08:00
|
|
|
package hhwms;
|
|
|
|
|
|
|
|
|
|
import java.sql.DriverManager;
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
|
|
import com.mysql.jdbc.Connection;
|
|
|
|
|
import com.mysql.jdbc.Statement;
|
2024-12-23 17:43:04 +08:00
|
|
|
import org.apache.log4j.Logger;
|
2024-12-18 10:38:31 +08:00
|
|
|
public class demo {
|
2024-12-23 17:43:04 +08:00
|
|
|
private static Logger logger = Logger.getLogger(demo.class);
|
2024-12-18 10:38:31 +08:00
|
|
|
public static void main(String[] args) throws ClassNotFoundException, SQLException {
|
|
|
|
|
//1.注册数据库驱动
|
|
|
|
|
Class.forName("com.mysql.jdbc.Driver");
|
|
|
|
|
Connection conn= (Connection) DriverManager.getConnection("jdbc:mysql://47.100.54.81:53306/lptwms?useUnicode=true&characterEncoding=utf-8&useSSL=true","root","Youchain@56");
|
|
|
|
|
Statement stat=(Statement) conn.createStatement();
|
|
|
|
|
String sql=" select GROUP_CONCAT(a.ID) as pickIds ,count(a.ID),a.it "
|
|
|
|
|
+ " from (select pt.ID,GROUP_CONCAT(i.ID) as 'it' from pick_ticket pt "
|
|
|
|
|
+ " left join pick_ticket_detail ptd on pt.ID=ptd.PICK_TICKET_ID "
|
|
|
|
|
+ " left join item i on i.ID=ptd.ITEM_ID "
|
|
|
|
|
+ " where i.ISBOM='T' "
|
|
|
|
|
+ " and pt.`STATUS`='OPEN' "
|
|
|
|
|
+ " GROUP BY pt.ID "
|
|
|
|
|
+ " ORDER BY i.ID ASC) as a GROUP BY a.it ";
|
|
|
|
|
ResultSet rs=stat.executeQuery(sql);
|
|
|
|
|
while (rs.next()){
|
|
|
|
|
String id=rs.getString("pickIds");
|
2024-12-23 17:43:04 +08:00
|
|
|
logger.info(id);
|
2024-12-18 10:38:31 +08:00
|
|
|
}
|
|
|
|
|
rs.close();
|
|
|
|
|
stat.close();
|
|
|
|
|
conn.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|