@@ -79,9 +79,9 @@ public class DataBus { | |||
for (BPA_SILOS silo : bpa_silos) { | |||
List<BPA_MATERIAL> m = QueryDB.GetMaterialBySilosID(silo.id); | |||
if (m.size() > 0) { | |||
lc.add(new lcMode(silo.id, silo.num, m.get(0).name, silo.silosmargin, silo.siloszl, m.get(0).id,m.get(0).type, silo.warningValue, silo.thrsoleValue,silo.name.isEmpty()?"":silo.name)); | |||
lc.add(new lcMode(silo.id, silo.num, m.get(0).name, silo.silosmargin, silo.siloszl, m.get(0).id,m.get(0).type, silo.warningValue, silo.thrsoleValue,silo.name.isEmpty()?"":silo.name,silo.status)); | |||
} else { | |||
lc.add(new lcMode(silo.id, silo.num, "未设置", silo.silosmargin, silo.siloszl, "",0, silo.warningValue, silo.thrsoleValue,silo.name.isEmpty()?"":silo.name)); | |||
lc.add(new lcMode(silo.id, silo.num, "未设置", silo.silosmargin, silo.siloszl, "",0, silo.warningValue, silo.thrsoleValue,silo.name.isEmpty()?"":silo.name,silo.status)); | |||
} | |||
} | |||
} | |||
@@ -474,6 +474,19 @@ public class QueryDB { | |||
Update(BPA_SILOS.class, silos); | |||
} | |||
} | |||
/** | |||
* 料仓状态 | |||
* @param id | |||
* @param data | |||
*/ | |||
public static void UpdateSilosStatus(String id, boolean data) { | |||
BPA_SILOS silos = GetSilosID(id); | |||
if (silos != null) { | |||
silos.status = data?0:1; | |||
Update(BPA_SILOS.class, silos); | |||
} | |||
} | |||
//endregion | |||
//region BPA_SILOSANDMATERIAL 料仓物料关联表 | |||
@@ -19,7 +19,7 @@ public class BPA_SILOS extends ModeBase { | |||
public int bValue; | |||
//校准值 实际校准1s出多少g | |||
public int jValue; //time 2 s | |||
//状态 状态:0 禁用 1 启用 | |||
//状态 状态:0 启用 1 禁用 | |||
public int status; | |||
//优先级 优先出料顺序 | |||
public int Sort; | |||
@@ -10,7 +10,7 @@ public class lcMode extends BPA_SILOS { | |||
public String materialId; | |||
//物料类型 | |||
public int materiallx; | |||
public lcMode(String id, int num,String materialName, int silosmargin,int siloszl,String materialId,int materiallx,int warningValue,int thrsoleValue,String _name) { | |||
public lcMode(String id, int num,String materialName, int silosmargin,int siloszl,String materialId,int materiallx,int warningValue,int thrsoleValue,String _name,int _sta) { | |||
this.materialName = materialName; | |||
this.silosmargin = silosmargin; | |||
this.num = num; | |||
@@ -21,5 +21,6 @@ public class lcMode extends BPA_SILOS { | |||
this.thrsoleValue=thrsoleValue; | |||
this.siloszl=siloszl; | |||
this.name=_name; | |||
this.status=_sta; | |||
} | |||
} |
@@ -19,6 +19,7 @@ import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.mode.Silos_item_fragment; | |||
import com.bonait.bnframework.modules.home.fragment.mode.add_silos_ck; | |||
import com.bonait.bnframework.modules.home.fragment.mode.add_yijian_controlextends; | |||
import com.bonait.bnframework.modules.home.fragment.mode.silos_jiaoyan; | |||
import com.qmuiteam.qmui.arch.QMUIFragment; | |||
import com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
@@ -50,15 +51,19 @@ public class SilosNewActivity extends BaseActivity { | |||
@BindView(R.id.add_yijian) | |||
add_yijian_controlextends add_yijian; | |||
@BindView(R.id.silos_jz) | |||
silos_jiaoyan silos_jz; | |||
private Context context; | |||
ArrayList<lcMode> lcModes = new ArrayList<>(); | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setContentView(R.layout.activity_silos_new); | |||
ButterKnife.bind(this); | |||
context=getContext(); | |||
context = getContext(); | |||
initTopBar(); | |||
InitData(); | |||
} | |||
@@ -72,7 +77,8 @@ public class SilosNewActivity extends BaseActivity { | |||
} | |||
}); | |||
add_yijian.mListener=new MyClickListener() { | |||
//一键控制 | |||
add_yijian.mListener = new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
@@ -83,10 +89,10 @@ public class SilosNewActivity extends BaseActivity { | |||
if (k == 0) { | |||
InitData(); | |||
add_yijian.setVisibility(View.GONE); | |||
} else if (k==1){ | |||
}else if (k==2){ | |||
}else if (k==3){ | |||
}else if (k==4){ | |||
} else if (k == 1) { | |||
} else if (k == 2) { | |||
} else if (k == 3) { | |||
} else if (k == 4) { | |||
} | |||
} | |||
}; | |||
@@ -101,6 +107,7 @@ public class SilosNewActivity extends BaseActivity { | |||
} | |||
}); | |||
//料仓设置 | |||
add_silos.mListener = new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
@@ -111,17 +118,34 @@ public class SilosNewActivity extends BaseActivity { | |||
if (k == 0) { | |||
InitData(); | |||
add_silos.setVisibility(View.GONE); | |||
} else if (k==1){ | |||
} else if (k == 1) { | |||
ToastUtils.info("补充原料成功!!!"); | |||
}else if (k==2){ | |||
}else if (k==3){ | |||
ToastUtils.warning("功能研发中!!!"); | |||
}else if (k==4){ | |||
ToastUtils.warning("功能研发中!!!"); | |||
}else if (k==5){ | |||
}else if (k==6){ | |||
ToastUtils.info("设置物料成功!!!"); | |||
} else if (k == 2) { | |||
//满贯 | |||
} else if (k == 3) { | |||
//设置 | |||
} else if (k == 4) { | |||
//校准 | |||
silos_jz.SetData((lcMode) data,getSupportFragmentManager()); | |||
silos_jz.setVisibility(View.VISIBLE); | |||
} else if (k == 5) { | |||
// | |||
} else if (k == 6) { | |||
ToastUtils.info("设置物料成功!!!"); | |||
} | |||
} | |||
}; | |||
//料仓校准 | |||
silos_jz.mListener = new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
if (k == 0) { | |||
silos_jz.setVisibility(View.GONE); | |||
} | |||
} | |||
}; | |||
@@ -129,32 +153,30 @@ public class SilosNewActivity extends BaseActivity { | |||
//list 界面 | |||
public List<LinkMode> Fdata = new ArrayList<>(); | |||
/** | |||
* 初始化数据 | |||
*/ | |||
public void InitData() { | |||
lcModes = DataBus.getInstance().ResGetLc(); | |||
Fdata.clear(); | |||
LinkedHashMap<String,List<Object>> map=new LinkedHashMap<>(); | |||
for(lcMode item :lcModes) | |||
{ | |||
if(map.containsKey(item.name)) | |||
{ | |||
LinkedHashMap<String, List<Object>> map = new LinkedHashMap<>(); | |||
for (lcMode item : lcModes) { | |||
if (map.containsKey(item.name)) { | |||
map.get(item.name).add(item); | |||
}else | |||
{ | |||
List<Object> lc=new ArrayList<>(); | |||
} else { | |||
List<Object> lc = new ArrayList<>(); | |||
lc.add(item); | |||
map.put(item.name,lc); | |||
map.put(item.name, lc); | |||
} | |||
} | |||
/** | |||
* 编例HashMap中所有key跟value的值 | |||
*/ | |||
int i=0; | |||
for(Object key:map.keySet()){ | |||
List<Object> value = map.get(key); | |||
LinkMode linkMode=new LinkMode(key.toString(),value,i==0?true:false); | |||
int i = 0; | |||
for (Object key : map.keySet()) { | |||
List<Object> value = map.get(key); | |||
LinkMode linkMode = new LinkMode(key.toString(), value, i == 0 ? true : false); | |||
Fdata.add(linkMode); | |||
@@ -162,29 +184,32 @@ public class SilosNewActivity extends BaseActivity { | |||
} | |||
QMUIFragmentPagerAdapter adapter=new QMUIFragmentPagerAdapter(getSupportFragmentManager()) { | |||
QMUIFragmentPagerAdapter adapter = new QMUIFragmentPagerAdapter(getSupportFragmentManager()) { | |||
@Override | |||
public int getCount() { | |||
return Fdata.size(); | |||
} | |||
@Override | |||
public QMUIFragment createFragment(int position) { | |||
//显示数元 | |||
Silos_item_fragment fragment= new Silos_item_fragment(); | |||
Silos_item_fragment fragment = new Silos_item_fragment(); | |||
fragment.SetData(Fdata.get(position).content); | |||
return fragment; | |||
} | |||
@Override | |||
public CharSequence getPageTitle(int position) { | |||
return Fdata.get(position).type.toString(); | |||
} | |||
}; | |||
viewpager_silos.setAdapter(adapter); | |||
tabs.setupWithViewPager(viewpager_silos,true); | |||
tabs.setupWithViewPager(viewpager_silos, true); | |||
tabs.selectTab(0); | |||
} | |||
@OnClick({R.id.yijian1,R.id.yijian2,R.id.yijian3,R.id.yijian4}) | |||
@OnClick({R.id.yijian1, R.id.yijian2, R.id.yijian3, R.id.yijian4}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.yijian1: | |||
@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.fragment.mode; | |||
import android.content.Context; | |||
import android.content.DialogInterface; | |||
import android.os.Handler; | |||
import android.os.SystemClock; | |||
import android.util.AttributeSet; | |||
import android.util.Log; | |||
import android.view.LayoutInflater; | |||
@@ -10,6 +11,7 @@ import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.Button; | |||
import android.widget.Chronometer; | |||
import android.widget.EditText; | |||
import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
@@ -21,6 +23,7 @@ import android.widget.TextView; | |||
import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
@@ -36,6 +39,7 @@ import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.adapter.goodpf_apapter; | |||
import com.bonait.bnframework.modules.home.adapter.lsjy_adapter; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.suke.widget.SwitchButton; | |||
@@ -96,6 +100,16 @@ public class add_silos_ck extends LinearLayout { | |||
@BindView(R.id.edittext2) | |||
EditText edittext2; | |||
@BindView(R.id.control_switch) | |||
SwitchButton control_switch;//料仓开关 | |||
@BindView(R.id.runtime) | |||
Chronometer runtime;// | |||
@BindView(R.id.jishiqi) | |||
RelativeLayout jishiqi;// | |||
ArrayList<BPA_MATERIAL> materials = new ArrayList<>(); | |||
List<String> names = new ArrayList<>(); | |||
@@ -104,18 +118,18 @@ public class add_silos_ck extends LinearLayout { | |||
/** | |||
* 点击事件 | |||
*/ | |||
public MyClickListener mListener=null; | |||
public MyClickListener mListener = null; | |||
private View root; | |||
public add_silos_ck(Context context, @Nullable AttributeSet attrs) { | |||
super(context, attrs); | |||
root= LayoutInflater.from(context).inflate(R.layout.dialog_add_silos_ck, this); | |||
root = LayoutInflater.from(context).inflate(R.layout.dialog_add_silos_ck, this); | |||
ButterKnife.bind(this, root); | |||
Init(); | |||
} | |||
public void Init() | |||
{ | |||
public void Init() { | |||
//初始化界面数据 | |||
initData(); | |||
//初始化界面控件的事件 | |||
@@ -123,8 +137,7 @@ public class add_silos_ck extends LinearLayout { | |||
} | |||
private void initData() | |||
{ | |||
private void initData() { | |||
materials.clear(); | |||
List<BPA_MATERIAL> bpa_materials = QueryDB.GetMaterialALL(); | |||
for (BPA_MATERIAL item : bpa_materials) { | |||
@@ -139,26 +152,27 @@ public class add_silos_ck extends LinearLayout { | |||
for (BPA_MATERIAL item : materials) { | |||
names.add(item.name); | |||
} | |||
SetAdapter(editsp_wl,names); | |||
SetAdapter(editsp_wl, names); | |||
} | |||
public void SetAdapter(Spinner spinner,List<String> map) | |||
{ | |||
public void SetAdapter(Spinner spinner, List<String> map) { | |||
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, map); | |||
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
spinner.setAdapter(adapter); | |||
} | |||
boolean ismanguan=false; | |||
private void initEvent() | |||
{ | |||
boolean ismanguan = false; | |||
private void initEvent() { | |||
buchongyuanliao.setOnClickListener(new OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
QueryDB.UpdateYL(lcMode.id,lcMode.siloszl); | |||
lcMode.silosmargin=lcMode.siloszl; | |||
QueryDB.UpdateYL(lcMode.id, lcMode.siloszl); | |||
lcMode.silosmargin = lcMode.siloszl; | |||
SetData(lcMode); | |||
//补充原料 | |||
if (mListener != null) { | |||
mListener.clickListenerNew(view,1,lcMode); | |||
mListener.clickListenerNew(view, 1, lcMode); | |||
} | |||
} | |||
}); | |||
@@ -186,10 +200,10 @@ public class add_silos_ck extends LinearLayout { | |||
item.materialID = material.id; | |||
//更新 | |||
if (QueryDB.UpdateSilosAndMaterial(item)) { | |||
lcMode.materialId=material.id; | |||
lcMode.materialName=material.name; | |||
lcMode.materialId = material.id; | |||
lcMode.materialName = material.name; | |||
if (mListener != null) { | |||
mListener.clickListenerNew(view,5,lcMode); | |||
mListener.clickListenerNew(view, 5, lcMode); | |||
name.setText(material.name); | |||
} | |||
SetData(lcMode); | |||
@@ -204,26 +218,26 @@ public class add_silos_ck extends LinearLayout { | |||
manguan.setOnClickListener(new OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if(ismanguan==false) | |||
{ | |||
ismanguan=true; | |||
if (ismanguan == false) { | |||
ismanguan = true; | |||
StartTime(); | |||
ExecuteTheRecipe.WritePLC("手自切换", false, null); | |||
int time=lcMode.bValue<=0?5:lcMode.bValue;//默认5秒 | |||
ExecuteTheRecipe.WritePLC("手动控制"+lcMode.num,true,null); | |||
int time = lcMode.bValue <= 0 ? 10 : lcMode.bValue;//默认10秒 | |||
ExecuteTheRecipe.WritePLC("手动控制" + lcMode.num, true, null); | |||
new Handler().postDelayed(new Runnable() { | |||
@Override | |||
public void run() { | |||
ExecuteTheRecipe.WritePLC("手动控制"+lcMode.num,false,null); | |||
ExecuteTheRecipe.WritePLC("手动控制" + lcMode.num, false, null); | |||
ToastUtils.info("满管成功!!!"); | |||
ismanguan=false; | |||
ismanguan = false; | |||
StopTime(); | |||
} | |||
}, time * 1000); | |||
//满管 | |||
if (mListener != null) { | |||
mListener.clickListenerNew(view,2,lcMode); | |||
mListener.clickListenerNew(view, 2, lcMode); | |||
} | |||
}else | |||
{ | |||
} else { | |||
ToastUtils.warning("满管中,请稍后!!!"); | |||
} | |||
} | |||
@@ -243,11 +257,11 @@ public class add_silos_ck extends LinearLayout { | |||
final int checkIndex = index; | |||
editsp_wl.setSelection(checkIndex); | |||
edittext1.setText(lcMode.siloszl+""); | |||
edittext2.setText(lcMode.warningValue+""); | |||
edittext1.setText(lcMode.siloszl + ""); | |||
edittext2.setText(lcMode.warningValue + ""); | |||
//设置 | |||
if (mListener != null) { | |||
mListener.clickListenerNew(view,3,lcMode); | |||
mListener.clickListenerNew(view, 3, lcMode); | |||
} | |||
} | |||
@@ -257,41 +271,37 @@ public class add_silos_ck extends LinearLayout { | |||
@Override | |||
public void onClick(View view) { | |||
String type= editsp_wl.getSelectedItem().toString(); | |||
String zl= edittext1.getText().toString(); | |||
if(zl==null || zl.isEmpty()) | |||
{ | |||
String type = editsp_wl.getSelectedItem().toString(); | |||
String zl = edittext1.getText().toString(); | |||
if (zl == null || zl.isEmpty()) { | |||
ToastUtils.warning("料仓容量不能为空!"); | |||
return; | |||
} | |||
String bjz= edittext2.getText().toString(); | |||
if(bjz==null || bjz.isEmpty()) | |||
{ | |||
String bjz = edittext2.getText().toString(); | |||
if (bjz == null || bjz.isEmpty()) { | |||
ToastUtils.warning("报警值不能为空!"); | |||
return; | |||
} | |||
int zl_int=0; | |||
int bj_int=0; | |||
int zl_int = 0; | |||
int bj_int = 0; | |||
try { | |||
zl_int=Integer.parseInt(zl); | |||
bj_int=Integer.parseInt(bjz); | |||
}catch (Exception ex) | |||
{ | |||
zl_int = Integer.parseInt(zl); | |||
bj_int = Integer.parseInt(bjz); | |||
} catch (Exception ex) { | |||
} | |||
if(bj_int>zl_int) | |||
{ | |||
if (bj_int > zl_int) { | |||
ToastUtils.warning("报警值不能大于料仓容量!"); | |||
return; | |||
} | |||
QueryDB.UpdateSilosZL(lcMode.id,zl_int); | |||
QueryDB.UpdateSilosBJZ(lcMode.id,bj_int); | |||
lcMode.siloszl=zl_int; | |||
lcMode.warningValue=bj_int; | |||
QueryDB.UpdateSilosZL(lcMode.id, zl_int); | |||
QueryDB.UpdateSilosBJZ(lcMode.id, bj_int); | |||
lcMode.siloszl = zl_int; | |||
lcMode.warningValue = bj_int; | |||
BPA_SILOSANDMATERIAL item = new BPA_SILOSANDMATERIAL(); | |||
BPA_MATERIAL material = materials.get(editsp_wl.getSelectedItemPosition()); | |||
@@ -299,23 +309,23 @@ public class add_silos_ck extends LinearLayout { | |||
item.materialID = material.id; | |||
//更新 | |||
if (QueryDB.UpdateSilosAndMaterial(item)) { | |||
lcMode.materialId=material.id; | |||
lcMode.materialName=material.name; | |||
lcMode.materialId = material.id; | |||
lcMode.materialName = material.name; | |||
} | |||
SetData(lcMode); | |||
liaochang_sz.setVisibility(View.GONE); | |||
if (mListener != null) { | |||
mListener.clickListenerNew(view,6,lcMode); | |||
mListener.clickListenerNew(view, 6, lcMode); | |||
} | |||
} | |||
}); | |||
jiaozhun.setOnClickListener(new OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
//设置 | |||
//校准 | |||
if (mListener != null) { | |||
mListener.clickListenerNew(view,4,lcMode); | |||
mListener.clickListenerNew(view, 4, lcMode); | |||
} | |||
} | |||
}); | |||
@@ -324,11 +334,10 @@ public class add_silos_ck extends LinearLayout { | |||
public void onClick(View v) { | |||
liaochang_sz.setVisibility(View.GONE); | |||
if (mListener != null) { | |||
mListener.clickListenerNew(v,0,null); | |||
mListener.clickListenerNew(v, 0, null); | |||
} | |||
} | |||
}); | |||
control_switch_shoudong.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
@@ -337,43 +346,48 @@ public class add_silos_ck extends LinearLayout { | |||
ExecuteTheRecipe.WritePLC("手自切换", false, new IWriteCallBack() { | |||
@Override | |||
public void onSuccess() { | |||
ExecuteTheRecipe.WritePLC("手动控制"+lcMode.num,true,null); | |||
ExecuteTheRecipe.WritePLC("手动控制" + lcMode.num, true, null); | |||
} | |||
@Override | |||
public void onFailure(String ErrorMsg) { | |||
} | |||
}); | |||
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) { | |||
Log.e("鼠标", "松开: "); | |||
ExecuteTheRecipe.WritePLC("手动控制"+lcMode.num,false,null); | |||
ExecuteTheRecipe.WritePLC("手动控制" + lcMode.num, false, null); | |||
} | |||
return false; | |||
} | |||
}); | |||
control_switch.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() { | |||
@Override | |||
public void onCheckedChanged(SwitchButton view, boolean isChecked) { | |||
//设置 | |||
lcMode.status=isChecked?0:1; | |||
QueryDB.UpdateSilosStatus(lcMode.id,isChecked); | |||
} | |||
}); | |||
} | |||
lcMode lcMode =null; | |||
public void SetData(lcMode _good) | |||
{ | |||
lcMode=_good; | |||
title.setText("查看料仓-("+lcMode.name+")"); | |||
xuhao.setText(lcMode.num+""); | |||
name.setText(lcMode.materialName.isEmpty()?"未设置":(lcMode.materialName+"")); | |||
if(lcMode.materialName.isEmpty() || lcMode.materialName.equals("未设置")) | |||
{ | |||
wuliaoimage.setImageResource(R.mipmap.newsilos); | |||
lcMode lcMode = null; | |||
public void SetData(lcMode _good) { | |||
lcMode = _good; | |||
control_switch.setChecked(_good.status==0?true:false); | |||
title.setText("查看料仓-(" + lcMode.name + ")"); | |||
xuhao.setText(lcMode.num + ""); | |||
name.setText(lcMode.materialName.isEmpty() ? "未设置" : (lcMode.materialName + "")); | |||
if (lcMode.materialName.isEmpty() || lcMode.materialName.equals("未设置")) { | |||
wuliaoimage.setImageResource(R.mipmap.newsilos); | |||
baifenbi.setText(""); | |||
}else | |||
{ | |||
if(lcMode.warningValue>=lcMode.silosmargin || lcMode.siloszl==0) | |||
{ | |||
wuliaoimage.setImageResource(R.mipmap.newsilos_yc); | |||
}else | |||
{ | |||
} else { | |||
if (lcMode.warningValue >= lcMode.silosmargin || lcMode.siloszl == 0) { | |||
wuliaoimage.setImageResource(R.mipmap.newsilos_yc); | |||
} else { | |||
wuliaoimage.setImageResource(R.mipmap.newsilos); | |||
} | |||
baifenbi.setText(get(lcMode.silosmargin,lcMode.siloszl)); | |||
baifenbi.setText(get(lcMode.silosmargin, lcMode.siloszl)); | |||
} | |||
} | |||
@@ -385,4 +399,26 @@ public class add_silos_ck extends LinearLayout { | |||
return new DecimalFormat("#%").format(value); | |||
} | |||
/** | |||
* 启动定时器 | |||
*/ | |||
public void StartTime() { | |||
jishiqi.setVisibility(View.VISIBLE); | |||
runtime.setBase(SystemClock.elapsedRealtime()); | |||
runtime.start(); | |||
} | |||
/** | |||
* 停止定时器 | |||
*/ | |||
public int StopTime() { | |||
jishiqi.setVisibility(View.GONE); | |||
long elapsedMillis = SystemClock.elapsedRealtime() - runtime.getBase(); | |||
runtime.stop(); | |||
int time=(int) (elapsedMillis / 1000); | |||
return time;//当前点击多少秒 | |||
} | |||
} |
@@ -0,0 +1,156 @@ | |||
package com.bonait.bnframework.modules.home.fragment.mode; | |||
import android.content.Context; | |||
import android.content.DialogInterface; | |||
import android.os.Handler; | |||
import android.util.AttributeSet; | |||
import android.util.Log; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.Button; | |||
import android.widget.EditText; | |||
import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.RelativeLayout; | |||
import android.widget.Spinner; | |||
import android.widget.TextView; | |||
import androidx.annotation.Nullable; | |||
import androidx.fragment.app.FragmentManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.res.lcMode; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.model.mode.ResMenuLeft; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.fragment.from.fragment.JiaoYan_lsjy_fragment; | |||
import com.qmuiteam.qmui.arch.QMUIFragment; | |||
import com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter; | |||
import com.qmuiteam.qmui.widget.QMUIViewPager; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.tab.QMUITabSegment; | |||
import java.math.BigDecimal; | |||
import java.text.DecimalFormat; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
public class silos_jiaoyan extends LinearLayout { | |||
@BindView(R.id.close_from) | |||
Button close_from; | |||
@BindView(R.id.tabs_jiaozhun) | |||
QMUITabSegment tabs_jiaozhun; | |||
@BindView(R.id.title_bc) | |||
TextView title_bc; | |||
@BindView(R.id.viewpager_jiaozhun) | |||
QMUIViewPager viewpager_jiaozhun; | |||
/** | |||
* 当前料仓 | |||
*/ | |||
public lcMode lcMode = null; | |||
/** | |||
* 窗体 | |||
*/ | |||
public FragmentManager fragmentManager; | |||
/** | |||
* 空间 | |||
*/ | |||
public List<ResMenuLeft> froms=new ArrayList<>(); | |||
/** | |||
* 点击事件 | |||
*/ | |||
public MyClickListener mListener=null; | |||
private View root; | |||
public silos_jiaoyan(Context context, @Nullable AttributeSet attrs) { | |||
super(context, attrs); | |||
root= LayoutInflater.from(context).inflate(R.layout.silos_jiaoyan_item, this); | |||
ButterKnife.bind(this, root); | |||
Init(); | |||
} | |||
public void Init() | |||
{ | |||
//初始化界面控件的事件 | |||
initEvent(); | |||
} | |||
/** | |||
* 初始化数据 | |||
*/ | |||
private void initData() | |||
{ | |||
title_bc.setText(lcMode.num+" "+lcMode.materialName); | |||
froms.clear(); | |||
if(lcMode.name.equals("外置仓")) | |||
{ | |||
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"物料校准",0,0,true)); | |||
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"满管校准",0,0,false)); | |||
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"酱料校准",0,0,false)); | |||
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"补偿校准",0,0,false)); | |||
}else | |||
{ | |||
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"物料校准",0,0,true)); | |||
froms.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"满管校准",0,0,false)); | |||
} | |||
QMUIFragmentPagerAdapter adapter = new QMUIFragmentPagerAdapter(fragmentManager) { | |||
@Override | |||
public int getCount() { | |||
return froms.size(); | |||
} | |||
@Override | |||
public QMUIFragment createFragment(int position) { | |||
//显示数元 | |||
return (QMUIFragment) froms.get(position).fragment; | |||
} | |||
@Override | |||
public CharSequence getPageTitle(int position) { | |||
return froms.get(position).name.toString(); | |||
} | |||
}; | |||
viewpager_jiaozhun.setAdapter(adapter); | |||
tabs_jiaozhun.setupWithViewPager(viewpager_jiaozhun, true); | |||
} | |||
private void initEvent() | |||
{ | |||
//关闭窗体 | |||
close_from.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
if (mListener != null) { | |||
mListener.clickListenerNew(v,0,null); | |||
} | |||
} | |||
}); | |||
} | |||
/** | |||
* 设置数据 | |||
* @param | |||
*/ | |||
public void SetData(lcMode _lcMode, FragmentManager _fragmentManager) | |||
{ | |||
this.lcMode=_lcMode; | |||
this.fragmentManager=_fragmentManager; | |||
initData(); | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:color="#7FEF5362" | |||
android:radius="-1dp"> | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<solid android:color="#4592F4" /> | |||
<corners android:radius="6dp" /> | |||
</shape> | |||
</item> | |||
<item android:state_enabled="false"> | |||
<shape> | |||
<solid android:color="#cccccc" /> | |||
<corners android:radius="6dp" /> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<solid android:color="#C6D7ED" /> | |||
<corners android:radius="6dp" /> | |||
</shape> | |||
</item> | |||
</ripple> |
@@ -92,6 +92,11 @@ | |||
android:visibility="gone" | |||
/> | |||
<com.bonait.bnframework.modules.home.fragment.mode.silos_jiaoyan | |||
android:id="@+id/silos_jz" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:visibility="gone"/> | |||
</RelativeLayout> | |||
@@ -28,7 +28,7 @@ | |||
android:layout_alignParentTop="true" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:background="@mipmap/close_image" | |||
android:background="@mipmap/newdelete" | |||
android:textSize="14dp" | |||
android:textColor="@color/white"/> | |||
@@ -97,7 +97,7 @@ | |||
android:id="@+id/wuliaoimage" | |||
android:layout_width="160dp" | |||
android:layout_height="160dp" | |||
android:src="@mipmap/liaochang_by"/> | |||
android:src="@mipmap/newsilos"/> | |||
<TextView | |||
android:id="@+id/wuliaoname" | |||
@@ -142,12 +142,34 @@ | |||
android:layout_width="60dp" | |||
android:layout_height="40dp" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg" | |||
android:text="加料" | |||
android:background="@drawable/silosbuttonbj" | |||
android:text="出料" | |||
android:textColor="@color/white" | |||
android:textSize="18sp"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_marginTop="10dp" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical"> | |||
<TextView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:text="启用/禁用" | |||
android:textAlignment="center" | |||
android:textSize="16dp" | |||
android:textColor="#65DD754B"/> | |||
<com.suke.widget.SwitchButton | |||
app:sb_uncheck_color="@color/app_color_blue" | |||
app:sb_uncheckcircle_color="@color/app_color_blue" | |||
app:sb_button_color="@color/app_color_blue" | |||
android:id="@+id/control_switch" | |||
android:layout_width="80dp" | |||
android:layout_height="wrap_content" | |||
android:focusable="true" | |||
/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_alignParentBottom="true" | |||
android:layout_width="match_parent" | |||
@@ -303,17 +325,19 @@ | |||
android:visibility="gone" | |||
android:layout_centerInParent="true" | |||
android:id="@+id/jishiqi" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:orientation="horizontal"> | |||
android:layout_width="400dp" | |||
android:layout_height="400dp" | |||
android:orientation="horizontal" | |||
android:background="@drawable/common_bg_with_radius_and_border"> | |||
<LinearLayout | |||
android:layout_centerInParent="true" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="用时: " | |||
android:textColor="@color/white" | |||
android:text="满管用时: " | |||
android:textColor="@color/black" | |||
android:textSize="24dp"/> | |||
<Chronometer | |||
android:id="@+id/runtime" | |||
@@ -328,7 +352,7 @@ | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text=" 秒" | |||
android:textColor="@color/white" | |||
android:textColor="@color/black" | |||
android:textSize="24dp"/> | |||
</LinearLayout> | |||
@@ -0,0 +1,98 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:clickable="true" | |||
android:focusable="true" | |||
android:background="@color/black"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_centerInParent="true" | |||
android:layout_margin="10dp" | |||
android:background="@drawable/common_bg_with_radius_and_border"> | |||
<com.qmuiteam.qmui.widget.tab.QMUITabSegment | |||
android:id="@+id/tabs_jiaozhun" | |||
android:layout_width="500dp" | |||
android:layout_height="43dp" | |||
android:layout_marginTop="10dp" | |||
android:background="@drawable/qmui_list_item_bg_with_border_bottom" | |||
android:textSize="14sp" | |||
app:qmui_tab_selected_text_size="16sp" | |||
app:qmui_tab_normal_text_size="14sp" | |||
app:qmui_tab_indicator_height="2dp" | |||
app:qmui_tab_indicator_top="false" | |||
app:qmui_tab_has_indicator="true" | |||
/> | |||
<Button | |||
android:id="@+id/close_from" | |||
android:layout_width="32dp" | |||
android:layout_height="32dp" | |||
android:layout_alignParentTop="true" | |||
android:layout_alignParentRight="true" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:background="@mipmap/newdelete" | |||
android:textColor="@color/white" | |||
android:textSize="14dp" /> | |||
<TextView | |||
android:layout_marginRight="80dp" | |||
android:layout_alignParentRight="true" | |||
android:id="@+id/title_bc" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="30dp" | |||
android:layout_marginTop="15dp" | |||
android:text="11 豆瓣酱" | |||
android:textAlignment="center" | |||
android:textSize="20dp" | |||
android:textColor="@color/app_color_blue"/> | |||
<RelativeLayout | |||
android:layout_marginTop="55dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/viewpager_jiaozhun" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginBottom="10dp"/> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:id="@+id/jishiqi" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:orientation="horizontal" | |||
android:visibility="gone"> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="用时: " | |||
android:textColor="@color/white" | |||
android:textSize="24dp" /> | |||
<Chronometer | |||
android:id="@+id/runtime" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:textColor="@color/purple_primary" | |||
android:textSize="30dp" | |||
android:textStyle="bold|italic" /> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text=" 秒" | |||
android:textColor="@color/white" | |||
android:textSize="24dp" /> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</RelativeLayout> |