Commit 548dcf00 by Wyh

1、SkyOrder打印上菜紙

parent 71826e2e
......@@ -4,6 +4,14 @@ apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.didi.dokit'
android {
signingConfigs {
GSAndroidNew {
keyAlias 'keycypos'
keyPassword 'qingkeke'
storeFile file('cyposandroid.keyset')
storePassword 'qingkeke'
}
}
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
......@@ -20,19 +28,31 @@ android {
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
// ndk{
// abiFilters "armeabi-v7a"
// }
}
resourcePrefix "app"
resourcePrefix "user_login"
bundle {
density {
// Different APKs are generated for devices with different screen densities; true by default.
enableSplit true
}
abi {
// Different APKs are generated for devices with different CPU architectures; true by default.
enableSplit true
}
language {
// This is disabled so that the App Bundle does NOT split the APK for each language.
// We're gonna use the same APK for all languages.
enableSplit true
}
}
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
signingConfig signingConfigs.GSAndroidNew
}
release {
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
......@@ -40,6 +60,7 @@ android {
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
signingConfig signingConfigs.GSAndroidNew
}
}
......@@ -56,18 +77,70 @@ android {
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd')
if (variant.buildType.name == 'release') {
fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_正式版_.apk"
} else if (variant.buildType.name == 'Test') {
fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_測試版_.apk"
fileName = "正式版_GSA-Cloud_${variant.mergedFlavor.versionName}_${formattedDate}.apk"
} else if (variant.buildType.name == 'debug') {
fileName = "${formattedDate}_GSA-Cloud_${variant.mergedFlavor.versionName}_debug_.apk"
fileName = "测试版_GSA-Cloud_${variant.mergedFlavor.versionName}_${formattedDate}.apk"
}
outputFileName = fileName
}
}
dexOptions {
// incremental true
javaMaxHeapSize "4g"
}
}
//dokit 扩展
dokitExt {
//通用设置
comm {
//地图经纬度开关
gpsSwitch true
//网络开关
networkSwitch true
//大图开关
bigImgSwitch true
//webView js 抓包
webViewSwitch true
}
slowMethod {
//调用栈模式配置
stackMethod {
//默认值为 5ms 小于该值的函数在调用栈中不显示
thresholdTime 5
//调用栈函数入口
enterMethods = ["com.didichuxing.doraemondemo.MainDebugActivity.test1"]
//黑名单 粒度最小到类 暂不支持到方法
methodBlacklist = ["com.facebook.drawee.backends.pipeline.Fresco"]
}
//普通模式配置
normalMethod {
//默认值为 500ms 小于该值的函数在运行时不会在控制台中被打印
thresholdTime 100
//需要针对函数插装的包名
packageNames = ["com.didichuxing.doraemondemo"]
//不需要针对函数插装的包名和类名
methodBlacklist = ["com.didichuxing.doraemondemo.dokit"]
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
addComponent 'component-main'
addComponent 'component-download'
addComponent 'component-table'
addComponent 'component-print'
addComponent 'component-delivery-pick'
addComponent 'component-manager'
addComponent 'component-coldchain'
addComponent 'component-supply-chain'
addComponent 'component-webview'
addComponent 'component-scan'
addComponent 'component-pay'
implementation rootProject.ext.dependencies["viewpager2"]
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
implementation rootProject.ext.dependencies["autosize"]
}
package com.example.gsa_cloud2;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.gsa_cloud2", appContext.getPackageName());
}
}
\ No newline at end of file
package com.example.gsa_cloud2;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.WindowManager;
......
......@@ -79,6 +79,7 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
@Override
public void dismiss() {
super.dismiss();
mContext = null;
}
public PrinterLoadingDialog build() {
......@@ -172,4 +173,6 @@ public class PrinterLoadingDialog extends BaseRetryDialog {
protected int getContentViewLayoutId() {
return R.layout.print_dialog_loading;
}
}
......@@ -6,16 +6,21 @@ import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.CCUtil;
import com.billy.cc.core.component.IComponent;
import com.gingersoft.gsa.cloud.common.bean.SkyOrderServingBean;
import com.gingersoft.gsa.cloud.common.constans.PrintConstans;
import com.gingersoft.gsa.cloud.common.function.FModule;
import com.gingersoft.gsa.cloud.component.ComponentAction;
import com.gingersoft.gsa.cloud.component.ComponentName;
import com.gingersoft.gsa.cloud.order.order.MealOrder;
import com.gingersoft.gsa.cloud.order.order.TakeawayOrder;
import com.gingersoft.gsa.cloud.print.bean.PrintContent;
import com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.meal.MealBillActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.meal.MealPayActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.meal.MealSoldoutActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.meal.MealStandActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.table.TableActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.order.OrderCenterActivity;
import com.gingersoft.gsa.cloud.table.mvp.ui.activity.table.TableActivity;
import com.jess.arms.integration.AppManager;
import com.jess.arms.utils.ArmsUtils;
......@@ -107,6 +112,20 @@ public class ComponentTable implements IComponent {
}
break;
}
case "printSkyOrderServer":
//打印skyOrder上菜紙
SkyOrderServingBean skyOrderServingBean = cc.getParamItem("skyServingData");
PrintContent printContent = new PrintContentAdapter().adaptationServingPaperContent(skyOrderServingBean);
CC.obtainBuilder(ComponentName.COMPONENT_PRINT)
.setActionName("printActivity")
.addParam(PrintConstans.PRINT_TYPE, PrintConstans.PRINT_SERVE)
.addParam(PrintConstans.PRINT_CONTENT, printContent)
.addParam(PrintConstans.PRINT_ORDER_NO, skyOrderServingBean.getOrderId() + "")
.build()
.callAsyncCallbackOnMainThread((cc1, result) -> {
});
break;
case ComponentAction.Table.INT_ORDER:
//初始化堂食賬單類
MealOrder.getInstance().initialization();
......
......@@ -68,6 +68,7 @@ ext {
"loadsir" : "com.kingja.loadsir:loadsir:1.3.8",
"lottie" : "com.airbnb.android:lottie:3.6.1",
"loadingIndicatorView" : "com.wang.avi:library:2.1.3",
"viewpager2" : "androidx.viewpager2:viewpager2:1.0.0-alpha03",
//rx1
"rxandroid" : "io.reactivex:rxandroid:1.2.1",
......
package com.gingersoft.gsa.cloud.common.bean;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* Date: 2021/5/29
* Time: 11:08
* Use:
*/
public class SkyOrderItemDetailBean {
/**
* itemDetail : []
* number : 1
* productName : 辣
*/
private int number;
private String productName;
private List<SkyOrderItemDetailBean> itemDetail;
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public List<SkyOrderItemDetailBean> getItemDetail() {
return itemDetail;
}
public void setItemDetail(List<SkyOrderItemDetailBean> itemDetail) {
this.itemDetail = itemDetail;
}
}
package com.gingersoft.gsa.cloud.common.bean;
import java.io.Serializable;
import java.util.List;
/**
* @author 宇航. 1239658231@qq.com
* Date: 2021/5/29
* Time: 10:56
* Use:掃碼點餐上菜紙
*/
public class SkyOrderServingBean implements Serializable {
/**
* foods : [{"itemDetail":[[{"itemDetail":[],"number":1,"productName":"辣"},{"itemDetail":[],"number":1,"productName":"甜辣"}]],"number":1,"productName":"雞飯(四客)"}]
* orderId : 11142192
* person : 9
* tableName : 512
*/
private int orderId;
private int person;
private String tableName;
private List<FoodsBean> foods;
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public int getPerson() {
return person;
}
public void setPerson(int person) {
this.person = person;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public List<FoodsBean> getFoods() {
return foods;
}
public void setFoods(List<FoodsBean> foods) {
this.foods = foods;
}
public static class FoodsBean {
/**
* itemDetail : [[{"itemDetail":[],"number":1,"productName":"辣"},{"itemDetail":[],"number":1,"productName":"甜辣"}]]
* number : 1
* productName : 雞飯(四客)
*/
private int number;
private String productName;
private List<List<SkyOrderItemDetailBean>> itemDetail;
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public List<List<SkyOrderItemDetailBean>> getItemDetail() {
return itemDetail;
}
public void setItemDetail(List<List<SkyOrderItemDetailBean>> itemDetail) {
this.itemDetail = itemDetail;
}
}
}
......@@ -17,13 +17,17 @@ import android.widget.RemoteViews
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import com.billy.cc.core.component.CC
import com.billy.cc.core.component.CCResult
import com.gingersoft.gsa.cloud.common.R
import com.gingersoft.gsa.cloud.common.bean.SkyOrderServingBean
import com.gingersoft.gsa.cloud.common.constans.AppConstant
import com.gingersoft.gsa.cloud.common.constans.HttpsConstans
import com.gingersoft.gsa.cloud.common.constans.PrintConstans
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.core.user.UserContext
import com.gingersoft.gsa.cloud.common.logan.LoganManager
import com.gingersoft.gsa.cloud.common.utils.SoundPoolUtils
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils
import com.gingersoft.gsa.cloud.common.utils.okhttpUtils.OkHttp3Utils
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils
import com.gingersoft.gsa.cloud.component.ComponentName
......@@ -107,6 +111,11 @@ class ICommandService : Service() {
private val TABLE_DATA = 11
/**
* sky order 送單消息
*/
private val SKYORDER_SEND = 13
/**
* 上次播報的時間
*/
private var lastSoundTime: Long = 0L
......@@ -359,6 +368,17 @@ class ICommandService : Service() {
.setActionName("getTables")
.build()
.call()
} else if (type == SKYORDER_SEND) {
//打印上菜紙
val receivedMsgBean = GsonUtils.GsonToBean(text, ReceivedMsgBean::class.java)
val skyOrderServingBean = GsonUtils.GsonToBean(receivedMsgBean.value, SkyOrderServingBean::class.java)
skyOrderServingBean?.apply {
CC.obtainBuilder(ComponentName.COMPONENT_TABLE)
.setActionName("printSkyOrderServer")
.addParam("skyServingData", skyOrderServingBean)
.build()
.call()
}
}
}
......@@ -523,4 +543,12 @@ class ICommandService : Service() {
class MsgBean(var type: Int, var data: String, var token: String, var userId: Int, var deviceId: String)
class ReceivedMsgBean {
var data: String? = null
var password: String? = null
var token: String? = null
var type: Int = 0
var username: String? = null
var value: Any? = null
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.print.bean.adapter;
import com.gingersoft.gsa.cloud.common.bean.SkyOrderServingBean;
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.settlement.SettlementReport;
import com.gingersoft.gsa.cloud.common.core.table.TableBean;
......@@ -28,5 +29,7 @@ public interface AdaptationContent {
PrintContent adaptationServingPaperContent(MealOrder mealOrder, TableBean.DataBean tableBean);
PrintContent adaptationServingPaperContent(SkyOrderServingBean skyOrderServingBean);
PrintContent adaptationBillContent(MealOrder mealOrder, TableBean.DataBean tableBean);
}
package com.gingersoft.gsa.cloud.print.bean.adapter;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.bean.SkyOrderItemDetailBean;
import com.gingersoft.gsa.cloud.common.bean.SkyOrderServingBean;
import com.gingersoft.gsa.cloud.common.constans.AppConstant;
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
......@@ -58,6 +60,7 @@ public class PrintContentAdapter implements AdaptationContent {
/**
* 清機打印
*
* @param settlementReport
* @return
*/
......@@ -76,6 +79,7 @@ public class PrintContentAdapter implements AdaptationContent {
/**
* 印單
*
* @param mealOrder
* @param tableBean
* @return
......@@ -100,6 +104,7 @@ public class PrintContentAdapter implements AdaptationContent {
/**
* 送單
*
* @param mealOrder
* @param tableBean
* @return
......@@ -121,6 +126,7 @@ public class PrintContentAdapter implements AdaptationContent {
/**
* 上菜紙
*
* @param mealOrder
* @param tableBean
* @return
......@@ -134,14 +140,28 @@ public class PrintContentAdapter implements AdaptationContent {
servingPaperContent.setPerson(tableBean.getPerson());
servingPaperContent.setCreateTime(tableBean.getCreateTime());
servingPaperContent.setOrderNo(mealOrder.getOrderNo());
// servingPaperContent.setFoodItemList(orderDetailItemCastPrintFoodItemList(mealOrder.getNewFoodList()));
servingPaperContent.setFoodItemList(orderDetailItemCastPrintFoodItemList(mealOrder.getShoppingCart().getOrderCommodityList()));
servingPaperContent.setPoliteLanguage(GsaCloudApplication.functionConfiguration.getBottomPoliteLanguageVaule());
return servingPaperContent;
}
@Override
public PrintContent adaptationServingPaperContent(SkyOrderServingBean skyOrderServingBean) {
PrintServingPaperContent servingPaperContent = new PrintServingPaperContent();
servingPaperContent.setBrand(RestaurantInfoManager.newInstance().getBrandName());
servingPaperContent.setResturantName(RestaurantInfoManager.newInstance().getRestaurantName());
servingPaperContent.setTableName(skyOrderServingBean.getTableName());
servingPaperContent.setPerson(skyOrderServingBean.getPerson());
servingPaperContent.setCreateTime(TimeUtils.getCurrentDate(TimeUtils.DEFAULT_DATE_FORMAT));
servingPaperContent.setOrderNo(skyOrderServingBean.getOrderId() + "");
servingPaperContent.setFoodItemList(skyOrderServingCastPrintFoodItemList(skyOrderServingBean.getFoods()));
servingPaperContent.setPoliteLanguage(GsaCloudApplication.functionConfiguration.getBottomPoliteLanguageVaule());
return servingPaperContent;
}
/**
* 打印結賬單
*
* @param mealOrder
* @param tableBean
* @return
......@@ -172,6 +192,29 @@ public class PrintContentAdapter implements AdaptationContent {
return billContent;
}
private List<PrintFoodItem> skyOrderServingCastPrintFoodItemList(List<SkyOrderServingBean.FoodsBean> foods) {
List<PrintFoodItem> printFoodItems = new ArrayList<>();
for (SkyOrderServingBean.FoodsBean food : foods) {
//上菜紙不顯示價格,填0
printFoodItems.add(new PrintFoodItem(food.getProductName(), food.getNumber(), 0, 1));
if (food.getItemDetail() != null) {
for (List<SkyOrderItemDetailBean> skyOrderItemDetailBeans : food.getItemDetail()) {
if (skyOrderItemDetailBeans != null) {
for (SkyOrderItemDetailBean skyOrderItemDetailBean : skyOrderItemDetailBeans) {
printFoodItems.add(new PrintFoodItem(skyOrderItemDetailBean.getProductName(), skyOrderItemDetailBean.getNumber(), 0, 2));
if (skyOrderItemDetailBean.getItemDetail() != null) {
for (SkyOrderItemDetailBean orderItemDetailBean : skyOrderItemDetailBean.getItemDetail()) {
printFoodItems.add(new PrintFoodItem(orderItemDetailBean.getProductName(), orderItemDetailBean.getNumber(), 0, 3));
}
}
}
}
}
}
}
return printFoodItems;
}
private List<PrintFoodItem> orderDetailItemCastPrintFoodItemList(List<OrderDetail> newFoodList) {
List<PrintFoodItem> printFoodItems = new ArrayList<>();
if (newFoodList != null) {
......
......@@ -15,6 +15,7 @@ include 'cc-register',
'library-order',
'library-print',
'app',
'component-login',
'component-main',
'component-download',
......
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