Compare commits
2 Commits
c5d17ba613
...
8b1532d213
Author | SHA1 | Date | |
---|---|---|---|
8b1532d213 | |||
32cfe3d7df |
21
src/main.rs
21
src/main.rs
@ -292,18 +292,16 @@ impl MainWindow {
|
|||||||
|
|
||||||
fn start(&mut self, sender: Sender<Message>) -> () {
|
fn start(&mut self, sender: Sender<Message>) -> () {
|
||||||
let mes_config = self.mysql_config.clone();
|
let mes_config = self.mysql_config.clone();
|
||||||
let label = self.label.clone();
|
let mut label = self.label.clone();
|
||||||
let download_type: DownloadType = self.selection.unwrap();
|
let download_type: DownloadType = self.selection.unwrap();
|
||||||
let online = self.is_online.clone();
|
let online = self.is_online.clone();
|
||||||
if label == "" {
|
if label == "" {
|
||||||
add_log("请输入Label".to_string());
|
add_log("请输入Label".to_string());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if label.contains(":"){
|
label = label.replace(":", "");
|
||||||
add_log("Label不合法".to_string());
|
label = label.to_uppercase();
|
||||||
self.label = "".to_string();
|
add_log("Label: ".to_string() + label.as_str());
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
sleep(std::time::Duration::from_secs(5));
|
sleep(std::time::Duration::from_secs(5));
|
||||||
let mut download_wrapper = download_wrapper::DownloadWrapper::new();
|
let mut download_wrapper = download_wrapper::DownloadWrapper::new();
|
||||||
@ -326,6 +324,17 @@ impl MainWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
add_log("连接成功".to_string());
|
add_log("连接成功".to_string());
|
||||||
|
match mes_service.get_order_number(mes_config.work_order.clone()){
|
||||||
|
Ok(batch) => {
|
||||||
|
label = batch + &label[label.len() - 6..];
|
||||||
|
add_log("获取订单号成功".to_string());
|
||||||
|
},
|
||||||
|
Err(e) =>{
|
||||||
|
add_log(e.to_string());
|
||||||
|
sender.send(Message::DownloadEnd((label, false))).unwrap();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
add_log("正在过站检测".to_string());
|
add_log("正在过站检测".to_string());
|
||||||
let check_result = mes_service.check_station(
|
let check_result = mes_service.check_station(
|
||||||
mes_config.work_order.clone(),
|
mes_config.work_order.clone(),
|
||||||
|
@ -61,6 +61,18 @@ impl MesService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_order_number(&self, work_order: String)->Result<String, Error>{
|
||||||
|
let mut conn = self.pool.get_conn()?;
|
||||||
|
let order_number: Vec<String> = conn.query(format!(
|
||||||
|
"SELECT `Batch` FROM wisun_ordertables WHERE `OrderId` = '{work_order}'"
|
||||||
|
))?;
|
||||||
|
if order_number.is_empty() {
|
||||||
|
Err(Error::msg("No order number found"))
|
||||||
|
}else{
|
||||||
|
Ok(order_number[0].clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update_station(
|
pub fn update_station(
|
||||||
&self,
|
&self,
|
||||||
work_order: String,
|
work_order: String,
|
||||||
|
Loading…
Reference in New Issue
Block a user