Browse Source

料仓设置23

master
fyf 1 year ago
parent
commit
2d49317e48
6 changed files with 71 additions and 18 deletions
  1. +2
    -0
      app/src/main/java/com/example/bpa/app/ICSApp.java
  2. +24
    -2
      app/src/main/java/com/example/bpa/helper/FlashHelper.java
  3. +15
    -0
      app/src/main/java/com/example/bpa/view/fragment/setting/systemparameter.java
  4. +26
    -14
      app/src/main/java/com/example/bpa/view/from/lcsz_activity.java
  5. +1
    -1
      app/src/main/java/com/example/bpa/view/from/yfcl_activity.java
  6. +3
    -1
      app/src/main/java/com/example/bpa/view/mode/lcMode.java

+ 2
- 0
app/src/main/java/com/example/bpa/app/ICSApp.java View File

@@ -81,6 +81,8 @@ public class ICSApp extends Application {
BPA_SILOS silo = new BPA_SILOS();
silo.id = java.util.UUID.randomUUID().toString();
silo.num = i + 1;
silo.thrsoleValue=ConfigName.getInstance().SiloAlarmThreshold;
silo.warningValue=ConfigName.getInstance().SiloFeedThreshold;
BPA_SILOSANDMATERIAL sm = new BPA_SILOSANDMATERIAL();
sm.silosID = silo.id;
sm.materialID = "";


+ 24
- 2
app/src/main/java/com/example/bpa/helper/FlashHelper.java View File

@@ -31,6 +31,9 @@ public class FlashHelper {
public List<Integer> listviews = new ArrayList<Integer>();
public List<Integer> listviews1 = new ArrayList<Integer>();

public List<View> listview = new ArrayList<View>();
public List<View> listview1 = new ArrayList<View>();

/**开启View闪烁效果**/
public void startFlick( View view ,Integer key) {
if (null == view) {
@@ -39,7 +42,6 @@ public class FlashHelper {
if(!listviews.contains(key))
{
view.setVisibility(View.VISIBLE);
Log.e("213", "VISIBLE: ");
Animation alphaAnimation = new AlphaAnimation(1, 0);
alphaAnimation.setDuration(300);
alphaAnimation.setInterpolator(new LinearInterpolator());
@@ -47,6 +49,7 @@ public class FlashHelper {
alphaAnimation.setRepeatMode(Animation.REVERSE);
view.startAnimation(alphaAnimation);
listviews.add(key);
listview.add(view);
}
}

@@ -61,6 +64,8 @@ public class FlashHelper {
view.setVisibility(View.GONE);
view.clearAnimation();
listviews.remove(key);
listview.remove(view);

}
}

@@ -72,7 +77,6 @@ public class FlashHelper {
if(!listviews1.contains(key))
{
view.setVisibility(View.VISIBLE);
Log.e("213", "VISIBLE: ");
Animation alphaAnimation = new AlphaAnimation(1, 0);
alphaAnimation.setDuration(300);
alphaAnimation.setInterpolator(new LinearInterpolator());
@@ -80,6 +84,8 @@ public class FlashHelper {
alphaAnimation.setRepeatMode(Animation.REVERSE);
view.startAnimation(alphaAnimation);
listviews1.add(key);
listview1.add(view);

}
}

@@ -94,6 +100,22 @@ public class FlashHelper {
view.setVisibility(View.GONE);
view.clearAnimation();
listviews1.remove(key);
listview1.remove(view);

}
}

public void Close()
{
listviews1.clear();
listviews.clear();
for (View item: listview1)
{
item.clearAnimation();
}
for (View item: listview)
{
item.clearAnimation();
}
}


+ 15
- 0
app/src/main/java/com/example/bpa/view/fragment/setting/systemparameter.java View File

@@ -19,6 +19,7 @@ import com.example.bpa.app.DeviceData;
import com.example.bpa.config.ConfigName;
import com.example.bpa.db.QueryDB;
import com.example.bpa.db.mode.BPA_GOODS;
import com.example.bpa.db.mode.BPA_SILOS;
import com.example.bpa.db.mode.BPA_SYSTEMSET;
import com.example.bpa.helper.T;

@@ -185,6 +186,20 @@ public class systemparameter extends Fragment implements View.OnClickListener{
set.userID = ConfigName.getInstance().user.userID;
QueryDB.AddSystemset(set);
}

ArrayList<BPA_SILOS> silos=QueryDB.GetSilosALL();
for (BPA_SILOS item:silos)
{
if(item.thrsoleValue<=0)
{
item.thrsoleValue=ConfigName.getInstance().SiloAlarmThreshold;
}
if(item.warningValue<=0)
{
item.warningValue=ConfigName.getInstance().SiloFeedThreshold;
}
QueryDB.UpdateSilos(item);
}
T.show(view.getContext(), "保存成功!");

break;


+ 26
- 14
app/src/main/java/com/example/bpa/view/from/lcsz_activity.java View File

@@ -73,6 +73,13 @@ public class lcsz_activity extends AppCompatActivity implements View.OnClickList
initEvents();
Run();
}

@Override
protected void onDestroy() {
FlashHelper.getInstance().Close();
super.onDestroy();
}

//endregion

//region 公共函数
@@ -114,9 +121,9 @@ public class lcsz_activity extends AppCompatActivity implements View.OnClickList
// }
List<BPA_MATERIAL> m = QueryDB.GetMaterialBySilosID(silo.id);
if(m.size()>0) {
datas.add(new lcMode(silo.id, silo.num, m.get(0).name, "0", m.get(0).id));
datas.add(new lcMode(silo.id, silo.num, m.get(0).name, "0", m.get(0).id,silo.warningValue,silo.thrsoleValue));
}else {
datas.add(new lcMode(silo.id, silo.num, "未设置", "0", ""));
datas.add(new lcMode(silo.id, silo.num, "未设置", "0", "",silo.warningValue,silo.thrsoleValue));
}

}
@@ -175,6 +182,8 @@ public class lcsz_activity extends AppCompatActivity implements View.OnClickList
if(QueryDB.UpdateSilosAndMaterial(item)){
currentSilo.materialName.setText(((selectitem_adapter)viewHolder).getItem(position).name);
T.show(lcsz_activity.this,"更新成功");
datas.get(position).materialId= item.materialID;
datas.get(position).materialName= ((selectitem_adapter)viewHolder).getItem(position).name;

}
}
@@ -237,20 +246,23 @@ public class lcsz_activity extends AppCompatActivity implements View.OnClickList
//hold.silosmargin.setText(new java.text.DecimalFormat("#.00").format(val)+"g");
hold.silosmargin.setText(val+"g");

if(val<datas.get(i).warningValue)//补料
if(!datas.get(i).materialId.isEmpty())
{
FlashHelper.getInstance().startFlick1(hold.image_yj,num);
}else
{
FlashHelper.getInstance().stopFlick1(hold.image_yj,num);
}
if(val<datas.get(i).warningValue)//补料
{
FlashHelper.getInstance().startFlick1(hold.image_yj,num);
}else
{
FlashHelper.getInstance().stopFlick1(hold.image_yj,num);
}

if(val<datas.get(i).thrsoleValue)//告警
{
FlashHelper.getInstance().startFlick(hold.image_gj,num);
}else
{
FlashHelper.getInstance().stopFlick(hold.image_gj,num);
if(val<datas.get(i).thrsoleValue)//告警
{
FlashHelper.getInstance().startFlick(hold.image_gj,num);
}else
{
FlashHelper.getInstance().stopFlick(hold.image_gj,num);
}
}
}
}


+ 1
- 1
app/src/main/java/com/example/bpa/view/from/yfcl_activity.java View File

@@ -32,7 +32,7 @@ public class yfcl_activity extends AppCompatActivity implements View.OnClickList
setContentView(R.layout.activity_yfcl);
Init();
initEvents();
//DataBus.getInstance().PlcIsConnect=true;
DataBus.getInstance().PlcIsConnect=true;
}
//endregion



+ 3
- 1
app/src/main/java/com/example/bpa/view/mode/lcMode.java View File

@@ -12,12 +12,14 @@ public class lcMode extends BPA_SILOS {
public String silosmargin;
//物料ID
public String materialId;
public lcMode(String id, int num,String materialName, String silosmargin,String materialId) {
public lcMode(String id, int num,String materialName, String silosmargin,String materialId,int warningValue,int thrsoleValue) {
this.materialName = materialName;
this.silosmargin = silosmargin;
this.num = num;
this.id = id;
this.materialId = materialId;
this.warningValue=warningValue;
this.thrsoleValue=thrsoleValue;
}




Loading…
Cancel
Save