lisai17@sina.com 2020-09-24 19:57:38 +08:00
parent f4886af87b
commit 53bd81f12b
7 changed files with 42 additions and 36 deletions

View File

@ -23,16 +23,13 @@ public class OverallService {
"before_day_total_weight": 693.00, // 前日配额重量
"month_total_weight": 7930.00, // 当月配额重量
"day_total_weight": 160.00, // 当日配额重量
"total_weight": 8376.00 // 总配额重量
},
"ordercluster_truck": [
{
"month_cnt": 49, // 当月分配车次
"day_cnt": 0, // 当日分配车次
"cnt": 53, // 总分配车次
"before_month_cnt": 4, // 前月分配车次
"before_day_cnt": 0 // 前日分配撤职
}
"total_weight": 8376.00, // 总配额重量
"month_truck_cnt": 49, // 当月分配车次
"day_truck_cnt": 0, // 当日分配车次
"truck_cnt": 53, // 总分配车次
"before_month_truck_cnt": 4, // 前月分配车次
"before_daytruck__cnt": 0 // 前日分配撤职
],
"by_supermarket": [
{
@ -119,6 +116,12 @@ public class OverallService {
]
}
}
select count(t.sn) cnt, sum(t.weight) weight, sum(t.total_price) total_price, date_format(t.create_time, '%Y-%m-%d') date from order_temp t
where t.state = 5
group by date
*/
public Record stat(Integer supermarket_id){
long st = System.currentTimeMillis();
@ -155,11 +158,11 @@ public class OverallService {
" where t.state < ?";
String sql_ordercluster_truck = "select\n" +
" count(t.id) cnt,\n" +
" sum(case when t.change_time like '" + nowmonttm +"%' then 1 else 0 end) month_cnt,\n" +
" sum(case when t.change_time like '" + nowdaytm + "%' then 1 else 0 end) day_cnt,\n" +
" sum(case when t.change_time like '" + premonthtm + "%' then 1 else 0 end) before_month_cnt,\n" +
" sum(case when t.change_time like '" + predaytm + "%' then 1 else 0 end) before_day_cnt\n" +
" count(t.id) truck_cnt,\n" +
" sum(case when t.change_time like '" + nowmonttm +"%' then 1 else 0 end) month_truck_cnt,\n" +
" sum(case when t.change_time like '" + nowdaytm + "%' then 1 else 0 end) day_truck_cnt,\n" +
" sum(case when t.change_time like '" + premonthtm + "%' then 1 else 0 end) before_month_truck_cnt,\n" +
" sum(case when t.change_time like '" + predaytm + "%' then 1 else 0 end) before_day_truck_cnt\n" +
" from ordercluster_truck t\n" +
" left join ordercluster c on c.id = t.ordercluster_id\n" +
" where c.state < ?";
@ -259,8 +262,12 @@ public class OverallService {
" ) a on a.supermarket_id = s.id", OrderStateEnum.RECEIVED.getStateid()));
}
out.set("ordercluster", Db.findFirst(sql_ordercluster, params1.toArray()));
out.set("ordercluster_truck", Db.find(sql_ordercluster_truck, params1.toArray()));
Record ocout = Db.findFirst(sql_ordercluster, params1.toArray());
Record oct = Db.findFirst(sql_ordercluster_truck, params1.toArray());
ocout.setColumns(oct);
out.set("ordercluster", ocout);
out.set("by_customer", Db.find(sql_by_customer + " group by t.customer_id", params2.toArray()));
return out;

View File

@ -118,12 +118,12 @@ public class DeviceThread extends Thread {
Record record = Db.findFirst("select * from device_config where supermarket_id = ? ", CliCacheData.SUP.getId());
if (record == null) {
log.error("从数据库未读到有效的砂站本地配置文件");
log.error("从数据库未读到有效的砂站本地配置文件");
log.error("从数据库未读到有效的砂站本地配置文件");
log.error("从数据库未读到有效的砂站本地配置文件");
log.error("从数据库未读到有效的砂站本地配置文件");
log.error("从数据库未读到有效的砂站本地配置文件");
log.error("从数据库未读到有效的砂站本地配置文件配置文件id:%s", CliCacheData.SUP.getId());
log.error("从数据库未读到有效的砂站本地配置文件配置文件id:%s", CliCacheData.SUP.getId());
log.error("从数据库未读到有效的砂站本地配置文件配置文件id:%s", CliCacheData.SUP.getId());
log.error("从数据库未读到有效的砂站本地配置文件配置文件id:%s", CliCacheData.SUP.getId());
log.error("从数据库未读到有效的砂站本地配置文件配置文件id:%s", CliCacheData.SUP.getId());
log.error("从数据库未读到有效的砂站本地配置文件配置文件id:%s", CliCacheData.SUP.getId());
return;
}
@ -166,10 +166,11 @@ public class DeviceThread extends Thread {
LEDThread led = new LEDThread(which + "_led", ledconf.getString("ip"), ledconf.getIntValue("port"));
AbsScale scale;
// 根据超市id兼容不同的表头
if (supermarket_id == 3) { // 城隍用了耀华的表头
scale = new YaoHuaScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port"));
} else if (supermarket_id == 4) { // 石畈用了两个不一样的表头
if (scaleconf.getIntValue("port") == 10001) {
if (scaleconf.getIntValue("port") == 10001) { // 根据现场实际接线配置
scale = new YaoHuaScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port"));
} else {
scale = new XiShuiScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port"));

View File

@ -159,8 +159,7 @@ public class InController extends Controller implements Runnable {
}
// 获取到地感线圈状态后,等待 5 秒后开始称重
// 2020-07-23 调整为 2500之前是 5000
Thread.sleep(2500);
Thread.sleep(5000);
double weight = 0;
int tryCount = 0;

View File

@ -159,8 +159,7 @@ public class OutController extends Controller implements Runnable {
}
// 获取到地感线圈状态后,等待 5 秒后开始称重
// 2020-07-23 调整为 2500之前是 5000
Thread.sleep(2500);
Thread.sleep(5000);
double weight = 0;
int tryCount = 0;

View File

@ -10,7 +10,7 @@ socketserver.port=21002
socketio.port=12002
#当前部署本地程序的砂站id
current.supermarket_id=1
current.supermarket_id=4
#打印用到的配置信息
print.vendor=浠水县长投环保有限公司

View File

@ -1,12 +1,12 @@
# mysql
# GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.119' IDENTIFIED BY 'Local_1' WITH GRANT OPTION;
jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
user=dev_ssjy_xsx
password=Ssjy_xs_890
#jdbcUrl=jdbc:mysql://rm-wz9wa070076b2uge2ro.mysql.rds.aliyuncs.com:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
#user=dev_ssjy_xsx
#password=Ssjy_xs_890
#jdbcUrl=jdbc:mysql://192.168.20.2:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
#user=root
#password=Ssjy_xsx_890
jdbcUrl=jdbc:mysql://192.168.20.2:3306/ssjy_xsx_dev?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
user=root
password=Ssjy_xsx_890
# redis
redis.basekey=ssjcgl_xsx_dev

View File

@ -10,7 +10,7 @@ socketserver.port=21002
socketio.port=12002
#当前部署本地程序的砂站id
current.supermarket_id=6
current.supermarket_id=4
#打印用到的配置信息
print.vendor=浠水县长投环保有限公司