Commit c24ffade by 张晓

fix bugs

1 parent dabaca17
......@@ -94,17 +94,35 @@ public class BatchServiceImpl implements BatchService {
" order by a.engineer_code asc";
int engCount = jdbcTemplate.update(sqlEngineer, batchNo, groupId);
// 未派过的工单
String sqlOrder = "INSERT INTO dispatch_order (group_id, batch_no, order_id , x, y, expect_time_begin, expect_time_end, tags, priority , skills , take_time )\n" +
" select a.org_group_id, ? , a.order_id, a.x, a.y , \n" +
" a.expect_time_begin, a.expect_time_end, a.tags, a.priority , concat(a.brand, a.type, a.skill) skills , b.take_time \n" +
" from order_request a left join product_category b on (a.brand=b.brand and a.type=b.type and a.skill=b.skill )\n" +
" where a.org_group_id=? and status='OPEN' and appointment_status='NOT_ASSIGNED' and appointment_method like 'AUTO%' \n" +
" and expect_time_begin between ? and ? \n" +
" where a.org_group_id=? and a.status='OPEN' " +
" and a.dt = ? " +
" and appointment_status ='NOT_ASSIGNED' and appointment_method like 'AUTO%' \n" +
" order by a.expect_time_begin asc ";
int orderCount = jdbcTemplate.update(sqlOrder, batchNo, groupId, batchDay + " 00:00:00", batchDay + " 23:59:59");
jdbcTemplate.update("update dispatch_batch set engineer_num=? , order_num=?, start_time=?, status='RUNNING' where group_id=? and batch_no=?",
engCount, orderCount, LocalDateTime.now(), groupId, batchNo);
int orderCount = jdbcTemplate.update(sqlOrder, batchNo, groupId, batchDay );
// 已派过PRE状态还可以再次派
String sqlOrderPre = "INSERT INTO dispatch_order (group_id, batch_no, order_id , x, y, expect_time_begin, expect_time_end, tags, priority , skills , take_time )\n" +
" select a.org_group_id, ?, a.order_id, a.x, a.y , \n" +
" a.expect_time_begin, a.expect_time_end, a.tags, a.priority , concat(a.brand, a.type, a.skill) skills , b.take_time \n" +
" from order_request a " +
" left join product_category b on (a.brand=b.brand and a.type=b.type and a.skill=b.skill )\n" +
" left join order_appointment o on (a.order_id =o.order_id)\n" +
" where a.org_group_id=? and a.status='OPEN' \n" +
" and a.dt = ? " +
" and a.appointment_status = 'ASSIGNED' and appointment_method like 'AUTO%' \n" +
" and o.pre_status ='PRE' \n" +
" order by a.expect_time_begin asc ";
int orderCountPre = jdbcTemplate.update(sqlOrderPre, batchNo, groupId, batchDay );
jdbcTemplate.update("update dispatch_batch set engineer_num=? , order_num=?, start_time=?, end_time=null, status='RUNNING' where group_id=? and batch_no=?",
engCount, orderCount+orderCountPre, LocalDateTime.now(), groupId, batchNo);
log.info("准备批次数据完成, groupId:{}, day:{}, batchNo:{}", groupId, batchDay, batchNo);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!