@@ -75,7 +75,7 @@ public class LoginActivity extends Activity implements View.OnClickListener { | |||||
throw new RuntimeException(e); | throw new RuntimeException(e); | ||||
} | } | ||||
} else { | } else { | ||||
MessageLog.ShowUserMessage(UserLogEnum.登录日志,user+"-用户密码错误!"); | |||||
MessageLog.ShowUserMessage(UserLogEnum.登录日志,user.name+"-用户密码错误!"); | |||||
T.show(LoginActivity.this, "用户密码错误!"); | T.show(LoginActivity.this, "用户密码错误!"); | ||||
} | } | ||||
} | } | ||||
@@ -121,11 +121,11 @@ public class BusinessServer { | |||||
DeviceData.Get().setDemandValue((short) recipe.value, silos.num, new IWriteCallBack() { | DeviceData.Get().setDemandValue((short) recipe.value, silos.num, new IWriteCallBack() { | ||||
@Override | @Override | ||||
public void onSuccess() { | public void onSuccess() { | ||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,message+"下发成功!"); | |||||
MessageLog.ShowInfo(message+"下发成功!"); | |||||
} | } | ||||
@Override | @Override | ||||
public void onFailure(String ErrorMsg) { | public void onFailure(String ErrorMsg) { | ||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,message+"下发失败!"+ErrorMsg); | |||||
MessageLog.ShowInfo(message+"下发失败!"+ErrorMsg); | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -165,7 +165,133 @@ public class BusinessServer { | |||||
//更新缓存商品制作列表状态 | //更新缓存商品制作列表状态 | ||||
count+=goodsRecipes.size(); | count+=goodsRecipes.size(); | ||||
DataBus.getInstance().UpdateGoodsMake(good.id,"步骤【" + key+ "】:"+RecipesNames+"-配料完成!",count); | DataBus.getInstance().UpdateGoodsMake(good.id,"步骤【" + key+ "】:"+RecipesNames+"-配料完成!",count); | ||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,"["+good.name+"]步骤【" + key + "】执行完成!"); | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,"["+good.name+"]步骤【" + key + "】下发"+RecipesNames+"执行完成!"); | |||||
} | |||||
//endregion | |||||
//5.设置数据中心商品已制作完成 | |||||
DataBus.getInstance().DeleteGoodsMake(GoodId); | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,"["+good.name+"]-订单执行完成,请取餐!"); | |||||
} | |||||
Thread.sleep(1000); | |||||
} | |||||
@Override | |||||
public void RunComplete() throws InterruptedException { | |||||
} | |||||
}); | |||||
} | |||||
public void test() { | |||||
ThreadManager.Get().StartLong("订单执行业务流程-新", true, new IThread() { | |||||
@Override | |||||
public void Run() throws InterruptedException { | |||||
while (Commoditys.size() > 0) { | |||||
//1.取出需要制作的订单商品 验证物料是否充足 | |||||
String GoodId = Commoditys.poll(); | |||||
// boolean IsMake=true; | |||||
// ResultA resultA= DataBus.getInstance().InspectMaterial(GoodId); | |||||
// if(resultA.IsMake==false)//如果商品物料不足 | |||||
// { | |||||
// DataBus.getInstance().UpdateGoodsMake(GoodId,resultA.Message,0); | |||||
// IsMake=false; | |||||
// } | |||||
// while (!IsMake) { | |||||
// IsMake=DataBus.getInstance().InspectMaterial(GoodId).IsMake; | |||||
// Thread.sleep(2000); | |||||
// } | |||||
//2.获取商品的配方信息 | |||||
ArrayList<ResGoodsRecipe> goods = QueryDB.GetGoodsSrecipeList(GoodId); | |||||
BPA_GOODS good= QueryDB.GetGoodsId(GoodId); | |||||
//3.根据物料配方排序Sort步骤分组 | |||||
//region 根据物料配方排序Sort步骤分组 | |||||
LinkedHashMap<Integer, List<ResGoodsRecipe>> rgrs = new LinkedHashMap<>(); | |||||
for (int i = 0; i < goods.size(); i++) { | |||||
if (!rgrs.containsKey(goods.get(i).sort)) | |||||
rgrs.put(goods.get(i).sort, new ArrayList<>()); | |||||
rgrs.get(goods.get(i).sort).add(goods.get(i)); | |||||
} | |||||
//endregion | |||||
//4.根据步骤分组进行物料下发 | |||||
//region 物料下发 | |||||
int count=0; | |||||
for (LinkedHashMap.Entry<Integer, List<ResGoodsRecipe>> entry : rgrs.entrySet()) { | |||||
final Integer key=entry.getKey(); | |||||
//当前一次性下发物料集合 | |||||
List<ResGoodsRecipe> goodsRecipes= entry.getValue(); | |||||
String RecipesNames=""; | |||||
for (ResGoodsRecipe item:goodsRecipes ){RecipesNames+=item.materialName+",";} | |||||
DataBus.getInstance().UpdateGoodsMake(good.id,"步骤【" + key+ "】准备下发物料:"+RecipesNames,count); | |||||
for (int m = 0; m < goodsRecipes.size(); m++) { | |||||
ResGoodsRecipe recipe=goodsRecipes.get(m); | |||||
int materialType = recipe.materialType; | |||||
final String message="["+good.name+"]步骤【" + key+ "】下发【"+recipe.materialName+"】"; | |||||
if(materialType==1)//1.正常物料 | |||||
{ | |||||
//获取物料关联的料仓信息 | |||||
BPA_SILOS silos=null; | |||||
List<BPA_SILOS> siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID); | |||||
for (BPA_SILOS item:siloslist) | |||||
{ | |||||
//临时屏蔽物料量检测 | |||||
// if(DeviceData.Get().getCallCurrentWeight(item.num)>=recipe.value){silos=item;break;} | |||||
silos=item; | |||||
} | |||||
if (silos==null) | |||||
{ | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,message+"下发失败!物料没有管理料仓!"); | |||||
}else | |||||
{ | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,message+"准备下发【" + silos.num + "】号料仓PLC控制命令,需求量:=" + recipe.value); | |||||
// DeviceData.Get().setDemandValue((short) recipe.value, silos.num, new IWriteCallBack() { | |||||
// @Override | |||||
// public void onSuccess() { | |||||
// MessageLog.ShowInfo(message+"下发成功!"); | |||||
// } | |||||
// @Override | |||||
// public void onFailure(String ErrorMsg) { | |||||
// MessageLog.ShowInfo(message+"下发失败!"+ErrorMsg); | |||||
// } | |||||
// }); | |||||
Thread.sleep(1000); | |||||
} | |||||
}else if (materialType == 2)//果糖 | |||||
{ | |||||
// BPA_SUGAR bs = QueryDB.GetsugarId(recipe.materialID); | |||||
// ModbusTcpServer.get().WriteBool(bs.plcvar, true); | |||||
// Thread.sleep(200); | |||||
// ModbusTcpServer.get().WriteBool(bs.plcvar, false); | |||||
// MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,message+"下发成功!"); | |||||
} | |||||
} | |||||
//启动配料 | |||||
// DeviceData.Get().setChargeMixtureStart(new IWriteCallBack() { | |||||
// @Override | |||||
// public void onSuccess() { | |||||
// MessageLog.ShowInfo("["+good.name+"]步骤【" + key+ "】启动配料成功!"); | |||||
// } | |||||
// @Override | |||||
// public void onFailure(String ErrorMsg) { | |||||
// MessageLog.ShowInfo("["+good.name+"]步骤【" + key+ "】启动配料失败!"); | |||||
// } | |||||
// }); | |||||
Thread.sleep(1000); | |||||
//等待配料完成,一直等待 | |||||
// final boolean[] IsComplete = {false}; | |||||
// DeviceData.Get().OnChargeMixtureCompleteNotify = new IRun() { | |||||
// @Override | |||||
// public void Run() { | |||||
// IsComplete[0] = true; | |||||
// MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,"["+good.name+"]步骤【" + key+ "】配料完成!"); | |||||
// } | |||||
// }; | |||||
// while (!IsComplete[0]) { | |||||
// Thread.sleep(100); | |||||
// } | |||||
//更新缓存商品制作列表状态 | |||||
count+=goodsRecipes.size(); | |||||
DataBus.getInstance().UpdateGoodsMake(good.id,"步骤【" + key+ "】:"+RecipesNames+"-配料完成!",count); | |||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志,"["+good.name+"]步骤【" + key + "】下发"+RecipesNames+"执行完成!"); | |||||
} | } | ||||
//endregion | //endregion | ||||
//5.设置数据中心商品已制作完成 | //5.设置数据中心商品已制作完成 | ||||
@@ -43,7 +43,10 @@ public class ICSApp extends Application { | |||||
//5.PLC数据监控 | //5.PLC数据监控 | ||||
ModbusTcpServer.get().Connect(ConfigName.getInstance().Address, ConfigName.getInstance().Post); | ModbusTcpServer.get().Connect(ConfigName.getInstance().Address, ConfigName.getInstance().Post); | ||||
//BusinessServer.Get().Init(); | |||||
//BusinessServer.Get().test(); | |||||
MessageLog.ShowAlertMessage(AlertLogEnum.传感器异常日志,"传感器异常"); | |||||
MessageLog.ShowAlertMessage(AlertLogEnum.异常订单未制作日志,"异常订单未制作日志"); | |||||
MessageLog.ShowAlertMessage(AlertLogEnum.料仓缺料日志,"料仓缺料日志"); | |||||
} | } | ||||
/** | /** | ||||
@@ -22,6 +22,7 @@ import com.example.bpa.db.mode.BPA_SYSTEMSET; | |||||
import com.example.bpa.db.mode.BPA_USER; | import com.example.bpa.db.mode.BPA_USER; | ||||
import com.example.bpa.db.mode.ModeBase; | import com.example.bpa.db.mode.ModeBase; | ||||
import com.example.bpa.helper.Tools; | import com.example.bpa.helper.Tools; | ||||
import com.example.bpa.view.mode.ResAlertLog; | |||||
import com.example.bpa.view.mode.ResGoodsRecipe; | import com.example.bpa.view.mode.ResGoodsRecipe; | ||||
import com.example.bpa.view.mode.ResLog; | import com.example.bpa.view.mode.ResLog; | ||||
import com.example.bpa.view.mode.ResSilosMode; | import com.example.bpa.view.mode.ResSilosMode; | ||||
@@ -939,7 +940,53 @@ public class QueryDB { | |||||
} | } | ||||
return data; | return data; | ||||
} | } | ||||
/** | |||||
* | |||||
* @return | |||||
*/ | |||||
public static ArrayList<ResAlertLog> GetAlertlogs(String sta, String stp, int lx, String text) { | |||||
String orderby = Desc_Time_Down;//先按排序 创建时间倒序 | |||||
String where = "isDelete=? and createTime>=? and createTime<=?"; | |||||
String[] args = new String[]{"0", sta,stp}; | |||||
if(lx!=0) | |||||
{ | |||||
where = "isDelete=? and createTime>=? and createTime<=? and type=?"; | |||||
args = new String[]{"0", sta,stp,String.valueOf(lx)}; | |||||
if(!text.isEmpty()) | |||||
{ | |||||
where = "isDelete=? and createTime>=? and createTime<=? and text like ? and type=?"; | |||||
args = new String[]{"0", sta,stp,"%"+text+"%",String.valueOf(lx)}; | |||||
} | |||||
}else | |||||
{ | |||||
if(!text.isEmpty()) | |||||
{ | |||||
where = "isDelete=? and createTime>=? and createTime<=? and text like ?"; | |||||
args = new String[]{"0", sta,stp,"%"+text+"%"}; | |||||
} | |||||
} | |||||
ArrayList<BPA_USER> Users=GetUserALL(); | |||||
ArrayList<ResAlertLog> data = new ArrayList<>(); | |||||
ArrayList<Object> obj = Get(BPA_ALERTLOG.class, where, args, orderby); | |||||
for (Object k : obj) { | |||||
BPA_ALERTLOG o=(BPA_ALERTLOG) k; | |||||
ResAlertLog log=new ResAlertLog(); | |||||
log.type=o.type; | |||||
log.text=o.text; | |||||
log.id=o.id; | |||||
log.createTime=o.createTime; | |||||
log.updateTime=o.updateTime; | |||||
log.deleteTime=o.deleteTime; | |||||
log.deviceID=o.deviceID; | |||||
log.userID=o.userID; | |||||
log.isDelete=o.isDelete; | |||||
log.exp=o.exp; | |||||
data.add(log); | |||||
} | |||||
return data; | |||||
} | |||||
/** | /** | ||||
* 获取所有今日预警日志 | * 获取所有今日预警日志 | ||||
* | * | ||||
@@ -0,0 +1,93 @@ | |||||
package com.example.bpa.view.adapter; | |||||
import android.app.Activity; | |||||
import android.content.Context; | |||||
import android.content.ContextWrapper; | |||||
import android.view.LayoutInflater; | |||||
import android.view.View; | |||||
import android.view.ViewGroup; | |||||
import android.widget.ArrayAdapter; | |||||
import android.widget.TextView; | |||||
import androidx.annotation.NonNull; | |||||
import androidx.annotation.Nullable; | |||||
import com.example.bpa.R; | |||||
import com.example.bpa.view.mode.ResAlertLog; | |||||
import com.example.bpa.view.mode.ResLog; | |||||
import java.util.List; | |||||
public class yjrz_adapter extends ArrayAdapter<ResAlertLog> { | |||||
private List<ResAlertLog> datas; | |||||
private Context context; | |||||
private int resource; | |||||
public yjrz_adapter(@NonNull Context context, int resource, @NonNull List<ResAlertLog> objects) { | |||||
super(context, resource, objects); | |||||
this.context = context; | |||||
this.resource=resource; | |||||
datas=objects; | |||||
} | |||||
//每个子项被滚动到屏幕内的时候会被调用 | |||||
@NonNull | |||||
@Override | |||||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { | |||||
ResAlertLog log = (ResAlertLog) getItem(position);//得到当前项选中item实例 | |||||
//为每一个子项加载设定的布局 | |||||
View view = LayoutInflater.from(getContext()).inflate(this.resource, parent, false); | |||||
//分别获取 image view 和 textview 的实例 | |||||
TextView name,type,time,message; | |||||
//name = (TextView) view.findViewById(R.id.name); | |||||
type = (TextView) view.findViewById(R.id.type); | |||||
time = (TextView) view.findViewById(R.id.time); | |||||
message = (TextView) view.findViewById(R.id.message); | |||||
//name.setText(log.Name); | |||||
switch (log.type) | |||||
{ | |||||
case 1: | |||||
type.setText("异常订单未制作日志"); | |||||
break; | |||||
case 2: | |||||
type.setText("料仓缺料日志"); | |||||
break; | |||||
case 3: | |||||
type.setText("传感器异常日志"); | |||||
break; | |||||
} | |||||
time.setText(log.createTime); | |||||
message.setText(log.text); | |||||
return view; | |||||
} | |||||
private Activity findActivity(@NonNull Context context) { | |||||
if (context instanceof Activity) { | |||||
return (Activity) context; | |||||
} else if (context instanceof ContextWrapper) { | |||||
return findActivity(((ContextWrapper) context).getBaseContext()); | |||||
} else { | |||||
return null; | |||||
} | |||||
} | |||||
/** | |||||
* 刷新 | |||||
* @param | |||||
*/ | |||||
public void refresh(){ | |||||
Activity activity= findActivity(context); | |||||
if(activity!=null) | |||||
{ | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
notifyDataSetChanged(); | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
} |
@@ -67,15 +67,15 @@ public class SystemCapabilitiesFragment extends Fragment { | |||||
menuModes.clear(); | menuModes.clear(); | ||||
menuModes.add(new MenuMode("物料管理", R.mipmap.wlgl)); | menuModes.add(new MenuMode("物料管理", R.mipmap.wlgl)); | ||||
menuModes.add(new MenuMode("料仓设置", R.mipmap.lcsz)); | |||||
menuModes.add(new MenuMode("饮料配方管理", R.mipmap.yfpf)); | |||||
menuModes.add(new MenuMode("料仓管理", R.mipmap.lcsz)); | |||||
menuModes.add(new MenuMode("电子秤校验", R.mipmap.dzcjy)); | menuModes.add(new MenuMode("电子秤校验", R.mipmap.dzcjy)); | ||||
menuModes.add(new MenuMode("流速校验", R.mipmap.lsjy)); | menuModes.add(new MenuMode("流速校验", R.mipmap.lsjy)); | ||||
menuModes.add(new MenuMode("自动清洗", R.mipmap.zdqx)); | menuModes.add(new MenuMode("自动清洗", R.mipmap.zdqx)); | ||||
menuModes.add(new MenuMode("研发出料", R.mipmap.yfcl)); | |||||
menuModes.add(new MenuMode("订单预警日志", R.mipmap.gjrz)); | |||||
menuModes.add(new MenuMode("员工操作日志", R.mipmap.czrz)); | |||||
//menuModes.add(new MenuMode("研发出料", R.mipmap.yfcl)); | |||||
menuModes.add(new MenuMode("预警日志", R.mipmap.gjrz)); | |||||
menuModes.add(new MenuMode("操作日志", R.mipmap.czrz)); | |||||
menuModes.add(new MenuMode("运行日志", R.mipmap.czrz)); | menuModes.add(new MenuMode("运行日志", R.mipmap.czrz)); | ||||
menuModes.add(new MenuMode("配方研发", R.mipmap.yfpf)); | |||||
MyLayoutManager layout = new MyLayoutManager(); | MyLayoutManager layout = new MyLayoutManager(); | ||||
//必须,防止recyclerview高度为wrap时测量item高度0 | //必须,防止recyclerview高度为wrap时测量item高度0 | ||||
@@ -95,7 +95,7 @@ public class SystemCapabilitiesFragment extends Fragment { | |||||
case "物料管理": | case "物料管理": | ||||
intent = new Intent(view.getContext(), wlgl_activity.class); | intent = new Intent(view.getContext(), wlgl_activity.class); | ||||
break; | break; | ||||
case "料仓设置": | |||||
case "料仓管理": | |||||
intent = new Intent(view.getContext(), lcsz_activity.class); | intent = new Intent(view.getContext(), lcsz_activity.class); | ||||
break; | break; | ||||
case "电子秤校验": | case "电子秤校验": | ||||
@@ -110,16 +110,16 @@ public class SystemCapabilitiesFragment extends Fragment { | |||||
case "研发出料": | case "研发出料": | ||||
intent = new Intent(view.getContext(), yfcl_activity.class); | intent = new Intent(view.getContext(), yfcl_activity.class); | ||||
break; | break; | ||||
case "订单预警日志": | |||||
case "预警日志": | |||||
intent = new Intent(view.getContext(), ddyjrz_activity.class); | intent = new Intent(view.getContext(), ddyjrz_activity.class); | ||||
break; | break; | ||||
case "员工操作日志": | |||||
case "操作日志": | |||||
intent = new Intent(view.getContext(), ygczrz_activity.class); | intent = new Intent(view.getContext(), ygczrz_activity.class); | ||||
break; | break; | ||||
case "运行日志": | case "运行日志": | ||||
intent = new Intent(view.getContext(), RunLog.class); | intent = new Intent(view.getContext(), RunLog.class); | ||||
break; | break; | ||||
case "配方研发": | |||||
case "饮料配方管理": | |||||
default: | default: | ||||
intent = new Intent(view.getContext(), yfpf_activity.class); | intent = new Intent(view.getContext(), yfpf_activity.class); | ||||
break; | break; | ||||
@@ -9,15 +9,36 @@ import androidx.fragment.app.FragmentTransaction; | |||||
import android.app.AlertDialog; | import android.app.AlertDialog; | ||||
import android.content.DialogInterface; | import android.content.DialogInterface; | ||||
import android.content.Intent; | import android.content.Intent; | ||||
import android.graphics.Color; | |||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.view.View; | import android.view.View; | ||||
import android.view.Window; | import android.view.Window; | ||||
import android.view.WindowManager; | import android.view.WindowManager; | ||||
import android.widget.ArrayAdapter; | |||||
import android.widget.Button; | |||||
import android.widget.EditText; | |||||
import android.widget.ImageView; | import android.widget.ImageView; | ||||
import android.widget.ListView; | |||||
import android.widget.Spinner; | |||||
import android.widget.TextView; | import android.widget.TextView; | ||||
import com.bigkoo.pickerview.TimePickerView; | |||||
import com.example.bpa.MainActivity; | import com.example.bpa.MainActivity; | ||||
import com.example.bpa.R; | import com.example.bpa.R; | ||||
import com.example.bpa.db.QueryDB; | |||||
import com.example.bpa.helper.DateUtils; | |||||
import com.example.bpa.helper.T; | |||||
import com.example.bpa.view.adapter.ygcarz_adapter; | |||||
import com.example.bpa.view.adapter.yjrz_adapter; | |||||
import com.example.bpa.view.mode.ResAlertLog; | |||||
import com.example.bpa.view.mode.ResLog; | |||||
import java.text.SimpleDateFormat; | |||||
import java.util.ArrayList; | |||||
import java.util.Calendar; | |||||
import java.util.Date; | |||||
import java.util.LinkedHashMap; | |||||
import java.util.Map; | |||||
/** | /** | ||||
* 订单预警日志 | * 订单预警日志 | ||||
@@ -35,6 +56,42 @@ public class ddyjrz_activity extends AppCompatActivity implements View.OnClickLi | |||||
TextView gongneng_title; | TextView gongneng_title; | ||||
//endregion | //endregion | ||||
//region 操作变量 | |||||
/** | |||||
* 输入框 | |||||
*/ | |||||
TextView edittext; | |||||
/** | |||||
* 查询按钮 | |||||
*/ | |||||
Button button; | |||||
/** | |||||
* 表格显示 | |||||
*/ | |||||
ListView datatab; | |||||
/** | |||||
* 日志数据 | |||||
*/ | |||||
ArrayList<ResAlertLog> bpa_logs = new ArrayList<>(); | |||||
/** | |||||
* 员工操作日志控制器 | |||||
*/ | |||||
com.example.bpa.view.adapter.yjrz_adapter adapter; | |||||
/** | |||||
* 日期选择器 | |||||
*/ | |||||
TimePickerView pvTime; | |||||
/** | |||||
* 开始时间-结束时间 | |||||
*/ | |||||
EditText starttime, stoptime; | |||||
/** | |||||
* 日志类型 | |||||
*/ | |||||
Spinner rzlx; | |||||
Map<String,Integer> lx_map = new LinkedHashMap<>(); | |||||
//endregion | |||||
//region 私有函数 | //region 私有函数 | ||||
@Override | @Override | ||||
protected void onCreate(Bundle savedInstanceState) { | protected void onCreate(Bundle savedInstanceState) { | ||||
@@ -55,17 +112,104 @@ public class ddyjrz_activity extends AppCompatActivity implements View.OnClickLi | |||||
private void Init(){ | private void Init(){ | ||||
gongneng_fanhui = this.findViewById(R.id.gongneng_fanhui); | gongneng_fanhui = this.findViewById(R.id.gongneng_fanhui); | ||||
gongneng_title = this.findViewById(R.id.gongneng_title); | gongneng_title = this.findViewById(R.id.gongneng_title); | ||||
edittext = this.findViewById(R.id.edittext); | |||||
button = this.findViewById(R.id.button); | |||||
datatab = this.findViewById(R.id.datatab); | |||||
starttime = this.findViewById(R.id.starttime); | |||||
stoptime = this.findViewById(R.id.stoptime); | |||||
rzlx = this.findViewById(R.id.rzlx); | |||||
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 | //通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 | ||||
String msg=getIntent().getStringExtra("data"); | |||||
String msg = getIntent().getStringExtra("data"); | |||||
gongneng_title.setText(msg); | gongneng_title.setText(msg); | ||||
((TextView)this.findViewById(R.id.test_view)).setText(msg); | |||||
} | |||||
lx_map.put("全部日志",0); | |||||
lx_map.put("异常订单未制作日志",1); | |||||
lx_map.put("料仓缺料日志",2); | |||||
lx_map.put("传感器异常日志",3); | |||||
ArrayAdapter<String> adapter2 = new ArrayAdapter<>(this, R.layout.spinner_text_item, new ArrayList<>(lx_map.keySet())); | |||||
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||||
rzlx.setAdapter(adapter2); | |||||
starttime.setText(new SimpleDateFormat("yyyy-MM-dd 00:00:00").format(new Date())); | |||||
stoptime.setText(new SimpleDateFormat("yyyy-MM-dd 23:59:59").format(new Date())); | |||||
starttime.setOnClickListener(new View.OnClickListener() { | |||||
@Override | |||||
public void onClick(View view) { | |||||
if (pvTime != null) { | |||||
pvTime.show(starttime); | |||||
} | |||||
} | |||||
}); | |||||
stoptime.setOnClickListener(new View.OnClickListener() { | |||||
@Override | |||||
public void onClick(View view) { | |||||
if (pvTime != null) { | |||||
pvTime.show(stoptime); | |||||
} | |||||
} | |||||
}); | |||||
CalendarTime(); | |||||
Initdata(); | |||||
} | |||||
/** | |||||
* CalendarTime | |||||
* 时间选择器 | |||||
*/ | |||||
public void CalendarTime() { | |||||
//控制时间范围(如果不设置范围,则使用默认时间1900-2100年,此段代码可注释) | |||||
//因为系统Calendar的月份是从0-11的,所以如果是调用Calendar的set方法来设置时间,月份的范围也要是从0-11 | |||||
Calendar selectedDate = Calendar.getInstance(); | |||||
Calendar startDate = Calendar.getInstance(); | |||||
startDate.set(2023, 0, 23); | |||||
Calendar endDate = Calendar.getInstance(); | |||||
endDate.set(2099, 11, 28); | |||||
//时间选择器 | |||||
pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { | |||||
@Override | |||||
public void onTimeSelect(Date date, View v) {//选中事件回调 | |||||
// 这里回调过来的v,就是show()方法里面所添加的 View 参数,如果show的时候没有添加参数,v则为null | |||||
TextView btn = (TextView) v; | |||||
btn.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date)); | |||||
} | |||||
}) | |||||
//年月日时分秒 的显示与否,不设置则默认全部显示 | |||||
.setType(new boolean[]{true, true, true, true, true, false}) | |||||
.setLabel("年", "月", "日", "时", "分", "秒") | |||||
.isCenterLabel(true) | |||||
.setDividerColor(Color.DKGRAY) | |||||
.setContentSize(16)//字号 | |||||
.setDate(selectedDate) | |||||
.setRangDate(startDate, endDate) | |||||
.setDecorView(null) | |||||
.build(); | |||||
} | |||||
/** | /** | ||||
* 初始化按钮事件 | * 初始化按钮事件 | ||||
*/ | */ | ||||
private void initEvents() { | private void initEvents() { | ||||
gongneng_fanhui.setOnClickListener(this); | gongneng_fanhui.setOnClickListener(this); | ||||
button.setOnClickListener(this); | |||||
} | |||||
/** | |||||
* 初始化数据加载 | |||||
*/ | |||||
public void Initdata() { | |||||
try { | |||||
String str= starttime.getText().toString(); | |||||
String stop= stoptime.getText().toString(); | |||||
if(DateUtils.compareDate(stop,str)) | |||||
{ | |||||
T.show(ddyjrz_activity.this,"开始时间不能大于结束时间!!!"); | |||||
return; | |||||
} | |||||
String lx= rzlx.getSelectedItem().toString(); | |||||
String text= edittext.getText().toString(); | |||||
bpa_logs= QueryDB.GetAlertlogs(str,stop, lx_map.get(lx),text); | |||||
adapter = new yjrz_adapter(ddyjrz_activity.this,R.layout.yjrz_item,bpa_logs); | |||||
datatab.setAdapter(adapter); | |||||
} catch (Exception e) { | |||||
} | |||||
} | } | ||||
//endregion | //endregion | ||||
@@ -81,6 +225,9 @@ public class ddyjrz_activity extends AppCompatActivity implements View.OnClickLi | |||||
case R.id.gongneng_fanhui://返回按钮 | case R.id.gongneng_fanhui://返回按钮 | ||||
this.finish(); | this.finish(); | ||||
break; | break; | ||||
case R.id.button://查询按钮 | |||||
Initdata(); | |||||
break; | |||||
} | } | ||||
} | } | ||||
//endregion | //endregion |
@@ -0,0 +1,14 @@ | |||||
package com.example.bpa.view.mode; | |||||
import com.example.bpa.db.mode.BPA_ALERTLOG; | |||||
import com.example.bpa.db.mode.BPA_LOG; | |||||
/** | |||||
* 返回预警Log信息 | |||||
*/ | |||||
public class ResAlertLog extends BPA_ALERTLOG { | |||||
/** | |||||
* 名称 | |||||
*/ | |||||
public String Name; | |||||
} |
@@ -0,0 +1,77 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<RelativeLayout | |||||
xmlns:android="http://schemas.android.com/apk/res/android" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:orientation="horizontal"> | |||||
<TableLayout | |||||
android:background="@mipmap/bgxz" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:gravity="center" | |||||
android:layout_gravity="center" | |||||
android:stretchColumns="0"> | |||||
<TableRow | |||||
android:layout_width="fill_parent" | |||||
android:layout_height="wrap_content" | |||||
android:gravity="center_horizontal"> | |||||
<!-- <RelativeLayout--> | |||||
<!-- android:layout_width="0dp"--> | |||||
<!-- android:layout_height="wrap_content"--> | |||||
<!-- android:layout_weight="1">--> | |||||
<!-- <TextView--> | |||||
<!-- android:id="@+id/name"--> | |||||
<!-- android:layout_width="wrap_content"--> | |||||
<!-- android:layout_height="wrap_content"--> | |||||
<!-- android:layout_marginLeft="20dp"--> | |||||
<!-- android:layout_alignParentLeft="true"--> | |||||
<!-- android:text="员工名称"--> | |||||
<!-- android:textColor="@color/foreground"--> | |||||
<!-- android:textSize="@dimen/textSize" />--> | |||||
<!-- </RelativeLayout>--> | |||||
<RelativeLayout | |||||
android:layout_width="0dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_weight="1"> | |||||
<TextView | |||||
android:id="@+id/type" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="20dp" | |||||
android:layout_alignParentLeft="true" | |||||
android:text="日志类型" | |||||
android:textColor="@color/foreground" | |||||
android:textSize="@dimen/textSize" /> | |||||
</RelativeLayout> | |||||
<RelativeLayout | |||||
android:layout_width="0dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_weight="2"> | |||||
<TextView | |||||
android:id="@+id/time" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="20dp" | |||||
android:layout_alignParentLeft="true" | |||||
android:text="日志时间" | |||||
android:textColor="@color/foreground" | |||||
android:textSize="@dimen/textSize" /> | |||||
</RelativeLayout> | |||||
<RelativeLayout | |||||
android:layout_width="0dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_weight="4"> | |||||
<TextView | |||||
android:id="@+id/message" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="20dp" | |||||
android:layout_alignParentLeft="true" | |||||
android:text="日志描述日志描述" | |||||
android:textColor="@color/foreground" | |||||
android:textSize="@dimen/textSize" /> | |||||
</RelativeLayout> | |||||
</TableRow> | |||||
</TableLayout> | |||||
</RelativeLayout> |
@@ -79,13 +79,195 @@ | |||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="match_parent" | android:layout_height="match_parent" | ||||
android:layout_margin="10dp"> | android:layout_margin="10dp"> | ||||
<TextView | |||||
android:id="@+id/test_view" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:textColor="@color/foreground" | |||||
android:textSize="@dimen/TitleSize"> | |||||
</TextView> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:orientation="vertical"> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="50dp"> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentBottom="true"> | |||||
<EditText | |||||
android:id="@+id/starttime" | |||||
android:layout_width="140dp" | |||||
android:layout_height="wrap_content" | |||||
android:inputType="text" | |||||
android:padding="3dp" | |||||
android:textColor="@color/foreground" | |||||
android:theme="@style/MyEditText1" | |||||
android:background="@drawable/round_corners_bg" | |||||
android:layout_marginLeft="5dp" | |||||
android:maxLines="1" | |||||
android:focusable="false" | |||||
android:text="2023-02-33 00:00:00" | |||||
android:textSize="@dimen/textSize"/> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="5dp" | |||||
android:textColor="@color/foreground" | |||||
android:text="--"> | |||||
</TextView> | |||||
<EditText | |||||
android:id="@+id/stoptime" | |||||
android:layout_width="140dp" | |||||
android:layout_height="wrap_content" | |||||
android:inputType="text" | |||||
android:padding="3dp" | |||||
android:focusable="false" | |||||
android:textColor="@color/foreground" | |||||
android:theme="@style/MyEditText1" | |||||
android:background="@drawable/round_corners_bg" | |||||
android:layout_marginLeft="5dp" | |||||
android:maxLines="1" | |||||
android:text="2023-02-33 00:00:00" | |||||
android:textSize="@dimen/textSize"/> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="5dp" | |||||
android:textColor="@color/foreground" | |||||
android:text="日志类型"> | |||||
</TextView> | |||||
<Spinner | |||||
android:id="@+id/rzlx" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
style="@style/commonSpinnerStyle"/> | |||||
<EditText | |||||
android:id="@+id/edittext" | |||||
android:layout_width="200dp" | |||||
android:layout_height="wrap_content" | |||||
android:inputType="text" | |||||
android:padding="3dp" | |||||
android:textColor="@color/foreground" | |||||
android:theme="@style/MyEditText1" | |||||
android:background="@drawable/round_corners_bg" | |||||
android:layout_marginLeft="5dp" | |||||
android:hint="请输入查询条件" | |||||
android:maxLines="1" | |||||
android:textSize="@dimen/textSize"/> | |||||
<Button | |||||
android:id="@+id/button" | |||||
android:text="查询" | |||||
android:background="@drawable/btn_button" | |||||
android:textSize="@dimen/textSize" | |||||
android:textColor="@color/foreground" | |||||
android:layout_marginLeft="5dp" | |||||
android:layout_gravity="center" | |||||
android:layout_width="60dp" | |||||
android:layout_height="26dp" | |||||
/> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent"> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:layout_marginTop="10dp" | |||||
android:orientation="vertical"> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:background="@mipmap/bgbtbj" | |||||
android:layout_height="26dp"> | |||||
<View | |||||
android:layout_width="match_parent" | |||||
android:layout_height="1dp" | |||||
android:background="#FF03668F" /> | |||||
<View | |||||
android:layout_width="match_parent" | |||||
android:layout_height="1dp" | |||||
android:layout_alignParentBottom="true" | |||||
android:background="#FF03668F" /> | |||||
<TableLayout | |||||
android:layout_centerVertical="true" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:gravity="center" | |||||
android:layout_gravity="center" | |||||
android:stretchColumns="0"> | |||||
<TableRow | |||||
android:layout_width="fill_parent" | |||||
android:layout_height="wrap_content" | |||||
android:gravity="center_horizontal"> | |||||
<!-- <RelativeLayout--> | |||||
<!-- android:layout_width="0dp"--> | |||||
<!-- android:layout_height="wrap_content"--> | |||||
<!-- android:layout_weight="1">--> | |||||
<!-- <TextView--> | |||||
<!-- android:layout_width="wrap_content"--> | |||||
<!-- android:layout_height="wrap_content"--> | |||||
<!-- android:layout_marginLeft="20dp"--> | |||||
<!-- android:layout_alignParentLeft="true"--> | |||||
<!-- android:text="订单名称"--> | |||||
<!-- android:textColor="@color/dataGridColumnHeaderColor"--> | |||||
<!-- android:textSize="@dimen/textSize" />--> | |||||
<!-- </RelativeLayout>--> | |||||
<RelativeLayout | |||||
android:layout_width="0dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_weight="1"> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="20dp" | |||||
android:layout_alignParentLeft="true" | |||||
android:text="日志类型" | |||||
android:textColor="@color/dataGridColumnHeaderColor" | |||||
android:textSize="@dimen/textSize" /> | |||||
</RelativeLayout> | |||||
<RelativeLayout | |||||
android:layout_width="0dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_weight="2"> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="20dp" | |||||
android:layout_alignParentLeft="true" | |||||
android:text="日志时间" | |||||
android:textColor="@color/dataGridColumnHeaderColor" | |||||
android:textSize="@dimen/textSize" /> | |||||
</RelativeLayout> | |||||
<RelativeLayout | |||||
android:layout_width="0dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_weight="4"> | |||||
<TextView | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="20dp" | |||||
android:layout_alignParentLeft="true" | |||||
android:text="日志描述" | |||||
android:textColor="@color/dataGridColumnHeaderColor" | |||||
android:textSize="@dimen/textSize" /> | |||||
</RelativeLayout> | |||||
</TableRow> | |||||
</TableLayout> | |||||
</RelativeLayout> | |||||
<RelativeLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent"> | |||||
<ListView | |||||
android:id="@+id/datatab" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:divider="#00000000" | |||||
android:dividerHeight="3dp" | |||||
android:layout_marginTop="3dp" | |||||
/> | |||||
</RelativeLayout> | |||||
</LinearLayout> | |||||
</RelativeLayout> | |||||
</LinearLayout> | |||||
</RelativeLayout> | </RelativeLayout> | ||||
</RelativeLayout> | </RelativeLayout> | ||||
</LinearLayout> | </LinearLayout> |