Commit 51a1f96b by Wyh

.

parent bdae41ef
......@@ -21,6 +21,7 @@ public class PrintCurrencyBean implements Serializable {
private int type;//1堂食,2外賣
private int foodComplexion;//食品顔色 0 黑色 2 紅色
private int modifierComplexion;//細項顔色 0 黑色 2 紅色
private int deletes;//是否刪除 0 正常 1 刪除
private Integer uid;
private Long createTime;
private Long updateTime;
......@@ -57,9 +58,8 @@ public class PrintCurrencyBean implements Serializable {
this.numberIsFlip = numberIsFlip;
}
@Generated(hash = 2001960487)
public PrintCurrencyBean(Long id, Long dbid, String name, Integer restaurantId, int type, int foodComplexion, int modifierComplexion, Integer uid, Long createTime, Long updateTime, Long fontId, int foodIsBold, String foodFont, int foodIsItalic, int modifierIsBold, String modifierFont, int modifierIsItalic,
int numberIsFlip) {
@Generated(hash = 172703695)
public PrintCurrencyBean(Long id, Long dbid, String name, Integer restaurantId, int type, int foodComplexion, int modifierComplexion, int deletes, Integer uid, Long createTime, Long updateTime, Long fontId, int foodIsBold, String foodFont, int foodIsItalic, int modifierIsBold, String modifierFont, int modifierIsItalic, int numberIsFlip) {
this.id = id;
this.dbid = dbid;
this.name = name;
......@@ -67,6 +67,7 @@ public class PrintCurrencyBean implements Serializable {
this.type = type;
this.foodComplexion = foodComplexion;
this.modifierComplexion = modifierComplexion;
this.deletes = deletes;
this.uid = uid;
this.createTime = createTime;
this.updateTime = updateTime;
......@@ -227,4 +228,12 @@ public class PrintCurrencyBean implements Serializable {
public Long getId() {
return this.id;
}
public int getDeletes() {
return deletes;
}
public void setDeletes(int deletes) {
this.deletes = deletes;
}
}
......@@ -436,7 +436,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
fun openCashBox() {
// launch({
// //單獨包起來,哪怕這接口報錯也不要影響到正常的邏輯
// repository.addPrj("11112364", "153", "48863116,48863117,48863119")
// repository.addPrj("11112364", "153", "48863119")
// }, {
// it.printStackTrace()
// Log.e("eee", "錯誤信息222:" + it.message)
......
......@@ -8,6 +8,7 @@ import com.jess.arms.mvp.IModel;
import java.util.List;
import io.reactivex.Observable;
import okhttp3.RequestBody;
public interface LocalPrintContract {
......@@ -19,6 +20,7 @@ public interface LocalPrintContract {
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<PublicBean> getPrinterCurrencyList(String restaurantId);
Observable<PublicBean> deletePrinterCurrency(RequestBody requestBody);
}
}
......@@ -19,7 +19,7 @@ public interface PrintAddCurrencyContract {
Observable<PublicBean> getPrinterCurrencyList(String restaurantId);
Observable<PublicBean> addPrinterCurrency(RequestBody requestBody);
Observable<PublicBean> addPrinterCurrency(RequestBody requestBody, boolean isUpdate);
}
}
......@@ -15,6 +15,7 @@ import com.joe.print.mvp.contract.LocalPrintContract;
import com.joe.print.mvp.model.server.PrintInfoService;
import io.reactivex.Observable;
import okhttp3.RequestBody;
@FragmentScope
......@@ -40,4 +41,9 @@ public class LocalPrintModel extends BaseModel implements LocalPrintContract.Mod
public Observable<PublicBean> getPrinterCurrencyList(String restaurantId) {
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class).getCurrencyPrenterList(restaurantId);
}
@Override
public Observable<PublicBean> deletePrinterCurrency(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class).updatePrinterCurrency(requestBody);
}
}
\ No newline at end of file
......@@ -43,7 +43,11 @@ public class PrintAddCurrencyModel extends BaseModel implements PrintAddCurrency
}
@Override
public Observable<PublicBean> addPrinterCurrency(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class).addCurrencyPrenter(requestBody);
public Observable<PublicBean> addPrinterCurrency(RequestBody requestBody, boolean isUpdate) {
if (isUpdate) {
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class).updatePrinterCurrency(requestBody);
} else {
return mRepositoryManager.obtainRetrofitService(PrintInfoService.class).addCurrencyPrenter(requestBody);
}
}
}
\ No newline at end of file
......@@ -242,7 +242,6 @@ public class PrintInfoBean {
numberIsFlip = printCurrencyBean.getNumberIsFlip() == 1;
}
if (prjBeans == null || prjBeans.size() <= 0) {
return null;
}
......@@ -274,7 +273,7 @@ public class PrintInfoBean {
printInfoBeans.add(new PrintInfoBean(new String[]{"落單時間:" + TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_MDHM)}, new double[]{1}, 0));
//廚房位置
if (!TextUtil.isEmptyOrNullOrUndefined(key) && !key.equals("-1")) {
printInfoBeans.add(new PrintInfoBean(new String[]{key + "廚房", " " + GsaCloudApplication.getMemberName(GsaCloudApplication.getAppContext())}, new double[]{1}, 0));
printInfoBeans.add(new PrintInfoBean(new String[]{key + "廚房", " " + prjBean.getUserName()}, new double[]{1}, 0));
}
//人數
if (prjBean.getPerson() != 0) {
......
......@@ -79,6 +79,7 @@ public class PrjBean {
private String takeFoodCode; //取餐碼
private String billNo;//訂單碼
private int orderType;//訂單類型
private String userName;
/***
* 層級
* 1:主食品
......@@ -282,6 +283,14 @@ public class PrjBean {
public void setSender(String sender) {
this.sender = sender;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
public Map<String, List<Bean>> getPrjMap() {
......
......@@ -40,4 +40,8 @@ public interface PrintInfoService {
@POST("printerComplexionConfig/insert" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<PublicBean> addCurrencyPrenter(@Body RequestBody requestBody);
@POST("printerComplexionConfig/update" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<PublicBean> updatePrinterCurrency(@Body RequestBody requestBody);
}
......@@ -20,6 +20,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType;
import okhttp3.RequestBody;
@FragmentScope
......@@ -67,6 +69,28 @@ public class LocalPrintPresenter extends BasePresenter<LocalPrintContract.Model,
}
}
});
}
public void deletePrinterCurrency(PrintCurrencyBean printCurrencyBean) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(printCurrencyBean));
mModel.deletePrinterCurrency(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<PublicBean>(mErrorHandler) {
@Override
public void onNext(PublicBean s) {
if (s != null) {
// mRootView.addSuccess(s.isSuccess());
// } else {
// mRootView.addSuccess(false);
}
}
});
}
}
......@@ -55,9 +55,9 @@ public class PrintAddCurrencyPresenter extends BasePresenter<PrintAddCurrencyCon
}
public void addCurrencyPresenter(PrintCurrencyBean printCurrencyBean) {
public void addCurrencyPresenter(PrintCurrencyBean printCurrencyBean, boolean isUpdate) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), JsonUtils.toJson(printCurrencyBean));
mModel.addPrinterCurrency(requestBody)
mModel.addPrinterCurrency(requestBody, isUpdate)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(""))
.subscribeOn(AndroidSchedulers.mainThread())
......@@ -92,4 +92,6 @@ public class PrintAddCurrencyPresenter extends BasePresenter<PrintAddCurrencyCon
.add("numberIsFlip", printCurrencyBean.getNumberIsFlip() + "");
return builder.build();
}
}
......@@ -293,17 +293,19 @@ public class EpsonPrint implements ReceiveListener {
} else {
isItalic = printInfoBean.getIsItalic()[i] ? 1 : 0;
}
mPrinter.addTextRotate(isItalic);
if (printInfoBean.getIsBold().length == 1) {
mPrinter.addTextStyle(0, isItalic, printInfoBean.getIsBold()[0] ? 1 : 0, color);
//reverse取值0,1沒效果,ul下劃線,em加粗,
mPrinter.addTextStyle(1, 0, printInfoBean.getIsBold()[0] ? 1 : 0, color);
} else {
if (printInfoBean.getIsBold()[i]) {
mPrinter.addTextStyle(0, isItalic, 0, color);
mPrinter.addTextStyle(1, 0, 1, color);
} else {
mPrinter.addTextStyle(0, isItalic, 1, color);
mPrinter.addTextStyle(1, 0, 0, color);
}
}
StringBuilder space = new StringBuilder();
if (printInfoBean.getSize().length == 1) {
for (int j = 0; j < location / printInfoBean.getSize()[0]; j++) {
......
......@@ -172,7 +172,7 @@ public class PrintPrjKitchen extends PrinterRoot {
//落單時間,為當前時間
tvOrderTime.setText(TimeUtils.getCurrentTimeInString(TimeUtils.DEFAULT_DATE_MDHM));
//操作人員
tvOperator.setText(GsaCloudApplication.getMemberName(context));
tvOperator.setText(prjBean.getUserName());
return viewToBitmap(context, view);
}
......
......@@ -190,6 +190,7 @@ public class PrjService extends Service implements PrintSocketHolder.OnStateChan
private PrinterRoot printerInIt;
private String json = "{\"success\":true,\"sysTime\":1595066909048,\"data\":{\"K1\":[{\"id\":2461,\"printerDeviceId\":87,\"status\":1,\"orderNo\":\"153201882821850443\",\"orderTime\":2020,\"sender\":\"\",\"person\":0,\"number\":1,\"orderDetailsTime\":\"Jul 10, 2020 11:59:29 AM\",\"orderDetailsId\":48863119,\"productName\":\"紅棗銀耳湯\",\"parentId\":48863115,\"type\":4,\"createTime\":1595066908689,\"productId\":5189,\"requests\":1,\"actualPrinterDeviceId\":87,\"takeFoodCode\":\"H462\",\"billNo\":\"0643\",\"orderType\":7,\"userName\":\"stefan001\"}]}}\n";
/**
* 開始打印
*/
......
......@@ -67,6 +67,8 @@ public class PrintAddCurrencyActivity extends BaseActivity<PrintAddCurrencyPrese
private int foodColorPosition = 0;//食品顏色 0黑色,1紅色,3 綠色
private int foodItemColorPosition = 0;//細項顔色 0 黑色 1 紅色
private boolean isUpdate = false;//true 為修改,false 為新增
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
DaggerPrintAddCurrencyComponent //如找不到该类,请编译一下项目
......@@ -85,6 +87,7 @@ public class PrintAddCurrencyActivity extends BaseActivity<PrintAddCurrencyPrese
@Override
public void initData(@Nullable Bundle savedInstanceState) {
if (printCurrencyBean != null) {
isUpdate = true;
typePosition = printCurrencyBean.getType();
foodColorPosition = printCurrencyBean.getFoodComplexion();
foodItemColorPosition = printCurrencyBean.getModifierComplexion();
......@@ -100,6 +103,7 @@ public class PrintAddCurrencyActivity extends BaseActivity<PrintAddCurrencyPrese
switchFoodItemItalic.setChecked(printCurrencyBean.getModifierIsItalic() == 1);
switchColorFlip.setChecked(printCurrencyBean.getNumberIsFlip() == 1);
} else {
isUpdate = false;
//設置默認值
setTableType();
setFoodColor();
......@@ -108,11 +112,11 @@ public class PrintAddCurrencyActivity extends BaseActivity<PrintAddCurrencyPrese
}
private void setFoodItemColor() {
if(foodItemColorPosition == 0){
if (foodItemColorPosition == 0) {
tvFoodItemColor.setText("黑色");
} else if(foodItemColorPosition == 1){
} else if (foodItemColorPosition == 1) {
tvFoodItemColor.setText("綠色");
} else if(foodItemColorPosition == 2){
} else if (foodItemColorPosition == 2) {
tvFoodItemColor.setText("紅色");
}
}
......@@ -201,15 +205,15 @@ public class PrintAddCurrencyActivity extends BaseActivity<PrintAddCurrencyPrese
printCurrencyBean.setFoodIsItalic(switchFoodItalic.isChecked() ? 1 : 2);
printCurrencyBean.setModifierIsItalic(switchFoodItemItalic.isChecked() ? 1 : 2);
printCurrencyBean.setNumberIsFlip(switchColorFlip.isChecked() ? 1 : 2);
mPresenter.addCurrencyPresenter(printCurrencyBean);
mPresenter.addCurrencyPresenter(printCurrencyBean, isUpdate);
}
private void showSelectType() {
List<String> types = new ArrayList<>();
types.add("堂食");
types.add("外");
types.add("外");
DialogUtils.showSelectPopop(this, types, "餐檯模式", typePosition, i -> {
typePosition = i;
typePosition = i + 1;
setTableType();
});
}
......
......@@ -18,6 +18,7 @@ import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean;
import com.gingersoft.gsa.cloud.database.utils.PrintCurrencyDaoUtils;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.jess.arms.base.BaseFragment;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
......@@ -192,12 +193,23 @@ public class LocalPrintFragment extends BaseFragment<LocalPrintPresenter> implem
tvFoodColor.setText("綠色");
}
tvFoodItemColor.setText(printCurrencyBeans.get(i).getModifierComplexion() == 0 ? "黑色" : "紅色");
int finalI1 = i;
view.findViewById(R.id.iv_currency_print_delete).setOnClickListener(v -> {
//刪除
new AppDialog().showWaringDialog(mContext, "是否確認刪除", (view1, dialog) -> {
//調用刪除接口
if (finalI1 < printCurrencyBeans.size()) {
printCurrencyBeans.get(finalI1).setDeletes(1);
mPresenter.deletePrinterCurrency(printCurrencyBeans.get(finalI1));
printCurrencyBeans.remove(finalI1);
loadView(printCurrencyBeans);
}
dialog.dismiss();
});
});
int finalI = i;
view.setOnClickListener(v->{
view.setOnClickListener(v -> {
//編輯
Intent intent = new Intent(mContext, PrintAddCurrencyActivity.class);
intent.putExtra("printCurrencyBean", printCurrencyBeans.get(finalI));
......
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