@@ -4,10 +4,10 @@ | |||
<selectionStates> | |||
<SelectionState runConfigName="app"> | |||
<option name="selectionMode" value="DROPDOWN" /> | |||
<DropdownSelection timestamp="2024-11-29T06:04:26.548960300Z"> | |||
<DropdownSelection timestamp="2024-12-02T09:52:14.828011900Z"> | |||
<Target type="DEFAULT_BOOT"> | |||
<handle> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=56c9cbdc" /> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=2125f535" /> | |||
</handle> | |||
</Target> | |||
</DropdownSelection> | |||
@@ -35,10 +35,10 @@ public class APIService { | |||
} | |||
public static MaterialData GetMaterialModels(){ return materialModels; } | |||
private static long lastTime = System.currentTimeMillis(); | |||
// private static String saasBaseUrl = "https://cfv.black-pa.com/saasbase"; | |||
private static String saasBaseUrl = "http://192.168.1.50:5006"; | |||
// private static String kitchBaseUrl = "https://cfv.black-pa.com/kitchbase"; | |||
private static String kitchBaseUrl = "http://192.168.1.50:5007"; | |||
private static String saasBaseUrl = "https://cfv.black-pa.com/saasbase"; | |||
// private static String saasBaseUrl = "http://192.168.1.50:5006"; | |||
private static String kitchBaseUrl = "https://cfv.black-pa.com/kitchbase"; | |||
// private static String kitchBaseUrl = "http://192.168.1.50:5007"; | |||
public static void MainInit(){ | |||
Utils.disableSSLCertChecking(); | |||
@@ -50,7 +50,6 @@ public class APIService { | |||
private static void GetGoodsInfo(){ | |||
String autoKey = ConfigName.getInstance().DeviceAutoKey; | |||
String url = kitchBaseUrl+"/api/goods/Getdevicegoods?deviceId="+autoKey; | |||
// String url = "http://192.168.1.50:5007/api/goods/Getdevicegoods?deviceId=274"; | |||
long curTime = System.currentTimeMillis(); | |||
LogUtils.d(" GetGoodsInfo1 usetime="+(curTime-lastTime)); | |||
lastTime = curTime; | |||
@@ -245,6 +244,7 @@ public class APIService { | |||
BPA_GOODS bpa_goods =new BPA_GOODS(); | |||
bpa_goods.id = item.goodsInfoList.get(i).goodsId; | |||
bpa_goods.name = item.goodsInfoList.get(i).goodsName; | |||
bpa_goods.price = String.valueOf(item.goodsInfoList.get(i).price); | |||
bpa_goods.materialids = getMaterialids(item.goodsInfoList.get(i)); | |||
bpa_goods.goodtype=item.goodsTypeId; | |||
bpa_goods.status=1; | |||
@@ -13,6 +13,10 @@ public class GoodsInfoList { | |||
* 商品名称 | |||
*/ | |||
public String goodsName; | |||
/** | |||
* 商品价格 | |||
*/ | |||
public double price; | |||
/** | |||
* 商品图片 | |||
@@ -36,14 +36,15 @@ import retrofit2.Call; | |||
public class ServerManager { | |||
// public static final String mainUrl = "https://cfv.black-pa.com/"; | |||
public static final String mainUrl = "http://192.168.1.50:5007/"; | |||
public static final String mainUrl = "https://cfv.black-pa.com/kitchbase/"; | |||
public static final String mainUrl2 = "https://cfv.black-pa.com/saasbase/"; | |||
// public static final String mainUrl = "http://192.168.1.50:5007/"; | |||
/** | |||
* 上传日志文件 | |||
*/ | |||
public static void uploadDeviceLog(File file,IHttpCallBack<Object> callback) { | |||
String url = mainUrl + "saasbase/api/ExternalPlatform/Device/uploadDeviceLog"; | |||
String url = mainUrl2 + "api/ExternalPlatform/Device/uploadDeviceLog"; | |||
MessageLog.ShowUserMessage(UserLogEnum.上传日志,"上传日志文件"+url+" filename:"+file.getName()); | |||
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) | |||
.addFormDataPart("formFile", ConfigName.getInstance().versionSelectionEnum+"-"+ | |||
@@ -108,6 +109,12 @@ public class ServerManager { | |||
* @param showTip | |||
*/ | |||
public static void btnUploadOrder(Context context,boolean showTip){ | |||
if(!NetworkUtils.checkNetworkAvailable(context)){ | |||
if(showTip){ | |||
ToastUtils.showToast("请先连接网络"); | |||
} | |||
return; | |||
} | |||
if(showTip){ | |||
WaitProcessUtil.getInstance().show(context,"请稍等","正在上传所有配方详情,请耐心等待..."); | |||
} | |||
@@ -159,37 +166,50 @@ public class ServerManager { | |||
*/ | |||
public static void uploadOrder(boolean showTip,IHttpCallBack<Object> callback) { | |||
ArrayList<BPA_SUBORDER> suborderList = SubOrderUtil.GetSubOrderNoUpload(); | |||
List<String> orderIdList = new ArrayList<>(); | |||
for(BPA_SUBORDER bean :suborderList ){ | |||
if(!orderIdList.contains(bean.orderID)){ | |||
orderIdList.add(bean.orderID); | |||
} | |||
} | |||
List<UploadOrderInfo> uploadOrderInfoList = new ArrayList<>(); | |||
for(BPA_SUBORDER bean : suborderList){ | |||
boolean has =false; | |||
for(UploadOrderInfo info :uploadOrderInfoList){ | |||
if(info.OrderId.equals(bean.orderID)){ | |||
UploadOrderInfo.OrderDetail detail = new UploadOrderInfo.OrderDetail(); | |||
detail.AttributeName = bean.exp.replace("/","-"); | |||
detail.GoodsName = bean.goodsName; | |||
detail.Status = bean.status; | |||
detail.UpdateTime =bean.createTime; | |||
info.getOrderDetailList().add(detail); | |||
has = true; | |||
break; | |||
for(String orderID : orderIdList){ | |||
ArrayList<BPA_SUBORDER> list = SubOrderUtil.GetSubOrderByOrderId(orderID); | |||
for(BPA_SUBORDER bean:list){ | |||
boolean has =false; | |||
for(UploadOrderInfo info :uploadOrderInfoList){ | |||
if(info.OrderId.equals(bean.orderID)){ | |||
UploadOrderInfo.OrderDetail detail = new UploadOrderInfo.OrderDetail(); | |||
detail.AttributeName = bean.exp.replace("/","-"); | |||
detail.GoodsName = bean.goodsName; | |||
detail.GoodsPrice = bean.realMoney; | |||
LogUtils.d("GoodsPrice ="+detail.GoodsPrice); | |||
detail.Status = bean.status; | |||
detail.UpdateTime =bean.createTime; | |||
info.getOrderDetailList().add(detail); | |||
has = true; | |||
break; | |||
} | |||
} | |||
if(!has){ | |||
UploadOrderInfo uploadOrderInfo = new UploadOrderInfo(); | |||
uploadOrderInfo.AutoKey = Integer.parseInt(ConfigName.getInstance().DeviceAutoKey); | |||
uploadOrderInfo.OrderId = bean.orderID; | |||
uploadOrderInfo.IsDevice = Boolean.parseBoolean(bean.isDevice); | |||
uploadOrderInfo.Number = bean.numId.isEmpty()?0:Integer.parseInt(bean.numId); | |||
List<UploadOrderInfo.OrderDetail> orderDetails = new ArrayList<>(); | |||
UploadOrderInfo.OrderDetail orderDetail = new UploadOrderInfo.OrderDetail(); | |||
orderDetail.AttributeName = bean.exp.replace("/","-"); | |||
orderDetail.GoodsName = bean.goodsName; | |||
orderDetail.Status = bean.status; | |||
orderDetail.UpdateTime =bean.createTime; | |||
orderDetail.GoodsPrice = bean.realMoney; | |||
LogUtils.d("GoodsPrice ="+orderDetail.GoodsPrice); | |||
orderDetails.add(orderDetail); | |||
uploadOrderInfo.OrderDetailList = orderDetails; | |||
uploadOrderInfoList.add(uploadOrderInfo); | |||
} | |||
} | |||
if(!has){ | |||
UploadOrderInfo uploadOrderInfo = new UploadOrderInfo(); | |||
uploadOrderInfo.AutoKey = Integer.parseInt(ConfigName.getInstance().DeviceAutoKey); | |||
uploadOrderInfo.OrderId = bean.orderID; | |||
uploadOrderInfo.IsDevice = Boolean.parseBoolean(bean.isDevice); | |||
uploadOrderInfo.Number = bean.numId.isEmpty()?0:Integer.parseInt(bean.numId); | |||
List<UploadOrderInfo.OrderDetail> orderDetails = new ArrayList<>(); | |||
UploadOrderInfo.OrderDetail orderDetail = new UploadOrderInfo.OrderDetail(); | |||
orderDetail.AttributeName = bean.exp.replace("/","-"); | |||
orderDetail.GoodsName = bean.goodsName; | |||
orderDetail.Status = bean.status; | |||
orderDetail.UpdateTime =bean.createTime; | |||
orderDetails.add(orderDetail); | |||
uploadOrderInfo.OrderDetailList = orderDetails; | |||
uploadOrderInfoList.add(uploadOrderInfo); | |||
} | |||
} | |||
@@ -21,7 +21,6 @@ import com.bonait.bnframework.common.db.res.ResOrderCloudList; | |||
import com.bonait.bnframework.common.db.res.UserLogEnum; | |||
import com.bonait.bnframework.common.db.util.CloudGoodsUtil; | |||
import com.bonait.bnframework.common.db.util.CloudOrderUtil; | |||
import com.bonait.bnframework.common.db.util.SubOrderUtil; | |||
import com.bonait.bnframework.common.helper.AES; | |||
import com.bonait.bnframework.common.helper.I.IRun; | |||
import com.bonait.bnframework.common.helper.I.IThread; | |||
@@ -193,9 +192,10 @@ public class OrderServer { | |||
bean1.AttributeNames = orderInfo.getGoodList().get(j).AttributeNames; | |||
bean1.GoodsId = orderInfo.getGoodList().get(j).GoodsId; | |||
bean1.AttributeIds = orderInfo.getGoodList().get(j).AttributeIds; | |||
bean1.GoodsPrice = orderInfo.getGoodList().get(j).GoodsPrice; | |||
goodsList.add(bean1); | |||
BPA_SUBORDER bpaSuborder = QueryDB.GetSubOrderId(bean1.id); | |||
BPA_SUBORDER bpaSuborder = QueryDB.GetById(bean1.id); | |||
if(bpaSuborder!=null){ | |||
QueryDB.DeleteSubOrder(bpaSuborder); | |||
} | |||
@@ -210,7 +210,10 @@ public class OrderServer { | |||
suborder.number = 1; | |||
suborder.status = 0; | |||
suborder.isDevice = "false"; | |||
suborder.isUpload = "false"; | |||
suborder.exp = bean1.AttributeNames; | |||
suborder.realMoney = (bean1.GoodsPrice==null||bean1.GoodsPrice.isEmpty())?0:Double.parseDouble(bean1.GoodsPrice); | |||
QueryDB.AddSubOrder(suborder); | |||
} | |||
List<String> namesList = new ArrayList<>(); | |||
@@ -316,6 +316,7 @@ public class DataBus { | |||
{ | |||
item.makeStatus=MakeStatus.制作完成; | |||
item.makeMs=""; | |||
item.subOrder.isUpload = "false"; | |||
item.makeProcess=100; | |||
item.subOrder.status=isError?3:1; | |||
QueryDB.UpdateSubOrder(item.subOrder); | |||
@@ -354,6 +355,7 @@ public class DataBus { | |||
item.makeMs=""; | |||
item.makeProcess=100; | |||
item.subOrder.status=4; | |||
item.subOrder.isUpload = "false"; | |||
QueryDB.UpdateSubOrder(item.subOrder); | |||
good=item; | |||
} | |||
@@ -390,6 +392,7 @@ public class DataBus { | |||
item.makeMs=""; | |||
item.makeProcess=100; | |||
item.subOrder.status=4; | |||
item.subOrder.isUpload = "false"; | |||
QueryDB.UpdateSubOrder(item.subOrder); | |||
} | |||
@@ -1825,7 +1825,7 @@ public class QueryDB { | |||
*/ | |||
public static void UpdateSubOrder(BPA_SUBORDER data) { | |||
data.isUpload = "false"; | |||
if(GetSubOrderId(data.id)==null){ | |||
if(GetById(data.id)==null){ | |||
AddSubOrder(data); | |||
}else { | |||
Update(BPA_SUBORDER.class, data); | |||
@@ -1878,7 +1878,7 @@ public class QueryDB { | |||
return data; | |||
} | |||
public static BPA_SUBORDER GetSubOrderId(String id) { | |||
public static BPA_SUBORDER GetById(String id) { | |||
String orderby = Desc_Time_Up;//先按排序 创建时间倒序 | |||
BPA_SUBORDER bean = null; | |||
String where = "isDelete=? and id=?"; | |||
@@ -1890,7 +1890,7 @@ public class QueryDB { | |||
return bean; | |||
} | |||
public static BPA_SUBORDER GetSubOrderById(String orderId) { | |||
public static BPA_SUBORDER GetByOrderId(String orderId) { | |||
String orderby = Desc_Time_Up;//先按排序 创建时间倒序 | |||
BPA_SUBORDER bean = null; | |||
String where = "isDelete=? and orderID=?"; | |||
@@ -3691,6 +3691,7 @@ public class QueryDB { | |||
((BPA_GOODS) data).issc = cursor.getInt((int) cursor.getColumnIndex("issc")); | |||
((BPA_GOODS) data).materialids = cursor.getString((int) cursor.getColumnIndex("materialids")); | |||
((BPA_GOODS) data).foreignKeyRe = cursor.getString((int) cursor.getColumnIndex("foreignKeyRe")); | |||
((BPA_GOODS) data).price = cursor.getString((int) cursor.getColumnIndex("price")); | |||
break; | |||
case "BPA_GOODSTYPE": | |||
data = new BPA_GOODSTYPE(); | |||
@@ -26,6 +26,8 @@ public class BPA_GOODS extends ModeBase { | |||
//外键集合 | |||
public String foreignKeyRe;//商品外键id | |||
public String price; | |||
@Override | |||
public String toString() { | |||
return "BPA_GOODS{" + | |||
@@ -27,4 +27,5 @@ public class BPA_SUBORDER extends ModeBase{ | |||
public String numId="0"; | |||
} |
@@ -18,6 +18,18 @@ import java.util.Map; | |||
* @date: 2024/11/27 13:34. | |||
*/ | |||
public class SubOrderUtil { | |||
public static ArrayList<BPA_SUBORDER> GetSubOrderByOrderId(String orderId) { | |||
String orderby = QueryDB.Desc_Time_Up;//先按排序 创建时间倒序 | |||
String where = "isDelete=? and orderID=?"; | |||
String[] args = new String[]{"0",orderId}; | |||
ArrayList<BPA_SUBORDER> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_SUBORDER.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_SUBORDER) k); | |||
} | |||
return data; | |||
} | |||
/** | |||
* 获取所有订单子表 | |||
* | |||
@@ -26,6 +26,15 @@ public class UploadOrderInfo { | |||
/// 商品制作状态(0等待 1完成 2执行中 3异常 4取消) | |||
public int Status; | |||
public String UpdateTime ; | |||
public double GoodsPrice; | |||
public double getGoodsPrice() { | |||
return GoodsPrice; | |||
} | |||
public void setGoodsPrice(double goodsPrice) { | |||
GoodsPrice = goodsPrice; | |||
} | |||
public String getGoodsName() { | |||
return GoodsName; | |||
@@ -225,112 +225,166 @@ public class ToastUtils { | |||
@CheckResult | |||
public static Toast custom(@NonNull Context context, @NonNull String message, Drawable icon, @ColorInt int textColor, @ColorInt int tintColor, int duration, boolean withIcon, boolean shouldTint) { | |||
StringBuilder toastMes = new StringBuilder(); | |||
if(message.contains("|")){ | |||
String[] res = message.split("\\|"); | |||
if(res.length>0 && res.length<3){ | |||
for (int i = 0;i < res.length;i++){ | |||
toastMes.append(res[i]); | |||
if(i!=res.length-1){ | |||
toastMes.append("\n"); | |||
try{ | |||
StringBuilder toastMes = new StringBuilder(); | |||
if(message.contains("|")){ | |||
String[] res = message.split("\\|"); | |||
if(res.length>0 && res.length<3){ | |||
for (int i = 0;i < res.length;i++){ | |||
toastMes.append(res[i]); | |||
if(i!=res.length-1){ | |||
toastMes.append("\n"); | |||
} | |||
} | |||
} | |||
}else if(res.length>=3){ | |||
for (int i = res.length-3;i < res.length;i++){ | |||
toastMes.append(res[i]); | |||
if(i!=res.length-1){ | |||
toastMes.append("\n"); | |||
}else if(res.length>=3){ | |||
for (int i = res.length-3;i < res.length;i++){ | |||
toastMes.append(res[i]); | |||
if(i!=res.length-1){ | |||
toastMes.append("\n"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
if(toastMes.length()==0){ | |||
toastMes.append(message); | |||
} | |||
if (Looper.myLooper() == Looper.getMainLooper()) { | |||
if (currentToast == null) { | |||
currentToast = new Toast(context); | |||
} | |||
final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.toast_layout, null); | |||
final ImageView toastIcon = toastLayout.findViewById(R.id.toast_icon); | |||
final TextView toastTextView = toastLayout.findViewById(R.id.toast_text); | |||
Drawable drawableFrame; | |||
if (shouldTint) { | |||
drawableFrame = tint9PatchDrawableFrame(context, tintColor); | |||
} else { | |||
drawableFrame = getDrawable(context, R.mipmap.toast_frame); | |||
} | |||
setBackground(toastLayout, drawableFrame); | |||
if (withIcon) { | |||
if (icon == null) { | |||
throw new IllegalArgumentException("Avoid passing 'icon' as null if 'withIcon' is set to true"); | |||
} | |||
setBackground(toastIcon, icon); | |||
} else { | |||
toastIcon.setVisibility(View.GONE); | |||
if(toastMes.length()==0){ | |||
toastMes.append(message); | |||
} | |||
toastTextView.setTextColor(textColor); | |||
toastTextView.setText(toastMes.toString()); | |||
toastTextView.setTypeface(Typeface.create(TOAST_TYPEFACE, Typeface.NORMAL)); | |||
currentToast.setView(toastLayout); | |||
currentToast.setDuration(duration); | |||
currentToast.setGravity(Gravity.BOTTOM,0,20); | |||
// currentToast.setGravity(Gravity.LEFT | Gravity.TOP, 0, 0);//左上角 | |||
// currentToast.setGravity(Gravity.RIGHT | Gravity.TOP, 0, 0);//右上角 | |||
// currentToast.setGravity(Gravity.LEFT | Gravity.BOTTOM, 0, 0);//左下角 | |||
// currentToast.setGravity(Gravity.RIGHT | Gravity.BOTTOM, 0, 100);//右下角 | |||
currentToast.show(); | |||
return currentToast; | |||
} else { | |||
mHandler.post(new Runnable() { | |||
@Override | |||
public void run() { | |||
if (currentToastThread == null) { | |||
currentToastThread = new Toast(context); | |||
} | |||
final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.toast_layout, null); | |||
final ImageView toastIcon = toastLayout.findViewById(R.id.toast_icon); | |||
final TextView toastTextView = toastLayout.findViewById(R.id.toast_text); | |||
Drawable drawableFrame; | |||
if (shouldTint) { | |||
drawableFrame = tint9PatchDrawableFrame(context, tintColor); | |||
} else { | |||
drawableFrame = getDrawable(context, R.mipmap.toast_frame); | |||
} | |||
setBackground(toastLayout, drawableFrame); | |||
if (withIcon) { | |||
if (icon == null) { | |||
throw new IllegalArgumentException("Avoid passing 'icon' as null if 'withIcon' is set to true"); | |||
try{ | |||
if (currentToast == null) { | |||
currentToast = new Toast(context); | |||
} | |||
final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.toast_layout, null); | |||
final ImageView toastIcon = toastLayout.findViewById(R.id.toast_icon); | |||
final TextView toastTextView = toastLayout.findViewById(R.id.toast_text); | |||
Drawable drawableFrame; | |||
if (shouldTint) { | |||
drawableFrame = tint9PatchDrawableFrame(context, tintColor); | |||
} else { | |||
drawableFrame = getDrawable(context, R.mipmap.toast_frame); | |||
} | |||
setBackground(toastLayout, drawableFrame); | |||
if (withIcon) { | |||
if (icon == null) { | |||
throw new IllegalArgumentException("Avoid passing 'icon' as null if 'withIcon' is set to true"); | |||
} | |||
setBackground(toastIcon, icon); | |||
} else { | |||
toastIcon.setVisibility(View.GONE); | |||
} | |||
setBackground(toastIcon, icon); | |||
} else { | |||
toastIcon.setVisibility(View.GONE); | |||
} | |||
toastTextView.setTextColor(textColor); | |||
toastTextView.setText(toastMes.toString()); | |||
toastTextView.setTypeface(Typeface.create(TOAST_TYPEFACE, Typeface.NORMAL)); | |||
currentToastThread.setView(toastLayout); | |||
currentToastThread.setDuration(duration); | |||
toastTextView.setTextColor(textColor); | |||
toastTextView.setText(toastMes.toString()); | |||
toastTextView.setTypeface(Typeface.create(TOAST_TYPEFACE, Typeface.NORMAL)); | |||
currentToastThread.setGravity(Gravity.BOTTOM,0,20); | |||
currentToastThread.show(); | |||
// currentToast.setGravity(Gravity.LEFT | Gravity.TOP, 0, 0);//左上角 | |||
currentToast.setView(toastLayout); | |||
currentToast.setDuration(duration); | |||
currentToast.setGravity(Gravity.BOTTOM,0,20); | |||
// currentToast.setGravity(Gravity.LEFT | Gravity.TOP, 0, 0);//左上角 | |||
// currentToast.setGravity(Gravity.RIGHT | Gravity.TOP, 0, 0);//右上角 | |||
// currentToast.setGravity(Gravity.LEFT | Gravity.BOTTOM, 0, 0);//左下角 | |||
// currentToast.setGravity(Gravity.RIGHT | Gravity.BOTTOM, 0, 100);//右下角 | |||
// currentToast.setGravity(Gravity.RIGHT | Gravity.BOTTOM, 0, 100);//右下角 | |||
currentToast.show(); | |||
}catch (Exception e){ | |||
} | |||
} | |||
}); | |||
}catch (Exception e){ | |||
} | |||
// if (Looper.myLooper() == Looper.getMainLooper()) { | |||
// if (currentToast == null) { | |||
// currentToast = new Toast(context); | |||
// } | |||
// final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.toast_layout, null); | |||
// final ImageView toastIcon = toastLayout.findViewById(R.id.toast_icon); | |||
// final TextView toastTextView = toastLayout.findViewById(R.id.toast_text); | |||
// Drawable drawableFrame; | |||
// | |||
// if (shouldTint) { | |||
// drawableFrame = tint9PatchDrawableFrame(context, tintColor); | |||
// } else { | |||
// drawableFrame = getDrawable(context, R.mipmap.toast_frame); | |||
// } | |||
// setBackground(toastLayout, drawableFrame); | |||
// | |||
// if (withIcon) { | |||
// if (icon == null) { | |||
// throw new IllegalArgumentException("Avoid passing 'icon' as null if 'withIcon' is set to true"); | |||
// } | |||
// setBackground(toastIcon, icon); | |||
// } else { | |||
// toastIcon.setVisibility(View.GONE); | |||
// } | |||
// | |||
// toastTextView.setTextColor(textColor); | |||
// toastTextView.setText(toastMes.toString()); | |||
// toastTextView.setTypeface(Typeface.create(TOAST_TYPEFACE, Typeface.NORMAL)); | |||
// | |||
// currentToast.setView(toastLayout); | |||
// currentToast.setDuration(duration); | |||
// currentToast.setGravity(Gravity.BOTTOM,0,20); | |||
//// currentToast.setGravity(Gravity.LEFT | Gravity.TOP, 0, 0);//左上角 | |||
//// currentToast.setGravity(Gravity.RIGHT | Gravity.TOP, 0, 0);//右上角 | |||
//// currentToast.setGravity(Gravity.LEFT | Gravity.BOTTOM, 0, 0);//左下角 | |||
// // currentToast.setGravity(Gravity.RIGHT | Gravity.BOTTOM, 0, 100);//右下角 | |||
// currentToast.show(); | |||
// return currentToast; | |||
// } else { | |||
// mHandler.post(new Runnable() { | |||
// @Override | |||
// public void run() { | |||
// if (currentToastThread == null) { | |||
// currentToastThread = new Toast(context); | |||
// } | |||
// final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.toast_layout, null); | |||
// final ImageView toastIcon = toastLayout.findViewById(R.id.toast_icon); | |||
// final TextView toastTextView = toastLayout.findViewById(R.id.toast_text); | |||
// Drawable drawableFrame; | |||
// | |||
// if (shouldTint) { | |||
// drawableFrame = tint9PatchDrawableFrame(context, tintColor); | |||
// } else { | |||
// drawableFrame = getDrawable(context, R.mipmap.toast_frame); | |||
// } | |||
// setBackground(toastLayout, drawableFrame); | |||
// | |||
// if (withIcon) { | |||
// if (icon == null) { | |||
// throw new IllegalArgumentException("Avoid passing 'icon' as null if 'withIcon' is set to true"); | |||
// } | |||
// setBackground(toastIcon, icon); | |||
// } else { | |||
// toastIcon.setVisibility(View.GONE); | |||
// } | |||
// | |||
// toastTextView.setTextColor(textColor); | |||
// toastTextView.setText(toastMes.toString()); | |||
// toastTextView.setTypeface(Typeface.create(TOAST_TYPEFACE, Typeface.NORMAL)); | |||
// | |||
// currentToastThread.setView(toastLayout); | |||
// currentToastThread.setDuration(duration); | |||
// | |||
// currentToastThread.setGravity(Gravity.BOTTOM,0,20); | |||
// currentToastThread.show(); | |||
// // currentToast.setGravity(Gravity.LEFT | Gravity.TOP, 0, 0);//左上角 | |||
//// currentToast.setGravity(Gravity.RIGHT | Gravity.TOP, 0, 0);//右上角 | |||
//// currentToast.setGravity(Gravity.LEFT | Gravity.BOTTOM, 0, 0);//左下角 | |||
// // currentToast.setGravity(Gravity.RIGHT | Gravity.BOTTOM, 0, 100);//右下角 | |||
// } | |||
// }); | |||
// } | |||
return null; | |||
} | |||
@@ -19,6 +19,7 @@ import android.widget.EditText; | |||
import android.widget.RelativeLayout; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.api.ServerManager; | |||
import com.bonait.bnframework.business.ConfigData; | |||
@@ -27,7 +28,11 @@ import com.bonait.bnframework.business.OrderServer; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG; | |||
import com.bonait.bnframework.common.db.mode.BPA_LOG; | |||
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
import com.bonait.bnframework.common.db.res.UserLogEnum; | |||
import com.bonait.bnframework.common.helper.I.IThread; | |||
import com.bonait.bnframework.common.helper.MQTT; | |||
import com.bonait.bnframework.common.helper.MediaPlayerHelper; | |||
@@ -49,6 +54,7 @@ import com.bonait.bnframework.modules.home.fragment.SheZhifragment; | |||
import com.bonait.bnframework.modules.home.fragment.mode.SerialInter; | |||
import com.bonait.bnframework.modules.home.fragment.mode.SerialManage; | |||
//import com.bonait.bnframework.modules.home.fragment.mode.ShaomaTest; | |||
import com.bonait.bnframework.modules.home.util.FileUtil; | |||
import com.bonait.bnframework.modules.mine.fragment.MyFragment; | |||
import com.bumptech.glide.Glide; | |||
import com.qmuiteam.qmui.widget.QMUIViewPager; | |||
@@ -96,6 +102,13 @@ public class BottomNavigationMainActivity extends BaseActivity{ | |||
PreferenceUtils.setInt("loginNum",loginNum+1); | |||
} | |||
long cacheSize = FileUtil.getFolderSize(new File(ConfigName.getInstance().appResRoot)); | |||
if(cacheSize>1024*500){ | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_LOG.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ALERTLOG.class,null); | |||
MessageLog.ShowUserMessage(UserLogEnum.角色操作日志,"自动清除日志"); | |||
} | |||
/* shaoma_Text.requestFocus(); | |||
shaoma_Text.setInputType(InputType.TYPE_NULL); | |||
shaoma_Text.setOnFocusChangeListener(new View.OnFocusChangeListener() { | |||
@@ -147,9 +160,7 @@ public class BottomNavigationMainActivity extends BaseActivity{ | |||
});*/ | |||
if(NetworkUtils.checkNetworkAvailable(this)){ | |||
ServerManager.btnUploadOrder(this,false); | |||
} | |||
ServerManager.btnUploadOrder(this,false); | |||
initData(); | |||
} | |||
@@ -8,6 +8,7 @@ import android.view.ViewGroup; | |||
import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
@@ -18,6 +19,7 @@ import com.bonait.bnframework.common.db.res.ResGoodsRecipe; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ItemGroupNameBinding; | |||
import com.bonait.bnframework.modules.home.util.WaitProcessUtil; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -32,11 +34,28 @@ public abstract class GoodGroupNameAdapter extends BaseAdapter<BPA_GOODSRECIPENA | |||
* 当前物料数据 | |||
*/ | |||
public List<BPA_MATERIAL> materilasList=new ArrayList<>(); | |||
public List<List<ResGoodsRecipe>> resGoodsRecipesList =new ArrayList<>(); | |||
public void setMaterilasList(List<BPA_MATERIAL> materilasList) { | |||
this.materilasList = materilasList; | |||
} | |||
public void freshRecipeData(){ | |||
ThreadManager.get().execute(()->{ | |||
try{ | |||
this.resGoodsRecipesList.clear(); | |||
for(BPA_GOODSRECIPENAME bean : mData){ | |||
this.resGoodsRecipesList.add(QueryDB.GetGoodsSreciperecipeList(bean.id)); | |||
} | |||
ToastUtils.info("配方数据加载成功!"); | |||
}catch (Exception e){ | |||
} | |||
}); | |||
} | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
@@ -57,6 +76,10 @@ public abstract class GoodGroupNameAdapter extends BaseAdapter<BPA_GOODSRECIPENA | |||
// DisplayManager.scaleViewGroup(holder.binding.root); | |||
// DisplayManager.scaleViewGroup(holder.binding.llControl); | |||
// } | |||
GoodGroupDetailAdapter detailAdapter = new GoodGroupDetailAdapter(); | |||
detailAdapter.setMaterilasList(materilasList); | |||
detailAdapter.setNewData(resGoodsRecipesList.size()>position?resGoodsRecipesList.get(position):new ArrayList<>()); | |||
holder.binding.recycleDetail.setAdapter(detailAdapter); | |||
holder.binding.groupName.setText(mData.get(position).name+""); | |||
holder.binding.btnCopy.setOnClickListener(v->{ | |||
onCopy(position,mData.get(position)); | |||
@@ -73,10 +96,7 @@ public abstract class GoodGroupNameAdapter extends BaseAdapter<BPA_GOODSRECIPENA | |||
holder.binding.recycleDetail.setVisibility(View.GONE); | |||
holder.binding.imgArrow.setBackgroundResource(R.mipmap.ic_arrow_left2); | |||
} | |||
GoodGroupDetailAdapter detailAdapter = new GoodGroupDetailAdapter(); | |||
detailAdapter.setMaterilasList(materilasList); | |||
detailAdapter.setNewData(QueryDB.GetGoodsSreciperecipeList(mData.get(position).id)); | |||
holder.binding.recycleDetail.setAdapter(detailAdapter); | |||
holder.binding.btnSave.setOnClickListener(v->{ | |||
ArrayList<ResGoodsRecipe> re= QueryDB.GetGoodsSreciperecipeList(mData.get(position).id); | |||
for(ResGoodsRecipe item:re) | |||
@@ -94,7 +114,13 @@ public abstract class GoodGroupNameAdapter extends BaseAdapter<BPA_GOODSRECIPENA | |||
good.sort=0; | |||
QueryDB.AddGoodsSrecipe(good); | |||
} | |||
ToastUtils.info("保存成功"); | |||
if(resGoodsRecipesList.size()>position){ | |||
resGoodsRecipesList.set(position,QueryDB.GetGoodsSreciperecipeList(mData.get(position).id)); | |||
ToastUtils.info("保存成功"); | |||
}else { | |||
ToastUtils.info("保存失败"); | |||
} | |||
}); | |||
holder.binding.btnAdd.setOnClickListener(v->{ | |||
ResGoodsRecipe bean = new ResGoodsRecipe(); | |||
@@ -111,6 +137,10 @@ public abstract class GoodGroupNameAdapter extends BaseAdapter<BPA_GOODSRECIPENA | |||
holder.binding.tvExpand.setText("收起"); | |||
holder.binding.recycleDetail.setVisibility(View.VISIBLE); | |||
holder.binding.llControl.setVisibility(View.VISIBLE); | |||
if(resGoodsRecipesList.size()<=position){ | |||
ToastUtils.warning("正在加载配方数据..."); | |||
} | |||
detailAdapter.setNewData(resGoodsRecipesList.size()>position?resGoodsRecipesList.get(position):new ArrayList<>()); | |||
}else { | |||
holder.binding.imgArrow.setBackgroundResource(R.mipmap.ic_arrow_left2); | |||
@@ -11,9 +11,8 @@ import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.OrderServer; | |||
import com.bonait.bnframework.api.ServerManager; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_ORDER_GOODS_CLOUD; | |||
import com.bonait.bnframework.common.db.mode.BPA_ORDER_HEADER_CLOUD; | |||
@@ -21,8 +20,6 @@ import com.bonait.bnframework.common.db.mode.BPA_SUBORDER; | |||
import com.bonait.bnframework.common.db.res.ResOrderCloudList; | |||
import com.bonait.bnframework.common.db.util.CloudGoodsUtil; | |||
import com.bonait.bnframework.common.db.util.CloudOrderUtil; | |||
import com.bonait.bnframework.common.helper.MQTT; | |||
import com.bonait.bnframework.common.model.event.SynchronousCloudDataEvent; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
@@ -31,7 +28,6 @@ import com.bonait.bnframework.event.FreshCloudOrderEvent; | |||
import com.bonait.bnframework.modules.home.adapter.CloudOrderAdapter; | |||
import com.bonait.bnframework.modules.home.fragment.mode.LookOrderGoodsDialog; | |||
import com.bonait.bnframework.modules.home.util.WaitProcessUtil; | |||
import com.mobsandgeeks.saripaar.annotation.Order; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
@@ -158,6 +154,7 @@ public class CloudOrderFragment extends BaseFragment { | |||
getData().set(position,orderBean); | |||
}else { | |||
getData().remove(position); | |||
ServerManager.btnUploadOrder(getContext(),false); | |||
} | |||
notifyDataSetChanged(); | |||
} | |||
@@ -188,15 +185,20 @@ public class CloudOrderFragment extends BaseFragment { | |||
bean.status = 4; | |||
} | |||
CloudGoodsUtil.update(bean); | |||
BPA_SUBORDER suborder = QueryDB.GetSubOrderById(bean.orderId); | |||
BPA_SUBORDER suborder = QueryDB.GetById(bean.id); | |||
if(suborder!=null){ | |||
suborder.number = 1; | |||
suborder.status = 4; | |||
if(suborder.status != 1){ | |||
suborder.status = 4; | |||
} | |||
suborder.realMoney = (bean.GoodsPrice==null||bean.GoodsPrice.isEmpty())?0:Double.parseDouble(bean.GoodsPrice); | |||
suborder.isUpload = "false"; | |||
suborder.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
QueryDB.UpdateSubOrder(suborder); | |||
}else { | |||
suborder = new BPA_SUBORDER(); | |||
suborder.number = 1; | |||
suborder.realMoney = (bean.GoodsPrice==null||bean.GoodsPrice.isEmpty())?0:Double.parseDouble(bean.GoodsPrice); | |||
suborder.status = 4; | |||
suborder.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
QueryDB.AddSubOrder(suborder); | |||
@@ -206,6 +208,7 @@ public class CloudOrderFragment extends BaseFragment { | |||
dataList.remove(position); | |||
orderAdapter.notifyDataSetChanged(); | |||
dialog.dismiss(); | |||
ServerManager.btnUploadOrder(getContext(),false); | |||
} | |||
}); | |||
} | |||
@@ -281,16 +284,22 @@ public class CloudOrderFragment extends BaseFragment { | |||
bean.status = 4; | |||
} | |||
CloudGoodsUtil.update(bean); | |||
BPA_SUBORDER suborder = QueryDB.GetSubOrderById(bean.orderId); | |||
BPA_SUBORDER suborder = QueryDB.GetById(bean.id); | |||
if(suborder!=null){ | |||
suborder.number = 1; | |||
suborder.status = 4; | |||
if(suborder.status != 1){ | |||
suborder.status = 4; | |||
} | |||
suborder.isUpload = "false"; | |||
suborder.realMoney = (bean.GoodsPrice==null||bean.GoodsPrice.isEmpty())?0:Double.parseDouble(bean.GoodsPrice); | |||
suborder.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
QueryDB.UpdateSubOrder(suborder); | |||
}else { | |||
suborder = new BPA_SUBORDER(); | |||
suborder.number = 1; | |||
suborder.status = 4; | |||
suborder.realMoney = (bean.GoodsPrice==null||bean.GoodsPrice.isEmpty())?0:Double.parseDouble(bean.GoodsPrice); | |||
suborder.isUpload = "false"; | |||
suborder.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
QueryDB.AddSubOrder(suborder); | |||
} | |||
@@ -305,6 +314,7 @@ public class CloudOrderFragment extends BaseFragment { | |||
orderAdapter.notifyDataSetChanged(); | |||
} | |||
WaitProcessUtil.getInstance().dismiss(); | |||
ServerManager.btnUploadOrder(getContext(),false); | |||
} | |||
@@ -674,6 +674,7 @@ public class MakeGoodFragment extends BaseFragment { | |||
suborder.userID = ConfigName.getInstance().user.userID; | |||
// suborder.orderID = order.id; | |||
suborder.goodsID = good.id; | |||
suborder.realMoney = (good.price==null || good.price.isEmpty())?0:Double.parseDouble(good.price); | |||
suborder.recipeID = goodsrecipename.id; | |||
suborder.number = 1; | |||
suborder.status = 0; | |||
@@ -239,12 +239,8 @@ public class OrderListActivity extends BaseActivity { | |||
case R.id.button://查询按钮 | |||
Initdata(); | |||
break; | |||
case R.id.btn_upload://查询按钮 | |||
if(NetworkUtils.checkNetworkAvailable(this)){ | |||
ServerManager.btnUploadOrder(this,true); | |||
}else { | |||
ToastUtils.warning("请先连接网络!"); | |||
} | |||
case R.id.btn_upload: | |||
ServerManager.btnUploadOrder(this,true); | |||
break; | |||
case R.id.delete: | |||
AlertDialogUtils.showDialog(this, | |||
@@ -44,6 +44,7 @@ import com.bonait.bnframework.modules.home.adapter.newmeatrilselect_adapter; | |||
import com.bonait.bnframework.modules.home.adapter.pfsx_adapter; | |||
import com.bonait.bnframework.modules.home.fragment.from.GoodPeiFangActivity; | |||
import com.bonait.bnframework.modules.home.fragment.from.ImageChooseActivity; | |||
import com.bonait.bnframework.modules.home.util.WaitProcessUtil; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
@@ -94,6 +95,7 @@ public class GoodsEditView extends LinearLayout { | |||
* @param data | |||
*/ | |||
public void setData(BPA_GOODS data, GoodPeiFangActivity activity) { | |||
if(data==null){ | |||
ToastUtils.info("数据为空"); | |||
return; | |||
@@ -102,6 +104,7 @@ public class GoodsEditView extends LinearLayout { | |||
goodsData = data; | |||
this.activity=activity; | |||
initData(); | |||
} | |||
/** | |||
@@ -152,17 +155,17 @@ public class GoodsEditView extends LinearLayout { | |||
} | |||
}); | |||
viewBinding.titleDetail.setOnClickListener(v->{ | |||
if(viewBinding.recyclerDetail.getVisibility() == VISIBLE){ | |||
viewBinding.tabTitle.setVisibility(GONE); | |||
viewBinding.recyclerDetail.setVisibility(GONE); | |||
viewBinding.icArrowDetail.setBackgroundResource(R.mipmap.ic_arrow_left); | |||
viewBinding.tvArrowDetail.setText("展开"); | |||
}else { | |||
viewBinding.tabTitle.setVisibility(VISIBLE); | |||
viewBinding.recyclerDetail.setVisibility(VISIBLE); | |||
viewBinding.icArrowDetail.setBackgroundResource(R.mipmap.ic_arrow_down); | |||
viewBinding.tvArrowDetail.setText("收起"); | |||
} | |||
// if(viewBinding.recyclerDetail.getVisibility() == VISIBLE){ | |||
// viewBinding.tabTitle.setVisibility(GONE); | |||
// viewBinding.recyclerDetail.setVisibility(GONE); | |||
// viewBinding.icArrowDetail.setBackgroundResource(R.mipmap.ic_arrow_left); | |||
// viewBinding.tvArrowDetail.setText("展开"); | |||
// }else { | |||
// viewBinding.tabTitle.setVisibility(VISIBLE); | |||
// viewBinding.recyclerDetail.setVisibility(VISIBLE); | |||
// viewBinding.icArrowDetail.setBackgroundResource(R.mipmap.ic_arrow_down); | |||
// viewBinding.tvArrowDetail.setText("收起"); | |||
// } | |||
}); | |||
viewBinding.llImg.setOnClickListener(v->{ | |||
@@ -413,6 +416,8 @@ public class GoodsEditView extends LinearLayout { | |||
ToastUtils.info("删除成功"); | |||
KeyboardUtil.hideKeyboard(viewBinding.recyclerDetail); | |||
goodsrecipenames.remove(position); | |||
groupAdapter.freshRecipeData(); | |||
groupAdapter.notifyDataSetChanged(); | |||
dialog.dismiss(); | |||
} | |||
@@ -462,8 +467,10 @@ public class GoodsEditView extends LinearLayout { | |||
copyRecipeDialog.show(activity.getSupportFragmentManager(),"复制配方"); | |||
} | |||
}; | |||
groupAdapter.setMaterilasList(materilasList); | |||
groupAdapter.setNewData(goodsrecipenames); | |||
groupAdapter.setMaterilasList(materilasList); | |||
ToastUtils.info("正在加载配方数据..."); | |||
groupAdapter.freshRecipeData(); | |||
viewBinding.recyclerDetail.setAdapter(groupAdapter); | |||
} | |||
@@ -26,6 +26,7 @@ import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.HBL.Unity; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.api.ServerManager; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
@@ -79,6 +80,7 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
super.handleMessage(msg); | |||
if(adapter!=null){ | |||
freshData(); | |||
adapter.setNewData(goodsList); | |||
adapter.notifyDataSetChanged(); | |||
} | |||
} | |||
@@ -221,7 +223,7 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
BPA_ORDER_GOODS_CLOUD goods = mData.get(position); | |||
if(goods.status != 0){ | |||
String title = "温馨提示!"; | |||
String message = "确定重新制作【"+getData().get(position).GoodsName+"】?"; | |||
String message = "确定重新制作【"+getData().get(position).GoodsName+","+getData().get(position).AttributeNames+"】?"; | |||
AlertDialogUtils.showDialog( getContext(), title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
@@ -242,7 +244,6 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
private void checkGoods(BPA_ORDER_GOODS_CLOUD goods){ | |||
ArrayList<ResGoodsRecipe> recipes= new ArrayList<>(); | |||
if (!ConfigName.TEST){ | |||
if (!ConfigName.getInstance().PlcIsConnect && !ConfigName.TEST2) { | |||
ToastUtils.warning("设备已离线,请检查设备..."); | |||
@@ -258,36 +259,36 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
ToastUtils.warning("请耐心等待上一商品制作完成..."); | |||
return; | |||
} | |||
} | |||
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(goods.AttributeIds, goods.GoodsId); | |||
if(goodsrecipename == null){ | |||
ToastUtils.warning("没有相关配方"); | |||
return; | |||
} | |||
recipes= QueryDB.GetGoodsSreciperecipeList(goodsrecipename.id); | |||
if(recipes.isEmpty() ){ | |||
ToastUtils.warning("没有配方数据"); | |||
return; | |||
} | |||
if(isDisable(recipes)){ | |||
return; | |||
} | |||
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(goods.AttributeIds, goods.GoodsId); | |||
if(goodsrecipename == null){ | |||
ToastUtils.warning("没有相关配方"); | |||
return; | |||
} | |||
ArrayList<ResGoodsRecipe> recipes = QueryDB.GetGoodsSreciperecipeList(goodsrecipename.id); | |||
if(recipes.isEmpty() ){ | |||
ToastUtils.warning("没有配方数据"); | |||
return; | |||
} | |||
if(isDisable(recipes)){ | |||
return; | |||
} | |||
for (int m = 0; m < recipes.size(); m++) { | |||
ResGoodsRecipe recipe = recipes.get(m); | |||
LogUtils.d("商品制作线程 recipe = "+recipe); | |||
//获取物料关联的料仓信息 | |||
List<BPA_SILOS> siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID); | |||
if(siloslist.isEmpty()){ | |||
ToastUtils.warning(recipe.materialName+"-物料没有绑定料仓"); | |||
return; | |||
} | |||
for (int m = 0; m < recipes.size(); m++) { | |||
ResGoodsRecipe recipe = recipes.get(m); | |||
LogUtils.d("商品制作线程 recipe = "+recipe); | |||
//获取物料关联的料仓信息 | |||
List<BPA_SILOS> siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID); | |||
if(siloslist.isEmpty()){ | |||
ToastUtils.warning(recipe.materialName+"-物料没有绑定料仓"); | |||
return; | |||
} | |||
} | |||
String title = "温馨提示!"; | |||
String message = "客官确定要开始制作【" +goods.GoodsName + "】吗?"; | |||
String message = "客官确定要开始制作【" +goods.GoodsName +","+goods.AttributeNames+ "】吗?"; | |||
QMUIDialog dialog = AlertDialogUtils.showDialog111(getContext(), title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
@@ -476,6 +477,14 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
addSubOrder(orderCloud,1); | |||
MediaPlayerHelper.getInstance().PlaySound(R.raw.pl_finish); | |||
} | |||
}else { | |||
if(ExecuteTheRecipe.IsMakeGood){ | |||
ToastUtils.error("请等待制作"); | |||
return; | |||
} | |||
if(recipes==null || recipes.isEmpty()){ | |||
ToastUtils.error("没有相关配方!"); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
@@ -484,7 +493,6 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
orderCloud.status = 3; | |||
CloudGoodsUtil.update(orderCloud); | |||
handler.sendEmptyMessage(0); | |||
addSubOrder(orderCloud,3); | |||
}finally { | |||
ExecuteTheRecipe.IsMakeGood=false; | |||
@@ -502,7 +510,7 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
} | |||
private void addSubOrder(BPA_ORDER_GOODS_CLOUD orderCloud,int status){ | |||
BPA_SUBORDER suborder = QueryDB.GetSubOrderId(orderCloud.id); | |||
BPA_SUBORDER suborder = QueryDB.GetById(orderCloud.id); | |||
if(suborder!=null){ | |||
suborder.deviceID = ConfigName.getInstance().DeviceId; | |||
suborder.userID = ConfigName.getInstance().user.userID; | |||
@@ -510,6 +518,7 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
suborder.isDevice = "false"; | |||
suborder.goodsID = orderCloud.GoodsId; | |||
suborder.goodsName = orderCloud.GoodsName; | |||
suborder.realMoney = (orderCloud.GoodsPrice==null||orderCloud.GoodsPrice.isEmpty())?0:Double.parseDouble(orderCloud.GoodsPrice); | |||
suborder.number = 1; | |||
suborder.status = status; | |||
suborder.isUpload = "false"; | |||
@@ -529,6 +538,7 @@ public class LookOrderGoodsDialog extends DialogFragment { | |||
suborder.number = 1; | |||
suborder.isUpload = "false"; | |||
suborder.status = status; | |||
suborder.realMoney = (orderCloud.GoodsPrice==null||orderCloud.GoodsPrice.isEmpty())?0:Double.parseDouble(orderCloud.GoodsPrice); | |||
suborder.numId = orderCloud.numId; | |||
suborder.exp = orderCloud.AttributeNames; | |||
suborder.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
@@ -273,6 +273,7 @@ public class add_makegood_control extends LinearLayout{ | |||
suborder.goodsID = ((BPA_GOODS) Good).id; | |||
suborder.recipeID=goodsrecipename.id; | |||
suborder.number = 1; | |||
suborder.isUpload = "false"; | |||
suborder.status = 0; | |||
suborder.numId = orderNum+""; | |||
orderNum++; | |||
@@ -283,6 +284,7 @@ public class add_makegood_control extends LinearLayout{ | |||
suborder.exp=names; | |||
suborder.goodsName=((BPA_GOODS) Good).name; | |||
suborder.realMoney = (((BPA_GOODS) Good).price==null || ((BPA_GOODS) Good).price.isEmpty())?0:Double.parseDouble(((BPA_GOODS) Good).price); | |||
QueryDB.AddSubOrder(suborder); | |||
DataBus.getInstance().AddGoodsMake(suborder); | |||
@@ -0,0 +1,50 @@ | |||
package com.bonait.bnframework.modules.home.util; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import java.io.File; | |||
import java.text.DecimalFormat; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/10/25 13:26. | |||
*/ | |||
public class FileUtil { | |||
/** | |||
* 获取数据库文件夹内存大小 | |||
* @return | |||
*/ | |||
public static String getCacheSize(){ | |||
String sizeString = ""; | |||
try { | |||
File folder = new File(ConfigName.getInstance().appResRoot); // 替换为你的文件夹路径 | |||
long folderSize = getFolderSize(folder); | |||
sizeString = formatSize(folderSize); // 将大小转换为可读的格式(可选) | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
} | |||
return sizeString; | |||
} | |||
public static long getFolderSize(File dir) { | |||
long size = 0; | |||
if (dir != null && dir.isDirectory()) { | |||
File[] files = dir.listFiles(); | |||
for (File file : files) { | |||
if (file.isFile()) { | |||
size += file.length(); | |||
} else if (file.isDirectory()) { | |||
size += getFolderSize(file); // 递归调用以获取子文件夹的大小 | |||
} | |||
} | |||
} | |||
return size; | |||
} | |||
public static String formatSize(long size) { | |||
if (size <= 0) return "0 Bytes"; | |||
final String[] units = {"Bytes", "KB", "MB", "GB", "TB"}; | |||
int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); | |||
return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; | |||
} | |||
} |
@@ -22,6 +22,7 @@ import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.RelativeLayout; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
@@ -116,6 +117,8 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
initUser(); | |||
initEvent(); | |||
initData(); | |||
int num = Runtime.getRuntime().availableProcessors(); | |||
LogUtils.d("availableProcessors num="+num); | |||
} | |||
/** | |||
@@ -322,6 +322,7 @@ | |||
android:gravity="center_vertical" | |||
android:textColor="@color/app_color_blue" | |||
android:layout_marginEnd="70dp" | |||
android:visibility="gone" | |||
/> | |||
<ImageView | |||
@@ -331,6 +332,7 @@ | |||
android:layout_centerVertical="true" | |||
android:layout_alignParentEnd="true" | |||
android:background="@mipmap/ic_arrow_down" | |||
android:visibility="gone" | |||
/> | |||
</RelativeLayout> | |||
</com.google.android.material.appbar.AppBarLayout> | |||