diff --git a/app/src/main/java/com/example/bpa/MainActivity.java b/app/src/main/java/com/example/bpa/MainActivity.java index c47cb94..0300b6c 100644 --- a/app/src/main/java/com/example/bpa/MainActivity.java +++ b/app/src/main/java/com/example/bpa/MainActivity.java @@ -199,11 +199,7 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen { //ping 不通 boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address,1,1); - if(status) - { - MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!"); - ModbusTcpServer.ConnectPLC(); - }else + if(!status) //ping 不通 连接 { MessageLog.ShowInfo("PLC状态断开,尝试连接..."); DataBus.getInstance().PlcIsConnect=false; diff --git a/app/src/main/java/com/example/bpa/app/BootInit.java b/app/src/main/java/com/example/bpa/app/BootInit.java index 6b1bb13..9ef1a1d 100644 --- a/app/src/main/java/com/example/bpa/app/BootInit.java +++ b/app/src/main/java/com/example/bpa/app/BootInit.java @@ -11,6 +11,7 @@ import com.example.bpa.config.DataBus; import com.example.bpa.db.QueryDB; import com.example.bpa.db.file.DBHelper; import com.example.bpa.db.mode.BPA_ALERTLOG; +import com.example.bpa.db.mode.BPA_GOODSRECIPE; import com.example.bpa.db.mode.BPA_LOG; import com.example.bpa.db.mode.BPA_SILOS; import com.example.bpa.db.mode.BPA_SILOSANDMATERIAL; @@ -42,10 +43,13 @@ public class BootInit { ToastUtil.init(app); //2.初始化SD卡,数据库DB SdCart.getInstance().initSD(); + + //3.初始化数据 InitDBdata(); //4.初始化Main Main.getInstance(); + //BusinessServer.Get().test(); //MessageLog.ShowAlertMessage(AlertLogEnum.传感器异常日志,"传感器异常"); //MessageLog.ShowAlertMessage(AlertLogEnum.异常订单未制作日志,"异常订单未制作日志"); @@ -179,8 +183,16 @@ public class BootInit { /** * 删除子订单表-重新生成新表 */ - public void DBdelete() + public static void DBdelete() { DBHelper.getInstance(ConfigName.getInstance().dishesCon).DeleteCreateTables(BPA_SUBORDER.class,null); } + + /** + * 更新数据库字段 + */ + public static void UpdateTablezd() + { + DBHelper.getInstance(ConfigName.getInstance().dishesCon).UpdateTbalezd(BPA_GOODSRECIPE.class,null,"value","text"); + } } diff --git a/app/src/main/java/com/example/bpa/config/ConfigName.java b/app/src/main/java/com/example/bpa/config/ConfigName.java index dcda2b1..8145af5 100644 --- a/app/src/main/java/com/example/bpa/config/ConfigName.java +++ b/app/src/main/java/com/example/bpa/config/ConfigName.java @@ -204,7 +204,7 @@ public class ConfigName { //硬件设备 初始化 add(new Res_PLCADDRESS("-------------","","出料口",1,0)); - add(new Res_PLCADDRESS("M51.6","M101.6","出料口振动器",1,1)); + add(new Res_PLCADDRESS("M41.6","M101.6","出料口振动器",1,1)); add(new Res_PLCADDRESS("-------------","","酱油仓/猪油仓",1,0)); add(new Res_PLCADDRESS("M52.7","M102.7","酱油仓控制",0,1)); @@ -221,18 +221,18 @@ public class ConfigName { add(new Res_PLCADDRESS("M50.4","M100.4","外置仓正转(5)",1,1)); add(new Res_PLCADDRESS("M50.5","M100.5","外置仓正转(6)",1,1)); - add(new Res_PLCADDRESS("M51.0","M101.0","外置仓反转(1)",1,1)); - add(new Res_PLCADDRESS("M51.1","M101.1","外置仓反转(2)",1,1)); - add(new Res_PLCADDRESS("M51.2","M101.2","外置仓反转(3)",1,1)); - add(new Res_PLCADDRESS("M51.3","M101.3","外置仓反转(4)",1,1)); - add(new Res_PLCADDRESS("M51.4","M101.4","外置仓反转(5)",1,1)); - add(new Res_PLCADDRESS("M51.5","M101.5","外置仓反转(6)",1,1)); + add(new Res_PLCADDRESS("M41.0","M101.0","外置仓反转(1)",1,1)); + add(new Res_PLCADDRESS("M41.1","M101.1","外置仓反转(2)",1,1)); + add(new Res_PLCADDRESS("M41.2","M101.2","外置仓反转(3)",1,1)); + add(new Res_PLCADDRESS("M41.3","M101.3","外置仓反转(4)",1,1)); + add(new Res_PLCADDRESS("M41.4","M101.4","外置仓反转(5)",1,1)); + add(new Res_PLCADDRESS("M41.5","M101.5","外置仓反转(6)",1,1)); add(new Res_PLCADDRESS("-------------","","粉料仓",0,0)); add(new Res_PLCADDRESS("M52.2","M102.2","粉料仓控制(1)",0,1)); - add(new Res_PLCADDRESS("M52.3","M102.3","粉料仓控制(1)",0,1)); - add(new Res_PLCADDRESS("M52.4","M102.4","粉料仓控制(1)",0,1)); - add(new Res_PLCADDRESS("M52.5","M102.5","粉料仓控制(1)",0,1)); + add(new Res_PLCADDRESS("M52.3","M102.3","粉料仓控制(2)",0,1)); + add(new Res_PLCADDRESS("M52.4","M102.4","粉料仓控制(3)",0,1)); + add(new Res_PLCADDRESS("M52.5","M102.5","粉料仓控制(4)",0,1)); add(new Res_PLCADDRESS("-------------","","水池",1,0)); add(new Res_PLCADDRESS("M50.6","M100.6","水池排水阀",1,1)); diff --git a/app/src/main/java/com/example/bpa/config/DataBus.java b/app/src/main/java/com/example/bpa/config/DataBus.java index 6435f38..4a81c2a 100644 --- a/app/src/main/java/com/example/bpa/config/DataBus.java +++ b/app/src/main/java/com/example/bpa/config/DataBus.java @@ -320,31 +320,31 @@ public class DataBus { public ResultA InspectMaterial(String GoodId) { ResultA resultA=new ResultA(); - boolean IsMake=true; - String message=""; +// boolean IsMake=true; +// String message=""; try { - ArrayList goodsRecipes = QueryDB.GetGoodsSrecipeList(GoodId); - for (ResGoodsRecipe recipe:goodsRecipes) - { - BPA_SILOS silos=null; - List siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID); - for (BPA_SILOS si:siloslist) - { - if(DeviceData.Get().getCallCurrentWeight(si.num)>=recipe.value){silos=si;break;} - } - if(silos==null) - { - IsMake=false; - message+=recipe.materialName+","; - } - } - resultA.IsMake=IsMake; - resultA.Message="【" +message+"】物料不足,请检查料仓物料!"; +// ArrayList goodsRecipes = QueryDB.GetGoodsSrecipeList(GoodId); +// for (ResGoodsRecipe recipe:goodsRecipes) +// { +// BPA_SILOS silos=null; +// List siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID); +// for (BPA_SILOS si:siloslist) +// { +// if(DeviceData.Get().getCallCurrentWeight(si.num)>=recipe.value){silos=si;break;} +// } +// if(silos==null) +// { +// IsMake=false; +// message+=recipe.materialName+","; +// } +// } +// resultA.IsMake=IsMake; +// resultA.Message="【" +message+"】物料不足,请检查料仓物料!"; return resultA; }catch(Exception e){ - resultA.IsMake=false; - resultA.Message=e.getMessage(); +// resultA.IsMake=false; +// resultA.Message=e.getMessage(); return resultA; } } diff --git a/app/src/main/java/com/example/bpa/db/QueryDB.java b/app/src/main/java/com/example/bpa/db/QueryDB.java index 2bbfb10..bf82b57 100644 --- a/app/src/main/java/com/example/bpa/db/QueryDB.java +++ b/app/src/main/java/com/example/bpa/db/QueryDB.java @@ -2066,7 +2066,7 @@ public class QueryDB { //私有 ((BPA_GOODSRECIPE) data).goodsID = cursor.getString((int) cursor.getColumnIndex("goodsID")); ((BPA_GOODSRECIPE) data).materialID = cursor.getString((int) cursor.getColumnIndex("materialID")); - ((BPA_GOODSRECIPE) data).value = cursor.getInt((int) cursor.getColumnIndex("value")); + ((BPA_GOODSRECIPE) data).value = cursor.getString((int) cursor.getColumnIndex("value")); ((BPA_GOODSRECIPE) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); ((BPA_GOODSRECIPE) data).materialType = cursor.getInt((int) cursor.getColumnIndex("materialType")); break; @@ -2141,11 +2141,13 @@ public class QueryDB { //私有 ((BPA_SUGAR) data).sugarName = cursor.getString((int) cursor.getColumnIndex("sugarName")); ((BPA_SUGAR) data).plcvar = cursor.getString((int) cursor.getColumnIndex("plcvar")); + break; case "BPA_CRAFT": data = new BPA_CRAFT(); //私有 ((BPA_CRAFT) data).status = cursor.getInt((int) cursor.getColumnIndex("status")); ((BPA_CRAFT) data).name = cursor.getString((int) cursor.getColumnIndex("name")); + break; case "BPA_CRAFTPROCESS": data = new BPA_CRAFTPROCESS(); //私有 @@ -2153,7 +2155,7 @@ public class QueryDB { ((BPA_CRAFTPROCESS) data).pfid = cursor.getString((int) cursor.getColumnIndex("pfid")); ((BPA_CRAFTPROCESS) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); ((BPA_CRAFTPROCESS) data).value = cursor.getInt((int) cursor.getColumnIndex("value")); - + break; } ((ModeBase) data).id = cursor.getString((int) cursor.getColumnIndex("id")); ((ModeBase) data).createTime = cursor.getString((int) cursor.getColumnIndex("createTime")); diff --git a/app/src/main/java/com/example/bpa/db/file/DBHelper.java b/app/src/main/java/com/example/bpa/db/file/DBHelper.java index 57f9679..9516d20 100644 --- a/app/src/main/java/com/example/bpa/db/file/DBHelper.java +++ b/app/src/main/java/com/example/bpa/db/file/DBHelper.java @@ -215,4 +215,60 @@ public class DBHelper extends SQLiteOpenHelper { db.setTransactionSuccessful(); db.endTransaction(); } + + /** + * 更新数据库字段 + * @param c + * @param premarykey + * @param newname + * @param newtype + */ + public void UpdateTbalezd(Class c,String premarykey,String newname,String newtype) + { + SQLiteDatabase db =this.getWritableDatabase(); + db.beginTransaction(); + String TabName= c.getSimpleName();//表名称 + + Table t = new Table(TabName); // 创建表名称 + Table t1 = new Table(TabName+"LAO"); // 创建表名称 + String zd=""; + for (Field field : c.getFields()){ + String name=field.getName(); + String type=field.getType().getSimpleName(); + if(type.equals("String") || type.equals("Date")) + { + type="text"; + } + t.addFeild(new Feild(name, type)); // 字段名称 + + + if(name.equals(newname)) + { + t1.addFeild(new Feild(name, newtype)); + }else + { + t1.addFeild(new Feild(name, type)); + } + zd+=name+","; + } + db.execSQL(t1.createSQL(premarykey));//创建临时表 + + // 2. 复制数据到临时表 + //"INSERT INTO new_table (column1, column2) " + // + "SELECT column1, column2 " + // + "FROM original_table;" + String _sql=String.format("INSERT INTO %s (%s) SELECT %s FROM %s", + TabName+"LAO", + zd.trim().replaceAll(",$", ""), + zd.trim().replaceAll(",$", ""), + TabName + ); + db.execSQL(_sql); + + db.execSQL(t.deleteSql()); + db.execSQL("ALTER TABLE "+TabName+"LAO RENAME TO "+TabName+";");//重新命名 + + db.setTransactionSuccessful(); + db.endTransaction(); + } } diff --git a/app/src/main/java/com/example/bpa/db/file/Table.java b/app/src/main/java/com/example/bpa/db/file/Table.java index d21c522..14f314b 100644 --- a/app/src/main/java/com/example/bpa/db/file/Table.java +++ b/app/src/main/java/com/example/bpa/db/file/Table.java @@ -41,7 +41,10 @@ public class Table { sb.append(" "); sb.append(f.type); sb.append(" "); - if (premarykey.equals(f.name)) {sb.append("PRIMARY KEY");}//主键 + if(premarykey!=null) + { + if (premarykey.equals(f.name)) {sb.append("PRIMARY KEY");}//主键 + } sb.append(","); } sb.deleteCharAt(sb.length()-1); diff --git a/app/src/main/java/com/example/bpa/db/mode/BPA_GOODSRECIPE.java b/app/src/main/java/com/example/bpa/db/mode/BPA_GOODSRECIPE.java index 4d5b0bb..5e1a3eb 100644 --- a/app/src/main/java/com/example/bpa/db/mode/BPA_GOODSRECIPE.java +++ b/app/src/main/java/com/example/bpa/db/mode/BPA_GOODSRECIPE.java @@ -10,7 +10,7 @@ public class BPA_GOODSRECIPE extends ModeBase { //物料ID public String materialID; //出料数值:20g - public int value; + public String value; //排序 public int sort; //物料类型 diff --git a/app/src/main/java/com/example/bpa/db/mode/BPA_GOODSRECIPELAO.java b/app/src/main/java/com/example/bpa/db/mode/BPA_GOODSRECIPELAO.java new file mode 100644 index 0000000..92fa280 --- /dev/null +++ b/app/src/main/java/com/example/bpa/db/mode/BPA_GOODSRECIPELAO.java @@ -0,0 +1,14 @@ +package com.example.bpa.db.mode; + +public class BPA_GOODSRECIPELAO extends ModeBase { + //商品ID + public String goodsID; + //物料ID + public String materialID; + //出料数值:20g + public String value; + //排序 + public int sort; + //物料类型 + public int materialType; +} \ No newline at end of file diff --git a/app/src/main/java/com/example/bpa/service/BusinessServer.java b/app/src/main/java/com/example/bpa/service/BusinessServer.java index 4d9985f..6b084e3 100644 --- a/app/src/main/java/com/example/bpa/service/BusinessServer.java +++ b/app/src/main/java/com/example/bpa/service/BusinessServer.java @@ -135,7 +135,8 @@ public class BusinessServer { } else { liaochang.add(silos.num); MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "准备下发【" + silos.num + "】号料仓PLC控制命令,需求量:=" + recipe.value); - DeviceData.Get().setDemandValue((short) recipe.value, silos.num, new IWriteCallBack() { + int _val = (int)Math.round((Double.parseDouble(recipe.value) * 10)); + DeviceData.Get().setDemandValue((short) _val, silos.num, new IWriteCallBack() { @Override public void onSuccess() { MessageLog.ShowInfo(message + "下发成功!"); @@ -155,19 +156,20 @@ public class BusinessServer { ModbusTcpServer.get().WriteBool(bs.plcvar, false); MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发成功!"); } - //将其余料仓出料设置为0,重置 - for (int k = 1; k <= 12; k++) { - if (!liaochang.contains(k)) { - DeviceData.Get().setDemandValue((short) 0, k, new IWriteCallBack() { - @Override - public void onSuccess() { - } + } - @Override - public void onFailure(String ErrorMsg) { - } - }); - } + //将其余料仓出料设置为0,重置 + for (int k = 1; k <= 12; k++) { + if (!liaochang.contains(k)) { + DeviceData.Get().setDemandValue((short) 0, k, new IWriteCallBack() { + @Override + public void onSuccess() { + } + + @Override + public void onFailure(String ErrorMsg) { + } + }); } } diff --git a/app/src/main/java/com/example/bpa/service/DeviceData.java b/app/src/main/java/com/example/bpa/service/DeviceData.java index dbe0b2f..78f41bc 100644 --- a/app/src/main/java/com/example/bpa/service/DeviceData.java +++ b/app/src/main/java/com/example/bpa/service/DeviceData.java @@ -68,6 +68,14 @@ public class DeviceData { JRX_FructoseTemperature=ints[1]; }); + //获取温度设置 + ModbusTcpServer.get().ReadInt("VD372", 1, ints -> { + BWX_FructoseTemperature_sz=ints[0]; + }); + ModbusTcpServer.get().ReadInt("VD380", 1, ints -> { + JRX_FructoseTemperature_sz=ints[0]; + }); + //获取校准模式 ModbusTcpServer.get().ReadBool("M1.0", 1, booleans -> { WeightCalibrationMode = booleans[0]; @@ -98,7 +106,7 @@ public class DeviceData { ModbusTcpServer.get().ReadBool("M105.0", 6, booleans -> { for (int i=0;i= 1 && ch <= 10) { + if (ch >= 1 && ch <= 12) { String add = "VW" + (298 + ch * 2); ModbusTcpServer.get().WriteShort(add, value, callback); } @@ -215,7 +223,7 @@ public class DeviceData { * 设置通道校准开关 * ,PLC 地址 M2.0--M3.1 * - * @param value 需要写入的值 + * @param value 需要写入的值122 * @param ch 需要写入的通道编号,1--10 */ public void setChCalibrationSwitch(boolean value, int ch, IWriteCallBack callback) { diff --git a/app/src/main/java/com/example/bpa/service/OrderServer.java b/app/src/main/java/com/example/bpa/service/OrderServer.java index 8345811..006126a 100644 --- a/app/src/main/java/com/example/bpa/service/OrderServer.java +++ b/app/src/main/java/com/example/bpa/service/OrderServer.java @@ -314,7 +314,7 @@ public class OrderServer { da.id=info.Id; Batchingstechnology gy= chnology.get(info.Id); da.materialID = info.BatchingId; - da.value = (int)info.BomQty; + da.value =String.format ("%.1f", info.BomQty); if(gy!=null) { da.sort =gy.Sort; @@ -352,7 +352,7 @@ public class OrderServer { { da.id=java.util.UUID.randomUUID().toString(); da.materialID = a.BatchingId; - da.value = Integer.valueOf(a.ActionValue) ; + da.value =String.format ("%.1f", a.ActionValue); da.sort =Integer.parseInt(actions.Sort); QueryDB.AddGoodsSrecipe(da); } diff --git a/app/src/main/java/com/example/bpa/view/adapter/pf_adapter.java b/app/src/main/java/com/example/bpa/view/adapter/pf_adapter.java index 201239c..1ace47c 100644 --- a/app/src/main/java/com/example/bpa/view/adapter/pf_adapter.java +++ b/app/src/main/java/com/example/bpa/view/adapter/pf_adapter.java @@ -139,7 +139,7 @@ public class pf_adapter extends ArrayAdapter { T.show(view.getContext(), "不能为空!"); return; } - resGoodsRecipe.value=Integer.parseInt(so); + resGoodsRecipe.value=String.format ("%.1f", Double.parseDouble(so)); datas.set(position,resGoodsRecipe); } }); diff --git a/app/src/main/java/com/example/bpa/view/control/clsf_control.java b/app/src/main/java/com/example/bpa/view/control/clsf_control.java index ff3c67e..e7d4c18 100644 --- a/app/src/main/java/com/example/bpa/view/control/clsf_control.java +++ b/app/src/main/java/com/example/bpa/view/control/clsf_control.java @@ -67,10 +67,12 @@ public class clsf_control extends LinearLayout { @Override public void run() { try { - switch1.setChecked(DeviceData.Get().getAutomationValue(in)); + switch1.setChecked(DeviceData.Get().getAutomationValue(in-1)); bc_text1.setText(DeviceData.Get().ReadAutomationValue(sf.H_address)+""); bc_text2.setText(DeviceData.Get().ReadAutomationValue(sf.L_address)+""); - bc_text3.setText(DeviceData.Get().ReadAutomationValue(sf.time_address)+""); + + int time=DeviceData.Get().ReadAutomationValue(sf.time_address); + bc_text3.setText(String.format ("%.1f", time/10.0)+""); } catch (Exception e) { } @@ -107,7 +109,9 @@ public class clsf_control extends LinearLayout { try { H=Short.parseShort(bc_text1.getText().toString()) ; L=Short.parseShort(bc_text2.getText().toString()) ; - time=Short.parseShort(bc_text3.getText().toString()) ; + //time=(Short)Math.round(); + int ftime = (int)Math.round((Double.parseDouble(bc_text3.getText().toString()) * 10)); + time=(short) ftime; } catch (Exception ex) { @@ -140,19 +144,45 @@ public class clsf_control extends LinearLayout { T.show(view.getContext(), "出料重量不能为空!"); return; } - int zl = 0; + double zl = 0; try { - zl = Integer.parseInt(zltext); + zl = Double.parseDouble(zltext); } catch (Exception e) { T.show(view.getContext(), "出料重量获取异常!" + e.getMessage()); return; } - int finalZl = zl; - DeviceData.Get().setDemandValue((short) zl, index, new IWriteCallBack() { + if(zl<=1) + { + T.show(view.getContext(), "出料重量至少大于1g!"); + return; + } + + double finalZl = zl; + //将其余料仓出料设置为0,重置 + for (int k = 1; k <= 12; k++) { + if (k!=index) { + DeviceData.Get().setDemandValue((short) 0, k,null); + } + } + DeviceData.Get().setDemandValue((short) ((int)(zl*10)), index, new IWriteCallBack() { @Override public void onSuccess() { + MessageLog.ShowInfo( "模拟物料下发成功!克数:"+ finalZl +"g"); + T.show(view.getContext(), "模拟物料下发成功!克数:"+ finalZl +"g"); + DeviceData.Get().setChargeMixtureStart(new IWriteCallBack() { + @Override + public void onSuccess() { + MessageLog.ShowInfo( "开始出料!克数:"+ finalZl +"g"); + T.show(view.getContext(), "开始出料!克数:"+ finalZl +"g"); + } + @Override + public void onFailure(String ErrorMsg) { + MessageLog.ShowInfo( "出料失败!克数:"+ finalZl +"g"); + T.show(view.getContext(), "出料失败!克数:"+ finalZl +"g"); + } + }); } @Override @@ -160,9 +190,6 @@ public class clsf_control extends LinearLayout { MessageLog.ShowInfo( "模拟物料下发失败!"); } }); - - //启动配料 - DeviceData.Get().setChargeMixtureStart(null); } }); } diff --git a/app/src/main/java/com/example/bpa/view/control/sdkz_control.java b/app/src/main/java/com/example/bpa/view/control/sdkz_control.java index 048d4cf..1ece152 100644 --- a/app/src/main/java/com/example/bpa/view/control/sdkz_control.java +++ b/app/src/main/java/com/example/bpa/view/control/sdkz_control.java @@ -63,7 +63,7 @@ public class sdkz_control extends LinearLayout { aSwitch.setTag(item.zd_address); aSwitch.setChecked(DeviceData.Get().getAutomationValue(item.address)); } - aSwitch.setHeight(40); + aSwitch.setHeight(55); aSwitch.setBackground(ConfigName.getInstance().dishesCon.getResources().getDrawable(R.drawable.qs_switch)); aSwitch.setOnClickListener(new OnClickListener() { @Override diff --git a/app/src/main/java/com/example/bpa/view/from/add_pf_activity.java b/app/src/main/java/com/example/bpa/view/from/add_pf_activity.java index b2cad24..b30cd77 100644 --- a/app/src/main/java/com/example/bpa/view/from/add_pf_activity.java +++ b/app/src/main/java/com/example/bpa/view/from/add_pf_activity.java @@ -286,6 +286,7 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi recipe1.sort=1; recipe1.materialName = wuliaolist_spinner.getSelectedItem().toString(); recipe1.materialID = material_map.get(recipe1.materialName); + recipe1.value="0"; bpa_pf.add(recipe1); DataTab(); break; @@ -296,6 +297,7 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi recipe.materialType = 2; recipe.materialName = guotanglist_spinner.getSelectedItem().toString(); recipe.materialID = sugar_map.get(recipe.materialName); + recipe.value="0"; bpa_pf.add(recipe); DataTab(); break; diff --git a/app/src/main/java/com/example/bpa/view/from/lsjy_activity.java b/app/src/main/java/com/example/bpa/view/from/lsjy_activity.java index c5f694e..a5fc286 100644 --- a/app/src/main/java/com/example/bpa/view/from/lsjy_activity.java +++ b/app/src/main/java/com/example/bpa/view/from/lsjy_activity.java @@ -151,11 +151,11 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList try { for (int i = 0; i < 12; i++) { String s = String.valueOf(DeviceData.Get().getCalibrationValue(i + 1)); - editTextLists.get(i).setText(s); + editTextLists.get(i).setText(String.format ("%.1f", (Double.parseDouble(s)/10))); } String time = String.valueOf(DeviceData.Get().getCalibrationReferenceTime()); //校准时间 - timeText.setText(time); + timeText.setText(String.format ("%.1f", (Double.parseDouble(time)/10))); //设置手动模式 DeviceData.Get().setHandOrAutoSwitch(false, null); @@ -186,7 +186,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList } int ftime = 0; try { - ftime = Integer.parseInt(stime); + ftime = (int)Math.round((Double.parseDouble(stime) * 10)); } catch (Exception e) { T.show(lsjy_activity.this, "校准基准时间异常!" + e.getMessage()); return; @@ -210,7 +210,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList String value = editTextLists.get(i).getText().toString(); Short val = 0; try { - val = Short.parseShort(value); + val =(short)Math.round((Double.parseDouble(value) * 10)); } catch (Exception e) { } if (val <= 0) { @@ -224,7 +224,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList String value = editTextLists.get(i).getText().toString(); Short val = 0; try { - val = Short.parseShort(value); + val =(short)Math.round((Double.parseDouble(value) * 10)); } catch (Exception e) { } DeviceData.Get().setCalibrationValue(val, i + 1, new IWriteCallBack() { diff --git a/app/src/main/res/drawable/btn_ripple_good.xml b/app/src/main/res/drawable/btn_ripple_good.xml index ac163b1..f6090cb 100644 --- a/app/src/main/res/drawable/btn_ripple_good.xml +++ b/app/src/main/res/drawable/btn_ripple_good.xml @@ -2,6 +2,6 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/datatab/layout/pf_item.xml b/app/src/main/res/layout/datatab/layout/pf_item.xml index 3572ebf..d67fd15 100644 --- a/app/src/main/res/layout/datatab/layout/pf_item.xml +++ b/app/src/main/res/layout/datatab/layout/pf_item.xml @@ -79,8 +79,8 @@ android:layout_centerVertical="true" android:layout_marginLeft="20dp" android:layout_alignParentLeft="true" - android:inputType="text" - android:digits="0123456789" + android:inputType="number|numberDecimal" + android:digits="0123456789." android:padding="3dp" android:textColor="@color/foreground" android:theme="@style/MyEditText1" diff --git a/app/src/main/res/layout/from/layout/activity_lsjy.xml b/app/src/main/res/layout/from/layout/activity_lsjy.xml index a0d9439..f7b334c 100644 --- a/app/src/main/res/layout/from/layout/activity_lsjy.xml +++ b/app/src/main/res/layout/from/layout/activity_lsjy.xml @@ -523,7 +523,7 @@ + android:src="@mipmap/milktea_2" /> + android:background="@mipmap/bg_f1">