|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574 |
- use serde::{Deserialize, Serialize};
- use tokio_postgres::Error as PgError;
- use chrono::NaiveDateTime;
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyAllot {
- pub id: i32,
- pub userid: Option<i32>,
- pub username: Option<String>,
- pub informationid: Option<i32>,
- pub allottime: Option<NaiveDateTime>,
- pub hy_code: Option<String>,
- pub hy_type: Option<String>,
- pub hy_method: Option<String>,
- pub hy_quest: Option<String>,
- }
-
- impl HyAllot {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_allot (id, userid, username, informationid, allottime,
- hy_code, hy_type, hy_method, hy_quest)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
- &[&self.id, &self.userid, &self.username, &self.informationid, &self.allottime,
- &self.hy_code, &self.hy_type, &self.hy_method, &self.hy_quest],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyFullWaterSample {
- pub id: i32,
- pub qs_code: Option<String>,
- pub qs_tonnage: Option<f64>,
- pub mt: Option<f64>,
- pub remark: Option<String>,
- pub onecode: Option<String>,
- pub towcode: Option<String>,
- pub fx_code: Option<String>,
- pub fx_onecode: Option<String>,
- pub fx_twocode: Option<String>,
- }
-
- impl HyFullWaterSample {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_fullwatersample (id, qs_code, qs_tonnage, mt, remark,
- onecode, towcode, fx_code, fx_onecode, fx_twocode)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
- &[&self.id, &self.qs_code, &self.qs_tonnage, &self.mt, &self.remark,
- &self.onecode, &self.towcode, &self.fx_code, &self.fx_onecode, &self.fx_twocode],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyInformationNorm {
- pub id: i32,
- pub information_id: Option<i32>,
- pub hy_id: Option<i32>,
- pub norm_name: Option<String>,
- pub flag: Option<i16>,
- pub apparatus_id: Option<i32>,
- pub need_compute: Option<i16>,
- pub formula: Option<String>,
- pub secondformula: Option<String>,
- pub mapping: Option<String>,
- pub input_type: Option<i32>,
- pub round: Option<i32>,
- pub sort: Option<i32>,
- }
-
- impl HyInformationNorm {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_informationnorm (id, information_id, hy_id, norm_name,
- flag, apparatus_id, need_compute, formula, secondformula, mapping, input_type,
- round, sort)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",
- &[&self.id, &self.information_id, &self.hy_id, &self.norm_name, &self.flag,
- &self.apparatus_id, &self.need_compute, &self.formula, &self.secondformula,
- &self.mapping, &self.input_type, &self.round, &self.sort],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyItemDetail {
- pub id: i32,
- pub record_id: Option<i32>,
- pub information_id: Option<i32>,
- pub laboratory_id: Option<i32>,
- pub number: Option<i32>,
- pub cancellation: Option<i16>,
- pub detectionuser: Option<String>,
- pub detectiontime: Option<NaiveDateTime>,
- pub original_num: Option<String>,
- pub hy_check: Option<i16>,
- pub checkuser: Option<String>,
- pub checktime: Option<NaiveDateTime>,
- pub oversize: Option<i16>,
- }
-
- impl HyItemDetail {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_itemdetail (id, record_id, information_id, laboratory_id,
- number, cancellation, detectionuser, detectiontime, original_num, hy_check,
- checkuser, checktime, oversize)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",
- &[&self.id, &self.record_id, &self.information_id, &self.laboratory_id,
- &self.number, &self.cancellation, &self.detectionuser, &self.detectiontime,
- &self.original_num, &self.hy_check, &self.checkuser, &self.checktime,
- &self.oversize],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyLaboratoryInstrument {
- pub id: i32,
- pub norm_id: Option<i32>,
- pub instrument_id: Option<i32>,
- }
-
- impl HyLaboratoryInstrument {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_laboratory_instrument (id, norm_id, instrument_id)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3)",
- &[&self.id, &self.norm_id, &self.instrument_id],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyMaterialAnalysisType {
- pub id: i32,
- pub name: Option<String>,
- pub flag: Option<i16>,
- pub sort: Option<i32>,
- pub createtime: Option<NaiveDateTime>,
- pub createuser: Option<String>,
- }
-
- impl HyMaterialAnalysisType {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_material_analysis_type (id, name, flag, sort, createtime,
- createuser)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6)",
- &[&self.id, &self.name, &self.flag, &self.sort, &self.createtime, &self.createuser],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyMaterialDetail {
- pub id: i32,
- pub name: Option<String>,
- pub flag: Option<i32>,
- pub sort: Option<i32>,
- pub createtime: Option<NaiveDateTime>,
- pub createuser: Option<String>,
- pub analysistypeid: Option<i32>,
- pub materialid: Option<i32>,
- }
-
- impl HyMaterialDetail {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_material_detail (id, name, flag, sort, createtime,
- createuser, analysistypeid, materialid)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
- &[&self.id, &self.name, &self.flag, &self.sort, &self.createtime, &self.createuser,
- &self.analysistypeid, &self.materialid],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyNorm {
- pub id: i32,
- pub norm_id: Option<i32>,
- pub zbvalues: Option<f64>,
- pub itemdetail_id: Option<i32>,
- pub hy_user: Option<String>,
- pub checktime: Option<NaiveDateTime>,
- pub explain: Option<String>,
- }
-
- impl HyNorm {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_norm (id, norm_id, zbvalues, itemdetail_id, hy_user,
- checktime, explain)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7)",
- &[&self.id, &self.norm_id, &self.zbvalues, &self.itemdetail_id, &self.hy_user,
- &self.checktime, &self.explain],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyWarmHumid {
- pub id: i32,
- pub laboratoryid: Option<i32>,
- pub temperature: Option<f64>,
- pub humidity: Option<f64>,
- pub begintime: Option<NaiveDateTime>,
- pub endtime: Option<NaiveDateTime>,
- pub username: Option<String>,
- }
-
- impl HyWarmHumid {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_warmhumid (id, laboratoryid, temperature, humidity,
- begintime, endtime, username)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7)",
- &[&self.id, &self.laboratoryid, &self.temperature, &self.humidity,
- &self.begintime, &self.endtime, &self.username],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyTask {
- pub id: i32,
- pub task_name: Option<String>,
- pub task_type: Option<String>,
- pub task_num: Option<String>,
- pub is_auto: Option<bool>,
- pub task_time: Option<NaiveDateTime>,
- pub state: Option<i32>,
- pub create_by: Option<String>,
- pub create_time: Option<NaiveDateTime>,
- pub update_by: Option<String>,
- pub update_time: Option<NaiveDateTime>,
- }
-
- impl HyTask {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_task (id, task_name, task_type, task_num, is_auto,
- task_time, state, create_by, create_time, update_by, update_time)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
- &[&self.id, &self.task_name, &self.task_type, &self.task_num, &self.is_auto,
- &self.task_time, &self.state, &self.create_by, &self.create_time,
- &self.update_by, &self.update_time],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HySpotcheck {
- pub id: i32,
- pub spotcheck_code: Option<String>,
- pub spotcheck_user: Option<String>,
- pub spotcheck_time: Option<NaiveDateTime>,
- pub spotcheck_type: Option<String>,
- pub coal_sample_code: Option<String>,
- pub sample_custodian: Option<String>,
- pub sampling_time: Option<NaiveDateTime>,
- pub quality_incoming: Option<f64>,
- pub granularity: Option<String>,
- pub spotcheck_compare: Option<String>,
- pub mt: Option<f64>,
- pub mad: Option<f64>,
- pub aad: f64, // NOT NULL
- pub ad: Option<f64>,
- pub vad: Option<f64>,
- pub vdaf: Option<f64>,
- pub var_data: Option<f64>,
- pub st_ad: Option<f64>,
- pub st_d: Option<f64>,
- pub qb_ad: Option<f64>,
- pub had: Option<f64>,
- pub qnet_ar: Option<f64>,
- pub qnet_ar1: Option<f64>,
- pub qgr_d: Option<f64>,
- pub qgr_ad: Option<f64>,
- pub vd: Option<f64>,
- pub aar: Option<f64>,
- pub st_ar: Option<f64>,
- pub hd: Option<f64>,
- pub fcad: Option<f64>,
- pub crc: Option<i64>,
- pub st_daf: Option<f64>,
- }
-
- impl HySpotcheck {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_spotcheck (id, spotcheck_code, spotcheck_user,
- spotcheck_time, spotcheck_type, coal_sample_code, sample_custodian,
- sampling_time, quality_incoming, granularity, spotcheck_compare, mt, mad, aad,
- ad, vad, vdaf, var_data, st_ad, st_d, qb_ad, had, qnet_ar, qnet_ar1, qgr_d,
- qgr_ad, vd, aar, st_ar, hd, fcad, crc, st_daf)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15,
- $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30,
- $31, $32, $33)",
- &[&self.id, &self.spotcheck_code, &self.spotcheck_user, &self.spotcheck_time,
- &self.spotcheck_type, &self.coal_sample_code, &self.sample_custodian,
- &self.sampling_time, &self.quality_incoming, &self.granularity,
- &self.spotcheck_compare, &self.mt, &self.mad, &self.aad, &self.ad, &self.vad,
- &self.vdaf, &self.var_data, &self.st_ad, &self.st_d, &self.qb_ad, &self.had,
- &self.qnet_ar, &self.qnet_ar1, &self.qgr_d, &self.qgr_ad, &self.vd, &self.aar,
- &self.st_ar, &self.hd, &self.fcad, &self.crc, &self.st_daf],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyWeightInput {
- pub id: i32,
- pub information_id: i32,
- pub information_norm_id: i32,
- }
-
- impl HyWeightInput {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_weight_input (id, information_id, information_norm_id)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3)",
- &[&self.id, &self.information_id, &self.information_norm_id],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Deserialize)]
- pub struct InstrumentInfo {
- pub id: i32,
- pub laboratoryid: Option<i32>,
- pub name: Option<String>,
- pub instrumentcode: Option<String>,
- pub informationid: Option<i32>,
- pub specification: Option<String>,
- pub remark: Option<String>,
- }
-
- impl InstrumentInfo {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_instrument (id, laboratoryid, name, instrumentcode,
- informationid, specification, remark)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7)",
- &[&self.id, &self.laboratoryid, &self.name, &self.instrumentcode,
- &self.informationid, &self.specification, &self.remark],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyInformation {
- pub id: i32,
- pub hy_name: Option<String>,
- pub flag: Option<i32>,
- pub laboratory_id: Option<i32>,
- pub analysistypeid: Option<i32>,
- }
-
- impl HyInformation {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_information (id, hy_name, flag, laboratory_id, analysistypeid)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5)",
- &[&self.id, &self.hy_name, &self.flag, &self.laboratory_id, &self.analysistypeid],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyCyTask {
- pub id: i32,
- pub task_id: Option<i32>,
- pub task_name: Option<String>,
- pub task_status: Option<i32>,
- pub create_time: Option<NaiveDateTime>,
- pub create_user: Option<String>,
- pub remark: Option<String>,
- }
-
- impl HyCyTask {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_cytask (id, task_id, task_name, task_status, create_time,
- create_user, remark)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7)",
- &[&self.id, &self.task_id, &self.task_name, &self.task_status,
- &self.create_time, &self.create_user, &self.remark],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HyRecord {
- #[serde(skip_deserializing)]
- pub id: i32,
- pub hy_code: Option<String>,
- pub hy_type: Option<String>,
- pub hy_check: Option<i16>,
- pub hy_approve: Option<i16>,
- pub check_time: Option<NaiveDateTime>,
- pub approve_time: Option<NaiveDateTime>,
- pub approve_user: Option<String>,
- pub check_user: Option<String>,
- pub hy_time: Option<NaiveDateTime>,
- pub hy_values: Option<String>,
- pub accept_time: Option<NaiveDateTime>,
- pub accept_user: Option<String>,
- pub mt: Option<f64>,
- pub mad: Option<f64>,
- pub aad: Option<f64>,
- pub ad: Option<f64>,
- pub vad: Option<f64>,
- pub vd: Option<f64>,
- pub var_data: Option<f64>,
- pub vdaf: Option<f64>,
- pub fcad: Option<f64>,
- pub st_ar: Option<f64>,
- pub st_ad: Option<f64>,
- pub st_d: Option<f64>,
- pub had: Option<f64>,
- pub hd: Option<f64>,
- pub qb_ad: Option<f64>,
- pub qgr_ad: Option<f64>,
- pub qgr_d: Option<f64>,
- pub qnet_ar_mj_kg: Option<f64>,
- pub qnet_ar_j_cal: Option<i32>,
- pub v: Option<f64>,
- pub aar: Option<f64>,
- pub qnet_ar: Option<f64>,
- pub qnet_ar1: Option<f64>,
- pub crc: Option<i32>,
- pub st_daf: Option<f64>,
- pub cad: Option<f64>,
- pub cd: Option<f64>,
- pub isauto: Option<i16>,
- pub isnormal: Option<i32>,
- }
-
- impl HyRecord {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_record (hy_code, hy_type, hy_check, hy_approve, check_time,
- approve_time, approve_user, check_user, hy_time, hy_values, accept_time, accept_user,
- mt, mad, aad, ad, vad, vd, var, vdaf, fcad, st_ar, st_ad, st_d, had, hd, qb_ad,
- qgr_ad, qgr_d, qnet_ar_mj_kg, qnet_ar_j_cal, v, aar, qnet_ar, qnet_ar1, crc,
- st_daf, cad, cd, isauto, isnormal)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16,
- $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32,
- $33, $34, $35, $36, $37, $38, $39, $40, $41)",
- &[&self.hy_code, &self.hy_type, &self.hy_check, &self.hy_approve, &self.check_time,
- &self.approve_time, &self.approve_user, &self.check_user, &self.hy_time,
- &self.hy_values, &self.accept_time, &self.accept_user, &self.mt, &self.mad,
- &self.aad, &self.ad, &self.vad, &self.vd, &self.var_data, &self.vdaf, &self.fcad,
- &self.st_ar, &self.st_ad, &self.st_d, &self.had, &self.hd, &self.qb_ad,
- &self.qgr_ad, &self.qgr_d, &self.qnet_ar_mj_kg, &self.qnet_ar_j_cal, &self.v,
- &self.aar, &self.qnet_ar, &self.qnet_ar1, &self.crc, &self.st_daf, &self.cad,
- &self.cd, &self.isauto, &self.isnormal],
- )
- .await?;
- Ok(())
- }
- }
-
- #[derive(Debug, Serialize, Deserialize)]
- pub struct HySampleCollectionDetail {
- pub id: i32,
- pub num: i32,
- pub unit_num: i32,
- pub time: Option<NaiveDateTime>,
- pub type_: Option<i32>,
- pub sy_method: Option<i32>,
- pub sy_time: Option<NaiveDateTime>,
- pub one_num: Option<String>,
- pub two_num: Option<String>,
- pub three_num: Option<String>,
- pub sy_starttime: Option<NaiveDateTime>,
- pub sy_endtime: Option<NaiveDateTime>,
- pub cy_startnum: Option<String>,
- pub cy_endnum: Option<String>,
- pub sy_user: Option<String>,
- pub sy_car_count: Option<i32>,
- pub sy_dun_weight: Option<f64>,
- pub byz_bag_count: Option<i16>,
- pub y_liu: Option<i16>,
- pub zy_user: Option<String>,
- }
-
- impl HySampleCollectionDetail {
- pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
- client
- .execute(
- "INSERT INTO public.hy_sample_collection_detail (id, num, unit_num, time, type,
- sy_method, sy_time, one_num, two_num, three_num, sy_starttime, sy_endtime,
- cy_startnum, cy_endnum, sy_user, sy_car_count, sy_dun_weight, byz_bag_count,
- y_liu, zy_user)
- OVERRIDING SYSTEM VALUE
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15,
- $16, $17, $18, $19, $20)",
- &[&self.id, &self.num, &self.unit_num, &self.time, &self.type_, &self.sy_method,
- &self.sy_time, &self.one_num, &self.two_num, &self.three_num, &self.sy_starttime,
- &self.sy_endtime, &self.cy_startnum, &self.cy_endnum, &self.sy_user,
- &self.sy_car_count, &self.sy_dun_weight, &self.byz_bag_count, &self.y_liu,
- &self.zy_user],
- )
- .await?;
- Ok(())
- }
- }
|