数据同步
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

models.rs 20KB

2 miesięcy temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. use serde::{Deserialize, Serialize};
  2. use tokio_postgres::Error as PgError;
  3. use chrono::NaiveDateTime;
  4. #[derive(Debug, Serialize, Deserialize)]
  5. pub struct HyAllot {
  6. pub id: i32,
  7. pub userid: Option<i32>,
  8. pub username: Option<String>,
  9. pub informationid: Option<i32>,
  10. pub allottime: Option<NaiveDateTime>,
  11. pub hy_code: Option<String>,
  12. pub hy_type: Option<String>,
  13. pub hy_method: Option<String>,
  14. pub hy_quest: Option<String>,
  15. }
  16. impl HyAllot {
  17. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  18. client
  19. .execute(
  20. "INSERT INTO public.hy_allot (id, userid, username, informationid, allottime,
  21. hy_code, hy_type, hy_method, hy_quest)
  22. OVERRIDING SYSTEM VALUE
  23. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
  24. &[&self.id, &self.userid, &self.username, &self.informationid, &self.allottime,
  25. &self.hy_code, &self.hy_type, &self.hy_method, &self.hy_quest],
  26. )
  27. .await?;
  28. Ok(())
  29. }
  30. }
  31. #[derive(Debug, Serialize, Deserialize)]
  32. pub struct HyFullWaterSample {
  33. pub id: i32,
  34. pub qs_code: Option<String>,
  35. pub qs_tonnage: Option<f64>,
  36. pub mt: Option<f64>,
  37. pub remark: Option<String>,
  38. pub onecode: Option<String>,
  39. pub towcode: Option<String>,
  40. pub fx_code: Option<String>,
  41. pub fx_onecode: Option<String>,
  42. pub fx_twocode: Option<String>,
  43. }
  44. impl HyFullWaterSample {
  45. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  46. client
  47. .execute(
  48. "INSERT INTO public.hy_fullwatersample (id, qs_code, qs_tonnage, mt, remark,
  49. onecode, towcode, fx_code, fx_onecode, fx_twocode)
  50. OVERRIDING SYSTEM VALUE
  51. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
  52. &[&self.id, &self.qs_code, &self.qs_tonnage, &self.mt, &self.remark,
  53. &self.onecode, &self.towcode, &self.fx_code, &self.fx_onecode, &self.fx_twocode],
  54. )
  55. .await?;
  56. Ok(())
  57. }
  58. }
  59. #[derive(Debug, Serialize, Deserialize)]
  60. pub struct HyInformationNorm {
  61. pub id: i32,
  62. pub information_id: Option<i32>,
  63. pub hy_id: Option<i32>,
  64. pub norm_name: Option<String>,
  65. pub flag: Option<i16>,
  66. pub apparatus_id: Option<i32>,
  67. pub need_compute: Option<i16>,
  68. pub formula: Option<String>,
  69. pub secondformula: Option<String>,
  70. pub mapping: Option<String>,
  71. pub input_type: Option<i32>,
  72. pub round: Option<i32>,
  73. pub sort: Option<i32>,
  74. }
  75. impl HyInformationNorm {
  76. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  77. client
  78. .execute(
  79. "INSERT INTO public.hy_informationnorm (id, information_id, hy_id, norm_name,
  80. flag, apparatus_id, need_compute, formula, secondformula, mapping, input_type,
  81. round, sort)
  82. OVERRIDING SYSTEM VALUE
  83. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",
  84. &[&self.id, &self.information_id, &self.hy_id, &self.norm_name, &self.flag,
  85. &self.apparatus_id, &self.need_compute, &self.formula, &self.secondformula,
  86. &self.mapping, &self.input_type, &self.round, &self.sort],
  87. )
  88. .await?;
  89. Ok(())
  90. }
  91. }
  92. #[derive(Debug, Serialize, Deserialize)]
  93. pub struct HyItemDetail {
  94. pub id: i32,
  95. pub record_id: Option<i32>,
  96. pub information_id: Option<i32>,
  97. pub laboratory_id: Option<i32>,
  98. pub number: Option<i32>,
  99. pub cancellation: Option<i16>,
  100. pub detectionuser: Option<String>,
  101. pub detectiontime: Option<NaiveDateTime>,
  102. pub original_num: Option<String>,
  103. pub hy_check: Option<i16>,
  104. pub checkuser: Option<String>,
  105. pub checktime: Option<NaiveDateTime>,
  106. pub oversize: Option<i16>,
  107. }
  108. impl HyItemDetail {
  109. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  110. client
  111. .execute(
  112. "INSERT INTO public.hy_itemdetail (id, record_id, information_id, laboratory_id,
  113. number, cancellation, detectionuser, detectiontime, original_num, hy_check,
  114. checkuser, checktime, oversize)
  115. OVERRIDING SYSTEM VALUE
  116. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",
  117. &[&self.id, &self.record_id, &self.information_id, &self.laboratory_id,
  118. &self.number, &self.cancellation, &self.detectionuser, &self.detectiontime,
  119. &self.original_num, &self.hy_check, &self.checkuser, &self.checktime,
  120. &self.oversize],
  121. )
  122. .await?;
  123. Ok(())
  124. }
  125. }
  126. #[derive(Debug, Serialize, Deserialize)]
  127. pub struct HyLaboratoryInstrument {
  128. pub id: i32,
  129. pub norm_id: Option<i32>,
  130. pub instrument_id: Option<i32>,
  131. }
  132. impl HyLaboratoryInstrument {
  133. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  134. client
  135. .execute(
  136. "INSERT INTO public.hy_laboratory_instrument (id, norm_id, instrument_id)
  137. OVERRIDING SYSTEM VALUE
  138. VALUES ($1, $2, $3)",
  139. &[&self.id, &self.norm_id, &self.instrument_id],
  140. )
  141. .await?;
  142. Ok(())
  143. }
  144. }
  145. #[derive(Debug, Serialize, Deserialize)]
  146. pub struct HyMaterialAnalysisType {
  147. pub id: i32,
  148. pub name: Option<String>,
  149. pub flag: Option<i16>,
  150. pub sort: Option<i32>,
  151. pub createtime: Option<NaiveDateTime>,
  152. pub createuser: Option<String>,
  153. }
  154. impl HyMaterialAnalysisType {
  155. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  156. client
  157. .execute(
  158. "INSERT INTO public.hy_material_analysis_type (id, name, flag, sort, createtime,
  159. createuser)
  160. OVERRIDING SYSTEM VALUE
  161. VALUES ($1, $2, $3, $4, $5, $6)",
  162. &[&self.id, &self.name, &self.flag, &self.sort, &self.createtime, &self.createuser],
  163. )
  164. .await?;
  165. Ok(())
  166. }
  167. }
  168. #[derive(Debug, Serialize, Deserialize)]
  169. pub struct HyMaterialDetail {
  170. pub id: i32,
  171. pub name: Option<String>,
  172. pub flag: Option<i32>,
  173. pub sort: Option<i32>,
  174. pub createtime: Option<NaiveDateTime>,
  175. pub createuser: Option<String>,
  176. pub analysistypeid: Option<i32>,
  177. pub materialid: Option<i32>,
  178. }
  179. impl HyMaterialDetail {
  180. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  181. client
  182. .execute(
  183. "INSERT INTO public.hy_material_detail (id, name, flag, sort, createtime,
  184. createuser, analysistypeid, materialid)
  185. OVERRIDING SYSTEM VALUE
  186. VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
  187. &[&self.id, &self.name, &self.flag, &self.sort, &self.createtime, &self.createuser,
  188. &self.analysistypeid, &self.materialid],
  189. )
  190. .await?;
  191. Ok(())
  192. }
  193. }
  194. #[derive(Debug, Serialize, Deserialize)]
  195. pub struct HyNorm {
  196. pub id: i32,
  197. pub norm_id: Option<i32>,
  198. pub zbvalues: Option<f64>,
  199. pub itemdetail_id: Option<i32>,
  200. pub hy_user: Option<String>,
  201. pub checktime: Option<NaiveDateTime>,
  202. pub explain: Option<String>,
  203. }
  204. impl HyNorm {
  205. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  206. client
  207. .execute(
  208. "INSERT INTO public.hy_norm (id, norm_id, zbvalues, itemdetail_id, hy_user,
  209. checktime, explain)
  210. OVERRIDING SYSTEM VALUE
  211. VALUES ($1, $2, $3, $4, $5, $6, $7)",
  212. &[&self.id, &self.norm_id, &self.zbvalues, &self.itemdetail_id, &self.hy_user,
  213. &self.checktime, &self.explain],
  214. )
  215. .await?;
  216. Ok(())
  217. }
  218. }
  219. #[derive(Debug, Serialize, Deserialize)]
  220. pub struct HyWarmHumid {
  221. pub id: i32,
  222. pub laboratoryid: Option<i32>,
  223. pub temperature: Option<f64>,
  224. pub humidity: Option<f64>,
  225. pub begintime: Option<NaiveDateTime>,
  226. pub endtime: Option<NaiveDateTime>,
  227. pub username: Option<String>,
  228. }
  229. impl HyWarmHumid {
  230. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  231. client
  232. .execute(
  233. "INSERT INTO public.hy_warmhumid (id, laboratoryid, temperature, humidity,
  234. begintime, endtime, username)
  235. OVERRIDING SYSTEM VALUE
  236. VALUES ($1, $2, $3, $4, $5, $6, $7)",
  237. &[&self.id, &self.laboratoryid, &self.temperature, &self.humidity,
  238. &self.begintime, &self.endtime, &self.username],
  239. )
  240. .await?;
  241. Ok(())
  242. }
  243. }
  244. #[derive(Debug, Serialize, Deserialize)]
  245. pub struct HyTask {
  246. pub id: i32,
  247. pub task_name: Option<String>,
  248. pub task_type: Option<String>,
  249. pub task_num: Option<String>,
  250. pub is_auto: Option<bool>,
  251. pub task_time: Option<NaiveDateTime>,
  252. pub state: Option<i32>,
  253. pub create_by: Option<String>,
  254. pub create_time: Option<NaiveDateTime>,
  255. pub update_by: Option<String>,
  256. pub update_time: Option<NaiveDateTime>,
  257. }
  258. impl HyTask {
  259. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  260. client
  261. .execute(
  262. "INSERT INTO public.hy_task (id, task_name, task_type, task_num, is_auto,
  263. task_time, state, create_by, create_time, update_by, update_time)
  264. OVERRIDING SYSTEM VALUE
  265. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
  266. &[&self.id, &self.task_name, &self.task_type, &self.task_num, &self.is_auto,
  267. &self.task_time, &self.state, &self.create_by, &self.create_time,
  268. &self.update_by, &self.update_time],
  269. )
  270. .await?;
  271. Ok(())
  272. }
  273. }
  274. #[derive(Debug, Serialize, Deserialize)]
  275. pub struct HySpotcheck {
  276. pub id: i32,
  277. pub spotcheck_code: Option<String>,
  278. pub spotcheck_user: Option<String>,
  279. pub spotcheck_time: Option<NaiveDateTime>,
  280. pub spotcheck_type: Option<String>,
  281. pub coal_sample_code: Option<String>,
  282. pub sample_custodian: Option<String>,
  283. pub sampling_time: Option<NaiveDateTime>,
  284. pub quality_incoming: Option<f64>,
  285. pub granularity: Option<String>,
  286. pub spotcheck_compare: Option<String>,
  287. pub mt: Option<f64>,
  288. pub mad: Option<f64>,
  289. pub aad: f64, // NOT NULL
  290. pub ad: Option<f64>,
  291. pub vad: Option<f64>,
  292. pub vdaf: Option<f64>,
  293. pub var_data: Option<f64>,
  294. pub st_ad: Option<f64>,
  295. pub st_d: Option<f64>,
  296. pub qb_ad: Option<f64>,
  297. pub had: Option<f64>,
  298. pub qnet_ar: Option<f64>,
  299. pub qnet_ar1: Option<f64>,
  300. pub qgr_d: Option<f64>,
  301. pub qgr_ad: Option<f64>,
  302. pub vd: Option<f64>,
  303. pub aar: Option<f64>,
  304. pub st_ar: Option<f64>,
  305. pub hd: Option<f64>,
  306. pub fcad: Option<f64>,
  307. pub crc: Option<i64>,
  308. pub st_daf: Option<f64>,
  309. }
  310. impl HySpotcheck {
  311. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  312. client
  313. .execute(
  314. "INSERT INTO public.hy_spotcheck (id, spotcheck_code, spotcheck_user,
  315. spotcheck_time, spotcheck_type, coal_sample_code, sample_custodian,
  316. sampling_time, quality_incoming, granularity, spotcheck_compare, mt, mad, aad,
  317. ad, vad, vdaf, var_data, st_ad, st_d, qb_ad, had, qnet_ar, qnet_ar1, qgr_d,
  318. qgr_ad, vd, aar, st_ar, hd, fcad, crc, st_daf)
  319. OVERRIDING SYSTEM VALUE
  320. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15,
  321. $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30,
  322. $31, $32, $33)",
  323. &[&self.id, &self.spotcheck_code, &self.spotcheck_user, &self.spotcheck_time,
  324. &self.spotcheck_type, &self.coal_sample_code, &self.sample_custodian,
  325. &self.sampling_time, &self.quality_incoming, &self.granularity,
  326. &self.spotcheck_compare, &self.mt, &self.mad, &self.aad, &self.ad, &self.vad,
  327. &self.vdaf, &self.var_data, &self.st_ad, &self.st_d, &self.qb_ad, &self.had,
  328. &self.qnet_ar, &self.qnet_ar1, &self.qgr_d, &self.qgr_ad, &self.vd, &self.aar,
  329. &self.st_ar, &self.hd, &self.fcad, &self.crc, &self.st_daf],
  330. )
  331. .await?;
  332. Ok(())
  333. }
  334. }
  335. #[derive(Debug, Serialize, Deserialize)]
  336. pub struct HyWeightInput {
  337. pub id: i32,
  338. pub information_id: i32,
  339. pub information_norm_id: i32,
  340. }
  341. impl HyWeightInput {
  342. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  343. client
  344. .execute(
  345. "INSERT INTO public.hy_weight_input (id, information_id, information_norm_id)
  346. OVERRIDING SYSTEM VALUE
  347. VALUES ($1, $2, $3)",
  348. &[&self.id, &self.information_id, &self.information_norm_id],
  349. )
  350. .await?;
  351. Ok(())
  352. }
  353. }
  354. #[derive(Debug, Deserialize)]
  355. pub struct InstrumentInfo {
  356. pub id: i32,
  357. pub laboratoryid: Option<i32>,
  358. pub name: Option<String>,
  359. pub instrumentcode: Option<String>,
  360. pub informationid: Option<i32>,
  361. pub specification: Option<String>,
  362. pub remark: Option<String>,
  363. }
  364. impl InstrumentInfo {
  365. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  366. client
  367. .execute(
  368. "INSERT INTO public.hy_instrument (id, laboratoryid, name, instrumentcode,
  369. informationid, specification, remark)
  370. OVERRIDING SYSTEM VALUE
  371. VALUES ($1, $2, $3, $4, $5, $6, $7)",
  372. &[&self.id, &self.laboratoryid, &self.name, &self.instrumentcode,
  373. &self.informationid, &self.specification, &self.remark],
  374. )
  375. .await?;
  376. Ok(())
  377. }
  378. }
  379. #[derive(Debug, Serialize, Deserialize)]
  380. pub struct HyInformation {
  381. pub id: i32,
  382. pub hy_name: Option<String>,
  383. pub flag: Option<i32>,
  384. pub laboratory_id: Option<i32>,
  385. pub analysistypeid: Option<i32>,
  386. }
  387. impl HyInformation {
  388. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  389. client
  390. .execute(
  391. "INSERT INTO public.hy_information (id, hy_name, flag, laboratory_id, analysistypeid)
  392. OVERRIDING SYSTEM VALUE
  393. VALUES ($1, $2, $3, $4, $5)",
  394. &[&self.id, &self.hy_name, &self.flag, &self.laboratory_id, &self.analysistypeid],
  395. )
  396. .await?;
  397. Ok(())
  398. }
  399. }
  400. #[derive(Debug, Serialize, Deserialize)]
  401. pub struct HyCyTask {
  402. pub id: i32,
  403. pub task_id: Option<i32>,
  404. pub task_name: Option<String>,
  405. pub task_status: Option<i32>,
  406. pub create_time: Option<NaiveDateTime>,
  407. pub create_user: Option<String>,
  408. pub remark: Option<String>,
  409. }
  410. impl HyCyTask {
  411. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  412. client
  413. .execute(
  414. "INSERT INTO public.hy_cytask (id, task_id, task_name, task_status, create_time,
  415. create_user, remark)
  416. OVERRIDING SYSTEM VALUE
  417. VALUES ($1, $2, $3, $4, $5, $6, $7)",
  418. &[&self.id, &self.task_id, &self.task_name, &self.task_status,
  419. &self.create_time, &self.create_user, &self.remark],
  420. )
  421. .await?;
  422. Ok(())
  423. }
  424. }
  425. #[derive(Debug, Serialize, Deserialize)]
  426. pub struct HyRecord {
  427. #[serde(skip_deserializing)]
  428. pub id: i32,
  429. pub hy_code: Option<String>,
  430. pub hy_type: Option<String>,
  431. pub hy_check: Option<i16>,
  432. pub hy_approve: Option<i16>,
  433. pub check_time: Option<NaiveDateTime>,
  434. pub approve_time: Option<NaiveDateTime>,
  435. pub approve_user: Option<String>,
  436. pub check_user: Option<String>,
  437. pub hy_time: Option<NaiveDateTime>,
  438. pub hy_values: Option<String>,
  439. pub accept_time: Option<NaiveDateTime>,
  440. pub accept_user: Option<String>,
  441. pub mt: Option<f64>,
  442. pub mad: Option<f64>,
  443. pub aad: Option<f64>,
  444. pub ad: Option<f64>,
  445. pub vad: Option<f64>,
  446. pub vd: Option<f64>,
  447. pub var_data: Option<f64>,
  448. pub vdaf: Option<f64>,
  449. pub fcad: Option<f64>,
  450. pub st_ar: Option<f64>,
  451. pub st_ad: Option<f64>,
  452. pub st_d: Option<f64>,
  453. pub had: Option<f64>,
  454. pub hd: Option<f64>,
  455. pub qb_ad: Option<f64>,
  456. pub qgr_ad: Option<f64>,
  457. pub qgr_d: Option<f64>,
  458. pub qnet_ar_mj_kg: Option<f64>,
  459. pub qnet_ar_j_cal: Option<i32>,
  460. pub v: Option<f64>,
  461. pub aar: Option<f64>,
  462. pub qnet_ar: Option<f64>,
  463. pub qnet_ar1: Option<f64>,
  464. pub crc: Option<i32>,
  465. pub st_daf: Option<f64>,
  466. pub cad: Option<f64>,
  467. pub cd: Option<f64>,
  468. pub isauto: Option<i16>,
  469. pub isnormal: Option<i32>,
  470. }
  471. impl HyRecord {
  472. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  473. client
  474. .execute(
  475. "INSERT INTO public.hy_record (hy_code, hy_type, hy_check, hy_approve, check_time,
  476. approve_time, approve_user, check_user, hy_time, hy_values, accept_time, accept_user,
  477. mt, mad, aad, ad, vad, vd, var, vdaf, fcad, st_ar, st_ad, st_d, had, hd, qb_ad,
  478. qgr_ad, qgr_d, qnet_ar_mj_kg, qnet_ar_j_cal, v, aar, qnet_ar, qnet_ar1, crc,
  479. st_daf, cad, cd, isauto, isnormal)
  480. OVERRIDING SYSTEM VALUE
  481. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16,
  482. $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32,
  483. $33, $34, $35, $36, $37, $38, $39, $40, $41)",
  484. &[&self.hy_code, &self.hy_type, &self.hy_check, &self.hy_approve, &self.check_time,
  485. &self.approve_time, &self.approve_user, &self.check_user, &self.hy_time,
  486. &self.hy_values, &self.accept_time, &self.accept_user, &self.mt, &self.mad,
  487. &self.aad, &self.ad, &self.vad, &self.vd, &self.var_data, &self.vdaf, &self.fcad,
  488. &self.st_ar, &self.st_ad, &self.st_d, &self.had, &self.hd, &self.qb_ad,
  489. &self.qgr_ad, &self.qgr_d, &self.qnet_ar_mj_kg, &self.qnet_ar_j_cal, &self.v,
  490. &self.aar, &self.qnet_ar, &self.qnet_ar1, &self.crc, &self.st_daf, &self.cad,
  491. &self.cd, &self.isauto, &self.isnormal],
  492. )
  493. .await?;
  494. Ok(())
  495. }
  496. }
  497. #[derive(Debug, Serialize, Deserialize)]
  498. pub struct HySampleCollectionDetail {
  499. pub id: i32,
  500. pub num: i32,
  501. pub unit_num: i32,
  502. pub time: Option<NaiveDateTime>,
  503. pub type_: Option<i32>,
  504. pub sy_method: Option<i32>,
  505. pub sy_time: Option<NaiveDateTime>,
  506. pub one_num: Option<String>,
  507. pub two_num: Option<String>,
  508. pub three_num: Option<String>,
  509. pub sy_starttime: Option<NaiveDateTime>,
  510. pub sy_endtime: Option<NaiveDateTime>,
  511. pub cy_startnum: Option<String>,
  512. pub cy_endnum: Option<String>,
  513. pub sy_user: Option<String>,
  514. pub sy_car_count: Option<i32>,
  515. pub sy_dun_weight: Option<f64>,
  516. pub byz_bag_count: Option<i16>,
  517. pub y_liu: Option<i16>,
  518. pub zy_user: Option<String>,
  519. }
  520. impl HySampleCollectionDetail {
  521. pub async fn insert(&self, client: &tokio_postgres::Client) -> Result<(), PgError> {
  522. client
  523. .execute(
  524. "INSERT INTO public.hy_sample_collection_detail (id, num, unit_num, time, type,
  525. sy_method, sy_time, one_num, two_num, three_num, sy_starttime, sy_endtime,
  526. cy_startnum, cy_endnum, sy_user, sy_car_count, sy_dun_weight, byz_bag_count,
  527. y_liu, zy_user)
  528. OVERRIDING SYSTEM VALUE
  529. VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15,
  530. $16, $17, $18, $19, $20)",
  531. &[&self.id, &self.num, &self.unit_num, &self.time, &self.type_, &self.sy_method,
  532. &self.sy_time, &self.one_num, &self.two_num, &self.three_num, &self.sy_starttime,
  533. &self.sy_endtime, &self.cy_startnum, &self.cy_endnum, &self.sy_user,
  534. &self.sy_car_count, &self.sy_dun_weight, &self.byz_bag_count, &self.y_liu,
  535. &self.zy_user],
  536. )
  537. .await?;
  538. Ok(())
  539. }
  540. }