Commit 5b0327e5 by Wyh

1、供應鏈的食品列表,採購單列表,分類頁面功能,購物車

Signed-off-by: Wyh <1239658231>
parent c1f2f178
......@@ -27,36 +27,4 @@ public class BaseResult {
public void setSuccess(boolean success) {
this.success = success;
}
public long getSysTime() {
return sysTime;
}
public void setSysTime(long sysTime) {
this.sysTime = sysTime;
}
public String getErrCode() {
return errCode;
}
public void setErrCode(String errCode) {
this.errCode = errCode;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
......@@ -18,14 +18,14 @@ import android.util.Log
import android.widget.RemoteViews
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import com.gingersoft.gsa.cloud.common.R
import com.gingersoft.gsa.cloud.common.constans.AppConstans
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager
import com.gingersoft.gsa.cloud.common.core.user.UserContext
import com.gingersoft.gsa.cloud.common.R
import com.gingersoft.gsa.cloud.common.utils.SoundPoolUtils
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.common.constans.AppConstans
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans
import com.google.gson.Gson
import io.reactivex.Observable
import io.reactivex.Observer
......@@ -247,7 +247,7 @@ class GetInfoUpdateService : Service() {
override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
super.onClosing(webSocket, code, reason)
//連接斷開,
Log.e(TAG, "onClosing")
Log.e(TAG, "onClosing$reason")
putTimeLog("onClosing關閉連接")
}
......
......@@ -17,11 +17,24 @@ import com.jess.arms.utils.ArmsUtils;
import java.util.List;
public class AppDialog {
private static AppDialog appDialog;
public static AppDialog getInstance() {
if (appDialog == null) {
appDialog = new AppDialog();
}
return appDialog;
}
public void showWaringDialog(Context context, String title, DialogOnClickListenter sureOnclickListenter) {
showWaringDialog(context, title, null, null, sureOnclickListenter, null);
}
public void showWaringDialog(Context context, String title, DialogOnClickListenter sureOnclickListenter, DialogOnClickListenter cancelOnclickListenter) {
showWaringDialog(context, title, null, null, sureOnclickListenter, cancelOnclickListenter);
}
private void showWaringDialog(Context context, String title, String confimText, String cancelText, DialogOnClickListenter sureOnclickListenter, DialogOnClickListenter cancelOnclickListenter) {
new DialogUtils(context, R.layout.other_order_pause_orders) {
@Override
......@@ -63,7 +76,7 @@ public class AppDialog {
RadioListAdapter radioListAdapter = new RadioListAdapter(list);
radioListAdapter.setSelectIndex(defaultCheck);
showSelectDialog(context, title, 1, radioListAdapter, (view, dialog) -> {
if(onDialogSelectListener != null){
if (onDialogSelectListener != null) {
onDialogSelectListener.onclick(view, dialog, radioListAdapter.getSelectIndex());
}
});
......@@ -72,6 +85,7 @@ public class AppDialog {
public interface DialogOnClickListenter {
void onclick(View view, Dialog dialog);
}
public interface onDialogSelectListener {
void onclick(View view, Dialog dialog, int position);
}
......
......@@ -223,15 +223,14 @@ public class OkHttp3Utils {
* 版本,時間,RP_HD001,Gingersoft,GS1,26ErrorMsg:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
*/
public static void noticePersonnel(String errCode, String pushContent) {
String restaurantInfo =
"版本號:" + DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()) + "|" + DeviceUtils.getVersionCode(GsaCloudApplication.getAppContext()) +
"時間:" + TimeUtils.getCurrentDate(TimeUtils.DEFAULT_DATE_FORMAT) +
"報錯CODE:" + errCode +
"品牌名:" + ResturantInfoManager.newInstance().getBrandName() +
"餐廳名:" + ResturantInfoManager.newInstance().getRestaurantName() +
"餐廳ID:" + ResturantInfoManager.newInstance().getRestaurantId() +
"登陸人員:" + UserContext.newInstance().getMemberName() + "|" + UserContext.newInstance().getMemberId() +
"報錯原因:" + pushContent;
String restaurantInfo = DeviceUtils.getVersionName(GsaCloudApplication.getAppContext()) + "|" + DeviceUtils.getVersionCode(GsaCloudApplication.getAppContext()) +
"--" + TimeUtils.getCurrentDate(TimeUtils.DEFAULT_DATE_FORMAT) +
"--CODE:" + errCode +
"--餐廳:" + ResturantInfoManager.newInstance().getBrandName() +
"--" + ResturantInfoManager.newInstance().getRestaurantName() +
"--ID:" + ResturantInfoManager.newInstance().getRestaurantId() +
"--用戶:" + UserContext.newInstance().getMemberName() + "|" + UserContext.newInstance().getMemberId() +
"--原因:" + pushContent;
RequestBody requestBody = new FormBody.Builder()
.add("code", errCode)//錯誤碼
.add("shopId", ResturantInfoManager.newInstance().getGsPosShopId())
......
......@@ -100,27 +100,7 @@ public class TimePickerUtils {
}
public static TimePickerView showDatePicker(Context mContext, OnTimeSelectListener onTimeSelectListener) {
//獲取今年第一天的日期
//打開時間選擇器
TimePickerView pvTime = new TimePickerBuilder(mContext, onTimeSelectListener)
.setType(new boolean[]{true, true, true, false, false, false})//默认全部显示
.setCancelText("取消")//取消按钮文字
.setSubmitText("確認")//确认按钮文字
.setContentTextSize(20)//滚轮文字大小
.setTitleSize(20)//标题文字大小
.setOutSideCancelable(true)//点击屏幕,点在控件外部范围时,是否取消显示
.isCyclic(false)//是否循环滚动
.setTextColorCenter(Color.BLACK)//设置选中项的颜色
.setTitleColor(Color.BLACK)//标题文字颜色
.setSubmitColor(Color.BLUE)//确定按钮文字颜色
.setCancelColor(Color.BLUE)//取消按钮文字颜色
.setLabel("", "", "", "", "", "")
.isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
.build();
//設置默認選中時間
pvTime.setDate(Calendar.getInstance());//注:根据需求来决定是否使用该方法(一般是精确到秒的情况),此项可以在弹出选择器的时候重新设置当前时间,避免在初始化之后由于时间已经设定,导致选中时间与当前时间不匹配的问题。
pvTime.show();
return pvTime;
return showDatePicker(mContext, null, onTimeSelectListener);
}
public static TimePickerView showDatePicker(Context mContext, View view, OnTimeSelectListener onTimeSelectListener) {
......@@ -142,8 +122,13 @@ public class TimePickerUtils {
.isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
.build();
//設置默認選中時間
pvTime.setDate(Calendar.getInstance());//注:根据需求来决定是否使用该方法(一般是精确到秒的情况),此项可以在弹出选择器的时候重新设置当前时间,避免在初始化之后由于时间已经设定,导致选中时间与当前时间不匹配的问题。
pvTime.show(view);
//注:根据需求来决定是否使用该方法(一般是精确到秒的情况),此项可以在弹出选择器的时候重新设置当前时间,避免在初始化之后由于时间已经设定,导致选中时间与当前时间不匹配的问题。
pvTime.setDate(Calendar.getInstance());
if (view == null) {
pvTime.show();
} else {
pvTime.show(view);
}
return pvTime;
}
......
......@@ -4,6 +4,12 @@ import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.media.ExifInterface;
import android.net.Uri;
import android.util.Log;
......@@ -14,6 +20,8 @@ import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
......@@ -27,6 +35,7 @@ public class BitmapUtil {
/**
* 生成条码bitmap
*
* @param content
* @param format
* @param width
......@@ -34,10 +43,10 @@ public class BitmapUtil {
* @return
*/
public static Bitmap generateBitmap(String content, int format, int width, int height) {
if(content == null || content.equals(""))
if (content == null || content.equals(""))
return null;
BarcodeFormat barcodeFormat;
switch (format){
switch (format) {
case 0:
barcodeFormat = BarcodeFormat.UPC_A;
break;
......@@ -194,4 +203,142 @@ public class BitmapUtil {
}
return bitmap;
}
private static String PHOTO_FILE_NAME = "PMSManagerPhoto";
/**
* 获取图片的旋转角度
*
* @param filePath
* @return
*/
public static int getRotateAngle(String filePath) {
int rotate_angle = 0;
try {
ExifInterface exifInterface = new ExifInterface(filePath);
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
rotate_angle = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotate_angle = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
rotate_angle = 270;
break;
}
} catch (IOException e) {
e.printStackTrace();
}
return rotate_angle;
}
/**
* 旋转图片角度
*
* @param angle
* @param bitmap
* @return
*/
public static Bitmap setRotateAngle(int angle, Bitmap bitmap) {
if (bitmap != null) {
Matrix m = new Matrix();
m.postRotate(angle);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
return bitmap;
}
return bitmap;
}
/**
* 转换为圆形状的bitmap
* @param source
* @return
*/
public static Bitmap createCircleImage(Bitmap source) {
int length = source.getWidth() < source.getHeight() ? source.getWidth() : source.getHeight();
Paint paint = new Paint();
paint.setAntiAlias(true);
Bitmap target = Bitmap.createBitmap(length, length, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(target);
canvas.drawCircle(length / 2, length / 2, length / 2, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(source, 0, 0, paint);
return target;
}
/**
* 图片压缩-质量压缩
*
* @param filePath 源图片路径
* @return 压缩后的路径
*/
public static String compressImage(String filePath) {
//原文件
File oldFile = new File(filePath);
//压缩文件路径 照片路径/
String targetPath = oldFile.getPath();
//压缩比例0-100
int quality = 50;
//获取一定尺寸的图片
Bitmap bm = getSmallBitmap(filePath);
//获取相片拍摄角度
int degree = getRotateAngle(filePath);
//旋转照片角度,防止横着显示
if (degree != 0) {
bm = setRotateAngle(degree, bm);
}
File outputFile = new File(targetPath);
try {
if (!outputFile.exists()) {
File parentFile = outputFile.getParentFile();
if (parentFile != null) {
boolean mkdirs = parentFile.mkdirs();
}
} else {
boolean delete = outputFile.delete();
}
FileOutputStream out = new FileOutputStream(outputFile);
bm.compress(Bitmap.CompressFormat.JPEG, quality, out);
out.close();
} catch (Exception e) {
e.printStackTrace();
return filePath;
}
return outputFile.getPath();
}
/**
* 根据路径获得图片信息并按比例压缩,返回bitmap
*/
public static Bitmap getSmallBitmap(String filePath) {
final BitmapFactory.Options options = new BitmapFactory.Options();
//只解析图片边沿,获取宽高
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filePath, options);
// 计算缩放比
options.inSampleSize = calculateInSampleSize(options, 480, 800);
// 完整解析图片返回bitmap
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(filePath, options);
}
public static int calculateInSampleSize(BitmapFactory.Options options,
int reqWidth, int reqHeight) {
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int heightRatio = Math.round((float) height / (float) reqHeight);
final int widthRatio = Math.round((float) width / (float) reqWidth);
inSampleSize = Math.min(heightRatio, widthRatio);
}
return inSampleSize;
}
}
......@@ -2,9 +2,9 @@ package com.gingersoft.gsa.cloud.ui.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter;
......@@ -32,9 +32,11 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
private int selectColor = -1;
private int unSelectColor = -1;
private boolean showDelete = false;
public BaseCategoryAdapter(@Nullable List<CategoryBean> data, Context context) {
super(R.layout.item_category, data);
addChildClickViewIds(R.id.iv_category_delete);
selectedBg = ContextCompat.getDrawable(context, R.drawable.shape_left_radio_shadow);
unSelectedBg = ContextCompat.getDrawable(context, R.color.trans);
}
......@@ -43,13 +45,13 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
protected void convert(@NotNull BaseViewHolder viewHolder, CategoryBean categoryBean) {
TextView tvCategoryName = viewHolder.getView(R.id.tv_category_name);
tvCategoryName.setText(categoryBean.getCategoryName());
LinearLayout view = viewHolder.getView(R.id.layout_category);
CardView view = viewHolder.getView(R.id.layout_category);
if (viewHolder.getAdapterPosition() == selectedIndex) {
if (selectedBg != null) {
view.setBackground(selectedBg);
}
if (selectColor != -1) {
viewHolder.setTextColor(R.id.tv_category_name, selectColor);
tvCategoryName.setTextColor(selectColor);
}
tvCategoryName.setSelected(true);
} else {
......@@ -58,9 +60,15 @@ public class BaseCategoryAdapter extends BaseQuickAdapter<CategoryBean, BaseView
view.setBackground(unSelectedBg);
}
if (unSelectColor != -1) {
viewHolder.setTextColor(R.id.tv_category_name, unSelectColor);
tvCategoryName.setTextColor(unSelectColor);
}
}
viewHolder.setGone(R.id.iv_category_delete, !showDelete);
}
public void setShowDelete(boolean showDelete) {
this.showDelete = showDelete;
notifyDataSetChanged();
}
public BaseCategoryAdapter setSelectedBg(Drawable selectedBg) {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="@dimen/dp_1"
android:color="@color/dotted_color"
android:dashWidth="@dimen/dp_8"
android:dashGap="@dimen/dp_8" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/horizontal_dotted"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="@drawable/shape_dotted" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_category"
......@@ -9,22 +9,37 @@
android:layout_marginTop="@dimen/dp_15"
android:elevation="@dimen/dp_5"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
app:cardElevation="@dimen/dp_10">
<TextView
android:id="@+id/tv_category_name"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<TextView
android:id="@+id/tv_category_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_2"
android:singleLine="true"
android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="果蔬類" />
</LinearLayout>
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
android:id="@+id/iv_category_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_2"
android:singleLine="true"
android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="果蔬類" />
</LinearLayout>
android:paddingRight="@dimen/dp_5"
android:layout_gravity="right|center_vertical"
android:src="@drawable/ic_red_circular_delete" />
</androidx.cardview.widget.CardView>
\ No newline at end of file
......@@ -473,6 +473,7 @@
<color name="color_bf">#BFBFBF</color>
<color name="color_da">#DADADA</color>
<color name="color_68">#686868</color>
<color name="color_42">#424242</color>
<color name="color_222">#222222</color>
<color name="tran_twenty_send_order_btn_bg_color">#331196DB</color>
<color name="tran_fifty_order_state0_color">#7F009788</color>
......@@ -527,4 +528,6 @@
<color name="purchase_total_price_text_color">#EC2D2D</color>
<color name="purchase_buy_again_color">#6EC581</color>
</resources>
<color name="dotted_color">#9FA0A2</color>
</resources>
\ No newline at end of file
......@@ -452,7 +452,7 @@
<style name="Save_Btn_Style">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:background">@drawable/shape_app_btn_small_radius</item>
<item name="android:background">@drawable/shape_app_btn</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/dp_16</item>
......
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.SendMsgModule;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.SendMsgFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/08/2020 09:17
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = SendMsgModule.class, dependencies = AppComponent.class)
public interface SendMsgComponent {
void inject(SendMsgFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
SendMsgComponent.Builder view(SendMsgContract.View view);
SendMsgComponent.Builder appComponent(AppComponent appComponent);
SendMsgComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.StorageListModule;
import com.gingersoft.supply_chain.mvp.contract.StorageListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.StorageListFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/10/2020 18:09
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = StorageListModule.class, dependencies = AppComponent.class)
public interface StorageListComponent {
void inject(StorageListFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
StorageListComponent.Builder view(StorageListContract.View view);
StorageListComponent.Builder appComponent(AppComponent appComponent);
StorageListComponent build();
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.gingersoft.supply_chain.mvp.model.SendMsgModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/08/2020 09:17
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class SendMsgModule {
@Binds
abstract SendMsgContract.Model bindSendMsgModel(SendMsgModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.StorageListContract;
import com.gingersoft.supply_chain.mvp.model.StorageListModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/10/2020 18:09
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class StorageListModule {
@Binds
abstract StorageListContract.Model bindStorageListModel(StorageListModel model);
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.bean;
import java.util.List;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/9
* Time: 18:33
* Use: 根據分類獲取食材信息的接口返回數據
*/
@Data
public class FoodByCategoryResultBean {
private boolean success;
private long sysTime;
private String errMsg;
private List<PurchaseFoodListVosBean> data;
}
......@@ -52,6 +52,7 @@ public class FoodCategoryResultBean {
private String remarks;
private long createTime;
private long updateTime;
private int deletes;
/**
* 子類
*/
......
package com.gingersoft.supply_chain.mvp.bean;
import java.util.List;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/1
* Time: 18:14
* Use:
* implements Commodity
*/
@Data
public class FoodInfoBean {
private int brandId;
private int restaurantId;
private String foodNo;
private String name;
private String images;
//供應商名稱
private String supplierName;
private String foodCategoryName;
private Double unitPrice;
//是否需要審核
private boolean reviews;
private String remarks;
private InventoryAlarm inventoryAlarm;
@Data
public static class InventoryAlarm {
//庫存預警,單位id
private int foodUnitId;
//最低庫存
private int minimumInventory;
}
//包裝規格
private List<FoodPackingSpecificationBean> foodPackingSpecifications;
}
//package com.gingersoft.supply_chain.mvp.bean;
//
//import java.util.List;
//
//import lombok.Data;
//
///**
// * @author 宇航.
// * User: admin
// * Date: 2020/12/1
// * Time: 18:14
// * Use:
// * implements Commodity
// */
//@Data
//public class FoodInfoBean {
// private int brandId;
// private int restaurantId;
// private String foodNo;
// private String name;
// private String images;
// //供應商名稱
// private String supplierName;
// private String foodCategoryName;
// private Double unitPrice;
// //是否需要審核
// private boolean reviews;
// private String remarks;
// private InventoryAlarm inventoryAlarm;
// @Data
// public static class InventoryAlarm {
// //庫存預警,單位id
// private int foodUnitId;
// //最低庫存
// private int minimumInventory;
// }
// //包裝規格
// private List<FoodPackingSpecificationBean> foodPackingSpecifications;
//
//
//}
......@@ -13,9 +13,15 @@ import lombok.Data;
public class OrderBean {
private int id;
private int uid;
private int orderNo;
private int foodCount;
private String orderNo;
//訂單內的食品
private String name;
private int purchaseFoodCount;
private double totalAmount;
private int status;
private int createTime;
private boolean visibleState;
private String remarks;
private long updateTime;
private long createTime;
private int deletes;
}
package com.gingersoft.supply_chain.mvp.bean;
import java.util.List;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/8
* Time: 16:24
* Use: 下單頁面的分類
*/
@Data
public class OrderCategoryBean {
private boolean success;
private long sysTime;
private String errMsg;
private List<FoodCategoryTrees> data;
@Data
public static class FoodCategoryTrees {
private int id;
private String name;
private int parentId;
private List<FoodCategoryTrees> foodCategoryTrees;
}
}
......@@ -2,6 +2,9 @@ package com.gingersoft.supply_chain.mvp.bean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
......@@ -12,7 +15,8 @@ import lombok.Data;
* Use:食材信息
*/
@Data
public class PurchaseFoodListVosBean {
public class PurchaseFoodListVosBean implements Serializable {
private static final long serialVersionUID = 7084280906070243339L;
private int id;
private String supplierName;
private String images;
......@@ -20,6 +24,8 @@ public class PurchaseFoodListVosBean {
private String name;
private double unitPrice;
private String foodCategoryName;
private String remarks;
private int quantityStarts;
private int quantityEnd;
private int type;
......@@ -47,6 +53,20 @@ public class PurchaseFoodListVosBean {
*
*/
private int deletes;
private int restaurantId;
private int brandId;
private InventoryAlarm inventoryAlarm;
@Data
public static class InventoryAlarm {
//庫存預警,單位id
private int foodUnitId;
//最低庫存
private int minimumInventory;
}
//包裝規格
private List<FoodPackingSpecificationBean> foodPackingSpecifications;
public boolean isChecked() {
return isChecked;
......
......@@ -32,9 +32,6 @@ public class SupplierInfoBean implements Serializable {
private long updateTime;
private int deletes;
public static final int DELETE = 1;
public static final int NORMAL = 0;
private List<SupplierContacts> supplierContacts;
public SupplierInfoBean(String supplierName, String address, String contactInformation, String contacts, String createDate) {
......
......@@ -16,9 +16,15 @@ public class Constant {
public static final int DELETE = 1;
public static final int NORMAL = 0;
public static void mapAddInfo(Map<String, Object> map){
map.put("restaurantId", ResturantInfoManager.newInstance().getRestaurantId());
public static void addBrandId(Map<String, Object> map) {
map.put("brandId", ResturantInfoManager.newInstance().getBrandId());
}
public static void addRestaurantId(Map<String, Object> map) {
map.put("restaurantId", ResturantInfoManager.newInstance().getRestaurantId());
}
public static void addPageSize(Map<String, Object> map) {
map.put("pageSize", 10);
}
......
package com.gingersoft.supply_chain.mvp.content;
import android.util.Log;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
/**
* @author 宇航.
......@@ -12,7 +15,7 @@ import java.util.List;
* Time: 11:21
* Use: 供應鏈購物車,需要緩存用戶選中的食品
*/
public class SupplyShoppingCart {
public class SupplyShoppingCart extends Observable {
/**
* key為食品id
* value為食品信息
......@@ -21,6 +24,8 @@ public class SupplyShoppingCart {
private static SupplyShoppingCart shoppingCart;
private int goodsNumber = 0;
public static SupplyShoppingCart getInstance() {
if (shoppingCart == null) {
shoppingCart = new SupplyShoppingCart();
......@@ -32,6 +37,10 @@ public class SupplyShoppingCart {
if (cartFoods == null) {
cartFoods = new ArrayList<>();
}
if (cartFoods.size() != goodsNumber) {
notifyObservers(cartFoods.size());
goodsNumber = cartFoods.size();
}
return cartFoods;
}
......
......@@ -28,6 +28,8 @@ public interface CategoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadCategoryInfo(List<FoodCategoryResultBean.DataBean.FoodCategoryBean> list, int hierarchy);
void refreshInfo(int hierarchy, int position);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......@@ -35,5 +37,7 @@ public interface CategoryContract {
Observable<FoodCategoryResultBean> getFoodCategoryList(Map<String, Object> map);
Observable<BaseResult> createFoodCategory(RequestBody requestBody);
Observable<BaseResult> updateFoodCategory(RequestBody requestBody);
}
}
......@@ -2,7 +2,9 @@ package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
......@@ -33,7 +35,21 @@ public interface FoodIngredientsContract {
void loadRightFoodIngredients(List<PurchaseFoodListVosBean> purchaseFoodListVOS);
/**
* 刪除食品成功回調
*
* @param position
*/
void onDeleteFoodSuccess(int position);
/**
* 加載左側分類
*
* @param foodCategoryTrees 所有分類層級信息
*/
void loadCategory(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees);
void loadFail();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......@@ -43,5 +59,9 @@ public interface FoodIngredientsContract {
Observable<BaseResult> getFoodBySupplierId(Map<String, Object> map);
Observable<BaseResult> updateFood(RequestBody requestBody);
Observable<OrderCategoryBean> getCategoryTrees(Map<String, Object> map);
Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map);
}
}
......@@ -29,6 +29,8 @@ public interface NewFoodIngredientsContract {
void refreshAdapterByPosition(int position);
void uploadPicSuccess(List<String> picUrl);
void saveFoodInfoSuccess();
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.OrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.jess.arms.mvp.IModel;
......@@ -9,6 +10,7 @@ import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
......@@ -27,10 +29,14 @@ public interface PurchaseListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadOrderList(List<OrderBean> list);
void deleteOrder(int position);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<PurchaseOrderResultBean> getOrderList(Map<String, Object> map);
Observable<BaseResult> updateOrder(RequestBody requestBody);
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/08/2020 09:17
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface SendMsgContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
package com.gingersoft.supply_chain.mvp.contract;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/10/2020 18:09
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface StorageListContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
}
}
......@@ -60,4 +60,9 @@ public class CategoryModel extends BaseModel implements CategoryContract.Model {
public Observable<BaseResult> createFoodCategory(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addFoodCategory(requestBody);
}
@Override
public Observable<BaseResult> updateFoodCategory(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateFoodCategory(requestBody);
}
}
\ No newline at end of file
......@@ -3,7 +3,9 @@ package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.contract.FoodIngredientsContract;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson;
......@@ -65,4 +67,15 @@ public class FoodIngredientsModel extends BaseModel implements FoodIngredientsCo
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateFood(requestBody);
}
@Override
public Observable<OrderCategoryBean> getCategoryTrees(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getCategoryTrees(map);
}
@Override
public Observable<FoodByCategoryResultBean> getFoodByCategory(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getFoodByCategory(map);
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.gingersoft.supply_chain.mvp.contract.PurchaseListContract;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
......@@ -15,6 +16,7 @@ import java.util.Map;
import javax.inject.Inject;
import io.reactivex.Observable;
import okhttp3.RequestBody;
/**
......@@ -52,4 +54,9 @@ public class PurchaseListModel extends BaseModel implements PurchaseListContract
public Observable<PurchaseOrderResultBean> getOrderList(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getOrderList(map);
}
@Override
public Observable<BaseResult> updateOrder(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateOrder(requestBody);
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/08/2020 09:17
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class SendMsgModel extends BaseModel implements SendMsgContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public SendMsgModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.StorageListContract;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/10/2020 18:09
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class StorageListModel extends BaseModel implements StorageListContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public StorageListModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
}
\ No newline at end of file
......@@ -2,12 +2,12 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.CategoryContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
......@@ -164,12 +164,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
}
public void addCategory(int parentId, String categoryName, int hierarchy) {
FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean = new FoodCategoryResultBean.DataBean.FoodCategoryBean();
foodCategoryBean.setBrandId(ResturantInfoManager.newInstance().getBrandId());
foodCategoryBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
foodCategoryBean.setName(categoryName);
foodCategoryBean.setParentId(parentId);
FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean = toFoodCategoryBean(parentId, categoryName, 0);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(foodCategoryBean));
mModel.createFoodCategory(requestBody)
.subscribeOn(Schedulers.io())
......@@ -194,4 +189,47 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
}
});
}
public FoodCategoryResultBean.DataBean.FoodCategoryBean toFoodCategoryBean(int parentId, String categoryName, int id) {
FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean = new FoodCategoryResultBean.DataBean.FoodCategoryBean();
foodCategoryBean.setBrandId(ResturantInfoManager.newInstance().getBrandId());
foodCategoryBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
foodCategoryBean.setName(categoryName);
foodCategoryBean.setParentId(parentId);
foodCategoryBean.setId(id);
return foodCategoryBean;
}
public void deleteFoodCategory(FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean, int hierarchy, int position) {
foodCategoryBean.setDeletes(Constant.DELETE);
updateFoodCategory(foodCategoryBean, hierarchy, position);
}
/**
* @param foodCategoryBean
* @param hierarchy 修改的是第幾級分類
* @param position 分類的位置
*/
public void updateFoodCategory(FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean, int hierarchy, int position) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(foodCategoryBean));
mModel.updateFoodCategory(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("修改中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) {
mRootView.refreshInfo(hierarchy, position);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("修改失敗");
}
}
});
}
}
......@@ -7,7 +7,9 @@ import com.gingersoft.gsa.cloud.common.core.restaurant.ResturantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.bean.view.CategoryBean;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
......@@ -62,6 +64,10 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
* 如果通過在map中有食品,就不用再次調用接口
*/
private Map<Integer, List<PurchaseFoodListVosBean>> supplierFoodsMap;
/**
* 分類數據,之後通過分類獲取對應下面的食品
*/
private List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees;
@Inject
public FoodIngredientsPresenter(FoodIngredientsContract.Model model, FoodIngredientsContract.View rootView) {
......@@ -105,7 +111,7 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
if (info.isSuccess() && info.getData() != null) {
List<CategoryBean> categoryBeans = new ArrayList<>();
if (supplierFoodsMap == null) {
supplierFoodsMap = new HashMap<>();
supplierFoodsMap = new HashMap<>(5);
}
for (FoodListInfoBean.DataBean datum : info.getData()) {
//將供應商信息轉為左側用來顯示的數據類型
......@@ -214,20 +220,29 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
cartFoods.addAll(integerMap.values());
}
public void deleteFood(PurchaseFoodListVosBean purchaseFoodListVosBean, int position){
/**
* 刪除食品
*
* @param purchaseFoodListVosBean
* @param position
*/
public void deleteFood(PurchaseFoodListVosBean purchaseFoodListVosBean, int position) {
purchaseFoodListVosBean.setDeletes(Constant.DELETE);
purchaseFoodListVosBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
purchaseFoodListVosBean.setBrandId(ResturantInfoManager.newInstance().getBrandId());
mModel.updateFood(RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(purchaseFoodListVosBean)))
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("刪除中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(()->mRootView.hideLoading())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if(baseResult.isSuccess()){
if (baseResult.isSuccess()) {
mRootView.onDeleteFoodSuccess(position);
} else if(TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())){
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage("刪除失敗");
......@@ -235,4 +250,68 @@ public class FoodIngredientsPresenter extends BasePresenter<FoodIngredientsContr
}
});
}
/**
* 獲取分類的結構
*/
public void getCategoryTrees() {
if (foodCategoryTrees != null) {
mRootView.loadCategory(foodCategoryTrees);
return;
}
Map<String, Object> map = new HashMap<>(2);
Constant.addBrandId(map);
Constant.addRestaurantId(map);
mModel.getCategoryTrees(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<OrderCategoryBean>(mErrorHandler) {
@Override
public void onNext(OrderCategoryBean orderCategoryBean) {
if (orderCategoryBean.isSuccess()) {
foodCategoryTrees = new ArrayList<>();
foodCategoryTrees.addAll(orderCategoryBean.getData());
mRootView.loadCategory(orderCategoryBean.getData());
} else if (TextUtil.isNotEmptyOrNullOrUndefined(orderCategoryBean.getErrMsg())) {
mRootView.showMessage(orderCategoryBean.getErrMsg());
} else {
mRootView.showMessage("獲取失敗,請稍候重試");
}
}
});
}
public void getFoodByCategory(int categoryId) {
Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000);
map.put("pageIndex", 0);
Constant.addBrandId(map);
Constant.addRestaurantId(map);
map.put("parentId", categoryId);
mModel.getFoodByCategory(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<FoodByCategoryResultBean>(mErrorHandler) {
@Override
public void onNext(@NonNull FoodByCategoryResultBean info) {
if (info.isSuccess()) {
mRootView.loadRightFoodIngredients(info.getData());
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
mRootView.loadFail();
} else {
mRootView.loadFail();
}
}
});
}
}
......@@ -11,10 +11,11 @@ import com.gingersoft.gsa.cloud.common.ui.bean.InfoMultiBean;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil;
import com.gingersoft.gsa.cloud.ui.bean.view.SectionCheckItem;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.FoodInfoBean;
import com.gingersoft.supply_chain.mvp.bean.FoodPackingSpecificationBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.contract.NewFoodIngredientsContract;
import com.gingersoft.supply_chain.mvp.ui.fragment.CategorySelectFragment;
......@@ -28,6 +29,7 @@ import com.jess.arms.utils.RxLifecycleUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
......@@ -98,7 +100,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
this.mApplication = null;
}
public List<InfoMultiBean> getFragmentInfo() {
public List<InfoMultiBean> getFragmentInfo(PurchaseFoodListVosBean purchaseFoodListVosBean) {
List<InfoMultiBean> infoMultiBeans = new ArrayList<>();
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "商品圖片"));
......@@ -118,9 +120,31 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "備註"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_MULTIPLE_INPUT_REMARK, "", false, "請輸入備註"));
if (purchaseFoodListVosBean != null) {
infoMultiBeans.get(supplierIndex).setShowValue(purchaseFoodListVosBean.getSupplierName());
infoMultiBeans.get(foodNameIndex).setShowValue(purchaseFoodListVosBean.getName());
infoMultiBeans.get(packageSpecificationIndex).setShowValue(purchaseFoodListVosBean.getUnitContent());
infoMultiBeans.get(foodNoIndex).setShowValue(purchaseFoodListVosBean.getFoodNo());
infoMultiBeans.get(foodIngredientCategoryIndex).setShowValue("選擇分類");
infoMultiBeans.get(foodIngredientPriceIndex).setShowValue(purchaseFoodListVosBean.getUnitPrice() + "");
infoMultiBeans.get(inventoryAlarmUnitIndex).setShowValue("收貨單位");
infoMultiBeans.get(mixInventoryIndex).setShowValue("1");
infoMultiBeans.get(remarkIndex).setShowValue("備註");
setPicUrl(infoMultiBeans, Collections.singletonList(purchaseFoodListVosBean.getImages()));
}
return infoMultiBeans;
}
public void setPicUrl(List<InfoMultiBean> data, List<String> picUrls) {
InfoMultiBean infoMultiBean = data.get(picIndex);
if (infoMultiBean instanceof UploadPicMultiBean) {
UploadPicMultiBean uploadPicMultiBean = (UploadPicMultiBean) infoMultiBean;
uploadPicMultiBean.setPicUrl(picUrls);
mRootView.refreshAdapterByPosition(picIndex);
}
}
/**
* 設置供應商信息
*
......@@ -162,11 +186,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
}
public void uploadPic(String filePath) {
File file = new File(filePath);
if (file.length() > 100 * 1024) {
mRootView.showMessage("請選擇100k以內大小的圖片");
return;
}
File file = new File(BitmapUtil.compressImage(filePath));
List<MultipartBody.Part> multipartBodies = new ArrayList<>();
multipartBodies.add(MultipartBody.Part.createFormData("files", file.getName(), RequestBody.create(MediaType.parse("image/png"), file)));
mModel.upLoadPic(multipartBodies)
......@@ -193,10 +213,10 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
/**
* 添加食品
*
* @param foodInfoBean
* @param purchaseFoodListVosBean
*/
public void addFoodInfo(FoodInfoBean foodInfoBean) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(foodInfoBean));
public void addFoodInfo(PurchaseFoodListVosBean purchaseFoodListVosBean) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(purchaseFoodListVosBean));
mModel.addFood(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("保存中..."))
......@@ -209,7 +229,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) {
mRootView.showMessage("保存成功");
mRootView.killMyself();
mRootView.saveFoodInfoSuccess();
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
......@@ -236,8 +256,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
return msg;
}
public FoodInfoBean getFoodInfoByInfoMulti(List<InfoMultiBean> infoMultiBeans) {
FoodInfoBean foodInfoBean = new FoodInfoBean();
public PurchaseFoodListVosBean getFoodInfoByInfoMulti(List<InfoMultiBean> infoMultiBeans) {
PurchaseFoodListVosBean foodInfoBean = new PurchaseFoodListVosBean();
foodInfoBean.setBrandId(ResturantInfoManager.newInstance().getBrandId());
foodInfoBean.setRestaurantId(ResturantInfoManager.newInstance().getRestaurantId());
foodInfoBean.setFoodNo(infoMultiBeans.get(foodNoIndex).getShowValue());
......@@ -250,7 +270,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
foodInfoBean.setUnitPrice(Double.parseDouble(infoMultiBeans.get(foodIngredientPriceIndex).getShowValue()));
// foodInfoBean.setReviews("是否需要審核");
foodInfoBean.setRemarks(infoMultiBeans.get(remarkIndex).getShowValue());
FoodInfoBean.InventoryAlarm inventoryAlarm = new FoodInfoBean.InventoryAlarm();
PurchaseFoodListVosBean.InventoryAlarm inventoryAlarm = new PurchaseFoodListVosBean.InventoryAlarm();
// inventoryAlarm.setFoodUnitId();
if (TextUtil.isNotEmptyOrNullOrUndefined(infoMultiBeans.get(mixInventoryIndex).getShowValue())) {
inventoryAlarm.setMinimumInventory(Integer.parseInt(infoMultiBeans.get(mixInventoryIndex).getShowValue()));
......
......@@ -2,7 +2,10 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.OrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.PurchaseListContract;
......@@ -22,6 +25,8 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
/**
......@@ -54,7 +59,10 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
public void getOrderList(String orderNo, int orderStatus, int pageIndex) {
Map<String, Object> map = new HashMap<>(6);
Constant.mapAddInfo(map);
Constant.addRestaurantId(map);
Constant.addBrandId(map);
Constant.addPageSize(map);
if (TextUtil.isNotEmptyOrNullOrUndefined(orderNo)) {
map.put("orderNo", orderNo);
}
......@@ -78,4 +86,25 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
}
});
}
public void deleteOrder(int position, OrderBean orderBean){
orderBean.setDeletes(Constant.DELETE);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(orderBean));
mModel.updateOrder(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if(info.isSuccess()){
mRootView.deleteOrder(position);
}
}
});
}
}
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/08/2020 09:17
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class SendMsgPresenter extends BasePresenter<SendMsgContract.Model, SendMsgContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public SendMsgPresenter(SendMsgContract.Model model, SendMsgContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
}
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.supply_chain.mvp.contract.StorageListContract;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import javax.inject.Inject;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/10/2020 18:09
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class StorageListPresenter extends BasePresenter<StorageListContract.Model, StorageListContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public StorageListPresenter(StorageListContract.Model model, StorageListContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
/**
* 獲取入庫單列表
*/
public void getStorageList(){
}
}
package com.gingersoft.supply_chain.mvp.server;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.FoodByCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodCategoryResultBean;
import com.gingersoft.supply_chain.mvp.bean.FoodListInfoBean;
import com.gingersoft.supply_chain.mvp.bean.MeasurementUnitBean;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderResultBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierResultBean;
......@@ -113,6 +115,15 @@ public interface SupplierServer {
Observable<BaseResult> addFoodCategory(@Body RequestBody requestBody);
/**
* 修改分類
* @param requestBody
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@POST("foodCategory/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updateFoodCategory(@Body RequestBody requestBody);
/**
* 上傳圖片
* @param parts
* @return
......@@ -167,8 +178,24 @@ public interface SupplierServer {
@GET("purchaseOrder/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<PurchaseOrderResultBean> getOrderList(@QueryMap Map<String, Object> map);
/**
* 修改採購單信息
* @param requestBody
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@POST("purchaseOrder/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> updateOrder(@Body RequestBody requestBody);
/**
* 獲取下單頁面的分類結構
* @param map
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("foodCategory/tree/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<OrderCategoryBean> getCategoryTrees(@QueryMap Map<String, Object> map);
/**
* 新增採購訂單
* @param requestBody
* @return
......@@ -176,4 +203,13 @@ public interface SupplierServer {
@Headers({"Domain-Name: ricepon-purchase"})
@POST("purchaseOrder/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addNewPurchaseOrder(@Body RequestBody requestBody);
/**
* 獲取下單頁面的分類結構
* @param map
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("foodCategory/subset/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<FoodByCategoryResultBean> getFoodByCategory(@QueryMap Map<String, Object> map);
}
......@@ -3,6 +3,7 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
......@@ -56,12 +57,22 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
integerMap = new HashMap<>(8);
}
public FoodListAdapter(int layoutId, Context context, @Nullable List<PurchaseFoodListVosBean> data, int adapterType) {
super(layoutId, data);
addChildClickViewIds(R.id.iv_supplier_edit, R.id.iv_supplier_delete, R.id.iv_order_food_delete);
this.context = context;
this.adapterType = adapterType;
integerMap = new HashMap<>(8);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseFoodListVosBean foodInfoBean) {
viewHolder.setText(R.id.tv_food_item_supplier_name, foodInfoBean.getSupplierName());
ImageView foodImg = viewHolder.getView(R.id.iv_food_ingredient_img);
if (TextUtil.isNotEmptyOrNullOrUndefined(foodInfoBean.getImages())) {
GlideUtils.display(context, foodImg, foodInfoBean.getImages());
} else {
foodImg.setVisibility(View.INVISIBLE);
}
viewHolder.setText(R.id.tv_food_item_no, foodInfoBean.getFoodNo());
viewHolder.setText(R.id.tv_food_item_name, foodInfoBean.getName());
......@@ -70,27 +81,21 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
if (adapterType == FOOD_INGREDIENTS) {
viewHolder.setGone(R.id.iv_supplier_edit, false);
viewHolder.setGone(R.id.iv_supplier_delete, false);
viewHolder.setGone(R.id.layout_food_supplier_info, false);
viewHolder.setGone(R.id.layout_operation_food_num, true);
viewHolder.setGone(R.id.cb_order_item_all_select, true);
viewHolder.setGone(R.id.iv_order_food_delete, true);
viewHolder.setGone(R.id.line_supplier_info, false);
} else if (adapterType == ADD_ORDER) {
viewHolder.setGone(R.id.iv_supplier_edit, true);
viewHolder.setGone(R.id.iv_supplier_delete, true);
viewHolder.setGone(R.id.layout_operation_food_num, false);
viewHolder.setGone(R.id.layout_food_supplier_info, false);
viewHolder.setGone(R.id.cb_order_item_all_select, true);
viewHolder.setGone(R.id.iv_order_food_delete, true);
viewHolder.setGone(R.id.line_supplier_info, false);
setEdit(viewHolder, foodInfoBean);
} else if (adapterType == ORDER_TYPE) {
viewHolder.setGone(R.id.iv_supplier_edit, false);
viewHolder.setGone(R.id.iv_supplier_delete, false);
viewHolder.setGone(R.id.layout_operation_food_num, false);
viewHolder.setGone(R.id.layout_food_supplier_info, true);
viewHolder.setGone(R.id.cb_order_item_all_select, false);
viewHolder.setGone(R.id.iv_order_food_delete, false);
viewHolder.setGone(R.id.line_supplier_info, true);
setEdit(viewHolder, foodInfoBean);
CheckBox checkBox = viewHolder.getView(R.id.cb_order_item_all_select);
......@@ -105,6 +110,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
private OnCheckedChangeListener onCheckedChangeListener;
private OnNumberChangeListener onNumberChangeListener;
private TextWatcher foodNumTextWatcher;
public interface OnCheckedChangeListener {
/**
......@@ -121,10 +127,11 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
/**
* 當食品數量發生變化時調用
*
* @param foodId 食品ID
* @param number 食品數量
* @param foodId 食品ID
* @param number 食品數量
* @param position 操作的食品下標
*/
void onChanged(int foodId, int number);
void onChanged(int foodId, int number, int position);
}
public void setOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener) {
......@@ -167,7 +174,7 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
// addNumber(editText, foodInfoBean);
// return true;
// });
editText.addTextChangedListener(new TextWatcher() {
foodNumTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
......@@ -186,17 +193,19 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodListVosBean, B
editText.setText(String.valueOf(0));
editText.setSelection(editText.getText().length());
if (onNumberChangeListener != null) {
onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), 0);
onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), 0, viewHolder.getAdapterPosition());
}
} else {
purchaseFoodListVosBean.setFoodCount(Integer.parseInt(s.toString()));
integerMap.put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean);
if (onNumberChangeListener != null) {
onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), Integer.parseInt(s.toString()));
onNumberChangeListener.onChanged(purchaseFoodListVosBean.getId(), Integer.parseInt(s.toString()), viewHolder.getAdapterPosition());
}
}
}
});
};
editText.removeTextChangedListener(foodNumTextWatcher);
editText.addTextChangedListener(foodNumTextWatcher);
}
public void setOnNumberChangeListener(OnNumberChangeListener onNumberChangeListener) {
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.view.View;
import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.OrderCategoryBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/8
* Time: 16:19
* Use:
*/
public class OrderCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCategoryTrees, BaseViewHolder> {
private int selectIndex = -1;
private Context context;
private int lastSelectIndex = -1;
public final int PRIMARY_CATEGORY = 1;
public final int SECOND_CATEGORY = 2;
/**
* 當前顯示的是幾級分類
*/
private int currentLevelCategory = PRIMARY_CATEGORY;
public OrderCategoryAdapter(Context context, @Nullable List<OrderCategoryBean.FoodCategoryTrees> data) {
super(R.layout.item_order_category, data);
this.context = context;
addChildClickViewIds(R.id.layout_order_category_back);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees) {
viewHolder.setText(R.id.tv_category_name, foodCategoryTrees.getName());
viewHolder.setGone(R.id.order_primary_category_line, viewHolder.getAdapterPosition() == selectIndex);
RecyclerView rvSecondCategory = viewHolder.getView(R.id.rv_order_second_category);
CardView bgLayout = viewHolder.getView(R.id.layout_category);
//是否顯示返回鍵
if (viewHolder.getAdapterPosition() == 0) {
viewHolder.setGone(R.id.layout_order_category_back, currentLevelCategory == PRIMARY_CATEGORY);
} else {
viewHolder.setGone(R.id.layout_order_category_back, true);
}
if (selectIndex == viewHolder.getAdapterPosition()) {
//選中並且有子類
if (foodCategoryTrees.getFoodCategoryTrees() != null && foodCategoryTrees.getFoodCategoryTrees().size() > 0) {
viewHolder.setGone(R.id.order_primary_category_line, false);
//設置子類的數據
SecondAdapter secondAdapter = new SecondAdapter(context, foodCategoryTrees.getFoodCategoryTrees());
rvSecondCategory.setAdapter(secondAdapter);
rvSecondCategory.setVisibility(View.VISIBLE);
secondAdapter.setOnItemClickListener((adapter, view, position) -> {
//二級分類被點擊時,重新設置一級的數據,二級變為一級,三級變成二級
secondAdapter.setSelectedIndex(position);
if (onSecondCategoryClickListener != null) {
onSecondCategoryClickListener.onClick(getData().get(viewHolder.getAdapterPosition()).getFoodCategoryTrees(), position);
}
});
} else {
rvSecondCategory.setAdapter(null);
viewHolder.setGone(R.id.order_primary_category_line, true);
}
viewHolder.setTextColor(R.id.tv_category_name, ContextCompat.getColor(context, R.color.order_category_name_select_color));
bgLayout.setBackground(ContextCompat.getDrawable(context, R.drawable.shape_left_radio_shadow));
} else {
//隱藏豎線
viewHolder.setGone(R.id.order_primary_category_line, true);
viewHolder.setTextColor(R.id.tv_category_name, ContextCompat.getColor(context, R.color.order_category_name_unselect_color));
//沒有被選中時,去掉背景,去掉子類
bgLayout.setBackground(null);
rvSecondCategory.setVisibility(View.GONE);
rvSecondCategory.setAdapter(null);
}
}
public void setSelectIndex(int selectIndex) {
this.selectIndex = selectIndex;
if (lastSelectIndex != -1 && lastSelectIndex < getData().size()) {
notifyItemChanged(lastSelectIndex);
}
if (selectIndex != -1 && selectIndex < getData().size()) {
notifyItemChanged(selectIndex);
}
lastSelectIndex = selectIndex;
}
public OnSecondCategoryClickListener onSecondCategoryClickListener;
public interface OnSecondCategoryClickListener {
void onClick(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees, int position);
}
public void setOnSecondCategoryClickListener(OnSecondCategoryClickListener onSecondCategoryClickListener) {
this.onSecondCategoryClickListener = onSecondCategoryClickListener;
}
public int getSelectIndex() {
return selectIndex;
}
public int getCurrentLevelCategory() {
return currentLevelCategory;
}
public void setCurrentLevelCategory(int currentLevelCategory) {
this.currentLevelCategory = currentLevelCategory;
}
public static class SecondAdapter extends BaseQuickAdapter<OrderCategoryBean.FoodCategoryTrees, BaseViewHolder> {
private int selectedIndex = -1;
private int lastSelectIndex = -1;
private Context context;
public SecondAdapter(Context context, @Nullable List<OrderCategoryBean.FoodCategoryTrees> data) {
super(R.layout.item_order_second_category, data);
this.context = context;
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, OrderCategoryBean.FoodCategoryTrees foodCategoryTrees) {
viewHolder.setText(R.id.tv_order_second_category_name, foodCategoryTrees.getName());
if (selectedIndex == viewHolder.getAdapterPosition()) {
viewHolder.setTextColor(R.id.tv_order_second_category_name, ContextCompat.getColor(context, R.color.white));
viewHolder.setBackgroundColor(R.id.layout_second_category, ContextCompat.getColor(context, R.color.theme_color));
} else {
viewHolder.setTextColor(R.id.tv_order_second_category_name, ContextCompat.getColor(context, R.color.order_category_name_unselect_color));
viewHolder.setBackgroundColor(R.id.layout_second_category, ContextCompat.getColor(context, R.color.trans));
}
viewHolder.setVisible(R.id.order_category_second_bottom_line, viewHolder.getAdapterPosition() != getData().size() - 1);
}
public void setSelectedIndex(int selectedIndex) {
this.selectedIndex = selectedIndex;
if (lastSelectIndex != -1 && lastSelectIndex < getData().size()) {
notifyItemChanged(lastSelectIndex);
}
if (selectedIndex != -1 && selectedIndex < getData().size()) {
notifyItemChanged(selectedIndex);
}
lastSelectIndex = selectedIndex;
}
}
}
......@@ -22,16 +22,15 @@ public class PurchaseOrderAdapter extends BaseQuickAdapter<OrderBean, BaseViewHo
public PurchaseOrderAdapter(@Nullable List<OrderBean> data) {
super(R.layout.item_purchase_order, data);
addChildClickViewIds(R.id.btn_purchase_send, R.id.btn_purchase_buy_again, R.id.btn_receiver_goods);
addChildClickViewIds(R.id.iv_supplier_delete, R.id.btn_purchase_send, R.id.btn_purchase_buy_again, R.id.btn_receiver_goods);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, OrderBean purchaseOrderBean) {
viewHolder.setText(R.id.tv_purchase_order_no, "" + purchaseOrderBean.getOrderNo());
viewHolder.setText(R.id.tv_purchase_order_create_time, TimeUtils.getTime(purchaseOrderBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT_YMDHM));
viewHolder.setText(R.id.tv_purchase_order_goods_num, purchaseOrderBean.getFoodCount() + "");
// viewHolder.setText(R.id.tv_purchase_order_goods, purchaseOrderBean.getFoods());
viewHolder.setText(R.id.tv_purchase_order_goods_num, purchaseOrderBean.getPurchaseFoodCount() + "");
viewHolder.setText(R.id.tv_purchase_order_goods, purchaseOrderBean.getName());
viewHolder.setText(R.id.tv_purchase_order_total_price, purchaseOrderBean.getTotalAmount() + "");
// viewHolder.setText(R.id.tv_purchase_order_time_out, purchaseOrderBean.getTotal() + "");
}
}
......@@ -31,11 +31,11 @@ import com.gingersoft.supply_chain.R;
*/
public class PurchasePageAdapter extends RecyclerView.Adapter<PurchasePageAdapter.ViewHolder> {
private PurchaseOrderAdapter adapter;
private RecyclerView.Adapter adapter;
private int pageSize;
private AdapterView.OnItemClickListener mOnItemClickListener;
public PurchasePageAdapter(PurchaseOrderAdapter adapter, int pageSize) {
public PurchasePageAdapter(RecyclerView.Adapter adapter, int pageSize) {
this.adapter = adapter;
this.pageSize = pageSize;
}
......
......@@ -29,9 +29,11 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<FoodCategoryResultBe
private int checkedTextColor;
private int unCheckedTextColor;
private boolean showDelete = false;
public SecondCategoryAdapter(@Nullable List<FoodCategoryResultBean.DataBean.FoodCategoryBean> data) {
super(R.layout.item_second_category, data);
addChildClickViewIds(R.id.iv_category_delete);
}
@Override
......@@ -54,6 +56,16 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<FoodCategoryResultBe
tvName.setTextColor(unCheckedTextColor);
}
}
if (viewHolder.getAdapterPosition() == 0) {
viewHolder.setGone(R.id.iv_category_delete, true);
} else {
viewHolder.setGone(R.id.iv_category_delete, !showDelete);
}
}
public void setShowDelete(boolean showDelete) {
this.showDelete = showDelete;
notifyDataSetChanged();
}
public SecondCategoryAdapter setCheckedBg(Drawable checkedBg) {
......@@ -86,7 +98,7 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<FoodCategoryResultBe
return selectIndex;
}
public FoodCategoryResultBean.DataBean.FoodCategoryBean getSelectData(){
public FoodCategoryResultBean.DataBean.FoodCategoryBean getSelectData() {
return getData().get(selectIndex);
}
}
......@@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.common.ui.utils.AppDialog;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
......@@ -48,7 +49,17 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<List<PurchaseFoodListV
TextView tvPrice = viewHolder.getView(R.id.tv_order_item_total_amount);
TextView tvFoodTypeNumber = viewHolder.getView(R.id.tv_order_item_food_type_total);
FoodListAdapter foodListAdapter = new FoodListAdapter(context, purchaseFoodListVosBeans, ORDER_TYPE);
FoodListAdapter foodListAdapter = new FoodListAdapter(R.layout.item_shopping_cart_food, context, purchaseFoodListVosBeans, ORDER_TYPE);
foodListAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_order_food_delete) {
new AppDialog().showWaringDialog(context, "是否刪除食品?", (v, dialog) -> {
dialog.dismiss();
if (onFoodDeleteListener != null) {
onFoodDeleteListener.onDeleteFood(viewHolder.getAdapterPosition(), purchaseFoodListVosBeans.get(position));
}
});
}
});
Map<Integer, PurchaseFoodListVosBean> integerMap = foodListAdapter.getIntegerMap();
for (PurchaseFoodListVosBean purchaseFoodListVosBean : purchaseFoodListVosBeans) {
integerMap.put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean);
......@@ -61,11 +72,30 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<List<PurchaseFoodListV
allSelectListener(foodListAdapter, cbAllSelect);
//單個食品的數量修改
foodListAdapter.setOnNumberChangeListener((foodId, number) -> {
//當數量發生改變時,重新計算價格。
calculateTotalPrice(purchaseFoodListVosBeans, tvPrice, tvFoodTypeNumber, cbAllSelect);
foodListAdapter.setOnNumberChangeListener((foodId, number, position) -> {
if (number <= 0) {
for (PurchaseFoodListVosBean purchaseFoodListVosBean : purchaseFoodListVosBeans) {
if (purchaseFoodListVosBean.getId() == foodId) {
new AppDialog().showWaringDialog(context, "數量小於1時將會刪除,是否刪除?", (view, dialog) -> {
dialog.dismiss();
if (onFoodDeleteListener != null && position < purchaseFoodListVosBeans.size()) {
onFoodDeleteListener.onDeleteFood(viewHolder.getAdapterPosition(), purchaseFoodListVosBeans.get(position));
}
}, (view, dialog) -> {
//取消,設置數量為1
dialog.dismiss();
purchaseFoodListVosBean.setFoodCount(1);
foodListAdapter.getIntegerMap().put(purchaseFoodListVosBean.getId(), purchaseFoodListVosBean);
foodListAdapter.notifyItemChanged(position);
});
break;
}
}
} else {
//當數量發生改變時,重新計算價格。
calculateTotalPrice(purchaseFoodListVosBeans, tvPrice, tvFoodTypeNumber, cbAllSelect);
}
});
//單個食品選中狀態切換
foodListAdapter.setOnCheckedChangeListener((isChecked, purchaseFoodListVosBean) -> {
foodCheckedChanged(isChecked, purchaseFoodListVosBean);
......@@ -83,6 +113,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<List<PurchaseFoodListV
}
private OnInfoChangeListener onInfoChangeListener;
private OnFoodDeleteListener onFoodDeleteListener;
public interface OnInfoChangeListener {
/**
......@@ -95,6 +126,14 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<List<PurchaseFoodListV
this.onInfoChangeListener = onInfoChangeListener;
}
public interface OnFoodDeleteListener {
void onDeleteFood(int supplierIndex, PurchaseFoodListVosBean foodListVosBean);
}
public void setOnFoodDeleteListener(OnFoodDeleteListener onFoodDeleteListener) {
this.onFoodDeleteListener = onFoodDeleteListener;
}
/**
* 食品的選中狀態發生改變
*
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.OrderBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/2
* Time: 17:36
* Use: 採購訂單列表
*/
public class StorageAdapter extends BaseQuickAdapter<OrderBean, BaseViewHolder> {
public StorageAdapter(@Nullable List<OrderBean> data) {
super(R.layout.item_storage, data);
addChildClickViewIds(R.id.btn_storage_buy_again);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, OrderBean purchaseOrderBean) {
viewHolder.setText(R.id.tv_storage_supplier_name, "供應商名稱");
viewHolder.setText(R.id.tv_storage_no, "入庫單號");
viewHolder.setText(R.id.tv_storage_order_no, "" + purchaseOrderBean.getOrderNo());
viewHolder.setText(R.id.tv_storage_create_time, TimeUtils.getTime(purchaseOrderBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT_YMDHM));
viewHolder.setText(R.id.tv_storage_goods_num, purchaseOrderBean.getPurchaseFoodCount() + "");
// viewHolder.setText(R.id.tv_storage_order_goods, purchaseOrderBean.getFoods());
viewHolder.setText(R.id.tv_storage_order_total_price, purchaseOrderBean.getTotalAmount() + "");
// viewHolder.setText(R.id.tv_purchase_order_time_out, purchaseOrderBean.getTotal() + "");
viewHolder.setText(R.id.btn_storage_order_state, "入庫單狀態");
}
}
......@@ -15,6 +15,7 @@ import com.jess.arms.base.BaseFragment;
import com.jess.arms.mvp.IPresenter;
import com.jess.arms.utils.ArmsUtils;
import com.kingja.loadsir.core.LoadService;
import com.qmuiteam.qmui.widget.QMUITopBar;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......@@ -34,6 +35,7 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
public abstract class BaseSupplyChainFragment<P extends IPresenter> extends BaseFragment<P> implements BaseSupplyChainContract.View {
protected LoadService loadService;
/**
* 通过此方法可以使 Fragment 能够与外界做一些交互和通信, 比如说外部的 Activity 想让自己持有的某个 Fragment 对象执行一些方法,
* 建议在有多个需要与外界交互的方法时, 统一传 {@link Message}, 通过 what 字段来区分不同的方法, 在 {@link #setData(Object)}
......@@ -75,6 +77,13 @@ public abstract class BaseSupplyChainFragment<P extends IPresenter> extends Base
}
protected void initTopBar(QMUITopBar topBar, String title) {
if (topBar.getLeftViewList().size() <= 0) {
topBar.setTitle(title);
topBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
}
}
@Override
public void showLoading(String message) {
if (message != null) {
......
......@@ -16,6 +16,7 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.ui.utils.AppDialog;
import com.gingersoft.gsa.cloud.common.ui.widget.dialog.DialogUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
......@@ -68,6 +69,10 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
CardView cardSecondCategory;
@BindView(R2.id.tv_new_third_category)
QMUIAlphaTextView addThirdCategory;
/**
* 是否顯示刪除
*/
private boolean showDelete = false;
public static CategoryFragment newInstance() {
CategoryFragment fragment = new CategoryFragment();
......@@ -97,7 +102,21 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
}
private void initTopBar() {
topbarFoodIngredients.addRightImageButton(R.drawable.ic_white_delete, R.id.topbar_right_delete_button).setOnClickListener(this);
topbarFoodIngredients.addRightImageButton(R.drawable.ic_white_delete, R.id.topbar_right_delete_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDelete = !showDelete;
if (baseCategoryAdapter != null) {
baseCategoryAdapter.setShowDelete(showDelete);
}
if (secondCategoryAdapter != null) {
secondCategoryAdapter.setShowDelete(showDelete);
}
if (thirdCategoryAdapter != null) {
thirdCategoryAdapter.setShowDelete(showDelete);
}
}
});
topbarFoodIngredients.setTitle("類別管理");
topbarFoodIngredients.addLeftBackImageButton().setOnClickListener(v -> killMyself());
}
......@@ -180,10 +199,18 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
rvFirstCategory.setAdapter(baseCategoryAdapter);
baseCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
if (baseCategoryAdapter.getSelectedIndex() != position) {
baseCategoryAdapter.setSelectedIndex(position);
List<CategoryBean> categoryBeans = baseCategoryAdapter.getData();
mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.secondCategoryTag);
baseCategoryAdapter.setSelectedIndex(position);
List<CategoryBean> categoryBeans = baseCategoryAdapter.getData();
mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.secondCategoryTag);
});
baseCategoryAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_category_delete) {
//刪除該分類
CategoryBean categoryBean = baseCategoryAdapter.getData().get(position);
new AppDialog().showWaringDialog(mContext, "是否確認刪除該類別【" + categoryBean.getCategoryName() + "】,子類將一同刪除?", (view1, dialog) -> {
mPresenter.deleteFoodCategory(mPresenter.toFoodCategoryBean(0, categoryBean.getCategoryName(), categoryBean.getId()), mPresenter.primaryCategoryTag, position);
dialog.dismiss();
});
}
});
} else {
......@@ -208,12 +235,11 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
.setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setOnItemClickListener((adapter, view, position) -> {
if (secondCategoryAdapter.getSelectIndex() != position) {
secondCategoryAdapter.setSelectIndex(position);
List<FoodCategoryResultBean.DataBean.FoodCategoryBean> categoryBeans = secondCategoryAdapter.getData();
mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.thirdCategoryTag);
}
secondCategoryAdapter.setSelectIndex(position);
List<FoodCategoryResultBean.DataBean.FoodCategoryBean> categoryBeans = secondCategoryAdapter.getData();
mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.thirdCategoryTag);
});
addOnDelete(secondCategoryAdapter, "】,子類將一同刪除?", mPresenter.secondCategoryTag);
rvSecondCategory.setLayoutManager(new GridLayoutManager(mContext, 3) {
@Override
public boolean canScrollHorizontally() {
......@@ -232,11 +258,59 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
thirdCategoryAdapter.setSelectIndex(-1)
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_da_stoke_fifteen_corners))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_68));
addOnDelete(thirdCategoryAdapter, "】?", mPresenter.thirdCategoryTag);
rvThirdCategory.setLayoutManager(new GridLayoutManager(mContext, 3));
rvThirdCategory.setAdapter(thirdCategoryAdapter);
} else {
thirdCategoryAdapter.setList(list);
}
}
}
private void addOnDelete(SecondCategoryAdapter categoryAdapter, String s, int categoryLevel) {
categoryAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_category_delete) {
//刪除該分類
new AppDialog().showWaringDialog(mContext, "是否確認刪除該類別【" + categoryAdapter.getData().get(position).getName() + s, (view1, dialog) -> {
mPresenter.deleteFoodCategory(categoryAdapter.getData().get(position), categoryLevel, position);
dialog.dismiss();
});
}
});
}
@Override
public void refreshInfo(int hierarchy, int position) {
if (hierarchy == mPresenter.primaryCategoryTag && baseCategoryAdapter != null) {
baseCategoryAdapter.removeAt(position);
if (baseCategoryAdapter.getItemCount() > 0) {
if (position - 1 < 0) {
position = 0;
} else {
position -= 1;
}
baseCategoryAdapter.setSelectedIndex(position);
baseCategoryAdapter.getOnItemClickListener().onItemClick(baseCategoryAdapter, rvFirstCategory.getChildAt(position), position);
}
} else if (hierarchy == mPresenter.secondCategoryTag && secondCategoryAdapter != null) {
notifyAdapter(position, secondCategoryAdapter);
} else if (hierarchy == mPresenter.thirdCategoryTag && thirdCategoryAdapter != null) {
notifyAdapter(position, thirdCategoryAdapter);
}
}
private void notifyAdapter(int position, SecondCategoryAdapter categoryAdapter) {
categoryAdapter.removeAt(position);
if (categoryAdapter.getItemCount() > 0) {
if (position - 1 < 1) {
position = 1;
} else {
position -= 1;
}
categoryAdapter.setSelectIndex(position);
categoryAdapter.getOnItemClickListener().onItemClick(categoryAdapter, null, position);
}
}
}
......@@ -80,14 +80,10 @@ public class CategorySelectFragment extends BaseSupplyChainFragment<CategorySele
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar();
initTopBar(mTopBar, "選擇分類");
mPresenter.getFoodCategoryList(null, 0, "0");
}
private void initTopBar() {
mTopBar.setTitle("選擇分類");
mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
}
@OnClick({R2.id.btn_food_ingredients_confirm, R2.id.btn_food_ingredients_supplier_cancel})
@Override
......
......@@ -82,6 +82,11 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
List<Function> orderManger = new ArrayList<>();
orderManger.add(new Function("採購訂單", R.drawable.ic_purchase_order));
purchaseFunctionBeans.add(new PurchaseFunctionBean("訂單管理", orderManger));
List<Function> storage = new ArrayList<>();
storage.add(new Function("入庫", R.drawable.ic_purchase_order));
purchaseFunctionBeans.add(new PurchaseFunctionBean("庫存管理", storage));
PurchaseFunctionAdapter purchaseFunctionAdapter = new PurchaseFunctionAdapter(mContext, purchaseFunctionBeans);
purchaseFunctionAdapter.setFunctionClickListener(new OnItemClickListener() {
@Override
......@@ -104,6 +109,9 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
case "採購訂單":
start(PurchaseListFragment.newInstance());
break;
case "入庫":
start(StorageListFragment.newInstance());
break;
default:
break;
......
......@@ -36,14 +36,6 @@ import butterknife.OnClick;
/**
* ================================================
* Description: 食材單位列表頁面
* <p>
* Created by MVPArmsTemplate on 11/21/2020 14:22
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class MeasurementUnitFragment extends BaseSupplyChainFragment<MeasurementUnitPresenter> implements MeasurementUnitContract.View, View.OnClickListener {
......@@ -118,7 +110,7 @@ public class MeasurementUnitFragment extends BaseSupplyChainFragment<Measurement
cancelSelect.setVisibility(isSelect ? View.VISIBLE : View.GONE);
btnNewMeasurementUnit.setVisibility(isSelect ? View.GONE : View.VISIBLE);
initTopBar();
initTopBar(topbarMeasurementUnitList, isSelect ? "選擇計量單位" : "計量單位");
loadInfo("");
// 重新加载逻辑
......@@ -140,11 +132,6 @@ public class MeasurementUnitFragment extends BaseSupplyChainFragment<Measurement
mPresenter.getMeasurementUnitList(unitContent, pageIndex);
}
private void initTopBar() {
topbarMeasurementUnitList.setTitle(isSelect ? "選擇計量單位" : "計量單位");
topbarMeasurementUnitList.addLeftBackImageButton().setOnClickListener(v -> killMyself());
}
@OnClick({R2.id.btn_measurement_unit_search, R2.id.btn_new_measurement_unit, R2.id.btn_measurement_unit_confirm, R2.id.btn_measurement_unit_cancel})
@Override
public void onClick(View v) {
......
......@@ -14,10 +14,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.gingersoft.gsa.cloud.bean.MultiSelectBean;
import com.gingersoft.gsa.cloud.bean.UploadPicMultiBean;
import com.gingersoft.gsa.cloud.common.ui.adapter.multi.InfoMultiAdapter;
import com.gingersoft.gsa.cloud.common.ui.bean.InfoMultiBean;
import com.gingersoft.gsa.cloud.common.ui.recylcler.decorator.DividerItemDecoration;
......@@ -29,6 +26,7 @@ import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerNewFoodIngredientsComponent;
import com.gingersoft.supply_chain.mvp.bean.FoodPackingSpecificationBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.contract.NewFoodIngredientsContract;
import com.gingersoft.supply_chain.mvp.presenter.NewFoodIngredientsPresenter;
......@@ -55,7 +53,7 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.SupplierListFragment.S
/**
* ================================================
* Description: 新增食材
* Description: 新增食材、編輯食材
*/
public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodIngredientsPresenter> implements NewFoodIngredientsContract.View, View.OnClickListener {
......@@ -68,8 +66,14 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
private InfoMultiAdapter infoMultiAdapter;
public static NewFoodIngredientsFragment newInstance() {
public final static String FOOD_INFO_KEY = "foodInfoKey";
public final static int EDIT_FOOD_RESULT_CODE = 1060;
public static NewFoodIngredientsFragment newInstance(PurchaseFoodListVosBean purchaseFoodListVosBean) {
NewFoodIngredientsFragment fragment = new NewFoodIngredientsFragment();
Bundle bundle = new Bundle();
bundle.putSerializable(FOOD_INFO_KEY, purchaseFoodListVosBean);
fragment.setArguments(bundle);
return fragment;
}
......@@ -102,8 +106,15 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
killMyself();
}
});
initTopBar();
infoMultiAdapter = new InfoMultiAdapter(mContext, mPresenter.getFragmentInfo());
//加載佈局
Bundle arguments = getArguments();
PurchaseFoodListVosBean purchaseFoodListVosBean = null;
if (arguments != null) {
purchaseFoodListVosBean = (PurchaseFoodListVosBean) arguments.getSerializable(FOOD_INFO_KEY);
}
infoMultiAdapter = new InfoMultiAdapter(mContext, mPresenter.getFragmentInfo(purchaseFoodListVosBean));
rvNewFoodIngredients.addItemDecoration(new DividerItemDecoration(mContext, VERTICAL_LIST));
infoMultiAdapter.setOnItemClickListener((adapter, view, position) -> {
List<InfoMultiBean> data = infoMultiAdapter.getData();
......@@ -115,15 +126,13 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
}
}
});
infoMultiAdapter.setOnItemChildClickListener(new OnItemChildClickListener() {
@Override
public void onItemChildClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
if (view.getId() == R.id.iv_multi_upload_pic) {
//選擇圖片
Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(intentToPickPic, CHOOSE_PHOTO);
}
//圖片點擊事件
infoMultiAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_multi_upload_pic) {
//選擇圖片
Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(intentToPickPic, CHOOSE_PHOTO);
}
});
rvNewFoodIngredients.setAdapter(infoMultiAdapter);
......@@ -211,18 +220,27 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
@Override
public void refreshAdapterByPosition(int position) {
infoMultiAdapter.notifyItemChanged(position);
if (infoMultiAdapter != null) {
infoMultiAdapter.notifyItemChanged(position);
}
}
@Override
public void uploadPicSuccess(List<String> picUrl) {
List<InfoMultiBean> data = infoMultiAdapter.getData();
InfoMultiBean infoMultiBean = data.get(mPresenter.picIndex);
if (infoMultiBean instanceof UploadPicMultiBean) {
UploadPicMultiBean uploadPicMultiBean = (UploadPicMultiBean) infoMultiBean;
uploadPicMultiBean.setPicUrl(picUrl);
refreshAdapterByPosition(mPresenter.picIndex);
}
// List<InfoMultiBean> data = infoMultiAdapter.getData();
// InfoMultiBean infoMultiBean = data.get(mPresenter.picIndex);
// if (infoMultiBean instanceof UploadPicMultiBean) {
// UploadPicMultiBean uploadPicMultiBean = (UploadPicMultiBean) infoMultiBean;
// uploadPicMultiBean.setPicUrl(picUrl);
// refreshAdapterByPosition(mPresenter.picIndex);
// }
mPresenter.setPicUrl(infoMultiAdapter.getData(), picUrl);
}
@Override
public void saveFoodInfoSuccess() {
setFragmentResult(EDIT_FOOD_RESULT_CODE, null);
killMyself();
}
}
......@@ -15,6 +15,7 @@ import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerNewSupplierComponent;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
import com.gingersoft.supply_chain.mvp.presenter.NewSupplierPresenter;
import com.jess.arms.di.component.AppComponent;
......@@ -25,7 +26,6 @@ import butterknife.BindView;
import butterknife.OnClick;
import static com.gingersoft.gsa.cloud.common.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST;
import static com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean.DELETE;
import static com.gingersoft.supply_chain.mvp.ui.fragment.SupplierListFragment.SUPPLIER_LIST;
......@@ -105,7 +105,7 @@ public class NewSupplierFragment extends BaseSupplyChainFragment<NewSupplierPres
//刪除供應商
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
dialog.dismiss();
supplierBean.setDeletes(DELETE);
supplierBean.setDeletes(Constant.DELETE);
mPresenter.updateSupplier();
});
} else if (viewId == R.id.btn_save_supplier) {
......
......@@ -17,6 +17,7 @@ import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerOrderContentComponent;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodListVosBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.OrderContentContract;
import com.gingersoft.supply_chain.mvp.presenter.OrderContentPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.ShoppingCartAdapter;
......@@ -33,13 +34,13 @@ import static com.gingersoft.supply_chain.mvp.ui.fragment.FoodIngredientsFragmen
/**
* ================================================
* Description: 訂單詳情
* Description: 購物車
* 本次下單所有食品展示頁
*/
public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPresenter> implements OrderContentContract.View, View.OnClickListener {
@BindView(R2.id.topbar)
QMUITopBar topbar;
@BindView(R2.id.supply_top_bar)
QMUITopBar topBar;
@BindView(R2.id.rv_order_content)
RecyclerView rvOrderContent;
@BindView(R2.id.cb_order_content_all_select)
......@@ -75,8 +76,7 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr
@Override
public void initData(@Nullable Bundle savedInstanceState) {
topbar.setTitle("採購單");
topbar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
initTopBar(topBar, "採購單");
mPresenter.organizeShopCartData();
cbOrderContentAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> {
......@@ -109,6 +109,8 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr
//完成
List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getPurchaseFoodListVosBeans();
mPresenter.addNewPurchaseOrder(purchaseFoodListVosBeans, edOrderContentRemark.getText() + "");
//去到訂單確認頁面
startWithPop(SendMsgFragment.newInstance());
} else if (viewId == R.id.btn_order_content_order_template) {
//訂單模板
......@@ -121,6 +123,15 @@ public class OrderContentFragment extends BaseSupplyChainFragment<OrderContentPr
@Override
public void loadAdapter(List<List<PurchaseFoodListVosBean>> supplierFoods) {
shoppingCartAdapter = new ShoppingCartAdapter(mContext, supplierFoods);
shoppingCartAdapter.setOnFoodDeleteListener((supplierIndex, foodListVosBean) -> {
SupplyShoppingCart.getInstance().getCartFoods().remove(foodListVosBean);
List<PurchaseFoodListVosBean> purchaseFoodListVosBeans = shoppingCartAdapter.getData().get(supplierIndex);
purchaseFoodListVosBeans.remove(foodListVosBean);
if (purchaseFoodListVosBeans.size() <= 0) {
shoppingCartAdapter.getData().remove(purchaseFoodListVosBeans);
}
shoppingCartAdapter.notifyItemChanged(supplierIndex);
});
rvOrderContent.setAdapter(shoppingCartAdapter);
shoppingCartAdapter.setOnInfoChangeListener(() -> mPresenter.calculateTotalPrice(cbOrderContentAllSelect));
}
......
......@@ -108,8 +108,7 @@ public class PackageSpecificationFragment extends BaseSupplyChainFragment<Packag
}
private void initTopBar() {
topbarNewPackageSpecification.setTitle("包裝規格");
topbarNewPackageSpecification.addLeftBackImageButton().setOnClickListener(v -> killMyself());
initTopBar(topbarNewPackageSpecification, "包裝規格");
}
@OnClick({R2.id.btn_save_new_package_specification})
......
......@@ -5,16 +5,19 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.gsa.cloud.common.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerPurchaseListComponent;
import com.gingersoft.supply_chain.mvp.bean.OrderBean;
import com.gingersoft.supply_chain.mvp.content.SupplyShoppingCart;
import com.gingersoft.supply_chain.mvp.contract.PurchaseListContract;
import com.gingersoft.supply_chain.mvp.presenter.PurchaseListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchaseOrderAdapter;
......@@ -24,7 +27,6 @@ import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.popup.QMUIPopups;
import com.qmuiteam.qmui.widget.tab.QMUIBasicTabSegment;
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator;
......@@ -52,8 +54,11 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
ViewPager2 contentViewPager;
@BindView(R2.id.btn_save)
QMUIAlphaButton btnNewOrder;
@BindView(R2.id.screen_view)
ScreenView screenView;
private PurchaseOrderAdapter purchaseOrderAdapter;
public static PurchaseListFragment newInstance() {
PurchaseListFragment fragment = new PurchaseListFragment();
return fragment;
......@@ -61,6 +66,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
private final int[] orderState = new int[]{0, 1, 2, 3};
private int pageIndex = 1;
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerPurchaseListComponent //如找不到该类,请编译一下项目
......@@ -88,10 +94,23 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
mPresenter.getOrderList("", orderState[0], pageIndex);
}
@Override
public void onSupportVisible() {
super.onSupportVisible();
if (tvCartGoodsNum != null) {
tvCartGoodsNum.setText(String.valueOf(SupplyShoppingCart.getInstance().getCartFoods().size()));
}
}
private TextView tvCartGoodsNum;
private void initTopBar() {
mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
mTopBar.setTitle("採購列表");
View view = View.inflate(mContext, R.layout.layout_shopping_cart, null);
tvCartGoodsNum = view.findViewById(R.id.tv_purchase_cart_size);
tvCartGoodsNum.setText(String.valueOf(SupplyShoppingCart.getInstance().getCartFoods().size()));
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
mTopBar.addRightView(view, R.id.qmui_shopping_cart, layoutParams);
view.setOnClickListener(v -> start(OrderContentFragment.newInstance()));
......@@ -103,6 +122,17 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
purchaseOrderAdapter = new PurchaseOrderAdapter(null);
purchaseOrderAdapter.setOnItemChildClickListener((adapter, view, position) -> {
int viewId = view.getId();
if (viewId == R.id.iv_supplier_delete) {
//刪除採購單
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除採購單?", (view1, dialog) -> {
List<OrderBean> data = purchaseOrderAdapter.getData();
mPresenter.deleteOrder(position, data.get(position));
dialog.dismiss();
});
}
});
PurchasePageAdapter adapter = new PurchasePageAdapter(purchaseOrderAdapter, 4);
contentViewPager.setAdapter(adapter);
mTabSegment.setupWithViewPager(contentViewPager);
......@@ -143,14 +173,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
int viewId = v.getId();
if (viewId == R.id.layout_purchase_list_screen) {
//篩選
QMUIPopups.popup(mContext, ViewGroup.LayoutParams.MATCH_PARENT)
.arrow(false)
.shadow(true)
.view(new ScreenView(mContext))
.offsetYIfTop(QMUIDisplayHelper.dp2px(mContext, 10))
.dismissIfOutsideTouch(false)
.dimAmount(0.6f)
.show(v);
screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
}
}
......@@ -158,4 +181,9 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
public void loadOrderList(List<OrderBean> list) {
purchaseOrderAdapter.setList(list);
}
@Override
public void deleteOrder(int position) {
purchaseOrderAdapter.removeAt(position);
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerSendMsgComponent;
import com.gingersoft.supply_chain.mvp.contract.SendMsgContract;
import com.gingersoft.supply_chain.mvp.presenter.SendMsgPresenter;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.widget.QMUITopBar;
import butterknife.BindView;
/**
* Description: 發送消息到供應商
*/
public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> implements SendMsgContract.View {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.layout_contact_information)
LinearLayout layoutContactInformation;
@BindView(R2.id.horizontal_dotted)
View horizontalDotted;
@BindView(R2.id.btn_supplier_confirm)
QMUIAlphaButton btnSupplierConfirm;
@BindView(R2.id.btn_supplier_cancel)
QMUIAlphaButton btnSupplierCancel;
public static SendMsgFragment newInstance() {
SendMsgFragment fragment = new SendMsgFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerSendMsgComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_send_msg, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "發送");
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerStorageListComponent;
import com.gingersoft.supply_chain.mvp.bean.OrderBean;
import com.gingersoft.supply_chain.mvp.contract.StorageListContract;
import com.gingersoft.supply_chain.mvp.presenter.StorageListPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchasePageAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.StorageAdapter;
import com.gingersoft.supply_chain.mvp.ui.widget.ScreenView;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.layout.QMUILinearLayout;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.tab.QMUIBasicTabSegment;
import com.qmuiteam.qmui.widget.tab.QMUITabBuilder;
import com.qmuiteam.qmui.widget.tab.QMUITabIndicator;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment;
import com.qmuiteam.qmui.widget.tab.QMUITabSegment2;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 12/10/2020 18:09
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class StorageListFragment extends BaseSupplyChainFragment<StorageListPresenter> implements StorageListContract.View, View.OnClickListener {
@BindView(R2.id.topbar_purchase_list)
QMUITopBar mTopBar;
@BindView(R2.id.ed_food_ingredients_search)
EditText edFoodIngredientsSearch;
@BindView(R2.id.layout_purchase_list_screen)
QMUILinearLayout layoutPurchaseListScreen;
@BindView(R2.id.layout_food_ingredients_search)
LinearLayout layoutFoodIngredientsSearch;
@BindView(R2.id.screen_view)
ScreenView screenView;
@BindView(R2.id.purchase_list_tabSegment)
QMUITabSegment2 mTabSegment;
@BindView(R2.id.contentViewPager)
ViewPager2 contentViewPager;
@BindView(R2.id.btn_save)
QMUIAlphaButton btnSave;
String[] tabs = new String[]{"全部", "待收貨", "部分收貨", "全部收貨", "拒收"};
public static StorageListFragment newInstance() {
StorageListFragment fragment = new StorageListFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerStorageListComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_purchase_list, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar();
initTabAndData();
}
private void initTopBar() {
mTopBar.addLeftBackImageButton().setOnClickListener(v -> killMyself());
mTopBar.setTitle("入庫列表");
btnSave.setVisibility(View.GONE);
}
private void initTabAndData() {
QMUITabBuilder builder = mTabSegment.tabBuilder()
.setNormalColor(ContextCompat.getColor(mContext, R.color.color_86))
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
List<OrderBean> orderBeans = new ArrayList<>();
// for (int i = 0; i < 10; i++) {
// OrderBean orderBean = new OrderBean("S0001", 5, 11.11, 1, System.currentTimeMillis());
// orderBeans.add(orderBean);
// }
StorageAdapter storageAdapter = new StorageAdapter(orderBeans);
PurchasePageAdapter adapter = new PurchasePageAdapter(storageAdapter, tabs.length);
contentViewPager.setAdapter(adapter);
mTabSegment.setupWithViewPager(contentViewPager);
mTabSegment.setIndicator(new QMUITabIndicator(
QMUIDisplayHelper.dp2px(getContext(), 2), false, false));
for (String tab : tabs) {
mTabSegment.addTab(builder.setText(tab).build(getContext()));
}
mTabSegment.setMode(QMUITabSegment.MODE_FIXED);
mTabSegment.addOnTabSelectedListener(new QMUIBasicTabSegment.OnTabSelectedListener() {
@Override
public void onTabSelected(int index) {
// mPresenter.getOrderList("", orderState[index], pageIndex);
}
@Override
public void onTabUnselected(int index) {
}
@Override
public void onTabReselected(int index) {
}
@Override
public void onDoubleTap(int index) {
mTabSegment.clearSignCountView(index);
}
});
}
@OnClick({R2.id.layout_purchase_list_screen})
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.layout_purchase_list_screen) {
screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
}
}
}
......@@ -23,7 +23,7 @@ import com.gingersoft.supply_chain.mvp.ui.adapter.SupplierAdapter;
import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadSir;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
......@@ -47,7 +47,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
@BindView(R2.id.rv_supplier_list)
RecyclerView rvSupplierList;
@BindView(R2.id.btn_new_supplier)
QMUIAlphaButton btnNewSupplier;
QMUIAlphaTextView btnNewSupplier;
@BindView(R2.id.ed_supplier_search)
EditText edSupplier;
public final static int SUPPLIER_LIST = 101;
......@@ -58,10 +58,9 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
* 當{@Link isSelect}為true時,顯示這兩個按鈕
*/
@BindView(R2.id.btn_supplier_confirm)
QMUIAlphaButton btnConfirm;
QMUIAlphaTextView btnConfirm;
@BindView(R2.id.btn_supplier_cancel)
QMUIAlphaButton btnCancel;
QMUIAlphaTextView btnCancel;
private int pageIndex = 0;
/**
......@@ -126,9 +125,10 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
}
private void initTopBar() {
mTopBarSupplierList.setTitle("供應商");
mTopBarSupplierList.addLeftBackImageButton().setOnClickListener(v -> killMyself());
mTopBarSupplierList.addRightImageButton(R.drawable.ic_screen, R.id.topbar_right_screen_button).setOnClickListener(this);
initTopBar(mTopBarSupplierList, "供應商");
if (mTopBarSupplierList.getLeftViewList().size() <= 0) {
mTopBarSupplierList.addRightImageButton(R.drawable.ic_screen, R.id.topbar_right_screen_button).setOnClickListener(this);
}
}
@OnClick({R2.id.btn_new_supplier, R2.id.btn_supplier_search, R2.id.btn_supplier_confirm, R2.id.btn_supplier_cancel})
......
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathEffect;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
/**
* @author 宇航.
* User: admin
* Date: 2020/12/8
* Time: 17:52
* Use:
*/
public class DashedView extends View {
private Context ct;
private Paint mPaint;
private Path mPath;
private PathEffect effects;
private int width;
private int height;
private int defaultColor = 0xffff0000;
public DashedView(Context context) {
this(context, null);
}
public DashedView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, -1);
}
public DashedView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
ct = context;
init();
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
width = w;
height = h;
}
private void init() {
//初始化,并打开抗锯齿
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setColor(defaultColor);
mPaint.setStrokeWidth(dip2px(ct, 1));
mPath = new Path();
//数组含义:里面最少要有2个值,值的个数必须是偶数个。偶数位(包含0),表示实线长度,奇数位表示断开的长度
effects = new DashPathEffect(new float[]{4, 2}, 0);
}
/**
* 设置线的必要属性
*
* @param color 十六进制颜色值
* @param lineWidth 虚线宽度,单位是dp
*/
public void setLineAttribute(int color, float lineWidth, float[] f) {
if (color == 0) {
color = defaultColor;
}
if (lineWidth == 0) {
lineWidth = 1;
}
if (f == null) {
f = new float[]{4, 2};
}
effects = new DashPathEffect(f, 0);
mPaint.setStrokeWidth(dip2px(ct, lineWidth));
mPaint.setColor(color);
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//定义起点
mPath.moveTo(0, 0);
//定义终点
if (width > height) {
//宽度比高度大,是横线
mPath.lineTo(width, 0);
} else {
//竖线。(根据实际情况,这里不考虑宽高相等情况)
mPath.lineTo(0, height);
}
mPaint.setPathEffect(effects);
canvas.drawPath(mPath, mPaint);
}
private static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
}
......@@ -3,17 +3,23 @@ package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.gingersoft.gsa.cloud.common.ui.view.timeselect.TimePickerView;
import com.gingersoft.gsa.cloud.common.utils.time.TimePickerUtils;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import java.util.Calendar;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
......@@ -44,6 +50,13 @@ public class ScreenView extends FrameLayout implements View.OnClickListener {
TextView tvEndTime;
@BindView(R2.id.iv_switch_time)
ImageView ivSwitchTime;
@BindView(R2.id.layout_purchase_list_screen)
LinearLayout screenLayout;
private Calendar startTime = Calendar.getInstance();
private Calendar endTime = startTime;
public ScreenView(Context context) {
this(context, null);
......@@ -63,19 +76,29 @@ public class ScreenView extends FrameLayout implements View.OnClickListener {
ButterKnife.bind(this, view);
tvStartTime.setText(TimeUtils.getCurrentDate(TimeUtils.DATE_FORMAT_DATE));
tvEndTime.setText(TimeUtils.getCurrentDate(TimeUtils.DATE_FORMAT_DATE));
this.addView(view);
}
@OnClick({R2.id.btn_screen_purchase_order_confirm, R2.id.btn_screen_purchase_order_cancel, R2.id.iv_screen_purchase_order_switch_num, R2.id.iv_screen_purchase_order_switch_supplier_name, R2.id.iv_switch_food_name, R2.id.tv_screen_purchase_order_start_time, R2.id.tv_screen_purchase_order_end_time, R2.id.iv_switch_time})
public ScreenView setLayoutMarginTop(int marginTop) {
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.topMargin = marginTop;
screenLayout.setLayoutParams(params);
return this;
}
@OnClick({R2.id.layout_screen_view, R2.id.btn_screen_purchase_order_confirm, R2.id.btn_screen_purchase_order_cancel, R2.id.iv_screen_purchase_order_switch_num, R2.id.iv_screen_purchase_order_switch_supplier_name, R2.id.iv_switch_food_name, R2.id.tv_screen_purchase_order_start_time, R2.id.tv_screen_purchase_order_end_time, R2.id.iv_switch_time})
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.btn_screen_purchase_order_confirm) {
if (viewId == R.id.layout_screen_view) {
this.setVisibility(GONE);
} else if (viewId == R.id.btn_screen_purchase_order_confirm) {
//確認
this.setVisibility(GONE);
} else if (viewId == R.id.btn_screen_purchase_order_cancel) {
//取消
this.setVisibility(GONE);
} else if (viewId == R.id.iv_screen_purchase_order_switch_num) {
//切換訂單編號排序
......@@ -87,10 +110,18 @@ public class ScreenView extends FrameLayout implements View.OnClickListener {
} else if (viewId == R.id.tv_screen_purchase_order_start_time) {
//選擇開始時間
TimePickerView timePickerView = TimePickerUtils.showDatePicker(getContext(), (date, v1) -> {
startTime.setTime(date);
tvStartTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
});
timePickerView.setDate(startTime);
} else if (viewId == R.id.tv_screen_purchase_order_end_time) {
//選擇結束時間
TimePickerView timePickerView = TimePickerUtils.showDatePicker(getContext(), (date, v1) -> {
endTime.setTime(date);
tvEndTime.setText(TimeUtils.DATE_FORMAT_DATE.format(date));
});
timePickerView.setDate(endTime);
} else if (viewId == R.id.iv_switch_time) {
//切換時間的排序
......
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90">
<shape android:shape="line">
<stroke
android:width="@dimen/dp_1"
android:color="@color/order_category_grading_line_color"
android:dashWidth="@dimen/dp_2"
android:dashGap="@dimen/dp_1" />
</shape>
</rotate>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/color_f0" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/dp_2"/>
<solid android:color="@color/color_ea"/>
</shape>
\ No newline at end of file
......@@ -98,11 +98,24 @@
android:textSize="@dimen/dp_14" />
</com.qmuiteam.qmui.alpha.QMUIAlphaLinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_ingredients_category"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_ingredients_category"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<!-- 二級分類單獨裝-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_food_ingredients_second_category"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</FrameLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
......@@ -131,9 +144,9 @@
android:background="@drawable/shape_app_btn"
android:gravity="center"
android:text="+新增食材"
android:visibility="gone"
android:textColor="@color/white"
android:textSize="@dimen/dp_16" />
android:textSize="@dimen/dp_16"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_food_ingredients_confirm"
......
......@@ -7,7 +7,7 @@
android:background="@color/supply_chain_bg_color"
android:orientation="vertical">
<include layout="@layout/include_topbar" />
<include layout="@layout/supply_chain_top_bar" />
<LinearLayout
android:layout_width="match_parent"
......
......@@ -78,6 +78,12 @@
</com.qmuiteam.qmui.layout.QMUILinearLayout>
</LinearLayout>
<com.gingersoft.supply_chain.mvp.ui.widget.ScreenView
android:id="@+id/screen_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<com.qmuiteam.qmui.widget.tab.QMUITabSegment2
android:id="@+id/purchase_list_tabSegment"
android:layout_width="match_parent"
......
......@@ -22,13 +22,13 @@
<LinearLayout
android:id="@+id/layout_supplier_search"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_height="@dimen/dp_47"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_10"
android:src="@drawable/ic_search" />
......@@ -78,34 +78,41 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_new_supplier"
style="@style/Save_Btn_Style"
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:text="+新增供應商"
android:visibility="visible" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_supplier_confirm"
style="@style/Save_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_weight="1"
android:text="確定" />
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:text="確定"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_supplier_cancel"
style="@style/Save_Btn_Style"
android:layout_width="0dp"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:background="@drawable/shape_black_border_small_radius"
android:text="取消" />
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:text="取消"
android:textColor="@color/color_3c"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/layout_order_category_back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:elevation="@dimen/dp_5"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_2"
android:singleLine="true"
android:textColor="@color/theme_color"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
android:text="返回" />
</LinearLayout>
<androidx.cardview.widget.CardView
android:id="@+id/layout_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="@dimen/dp_10">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="@dimen/dp_5"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_5"
android:paddingTop="@dimen/dp_10">
<TextView
android:id="@+id/tv_category_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:button="@null"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_2"
android:paddingBottom="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="果蔬類" />
<View
android:id="@+id/order_primary_category_line"
android:layout_width="@dimen/dp_2"
android:layout_height="0dp"
android:background="#084279"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_category_name" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_second_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_second_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_5">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:id="@+id/order_category_second_top_line"
android:layout_width="@dimen/dp_2"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/order_category_grading_line_color" />
<View
android:id="@+id/order_category_second_bottom_line"
android:layout_width="@dimen/dp_2"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/order_category_grading_line_color" />
</LinearLayout>
<View
android:id="@+id/tv_order_second_category_horizontal_line"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_2"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:background="@color/order_category_grading_line_color" />
</RelativeLayout>
<TextView
android:id="@+id/tv_order_second_category_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_2"
android:paddingBottom="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="果蔬類" />
<!-- <com.gingersoft.supply_chain.mvp.ui.widget.DashedView-->
<!-- android:id="@+id/order_category_second_dashed"-->
<!-- android:layout_width="@dimen/dp_10"-->
<!-- android:layout_height="0dp"-->
<!-- android:visibility="gone"-->
<!-- android:padding="@dimen/dp_0"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="@id/tv_order_second_category_horizontal_line" />-->
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_order_third_category"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="@dimen/dp_5"-->
<!-- android:background="@color/white"-->
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />-->
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:elevation="@dimen/dp_5"
android:orientation="horizontal"
app:cardElevation="@dimen/dp_10">
<TextView
android:id="@+id/tv_order_third_category_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_5"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_2"
android:paddingBottom="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/s_btn_blue_3c_text"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@id/tv_order_third_category_horizontal_line"
tools:text="果蔬類" />
<com.gingersoft.supply_chain.mvp.ui.widget.DashedView
android:id="@+id/tv_order_third_category_horizontal_line"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_2"
app:layout_constraintBottom_toBottomOf="@id/tv_order_third_category_name"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_order_third_category_name" />
<com.gingersoft.supply_chain.mvp.ui.widget.DashedView
android:id="@+id/order_category_third_top_line"
android:layout_width="@dimen/dp_2"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/tv_order_third_category_horizontal_line"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.gingersoft.supply_chain.mvp.ui.widget.DashedView
android:id="@+id/order_category_third_bottom_line"
android:layout_width="@dimen/dp_2"
android:layout_height="0dp"
android:padding="@dimen/dp_0"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_order_third_category_horizontal_line" />
</androidx.constraintlayout.widget.ConstraintLayout>
......@@ -22,20 +22,21 @@
<TextView
android:id="@+id/tv_purchase_order_no"
android:layout_width="0dp"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="訂單編號"
android:textColor="@color/black"
android:textSize="@dimen/dp_17"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="訂單編號" />
<ImageView
android:id="@+id/iv_supplier_edit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_blue_edit" />
android:src="@drawable/ic_blue_edit"
android:visibility="gone" />
<ImageView
android:id="@+id/iv_supplier_delete"
......
......@@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_second_category_title"
style="@style/Second_Category_Style"
......@@ -11,11 +12,17 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
android:layout_marginTop="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_3"
android:layout_marginRight="@dimen/dp_4"
android:background="@drawable/s_app_color_to_bf"
android:gravity="center"
android:textColor="@color/s_3c_to_white"
android:textSize="@dimen/dp_14"
tools:text="瓜果類" />
<com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
android:id="@+id/iv_category_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ic_red_circular_delete" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:elevation="@dimen/dp_2"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginLeft="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_8"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_storage_supplier_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/black"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="供應商名稱" />
<ImageView
android:id="@+id/iv_supplier_edit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_blue_edit" />
<ImageView
android:id="@+id/iv_supplier_delete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@dimen/dp_10"
android:src="@drawable/ic_red_delete" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="入庫單號:" />
<TextView
android:id="@+id/tv_storage_no"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="123456789" />
<TextView
android:id="@+id/tv_storage_create_time"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="2020-11-20 12:00" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="訂單編號:" />
<TextView
android:id="@+id/tv_storage_order_no"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="DD0002" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品數量:" />
<TextView
android:id="@+id/tv_storage_goods_num"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="10" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="訂單食材:" />
<TextView
android:id="@+id/tv_storage_order_goods"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
tools:text="巴西肥牛、澳洲牛排" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="總價:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_storage_order_total_price"
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/purchase_total_price_text_color"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
tools:text="$100.00" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_10"
android:gravity="right"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_storage_buy_again"
android:layout_width="@dimen/dp_76"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:background="@drawable/shape_bug_again_btn"
android:gravity="center"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8"
android:text="再次購買"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/btn_storage_order_state"
android:layout_width="@dimen/dp_76"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:background="@drawable/shape_to_be_received_btn"
android:gravity="center"
android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_8"
android:text="待收貨"
android:textColor="@color/white"
android:textSize="@dimen/dp_12" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
......@@ -8,12 +8,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_height="@dimen/dp_37"
android:layout_marginLeft="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_8"
android:gravity="center_vertical"
......@@ -24,7 +25,7 @@
android:layout_height="wrap_content"
android:text="供應商:"
android:textColor="@color/black"
android:textSize="@dimen/dp_14"
android:textSize="@dimen/dp_17"
android:textStyle="bold" />
<TextView
......@@ -34,7 +35,7 @@
android:layout_weight="1"
android:text="海鮮天地"
android:textColor="@color/black"
android:textSize="@dimen/dp_14"
android:textSize="@dimen/dp_17"
android:textStyle="bold" />
<ImageView
......@@ -54,7 +55,7 @@
<RadioButton
android:id="@+id/rb_supplier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:button="@drawable/selector_checkbox" />
</LinearLayout>
......@@ -63,7 +64,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:orientation="horizontal">
<TextView
......@@ -84,7 +87,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:orientation="horizontal">
<TextView
......@@ -105,7 +110,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:orientation="horizontal">
<TextView
......@@ -126,7 +133,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:orientation="horizontal">
<TextView
......@@ -148,7 +157,9 @@
android:id="@+id/layout_supplier_food_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_8"
android:layout_marginTop="@dimen/dp_2"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7"
android:gravity="center_vertical"
android:orientation="horizontal">
......
......@@ -16,12 +16,13 @@
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_purchase_cart_size"
android:layout_width="@dimen/dp_12"
android:layout_height="@dimen/dp_12"
android:layout_gravity="right"
android:autoSizeMaxTextSize="@dimen/dp_6"
android:autoSizeMaxTextSize="@dimen/dp_8"
android:gravity="center"
android:autoSizeMinTextSize="@dimen/dp_2"
android:autoSizeMinTextSize="@dimen/dp_4"
android:background="@drawable/ui_shape_red_oval"
android:text="3"
android:textColor="@color/white"
......
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUITopBar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/supply_top_bar"
app:qmui_topbar_title_color="@color/theme_white_color"
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:background="@color/theme_color"
android:fitsSystemWindows="true" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SeekBarPressure">
<!-- SeekBar 最小值-->
<attr name="min" format="integer"/>
<!-- SeekBar 2点间代表的数值-->
<attr name="per_value" format="integer"/>
<!-- SeekBar供有多少个点-->
<attr name="point_count" format="integer"/>
<!-- 背景线颜色-->
<attr name="back_line_color" format="color"/>
<!-- 区间线颜色-->
<attr name="indicator_line_color" format="color"/>
<!-- 滑动指示器 reference|-->
<attr name="indicator" format="color"/>
</declare-styleable>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="order_category_grading_line_color">#084279</color>
<color name="order_category_name_unselect_color">@color/color_3c</color>
<color name="order_category_name_select_color">@color/theme_color</color>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment