@@ -89,7 +89,7 @@ android { | |||
//数据库配置 | |||
greendao { | |||
//指定数据库schema版本号,迁移等操作会用到 | |||
schemaVersion 4 | |||
schemaVersion 5 | |||
//设置生成数据库文件的目录,默认是在build中,可以将生成的文件放到我们的java目录中 | |||
targetGenDir 'src/main/java' | |||
//设置生成的数据库相关文件的包名,默认为entity所在的包名 | |||
@@ -0,0 +1,129 @@ | |||
package com.jdzh.jdzhandroid; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
import android.content.pm.PackageInfo; | |||
import android.content.pm.PackageManager; | |||
import android.content.pm.PackageManager.NameNotFoundException; | |||
import android.os.Build; | |||
import android.os.Environment; | |||
import android.os.Looper; | |||
import android.os.SystemClock; | |||
import android.util.Log; | |||
import android.widget.Toast; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.Log.RecordManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.io.File; | |||
import java.io.FileOutputStream; | |||
import java.io.FilenameFilter; | |||
import java.io.PrintWriter; | |||
import java.io.StringWriter; | |||
import java.io.Writer; | |||
import java.lang.Thread.UncaughtExceptionHandler; | |||
import java.lang.reflect.Field; | |||
import java.text.DateFormat; | |||
import java.text.SimpleDateFormat; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
@SuppressLint("SimpleDateFormat") | |||
public class CrashHandler implements UncaughtExceptionHandler { | |||
public static String TAG = "MyCrash"; | |||
private UncaughtExceptionHandler mDefaultHandler; | |||
private static CrashHandler instance = new CrashHandler(); | |||
private Context mContext; | |||
private Map<String, String> infos = new HashMap<String, String>(); | |||
private DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |||
private CrashHandler() { | |||
} | |||
public static CrashHandler getInstance() { | |||
return instance; | |||
} | |||
public void init(Context context) { | |||
mContext = context; | |||
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); | |||
Thread.setDefaultUncaughtExceptionHandler(this); | |||
} | |||
@Override | |||
public void uncaughtException(Thread thread, Throwable ex) { | |||
if (!handleException(ex) && mDefaultHandler != null) { | |||
mDefaultHandler.uncaughtException(thread, ex); | |||
} else { | |||
SystemClock.sleep(3000); | |||
android.os.Process.killProcess(android.os.Process.myPid()); | |||
System.exit(1); | |||
} | |||
} | |||
private boolean handleException(Throwable ex) { | |||
if (ex == null) | |||
return false; | |||
try { | |||
new Thread() { | |||
@Override | |||
public void run() { | |||
Looper.prepare(); | |||
Toast.makeText(mContext, "大爷我崩溃了.自动修复中!!!", | |||
Toast.LENGTH_LONG).show(); | |||
Looper.loop(); | |||
} | |||
}.start(); | |||
StringWriter sw = new StringWriter(); | |||
PrintWriter pw = new PrintWriter(sw); | |||
ex.printStackTrace(pw); | |||
StringBuilder sb = new StringBuilder(); | |||
@SuppressLint("SimpleDateFormat") SimpleDateFormat sDateFormat = new SimpleDateFormat( | |||
"yyyy-MM-dd HH:mm:ss"); | |||
String date = sDateFormat.format(new Date()); | |||
sb.append("\r\n").append(date).append("\n"); | |||
sb.append("APPLICATION_ID=").append(BuildConfig.APPLICATION_ID).append(" "); | |||
sb.append("BUILD_TYPE=").append(BuildConfig.BUILD_TYPE).append(" "); | |||
sb.append("VERSION_CODE=").append(BuildConfig.VERSION_CODE).append(" "); | |||
sb.append("VERSION_NAME=").append(BuildConfig.VERSION_NAME).append("\n"); | |||
sb.append(sw.toString()); | |||
try{ | |||
// File logFile = new File(Environment.getExternalStorageDirectory(),"/jdzhandroid/crash.log"); | |||
File folder = new File(Environment.getExternalStorageDirectory()+"/jdzhandroid"); | |||
if(!folder.exists())folder.mkdir(); | |||
FileOutputStream writer = new FileOutputStream(Environment.getExternalStorageDirectory()+"/jdzhandroid/crash.log",true); | |||
writer.write(sb.toString().getBytes()); | |||
writer.flush(); | |||
writer.close(); | |||
LogUtils.d("saveCrashLogToFile ///////////// 准备重启"+mContext.getPackageName()); | |||
SystemClock.sleep(3000); | |||
Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(mContext.getPackageName()); | |||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
mContext.startActivity(intent); | |||
LogUtils.d("saveCrashLogToFile ///////////// 重启"); | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
LogUtils.d("saveCrashLogToFile ///////////// "+e.getMessage()); | |||
} | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
return true; | |||
} | |||
} |
@@ -51,9 +51,10 @@ public class MainApplication extends Application { | |||
@Override | |||
public void onCreate() { | |||
super.onCreate(); | |||
Thread.setDefaultUncaughtExceptionHandler((thread,throwable)->{ | |||
saveCrashLogToFile(throwable); | |||
}); | |||
// Thread.setDefaultUncaughtExceptionHandler((thread,throwable)->{ | |||
// saveCrashLogToFile(throwable); | |||
// }); | |||
CrashHandler.getInstance().init(this); | |||
context = getApplicationContext(); | |||
Config.getInstance().app = this; | |||
// GlobalContext.setContext(context); | |||
@@ -143,9 +144,9 @@ public class MainApplication extends Application { | |||
SystemClock.sleep(3000); | |||
Intent intent = Config.getInstance().app.getPackageManager().getLaunchIntentForPackage(Config.getInstance().app.getPackageName()); | |||
Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); | |||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
Config.getInstance().app.startActivity(intent); | |||
context.startActivity(intent); | |||
LogUtils.d("saveCrashLogToFile ///////////// 重启"); | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
@@ -18,6 +18,7 @@ public class BPA_RecipeConfig { | |||
* 配方组合id | |||
*/ | |||
private String attributeId; | |||
private String attributeNames; | |||
@Id | |||
private String id; | |||
@@ -80,14 +81,24 @@ public class BPA_RecipeConfig { | |||
createAt= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
} | |||
@Generated(hash = 1972122316) | |||
public BPA_RecipeConfig(String recipeId, String attributeId, String id, | |||
String createAt, String createBy, String groupId) { | |||
@Generated(hash = 782754591) | |||
public BPA_RecipeConfig(String recipeId, String attributeId, | |||
String attributeNames, String id, String createAt, String createBy, | |||
String groupId) { | |||
this.recipeId = recipeId; | |||
this.attributeId = attributeId; | |||
this.attributeNames = attributeNames; | |||
this.id = id; | |||
this.createAt = createAt; | |||
this.createBy = createBy; | |||
this.groupId = groupId; | |||
} | |||
public String getAttributeNames() { | |||
return attributeNames; | |||
} | |||
public void setAttributeNames(String attributeNames) { | |||
this.attributeNames = attributeNames; | |||
} | |||
} |
@@ -42,15 +42,17 @@ public class BPA_RecipeUseDetail { | |||
private String groupId; | |||
private boolean upLoad;// | |||
public BPA_RecipeUseDetail(){ | |||
id= UUID.randomUUID().toString(); | |||
createAt= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
} | |||
@Generated(hash = 501903891) | |||
@Generated(hash = 1246934803) | |||
public BPA_RecipeUseDetail(String id, String RecipeName, String AttributeName, | |||
String StoreName, String DeviceName, String UseDate, String JsonData, | |||
String createAt, String createBy, String groupId) { | |||
String createAt, String createBy, String groupId, boolean upLoad) { | |||
this.id = id; | |||
this.RecipeName = RecipeName; | |||
this.AttributeName = AttributeName; | |||
@@ -61,6 +63,15 @@ public class BPA_RecipeUseDetail { | |||
this.createAt = createAt; | |||
this.createBy = createBy; | |||
this.groupId = groupId; | |||
this.upLoad = upLoad; | |||
} | |||
public boolean isUpLoad() { | |||
return upLoad; | |||
} | |||
public void setUpLoad(boolean upLoad) { | |||
this.upLoad = upLoad; | |||
} | |||
public String getId() { | |||
@@ -142,4 +153,8 @@ public class BPA_RecipeUseDetail { | |||
public void setGroupId(String groupId) { | |||
this.groupId = groupId; | |||
} | |||
public boolean getUpLoad() { | |||
return this.upLoad; | |||
} | |||
} |
@@ -7,6 +7,7 @@ import org.greenrobot.greendao.query.QueryBuilder; | |||
import org.greenrobot.greendao.query.WhereCondition; | |||
import java.lang.reflect.Method; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -212,7 +213,11 @@ public class SqliteHelper { | |||
public <T> List<T> queryByQueryBuilder(Class<T> entityClass,WhereCondition cond, WhereCondition... condMore) | |||
{ | |||
QueryBuilder<T> queryBuilder = daoSession.queryBuilder(entityClass); | |||
return queryBuilder.where(cond, condMore).list(); | |||
List<T> list = queryBuilder.where(cond, condMore).list(); | |||
if(list==null){ | |||
return new ArrayList<>(); | |||
} | |||
return list; | |||
} | |||
/** | |||
@@ -234,7 +239,11 @@ public class SqliteHelper { | |||
public <T> List<T> queryByBuilder(Class<T> entityClass,WhereCondition cond) | |||
{ | |||
QueryBuilder<T> queryBuilder = daoSession.queryBuilder(entityClass); | |||
return queryBuilder.where(cond).list(); | |||
List<T> list = queryBuilder.where(cond).list(); | |||
if(list==null){ | |||
return new ArrayList<>(); | |||
} | |||
return list; | |||
} | |||
public <T> T queryByBuilderEntity(Class<T> entityClass,WhereCondition cond) | |||
@@ -10,6 +10,7 @@ import androidx.annotation.Nullable; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bigkoo.pickerview.TimePickerView; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeUseDetail; | |||
@@ -21,6 +22,8 @@ import com.jdzh.jdzhandroid.databinding.ActivityRecipeBillingBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import org.greenrobot.greendao.query.QueryBuilder; | |||
import java.text.ParseException; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
@@ -55,7 +58,7 @@ public class RecipeBillingActivity extends ActivityBase { | |||
adapter.setNewData(recipeUseDetails); | |||
binding.recycle.setAdapter(adapter); | |||
binding.starttime.setText( new SimpleDateFormat("yyyy-MM-01 00:00:00").format(new Date())); | |||
binding.endtime.setText(new SimpleDateFormat("yyyy-MM-28 23:59:59").format(new Date())); | |||
binding.endtime.setText(new SimpleDateFormat("yyyy-MM-dd 23:59:59").format(new Date())); | |||
binding.starttime.setOnClickListener(v->{ | |||
if(Config.getInstance().isFastClick()){ | |||
ToastUtil.showInfo("点击过快!"); | |||
@@ -83,6 +86,7 @@ public class RecipeBillingActivity extends ActivityBase { | |||
initData(); | |||
}); | |||
List<BPA_RecipeInfo> recipeInfos = SqliteHelper.get().queryAll(BPA_RecipeInfo.class); | |||
if(!recipeInfos.isEmpty()){ | |||
binding.recipeName1.setText(recipeInfos.get(0).getName()); | |||
} | |||
@@ -100,11 +104,14 @@ public class RecipeBillingActivity extends ActivityBase { | |||
private void initData(){ | |||
recipeUseDetails.clear(); | |||
recipeUseDetails.addAll(SqliteHelper.get().queryByQueryBuilder(BPA_RecipeUseDetail.class, | |||
BPA_RecipeUseDetailDao.Properties.CreateAt.ge(binding.starttime.getText().toString()), | |||
BPA_RecipeUseDetailDao.Properties.CreateAt.le(binding.endtime.getText().toString()), | |||
BPA_RecipeUseDetailDao.Properties.RecipeName.eq(binding.recipeName1.getText()) | |||
)); | |||
List<BPA_RecipeUseDetail> useDetails = SqliteHelper.get().getDaoSession() | |||
.queryBuilder(BPA_RecipeUseDetail.class) | |||
.where(BPA_RecipeUseDetailDao.Properties.CreateAt.ge(binding.starttime.getText().toString())) | |||
.where(BPA_RecipeUseDetailDao.Properties.CreateAt.le(binding.endtime.getText().toString())) | |||
.where(BPA_RecipeUseDetailDao.Properties.RecipeName.eq(binding.recipeName1.getText())) | |||
.orderDesc(BPA_RecipeUseDetailDao.Properties.CreateAt) | |||
.list(); | |||
recipeUseDetails.addAll(useDetails); | |||
LogUtils.d(" recipeUseDetails = "+recipeUseDetails.size()); | |||
adapter.notifyDataSetChanged(); | |||
binding.recycle.scrollToPosition(0); | |||
@@ -61,8 +61,21 @@ public class RecipeManagerActivity extends ActivityBase { | |||
mContext=this; | |||
initData(); | |||
binding.btnGroupAdd.setOnClickListener(view -> { | |||
List<BPA_RecipeGroup> groups = SqliteHelper.get().queryByBuilder(BPA_RecipeGroup.class, | |||
BPA_RecipeGroupDao.Properties.IsWeight.eq(Config.getInstance().isWeight)); | |||
List<String> nameList = new ArrayList<>(); | |||
for(BPA_RecipeGroup bean:groups){ | |||
nameList.add(bean.getName()); | |||
} | |||
String name = "未命名1"; | |||
for(int i=1;i<=nameList.size()+2;i++){ | |||
if(nameList.contains("未命名"+i)){ | |||
name = "未命名"+(i+1); | |||
} | |||
} | |||
BPA_RecipeGroup recipeGroup = new BPA_RecipeGroup(); | |||
recipeGroup.setName("未命名"); | |||
recipeGroup.setName(name); | |||
recipeGroup.setSort(recipeGroups.size()+1); | |||
recipeGroup.setIsWeight(Config.getInstance().isWeight); | |||
@@ -16,9 +16,12 @@ import androidx.recyclerview.widget.RecyclerView; | |||
import com.daimajia.swipe.SwipeLayout; | |||
import com.jdzh.jdzhandroid.R; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeGroupDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeGroup; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.util.RecipeEditUtil; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.util.List; | |||
@@ -90,6 +93,13 @@ public class RecipeGroupEditAdapter extends RecyclerView.Adapter<RecipeGroupEdit | |||
holder.ll_group_edit.setVisibility(View.VISIBLE); | |||
}); | |||
holder.btn_group_ok.setOnClickListener(view -> { | |||
if(!SqliteHelper.get().queryByQueryBuilder(BPA_RecipeGroup.class, | |||
BPA_RecipeGroupDao.Properties.IsWeight.eq(Config.getInstance().isWeight), | |||
BPA_RecipeGroupDao.Properties.Name.eq(holder.et_group_name.getText().toString()) | |||
).isEmpty()){ | |||
ToastUtil.showWarn("已存在分组名,请换一个名称!"); | |||
return; | |||
} | |||
holder.swipeLayout.close(); | |||
holder.ll_group_edit.setVisibility(View.GONE); | |||
mDatas.get(position).setName(holder.et_group_name.getText().toString()); | |||
@@ -17,7 +17,9 @@ import com.jdzh.jdzhandroid.Enum.SiloChannel; | |||
import com.jdzh.jdzhandroid.Log.MessageLog; | |||
import com.jdzh.jdzhandroid.R; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_BatchingDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeConfigDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeConfigDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.BaseAdapter; | |||
import com.jdzh.jdzhandroid.databinding.ItemMaterialBinding; | |||
@@ -55,8 +57,13 @@ public class MaterialAdapter extends BaseAdapter<BPA_Batching,MaterialAdapter.Ma | |||
if(mData!=null){ | |||
DialogManager.showInfo("是否删除 "+mData.get(position).getName()+" 物料", DialogButton.YesNo,s->{ | |||
if(s){ | |||
mData.remove(position); | |||
if(!SqliteHelper.get().queryByBuilder(BPA_RecipeConfigDetail.class, | |||
BPA_RecipeConfigDetailDao.Properties.BatchingId.eq(mData.get(position).getId())).isEmpty()){ | |||
ToastUtil.showWarn("有配方正在使用该物料,无法删除!"); | |||
return; | |||
} | |||
SqliteHelper.get().delete(mData.get(position)); | |||
mData.remove(position); | |||
notifyDataSetChanged(); | |||
ToastUtil.showInfo("删除物料信息成功!"); | |||
} | |||
@@ -84,8 +91,9 @@ public class MaterialAdapter extends BaseAdapter<BPA_Batching,MaterialAdapter.Ma | |||
WhereCondition wc2=BPA_BatchingDao.Properties.SiloChannelNum.eq(s.Content.getSiloChannelNum()); | |||
BPA_Batching batchingWC2= SqliteHelper.get().queryByBuilderEntity(BPA_Batching.class,wc2); | |||
if(!mData.get(position).getSiloChannelNum().equals(s.Content.getSiloChannelNum())){ | |||
if(batchingWC2==null){ | |||
if(batchingWC2==null || s.Content.getSiloChannelNum().equals("未设置")){ | |||
mData.get(position).setSiloChannelNum(s.Content.getSiloChannelNum()); | |||
SqliteHelper.get().update(mData.get(position)); | |||
notifyDataSetChanged(); | |||
@@ -17,6 +17,7 @@ import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeBaseConfigDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeConfigDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeConfigDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeGroupDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeattributeDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeBaseConfig; | |||
@@ -32,6 +33,7 @@ import com.jdzh.jdzhandroid.UI.adapter.attribute.AttributeGroupTabAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.edit.RecipeAttribute2Adapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeDetailValueAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.attribute.RecipeAttributeAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeEditBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -114,6 +116,18 @@ public class RecipeEditDialog extends Dialog { | |||
ToastUtil.showWarn("基准克数不能小于100!"); | |||
return; | |||
} | |||
String name = binding.etRecipeName.getText().toString(); | |||
List<BPA_RecipeGroup> groups = SqliteHelper.get().queryByBuilder(BPA_RecipeGroup.class, | |||
BPA_RecipeGroupDao.Properties.IsWeight.eq(Config.getInstance().isWeight)); | |||
for(BPA_RecipeGroup bean:groups){ | |||
if(!SqliteHelper.get().queryByQueryBuilder(BPA_RecipeInfo.class, | |||
BPA_RecipeInfoDao.Properties.RecipeGroupId.eq(bean.getId()), | |||
BPA_RecipeInfoDao.Properties.Name.eq(name)).isEmpty() | |||
){ | |||
ToastUtil.showWarn("已存在配方名,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
recipeInfo.setName(binding.etRecipeName.getText().toString()); | |||
recipeInfo.setReferenceWeight(Float.parseFloat(binding.etWeight.getText().toString())); | |||
SqliteHelper.get().update(recipeInfo); | |||
@@ -147,11 +161,14 @@ public class RecipeEditDialog extends Dialog { | |||
ToastUtil.showInfo("请先选择属性组合"); | |||
}else if(selectPos == -1){ | |||
StringBuilder ids = new StringBuilder(); | |||
StringBuilder names = new StringBuilder(); | |||
for(BPA_RecipeattributeValue recipeattributeValue:recipeAttributeAdapter.getSelectedValues()){ | |||
ids.append(recipeattributeValue.getId()).append(","); | |||
names.append(recipeattributeValue.getName()).append("-"); | |||
} | |||
BPA_RecipeConfig config = new BPA_RecipeConfig(); | |||
config.setAttributeId(ids.substring(0,ids.length()-1)); | |||
config.setAttributeNames(names.substring(0,names.length()-1)); | |||
config.setRecipeId(recipeInfo.getId()); | |||
SqliteHelper.get().insert(config); | |||
recipeConfigs.add(config); | |||
@@ -20,6 +20,8 @@ import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.api.IHttpCallBack; | |||
import com.jdzh.jdzhandroid.api.ServerManager; | |||
import com.jdzh.jdzhandroid.databinding.FragmentParSetBinding; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -82,7 +84,9 @@ public class ParSetFragment extends Fragment { | |||
} | |||
@Override | |||
public void onError(int failCode) { | |||
public void onError(int failCode,String msg) { | |||
DialogManager.showWarn("上传物料失败:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
@@ -102,7 +106,9 @@ public class ParSetFragment extends Fragment { | |||
} | |||
@Override | |||
public void onError(int failCode) { | |||
public void onError(int failCode,String msg) { | |||
DialogManager.showWarn("上传配方分组失败:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
@@ -116,7 +122,6 @@ public class ParSetFragment extends Fragment { | |||
private void uploadRecipeInfo(int position){ | |||
List<BPA_RecipeGroup> list = SqliteHelper.get().queryAll(BPA_RecipeGroup.class); | |||
if(position>=list.size()){ | |||
ToastUtil.showInfo("上传配方信息成功"); | |||
uploadRecipeAttr(); | |||
}else { | |||
ServerManager.uploadRecipeInfo(getContext(),list.get(position), new IHttpCallBack<Object>() { | |||
@@ -127,7 +132,9 @@ public class ParSetFragment extends Fragment { | |||
} | |||
@Override | |||
public void onError(int failCode) { | |||
public void onError(int failCode,String msg) { | |||
DialogManager.showWarn("上传分组["+list.get(position).getName()+"]下的配方信息失败:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
@@ -149,7 +156,9 @@ public class ParSetFragment extends Fragment { | |||
} | |||
@Override | |||
public void onError(int failCode) { | |||
public void onError(int failCode,String msg) { | |||
DialogManager.showWarn("上传多属性失败:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
@@ -170,7 +179,9 @@ public class ParSetFragment extends Fragment { | |||
} | |||
@Override | |||
public void onError(int failCode) { | |||
public void onError(int failCode,String msg) { | |||
DialogManager.showWarn("上传配方物料失败:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
@@ -12,6 +12,10 @@ import androidx.annotation.Nullable; | |||
import androidx.fragment.app.Fragment; | |||
import com.jdzh.jdzhandroid.Enum.DialogButton; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.Task.TaskManager; | |||
import com.jdzh.jdzhandroid.UI.activity.BatchingRecordActivity; | |||
import com.jdzh.jdzhandroid.UI.activity.RecipeBillingActivity; | |||
import com.jdzh.jdzhandroid.UI.activity.RecipeRecordActivity; | |||
@@ -19,8 +23,6 @@ import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.api.IHttpCallBack; | |||
import com.jdzh.jdzhandroid.api.ServerManager; | |||
import com.jdzh.jdzhandroid.databinding.FragmentRecordBinding; | |||
import com.jdzh.jdzhandroid.databinding.FragmentSystemSetBinding; | |||
import com.jdzh.jdzhandroid.model.ResponseData; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -77,10 +79,23 @@ public class RecordFragment extends Fragment { | |||
public void onSuccess(Object responseData) { | |||
ToastUtil.showInfo("上传配方使用记录成功"); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
List<BPA_RecipeUseDetail> useDetails = SqliteHelper.get().queryByQueryBuilder(BPA_RecipeUseDetail.class, | |||
BPA_RecipeUseDetailDao.Properties.UpLoad.eq(false)); | |||
for(BPA_RecipeUseDetail bean:useDetails){ | |||
bean.setUpLoad(true); | |||
} | |||
TaskManager.get().execute(new Runnable() { | |||
@Override | |||
public void run() { | |||
SqliteHelper.get().insertMulti(useDetails); | |||
} | |||
}); | |||
} | |||
@Override | |||
public void onError(int failCode) { | |||
public void onError(int failCode,String msg) { | |||
DialogManager.showWarn("上传配方使用记录失败:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
@@ -104,7 +119,9 @@ public class RecordFragment extends Fragment { | |||
} | |||
@Override | |||
public void onError(int failCode) { | |||
public void onError(int failCode,String msg) { | |||
DialogManager.showWarn("上传文件失败:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
@@ -31,7 +31,9 @@ public class WaitProcessUtil { | |||
} | |||
MainApplication.handler.post(() -> { | |||
if(progressDialog!=null){ | |||
progressDialog.dismiss(); | |||
// progressDialog.dismiss(); | |||
progressDialog.setTitleAndMessage(title,message,hasClose); | |||
return; | |||
} | |||
progressDialog = new WaiteProgressDialog(context); | |||
progressDialog.setTitleAndMessage(title,message,hasClose); | |||
@@ -2,8 +2,10 @@ package com.jdzh.jdzhandroid.UI.view; | |||
import android.app.ProgressDialog; | |||
import android.content.Context; | |||
import android.os.Build; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import com.jdzh.jdzhandroid.databinding.DialogProgressWaiteBinding; | |||
@@ -25,12 +27,40 @@ public class WaiteProgressDialog extends ProgressDialog { | |||
super(context); | |||
} | |||
@Override | |||
public void onStart() { | |||
super.onStart(); | |||
Window window = getWindow(); | |||
assert window != null; | |||
fullScreen(window); | |||
} | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
initView(); | |||
} | |||
private void fullScreen(Window window){ | |||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { | |||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |||
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。 | |||
// 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果 | |||
window.getDecorView().setSystemUiVisibility( | |||
View.SYSTEM_UI_FLAG_LOW_PROFILE | |||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |||
| View.SYSTEM_UI_FLAG_FULLSCREEN | |||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | |||
} else { | |||
// 全屏显示,隐藏状态栏 | |||
window.getDecorView().setSystemUiVisibility(View.INVISIBLE); | |||
} | |||
} | |||
} | |||
private void initView(){ | |||
setCancelable(false); | |||
setCanceledOnTouchOutside(false); | |||
@@ -2,26 +2,15 @@ package com.jdzh.jdzhandroid.api; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeBathingUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeGroup; | |||
import com.jdzh.jdzhandroid.model.ResResult; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.ResponseData; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import java.io.File; | |||
import java.util.ArrayList; | |||
import okhttp3.MultipartBody; | |||
import okhttp3.RequestBody; | |||
import retrofit2.Call; | |||
import retrofit2.http.Body; | |||
import retrofit2.http.Field; | |||
import retrofit2.http.FormUrlEncoded; | |||
import retrofit2.http.Headers; | |||
import retrofit2.http.Multipart; | |||
import retrofit2.http.POST; | |||
import retrofit2.http.Part; | |||
import retrofit2.http.Query; | |||
import retrofit2.http.Url; | |||
/** | |||
@@ -32,13 +21,13 @@ public interface Api { | |||
* 获取物料 | |||
*/ | |||
@POST | |||
Call<ResResult<ArrayList<BPA_Batching>>> getBatching(@Url String url); | |||
Call<ResUpload<ArrayList<BPA_Batching>>> getBatching(@Url String url); | |||
/** | |||
* 上传物料 | |||
*/ | |||
@POST | |||
Call<ResResult<ResponseData>> uploadBatching(@Url String url, | |||
Call<ResUpload<UploadTData>> uploadBatching(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
@@ -46,44 +35,44 @@ public interface Api { | |||
* isWeight 分组模式(true:称重模式 false:标准模式) | |||
*/ | |||
@POST | |||
Call<ResResult<ResponseData>> uploadRecipeGroup(@Url String url, | |||
@Body RequestBody body); | |||
Call<ResUpload<UploadTData>> uploadRecipeGroup(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传配方信息 | |||
*/ | |||
@POST | |||
Call<ResResult<ResponseData>> uploadRecipeInfo(@Url String url, | |||
@Body RequestBody body); | |||
Call<ResUpload<UploadTData>> uploadRecipeInfo(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传配方属性 | |||
*/ | |||
@POST | |||
Call<ResResult<ResponseData>> uploadRecipeAttr(@Url String url, | |||
@Body RequestBody body); | |||
Call<ResUpload<UploadTData>> uploadRecipeAttr(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传配方物料详情 | |||
*/ | |||
@POST | |||
Call<ResResult<ResponseData>> uploadRecipeBatching(@Url String url, | |||
@Body RequestBody body); | |||
Call<ResUpload<UploadTData>> uploadRecipeBatching(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传配方使用详情 | |||
*/ | |||
@POST | |||
Call<ResResult<ResponseData>> uploadRecipeUseDetail(@Url String url, | |||
@Body RequestBody body); | |||
Call<ResUpload<UploadTData>> uploadRecipeUseDetail(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传上传设备日志文件 | |||
*/ | |||
@POST | |||
Call<ResResult<ResponseData>> uploadDeviceLog(@Url String url, | |||
@Body RequestBody body | |||
Call<ResUpload<UploadTData>> uploadDeviceLog(@Url String url, | |||
@Body RequestBody body | |||
// @Part MultipartBody.Part file | |||
); | |||
@@ -2,19 +2,20 @@ package com.jdzh.jdzhandroid.api; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.model.ResResult; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.net.SocketTimeoutException; | |||
import java.util.List; | |||
import retrofit2.Call; | |||
import retrofit2.Callback; | |||
import retrofit2.Response; | |||
/** | |||
* @author Nov | |||
* @date 19.11.25 | |||
*/ | |||
public class BaseResponse implements Callback<ResResult> { | |||
public class BaseUpResponse implements Callback<ResUpload> { | |||
/** | |||
* 回调 | |||
@@ -22,38 +23,47 @@ public class BaseResponse implements Callback<ResResult> { | |||
private IHttpCallBack callback; | |||
public BaseResponse(IHttpCallBack callback) { | |||
public BaseUpResponse(IHttpCallBack callback) { | |||
this.callback = callback; | |||
} | |||
@Override | |||
public void onResponse(Call<ResResult> call, Response<ResResult> response) { | |||
ResResult data = response.body(); | |||
public void onResponse(Call<ResUpload> call, Response<ResUpload> response) { | |||
ResUpload body = response.body(); | |||
if (null == response) { | |||
callError("response=null", Constant.APP_DATA_ERROR, "response =null"); | |||
return; | |||
} | |||
if (null == data) { | |||
if (null == body) { | |||
callError("body=null", Constant.APP_DATA_ERROR, response.message()); | |||
return; | |||
} | |||
if (data.getStatusCode() != Constant.CMS_STATUS_OK) { | |||
callError("code!=200", data.getStatusCode(), data.getErrors()); | |||
if (body.getStatusCode() != Constant.CMS_STATUS_OK) { | |||
callError("code!=200", body.getStatusCode(), body.getErrors()); | |||
return; | |||
} | |||
Object t = data.getData(); | |||
// if (null == t) { | |||
// LogUtil.d("CmsResponse---> onResponse : 4"); | |||
// callError("data=null", Constant.APP_DATA_NULL, data.getMessage()); | |||
// return; | |||
// } | |||
callSuccess(t); | |||
List<UploadTData> data = body.getData(); | |||
StringBuilder desc = new StringBuilder(); | |||
if(data!=null && !data.isEmpty()){ | |||
for(UploadTData bean:data){ | |||
if(bean.code!=30000){ | |||
desc.append("{").append(bean.getCode()).append(bean.getMessage()).append("[").append(bean.getName()).append("]}"); | |||
} | |||
} | |||
if(desc.length()>0){ | |||
callError("",body.statusCode,desc.toString()); | |||
return; | |||
} | |||
} | |||
callSuccess( body.getData()); | |||
} | |||
@Override | |||
public void onFailure(Call<ResResult> call, Throwable t) { | |||
public void onFailure(Call<ResUpload> call, Throwable t) { | |||
LogUtils.d("接口出错....."+t.getMessage() + " "+call.request().url()); | |||
callFail(Constant.APP_NET_ERROR, t); | |||
@@ -66,6 +76,7 @@ public class BaseResponse implements Callback<ResResult> { | |||
* @param e | |||
*/ | |||
private void callFail(final int code, final Throwable e) { | |||
if (null == callback) { | |||
return; | |||
} | |||
@@ -90,7 +101,7 @@ public class BaseResponse implements Callback<ResResult> { | |||
return; | |||
} | |||
//LogUtils.d("请求数据处理错误....."); | |||
callback.onError(code); | |||
callback.onError(code,msg); | |||
reportErrorInfo(code + "", msg); | |||
} | |||
@@ -78,7 +78,7 @@ public class CommonResponse<T> implements Callback<T> { | |||
return; | |||
} | |||
LogUtils.d("请求数据处理错误....."); | |||
callback.onError(code); | |||
callback.onError(code,msg); | |||
reportErrorInfo(code + "", msg); | |||
} | |||
@@ -17,7 +17,7 @@ public interface IHttpCallBack<T> { | |||
* | |||
* @param failCode 失败原因Code 非法请求:ServerUtil.CODE_FAIL_ILLEGAL;其它失败:ServerUtil.CODE_FAIL; 等 | |||
*/ | |||
public void onError(int failCode); | |||
public void onError(int failCode,String msg); | |||
/** | |||
* Http请求失败 | |||
@@ -7,6 +7,7 @@ import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeBathingUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeConfigDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeConfigDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeattributeDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeattributeValueDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
@@ -23,6 +24,8 @@ import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.api.net.HttpUtil; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import com.jdzh.jdzhandroid.model.upload.BatchBean; | |||
import com.jdzh.jdzhandroid.model.upload.RecipeAttributeBean; | |||
import com.jdzh.jdzhandroid.model.upload.RecipeBatchBean; | |||
@@ -36,10 +39,7 @@ import java.io.File; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.prefs.BackingStoreException; | |||
import okhttp3.MediaType; | |||
import okhttp3.MultipartBody; | |||
@@ -56,7 +56,7 @@ public class ServerManager { | |||
public static void getBatching(IHttpCallBack<ArrayList<BPA_Batching>> callback) { | |||
String url = mainUrl + "/api/interface/getBatching"; | |||
Call call = HttpUtil.getService(Api.class).getBatching(url); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -79,7 +79,7 @@ public class ServerManager { | |||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
GsonUtil.object2JsonStr(dataList)); | |||
Call call = HttpUtil.getService(Api.class).uploadBatching(url,body); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -100,7 +100,7 @@ public class ServerManager { | |||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
GsonUtil.object2JsonStr(dataList)); | |||
Call call = HttpUtil.getService(Api.class).uploadRecipeGroup(url,body); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -115,13 +115,13 @@ public class ServerManager { | |||
recipeInfoBean.setRecipeGroupName(recipeGroup.getName()); | |||
recipeInfoBean.setWeight(recipeGroup.getIsWeight()); | |||
recipeInfoBean.setStoreId(PreferenceUtils.getString(Config.SHARE_KEY_storeId,"")); | |||
recipeInfoBean.setStoreName(PreferenceUtils.getString(Config.SHARE_KEY_storeId,"")); | |||
recipeInfoBean.setStoreName(PreferenceUtils.getString(Config.SHARE_KEY_storeName,"")); | |||
recipeInfoBean.setDeviceId(PreferenceUtils.getString(Config.SHARE_KEY_deviceId,"")); | |||
recipeInfoBean.setDeviceName(PreferenceUtils.getString(Config.SHARE_KEY_deviceName,"")); | |||
List<RecipeInfoBean.RecipeInfoListBean> listBean = new ArrayList<>(); | |||
for(BPA_RecipeInfo bean:SqliteHelper.get().queryByBuilder(BPA_RecipeInfo.class, | |||
BPA_RecipeInfoDao.Properties.RecipeGroupId.eq(recipeGroup.getGroupId()))){ | |||
BPA_RecipeInfoDao.Properties.RecipeGroupId.eq(recipeGroup.getId()))){ | |||
RecipeInfoBean.RecipeInfoListBean infoBean = new RecipeInfoBean.RecipeInfoListBean(); | |||
infoBean.setId(bean.getId()); | |||
infoBean.setName(bean.getName()); | |||
@@ -133,7 +133,7 @@ public class ServerManager { | |||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
GsonUtil.object2JsonStr(recipeInfoBean)); | |||
Call call = HttpUtil.getService(Api.class).uploadRecipeInfo(url,body); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -176,7 +176,7 @@ public class ServerManager { | |||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
GsonUtil.object2JsonStr(recipeAttributeList)); | |||
Call call = HttpUtil.getService(Api.class).uploadRecipeAttr(url,body); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -187,7 +187,8 @@ public class ServerManager { | |||
String url = mainUrl + "/api/interface/uploadRecipeBatching"; | |||
List<RecipeBatchBean> recipeBatchBeans = new ArrayList<>(); | |||
for(BPA_RecipeInfo bean:SqliteHelper.get().queryAll(BPA_RecipeInfo.class)){ | |||
for(BPA_RecipeInfo bean:SqliteHelper.get().queryByQueryBuilder(BPA_RecipeInfo.class, | |||
BPA_RecipeInfoDao.Properties.Name.notEq(""))){ | |||
RecipeBatchBean recipeBatchBean = new RecipeBatchBean(); | |||
recipeBatchBean.setRecipeId(bean.getId()); | |||
recipeBatchBean.setRecipeName(bean.getName()); | |||
@@ -198,7 +199,7 @@ public class ServerManager { | |||
RecipeBatchBean.ConfigListBean configListBean = new RecipeBatchBean.ConfigListBean(); | |||
configListBean.setId(config.getId()); | |||
configListBean.setAttributeId(config.getAttributeId()); | |||
configListBean.setAttributeName(""); | |||
configListBean.setAttributeName(config.getAttributeNames()); | |||
List<RecipeBatchBean.ConfigListBean.BatchingListBean> batchingListBeans = new ArrayList<>(); | |||
for(BPA_RecipeConfigDetail configDetail:SqliteHelper.get().queryByBuilder(BPA_RecipeConfigDetail.class, | |||
@@ -218,9 +219,9 @@ public class ServerManager { | |||
BPA_RecipeBaseConfigDao.Properties.RecipeId.eq(bean.getId())); | |||
if(recipeBaseConfig!=null){ | |||
RecipeBatchBean.ConfigListBean configListBean = new RecipeBatchBean.ConfigListBean(); | |||
configListBean.setId(configListBean.getId()); | |||
configListBean.setId(recipeBaseConfig.getId()); | |||
configListBean.setAttributeId(""); | |||
configListBean.setAttributeName(""); | |||
configListBean.setAttributeName("基础配方"); | |||
List<RecipeBatchBean.ConfigListBean.BatchingListBean> batchingListBeans = new ArrayList<>(); | |||
for(BPA_RecipeConfigDetail configDetail:SqliteHelper.get().queryByBuilder(BPA_RecipeConfigDetail.class, | |||
BPA_RecipeConfigDetailDao.Properties.ConfigId.eq(recipeBaseConfig.getId()))){ | |||
@@ -241,7 +242,7 @@ public class ServerManager { | |||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
GsonUtil.object2JsonStr(recipeBatchBeans)); | |||
Call call = HttpUtil.getService(Api.class).uploadRecipeBatching(url,body); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -252,7 +253,8 @@ public class ServerManager { | |||
String url = mainUrl + "/api/interface/uploadRecipeUseDetail"; | |||
List<RecipeUseDetailBean> recipeUseDetailBeans = new ArrayList<>(); | |||
for(BPA_RecipeUseDetail bean:SqliteHelper.get().queryAll(BPA_RecipeUseDetail.class)){ | |||
for(BPA_RecipeUseDetail bean:SqliteHelper.get().queryByQueryBuilder(BPA_RecipeUseDetail.class, | |||
BPA_RecipeUseDetailDao.Properties.UpLoad.eq(false))){ | |||
RecipeUseDetailBean recipeUseDetailBean = new RecipeUseDetailBean(); | |||
recipeUseDetailBean.setRecipeName(bean.getRecipeName()); | |||
recipeUseDetailBean.setAttributeName(bean.getAttributeName()); | |||
@@ -275,7 +277,7 @@ public class ServerManager { | |||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
GsonUtil.object2JsonStr(recipeUseDetailBeans)); | |||
Call call = HttpUtil.getService(Api.class).uploadRecipeUseDetail(url,body); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -292,15 +294,15 @@ public class ServerManager { | |||
.build(); | |||
Call call = HttpUtil.getService(Api.class).uploadDeviceLog(url,body); | |||
resEnqueue(call, callback); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
* @param call | |||
* @param callBack | |||
*/ | |||
private static void resEnqueue(Call call, IHttpCallBack callBack) { | |||
BaseResponse response = new BaseResponse(callBack); | |||
private static void resUpEnqueue(Call call, IHttpCallBack callBack) { | |||
BaseUpResponse response = new BaseUpResponse(callBack); | |||
call.enqueue(response); | |||
} | |||
@@ -49,9 +49,9 @@ public class Config { | |||
public static void Test(){ | |||
PreferenceUtils.setString(Config.SHARE_KEY_autoKey,"1"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_storeName,"门店1"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_storeId,"1"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_storeId,"930f754e-31c0-4aa7-af77-9d860f58a816"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_deviceName,"设备1"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_deviceId,"1"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_deviceId,"006ad902-64c3-4078-a0f3-c241a871bbe1"); | |||
} | |||
private static volatile Config mInstance = null; //实例变量设置私有,防止直接通过类名访问 | |||
@@ -9,7 +9,7 @@ import retrofit2.http.Body; | |||
public class ResResult<T> { | |||
public int statusCode ; | |||
public List<T> data ; | |||
public List<T> data ;// | |||
public boolean succeeded ; | |||
@@ -16,4 +16,52 @@ public class ResUpload<T> implements Serializable { | |||
public String errors; | |||
public String extras; | |||
public int timestamp; | |||
public int getStatusCode() { | |||
return statusCode; | |||
} | |||
public void setStatusCode(int statusCode) { | |||
this.statusCode = statusCode; | |||
} | |||
public List<T> getData() { | |||
return data; | |||
} | |||
public void setData(List<T> data) { | |||
this.data = data; | |||
} | |||
public boolean isSucceeded() { | |||
return succeeded; | |||
} | |||
public void setSucceeded(boolean succeeded) { | |||
this.succeeded = succeeded; | |||
} | |||
public String getErrors() { | |||
return errors; | |||
} | |||
public void setErrors(String errors) { | |||
this.errors = errors; | |||
} | |||
public String getExtras() { | |||
return extras; | |||
} | |||
public void setExtras(String extras) { | |||
this.extras = extras; | |||
} | |||
public int getTimestamp() { | |||
return timestamp; | |||
} | |||
public void setTimestamp(int timestamp) { | |||
this.timestamp = timestamp; | |||
} | |||
} |
@@ -5,8 +5,8 @@ package com.jdzh.jdzhandroid.model; | |||
* @description: | |||
* @date: 2024/10/21 13:47. | |||
*/ | |||
public class ResponseData { | |||
public int code; | |||
public class UploadTData { | |||
public int code;//成功30000 重复:30001,未找到:30002,已被使用:30003 | |||
public String id; | |||
public String message; | |||
public String name; |
@@ -35,6 +35,7 @@ public class RecipeEditUtil { | |||
List<BPA_RecipeInfo> list = new ArrayList<>(); | |||
for(int j=1;j<=20;j++) { | |||
BPA_RecipeInfo recipe = new BPA_RecipeInfo(groupId, "",sort+j); | |||
recipe.setReferenceWeight(200);//默认重量200g | |||
list.add(recipe); | |||
addRecipeBaseConfig(recipe); | |||
} | |||
@@ -56,7 +56,7 @@ | |||
<TextView | |||
android:id="@+id/tv_group" | |||
android:background="@color/group_item_bg" | |||
android:textSize="@dimen/dp22" | |||
android:textSize="@dimen/sp22" | |||
android:textColor="@color/black" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
@@ -103,7 +103,7 @@ | |||
android:layout_height="match_parent" | |||
android:layout_marginEnd="@dimen/dp40" | |||
android:gravity="center" | |||
android:textSize="@dimen/dp14" | |||
android:textSize="@dimen/sp22" | |||
android:textColor="@color/black" | |||
></EditText> | |||
<Button | |||
@@ -28,22 +28,32 @@ | |||
</RelativeLayout> | |||
<TextView | |||
android:id="@+id/tv_Info" | |||
android:layout_margin="10dp" | |||
android:layout_row="1" | |||
android:layout_rowWeight="1" | |||
android:lineSpacingExtra="10dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:textColor="#666666" | |||
android:text="提示信息" | |||
android:textSize="25sp"/> | |||
<ScrollView | |||
android:layout_height="@dimen/dp190" | |||
android:layout_width="match_parent"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:id="@+id/tv_Info" | |||
android:padding="10dp" | |||
android:layout_row="1" | |||
android:layout_rowWeight="1" | |||
android:lineSpacingExtra="10dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:textColor="#666666" | |||
android:text="提示信息" | |||
android:textSize="22sp"/> | |||
</LinearLayout> | |||
</ScrollView> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_row="2" | |||
android:layout_marginBottom="20dp" | |||
android:layout_marginBottom="10dp" | |||
android:layout_height="50dp"> | |||
<LinearLayout | |||