Commit 2ea685ea by 宁斌

Merge remote-tracking branch 'origin/dev' into dev

parents 5d6a161a 771adf38
...@@ -2,7 +2,6 @@ package com.joe.print.mvp.print; ...@@ -2,7 +2,6 @@ package com.joe.print.mvp.print;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Looper;
import android.util.Log; import android.util.Log;
import com.epson.epos2.Epos2Exception; import com.epson.epos2.Epos2Exception;
...@@ -113,20 +112,24 @@ public class EpsonPrint implements ReceiveListener { ...@@ -113,20 +112,24 @@ public class EpsonPrint implements ReceiveListener {
*/ */
private boolean createPrintData(Bitmap bitmap) { private boolean createPrintData(Bitmap bitmap) {
try { try {
mPrinter.addTextAlign(Printer.ALIGN_CENTER); //Printer.MODE_MONO单色(2个刻度)
//Printer.MODE_GRAY16多灰度(16刻度)
//Printer.MODE_MONO_HIGH_DENSITY 高密度单色(2个刻度),双倍密度
// 使用雙倍密度更清晰。但是寬度會被压窄一半,所以需要处理bitmap宽度为正常的两倍
//Printer.HALFTONE_DITHER 抖動(適用於打印圖形) 打印效果比較多一些噪點
//Printer.HALFTONE_ERROR_DIFFUSION 错误扩散(适合打印文本和图形) 打印效果比較多一些噪點
//Printer.HALFTONE_THRESHOLD 阈值(仅适用于打印文本) 打印效果更平滑
mPrinter.addImage(bitmap, 0, 0, mPrinter.addImage(bitmap, 0, 0,
bitmap.getWidth(), bitmap.getWidth(),
bitmap.getHeight(), bitmap.getHeight(),
Printer.COLOR_1, Printer.COLOR_NONE,//顏色
Printer.MODE_MONO_HIGH_DENSITY,//密度 Printer.MODE_MONO_HIGH_DENSITY,//密度
Printer.HALFTONE_DITHER,//半色調抖動 Printer.HALFTONE_THRESHOLD,//色調抖動
Printer.PARAM_DEFAULT, Printer.PARAM_DEFAULT,//亮度
Printer.COMPRESS_NONE);//壓縮 Printer.COMPRESS_AUTO);//壓縮
mPrinter.addCut(Printer.CUT_FEED); mPrinter.addCut(Printer.CUT_FEED);
//COLOR_NONE 為普通顏色 COLOR_2為紅色 //COLOR_NONE 為普通顏色 COLOR_2為紅色
// mPrinter.addTextSize(2, 2);
// mPrinter.addTextStyle(0,0,1, Printer.COLOR_1);
// mPrinter.addText("炒爐打印測試\n");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
mPrinter.clearCommandBuffer(); mPrinter.clearCommandBuffer();
......
...@@ -7,9 +7,6 @@ import android.view.View; ...@@ -7,9 +7,6 @@ import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.constans.OrderTypeConstans; import com.gingersoft.gsa.cloud.common.constans.OrderTypeConstans;
import com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils; import com.gingersoft.gsa.cloud.common.core.restaurant.utils.RestaurantExpandInfoUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
...@@ -20,6 +17,7 @@ import com.gingersoft.gsa.cloud.print.bean.PrjBean; ...@@ -20,6 +17,7 @@ import com.gingersoft.gsa.cloud.print.bean.PrjBean;
import com.joe.print.mvp.model.bean.HtmlLable; import com.joe.print.mvp.model.bean.HtmlLable;
import com.joe.print.mvp.print.common.HtmlContract; import com.joe.print.mvp.print.common.HtmlContract;
import com.joe.print.R; import com.joe.print.R;
import com.joe.print.mvp.print.service.PrjService;
import com.joe.print.mvp.ui.view.KitChenPrjFoodView; import com.joe.print.mvp.ui.view.KitChenPrjFoodView;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -254,7 +252,13 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -254,7 +252,13 @@ public class PrintPrjKitchen extends PrinterRoot {
return null; return null;
} }
setFoodItemType(data); setFoodItemType(data);
View view = LinearLayout.inflate(context, R.layout.print_kitchen2, null); View view;
if (PrjService.isPinPrinter(printerDeviceBean)) {
//针式暂时用这个新的布局
view = LinearLayout.inflate(context, R.layout.print_dot_matrix_kitchen, null);
} else {
view = LinearLayout.inflate(context, R.layout.print_kitchen, null);
}
TextView tvTableNumber = view.findViewById(R.id.tv_kitchen_print_table_number); TextView tvTableNumber = view.findViewById(R.id.tv_kitchen_print_table_number);
TextView tvOrderNumberText = view.findViewById(R.id.tv_order_num_text); TextView tvOrderNumberText = view.findViewById(R.id.tv_order_num_text);
TextView tvOrderNumber = view.findViewById(R.id.tv_order_num); TextView tvOrderNumber = view.findViewById(R.id.tv_order_num);
...@@ -267,7 +271,6 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -267,7 +271,6 @@ public class PrintPrjKitchen extends PrinterRoot {
TextView tvKitChenLocation = view.findViewById(R.id.tv_kitchen_location); TextView tvKitChenLocation = view.findViewById(R.id.tv_kitchen_location);
TextView tvPeople = view.findViewById(R.id.tv_people); TextView tvPeople = view.findViewById(R.id.tv_people);
TextView tvCurrentPageIndex = view.findViewById(R.id.tv_prj_page_index); TextView tvCurrentPageIndex = view.findViewById(R.id.tv_prj_page_index);
// RecyclerView rvFood = view.findViewById(R.id.rv_kitchen_food);
LinearLayout foodLayout = view.findViewById(R.id.ll_kitchen_food); LinearLayout foodLayout = view.findViewById(R.id.ll_kitchen_food);
TextView tvTableNumber2 = view.findViewById(R.id.tv_kitchen_print_table_number_bottom); TextView tvTableNumber2 = view.findViewById(R.id.tv_kitchen_print_table_number_bottom);
TextView tvFirstOrder = view.findViewById(R.id.tv_kitchen_print_first_order); TextView tvFirstOrder = view.findViewById(R.id.tv_kitchen_print_first_order);
...@@ -281,15 +284,14 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -281,15 +284,14 @@ public class PrintPrjKitchen extends PrinterRoot {
LinearLayout layoutOpenTableTime = view.findViewById(R.id.ll_opening_table_time); LinearLayout layoutOpenTableTime = view.findViewById(R.id.ll_opening_table_time);
foodLayout.addView(new KitChenPrjFoodView(context, data, printerDeviceBean)); foodLayout.addView(new KitChenPrjFoodView(context, data, printerDeviceBean));
// KitChenPrjPrintFoodAdapter foodAdapter = new KitChenPrjPrintFoodAdapter(data, printerDeviceBean);
// rvFood.setLayoutManager(new LinearLayoutManager(context));
// rvFood.setAdapter(foodAdapter);
//廚房位置 //廚房位置
if (!TextUtil.isEmptyOrNullOrUndefined(key) && !key.equals("-1")) { if (!TextUtil.isEmptyOrNullOrUndefined(key) && !key.equals("-1")) {
tvKitChenLocationText.setVisibility(View.VISIBLE); tvKitChenLocationText.setVisibility(View.VISIBLE);
tvKitChenLocation.setVisibility(View.VISIBLE);
tvKitChenLocation.setText(key); tvKitChenLocation.setText(key);
} else { } else {
tvKitChenLocationText.setVisibility(View.GONE); tvKitChenLocationText.setVisibility(View.GONE);
tvKitChenLocation.setVisibility(View.GONE);
} }
if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getBillNo())) { if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getBillNo())) {
...@@ -307,11 +309,6 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -307,11 +309,6 @@ public class PrintPrjKitchen extends PrinterRoot {
tvTableNumber2.setText("堂食"); tvTableNumber2.setText("堂食");
tvTableNumber.setText(prjBean.getTableName()); tvTableNumber.setText(prjBean.getTableName());
tvTableNumber2.setText(prjBean.getTableName()); tvTableNumber2.setText(prjBean.getTableName());
// if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getTakeFoodCode())) {
// tvTakeCodeText.setVisibility(View.VISIBLE);
// tvTakeCode.setVisibility(View.VISIBLE);
// tvTakeCode.setText(prjBean.getTakeFoodCode());
// }
break; break;
case OrderTypeConstans.order_type_7: case OrderTypeConstans.order_type_7:
layoutOpenTableTime.setVisibility(View.GONE); layoutOpenTableTime.setVisibility(View.GONE);
...@@ -344,45 +341,12 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -344,45 +341,12 @@ public class PrintPrjKitchen extends PrinterRoot {
} else { } else {
tvWaiter.setText(prjBean.getMemberName()); tvWaiter.setText(prjBean.getMemberName());
} }
// if (TextUtil.isEmptyOrNullOrUndefined(prjBean.getTableName())) {
// layoutOpenTableTime.setVisibility(View.GONE);
// switch (prjBean.getOrderType()) {
// case 1:
// case 3:
// tvTableNumber.setText("堂食");
// tvTableNumber2.setText("堂食");
// if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getTakeFoodCode())) {
// tvTakeCodeText.setVisibility(View.VISIBLE);
// tvTakeCode.setVisibility(View.VISIBLE);
// tvTakeCode.setText(prjBean.getTakeFoodCode());
// }
// break;
// case 7:
// tvTableNumber.setText("自取");
// tvTableNumber2.setText("自取");
// if (!TextUtil.isEmptyOrNullOrUndefined(prjBean.getTakeFoodCode())) {
// tvTakeCodeText.setVisibility(View.VISIBLE);
// tvTakeCode.setVisibility(View.VISIBLE);
// tvTakeCode.setText(prjBean.getTakeFoodCode());
// }
// break;
// default:
// tvTableNumber.setText("外賣");
// tvTableNumber2.setText("外賣");
// tvOrderNumberText.setText("訂單碼:");
// tvOrderNumber.setText(prjBean.getTakeFoodCode());
// break;
// }
// } else {
// tvTableNumber.setText(prjBean.getTableName());
// tvTableNumber2.setText(prjBean.getTableName());
// }
//人數 //人數
if (prjBean.getPerson() != 0) { tvPeople.setText(prjBean.getPerson() + "");
tvPeople.setText(prjBean.getPerson() + ""); int visibility = prjBean.getPerson() == 0 ? View.GONE : View.VISIBLE;
view.findViewById(R.id.tv_people_text).setVisibility(View.VISIBLE); view.findViewById(R.id.tv_people_text).setVisibility(visibility);
view.findViewById(R.id.tv_people).setVisibility(View.VISIBLE); tvPeople.setVisibility(visibility);
}
if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getTakeTime())) { if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getTakeTime())) {
tvTakeTime.setText("取餐:" + prjBean.getTakeTime()); tvTakeTime.setText("取餐:" + prjBean.getTakeTime());
} else if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getSendTime())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(prjBean.getSendTime())) {
...@@ -404,18 +368,6 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -404,18 +368,6 @@ public class PrintPrjKitchen extends PrinterRoot {
} }
//開台時間 //開台時間
tvOpeningTime.setText(TimeUtils.parseTimeRepeat(prjBean.getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_MDHM)); tvOpeningTime.setText(TimeUtils.parseTimeRepeat(prjBean.getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_MDHM));
// if (OpenTableManage.getDefault().getTableBean() != null) {
// //台號
// tvTableNumber.setText(prjBean.getTableName());
// tvTableNumber2.setText(prjBean.getTableName());
// //人數
// tvPeople.setText(prjBean.getPerson() + "");
// //訂單號
// tvOrderNumber.setText(prjBean.getOrderNo());
// //開台時間
// tvOpeningTime.setText(TimeUtils.parseTimeRepeat(prjBean.getOrderDetailsTime(), TimeUtils.DEFAULT_DATE_FORMAT));
// }
//落單時間,為當前時間 //落單時間,為當前時間
tvOrderTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_MDHM)); tvOrderTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_MDHM));
if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintPage, false)) { if (RestaurantExpandInfoUtils.getValue(ExpandConstant.PrintPage, false)) {
...@@ -423,7 +375,6 @@ public class PrintPrjKitchen extends PrinterRoot { ...@@ -423,7 +375,6 @@ public class PrintPrjKitchen extends PrinterRoot {
tvCurrentPageIndex.setText(prjBean.getCurrentIndex() + "/" + prjBean.getTotalPrj()); tvCurrentPageIndex.setText(prjBean.getCurrentIndex() + "/" + prjBean.getTotalPrj());
} }
} }
return viewToZoomBitmap(context, view, printerDeviceBean); return viewToZoomBitmap(context, view, printerDeviceBean);
} }
......
...@@ -9,7 +9,6 @@ import android.os.Build; ...@@ -9,7 +9,6 @@ import android.os.Build;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
...@@ -68,6 +67,7 @@ import com.joe.print.mvp.print.common.HtmlContract; ...@@ -68,6 +67,7 @@ import com.joe.print.mvp.print.common.HtmlContract;
import com.joe.print.mvp.print.common.PrinterFinderCallback; import com.joe.print.mvp.print.common.PrinterFinderCallback;
import com.joe.print.mvp.print.common.SendResultCode; import com.joe.print.mvp.print.common.SendResultCode;
import com.joe.print.mvp.print.maker.IpPrintMaker; import com.joe.print.mvp.print.maker.IpPrintMaker;
import com.joe.print.mvp.print.service.PrjService;
import com.joe.print.mvp.print.usb.EscCommand; import com.joe.print.mvp.print.usb.EscCommand;
import com.joe.print.mvp.print.usb.UsbPrint; import com.joe.print.mvp.print.usb.UsbPrint;
import com.joe.print.mvp.print.usb.UsbPrinter; import com.joe.print.mvp.print.usb.UsbPrinter;
...@@ -82,7 +82,6 @@ import com.xuexiang.rxutil2.rxjava.RxJavaUtils; ...@@ -82,7 +82,6 @@ import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxIOTask; import com.xuexiang.rxutil2.rxjava.task.RxIOTask;
import java.io.IOException; import java.io.IOException;
import java.net.ConnectException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
...@@ -454,6 +453,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -454,6 +453,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
*/ */
final Bitmap viewToZoomBitmap(Context context, View view, PrinterDeviceBean printerDeviceBean) { final Bitmap viewToZoomBitmap(Context context, View view, PrinterDeviceBean printerDeviceBean) {
LayoutToBitmapUtils.layoutView(context, view);//先测量view LayoutToBitmapUtils.layoutView(context, view);//先测量view
// return LayoutToBitmapUtils.loadBitmapFromView(view);
//轉為bitmap //轉為bitmap
return zoomBitmap(printerDeviceBean, LayoutToBitmapUtils.loadBitmapFromView(view)); return zoomBitmap(printerDeviceBean, LayoutToBitmapUtils.loadBitmapFromView(view));
} }
...@@ -467,11 +467,17 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -467,11 +467,17 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
*/ */
private Bitmap zoomBitmap(PrinterDeviceBean printerDeviceBean, Bitmap bitmap) { private Bitmap zoomBitmap(PrinterDeviceBean printerDeviceBean, Bitmap bitmap) {
int printWidth; int printWidth;
if (printerDeviceBean != null && printerDeviceBean.getPaperSpecification() != null) { if (PrjService.isPinPrinter(printerDeviceBean)) {
printWidth = Double.valueOf(printerDeviceBean.getPaperSpecification()).intValue(); //epson针式打印機
printWidth = 200;
return ImageUtils.dotMatrixZoomDrawable(bitmap, printWidth);
} else { } else {
//如果打印機沒設置寬度 if (printerDeviceBean != null && printerDeviceBean.getPaperSpecification() != null) {
printWidth = 480; printWidth = Double.valueOf(printerDeviceBean.getPaperSpecification()).intValue();
} else {
//如果打印機沒設置寬度
printWidth = 480;
}
} }
return ImageUtils.zoomDrawable(bitmap, printWidth); return ImageUtils.zoomDrawable(bitmap, printWidth);
} }
...@@ -939,7 +945,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut ...@@ -939,7 +945,7 @@ public abstract class PrinterRoot<T extends PrintContent> implements PrintExecut
} }
public View getAmountText(Context mContext, String text) { public View getAmountText(Context mContext, String text) {
return getTextView(mContext, text, Gravity.RIGHT, 24, ContextCompat.getColor(mContext, R.color.black)); return getTextView(mContext, text, Gravity.RIGHT, 28, ContextCompat.getColor(mContext, R.color.black));
} }
public TextView getTextView(Context mContext, String text, int gravity, float textSize) { public TextView getTextView(Context mContext, String text, int gravity, float textSize) {
......
...@@ -1044,7 +1044,7 @@ public class PrjService extends Service implements ReceiveListener { ...@@ -1044,7 +1044,7 @@ public class PrjService extends Service implements ReceiveListener {
* @param printerDeviceBean 打印機實體類 * @param printerDeviceBean 打印機實體類
* @return true是 * @return true是
*/ */
private boolean isPinPrinter(PrinterDeviceBean printerDeviceBean) { public static boolean isPinPrinter(PrinterDeviceBean printerDeviceBean) {
return (printerDeviceBean != null && printerDeviceBean.getPrinterName() != null && printerDeviceBean.getPrinterName().toLowerCase().contains("EPSON".toLowerCase())) return (printerDeviceBean != null && printerDeviceBean.getPrinterName() != null && printerDeviceBean.getPrinterName().toLowerCase().contains("EPSON".toLowerCase()))
&& (printerDeviceBean.getModel() != null && printerDeviceBean.getModel().toLowerCase().contains("TM-U220B".toLowerCase())); && (printerDeviceBean.getModel() != null && printerDeviceBean.getModel().toLowerCase().contains("TM-U220B".toLowerCase()));
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<TextView <TextView
android:id="@+id/print_brand_name" android:id="@+id/print_brand_name"
style="@style/Print_text_style" style="@style/Print_header_textStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<TextView <TextView
android:id="@+id/print_restaurant_name" android:id="@+id/print_restaurant_name"
style="@style/Print_text_style" style="@style/Print_header_textStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<style name="print_other_order_twenty_six_style"> <style name="print_other_order_twenty_six_style">
<item name="android:textColor">@color/theme_333_color</item> <item name="android:textColor">@color/theme_333_color</item>
<item name="android:textSize">@dimen/dp_26</item> <item name="android:textSize">@dimen/dp_28</item>
</style> </style>
<style name="print_other_order_thirty_style"> <style name="print_other_order_thirty_style">
...@@ -58,4 +58,10 @@ ...@@ -58,4 +58,10 @@
<item name="android:textSize">@dimen/dp_16</item> <item name="android:textSize">@dimen/dp_16</item>
<item name="android:textColor">@color/theme_color</item> <item name="android:textColor">@color/theme_color</item>
</style> </style>
<style name="Print_header_textStyle">
<item name="android:textSize">@dimen/dp_26</item>
<item name="android:textColor">@color/black</item>
</style>
</resources> </resources>
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.bean;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/19
* Time: 18:54
* Use:打印出庫單用
*/
public class OutboundOrderBean {
private String name;
private String value;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public OutboundOrderBean(String name, String value) {
this.name = name;
this.value = value;
}
}
...@@ -166,12 +166,12 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas ...@@ -166,12 +166,12 @@ public class PurchaseFoodBean implements Serializable, QMUISection.Model<Purchas
@Override @Override
public boolean isSameItem(PurchaseFoodBean other) { public boolean isSameItem(PurchaseFoodBean other) {
return false; return id.equals(other.id);
} }
@Override @Override
public boolean isSameContent(PurchaseFoodBean other) { public boolean isSameContent(PurchaseFoodBean other) {
return false; return foodNo.equals(other.foodNo);
} }
} }
package com.gingersoft.supply_chain.mvp.bean; package com.gingersoft.supply_chain.mvp.bean;
import java.io.Serializable;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
...@@ -31,7 +32,7 @@ public class WareHouseListBean { ...@@ -31,7 +32,7 @@ public class WareHouseListBean {
* purchaseWarehousingOrderDetailsVOS : [{"id":84,"name":"阿克苏苹果🍎","cateName":"特级水果","supplierName":"盒马生鲜","basicUnitName":"1","foodPrice":89,"foodNum":3,"foodAmount":267},{"id":67,"name":"大閘蟹","cateName":"海鮮","supplierName":"測試供應商1205","basicUnitName":"1","foodPrice":100,"foodNum":3,"foodAmount":300},{"id":66,"name":"澳洲龍蝦","cateName":"海鮮","supplierName":"測試供應商1205","basicUnitName":"1","foodPrice":100,"foodNum":3,"foodAmount":300},{"id":3,"name":"香蕉","cateName":"青菜","supplierName":"人民公社供應商","basicUnitName":"3","foodPrice":2,"foodNum":20,"foodAmount":200}] * purchaseWarehousingOrderDetailsVOS : [{"id":84,"name":"阿克苏苹果🍎","cateName":"特级水果","supplierName":"盒马生鲜","basicUnitName":"1","foodPrice":89,"foodNum":3,"foodAmount":267},{"id":67,"name":"大閘蟹","cateName":"海鮮","supplierName":"測試供應商1205","basicUnitName":"1","foodPrice":100,"foodNum":3,"foodAmount":300},{"id":66,"name":"澳洲龍蝦","cateName":"海鮮","supplierName":"測試供應商1205","basicUnitName":"1","foodPrice":100,"foodNum":3,"foodAmount":300},{"id":3,"name":"香蕉","cateName":"青菜","supplierName":"人民公社供應商","basicUnitName":"3","foodPrice":2,"foodNum":20,"foodAmount":200}]
*/ */
private TotalBean total; private TotalBean total;
private List<PurchaseWarehousingOrderDetailsVOSBean> purchaseWarehousingOrderDetailsVOS; private List<PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVOS;
/** /**
* 數量統計 * 數量統計
...@@ -71,7 +72,7 @@ public class WareHouseListBean { ...@@ -71,7 +72,7 @@ public class WareHouseListBean {
* 食品信息 * 食品信息
*/ */
@Data @Data
public static class PurchaseWarehousingOrderDetailsVOSBean { public static class PurchaseWarehousingOrderDetailsVO implements Serializable {
/** /**
* id : 84 * id : 84
* name : 阿克苏苹果🍎 * name : 阿克苏苹果🍎
...@@ -92,6 +93,7 @@ public class WareHouseListBean { ...@@ -92,6 +93,7 @@ public class WareHouseListBean {
private int foodNum; private int foodNum;
private double foodAmount; private double foodAmount;
private String images; private String images;
private boolean snFood;
} }
} }
} }
...@@ -52,7 +52,7 @@ public interface BuyIngredientsContract { ...@@ -52,7 +52,7 @@ public interface BuyIngredientsContract {
* 加載食品 * 加載食品
* @param food * @param food
*/ */
void loadFood(List<QMUISection<CategoryBean, PurchaseFoodBean>> food); void loadFood(int categoryId, List<QMUISection<CategoryBean, PurchaseFoodBean>> food);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
...@@ -28,7 +28,7 @@ public interface WareHouseListContract { ...@@ -28,7 +28,7 @@ public interface WareHouseListContract {
interface View extends IView { interface View extends IView {
void loadWarehousingInfo(WareHouseListBean.WareHousingDataBean data); void loadWarehousingInfo(WareHouseListBean.WareHousingDataBean data);
void loadListInfo(List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean> purchaseWarehousingOrderDetailsVos); void loadListInfo(List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVos);
void finishLoad(); void finishLoad();
......
...@@ -65,6 +65,10 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -65,6 +65,10 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
private List<CategoryFoodTreeBean> categoryFoodTreeBeans; private List<CategoryFoodTreeBean> categoryFoodTreeBeans;
private Map<Integer, List<QMUISection<CategoryBean, PurchaseFoodBean>>> foodSectionMap = new HashMap<>(); private Map<Integer, List<QMUISection<CategoryBean, PurchaseFoodBean>>> foodSectionMap = new HashMap<>();
/**
* 是否正在加載食品中
*/
private boolean isLoadFood = false;
@Inject @Inject
public BuyIngredientsPresenter(BuyIngredientsContract.Model model, BuyIngredientsContract.View rootView) { public BuyIngredientsPresenter(BuyIngredientsContract.Model model, BuyIngredientsContract.View rootView) {
...@@ -159,6 +163,17 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -159,6 +163,17 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} }
public void getFoodByCategoryId() { public void getFoodByCategoryId() {
}
public void getFood(int parentCategoryId) {
List<QMUISection<CategoryBean, PurchaseFoodBean>> foodSections = foodSectionMap.get(parentCategoryId);
if (foodSections == null) {
getFoodByCategoryId(parentCategoryId);
} else {
mRootView.loadFood(parentCategoryId, foodSections);
}
} }
/** /**
...@@ -166,7 +181,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -166,7 +181,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
* *
* @param parentCategoryId 父分類id * @param parentCategoryId 父分類id
*/ */
public void getFoodByCategoryId(int parentCategoryId) { private void getFoodByCategoryId(int parentCategoryId) {
Map<String, Object> map = new HashMap<>(5); Map<String, Object> map = new HashMap<>(5);
map.put("pageSize", 1000); map.put("pageSize", 1000);
map.put("pageIndex", 0); map.put("pageIndex", 0);
...@@ -191,7 +206,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -191,7 +206,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
//將食品和分類整合到一起,List<QMUISection<CategoryBean, PurchaseFoodBean>> //將食品和分類整合到一起,List<QMUISection<CategoryBean, PurchaseFoodBean>>
val sections = foodToList(info.getData()); val sections = foodToList(info.getData());
foodSectionMap.put(parentCategoryId, sections); foodSectionMap.put(parentCategoryId, sections);
mRootView.loadFood(sections); mRootView.loadFood(parentCategoryId, sections);
// mRootView.loadRightFoodIngredients(filterThisCategoryFood(categoryId, info.getData())); // mRootView.loadRightFoodIngredients(filterThisCategoryFood(categoryId, info.getData()));
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
...@@ -235,7 +250,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -235,7 +250,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
List<QMUISection<CategoryBean, PurchaseFoodBean>> sections = new ArrayList<>(); List<QMUISection<CategoryBean, PurchaseFoodBean>> sections = new ArrayList<>();
CategoryBean categoryBean = new CategoryBean(); CategoryBean categoryBean = new CategoryBean();
List<PurchaseFoodBean> purchaseFoodBeans = new ArrayList<>(); List<PurchaseFoodBean> purchaseFoodBeans = new ArrayList<>();
for (int i = 0; i < data.size(); i++) { for (int i = data.size() - 1; i >= 0; i--) {
PurchaseFoodBean purchaseFoodBean = data.get(i); PurchaseFoodBean purchaseFoodBean = data.get(i);
if (categoryBean.getId() == null) { if (categoryBean.getId() == null) {
categoryBean.setId(purchaseFoodBean.getFoodCategoryId()); categoryBean.setId(purchaseFoodBean.getFoodCategoryId());
...@@ -248,7 +263,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -248,7 +263,7 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} }
} }
purchaseFoodBeans.add(purchaseFoodBean); purchaseFoodBeans.add(purchaseFoodBean);
if (i == data.size() - 1) { if (i == 0) {
//最後一個食品 //最後一個食品
sections.add(new QMUISection<>(categoryBean, purchaseFoodBeans)); sections.add(new QMUISection<>(categoryBean, purchaseFoodBeans));
} }
...@@ -288,4 +303,13 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac ...@@ -288,4 +303,13 @@ public class BuyIngredientsPresenter extends BasePresenter<BuyIngredientsContrac
} }
return foods; return foods;
} }
public boolean isLoadFood() {
return isLoadFood;
}
public void setLoadFood(boolean loadFood) {
isLoadFood = loadFood;
}
} }
...@@ -23,6 +23,7 @@ import javax.inject.Inject; ...@@ -23,6 +23,7 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract; import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -51,6 +52,8 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -51,6 +52,8 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
@Inject @Inject
AppManager mAppManager; AppManager mAppManager;
private List<InventoryRecordBean> inventoryRecordBeanList;
@Inject @Inject
public WarehousingInventoryPresenter(WarehousingInventoryContract.Model model, WarehousingInventoryContract.View rootView) { public WarehousingInventoryPresenter(WarehousingInventoryContract.Model model, WarehousingInventoryContract.View rootView) {
super(model, rootView); super(model, rootView);
...@@ -122,7 +125,14 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve ...@@ -122,7 +125,14 @@ public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInve
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) { if (baseResult != null && baseResult.isSuccess()) {
List<InventoryRecordBean> inventoryRecordBeans = GsonUtils.jsonToList(baseResult.getData(), InventoryRecordBean.class); List<InventoryRecordBean> inventoryRecordBeans = GsonUtils.jsonToList(baseResult.getData(), InventoryRecordBean.class);
mRootView.loadRecord(inventoryRecordBeans); if (inventoryRecordBeanList == null) {
inventoryRecordBeanList = new ArrayList<>();
}
if (pageIndex == 0) {
inventoryRecordBeanList.clear();
}
inventoryRecordBeanList.addAll(inventoryRecordBeans);
mRootView.loadRecord(inventoryRecordBeanList);
} else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
} else { } else {
......
...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.ui.adapter; ...@@ -2,6 +2,7 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.text.Editable; import android.text.Editable;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -40,13 +41,14 @@ import butterknife.ButterKnife; ...@@ -40,13 +41,14 @@ import butterknife.ButterKnife;
public class BuyIngredientsAdapter extends QMUIDefaultStickySectionAdapter<CategoryBean, PurchaseFoodBean> { public class BuyIngredientsAdapter extends QMUIDefaultStickySectionAdapter<CategoryBean, PurchaseFoodBean> {
private Context context; private Context context;
private boolean isShowDouble = false; private boolean isSinger = true;
public BuyIngredientsAdapter(Context context, List<QMUISection<CategoryBean, PurchaseFoodBean>> food) { public BuyIngredientsAdapter(Context context, List<QMUISection<CategoryBean, PurchaseFoodBean>> food) {
this.context = context; this.context = context;
setData(food); setData(food);
} }
@NonNull @NonNull
@Override @Override
protected HeadViewHolder onCreateSectionHeaderViewHolder(@NonNull ViewGroup viewGroup) { protected HeadViewHolder onCreateSectionHeaderViewHolder(@NonNull ViewGroup viewGroup) {
...@@ -54,14 +56,14 @@ public class BuyIngredientsAdapter extends QMUIDefaultStickySectionAdapter<Categ ...@@ -54,14 +56,14 @@ public class BuyIngredientsAdapter extends QMUIDefaultStickySectionAdapter<Categ
} }
public int getLayoutId() { public int getLayoutId() {
if (isShowDouble) { if (isSinger) {
return R.layout.item_buy_food_ingredient_double_row; return R.layout.item_buy_food_ingredient;
} }
return R.layout.item_buy_food_ingredient; return R.layout.item_buy_food_ingredient_double_row;
} }
public void setShowDoubleRow(boolean showType) { public void setShowSingerRow(boolean showType) {
isShowDouble = showType; isSinger = showType;
} }
@NonNull @NonNull
...@@ -115,7 +117,7 @@ public class BuyIngredientsAdapter extends QMUIDefaultStickySectionAdapter<Categ ...@@ -115,7 +117,7 @@ public class BuyIngredientsAdapter extends QMUIDefaultStickySectionAdapter<Categ
//食材數量增加 //食材數量增加
purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() + 1); purchaseFoodBean.setFoodQuantity(purchaseFoodBean.getFoodQuantity() + 1);
itemViewHolder.edFoodIngredientNumber.setText(String.valueOf(purchaseFoodBean.getFoodQuantity())); itemViewHolder.edFoodIngredientNumber.setText(String.valueOf(purchaseFoodBean.getFoodQuantity()));
setSubAndNumShow(itemViewHolder, true); setSubAndNumShow(itemViewHolder, false);
}); });
//輸入框焦點監聽 //輸入框焦點監聽
itemViewHolder.edFoodIngredientNumber.setOnFocusChangeListener((v, hasFocus) -> { itemViewHolder.edFoodIngredientNumber.setOnFocusChangeListener((v, hasFocus) -> {
......
...@@ -22,13 +22,13 @@ public class ConsumptionReasonAdapter extends BaseQuickAdapter<ConsumeReasonBean ...@@ -22,13 +22,13 @@ public class ConsumptionReasonAdapter extends BaseQuickAdapter<ConsumeReasonBean
private int selectIndex = 0; private int selectIndex = 0;
public ConsumptionReasonAdapter(List<ConsumeReasonBean> consumeReasonBeans) { public ConsumptionReasonAdapter(List<ConsumeReasonBean> consumeReasonBeans) {
super(R.layout.item_consumption_reason, consumeReasonBeans); super(R.layout.btn_gray_to_blue, consumeReasonBeans);
addChildClickViewIds(R.id.cb_consumption_reason); addChildClickViewIds(R.id.cb_gray_to_blue);
} }
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, ConsumeReasonBean consumeReasonBean) { protected void convert(@NotNull BaseViewHolder viewHolder, ConsumeReasonBean consumeReasonBean) {
AppCompatCheckBox compatCheckBox = viewHolder.getView(R.id.cb_consumption_reason); AppCompatCheckBox compatCheckBox = viewHolder.getView(R.id.cb_gray_to_blue);
compatCheckBox.setText(consumeReasonBean.getDescription()); compatCheckBox.setText(consumeReasonBean.getDescription());
compatCheckBox.setChecked(viewHolder.getAdapterPosition() == selectIndex); compatCheckBox.setChecked(viewHolder.getAdapterPosition() == selectIndex);
} }
......
...@@ -6,12 +6,14 @@ import androidx.core.content.ContextCompat; ...@@ -6,12 +6,14 @@ import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; 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.R;
import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean; import com.gingersoft.supply_chain.mvp.bean.InventoryRecordBean;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.sql.Time;
import java.util.List; import java.util.List;
import cn.bingoogolapple.baseadapter.BGABaseAdapterUtil; import cn.bingoogolapple.baseadapter.BGABaseAdapterUtil;
...@@ -33,9 +35,9 @@ public class InventoryRecordAdapter extends BaseQuickAdapter<InventoryRecordBean ...@@ -33,9 +35,9 @@ public class InventoryRecordAdapter extends BaseQuickAdapter<InventoryRecordBean
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, InventoryRecordBean inventoryRecordBean) { protected void convert(@NotNull BaseViewHolder viewHolder, InventoryRecordBean inventoryRecordBean) {
viewHolder.setText(R.id.tv_inventory_record_username, inventoryRecordBean.getUserName()); viewHolder.setText(R.id.tv_inventory_record_username, inventoryRecordBean.getUserName());
viewHolder.setText(R.id.tv_inventory_record_number, inventoryRecordBean.getUserName()); viewHolder.setText(R.id.tv_inventory_record_number, String.valueOf(inventoryRecordBean.getRemainingQuantity()));
viewHolder.setText(R.id.tv_inventory_record_difference, inventoryRecordBean.getUserName()); viewHolder.setText(R.id.tv_inventory_record_difference, String.valueOf(inventoryRecordBean.getConsumeQuantity()));
viewHolder.setText(R.id.tv_inventory_record_operating_data, inventoryRecordBean.getUserName()); viewHolder.setText(R.id.tv_inventory_record_operating_data, TimeUtils.getTime(inventoryRecordBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT));
viewHolder.setTextColor(R.id.tv_inventory_record_username, ContextCompat.getColor(getContext(), R.color.color_3c)); viewHolder.setTextColor(R.id.tv_inventory_record_username, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setTextColor(R.id.tv_inventory_record_number, ContextCompat.getColor(getContext(), R.color.color_3c)); viewHolder.setTextColor(R.id.tv_inventory_record_number, ContextCompat.getColor(getContext(), R.color.color_3c));
...@@ -43,6 +45,12 @@ public class InventoryRecordAdapter extends BaseQuickAdapter<InventoryRecordBean ...@@ -43,6 +45,12 @@ public class InventoryRecordAdapter extends BaseQuickAdapter<InventoryRecordBean
viewHolder.setTextColor(R.id.tv_inventory_record_operating_data, ContextCompat.getColor(getContext(), R.color.color_3c)); viewHolder.setTextColor(R.id.tv_inventory_record_operating_data, ContextCompat.getColor(getContext(), R.color.color_3c));
viewHolder.setBackgroundColor(R.id.layout_inventory_record, BGABaseAdapterUtil.getColor(colors[viewHolder.getAdapterPosition() % 2])); viewHolder.setBackgroundColor(R.id.layout_inventory_record, BGABaseAdapterUtil.getColor(colors[viewHolder.getAdapterPosition() % 2]));
if (inventoryRecordBean.getConsumeQuantity() > 0) {
viewHolder.setTextColor(R.id.tv_inventory_record_difference, ContextCompat.getColor(getContext(), R.color.required_color));
} else {
viewHolder.setTextColor(R.id.tv_inventory_record_difference, ContextCompat.getColor(getContext(), R.color.purchase_buy_again_color));
}
} }
......
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.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.OutboundOrderBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/19
* Time: 18:59
* Use:
*/
public class OutboundOrderAdapter extends BaseQuickAdapter<OutboundOrderBean, BaseViewHolder> {
public OutboundOrderAdapter(@Nullable List<OutboundOrderBean> data) {
super(R.layout.item_outbound_order, data);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, OutboundOrderBean outboundOrderBean) {
viewHolder.setText(R.id.tv_item_name,outboundOrderBean.getName());
viewHolder.setText(R.id.tv_item_value,outboundOrderBean.getValue());
}
}
package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.pdf.PdfDocument;
import android.graphics.pdf.PdfRenderer;
import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.print.PageRange;
import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter;
import android.print.PrintDocumentInfo;
import android.print.pdf.PrintedPdfDocument;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/19
* Time: 17:56
* Use:
*/
public class PrintPdfAdapter extends PrintDocumentAdapter {
private Context context;
private int pageHeight;
private int pageWidth;
private PdfDocument mPdfDocument;
private int totalPages = 1;
private String pdfPath;
private List<Bitmap> mList;
public PrintPdfAdapter(Context context, String pdfPath) {
this.context = context;
this.pdfPath = pdfPath;
}
@Override
public void onLayout(PrintAttributes oldAttributes, PrintAttributes newAttributes, CancellationSignal cancellationSignal,
LayoutResultCallback callback,
Bundle metadata) {
mPdfDocument = new PrintedPdfDocument(context, newAttributes); //创建可打印PDF文档对象
pageHeight = PrintAttributes.MediaSize.ISO_A4.getHeightMils() * 72 / 1000; //设置尺寸
pageWidth = PrintAttributes.MediaSize.ISO_A4.getWidthMils() * 72 / 1000;
if (cancellationSignal.isCanceled()) {
callback.onLayoutCancelled();
return;
}
ParcelFileDescriptor mFileDescriptor;
PdfRenderer pdfRender = null;
PdfRenderer.Page page = null;
try {
mFileDescriptor = ParcelFileDescriptor.open(new File(pdfPath), ParcelFileDescriptor.MODE_READ_ONLY);
if (mFileDescriptor != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
pdfRender = new PdfRenderer(mFileDescriptor);
}
}
mList = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (pdfRender != null && pdfRender.getPageCount() > 0) {
totalPages = pdfRender.getPageCount();
for (int i = 0; i < pdfRender.getPageCount(); i++) {
if (null != page) {
page.close();
}
page = pdfRender.openPage(i);
Bitmap bmp = Bitmap.createBitmap(page.getWidth() * 2, page.getHeight() * 2, Bitmap.Config.ARGB_8888);
page.render(bmp, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
mList.add(bmp);
}
}
}
if (null != page) {
page.close();
}
if (null != mFileDescriptor) {
mFileDescriptor.close();
}
if (null != pdfRender) {
pdfRender.close();
}
} catch (IOException e) {
e.printStackTrace();
}
if (totalPages > 0) {
PrintDocumentInfo.Builder builder = new PrintDocumentInfo
.Builder("快速入门.pdf")
.setContentType(PrintDocumentInfo.CONTENT_TYPE_DOCUMENT)
.setPageCount(totalPages); //构建文档配置信息
PrintDocumentInfo info = builder.build();
callback.onLayoutFinished(info, true);
} else {
callback.onLayoutFailed("Page count is zero.");
}
}
@Override
public void onWrite(final PageRange[] pageRanges, final ParcelFileDescriptor destination, final CancellationSignal cancellationSignal,
final WriteResultCallback callback) {
for (int i = 0; i < totalPages; i++) {
if (pageInRange(pageRanges, i)) //保证页码正确
{
PdfDocument.PageInfo newPage = new PdfDocument.PageInfo.Builder(pageWidth,
pageHeight, i).create();
PdfDocument.Page page =
mPdfDocument.startPage(newPage); //创建新页面
if (cancellationSignal.isCanceled()) { //取消信号
callback.onWriteCancelled();
mPdfDocument.close();
mPdfDocument = null;
return;
}
drawPage(page, i); //将内容绘制到页面Canvas上
mPdfDocument.finishPage(page);
}
}
try {
mPdfDocument.writeTo(new FileOutputStream(
destination.getFileDescriptor()));
} catch (IOException e) {
callback.onWriteFailed(e.toString());
return;
} finally {
mPdfDocument.close();
mPdfDocument = null;
}
callback.onWriteFinished(pageRanges);
}
private boolean pageInRange(PageRange[] pageRanges, int page) {
for (PageRange pageRange : pageRanges) {
if ((page >= pageRange.getStart()) &&
(page <= pageRange.getEnd())) {
return true;
}
}
return false;
}
/**
* 页面绘制(渲染)
*/
private void drawPage(PdfDocument.Page page, int pagenumber) {
Canvas canvas = page.getCanvas();
if (mList != null) {
Paint paint = new Paint();
Bitmap bitmap = mList.get(pagenumber);
int bitmapWidth = bitmap.getWidth();
int bitmapHeight = bitmap.getHeight();
// 计算缩放比例
float scale = (float) pageWidth / (float) bitmapWidth;
// 取得想要缩放的matrix参数
Matrix matrix = new Matrix();
matrix.postScale(scale, scale);
canvas.drawBitmap(bitmap, matrix, paint);
}
}
}
...@@ -50,7 +50,11 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Fo ...@@ -50,7 +50,11 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Fo
TextView tvName = viewHolder.getView(R.id.tv_second_category_title); TextView tvName = viewHolder.getView(R.id.tv_second_category_title);
CardView cardView = viewHolder.getView(R.id.card_purchase_category); CardView cardView = viewHolder.getView(R.id.card_purchase_category);
viewHolder.setVisible(R.id.tv_second_category_title, TextUtil.isNotEmptyOrNullOrUndefined(categoryBean.getName())); viewHolder.setVisible(R.id.tv_second_category_title, TextUtil.isNotEmptyOrNullOrUndefined(categoryBean.getName()));
if (viewHolder.getAdapterPosition() == selectIndex) { notifyCheckState(viewHolder.getAdapterPosition(), tvName, cardView);
}
private void notifyCheckState(@NotNull int position, TextView tvName, CardView cardView) {
if (position == selectIndex) {
cardView.setBackground(ContextCompat.getDrawable(getContext(), checkedBg)); cardView.setBackground(ContextCompat.getDrawable(getContext(), checkedBg));
tvName.setTextColor(checkedTextColor); tvName.setTextColor(checkedTextColor);
} else { } else {
...@@ -59,6 +63,18 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Fo ...@@ -59,6 +63,18 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Fo
} }
} }
public static final int UPDATE_STATE = 101;
@Override
public void onBindViewHolder(@NotNull BaseViewHolder holder, int position, @NotNull List<Object> payloads) {
//list为空时,必须调用两个参数的onBindViewHolder(@NonNull LabelHolder holder, int position)
if (payloads.isEmpty()) {
onBindViewHolder(holder, position);
} else {
notifyCheckState(position, holder.getView(R.id.tv_second_category_title), holder.getView(R.id.card_purchase_category));
}
}
public SecondCategoryAdapter setCheckedBg(int checkedBg) { public SecondCategoryAdapter setCheckedBg(int checkedBg) {
this.checkedBg = checkedBg; this.checkedBg = checkedBg;
return this; return this;
...@@ -69,14 +85,14 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Fo ...@@ -69,14 +85,14 @@ public class SecondCategoryAdapter extends BaseQuickAdapter<OrderCategoryBean.Fo
return this; return this;
} }
public SecondCategoryAdapter setSelectIndex(int selectIndex) { public SecondCategoryAdapter setSelectedIndex(int selectIndex) {
int lastIndex = this.selectIndex; int lastIndex = this.selectIndex;
this.selectIndex = selectIndex; this.selectIndex = selectIndex;
if (lastIndex >= 0 && lastIndex < getItemCount()) { if (lastIndex >= 0 && lastIndex < getItemCount()) {
notifyItemChanged(lastIndex); notifyItemChanged(lastIndex, UPDATE_STATE);
} }
if (this.selectIndex >= 0 && this.selectIndex < getItemCount()) { if (this.selectIndex >= 0 && this.selectIndex < getItemCount()) {
notifyItemChanged(this.selectIndex); notifyItemChanged(this.selectIndex, UPDATE_STATE);
} }
return this; return this;
} }
......
...@@ -20,19 +20,19 @@ import java.util.List; ...@@ -20,19 +20,19 @@ import java.util.List;
* Time: 16:36 * Time: 16:36
* Use:庫存查詢的訂單列表 * Use:庫存查詢的訂單列表
*/ */
public class WarehousingQueryAdapter extends BaseQuickAdapter<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean, BaseViewHolder> { public class WarehousingQueryAdapter extends BaseQuickAdapter<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO, BaseViewHolder> {
private Context context; private Context context;
private int[] colors = new int[]{R.color.color_f9, R.color.white}; private int[] colors = new int[]{R.color.color_f9, R.color.white};
public WarehousingQueryAdapter(Context context, List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean> purchaseWarehousingOrderDetailsVosBeans) { public WarehousingQueryAdapter(Context context, List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVosBeans) {
super(R.layout.item_warehousing_query, purchaseWarehousingOrderDetailsVosBeans); super(R.layout.item_warehousing_query, purchaseWarehousingOrderDetailsVosBeans);
addChildClickViewIds(R.id.tv_warehouse_item_inventory_quantity); addChildClickViewIds(R.id.tv_warehouse_item_inventory_quantity);
this.context = context; this.context = context;
} }
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean item) { protected void convert(@NotNull BaseViewHolder viewHolder, WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO item) {
viewHolder.setText(R.id.tv_warehouse_item_ingredients_name, item.getName()); viewHolder.setText(R.id.tv_warehouse_item_ingredients_name, item.getName());
viewHolder.setText(R.id.tv_warehouse_item_ingredients_species, item.getFoodCategoryName()); viewHolder.setText(R.id.tv_warehouse_item_ingredients_species, item.getFoodCategoryName());
viewHolder.setText(R.id.tv_warehouse_item_unit, item.getUnitName()); viewHolder.setText(R.id.tv_warehouse_item_unit, item.getUnitName());
......
...@@ -113,8 +113,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr ...@@ -113,8 +113,8 @@ public class FunctionListFragment extends BaseSupplyChainFragment<FunctionListPr
start(SupplierListFragment.newInstance(false, null)); start(SupplierListFragment.newInstance(false, null));
break; break;
case "食材": case "食材":
start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS)); // start(FoodIngredientsFragment.newInstance(FOOD_INGREDIENTS));
// start(BuyIngredientsFragment.newInstance()); start(BuyIngredientsFragment.newInstance());
break; break;
case "種類": case "種類":
start(CategoryFragment.newInstance()); start(CategoryFragment.newInstance());
......
...@@ -79,8 +79,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -79,8 +79,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
private PurchaseOrderAdapter purchaseOrderAdapter; private PurchaseOrderAdapter purchaseOrderAdapter;
public static PurchaseListFragment newInstance() { public static PurchaseListFragment newInstance() {
PurchaseListFragment fragment = new PurchaseListFragment(); return new PurchaseListFragment();
return fragment;
} }
/** /**
...@@ -187,9 +186,12 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -187,9 +186,12 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
.setOnSelectListener((popupPosition, text) -> { .setOnSelectListener((popupPosition, text) -> {
if (popupPosition == 0) { if (popupPosition == 0) {
//刪除 //刪除
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> { if (purchaseOrderAdapter.getItem(position).getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
mPresenter.deleteOrder(position, purchaseOrderAdapter.getData().get(position).getId()); //只有待收貨可以刪除
}); AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> mPresenter.deleteOrder(position, purchaseOrderAdapter.getData().get(position).getId()));
} else {
showMessage("該訂單已有入庫食品,不可刪除!");
}
} else if (popupPosition == 1) { } else if (popupPosition == 1) {
//發送採購單 //發送採購單
sendPurchase(position); sendPurchase(position);
...@@ -252,7 +254,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -252,7 +254,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); screenView.setVisibility(screenView.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
} else if (viewId == R.id.iv_purchase_list_search) { } else if (viewId == R.id.iv_purchase_list_search) {
getOrderList(); getOrderList();
} else if(viewId == R.id.btn_save){ } else if (viewId == R.id.btn_save) {
//跳轉到下單頁面 //跳轉到下單頁面
startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE); startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
} }
...@@ -293,13 +295,14 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -293,13 +295,14 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
@Override @Override
public void deleteOrder(int position) { public void deleteOrder(int position) {
purchaseOrderAdapter.removeAt(position); purchaseOrderAdapter.removeAt(position);
showMessage("訂單已刪除,請打電話聯繫供應商訂單刪除!");
} }
@Override @Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) { public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data); super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ORDER_DETAILS_CODE) { if (requestCode == REQUEST_ORDER_DETAILS_CODE) {
// //用戶對訂單進行了操作,需要對列表進行刷新 //用戶對訂單進行了操作,需要對列表進行刷新
getOrderList(); getOrderList();
} }
} }
......
...@@ -38,6 +38,8 @@ import butterknife.OnClick; ...@@ -38,6 +38,8 @@ import butterknife.OnClick;
/** /**
* 庫存查詢列表 * 庫存查詢列表
*
* @author admin
*/ */
public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseListPresenter> implements WareHouseListContract.View { public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseListPresenter> implements WareHouseListContract.View {
...@@ -59,14 +61,13 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -59,14 +61,13 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
RecyclerView rvWarehouseList; RecyclerView rvWarehouseList;
@BindView(R2.id.sl_warehousing_list) @BindView(R2.id.sl_warehousing_list)
SmartRefreshLayout smartRefreshLayout; SmartRefreshLayout smartRefreshLayout;
// @BindView(R2.id.hs_warehousing_list)
// HorizontalScrollView hsWarehousingList;
@BindView(R2.id.tv_warehouse_item_unit_price) @BindView(R2.id.tv_warehouse_item_unit_price)
TextView tvUnitPrice; TextView tvUnitPrice;
@BindView(R2.id.tv_warehouse_item_inventory_quantity) @BindView(R2.id.tv_warehouse_item_inventory_quantity)
TextView tvWarehousingQuantity; TextView tvWarehousingQuantity;
@BindView(R2.id.tv_warehouse_item_total_amount) @BindView(R2.id.tv_warehouse_item_total_amount)
TextView tvTotalAmount; TextView tvTotalAmount;
private int SORT_TYPE = 0; private int SORT_TYPE = 0;
/** /**
* 升序或降序 * 升序或降序
...@@ -80,8 +81,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -80,8 +81,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
private WarehousingQueryAdapter warehousingQueryAdapter; private WarehousingQueryAdapter warehousingQueryAdapter;
public static WareHouseListFragment newInstance() { public static WareHouseListFragment newInstance() {
WareHouseListFragment fragment = new WareHouseListFragment(); return new WareHouseListFragment();
return fragment;
} }
@Override @Override
...@@ -151,9 +151,9 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -151,9 +151,9 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
@Override @Override
public void loadWarehousingInfo(WareHouseListBean.WareHousingDataBean data) { public void loadWarehousingInfo(WareHouseListBean.WareHousingDataBean data) {
WareHouseListBean.WareHousingDataBean.TotalBean total = data.getTotal(); WareHouseListBean.WareHousingDataBean.TotalBean total = data.getTotal();
tvOverdueFoodNum.setText(total.getOverdue() + ""); tvOverdueFoodNum.setText(String.valueOf(total.getOverdue()));
tvExpiringSoonFoodNum.setText(total.getAboutExpire() + ""); tvExpiringSoonFoodNum.setText(String.valueOf(total.getAboutExpire()));
tvLowInventoryFoodNum.setText(total.getOutStock() + ""); tvLowInventoryFoodNum.setText(String.valueOf(total.getOutStock()));
tvIngredientsCostInventory.setText(String.format(getString(R.string.amount_string), total.getCost())); tvIngredientsCostInventory.setText(String.format(getString(R.string.amount_string), total.getCost()));
loadListInfo(data.getPurchaseWarehousingOrderDetailsVOS()); loadListInfo(data.getPurchaseWarehousingOrderDetailsVOS());
} }
...@@ -171,7 +171,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -171,7 +171,7 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
} }
@Override @Override
public void loadListInfo(List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean> purchaseWarehousingOrderDetailsVos) { public void loadListInfo(List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO> purchaseWarehousingOrderDetailsVos) {
if (purchaseWarehousingOrderDetailsVos == null || purchaseWarehousingOrderDetailsVos.size() <= 0) { if (purchaseWarehousingOrderDetailsVos == null || purchaseWarehousingOrderDetailsVos.size() <= 0) {
loadService.showCallback(EmptyCallback.class); loadService.showCallback(EmptyCallback.class);
return; return;
......
...@@ -13,7 +13,6 @@ import android.widget.TextView; ...@@ -13,7 +13,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils; import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
...@@ -28,11 +27,11 @@ import com.gingersoft.supply_chain.mvp.presenter.WarehousingInventoryPresenter; ...@@ -28,11 +27,11 @@ import com.gingersoft.supply_chain.mvp.presenter.WarehousingInventoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.InventoryRecordAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.InventoryRecordAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import com.zhy.autolayout.utils.ScreenUtils; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import org.w3c.dom.Text; import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import java.util.List; import java.util.List;
...@@ -57,22 +56,16 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -57,22 +56,16 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
@BindView(R2.id.rv_warehouse_inventory_record) @BindView(R2.id.rv_warehouse_inventory_record)
RecyclerView rvRecord; RecyclerView rvRecord;
private InventoryRecordAdapter adapter; private InventoryRecordAdapter adapter;
/** @BindView(R2.id.smart_inventory_record)
* 食品總庫存 SmartRefreshLayout smartRefreshLayout;
*/
private int foodNum;
private String foodNo;
private int pageIndex; private int pageIndex;
public static WarehousingInventoryFragment newInstance(WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean purchaseWarehousingOrderDetailsVosBean) { private WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVo;
public static WarehousingInventoryFragment newInstance(WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO purchaseWarehousingOrderDetailsVo) {
WarehousingInventoryFragment fragment = new WarehousingInventoryFragment(); WarehousingInventoryFragment fragment = new WarehousingInventoryFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(WarehouseDetailsFragment.FOOD_NAME_KEY, purchaseWarehousingOrderDetailsVosBean.getName()); bundle.putSerializable(WarehouseDetailsFragment.FOOD_INFO_KEY, purchaseWarehousingOrderDetailsVo);
bundle.putInt(WarehouseDetailsFragment.FOOD_ID_KEY, purchaseWarehousingOrderDetailsVosBean.getId());
bundle.putInt(WarehouseDetailsFragment.FOOD_NUM_KEY, purchaseWarehousingOrderDetailsVosBean.getFoodNum());
bundle.putString(WarehouseDetailsFragment.FOOD_NO_KEY, purchaseWarehousingOrderDetailsVosBean.getFoodNo());
bundle.putString(WarehouseDetailsFragment.FOOD_IMAGE_KEY, purchaseWarehousingOrderDetailsVosBean.getImages());
fragment.setArguments(bundle); fragment.setArguments(bundle);
return fragment; return fragment;
} }
...@@ -96,34 +89,38 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -96,34 +89,38 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
int foodId = arguments.getInt(WarehouseDetailsFragment.FOOD_ID_KEY); purchaseWarehousingOrderDetailsVo = (WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVO) arguments.getSerializable(WarehouseDetailsFragment.FOOD_INFO_KEY);
//食品編號
foodNo = arguments.getString(WarehouseDetailsFragment.FOOD_NO_KEY);
//食品庫存總數
foodNum = arguments.getInt(WarehouseDetailsFragment.FOOD_NUM_KEY);
//獲取庫存盤點記錄 //獲取庫存盤點記錄
getWarehousingRecord(); getWarehousingRecord();
//加載食品圖片 //加載食品圖片
loadFoodImage(arguments); loadFoodImage();
//初始化標題 //初始化標題
initTopBar(arguments); initTopBar(purchaseWarehousingOrderDetailsVo.getName());
//初始化數量和編輯監聽 //初始化數量和編輯監聽
initEdit(); initEdit();
} else { } else {
showMessage("獲取食材信息失敗,請稍候重試"); showMessage("獲取食材信息失敗,請稍候重試");
killMyself(); killMyself();
} }
smartRefreshLayout.setOnRefreshListener(refreshLayout -> {
pageIndex = 0;
getWarehousingRecord();
});
smartRefreshLayout.setOnLoadMoreListener(refreshLayout -> {
pageIndex++;
getWarehousingRecord();
});
} }
private void getWarehousingRecord() { private void getWarehousingRecord() {
mPresenter.getWarehousingRecord(foodNo, pageIndex); mPresenter.getWarehousingRecord(purchaseWarehousingOrderDetailsVo.getFoodNo(), pageIndex);
} }
private void initEdit() { private void initEdit() {
//庫存數量 //庫存數量
tvWarehouseTotal.setText(String.valueOf(foodNum)); tvWarehouseTotal.setText(String.valueOf(purchaseWarehousingOrderDetailsVo.getFoodNum()));
//庫存差異 //庫存差異
tvWarehouseDifference.setText(String.valueOf(foodNum)); tvWarehouseDifference.setText(String.valueOf(purchaseWarehousingOrderDetailsVo.getFoodNum()));
edWarehouseLoss.setOnFocusChangeListener((v, hasFocus) -> { edWarehouseLoss.setOnFocusChangeListener((v, hasFocus) -> {
//當輸入框獲得焦點時,數量為0,去掉0 //當輸入框獲得焦點時,數量為0,去掉0
if (hasFocus && edWarehouseLoss.getText().toString().equals("0")) { if (hasFocus && edWarehouseLoss.getText().toString().equals("0")) {
...@@ -152,16 +149,15 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -152,16 +149,15 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
// edWarehouseLoss.setText(String.valueOf(foodNum)); // edWarehouseLoss.setText(String.valueOf(foodNum));
// edWarehouseLoss.setSelection(edWarehouseLoss.getText().length()); // edWarehouseLoss.setSelection(edWarehouseLoss.getText().length());
// } // }
tvWarehouseDifference.setText(String.valueOf(Math.abs(foodNum - inventoryNum))); tvWarehouseDifference.setText(String.valueOf(Math.abs(purchaseWarehousingOrderDetailsVo.getFoodNum() - inventoryNum)));
} else { } else {
tvWarehouseDifference.setText(String.valueOf(foodNum)); tvWarehouseDifference.setText(String.valueOf(purchaseWarehousingOrderDetailsVo.getFoodNum()));
} }
} }
}); });
} }
private void initTopBar(Bundle arguments) { private void initTopBar(String foodName) {
String foodName = arguments.getString(WarehouseDetailsFragment.FOOD_NAME_KEY);
//初始化標題 //初始化標題
initTopBar(supplyTopBar, foodName); initTopBar(supplyTopBar, foodName);
//添加保存按鈕 //添加保存按鈕
...@@ -170,10 +166,9 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -170,10 +166,9 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
btnSave.setOnClickListener(mOnClickListener); btnSave.setOnClickListener(mOnClickListener);
} }
private void loadFoodImage(Bundle arguments) { private void loadFoodImage() {
String foodImageUrl = arguments.getString(WarehouseDetailsFragment.FOOD_IMAGE_KEY); if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseWarehousingOrderDetailsVo.getImages())) {
if (TextUtil.isNotEmptyOrNullOrUndefined(foodImageUrl)) { GlideUtils.display(requireContext(), ivWarehouseImg, purchaseWarehousingOrderDetailsVo.getImages());
GlideUtils.display(requireContext(), ivWarehouseImg, foodImageUrl);
} else { } else {
ivWarehouseImg.setImageResource(R.drawable.img_small_default); ivWarehouseImg.setImageResource(R.drawable.img_small_default);
} }
...@@ -192,8 +187,8 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -192,8 +187,8 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
showMessage("請輸入盤點庫存數量"); showMessage("請輸入盤點庫存數量");
edWarehouseLoss.requestFocus(); edWarehouseLoss.requestFocus();
} else { } else {
int remainingAmount = foodNum - inventoryNum; int remainingAmount = purchaseWarehousingOrderDetailsVo.getFoodNum() - inventoryNum;
mPresenter.consumeWareHousing(foodNo, remainingAmount); mPresenter.consumeWareHousing(purchaseWarehousingOrderDetailsVo.getFoodNo(), remainingAmount);
} }
} }
} }
...@@ -206,6 +201,8 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho ...@@ -206,6 +201,8 @@ public class WarehousingInventoryFragment extends BaseSupplyChainFragment<Wareho
@Override @Override
public void loadRecord(List<InventoryRecordBean> inventoryRecordBeans) { public void loadRecord(List<InventoryRecordBean> inventoryRecordBeans) {
smartRefreshLayout.finishLoadMore();
smartRefreshLayout.finishRefresh();
//加載盤點記錄 //加載盤點記錄
if (adapter == null) { if (adapter == null) {
adapter = new InventoryRecordAdapter(inventoryRecordBeans); adapter = new InventoryRecordAdapter(inventoryRecordBeans);
......
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
/**
* @author 宇航.
* User: admin
* Date: 2021/3/23
* Time: 15:38
* Use:
*/
public class CenterLayoutManager extends LinearLayoutManager {
public CenterLayoutManager(Context context) {
super(context);
}
public CenterLayoutManager(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
public CenterLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
RecyclerView.SmoothScroller smoothScroller = new CenterSmoothScroller(recyclerView.getContext());
smoothScroller.setTargetPosition(position);
startSmoothScroll(smoothScroller);
}
private static class CenterSmoothScroller extends LinearSmoothScroller {
public CenterSmoothScroller(Context context) {
super(context);
}
/**
*
* @param viewStart view起點
* @param viewEnd view重點
* @param boxStart 整個recyclerview的起點
* @param boxEnd 整個recyclerview的終點
* @param snapPreference 未知
* @return 滑動到哪個位置
*/
@Override
public int calculateDtToFit(int viewStart, int viewEnd, int boxStart, int boxEnd, int snapPreference) {
return (boxStart + (boxEnd - boxStart) / 2) - (viewStart + (viewEnd - viewStart) / 2);
}
/**
* 滑動速度
*/
@Override
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
return 100f / displayMetrics.densityDpi;
}
}
}
...@@ -52,21 +52,24 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -52,21 +52,24 @@ public class InventoryConsumptionView extends FrameLayout {
QMUIAlphaTextView tvConfirm; QMUIAlphaTextView tvConfirm;
@BindView(R2.id.tv_cancel) @BindView(R2.id.tv_cancel)
QMUIAlphaTextView tvCancel; QMUIAlphaTextView tvCancel;
@BindView(R2.id.layout_inventory_btn)
LinearLayout layoutBtn;
private OnConfirmClickListener onConfirmClickListener; private OnConfirmClickListener onConfirmClickListener;
private ScanSnView.OnCancelListener onCancelListener;
private ConsumptionReasonAdapter consumptionReasonAdapter; private ConsumptionReasonAdapter consumptionReasonAdapter;
public InventoryConsumptionView(@NonNull Context context, List<ConsumeReasonBean> consumeReasonBeans, int maxConsumption) { public InventoryConsumptionView(@NonNull Context context, List<ConsumeReasonBean> consumeReasonBeans, int maxConsumption) {
super(context); super(context);
View rootView = LayoutInflater.from(context).inflate(R.layout.layout_inventory_consumption, null,false); View rootView = LayoutInflater.from(context).inflate(R.layout.layout_inventory_consumption, null, false);
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
addView(rootView); addView(rootView);
this.maxConsumption = maxConsumption; this.maxConsumption = maxConsumption;
edRemarks.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(getContext())}); edRemarks.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), RemarkProvider.REMARK_TEXT_LENGTH), InputFilterUtils.getChAndEnAndNumAndPtInputFilter(getContext())});
consumptionReasonAdapter = new ConsumptionReasonAdapter(consumeReasonBeans); consumptionReasonAdapter = new ConsumptionReasonAdapter(consumeReasonBeans);
consumptionReasonAdapter.setOnItemChildClickListener((adapter, view, position) -> consumptionReasonAdapter.setSelectIndex(position)); consumptionReasonAdapter.setOnItemChildClickListener((adapter, view, position) -> consumptionReasonAdapter.setSelectIndex(position));
rvConsumptionReason.setLayoutManager(new GridLayoutManager(getContext(), 2)); rvConsumptionReason.setLayoutManager(new GridLayoutManager(getContext(), 3));
rvConsumptionReason.setAdapter(consumptionReasonAdapter); rvConsumptionReason.setAdapter(consumptionReasonAdapter);
tvCancel.setOnClickListener(v -> onCancelListener.onCancel());
tvConfirm.setOnClickListener(v -> { tvConfirm.setOnClickListener(v -> {
if (onConfirmClickListener != null) { if (onConfirmClickListener != null) {
String s = edInput.getText().toString(); String s = edInput.getText().toString();
...@@ -119,6 +122,16 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -119,6 +122,16 @@ public class InventoryConsumptionView extends FrameLayout {
return this; return this;
} }
public InventoryConsumptionView setOnCancelListener(ScanSnView.OnCancelListener onCancelListener) {
this.onCancelListener = onCancelListener;
return this;
}
public InventoryConsumptionView setShowBtn() {
layoutBtn.setVisibility(VISIBLE);
return this;
}
public String getRemark() { public String getRemark() {
return edRemarks.getText().toString(); return edRemarks.getText().toString();
} }
...@@ -132,6 +145,10 @@ public class InventoryConsumptionView extends FrameLayout { ...@@ -132,6 +145,10 @@ public class InventoryConsumptionView extends FrameLayout {
return consumptionReasonAdapter.getSelectIndex(); return consumptionReasonAdapter.getSelectIndex();
} }
public boolean getIsPrint() {
return switchMultiBooleanState.isChecked();
}
/** /**
* 獲取消耗數量 * 獲取消耗數量
* *
......
...@@ -85,7 +85,7 @@ public class ScanSnView extends FrameLayout { ...@@ -85,7 +85,7 @@ public class ScanSnView extends FrameLayout {
} }
private void init() { private void init() {
View rootView = LayoutInflater.from(getContext()).inflate(R.layout.layout_scan_sn, null, false); View rootView = LayoutInflater.from(getContext()).inflate(R.layout.layout_scan_sn, this, false);
ButterKnife.bind(this, rootView); ButterKnife.bind(this, rootView);
//初始化adapter //初始化adapter
SnCodeAdapter adapter = new SnCodeAdapter(R.layout.item_sn_code, snCodes); SnCodeAdapter adapter = new SnCodeAdapter(R.layout.item_sn_code, snCodes);
......
...@@ -57,7 +57,7 @@ public class ShowSecondCategoryPopup extends AttachPopupView { ...@@ -57,7 +57,7 @@ public class ShowSecondCategoryPopup extends AttachPopupView {
flexboxLayoutManager.setFlexWrap(FlexWrap.WRAP); flexboxLayoutManager.setFlexWrap(FlexWrap.WRAP);
recyclerView.setLayoutManager(flexboxLayoutManager); recyclerView.setLayoutManager(flexboxLayoutManager);
SecondCategoryAdapter secondCategoryAdapter = new SecondCategoryAdapter(getContext(), foodCategoryTreesList); SecondCategoryAdapter secondCategoryAdapter = new SecondCategoryAdapter(getContext(), foodCategoryTreesList);
secondCategoryAdapter.setSelectIndex(defaultSelect); secondCategoryAdapter.setSelectedIndex(defaultSelect);
secondCategoryAdapter.setOnItemClickListener((adapter, view, position) -> { secondCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
if (!showThirdCategory) { if (!showThirdCategory) {
//三級分類就不回調 //三級分類就不回調
......
...@@ -35,8 +35,9 @@ public class TextPopup extends CenterPopupView { ...@@ -35,8 +35,9 @@ public class TextPopup extends CenterPopupView {
protected void onCreate() { protected void onCreate() {
super.onCreate(); super.onCreate();
TextView tvTitle = findViewById(R.id.tv_title); TextView tvTitle = findViewById(R.id.tv_title);
tvTitle.setText(title); tvTitle.setText(title);
TextView tvContent = findViewById(R.id.tv_content); TextView tvContent = findViewById(R.id.tv_content);
tvContent.setText(content); tvContent.setText(content.replace("\\n", "\n"));
} }
} }
...@@ -26,7 +26,7 @@ public class ViewUtils { ...@@ -26,7 +26,7 @@ public class ViewUtils {
int halfLeftRvHeight = recyclerView.getHeight() / 2; int halfLeftRvHeight = recyclerView.getHeight() / 2;
if (childAt != null) { if (childAt != null) {
//中間位置那個item減去一半的高度等於中間item一半顯示在列表中間 //中間位置那個item減去一半的高度等於中間item一半顯示在列表中間
int y = (int) (childAt.getTop() - halfLeftRvHeight); int y = childAt.getTop() - halfLeftRvHeight;
recyclerView.smoothScrollBy(0, y); recyclerView.smoothScrollBy(0, y);
} }
} }
...@@ -42,7 +42,7 @@ public class ViewUtils { ...@@ -42,7 +42,7 @@ public class ViewUtils {
int halfLeftRvHeight = recyclerView.getWidth() / 2; int halfLeftRvHeight = recyclerView.getWidth() / 2;
if (childAt != null) { if (childAt != null) {
//中間位置那個item減去一半的高度等於中間item一半顯示在列表中間 //中間位置那個item減去一半的高度等於中間item一半顯示在列表中間
int x = (int) (childAt.getLeft() - halfLeftRvHeight); int x = childAt.getLeft() - halfLeftRvHeight;
recyclerView.smoothScrollBy(x, 0); recyclerView.smoothScrollBy(x, 0);
} }
} }
......
<?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">
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/cb_gray_to_blue"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_2"
android:layout_marginRight="@dimen/dp_2"
android:layout_marginBottom="@dimen/dp_15"
android:background="@drawable/selector_new_order_radio_bg"
android:button="@null"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5"
android:textColor="@color/s_gray_blue"
android:textSize="@dimen/dp_15"
tools:text="正常消耗" />
</FrameLayout>
...@@ -105,66 +105,72 @@ ...@@ -105,66 +105,72 @@
</LinearLayout> </LinearLayout>
<LinearLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/layout_right_content"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="4" android:layout_weight="4"
android:orientation="vertical"> android:orientation="vertical">
<!-- 二級分類 --> <com.google.android.material.appbar.AppBarLayout
<LinearLayout
android:id="@+id/layout_category" android:id="@+id/layout_category"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white" android:layout_marginBottom="@dimen/dp_5"
android:orientation="horizontal"> android:background="@color/white">
<!-- 二級分類 -->
<androidx.recyclerview.widget.RecyclerView <com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/rv_food_ingredients_second_category" android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" /> app:layout_scrollFlags="scroll|enterAlways">
<androidx.cardview.widget.CardView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/card_show_more_category" android:id="@+id/rv_food_ingredients_second_category"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:background="@color/white" android:layout_marginRight="@dimen/dp_58" />
app:cardElevation="@dimen/dp_10">
<LinearLayout <androidx.cardview.widget.CardView
android:id="@+id/card_show_more_category"
android:layout_width="@dimen/dp_58" android:layout_width="@dimen/dp_58"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@color/white" android:background="@color/white"
android:gravity="center"> app:cardElevation="@dimen/dp_10">
<ImageView <LinearLayout
android:id="@+id/iv_unfold_arrow" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:layout_height="wrap_content" android:background="@color/white"
android:src="@drawable/ic_inverted_triangle_66" /> android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_unfold_category" <ImageView
android:layout_width="wrap_content" android:id="@+id/iv_unfold_arrow"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_marginLeft="@dimen/dp_3" android:layout_height="wrap_content"
android:text="展開" android:src="@drawable/ic_inverted_triangle_66" />
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12" /> <TextView
android:id="@+id/tv_unfold_category"
</LinearLayout> android:layout_width="wrap_content"
</androidx.cardview.widget.CardView> android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_3"
</LinearLayout> android:text="展開"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<!-- 食材 --> <!-- 食材 -->
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refreshLayout" android:id="@+id/refreshLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_5"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout <com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout
android:id="@+id/section_food_ingredients" android:id="@+id/section_food_ingredients"
...@@ -173,13 +179,15 @@ ...@@ -173,13 +179,15 @@
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
<!-- <androidx.recyclerview.widget.RecyclerView--> <!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rv_food_ingredients"--> <!-- android:id="@+id/rv_food_ingredients"-->
<!-- android:layout_width="match_parent"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"--> <!-- android:layout_height="match_parent"-->
<!-- android:layout_marginTop="@dimen/dp_5"--> <!-- android:layout_marginTop="@dimen/dp_5"-->
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />--> <!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />-->
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg" android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/dp_10" android:paddingTop="@dimen/dp_10"
...@@ -100,6 +102,7 @@ ...@@ -100,6 +102,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -128,7 +131,6 @@ ...@@ -128,7 +131,6 @@
android:text="出庫流水" android:text="出庫流水"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17" /> android:textSize="@dimen/dp_17" />
</LinearLayout> </LinearLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
......
...@@ -122,13 +122,25 @@ ...@@ -122,13 +122,25 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<include layout="@layout/item_inventory_record" /> <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/smart_inventory_record"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehouse_inventory_record"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_1"
android:orientation="vertical">
<include layout="@layout/item_inventory_record" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_warehouse_inventory_record"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</LinearLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginBottom="@dimen/dp_1" android:layout_height="wrap_content"
android:layout_height="wrap_content"> android:layout_marginBottom="@dimen/dp_1">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -33,24 +33,27 @@ ...@@ -33,24 +33,27 @@
<TextView <TextView
android:id="@+id/tv_food_item_no" android:id="@+id/tv_food_item_no"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
tools:text="SP001" /> tools:text="SP001" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView <TextView
android:id="@+id/tv_food_item_supplier_name" android:id="@+id/tv_food_item_supplier_name"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2"
android:gravity="right" android:gravity="right"
android:maxLines="2"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/dp_13" android:textSize="@dimen/dp_13"
android:textStyle="bold" android:textStyle="bold"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/cb_consumption_reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:textColor="@color/color_3c"
android:layout_marginTop="@dimen/dp_10"
android:text="正常消耗" />
</LinearLayout>
\ No newline at end of file
...@@ -9,40 +9,50 @@ ...@@ -9,40 +9,50 @@
<TextView <TextView
android:id="@+id/tv_inventory_record_username" android:id="@+id/tv_inventory_record_username"
style="@style/WareHouse_item_TextStyle" style="@style/Inventory_Record_style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="20" android:layout_weight="20"
android:paddingLeft="@dimen/dp_2"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_2"
android:paddingBottom="@dimen/dp_10"
android:text="用戶名" /> android:text="用戶名" />
<include layout="@layout/include_vertical_color_white_dividing_line" /> <include layout="@layout/include_vertical_color_e8_dividing_line" />
<TextView <TextView
android:id="@+id/tv_inventory_record_number" android:id="@+id/tv_inventory_record_number"
style="@style/WareHouse_item_TextStyle" style="@style/Inventory_Record_style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="17" android:layout_weight="17"
android:paddingLeft="@dimen/dp_2"
android:paddingRight="@dimen/dp_2"
android:text="盤點" /> android:text="盤點" />
<include layout="@layout/include_vertical_color_white_dividing_line" /> <include layout="@layout/include_vertical_color_e8_dividing_line" />
<TextView <TextView
android:id="@+id/tv_inventory_record_difference" android:id="@+id/tv_inventory_record_difference"
style="@style/WareHouse_item_TextStyle" style="@style/Inventory_Record_style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="23" android:layout_weight="23"
android:paddingLeft="@dimen/dp_2"
android:paddingRight="@dimen/dp_2"
android:text="差異數" /> android:text="差異數" />
<include layout="@layout/include_vertical_color_white_dividing_line" /> <include layout="@layout/include_vertical_color_e8_dividing_line" />
<TextView <TextView
android:id="@+id/tv_inventory_record_operating_data" android:id="@+id/tv_inventory_record_operating_data"
style="@style/WareHouse_item_TextStyle" style="@style/Inventory_Record_style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_weight="39" android:layout_weight="39"
android:paddingLeft="@dimen/dp_2"
android:paddingRight="@dimen/dp_2"
android:text="操作日期" /> android:text="操作日期" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_item_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.18"
android:background="#D9E1F2"
android:gravity="center"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5"
tools:text="品名" />
<View
android:layout_width="@dimen/dp_1"
android:layout_height="match_parent"
android:background="#BAC5D3" />
<TextView
android:id="@+id/tv_item_value"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.82"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_5"
tools:text="巴西肥牛" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#BAC5D3" />
</LinearLayout>
<?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:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_print_consume_restaurant_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
tools:text="餐廳名" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<TextView
android:id="@+id/tv_print_consume_date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
tools:text="日期:" />
<TextView
android:id="@+id/tv_print_consume_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14"
tools:text="編號" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_marginTop="@dimen/dp_5"
android:layout_height="@dimen/dp_1"
android:background="@color/theme_333_color" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_print_consume_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<TextView
android:id="@+id/tv_print_consume_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_5"
android:text="製單人:"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
...@@ -67,12 +67,17 @@ ...@@ -67,12 +67,17 @@
<include layout="@layout/item_sn_code" /> <include layout="@layout/item_sn_code" />
<androidx.recyclerview.widget.RecyclerView <FrameLayout
android:id="@+id/rv_sn_code"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_sn_code"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</FrameLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/centerPopupContainer" android:id="@+id/centerPopupContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -27,7 +28,7 @@ ...@@ -27,7 +28,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="標題" tools:text="內存\n阿薩德好看熬好久是"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14" />
</LinearLayout> </LinearLayout>
......
...@@ -28,4 +28,9 @@ ...@@ -28,4 +28,9 @@
<string name="str_Inbound_quantity">入庫數量:</string> <string name="str_Inbound_quantity">入庫數量:</string>
<string name="str_enter_scan_sn">輸入/掃描SN碼:</string> <string name="str_enter_scan_sn">輸入/掃描SN碼:</string>
<string name="str_sn_code">SN碼</string> <string name="str_sn_code">SN碼</string>
<string name="str_restaurant_outbound_order">%1$s-出庫單</string>
<string name="str_no">NO:%1$s</string>
<string name="str_prepared">製單人:%1$s</string>
<string name="str_device_not_print">您的設備不支持打印</string>
</resources> </resources>
\ No newline at end of file
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
<item name="android:textSize">@dimen/dp_14</item> <item name="android:textSize">@dimen/dp_14</item>
<item name="android:textColor">@color/color_3c</item> <item name="android:textColor">@color/color_3c</item>
</style> </style>
<style name="Remark_editStyle"> <style name="Remark_editStyle">
<item name="android:textColorHint">@color/color_c9</item> <item name="android:textColorHint">@color/color_c9</item>
<item name="android:textSize">@dimen/dp_16</item> <item name="android:textSize">@dimen/dp_16</item>
...@@ -77,4 +78,12 @@ ...@@ -77,4 +78,12 @@
<item name="android:textColorHint">@color/color_b8</item> <item name="android:textColorHint">@color/color_b8</item>
<item name="android:textSize">@dimen/dp_16</item> <item name="android:textSize">@dimen/dp_16</item>
</style> </style>
<style name="Inventory_Record_style">
<item name="android:textSize">@dimen/dp_14</item>
<item name="android:textColor">@color/white</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
<item name="android:gravity">center</item>
</style>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
\ No newline at end of file
...@@ -110,17 +110,37 @@ public class ImageUtils { ...@@ -110,17 +110,37 @@ public class ImageUtils {
int height = oldbmp.getHeight(); int height = oldbmp.getHeight();
Matrix matrix = new Matrix(); Matrix matrix = new Matrix();
float scaleWidth = ((float) w / width); float scaleWidth = ((float) w / width);
// float scaleWidth = ((float) w / (width / 2f));//0.37
// float scaleHeight = scaleWidth / 2;
matrix.postScale(scaleWidth, scaleWidth); matrix.postScale(scaleWidth, scaleWidth);
return Bitmap.createBitmap(oldbmp, 0, 0, width, height, return Bitmap.createBitmap(oldbmp, 0, 0, width, height,
matrix, true); matrix, true);
} }
/**
* 針式打印機用,因為是高密度模式,打印出來寬度會少一半,所以需要除以2
*
* @param oldbmp 圖片
* @param w 打印紙寬度
* @return 縮放後的圖片
*/
public static Bitmap dotMatrixZoomDrawable(Bitmap oldbmp, int w) {
int width = oldbmp.getWidth();
int height = oldbmp.getHeight();
Matrix matrix = new Matrix();
float scaleWidth = ((float) w / (width / 2f));
float scaleHeight = scaleWidth / 2;
matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(oldbmp, 0, 0, width, height,
matrix, true);
}
public static Bitmap zoomDrawable(Bitmap oldbmp, int w, double heightMultiple) { public static Bitmap zoomDrawable(Bitmap oldbmp, int w, double heightMultiple) {
int width = oldbmp.getWidth(); int width = oldbmp.getWidth();
int height = oldbmp.getHeight(); int height = oldbmp.getHeight();
Matrix matrix = new Matrix(); Matrix matrix = new Matrix();
float scaleWidth = ((float) w / width); float scaleWidth = ((float) w / width);
float scaleHeight = (float) (scaleWidth/heightMultiple); float scaleHeight = (float) (scaleWidth / heightMultiple);
matrix.postScale(scaleWidth, scaleHeight); matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(oldbmp, 0, 0, width, height, return Bitmap.createBitmap(oldbmp, 0, 0, width, height,
matrix, true); matrix, true);
......
...@@ -5,6 +5,8 @@ import android.graphics.Bitmap; ...@@ -5,6 +5,8 @@ import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PaintFlagsDrawFilter;
import android.os.Environment; import android.os.Environment;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
...@@ -171,12 +173,17 @@ public class LayoutToBitmapUtils { ...@@ -171,12 +173,17 @@ public class LayoutToBitmapUtils {
c.drawColor(Color.WHITE); c.drawColor(Color.WHITE);
/** 如果不设置canvas画布为白色,则生成透明 */ /** 如果不设置canvas画布为白色,则生成透明 */
c.setDrawFilter(new PaintFlagsDrawFilter(Paint.ANTI_ALIAS_FLAG, Paint.FILTER_BITMAP_FLAG));
v.layout(0, 0, w, h); v.layout(0, 0, w, h);
v.draw(c); v.draw(c);
return bmp; return bmp;
} }
public static Bitmap getBitmapByView(Context context, View v){
layoutView(context, v);
return loadBitmapFromView(v);
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
//然后View和其内部的子View都具有了实际大小,也就是完成了布局,相当与添加到了界面上。接着就可以创建位图并在上面绘制了: //然后View和其内部的子View都具有了实际大小,也就是完成了布局,相当与添加到了界面上。接着就可以创建位图并在上面绘制了:
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/other_order_details_sure_btn_color" android:state_checked="true" />
<item android:color="@color/color_c8" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/other_order_details_sure_btn_color" android:state_checked="true"/> <item android:drawable="@drawable/shape_border_bg" android:state_checked="true" />
<item android:drawable="@drawable/shape_delivery_item_btn_normal"/> <item android:drawable="@drawable/shape_delivery_item_btn_normal" />
</selector> </selector>
\ No newline at end of file
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
<style name="Print_text_style"> <style name="Print_text_style">
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
<item name="android:textSize">@dimen/sp_24</item> <item name="android:textSize">@dimen/sp_28</item>
</style> </style>
<!-- 廚房單菜品名字體樣式--> <!-- 廚房單菜品名字體樣式-->
......
...@@ -44,7 +44,7 @@ public class PrjBean implements Serializable { ...@@ -44,7 +44,7 @@ public class PrjBean implements Serializable {
private String tableName; private String tableName;
private String orderNo; private String orderNo;
private int orderTime; private String orderTime;
private int person; private int person;
private String orderDetailsTime; private String orderDetailsTime;
private int orderDetailsId; private int orderDetailsId;
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Print_eighteen_text">
<item name="android:textSize">@dimen/dp_18</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="Print_twenty_four_text">
<item name="android:textSize">@dimen/dp_24</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="Print_twenty_six_text">
<item name="android:textSize">@dimen/dp_26</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="Print_twenty_eight_text">
<item name="android:textSize">@dimen/dp_28</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="Print_thirty_two_text">
<item name="android:textSize">@dimen/dp_32</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="Print_forty_two_text">
<item name="android:textSize">@dimen/dp_42</item>
<item name="android:textColor">@color/black</item>
<item name="android:includeFontPadding">false</item>
</style>
<style name="Print_dot_matrix_normal" parent="@style/Print_twenty_six_text" />
</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