From 2ee23828c9288c4cb5e86af595138d5b3fae879a Mon Sep 17 00:00:00 2001 From: Igor I Date: Mon, 15 Jul 2024 17:36:52 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=B2=D0=B8=D0=B3=D0=B0=D1=8E=D1=81?= =?UTF-8?q?=D1=8C=20=D0=BF=D0=BE=20=D0=BF=D0=BE=D0=BB=D1=8F=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/kz/istt/locust/DbOpenHelper.java | 21 +- .../kz/istt/locust/LocustDelActivity.java | 2 - .../kz/istt/locust/LocustHealthActivity.java | 179 ++++++++++++++++-- .../istt/locust/LocustHealthListActivity.java | 1 + .../res/layout/activity_locust_health.xml | 26 +-- 5 files changed, 176 insertions(+), 53 deletions(-) diff --git a/app/src/main/java/kz/istt/locust/DbOpenHelper.java b/app/src/main/java/kz/istt/locust/DbOpenHelper.java index d9b6e72..06deda2 100644 --- a/app/src/main/java/kz/istt/locust/DbOpenHelper.java +++ b/app/src/main/java/kz/istt/locust/DbOpenHelper.java @@ -494,7 +494,7 @@ public class DbOpenHelper extends SQLiteOpenHelper "lon5 double, " + "lat6 double, " + "lon6 double, " + - "bio_hectare double, " + //"bio_hectare integer, " ++++++++ + "bio_hectare double, " + //"bio_hectare integer, " "bio_biotope_id integer," + //тип биотопаCIT (степь, залежь, посевы) тип биотопаDMA (равнины, холмы, посевы) тип биотопаLMI (низкие сухие тростники, высокие влажные тростники, другое) "bio_greenery_id integer,"+ //растительность: сухая, всходы, зеленая, засыхающая "bio_greenery_cover_id integer,"+ //растительный покров(Редкий, Ср., Густой) @@ -677,7 +677,7 @@ public class DbOpenHelper extends SQLiteOpenHelper "efficacy_passed_time float," + //Прошло времени после обработки "efficacy_mortality_method integer," + //метод подсчета смертности "safety_clothing text," + //Какой защитной одеждой пользовался оператор - "safety_clothing_clean boolean," + //В 2024 сказали оставить только в форме по ЗЧ и ОС + "safety_clothing_clean boolean," + //В 2024 сказали оставить только в форме по ЗЧ и ОС (теперь это поле там) "safety_operator_health boolean," + "description text," + //Описание "safety_inform text," + //Кто был оповещен об обработках? @@ -710,7 +710,8 @@ public class DbOpenHelper extends SQLiteOpenHelper //Идентификация места мониторинга "observer text, " + //Имя руководителя бригады по мониторингу ЗЧ и ОС - "date integer," + //Дата мониторинга (секунд с 1970 года) + "date text," + //Дата мониторинга (секунд с 1970 года) + "timezone text, " + //Временная зона "frmlocustdel_filled boolean," + //Заполнялась ли Форма по Мониторингу противосаранчовых обработок бригадой по обработке? (Похоже что это бесполезное поле так как есть поле frmlocustdel_uid) //Бригада по обработке @@ -770,6 +771,7 @@ public class DbOpenHelper extends SQLiteOpenHelper "safety_Control boolean," + // Осуществлялся ли бригадой по мониторингу ЗЧ и ОС контроль в отношении наблюдаемого или зарегистрированного воздействия на окружающую среду "safety_Control_Actions text," + // Если Да, опишите последующее действие(я) + "safety_clothing_clean boolean," + // Защитная одержа чистая и в хорошем состоянии (перенесли из таблицы обработки саранчи) "map_treatment boolean," + // Была ли составлена ситуационная карта обработки? @@ -1236,7 +1238,7 @@ public class DbOpenHelper extends SQLiteOpenHelper //Информация об инсектицидах "insecticide_part_number text," + //Номер партии препарата (если указан на контейнере) - "insecticide_manufactured_date integer," + //Дата производства или срок годности (срок хранения) + "insecticide_manufactured_date text," + //Дата производства или срок годности (срок хранения) "insecticide_expiration_date integer," + //********** На всякий случай, может и не пригодиться ********** "insecticide_container_state_id integer," + //Состояние пакетов или контейнеров с инсектицидами @@ -1367,8 +1369,15 @@ public class DbOpenHelper extends SQLiteOpenHelper db.execSQL("ALTER TABLE frmlocusthealth RENAME COLUMN date TO date_DEL;"); db.execSQL("ALTER TABLE frmlocusthealth RENAME COLUMN date_temp TO date;"); - ++++++++ - sql = "ALTER TABLE frmlocusthealth ADD safety_clothing_clean boolean;"; + //Дата производства или срок годности (срок хранения) + db.execSQL("ALTER TABLE frmlocusthealth ADD COLUMN insecticide_manufactured_date_temp TEXT;"); + db.execSQL("UPDATE frmlocusthealth SET insecticide_manufactured_date_temp = insecticide_manufactured_date;"); + db.execSQL("ALTER TABLE frmlocusthealth RENAME COLUMN insecticide_manufactured_date TO insecticide_manufactured_date_DEL;"); + db.execSQL("ALTER TABLE frmlocusthealth RENAME COLUMN insecticide_manufactured_date_temp TO insecticide_manufactured_date;"); + + sql = "ALTER TABLE frmlocusthealth ADD safety_clothing_clean boolean;"; + db.execSQL(sql); + sql = "ALTER TABLE frmlocusthealth ADD timezone text;"; db.execSQL(sql); oldVersion=153; diff --git a/app/src/main/java/kz/istt/locust/LocustDelActivity.java b/app/src/main/java/kz/istt/locust/LocustDelActivity.java index 70b79fb..207ab21 100644 --- a/app/src/main/java/kz/istt/locust/LocustDelActivity.java +++ b/app/src/main/java/kz/istt/locust/LocustDelActivity.java @@ -1261,8 +1261,6 @@ public class LocustDelActivity extends FragmentActivity implements LocationListe edtSafEmptyContainers = (EditText) findViewById(R.id.edtSafEmptyContainers); guiTable.add(edtSafEmptyContainers, "safety_container"); - - edtSafEmptyContainers.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) diff --git a/app/src/main/java/kz/istt/locust/LocustHealthActivity.java b/app/src/main/java/kz/istt/locust/LocustHealthActivity.java index f4f4e01..6ae1442 100644 --- a/app/src/main/java/kz/istt/locust/LocustHealthActivity.java +++ b/app/src/main/java/kz/istt/locust/LocustHealthActivity.java @@ -109,15 +109,31 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi public EditText edtLonCenter = null; // Долгота public ListView latlonList = null; + //Идентификация места мониторинга + public EditText edtObserverHealth = null; //H Имя руководителя бригады по мониторингу ЗЧ и ОС + public EditText edtMonitoringDate = null; //H Дата мониторинга + public EditText edtMonitoringTimeZone = null; //H Временная зона для: Дата мониторинга + public View spiFrmLocustDelFilled = null; //H Заполнялась ли Форма по Мониторингу противосаранчовых обработок бригадой по обработке? + + //Бригада по обработке + public EditText edtBrigadeCount = null; //H Количество работников в бригаде по обработке + public EditText edtBrigadeCountTrained = null; //H Количество работников, ранее обученных обращению с инсектицидами и их применению + + public EditText edtInfestedArea = null; // заселенная площадь(га) public EditText edtTreatedArea = null; // обработанная площадь(га) public View spiVegType = null; // Тип(дикая, культурная) public EditText edtVegHeight = null; // Высота (м) public View spiVegCover = null; // Растительный покров (Редкий, Ср., Густой) public EditText edtVegCrop = null; // Перечисление культур - public View spiVegDamage = null; // Повреждения растительного покрова(%) - public EditText edtVegDamageArea = null; // Площадь повреждений (га) + //public View spiVegDamage = null; // Повреждения растительного покрова(%) + //public EditText edtVegDamageArea = null; // Площадь повреждений (га) + + //Информация об инсектицидах public EditText edtInsName = null; // коммерческое название + public EditText edtInsPartNumber = null; //H Номер партии препарата (если указан на контейнере) + public EditText edtInsManufacturedDate = null; //H Дата производства или Срок годности (срок хранения) + public EditText edtInsActiveSubstance = null; // Наименование активного вещества отравы public EditText edtInsConcentration = null; // концентрация(г д.в./л или%) public View spiInsFormulation = null; // формуляция(УМО, КЭ, др.) @@ -154,7 +170,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi public View spiMainPurpose = null; // Основная цель при обработке (Имаго,Кулиги,Стаи,Разреженные) - public View spiLocustPhaseId = null; // Фара саранчи + //public View spiLocustPhaseId = null; // Фара саранчи public View spiSprPlatform = null; // Вид опрыскивания public View spiSprPlatformA = null; // «Авиа» - выпадающий список:«Самолет», «Вертолет», «Дельтаплан». @@ -197,18 +213,18 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi public View spiHlthProtectiveClothingClean = null; // Защитная одежда чистая и в хорошем состоянии - public View spiProtectiveClothingClean = null; + //public View spiProtectiveClothingClean = null; public View spiOperatorExposedInsecticide = null; public EditText edtDescription = null; public CheckBox cbTest; //Тестовая ли анкета - public CheckBox cbSafInformFarmer = null; // Кто был оповещен об обработках? Фермер - public CheckBox cbSafInformShepherd = null; // Кто был оповещен об обработках? Пастух - public CheckBox cbSafInformVillager = null; // Кто был оповещен об обработках? Сельский житель - public CheckBox cbSafInformOfficial = null; // Кто был оповещен об обработках? Чиновник - public CheckBox cbSafInformBeekeeper = null; // Кто был оповещен об обработках? Пчеловод - public CheckBox cbSafInformOther = null; // Кто был оповещен об обработках? Другие - public EditText edtInform = null; // Сборная колонка для (Фермер,Сельский житель,Чиновник,Пчеловод,Другие) + //public CheckBox cbSafInformFarmer = null; // Кто был оповещен об обработках? Фермер + //public CheckBox cbSafInformShepherd = null; // Кто был оповещен об обработках? Пастух + //public CheckBox cbSafInformVillager = null; // Кто был оповещен об обработках? Сельский житель + //public CheckBox cbSafInformOfficial = null; // Кто был оповещен об обработках? Чиновник + //public CheckBox cbSafInformBeekeeper = null; // Кто был оповещен об обработках? Пчеловод + //public CheckBox cbSafInformOther = null; // Кто был оповещен об обработках? Другие + //public EditText edtInform = null; // Сборная колонка для (Фермер,Сельский житель,Чиновник,Пчеловод,Другие) //public SpinnerDB spiSafEmptyСontainers = null; // Пустые контейнеры public CheckBox cbTripleRinsed = null; @@ -365,7 +381,31 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi // }; + //sql = "ALTER TABLE frmlocusthealth ADD timezone text;"; + //db.execSQL(sql); + + //**********Идентификация места мониторинга********** + + //H Имя руководителя бригады по мониторингу ЗЧ и ОС + edtObserverHealth = (EditText) findViewById(R.id.edtObserverHealth); + guiTableHealth.add(edtObserverHealth, "observer"); + //H Дата мониторинга + edtMonitoringDate = (EditText) findViewById(R.id.edtMonitoringDate); + guiTableHealth.add(edtMonitoringDate, "date"); + //H Временная зона для: Дата мониторинга + edtMonitoringTimeZone = (EditText) findViewById(R.id.edtMonitoringTimeZone); + guiTableHealth.add(edtMonitoringTimeZone,"timezone"); + + //**********Бригада по обработке********** + //H Количество работников в бригаде по обработке + edtBrigadeCount = (EditText) findViewById(R.id.edtBrigadeCount); + guiTableHealth.add(edtBrigadeCount, "brigade_count"); + //H Количество работников, ранее обученных обращению с инсектицидами и их применению + edtBrigadeCountTrained = (EditText) findViewById(R.id.edtBrigadeCountTrained); + guiTableHealth.add(edtBrigadeCountTrained, "brigade_count_trained"); + + //**********Информация о растительности********** //Тип растительности spiVegType = findViewById(R.id.spiVegType); // Тип(Дикая, Культурная) guiTableDel.add(spiVegType, "vegetation_type_id"); @@ -414,9 +454,17 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi edtVegCrop = (EditText) findViewById(R.id.edtVegCrop); // Перечисление культур guiTableDel.add(edtVegCrop, "vegetation_crop"); - //Наименование инсектицида - edtInsName = (EditText) findViewById(R.id.edtInsName); // коммерческое название + //**********Информация об инсектицидах********** + // коммерческое название (Наименование инсектицида) + edtInsName = (EditText) findViewById(R.id.edtInsName); guiTableDel.add(edtInsName, "insecticide_name"); + //H Номер партии препарата (если указан на контейнере) + edtInsPartNumber = (EditText) findViewById(R.id.edtInsPartNumber); + guiTableHealth.add(edtInsPartNumber, "insecticide_part_number"); + //H Дата производства или Срок годности (срок хранения) + edtInsManufacturedDate = (EditText) findViewById(R.id.edtInsPartNumber); + guiTableHealth.add(edtInsManufacturedDate, "insecticide_manufactured_date"); ++++++++++ // Наименование активного вещества отравы edtInsActiveSubstance = (EditText) findViewById(R.id.edtInsActiveSubstance); @@ -480,6 +528,7 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi edtInsRate = (EditText) findViewById(R.id.edtInsRate); guiTableDel.add(edtInsRate, "insecticide_rate"); + //**********Погодные условия********** // время начала spiWeaTimeStart = findViewById(R.id.spiWeaTimeStart); guiTableDel.add(spiWeaTimeStart, "weather_time_start"); @@ -897,6 +946,102 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi ((selectDB)spiEffectiveness).addField(getString(R.string.Yes), "1"); ((selectDB)spiEffectiveness).addField(getString(R.string.No), "0"); + //Оператор случайно подвергся воздействию инсектицида или плохое самочувствие + spiOperatorExposedInsecticide = findViewById(R.id.spiOperatorExposedInsecticide); + guiTableDel.add(spiOperatorExposedInsecticide, "safety_operator_health"); + ((selectDB)spiOperatorExposedInsecticide).addField("", ""); + ((selectDB)spiOperatorExposedInsecticide).addField(getString(R.string.Yes), "1"); + ((selectDB)spiOperatorExposedInsecticide).addField(getString(R.string.No), "0"); + + // если да, то какое + edtDescription = (EditText) findViewById(R.id.edtDescription); + guiTableDel.add(edtDescription, "description"); + + + // Пустые контейнеры (выборка локализованных названий) + dboh = new DbOpenHelper(this); + cursor = dboh + .getReadableDatabase() + .rawQuery( + "select d.id, COALESCE((SELECT translation FROM _translations t JOIN _languages l ON t.language_id=l.id WHERE t.del = 0 AND identifier = d.name AND l.short_name='" + + Tools.getLang() + "' LIMIT 1),d.name) name from list_containers d where d.del=0 order by d.sort,d.name", null); + if (cursor.moveToFirst()) + { + do + { + if(cursor.getLong(cursor.getColumnIndex("id"))==1) + ((CheckBox) findViewById(R.id.cbTripleRinsed)).setText(cursor.getString(cursor.getColumnIndex("name"))); + if(cursor.getLong(cursor.getColumnIndex("id"))==2) + ((CheckBox) findViewById(R.id.cbPunctured)).setText(cursor.getString(cursor.getColumnIndex("name"))); + if(cursor.getLong(cursor.getColumnIndex("id"))==3) + ((CheckBox) findViewById(R.id.cbTakenBackToBase)).setText(cursor.getString(cursor.getColumnIndex("name"))); + if(cursor.getLong(cursor.getColumnIndex("id"))==4) + ((CheckBox) findViewById(R.id.cbLeftInField)).setText(cursor.getString(cursor.getColumnIndex("name"))); + if(cursor.getLong(cursor.getColumnIndex("id"))==5) + ((CheckBox) findViewById(R.id.cbBuried)).setText(cursor.getString(cursor.getColumnIndex("name"))); + if(cursor.getLong(cursor.getColumnIndex("id"))==6) + ((CheckBox) findViewById(R.id.cbBurned)).setText(cursor.getString(cursor.getColumnIndex("name"))); + } while (cursor.moveToNext()); + } + cursor.close(); + dboh.close(); + //Тут сам выбор значений из базы + edtSafEmptyContainers = (EditText) findViewById(R.id.edtSafEmptyContainers); + guiTableDel.add(edtSafEmptyContainers, "safety_container"); + edtSafEmptyContainers.addTextChangedListener(new TextWatcher() + { + public void afterTextChanged(Editable s){} + public void beforeTextChanged(CharSequence s, int start, int count, int after){} + public void onTextChanged(CharSequence s, int start, int before, int count) + { + String str = LocustHealthActivity.this.edtSafEmptyContainers.getText().toString(); + if (str.indexOf("1") != -1) + LocustHealthActivity.this.cbTripleRinsed.setChecked(true); + if (str.indexOf("2") != -1) + LocustHealthActivity.this.cbPunctured.setChecked(true); + if (str.indexOf("3") != -1) + LocustHealthActivity.this.cbTakenBackToBase.setChecked(true); + if (str.indexOf("4") != -1) + LocustHealthActivity.this.cbLeftInField.setChecked(true); + if (str.indexOf("5") != -1) + LocustHealthActivity.this.cbBuried.setChecked(true); + if (str.indexOf("6") != -1) + LocustHealthActivity.this.cbBurned.setChecked(true); + } + }); + cbTripleRinsed = (CheckBox) findViewById(R.id.cbTripleRinsed); + cbPunctured = (CheckBox) findViewById(R.id.cbPunctured); + cbTakenBackToBase = (CheckBox) findViewById(R.id.cbTakenBackToBase); + cbLeftInField = (CheckBox) findViewById(R.id.cbLeftInField); + cbBuried = (CheckBox) findViewById(R.id.cbBuried); + cbBurned = (CheckBox) findViewById(R.id.cbBurned); + + + // воздействие на нецелевые организмы + spiSafNonTarget = findViewById(R.id.spiSafNonTarget); + guiTableDel.add(spiSafNonTarget, "safety_non_target"); + ((selectDB)spiSafNonTarget).addField("", ""); + ((selectDB)spiSafNonTarget).addField(getString(R.string.Yes), "1"); + ((selectDB)spiSafNonTarget).addField(getString(R.string.No), "0"); + + // если да, то какое воздействие на нецелевые организмы + edtSafNonTargetEffect = (EditText) findViewById(R.id.edtSafNonTargetEffect); + guiTableDel.add(edtSafNonTargetEffect, "safety_non_target_effect"); + + // Другие инциденты по здоровью или окружающей среде, возникшие возможно при обработке + spiSafIncident = findViewById(R.id.spiSafIncident); + guiTableDel.add(spiSafIncident, "safety_incident"); + ((selectDB)spiSafIncident).addField("", ""); + ((selectDB)spiSafIncident).addField(getString(R.string.Yes), "1"); + ((selectDB)spiSafIncident).addField(getString(R.string.No), "0"); + + // Если Да, тип инцидента и кем сообщен (описание) + edtSafIncidentEffect = (EditText) findViewById(R.id.edtSafIncidentEffect); + guiTableDel.add(edtSafIncidentEffect, "safety_incident_effect"); + + + edtComments = (EditText) findViewById(R.id.edtComments); // КОММЕНТАР�?�? + guiTableDel.add(edtComments, "comments"); @@ -1635,14 +1780,8 @@ public class LocustHealthActivity extends FragmentActivity implements LocationLi // ((selectDB)spiProtectiveClothingClean).addField(getString(R.string.Yes), "1"); // ((selectDB)spiProtectiveClothingClean).addField(getString(R.string.No), "0"); // -// spiOperatorExposedInsecticide = findViewById(R.id.spiOperatorExposedInsecticide); -// guiTable.add(spiOperatorExposedInsecticide, "safety_operator_health"); -// ((selectDB)spiOperatorExposedInsecticide).addField("", ""); -// ((selectDB)spiOperatorExposedInsecticide).addField(getString(R.string.Yes), "1"); -// ((selectDB)spiOperatorExposedInsecticide).addField(getString(R.string.No), "0"); // -// edtDescription = (EditText) findViewById(R.id.edtDescription); // если да, то какое -// guiTable.add(edtDescription, "description"); + // // cbTest = (CheckBox) findViewById(R.id.cbTest); // guiTable.add(cbTest, "test"); diff --git a/app/src/main/java/kz/istt/locust/LocustHealthListActivity.java b/app/src/main/java/kz/istt/locust/LocustHealthListActivity.java index 9b6ce67..9341a22 100644 --- a/app/src/main/java/kz/istt/locust/LocustHealthListActivity.java +++ b/app/src/main/java/kz/istt/locust/LocustHealthListActivity.java @@ -599,6 +599,7 @@ public class LocustHealthListActivity extends AppCompatActivity llList.removeAllViews(); DbOpenHelper dboh = new DbOpenHelper(LocustHealthListActivity.this); + Cursor cursor = null; switch (spiList.getSelectedItemPosition()) { diff --git a/app/src/main/res/layout/activity_locust_health.xml b/app/src/main/res/layout/activity_locust_health.xml index ec8007c..7efd4f2 100644 --- a/app/src/main/res/layout/activity_locust_health.xml +++ b/app/src/main/res/layout/activity_locust_health.xml @@ -878,7 +878,7 @@ android:background="@color/transparent" app:boxBackgroundColor="@color/transparent"> - - - - - -