ConvertHelper.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. using DBEntity;
  2. using IvfTl.Control.Entity.DBEntitys;
  3. using IvfTl.Control.Entity.DTO;
  4. using IvfTl.Control.Entity.DTO.ApiResultDTO;
  5. using IvfTl.Control.Entity.GlobalEntitys;
  6. using IvfTl.Control.Entity.InitEntitys;
  7. namespace ivf_tl_UtilHelper
  8. {
  9. public static class ConvertHelper
  10. {
  11. public static TLSetting ConvertToTLSetting(tlInfoDTO tlInfo, tlSettingDTO tlSetting)
  12. {
  13. if (tlInfo == null) return null;
  14. TLSetting TLSetting = new TLSetting();
  15. TLSetting.id = tlInfo.id;
  16. TLSetting.tlSn = tlInfo.tlSn;
  17. TLSetting.tlName = tlInfo.tlName;
  18. TLSetting.state = tlInfo.state;
  19. TLSetting.online = tlInfo.online;
  20. TLSetting.softwareVersion = tlInfo.softwareVersion;
  21. TLSetting.protocolAddress = tlInfo.protocolAddress;
  22. TLSetting.installTime = tlInfo.installTime;
  23. TLSetting.address = tlInfo.address;
  24. TLSetting.socketIp = tlInfo.socketIp;
  25. TLSetting.socketPort = tlInfo.socketPort;
  26. TLSetting.alarmIp = tlInfo.alarmIp;
  27. TLSetting.alarmPort = tlInfo.alarmPort;
  28. TLSetting.mqttQueue = tlInfo.mqttQueue;
  29. TLSetting.kafkaTopic = tlInfo.kafkaTopic;
  30. TLSetting.remark = tlInfo.remark;
  31. if (tlSetting == null) return TLSetting;
  32. TLSetting.tmpDir = tlSetting.tmpDir;
  33. TLSetting.autoFocusTime = tlSetting.autoFocusTime;
  34. TLSetting.videoFps = tlSetting.videoFps;
  35. TLSetting.watermarking = tlSetting.watermarking;
  36. TLSetting.bufferBottlerPressureMax = tlSetting.bufferBottlerPressureMax;
  37. TLSetting.bufferBottlerPressureMin = tlSetting.bufferBottlerPressureMin;
  38. TLSetting.pressureAlarmMax = tlSetting.pressureAlarmMax;
  39. TLSetting.pressureAlarmMin = tlSetting.pressureAlarmMin;
  40. TLSetting.temperatureAlarmMax = tlSetting.temperatureAlarmMax;
  41. TLSetting.temperatureAlarmMin = tlSetting.temperatureAlarmMin;
  42. TLSetting.bufferBottlerAerationNum = tlSetting.bufferBottlerAerationNum;
  43. TLSetting.houseAerationNum = tlSetting.houseAerationNum;
  44. TLSetting.ventilationDelay = tlSetting.ventilationDelay;
  45. TLSetting.airSwapFrequency = tlSetting.airSwapFrequency;
  46. TLSetting.airSwapTime = tlSetting.airSwapTime;
  47. TLSetting.valueDelay = tlSetting.valueDelay;
  48. TLSetting.aerationDelay = tlSetting.aerationDelay;
  49. if (tlSetting.newAirSwap == 1)
  50. {
  51. TLSetting.newAirSwap = true;
  52. }
  53. TLSetting.motorDelay = tlSetting.motorDelay;
  54. TLSetting.verticalMotorPulseMax = tlSetting.verticalMotorPulseMax;
  55. TLSetting.photoIntervalPerRound = tlSetting.photoIntervalPerRound;
  56. TLSetting.lightOn = tlSetting.lightOn;
  57. TLSetting.keepDate = tlSetting.keepDate;
  58. TLSetting.heapDate = tlSetting.heapDate;
  59. TLSetting.historyCurveInterval = tlSetting.historyCurveInterval;
  60. TLSetting.mattingAlarmTimes = tlSetting.mattingAlarmTimes;
  61. TLSetting.houseDoorAlarmTime = tlSetting.houseDoorAlarmTime;
  62. TLSetting.temperatureAlarmTime = tlSetting.temperatureAlarmTime;
  63. TLSetting.pressureAlarmTime = tlSetting.pressureAlarmTime;
  64. TLSetting.chartThreshold = tlSetting.chartThreshold;
  65. TLSetting.saveSourcePic = TLSetting.saveSourcePic;
  66. if (tlSetting.compositeVideo == 1)
  67. {
  68. TLSetting.buildVideo = true;
  69. }
  70. // V-047 对焦配置下发链:服务器 init JSON → tlSettingDTO → 运行态 TLSetting
  71. // (喂 PhotoLayerCalculator / 安全门),再经 ConvertToTLSettingDB 落本地 SQLite 缓存。
  72. TLSetting.localAutofocusEnabled = tlSetting.localAutofocusEnabled ?? 0;
  73. TLSetting.focusLayerSpacingPulse = tlSetting.focusLayerSpacingPulse;
  74. TLSetting.focusLayerCount = tlSetting.focusLayerCount;
  75. TLSetting.focusLayerDown = tlSetting.focusLayerDown;
  76. TLSetting.focusPeakRatioThreshold = tlSetting.focusPeakRatioThreshold;
  77. return TLSetting;
  78. }
  79. public static TLSetting ConvertToTLSetting(TLSettingDB tLSettingDB)
  80. {
  81. if (tLSettingDB == null) return null;
  82. TLSetting TLSetting = new TLSetting();
  83. TLSetting.id = tLSettingDB.id;
  84. TLSetting.tlSn = tLSettingDB.tlSn;
  85. TLSetting.tlName = tLSettingDB.tlName;
  86. TLSetting.state = tLSettingDB.state;
  87. TLSetting.online = tLSettingDB.online;
  88. TLSetting.softwareVersion = tLSettingDB.softwareVersion;
  89. TLSetting.protocolAddress = tLSettingDB.protocolAddress;
  90. TLSetting.installTime = tLSettingDB.installTime;
  91. TLSetting.address = tLSettingDB.address;
  92. TLSetting.socketIp = tLSettingDB.socketIp;
  93. TLSetting.socketPort = tLSettingDB.socketPort;
  94. TLSetting.alarmIp = tLSettingDB.alarmIp;
  95. TLSetting.alarmPort = tLSettingDB.alarmPort;
  96. TLSetting.mqttQueue = tLSettingDB.mqttQueue;
  97. TLSetting.kafkaTopic = tLSettingDB.kafkaTopic;
  98. TLSetting.remark = tLSettingDB.remark;
  99. TLSetting.tmpDir = tLSettingDB.tmpDir;
  100. TLSetting.autoFocusTime = tLSettingDB.autoFocusTime;
  101. TLSetting.videoFps = tLSettingDB.videoFps;
  102. TLSetting.watermarking = tLSettingDB.watermarking;
  103. TLSetting.bufferBottlerPressureMax = tLSettingDB.bufferBottlerPressureMax;
  104. TLSetting.bufferBottlerPressureMin = tLSettingDB.bufferBottlerPressureMin;
  105. TLSetting.pressureAlarmMax = tLSettingDB.pressureAlarmMax;
  106. TLSetting.pressureAlarmMin = tLSettingDB.pressureAlarmMin;
  107. TLSetting.temperatureAlarmMax = tLSettingDB.temperatureAlarmMax;
  108. TLSetting.temperatureAlarmMin = tLSettingDB.temperatureAlarmMin;
  109. TLSetting.bufferBottlerAerationNum = tLSettingDB.bufferBottlerAerationNum;
  110. TLSetting.houseAerationNum = tLSettingDB.houseAerationNum;
  111. TLSetting.ventilationDelay = tLSettingDB.ventilationDelay;
  112. TLSetting.airSwapFrequency = tLSettingDB.airSwapFrequency;
  113. TLSetting.airSwapTime = tLSettingDB.airSwapTime;
  114. TLSetting.valueDelay = tLSettingDB.valueDelay;
  115. TLSetting.aerationDelay = tLSettingDB.aerationDelay;
  116. if (tLSettingDB.newAirSwap == 1)
  117. {
  118. TLSetting.newAirSwap = true;
  119. }
  120. TLSetting.motorDelay = tLSettingDB.motorDelay;
  121. TLSetting.verticalMotorPulseMax = tLSettingDB.verticalMotorPulseMax;
  122. TLSetting.photoIntervalPerRound = tLSettingDB.photoIntervalPerRound;
  123. TLSetting.lightOn = tLSettingDB.lightOn;
  124. TLSetting.keepDate = tLSettingDB.keepDate;
  125. TLSetting.heapDate = tLSettingDB.heapDate;
  126. TLSetting.historyCurveInterval = tLSettingDB.historyCurveInterval;
  127. TLSetting.mattingAlarmTimes = tLSettingDB.mattingAlarmTimes;
  128. TLSetting.houseDoorAlarmTime = tLSettingDB.houseDoorAlarmTime;
  129. TLSetting.temperatureAlarmTime = tLSettingDB.temperatureAlarmTime;
  130. TLSetting.pressureAlarmTime = tLSettingDB.pressureAlarmTime;
  131. TLSetting.chartThreshold = tLSettingDB.chartThreshold;
  132. // M2-06 场景B本地自动对焦安全门(设备级开关;0关闭降级/1启用本地对焦,默认安全)。
  133. TLSetting.localAutofocusEnabled = tLSettingDB.localAutofocusEnabled;
  134. // V-047 取数链:设备级拍照层配置 本地缓存 → 运行时(喂 PhotoLayerCalculator)。
  135. TLSetting.focusLayerSpacingPulse = tLSettingDB.focusLayerSpacingPulse;
  136. TLSetting.focusLayerCount = tLSettingDB.focusLayerCount;
  137. TLSetting.focusLayerDown = tLSettingDB.focusLayerDown;
  138. TLSetting.focusPeakRatioThreshold = tLSettingDB.focusPeakRatioThreshold;
  139. TLSetting.saveSourcePic = TLSetting.saveSourcePic;
  140. if (tLSettingDB.compositeVideo == 1)
  141. {
  142. TLSetting.buildVideo = true;
  143. }
  144. return TLSetting;
  145. }
  146. public static TLSettingDB ConvertToTLSettingDB(TLSetting tLSetting)
  147. {
  148. if (tLSetting == null) return null;
  149. TLSettingDB tLSettingDB = new TLSettingDB();
  150. tLSettingDB.id = tLSetting.id;
  151. tLSettingDB.tlSn = tLSetting.tlSn;
  152. tLSettingDB.tlName = tLSetting.tlName;
  153. tLSettingDB.state = tLSetting.state;
  154. tLSettingDB.online = tLSetting.online;
  155. tLSettingDB.softwareVersion = tLSetting.softwareVersion;
  156. tLSettingDB.protocolAddress = tLSetting.protocolAddress;
  157. tLSettingDB.installTime = tLSetting.installTime;
  158. tLSettingDB.address = tLSetting.address;
  159. tLSettingDB.socketIp = tLSetting.socketIp;
  160. tLSettingDB.socketPort = tLSetting.socketPort;
  161. tLSettingDB.alarmIp = tLSetting.alarmIp;
  162. tLSettingDB.alarmPort = tLSetting.alarmPort;
  163. tLSettingDB.mqttQueue = tLSetting.mqttQueue;
  164. tLSettingDB.kafkaTopic = tLSetting.kafkaTopic;
  165. tLSettingDB.remark = tLSetting.remark;
  166. tLSettingDB.tmpDir = tLSetting.tmpDir;
  167. tLSettingDB.autoFocusTime = tLSetting.autoFocusTime;
  168. tLSettingDB.videoFps = tLSetting.videoFps;
  169. tLSettingDB.watermarking = tLSetting.watermarking;
  170. tLSettingDB.bufferBottlerPressureMax = tLSetting.bufferBottlerPressureMax;
  171. tLSettingDB.bufferBottlerPressureMin = tLSetting.bufferBottlerPressureMin;
  172. tLSettingDB.pressureAlarmMax = tLSetting.pressureAlarmMax;
  173. tLSettingDB.pressureAlarmMin = tLSetting.pressureAlarmMin;
  174. tLSettingDB.temperatureAlarmMax = tLSetting.temperatureAlarmMax;
  175. tLSettingDB.temperatureAlarmMin = tLSetting.temperatureAlarmMin;
  176. tLSettingDB.bufferBottlerAerationNum = tLSetting.bufferBottlerAerationNum;
  177. tLSettingDB.houseAerationNum = tLSetting.houseAerationNum;
  178. tLSettingDB.ventilationDelay = tLSetting.ventilationDelay;
  179. tLSettingDB.airSwapFrequency = tLSetting.airSwapFrequency;
  180. tLSettingDB.airSwapTime = tLSetting.airSwapTime;
  181. tLSettingDB.valueDelay = tLSetting.valueDelay;
  182. tLSettingDB.aerationDelay = tLSetting.aerationDelay;
  183. tLSettingDB.historyCurveInterval = tLSetting.historyCurveInterval;
  184. if (tLSetting.newAirSwap)
  185. {
  186. tLSettingDB.newAirSwap = 1;
  187. }
  188. else
  189. {
  190. tLSettingDB.newAirSwap = 0;
  191. }
  192. tLSettingDB.motorDelay = tLSetting.motorDelay;
  193. tLSettingDB.verticalMotorPulseMax = tLSetting.verticalMotorPulseMax;
  194. tLSettingDB.photoIntervalPerRound = tLSetting.photoIntervalPerRound;
  195. tLSettingDB.lightOn = tLSetting.lightOn;
  196. tLSettingDB.keepDate = tLSetting.keepDate;
  197. tLSettingDB.heapDate = tLSetting.heapDate;
  198. tLSettingDB.mattingAlarmTimes = tLSetting.mattingAlarmTimes;
  199. tLSettingDB.houseDoorAlarmTime = tLSetting.houseDoorAlarmTime;
  200. tLSettingDB.temperatureAlarmTime = tLSetting.temperatureAlarmTime;
  201. tLSettingDB.pressureAlarmTime = tLSetting.pressureAlarmTime;
  202. tLSettingDB.chartThreshold = tLSetting.chartThreshold;
  203. // M2-06 场景B本地自动对焦安全门(设备级开关)回写本地缓存,跨重启保留。
  204. tLSettingDB.localAutofocusEnabled = tLSetting.localAutofocusEnabled;
  205. // V-047 取数链:设备级拍照层配置 运行时 → 本地缓存,跨重启保留。
  206. tLSettingDB.focusLayerSpacingPulse = tLSetting.focusLayerSpacingPulse;
  207. tLSettingDB.focusLayerCount = tLSetting.focusLayerCount;
  208. tLSettingDB.focusLayerDown = tLSetting.focusLayerDown;
  209. tLSettingDB.focusPeakRatioThreshold = tLSetting.focusPeakRatioThreshold;
  210. tLSettingDB.saveSourcePic = tLSetting.saveSourcePic;
  211. if (tLSetting.buildVideo)
  212. {
  213. tLSettingDB.compositeVideo = 1;
  214. }
  215. else
  216. {
  217. tLSettingDB.compositeVideo = 0;
  218. }
  219. return tLSettingDB;
  220. }
  221. public static House ConvertToHouse(houseDTO houseDTO)
  222. {
  223. if (houseDTO == null) return null;
  224. House house = new House();
  225. house.tlSn = houseDTO.tlSn;
  226. house.houseSn = houseDTO.houseSn;
  227. house.houseName = houseDTO.houseName;
  228. house.housePort = houseDTO.housePort;
  229. house.ccdId = houseDTO.ccdId;
  230. house.ccdSn = houseDTO.ccdSn;
  231. house.ccdHeight = houseDTO.ccdHeight;
  232. house.ccdWidth = houseDTO.ccdWidth;
  233. house.targetHeight = houseDTO.targetHeight;
  234. house.targetWidth = houseDTO.targetWidth;
  235. house.verticalMotorSpacePulse = houseDTO.verticalMotorSpacePulse;
  236. house.ccdExposure = houseDTO.ccdExposure;
  237. house.autoFocusNumber = houseDTO.autoFocusNumber;
  238. house.photographPictureNumber = houseDTO.photographPictureNumber;
  239. house.updateFocusNumber = houseDTO.updateFocusNumber;
  240. house.updateClearestNumber = houseDTO.updateClearestNumber;
  241. house.openCcd = houseDTO.openCcd;
  242. house.openPort = houseDTO.openPort;
  243. house.autoFocus = houseDTO.autoFocus == 1;
  244. house.noImagePreview = houseDTO.noImagePreview == 1;
  245. house.inletValveOpeningTime = houseDTO.inletValveOpeningTime;
  246. house.temperatureLowerHeatingPlate = houseDTO.temperatureLowerHeatingPlate;
  247. return house;
  248. }
  249. public static House ConvertToHouse(HouseDB houseDB)
  250. {
  251. if (houseDB == null) return null;
  252. House house = new House();
  253. house.tlSn = houseDB.tlSn;
  254. house.houseSn = houseDB.houseSn;
  255. house.houseName = houseDB.houseName;
  256. house.housePort = houseDB.housePort;
  257. house.ccdId = houseDB.ccdId;
  258. house.ccdSn = houseDB.ccdSn;
  259. house.ccdHeight = houseDB.ccdHeight;
  260. house.ccdWidth = houseDB.ccdWidth;
  261. house.targetHeight = houseDB.targetHeight;
  262. house.targetWidth = houseDB.targetWidth;
  263. house.verticalMotorSpacePulse = houseDB.verticalMotorSpacePulse;
  264. house.ccdExposure = houseDB.ccdExposure;
  265. house.autoFocusNumber = houseDB.autoFocusNumber;
  266. house.photographPictureNumber = houseDB.photographPictureNumber;
  267. house.updateFocusNumber = houseDB.updateFocusNumber;
  268. house.updateClearestNumber = houseDB.updateClearestNumber;
  269. house.openCcd = houseDB.openCcd;
  270. house.openPort = houseDB.openPort;
  271. house.autoFocus = houseDB.autoFocus == 1;
  272. house.noImagePreview = houseDB.noImagePreview == 1;
  273. house.inletValveOpeningTime = houseDB.inletValveOpeningTime;
  274. house.temperatureLowerHeatingPlate = houseDB.temperatureLowerHeatingPlate;
  275. return house;
  276. }
  277. public static HouseDB ConvertToHouseDB(House house)
  278. {
  279. if (house == null) return null;
  280. HouseDB houseDB = new HouseDB();
  281. houseDB.tlSn = house.tlSn;
  282. houseDB.houseSn = house.houseSn;
  283. houseDB.houseName = house.houseName;
  284. houseDB.housePort = house.housePort;
  285. houseDB.ccdId = house.ccdId;
  286. houseDB.ccdSn = house.ccdSn;
  287. houseDB.ccdHeight = house.ccdHeight;
  288. houseDB.ccdWidth = house.ccdWidth;
  289. houseDB.targetHeight = house.targetHeight;
  290. houseDB.targetWidth = house.targetWidth;
  291. houseDB.verticalMotorSpacePulse = house.verticalMotorSpacePulse;
  292. houseDB.ccdExposure = house.ccdExposure;
  293. houseDB.autoFocusNumber = house.autoFocusNumber;
  294. houseDB.photographPictureNumber = house.photographPictureNumber;
  295. houseDB.updateFocusNumber = house.updateFocusNumber;
  296. houseDB.updateClearestNumber = house.updateClearestNumber;
  297. houseDB.openCcd = house.openCcd;
  298. houseDB.openPort = house.openPort;
  299. houseDB.autoFocus = house.autoFocus ? 1 : 0;
  300. houseDB.noImagePreview = house.noImagePreview ? 1 : 0;
  301. houseDB.inletValveOpeningTime = house.inletValveOpeningTime;
  302. houseDB.temperatureLowerHeatingPlate = house.temperatureLowerHeatingPlate;
  303. return houseDB;
  304. }
  305. public static HouseWellSetting ConvertToHouseWellSetting(houseWellSettingDTO houseWellSettingDTO)
  306. {
  307. if (houseWellSettingDTO == null) return null;
  308. HouseWellSetting houseWellSetting = new HouseWellSetting();
  309. houseWellSetting.tlSn = houseWellSettingDTO.tlSn;
  310. houseWellSetting.houseSn = houseWellSettingDTO.houseSn;
  311. houseWellSetting.wellSn = houseWellSettingDTO.wellSn;
  312. houseWellSetting.leftOffset = houseWellSettingDTO.leftOffset;
  313. houseWellSetting.bottomOffset = houseWellSettingDTO.bottomOffset;
  314. houseWellSetting.moveDownLayer = houseWellSettingDTO.moveDownLayer;
  315. houseWellSetting.horizontalMotorPosition = houseWellSettingDTO.horizontalMotorPosition;
  316. houseWellSetting.eepromClearPosition = houseWellSettingDTO.eepromClearPosition;
  317. // V-047 对焦配置下发链:well 级覆盖 服务器 init JSON → DTO → 运行态(空=继承设备级)。
  318. houseWellSetting.focusLayerSpacingPulse = houseWellSettingDTO.focusLayerSpacingPulse;
  319. houseWellSetting.focusLayerCount = houseWellSettingDTO.focusLayerCount;
  320. return houseWellSetting;
  321. }
  322. public static HouseWellSetting ConvertToHouseWellSetting(HouseWellSettingDB houseWellSettingDB)
  323. {
  324. if (houseWellSettingDB == null) return null;
  325. HouseWellSetting houseWellSetting = new HouseWellSetting();
  326. houseWellSetting.tlSn = houseWellSettingDB.tlSn;
  327. houseWellSetting.houseSn = houseWellSettingDB.houseSn;
  328. houseWellSetting.wellSn = houseWellSettingDB.wellSn;
  329. houseWellSetting.leftOffset = houseWellSettingDB.leftOffset;
  330. houseWellSetting.bottomOffset = houseWellSettingDB.bottomOffset;
  331. houseWellSetting.moveDownLayer = houseWellSettingDB.moveDownLayer;
  332. houseWellSetting.horizontalMotorPosition = houseWellSettingDB.horizontalMotorPosition;
  333. houseWellSetting.eepromClearPosition = houseWellSettingDB.eepromClearPosition;
  334. // V-047 取数链:well 级拍照层覆盖 本地缓存 → 运行时(空=继承设备级,喂 PhotoLayerCalculator)。
  335. houseWellSetting.focusLayerSpacingPulse = houseWellSettingDB.focusLayerSpacingPulse;
  336. houseWellSetting.focusLayerCount = houseWellSettingDB.focusLayerCount;
  337. return houseWellSetting;
  338. }
  339. public static HouseWellSettingDB ConvertToHouseWellSettingDB(HouseWellSetting houseWellSetting)
  340. {
  341. if (houseWellSetting == null) return null;
  342. HouseWellSettingDB houseWellSettingDB = new HouseWellSettingDB();
  343. houseWellSettingDB.tlSn = houseWellSetting.tlSn;
  344. houseWellSettingDB.houseSn = houseWellSetting.houseSn;
  345. houseWellSettingDB.wellSn = houseWellSetting.wellSn;
  346. houseWellSettingDB.leftOffset = houseWellSetting.leftOffset;
  347. houseWellSettingDB.bottomOffset = houseWellSetting.bottomOffset;
  348. houseWellSettingDB.moveDownLayer = houseWellSetting.moveDownLayer;
  349. houseWellSettingDB.horizontalMotorPosition = houseWellSetting.horizontalMotorPosition;
  350. houseWellSettingDB.eepromClearPosition = houseWellSetting.eepromClearPosition;
  351. // V-047 取数链:well 级拍照层覆盖 运行时 → 本地缓存,跨重启保留。
  352. houseWellSettingDB.focusLayerSpacingPulse = houseWellSetting.focusLayerSpacingPulse;
  353. houseWellSettingDB.focusLayerCount = houseWellSetting.focusLayerCount;
  354. return houseWellSettingDB;
  355. }
  356. public static HouseWellPhoto ConvertToHouseWellPhoto(positionResultDTO autoFocusPositionDTO)
  357. {
  358. if (autoFocusPositionDTO == null) return null;
  359. HouseWellPhoto houseWellPhoto = new HouseWellPhoto();
  360. houseWellPhoto.tlSn = autoFocusPositionDTO.tlSn;
  361. houseWellPhoto.houseSn = autoFocusPositionDTO.houseSn;
  362. houseWellPhoto.wellSn = autoFocusPositionDTO.wellSn;
  363. houseWellPhoto.verticalMotorPosition = autoFocusPositionDTO.verticalMotorPosition;
  364. houseWellPhoto.clearest = autoFocusPositionDTO.layerNum;
  365. houseWellPhoto.positionType = autoFocusPositionDTO.positionType;
  366. return houseWellPhoto;
  367. }
  368. public static HouseWellPhoto ConvertToHouseWellPhoto(HouseWellPhotoDB houseWellPhotoDb)
  369. {
  370. if (houseWellPhotoDb == null) return null;
  371. HouseWellPhoto houseWellPhoto = new HouseWellPhoto();
  372. houseWellPhoto.tlSn = houseWellPhotoDb.tlSn;
  373. houseWellPhoto.houseSn = houseWellPhotoDb.houseSn;
  374. houseWellPhoto.wellSn = houseWellPhotoDb.wellSn;
  375. houseWellPhoto.verticalMotorPosition = houseWellPhotoDb.verticalMotorPosition;
  376. houseWellPhoto.clearest = houseWellPhotoDb.clearest;
  377. houseWellPhoto.positionType = houseWellPhotoDb.positionType;
  378. return houseWellPhoto;
  379. }
  380. public static HouseWellPhotoDB ConvertToHouseWellPhotoDB(HouseWellPhoto houseWellPhoto)
  381. {
  382. if (houseWellPhoto == null) return null;
  383. HouseWellPhotoDB houseWellPhotoDB = new HouseWellPhotoDB();
  384. houseWellPhotoDB.tlSn = houseWellPhoto.tlSn;
  385. houseWellPhotoDB.houseSn = houseWellPhoto.houseSn;
  386. houseWellPhotoDB.wellSn = houseWellPhoto.wellSn;
  387. houseWellPhotoDB.verticalMotorPosition = houseWellPhoto.verticalMotorPosition;
  388. houseWellPhotoDB.clearest = houseWellPhoto.clearest;
  389. houseWellPhotoDB.positionType = houseWellPhoto.positionType;
  390. return houseWellPhotoDB;
  391. }
  392. public static Embryo ConvertToEmbryo(embryoDTO embryoDTO)
  393. {
  394. if (embryoDTO == null) return null;
  395. Embryo embryo=new Embryo();
  396. embryo.id = embryoDTO.id;
  397. embryo.dishId = embryoDTO.dishId;
  398. embryo.tlSn = embryoDTO.tlSn;
  399. embryo.houseSn= embryoDTO.houseSn;
  400. embryo.wellSn = embryoDTO.wellSn;
  401. embryo.startTime = embryoDTO.startTime;
  402. embryo.state= embryoDTO.state;
  403. embryo.stateTime = embryoDTO.stateTime;
  404. return embryo;
  405. }
  406. public static Embryo ConvertToEmbryo(EmbryoDB embryoDB)
  407. {
  408. if (embryoDB == null) return null;
  409. Embryo embryo = new Embryo();
  410. embryo.id = embryoDB.id;
  411. embryo.dishId = embryoDB.dishId;
  412. embryo.tlSn = embryoDB.tlSn;
  413. embryo.houseSn = embryoDB.houseSn;
  414. embryo.wellSn = embryoDB.wellSn;
  415. embryo.startTime = embryoDB.startTime;
  416. embryo.state = embryoDB.state;
  417. embryo.stateTime = embryoDB.stateTime;
  418. return embryo;
  419. }
  420. public static EmbryoDB ConvertToEmbryoDB(Embryo embryo)
  421. {
  422. if (embryo == null) return null;
  423. EmbryoDB embryoDB = new EmbryoDB();
  424. embryoDB.id = embryo.id;
  425. embryoDB.dishId = embryo.dishId;
  426. embryoDB.tlSn = embryo.tlSn;
  427. embryoDB.houseSn = embryo.houseSn;
  428. embryoDB.wellSn = embryo.wellSn;
  429. embryoDB.startTime = embryo.startTime;
  430. embryoDB.state = embryo.state;
  431. embryoDB.stateTime = embryo.stateTime;
  432. return embryoDB;
  433. }
  434. public static Dish ConvertToDish(dishDTO dishDTO)
  435. {
  436. if (dishDTO == null) return null;
  437. Dish dish = new Dish();
  438. dish.id=dishDTO.id;
  439. dish.tlSn= dishDTO.tlSn;
  440. dish.houseSn= dishDTO.houseSn;
  441. dish.startTime = dishDTO.startTime;
  442. dish.embryoCount = dishDTO.embryoCount;
  443. dish.Embryo = new List<Embryo>();
  444. foreach (var item in dishDTO.embryo)
  445. {
  446. dish.Embryo.Add(ConvertToEmbryo(item));
  447. }
  448. return dish;
  449. }
  450. public static Dish ConvertToDish(DishDB dishDB)
  451. {
  452. if (dishDB == null) return null;
  453. Dish dish = new Dish();
  454. dish.id = dishDB.id;
  455. dish.tlSn = dishDB.tlSn;
  456. dish.houseSn = dishDB.houseSn;
  457. dish.startTime = dishDB.startTime;
  458. dish.embryoCount = dishDB.embryoCount;
  459. dish.Embryo = new List<Embryo>();
  460. dish.endTime = dishDB.endTime;
  461. return dish;
  462. }
  463. public static DishDB ConvertToDishDB(Dish dish)
  464. {
  465. if (dish == null) return null;
  466. DishDB dishDB = new DishDB();
  467. dishDB.id = dish.id;
  468. dishDB.tlSn = dish.tlSn;
  469. dishDB.houseSn = dish.houseSn;
  470. dishDB.startTime = dish.startTime;
  471. dishDB.embryoCount = dish.embryoCount;
  472. dishDB.endTime = dish.endTime;
  473. return dishDB;
  474. }
  475. public static Balance ConvertToBalance(balanceDTO balanceDTO)
  476. {
  477. if (balanceDTO == null) return null;
  478. Balance balance = new Balance();
  479. balance.id=balanceDTO.id;
  480. balance.tlSn = balanceDTO.tlSn;
  481. balance.houseSn = balanceDTO.houseSn;
  482. balance.startTime = balanceDTO.startTime;
  483. return balance;
  484. }
  485. public static Balance ConvertToBalance(BalanceDB balanceDB)
  486. {
  487. if (balanceDB == null) return null;
  488. Balance balance = new Balance();
  489. balance.id = balanceDB.id;
  490. balance.tlSn = balanceDB.tlSn;
  491. balance.houseSn = balanceDB.houseSn;
  492. balance.startTime = balanceDB.startTime;
  493. balance.endTime = balanceDB.endTime;
  494. return balance;
  495. }
  496. public static BalanceDB ConvertToBalanceDB(Balance balance)
  497. {
  498. if (balance == null) return null;
  499. BalanceDB balanceDB = new BalanceDB();
  500. balanceDB.id = balance.id;
  501. balanceDB.tlSn = balance.tlSn;
  502. balanceDB.houseSn = balance.houseSn;
  503. balanceDB.startTime = balance.startTime;
  504. balanceDB.endTime = balance.endTime;
  505. return balanceDB;
  506. }
  507. public static PictureDB ConvertToPictureDB(ImageDTO imageDTO)
  508. {
  509. if (imageDTO == null) return null;
  510. PictureDB pictureDB = new PictureDB();
  511. pictureDB.CCDSN = imageDTO.CcdSn;
  512. pictureDB.Clearest = imageDTO.Clearest;
  513. pictureDB.dishId = (long)imageDTO.EmbryoCultureRecordId;
  514. pictureDB.EmbryoId = (long)imageDTO.EmbryoId;
  515. pictureDB.End = imageDTO.End;
  516. pictureDB.FertilizationTime = imageDTO.FertilizationTime;
  517. pictureDB.HorizontalPosition= imageDTO.HorizontalPosition;
  518. pictureDB.HouseSn = imageDTO.HouseSn;
  519. pictureDB.ImageTime = imageDTO.ImageTime;
  520. pictureDB.PhotographType = imageDTO.PhotographType;
  521. pictureDB.PictureLayer = imageDTO.PictureLayer;
  522. pictureDB.ShootingPosition = imageDTO.ShootingPosition;
  523. pictureDB.SourceImageName = imageDTO.SourceImageName;
  524. pictureDB.SourceImagePath = imageDTO.SourceImagePath;
  525. pictureDB.SourceImageWidth = imageDTO.SourceImageWidth;
  526. pictureDB.SourceImageHeight = imageDTO.SourceImageHeight;
  527. pictureDB.TlSn = imageDTO.TlSn;
  528. pictureDB.WellSn = imageDTO.WellSn;
  529. pictureDB.TotalLayer= imageDTO.TotalLayer;
  530. return pictureDB;
  531. }
  532. public static ImageDTO ConvertToPictureDB(PictureDB pictureDB)
  533. {
  534. if (pictureDB == null) return null;
  535. ImageDTO imageDTO = new ImageDTO();
  536. imageDTO.CcdSn = pictureDB.CCDSN;
  537. imageDTO.Clearest = pictureDB.Clearest;
  538. imageDTO.EmbryoCultureRecordId = (ulong)pictureDB.dishId;
  539. imageDTO.EmbryoId = (ulong)pictureDB.EmbryoId;
  540. imageDTO.End = pictureDB.End;
  541. imageDTO.FertilizationTime = pictureDB.FertilizationTime;
  542. imageDTO.HorizontalPosition = pictureDB.HorizontalPosition;
  543. imageDTO.HouseSn = pictureDB.HouseSn;
  544. imageDTO.ImageTime = pictureDB.ImageTime;
  545. imageDTO.PhotographType = pictureDB.PhotographType;
  546. imageDTO.PictureLayer = pictureDB.PictureLayer;
  547. imageDTO.ShootingPosition = pictureDB.ShootingPosition;
  548. imageDTO.SourceImageName = pictureDB.SourceImageName;
  549. imageDTO.SourceImagePath = pictureDB.SourceImagePath;
  550. imageDTO.SourceImageWidth = pictureDB.SourceImageWidth;
  551. imageDTO.SourceImageHeight = pictureDB.SourceImageHeight;
  552. imageDTO.TlSn = pictureDB.TlSn;
  553. imageDTO.WellSn = pictureDB.WellSn;
  554. imageDTO.TotalLayer = pictureDB.TotalLayer;
  555. return imageDTO;
  556. }
  557. }
  558. }