Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
2189429e
Commit
2189429e
authored
Mar 11, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3-11 修復送單打印所有食品問題,添加細項縮進
parent
8dba2f2b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
51 additions
and
177 deletions
+51
-177
print-module/src/main/java/com/joe/print/mvp/print/PrintUtils.java
+4
-4
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
+7
-3
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintUtils.java
+0
-142
public-base/src/main/java/com/gingersoft/gsa/cloud/base/adapter/print/FoodAdapter.java
+7
-5
public-base/src/main/java/com/gingersoft/gsa/cloud/base/adapter/print/KitChenPrintFoodAdapter.java
+11
-4
public-base/src/main/java/com/gingersoft/gsa/cloud/base/common/bean/OrderDetail.java
+1
-2
public-base/src/main/res/layout/print_kitchen.xml
+3
-3
public-base/src/main/res/values/styles.xml
+4
-4
table-mode/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/BaseOrderPresenter.java
+5
-4
table-mode/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/MealStandPresenter.java
+9
-6
No files found.
print-module/src/main/java/com/joe/print/mvp/print/PrintUtils.java
View file @
2189429e
...
@@ -6,6 +6,9 @@ import android.view.View;
...
@@ -6,6 +6,9 @@ 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.base.adapter.print.BillAdapter
;
import
com.gingersoft.gsa.cloud.base.adapter.print.BillAdapter
;
import
com.gingersoft.gsa.cloud.base.adapter.print.BillTypeAdapter
;
import
com.gingersoft.gsa.cloud.base.adapter.print.BillTypeAdapter
;
import
com.gingersoft.gsa.cloud.base.adapter.print.FoodAdapter
;
import
com.gingersoft.gsa.cloud.base.adapter.print.FoodAdapter
;
...
@@ -31,9 +34,6 @@ import java.util.List;
...
@@ -31,9 +34,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
/**
/**
* Created by Wyh on 2020/2/10.
* Created by Wyh on 2020/2/10.
* 打印工具類
* 打印工具類
...
@@ -303,7 +303,7 @@ public class PrintUtils {
...
@@ -303,7 +303,7 @@ public class PrintUtils {
TextView
tvOperator
=
view
.
findViewById
(
R
.
id
.
tv_operator
);
TextView
tvOperator
=
view
.
findViewById
(
R
.
id
.
tv_operator
);
RecyclerView
rvFood
=
view
.
findViewById
(
R
.
id
.
rv_kitchen_food
);
RecyclerView
rvFood
=
view
.
findViewById
(
R
.
id
.
rv_kitchen_food
);
TextView
tvTableNumber2
=
view
.
findViewById
(
R
.
id
.
tv_kitchen_print_table_number2
);
TextView
tvTableNumber2
=
view
.
findViewById
(
R
.
id
.
tv_kitchen_print_table_number2
);
if
(
foodList
!=
null
&&
foodList
.
size
()
>
0
&&
foodList
.
get
(
0
)
!=
null
)
{
if
(
foodList
.
size
()
>
0
&&
foodList
.
get
(
0
)
!=
null
)
{
KitChenPrintFoodAdapter
foodAdapter
=
new
KitChenPrintFoodAdapter
(
foodList
);
KitChenPrintFoodAdapter
foodAdapter
=
new
KitChenPrintFoodAdapter
(
foodList
);
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setAdapter
(
foodAdapter
);
rvFood
.
setAdapter
(
foodAdapter
);
...
...
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintActivity.java
View file @
2189429e
...
@@ -40,6 +40,7 @@ import com.joe.print.R;
...
@@ -40,6 +40,7 @@ import com.joe.print.R;
import
com.joe.print.di.component.DaggerPrintComponent
;
import
com.joe.print.di.component.DaggerPrintComponent
;
import
com.joe.print.mvp.contract.PrintContract
;
import
com.joe.print.mvp.contract.PrintContract
;
import
com.joe.print.mvp.presenter.PrintPresenter
;
import
com.joe.print.mvp.presenter.PrintPresenter
;
import
com.joe.print.mvp.print.PrintStatus
;
import
com.joe.print.mvp.print.PrintUtils
;
import
com.joe.print.mvp.print.PrintUtils
;
import
com.joe.print.mvp.ui.adapter.DialogPrinterListAdapter
;
import
com.joe.print.mvp.ui.adapter.DialogPrinterListAdapter
;
import
com.sunmi.peripheral.printer.InnerResultCallbcak
;
import
com.sunmi.peripheral.printer.InnerResultCallbcak
;
...
@@ -147,7 +148,12 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -147,7 +148,12 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
paperWidth
=
500
;
paperWidth
=
500
;
try
{
try
{
//初始化N5打印
//初始化N5打印
int
state
=
PrinterUtil
.
getStatus
();
// int state = PrinterUtil.getStatus();
boolean
state
=
PrintStatus
.
initN5PrintStatus
(
mContext
);
if
(!
state
)
{
//不能打印
printFile
();
}
Log
.
e
(
"error"
,
"打印機狀態:"
+
state
);
Log
.
e
(
"error"
,
"打印機狀態:"
+
state
);
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -158,8 +164,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
...
@@ -158,8 +164,6 @@ public class PrintActivity extends BaseActivity<PrintPresenter> implements Print
ex
.
printStackTrace
();
ex
.
printStackTrace
();
Log
.
e
(
"error"
,
"打印初始化失敗:"
+
ex
.
getMessage
());
Log
.
e
(
"error"
,
"打印初始化失敗:"
+
ex
.
getMessage
());
}
}
}
catch
(
RemoteException
e
)
{
Log
.
e
(
"error"
,
"獲取狀態失敗:"
+
e
.
getMessage
());
}
}
}
}
}
}
...
...
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintUtils.java
deleted
100644 → 0
View file @
8dba2f2b
package
com
.
joe
.
print
.
mvp
.
ui
.
activity
;
/**
* Created by Wyh on 2020/3/6.
*/
import
android.annotation.SuppressLint
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.nio.charset.Charset
;
public
class
PrintUtils
{
private
static
final
int
LINE_BYTE_SIZE
=
32
;
private
static
OutputStream
outputStream
=
null
;
public
static
void
setOutputStream
(
OutputStream
outputStream
)
{
PrintUtils
.
outputStream
=
outputStream
;
}
/**
* 打印文字
*
* @param text 要打印的文字
*/
public
static
void
printText
(
String
text
)
{
try
{
byte
[]
data
=
text
.
getBytes
(
"gbk"
);
outputStream
.
write
(
data
,
0
,
data
.
length
);
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
/**
* 设置打印格式
*
* @param command 格式指令
*/
public
static
void
selectCommand
(
byte
[]
command
)
{
try
{
outputStream
.
write
(
command
);
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
//Toast.makeText(this.context, "发送失败!", Toast.LENGTH_SHORT).show();
e
.
printStackTrace
();
}
}
/**
* 复位打印机
*/
public
static
final
byte
[]
RESET
=
{
0x1b
,
0x40
};
/**
* 左对齐
*/
public
static
final
byte
[]
ALIGN_LEFT
=
{
0x1b
,
0x61
,
0x00
};
/**
* 中间对齐
*/
public
static
final
byte
[]
ALIGN_CENTER
=
{
0x1b
,
0x61
,
0x01
};
/**
* 选择加粗模式
*/
public
static
final
byte
[]
BOLD
=
{
0x1b
,
0x45
,
0x01
};
/**
* 取消加粗模式
*/
public
static
final
byte
[]
BOLD_CANCEL
=
{
0x1b
,
0x45
,
0x00
};
/**
* 宽高加倍
*/
public
static
final
byte
[]
DOUBLE_HEIGHT_WIDTH
=
{
0x1d
,
0x21
,
0x11
};
/**
* 字体不放大
*/
public
static
final
byte
[]
NORMAL
=
{
0x1d
,
0x21
,
0x00
};
/**
* 设置默认行间距
*/
public
static
final
byte
[]
LINE_SPACING_DEFAULT
=
{
0x1b
,
0x32
};
// /**
// * 设置行间距
// */
public
static
final
byte
[]
LINE_SPACING
=
{
0x1b
,
0x33
,
0x50
};
// 20的行间距(0,255)
/**
* 设置字符间距
*/
public
static
final
byte
[]
COLUMN_SPACING
=
{
0x1b
,
0x20
,
0x25
};
/**
* 取消设置字符间距
*/
public
static
final
byte
[]
COLUMN_SPACING_CANCEL
=
{
0x1b
,
0x20
,
0x00
};
/**
* 打印两列
*
* @param leftText 左侧文字
* @param rightText 右侧文字
* @return
*/
@SuppressLint
(
"NewApi"
)
public
static
String
printTwoData
(
String
leftText
,
String
rightText
)
{
StringBuilder
sb
=
new
StringBuilder
();
int
leftTextLength
=
getBytesLength
(
leftText
);
int
rightTextLength
=
getBytesLength
(
rightText
);
sb
.
append
(
leftText
);
// 计算两侧文字中间的空格
int
marginBetweenMiddleAndRight
=
LINE_BYTE_SIZE
-
leftTextLength
-
rightTextLength
;
for
(
int
i
=
0
;
i
<
marginBetweenMiddleAndRight
;
i
++)
{
sb
.
append
(
" "
);
}
sb
.
append
(
rightText
);
return
sb
.
toString
();
}
/**
* 获取数据长度
*
* @param msg
* @return
*/
@SuppressLint
(
"NewApi"
)
private
static
int
getBytesLength
(
String
msg
)
{
return
msg
.
getBytes
(
Charset
.
forName
(
"GB2312"
)).
length
;
}
}
\ No newline at end of file
public-base/src/main/java/com/gingersoft/gsa/cloud/base/adapter/print/FoodAdapter.java
View file @
2189429e
...
@@ -20,12 +20,14 @@ public class FoodAdapter extends BaseQuickAdapter<OrderDetail, BaseViewHolder> {
...
@@ -20,12 +20,14 @@ public class FoodAdapter extends BaseQuickAdapter<OrderDetail, BaseViewHolder> {
@Override
@Override
protected
void
convert
(
BaseViewHolder
helper
,
OrderDetail
item
)
{
protected
void
convert
(
BaseViewHolder
helper
,
OrderDetail
item
)
{
if
(
item
.
getItemType
()
==
3
)
{
if
(
item
.
getItemType
()
==
2
)
{
//
菜品
//
細項,縮進
helper
.
setText
(
R
.
id
.
tv_food_name
,
item
.
getProductName
());
helper
.
setText
(
R
.
id
.
tv_food_name
,
"\u3000"
+
item
.
getProductName
());
}
else
if
(
item
.
getItemType
()
==
4
)
{
}
else
if
(
item
.
getItemType
()
==
3
)
{
//細項,縮進
//細項,縮進
helper
.
setText
(
R
.
id
.
tv_food_name
,
"\\u3000"
+
item
.
getProductName
());
helper
.
setText
(
R
.
id
.
tv_food_name
,
"\u3000\u3000"
+
item
.
getProductName
());
}
else
{
helper
.
setText
(
R
.
id
.
tv_food_name
,
item
.
getProductName
());
}
}
helper
.
setText
(
R
.
id
.
tv_food_quantity
,
String
.
valueOf
(
item
.
getNumber
()));
helper
.
setText
(
R
.
id
.
tv_food_quantity
,
String
.
valueOf
(
item
.
getNumber
()));
helper
.
setText
(
R
.
id
.
tv_food_price
,
"$"
+
item
.
getPrice
());
helper
.
setText
(
R
.
id
.
tv_food_price
,
"$"
+
item
.
getPrice
());
...
...
public-base/src/main/java/com/gingersoft/gsa/cloud/base/adapter/print/KitChenPrintFoodAdapter.java
View file @
2189429e
package
com
.
gingersoft
.
gsa
.
cloud
.
base
.
adapter
.
print
;
package
com
.
gingersoft
.
gsa
.
cloud
.
base
.
adapter
.
print
;
import
androidx.annotation.Nullable
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
com.gingersoft.gsa.cloud.base.R
;
import
com.gingersoft.gsa.cloud.base.R
;
import
com.gingersoft.gsa.cloud.base.common.bean.OrderDetail
;
import
com.gingersoft.gsa.cloud.base.common.bean.OrderDetail
;
import
com.gingersoft.gsa.cloud.database.bean.Food
;
import
java.util.List
;
import
java.util.List
;
import
androidx.annotation.Nullable
;
/**
/**
* Created by Wyh on 2020/2/20.
* Created by Wyh on 2020/2/20.
*/
*/
...
@@ -21,7 +20,15 @@ public class KitChenPrintFoodAdapter extends BaseQuickAdapter<OrderDetail, BaseV
...
@@ -21,7 +20,15 @@ public class KitChenPrintFoodAdapter extends BaseQuickAdapter<OrderDetail, BaseV
@Override
@Override
protected
void
convert
(
BaseViewHolder
helper
,
OrderDetail
item
)
{
protected
void
convert
(
BaseViewHolder
helper
,
OrderDetail
item
)
{
helper
.
setText
(
R
.
id
.
tv_food_number
,
item
.
getNumber
()
+
""
);
if
(
item
.
getItemType
()
==
2
)
{
//細項,縮進
helper
.
setText
(
R
.
id
.
tv_food_number
,
"\u3000"
+
item
.
getNumber
());
}
else
if
(
item
.
getItemType
()
==
3
)
{
//細項,縮進
helper
.
setText
(
R
.
id
.
tv_food_number
,
"\u3000\u3000"
+
item
.
getNumber
());
}
else
{
helper
.
setText
(
R
.
id
.
tv_food_number
,
item
.
getNumber
()
+
""
);
}
helper
.
setText
(
R
.
id
.
tv_food_name
,
item
.
getProductName
());
helper
.
setText
(
R
.
id
.
tv_food_name
,
item
.
getProductName
());
}
}
}
}
public-base/src/main/java/com/gingersoft/gsa/cloud/base/common/bean/OrderDetail.java
View file @
2189429e
...
@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.base.common.bean;
...
@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.base.common.bean;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage
;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage
;
import
com.gingersoft.gsa.cloud.database.bean.ComboItem
;
import
com.gingersoft.gsa.cloud.database.bean.ComboItem
;
import
com.gingersoft.gsa.cloud.database.bean.FoodCombo
;
import
com.gingersoft.gsa.cloud.database.bean.Food
;
import
com.gingersoft.gsa.cloud.database.bean.Food
;
import
com.gingersoft.gsa.cloud.database.bean.Modifier
;
import
com.gingersoft.gsa.cloud.database.bean.Modifier
;
...
@@ -60,7 +59,7 @@ public class OrderDetail implements Serializable {
...
@@ -60,7 +59,7 @@ public class OrderDetail implements Serializable {
private
int
ComboLevel
=
0
;
private
int
ComboLevel
=
0
;
//套餐食品是否自動跟餐
//套餐食品是否自動跟餐
private
boolean
isComboAuto
=
false
;
private
boolean
isComboAuto
=
false
;
//層級
//層級
,1,2,3
private
int
itemType
;
private
int
itemType
;
/**
/**
* ID
* ID
...
...
public-base/src/main/res/layout/print_kitchen.xml
View file @
2189429e
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
<TextView
<TextView
android:id=
"@+id/tv_opening_time_text"
android:id=
"@+id/tv_opening_time_text"
style=
"@style/Print_text_style"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"開檯時間:"
android:text=
"開檯時間:"
...
@@ -29,6 +30,7 @@
...
@@ -29,6 +30,7 @@
<TextView
<TextView
android:id=
"@+id/tv_opening_time"
android:id=
"@+id/tv_opening_time"
style=
"@style/Print_text_style"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"01-04 18:32"
android:text=
"01-04 18:32"
...
@@ -40,7 +42,6 @@
...
@@ -40,7 +42,6 @@
style=
"@style/Print_text_style"
style=
"@style/Print_text_style"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:text=
"落單時間:"
android:text=
"落單時間:"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tv_opening_time_text"
/>
app:layout_constraintTop_toBottomOf=
"@id/tv_opening_time_text"
/>
...
@@ -50,10 +51,9 @@
...
@@ -50,10 +51,9 @@
style=
"@style/Print_text_style"
style=
"@style/Print_text_style"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:text=
"01-04 19:32"
android:text=
"01-04 19:32"
app:layout_constraintLeft_toRightOf=
"@id/tv_order_time_text"
app:layout_constraintLeft_toRightOf=
"@id/tv_order_time_text"
app:layout_constraintTop_to
BottomOf=
"@id/tv_opening
_time_text"
/>
app:layout_constraintTop_to
TopOf=
"@id/tv_order
_time_text"
/>
<TextView
<TextView
android:id=
"@+id/tv_kitchen_location"
android:id=
"@+id/tv_kitchen_location"
...
...
public-base/src/main/res/values/styles.xml
View file @
2189429e
...
@@ -268,13 +268,13 @@
...
@@ -268,13 +268,13 @@
</style>
</style>
<style
name=
"Print_text_style"
>
<style
name=
"Print_text_style"
>
<item
name=
"android:textColor"
>
#333
</item>
<item
name=
"android:textColor"
>
@color/theme_333_color
</item>
<item
name=
"android:textSize"
>
24sp
</item>
<item
name=
"android:textSize"
>
@dimen/sp_24
</item>
</style>
</style>
<style
name=
"Print_large_text_style"
>
<style
name=
"Print_large_text_style"
>
<item
name=
"android:textColor"
>
#333
</item>
<item
name=
"android:textColor"
>
@color/theme_333_color
</item>
<item
name=
"android:textSize"
>
35sp
</item>
<item
name=
"android:textSize"
>
@dimen/sp_48
</item>
</style>
</style>
<style
name=
"report_food_ranking"
>
<style
name=
"report_food_ranking"
>
...
...
table-mode/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/BaseOrderPresenter.java
View file @
2189429e
...
@@ -6,11 +6,11 @@ import android.widget.TextView;
...
@@ -6,11 +6,11 @@ import android.widget.TextView;
import
com.gingersoft.gsa.cloud.base.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.base.common.bean.BaseResult
;
import
com.gingersoft.gsa.cloud.base.common.bean.OrderBean
;
import
com.gingersoft.gsa.cloud.base.common.bean.OrderBean
;
import
com.gingersoft.gsa.cloud.base.common.bean.OrderDetail
;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage
;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage
;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage
;
import
com.gingersoft.gsa.cloud.base.common.bean.mealManage.OpenTableManage
;
import
com.gingersoft.gsa.cloud.table.mvp.contract.BaseOrderContract
;
import
com.gingersoft.gsa.cloud.table.mvp.contract.BaseOrderContract
;
import
com.gingersoft.gsa.cloud.table.mvp.model.bean.BillOrderMoney
;
import
com.gingersoft.gsa.cloud.table.mvp.model.bean.BillOrderMoney
;
import
com.gingersoft.gsa.cloud.base.common.bean.OrderDetail
;
import
com.gingersoft.gsa.cloud.table.mvp.model.bean.request.AddOrderRequest
;
import
com.gingersoft.gsa.cloud.table.mvp.model.bean.request.AddOrderRequest
;
import
com.gingersoft.gsa.cloud.table.mvp.model.bean.request.CreateOrderRequest
;
import
com.gingersoft.gsa.cloud.table.mvp.model.bean.request.CreateOrderRequest
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderContentActivity
;
import
com.gingersoft.gsa.cloud.table.mvp.ui.activity.OrderContentActivity
;
...
@@ -26,8 +26,6 @@ import java.util.ArrayList;
...
@@ -26,8 +26,6 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.IdentityHashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -355,7 +353,8 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
...
@@ -355,7 +353,8 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
*/
*/
long
type1
=
1
;
long
type1
=
1
;
long
type2
=
2
;
long
type2
=
2
;
//打印用到,清理掉之前保存的食品
MyOrderManage
.
getInstance
().
getNewFoodList
().
clear
();
//可重複的map
//可重複的map
Map
<
String
,
List
<
OrderBean
.
OrderDetailsBean
>>
orderDetails
=
new
HashMap
<>();
Map
<
String
,
List
<
OrderBean
.
OrderDetailsBean
>>
orderDetails
=
new
HashMap
<>();
if
(
foodList
!=
null
)
{
if
(
foodList
!=
null
)
{
...
@@ -389,6 +388,8 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
...
@@ -389,6 +388,8 @@ public class BaseOrderPresenter<M extends BaseOrderContract.Model, V extends Bas
if
(
food
.
isNew
())
{
if
(
food
.
isNew
())
{
//這裡只添加新食品
//這裡只添加新食品
orderItems
.
add
(
request
);
orderItems
.
add
(
request
);
//保存新食品,打印用到
MyOrderManage
.
getInstance
().
getNewFoodList
().
add
(
food
);
}
}
int
nextIndex
=
i
+
1
;
int
nextIndex
=
i
+
1
;
if
(
foodList
.
size
()
>
nextIndex
)
{
if
(
foodList
.
size
()
>
nextIndex
)
{
...
...
table-mode/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/MealStandPresenter.java
View file @
2189429e
...
@@ -346,7 +346,8 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
...
@@ -346,7 +346,8 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
setOrderId
((
Double
)
info
.
getData
());
setOrderId
((
Double
)
info
.
getData
());
}
}
mRootView
.
showMessage
(
"送單成功"
);
mRootView
.
showMessage
(
"送單成功"
);
printSendOrder
(
getOrderFoodLists
(),
true
);
MyOrderManage
.
getInstance
().
setNewFoodList
(
getOrderFoodLists
());
printSendOrder
(
true
);
}
else
{
}
else
{
mRootView
.
showMessage
(
"送單失敗"
);
mRootView
.
showMessage
(
"送單失敗"
);
}
}
...
@@ -374,7 +375,11 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
...
@@ -374,7 +375,11 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
public
void
onNext
(
@NonNull
BaseResult
info
)
{
public
void
onNext
(
@NonNull
BaseResult
info
)
{
if
(
info
!=
null
&&
info
.
isSuccess
())
{
if
(
info
!=
null
&&
info
.
isSuccess
())
{
mRootView
.
showMessage
(
"送單成功"
);
mRootView
.
showMessage
(
"送單成功"
);
printSendOrder
(
foodLists
,
false
);
if
(
OpenTableManage
.
getDefault
()
!=
null
)
{
//通知更新餐台状态
EventBus
.
getDefault
().
post
(
OpenTableManage
.
getDefault
().
getTableBean
().
getId
(),
"initTable_status_event"
);
}
printSendOrder
(
false
);
}
else
{
}
else
{
if
(!
hasNesOrderFoods
())
{
if
(!
hasNesOrderFoods
())
{
//TODO 未新增食品點擊送單 後台不讓過直接提示即可
//TODO 未新增食品點擊送單 後台不讓過直接提示即可
...
@@ -383,7 +388,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
...
@@ -383,7 +388,7 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
//通知更新餐台状态
//通知更新餐台状态
EventBus
.
getDefault
().
post
(
OpenTableManage
.
getDefault
().
getTableBean
().
getId
(),
"initTable_status_event"
);
EventBus
.
getDefault
().
post
(
OpenTableManage
.
getDefault
().
getTableBean
().
getId
(),
"initTable_status_event"
);
}
}
printSendOrder
(
f
oodLists
,
f
alse
);
printSendOrder
(
false
);
}
else
{
}
else
{
mRootView
.
showMessage
(
"送單失敗"
);
mRootView
.
showMessage
(
"送單失敗"
);
}
}
...
@@ -394,11 +399,9 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
...
@@ -394,11 +399,9 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
/**
/**
* 打印上菜紙
* 打印上菜紙
* @param newFoods 當前送單新增食品
* @param initTable 是否是開台
* @param initTable 是否是開台
*/
*/
private
void
printSendOrder
(
List
<
OrderDetail
>
newFoods
,
boolean
initTable
)
{
private
void
printSendOrder
(
boolean
initTable
)
{
MyOrderManage
.
getInstance
().
setNewFoodList
(
newFoods
);
CC
.
obtainBuilder
(
"Component.Print"
)
CC
.
obtainBuilder
(
"Component.Print"
)
.
setActionName
(
"printActivity"
)
.
setActionName
(
"printActivity"
)
.
addParam
(
"type"
,
3
)
.
addParam
(
"type"
,
3
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment