28 changed files with 1475 additions and 99 deletions
@ -1 +1 @@ |
|||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.8","enabled":true,"outputFile":"维科上料报工系统_v1.0.8.apk","fullName":"release","baseName":"release"},"path":"维科上料报工系统_v1.0.8.apk","properties":{}}] |
|||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.11","enabled":true,"outputFile":"维科上料报工系统_v1.0.11.apk","fullName":"release","baseName":"release"},"path":"维科上料报工系统_v1.0.11.apk","properties":{}}] |
@ -0,0 +1,20 @@ |
|||
[ |
|||
{ |
|||
"id": 1, |
|||
"type": 2, |
|||
"fieldName": "AUFNR", |
|||
"name": "工单号", |
|||
"value": "", |
|||
"editExp": 0, |
|||
"values": [], |
|||
"mast": false, |
|||
"canChange": true, |
|||
"isShow": true, |
|||
"isFocus": true, |
|||
"language": { |
|||
"zh": "工单号", |
|||
"en": "Work order number", |
|||
"th": "หมายเลขหน้า" |
|||
} |
|||
} |
|||
] |
@ -0,0 +1,186 @@ |
|||
package com.techscan.wk.model; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* Description: |
|||
* created by MULEI at 2024/10/28 |
|||
*/ |
|||
public class FinshWarehouseSaveBean { |
|||
private List<ListBean> list; |
|||
|
|||
public void setList(List<ListBean> list) { |
|||
this.list = list; |
|||
} |
|||
|
|||
public List<ListBean> getList() { |
|||
return this.list; |
|||
} |
|||
|
|||
public static class ItemBean { |
|||
|
|||
private String aufnr; |
|||
|
|||
private String zgdsl; |
|||
|
|||
public String getAufnr() { |
|||
return aufnr; |
|||
} |
|||
|
|||
public void setAufnr(String aufnr) { |
|||
this.aufnr = aufnr; |
|||
} |
|||
|
|||
public String getZgdsl() { |
|||
return zgdsl; |
|||
} |
|||
|
|||
public void setZgdsl(String zgdsl) { |
|||
this.zgdsl = zgdsl; |
|||
} |
|||
} |
|||
|
|||
public static class ListBean { |
|||
|
|||
private List<ItemBean> item; |
|||
|
|||
private String matnr; |
|||
|
|||
private String werks; |
|||
|
|||
private String zbzcj; |
|||
|
|||
private String zcj; |
|||
|
|||
private String zcpdw; |
|||
|
|||
private String zcpsl; |
|||
|
|||
private String zgwh; |
|||
|
|||
private String zljrk; |
|||
|
|||
private String zmesdoc; |
|||
|
|||
private String zpc; |
|||
|
|||
private String zrkzt; |
|||
|
|||
private String zxtpc; |
|||
|
|||
private String zzlzt; |
|||
|
|||
public void setItem(List<ItemBean> item) { |
|||
this.item = item; |
|||
} |
|||
|
|||
public List<ItemBean> getItem() { |
|||
return this.item; |
|||
} |
|||
|
|||
public void setMatnr(String matnr) { |
|||
this.matnr = matnr; |
|||
} |
|||
|
|||
public String getMatnr() { |
|||
return this.matnr; |
|||
} |
|||
|
|||
public void setWerks(String werks) { |
|||
this.werks = werks; |
|||
} |
|||
|
|||
public String getWerks() { |
|||
return this.werks; |
|||
} |
|||
|
|||
public void setZbzcj(String zbzcj) { |
|||
this.zbzcj = zbzcj; |
|||
} |
|||
|
|||
public String getZbzcj() { |
|||
return this.zbzcj; |
|||
} |
|||
|
|||
public void setZcj(String zcj) { |
|||
this.zcj = zcj; |
|||
} |
|||
|
|||
public String getZcj() { |
|||
return this.zcj; |
|||
} |
|||
|
|||
public void setZcpdw(String zcpdw) { |
|||
this.zcpdw = zcpdw; |
|||
} |
|||
|
|||
public String getZcpdw() { |
|||
return this.zcpdw; |
|||
} |
|||
|
|||
public void setZcpsl(String zcpsl) { |
|||
this.zcpsl = zcpsl; |
|||
} |
|||
|
|||
public String getZcpsl() { |
|||
return this.zcpsl; |
|||
} |
|||
|
|||
public void setZgwh(String zgwh) { |
|||
this.zgwh = zgwh; |
|||
} |
|||
|
|||
public String getZgwh() { |
|||
return this.zgwh; |
|||
} |
|||
|
|||
public void setZljrk(String zljrk) { |
|||
this.zljrk = zljrk; |
|||
} |
|||
|
|||
public String getZljrk() { |
|||
return this.zljrk; |
|||
} |
|||
|
|||
public void setZmesdoc(String zmesdoc) { |
|||
this.zmesdoc = zmesdoc; |
|||
} |
|||
|
|||
public String getZmesdoc() { |
|||
return this.zmesdoc; |
|||
} |
|||
|
|||
public void setZpc(String zpc) { |
|||
this.zpc = zpc; |
|||
} |
|||
|
|||
public String getZpc() { |
|||
return this.zpc; |
|||
} |
|||
|
|||
public void setZrkzt(String zrkzt) { |
|||
this.zrkzt = zrkzt; |
|||
} |
|||
|
|||
public String getZrkzt() { |
|||
return this.zrkzt; |
|||
} |
|||
|
|||
public void setZxtpc(String zxtpc) { |
|||
this.zxtpc = zxtpc; |
|||
} |
|||
|
|||
public String getZxtpc() { |
|||
return this.zxtpc; |
|||
} |
|||
|
|||
public void setZzlzt(String zzlzt) { |
|||
this.zzlzt = zzlzt; |
|||
} |
|||
|
|||
public String getZzlzt() { |
|||
return this.zzlzt; |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,209 @@ |
|||
package com.techscan.wk.model; |
|||
|
|||
public class ReportWorkBean { |
|||
private boolean select; |
|||
private String arbpl; |
|||
private String aufnr; |
|||
private String matnr; |
|||
private String budat; |
|||
private String createTime; |
|||
private int createUser; |
|||
private int dr; |
|||
private String gmein; |
|||
private int gmnga; |
|||
private String grund; |
|||
private int id; |
|||
private int lmnga; |
|||
private String meinh; |
|||
private String resultRmzhl; |
|||
private String resultRueck; |
|||
private String rmzhl; |
|||
private String rueck; |
|||
private int status; |
|||
private String vornr; |
|||
private String werks; |
|||
private int xmnga; |
|||
private String zxtpc; |
|||
private String zpc; |
|||
private String zzt; |
|||
|
|||
public String getMatnr() { |
|||
return matnr; |
|||
} |
|||
|
|||
public void setMatnr(String matnr) { |
|||
this.matnr = matnr; |
|||
} |
|||
|
|||
public String getZpc() { |
|||
return zpc; |
|||
} |
|||
|
|||
public void setZpc(String zpc) { |
|||
this.zpc = zpc; |
|||
} |
|||
|
|||
public boolean isSelect() { |
|||
return select; |
|||
} |
|||
|
|||
public void setSelect(boolean select) { |
|||
this.select = select; |
|||
} |
|||
|
|||
public void setArbpl(String arbpl) { |
|||
this.arbpl = arbpl; |
|||
} |
|||
public String getArbpl() { |
|||
return arbpl; |
|||
} |
|||
|
|||
public void setAufnr(String aufnr) { |
|||
this.aufnr = aufnr; |
|||
} |
|||
public String getAufnr() { |
|||
return aufnr; |
|||
} |
|||
|
|||
public void setBudat(String budat) { |
|||
this.budat = budat; |
|||
} |
|||
public String getBudat() { |
|||
return budat; |
|||
} |
|||
|
|||
public void setCreateTime(String createTime) { |
|||
this.createTime = createTime; |
|||
} |
|||
public String getCreateTime() { |
|||
return createTime; |
|||
} |
|||
|
|||
public void setCreateUser(int createUser) { |
|||
this.createUser = createUser; |
|||
} |
|||
public int getCreateUser() { |
|||
return createUser; |
|||
} |
|||
|
|||
public void setDr(int dr) { |
|||
this.dr = dr; |
|||
} |
|||
public int getDr() { |
|||
return dr; |
|||
} |
|||
|
|||
public void setGmein(String gmein) { |
|||
this.gmein = gmein; |
|||
} |
|||
public String getGmein() { |
|||
return gmein; |
|||
} |
|||
|
|||
public void setGmnga(int gmnga) { |
|||
this.gmnga = gmnga; |
|||
} |
|||
public int getGmnga() { |
|||
return gmnga; |
|||
} |
|||
|
|||
public void setGrund(String grund) { |
|||
this.grund = grund; |
|||
} |
|||
public String getGrund() { |
|||
return grund; |
|||
} |
|||
|
|||
public void setId(int id) { |
|||
this.id = id; |
|||
} |
|||
public int getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setLmnga(int lmnga) { |
|||
this.lmnga = lmnga; |
|||
} |
|||
public int getLmnga() { |
|||
return lmnga; |
|||
} |
|||
|
|||
public void setMeinh(String meinh) { |
|||
this.meinh = meinh; |
|||
} |
|||
public String getMeinh() { |
|||
return meinh; |
|||
} |
|||
|
|||
public void setResultRmzhl(String resultRmzhl) { |
|||
this.resultRmzhl = resultRmzhl; |
|||
} |
|||
public String getResultRmzhl() { |
|||
return resultRmzhl; |
|||
} |
|||
|
|||
public void setResultRueck(String resultRueck) { |
|||
this.resultRueck = resultRueck; |
|||
} |
|||
public String getResultRueck() { |
|||
return resultRueck; |
|||
} |
|||
|
|||
public void setRmzhl(String rmzhl) { |
|||
this.rmzhl = rmzhl; |
|||
} |
|||
public String getRmzhl() { |
|||
return rmzhl; |
|||
} |
|||
|
|||
public void setRueck(String rueck) { |
|||
this.rueck = rueck; |
|||
} |
|||
public String getRueck() { |
|||
return rueck; |
|||
} |
|||
|
|||
public void setStatus(int status) { |
|||
this.status = status; |
|||
} |
|||
public int getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setVornr(String vornr) { |
|||
this.vornr = vornr; |
|||
} |
|||
public String getVornr() { |
|||
return vornr; |
|||
} |
|||
|
|||
public void setWerks(String werks) { |
|||
this.werks = werks; |
|||
} |
|||
public String getWerks() { |
|||
return werks; |
|||
} |
|||
|
|||
public void setXmnga(int xmnga) { |
|||
this.xmnga = xmnga; |
|||
} |
|||
public int getXmnga() { |
|||
return xmnga; |
|||
} |
|||
|
|||
public void setZxtpc(String zxtpc) { |
|||
this.zxtpc = zxtpc; |
|||
} |
|||
public String getZxtpc() { |
|||
return zxtpc; |
|||
} |
|||
|
|||
public void setZzt(String zzt) { |
|||
this.zzt = zzt; |
|||
} |
|||
public String getZzt() { |
|||
return zzt; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,600 @@ |
|||
package com.techscan.wk.ui.finishedWarehous; |
|||
|
|||
import static com.techscan.wk.app.AppConst.CAMERA_CODE; |
|||
import static com.techscan.wk.app.AppConst.KEY_IS_CONTINUOUS; |
|||
import static com.techscan.wk.app.AppConst.KEY_TITLE; |
|||
import static com.techscan.wk.app.AppConst.REQUEST_CODE_SCAN_FOR_GROUP; |
|||
|
|||
import android.Manifest; |
|||
import android.annotation.SuppressLint; |
|||
import android.content.Context; |
|||
import android.content.Intent; |
|||
import android.content.pm.PackageManager; |
|||
import android.os.Bundle; |
|||
import android.text.TextUtils; |
|||
import android.util.DisplayMetrics; |
|||
import android.view.KeyEvent; |
|||
import android.view.View; |
|||
import android.widget.EditText; |
|||
import android.widget.ImageView; |
|||
import android.widget.LinearLayout; |
|||
import android.widget.Toast; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.core.app.ActivityCompat; |
|||
import androidx.core.content.ContextCompat; |
|||
import androidx.recyclerview.widget.DividerItemDecoration; |
|||
import androidx.recyclerview.widget.GridLayoutManager; |
|||
import androidx.recyclerview.widget.RecyclerView; |
|||
|
|||
import com.bin.david.form.core.TableConfig; |
|||
import com.bin.david.form.data.CellInfo; |
|||
import com.bin.david.form.data.column.Column; |
|||
import com.bin.david.form.data.format.bg.BaseBackgroundFormat; |
|||
import com.bin.david.form.data.format.bg.BaseCellBackgroundFormat; |
|||
import com.bin.david.form.data.format.bg.IBackgroundFormat; |
|||
import com.bin.david.form.data.format.draw.ImageResDrawFormat; |
|||
import com.bin.david.form.data.style.FontStyle; |
|||
import com.bin.david.form.data.table.TableData; |
|||
import com.bin.david.form.utils.DensityUtils; |
|||
import com.blankj.utilcode.util.KeyboardUtils; |
|||
import com.blankj.utilcode.util.StringUtils; |
|||
import com.blankj.utilcode.util.ToastUtils; |
|||
import com.google.gson.reflect.TypeToken; |
|||
import com.king.zxing.Intents; |
|||
import com.lxj.xpopup.XPopup; |
|||
import com.qmuiteam.qmui.widget.QMUITopBar; |
|||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; |
|||
import com.techscan.wk.R; |
|||
import com.techscan.wk.adapter.DynamicFormAdapter; |
|||
import com.techscan.wk.base.CommonFunctionActivity; |
|||
import com.techscan.wk.model.DetailShowBean; |
|||
import com.techscan.wk.model.DynamicFormBean; |
|||
import com.techscan.wk.model.FinshWarehouseSaveBean; |
|||
import com.techscan.wk.model.ReportWorkBean; |
|||
import com.techscan.wk.model.ReportWorkErrorInfoBean; |
|||
import com.techscan.wk.rxbus.Event; |
|||
import com.techscan.wk.rxbus.RxBus; |
|||
import com.techscan.wk.rxretrofit.BaseObserver; |
|||
import com.techscan.wk.rxretrofit.BaseResponseBean; |
|||
import com.techscan.wk.rxretrofit.HttpMethods; |
|||
import com.techscan.wk.ui.scan.CustomCaptureActivity; |
|||
import com.techscan.wk.utils.AntiShakeUtils; |
|||
import com.techscan.wk.utils.FindUtils; |
|||
import com.techscan.wk.utils.SoundUtils; |
|||
import com.techscan.wk.utils.ToastUtil; |
|||
import com.techscan.wk.widgets.DetailBottomSheet; |
|||
import com.techscan.wk.widgets.MySmartTable; |
|||
|
|||
import java.lang.reflect.Type; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
import butterknife.OnClick; |
|||
import io.reactivex.disposables.Disposable; |
|||
import okhttp3.ResponseBody; |
|||
import q.rorbin.badgeview.QBadgeView; |
|||
|
|||
/** |
|||
* 完工入库 |
|||
*/ |
|||
public class FinshWarehouseActivity extends CommonFunctionActivity { |
|||
|
|||
@BindView(R.id.topbar) |
|||
QMUITopBar topbar; |
|||
@BindView(R.id.et_value) |
|||
EditText etValue; |
|||
@BindView(R.id.iv_scan) |
|||
ImageView ivScan; |
|||
@BindView(R.id.ll_scan) |
|||
LinearLayout llScan; |
|||
@BindView(R.id.rv_ui) |
|||
RecyclerView rvUi; |
|||
|
|||
@BindView(R.id.smartTable) |
|||
MySmartTable<ReportWorkBean> smartTable; |
|||
private Column<Boolean> select; |
|||
private Column<String> AUFNR; |
|||
private Column<String> GMNGA; |
|||
private Column<String> createTime; |
|||
private Column<String> zxtpc; |
|||
private Column<String> zpc; |
|||
|
|||
|
|||
QBadgeView qTaskBadgeView, qDetailBadgeView; |
|||
|
|||
private DynamicFormAdapter dynamicFormAdapter; |
|||
private List<DynamicFormBean> dynamicFormBeans; |
|||
private DynamicFormBean selectDynamicFormBean; |
|||
private TableData<ReportWorkBean> mTableData; |
|||
private List<ReportWorkBean> list = new ArrayList<>(); |
|||
|
|||
|
|||
@Override |
|||
protected void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setContentView(R.layout.activity_report_work_in); |
|||
ButterKnife.bind(this); |
|||
setBody(true); |
|||
Disposable register = RxBus.getInstance().register(Event.class, eventMsg -> { |
|||
}); |
|||
|
|||
RxBus.getInstance().addSubscription(this, register); |
|||
|
|||
qTaskBadgeView = new QBadgeView(context); |
|||
qDetailBadgeView = new QBadgeView(context); |
|||
|
|||
initTopBar(); |
|||
|
|||
initListeners(); |
|||
initRvData(); |
|||
initTableData(); |
|||
rvUi.postDelayed(() -> { |
|||
setNextFocus("AUFNR"); |
|||
}, 200); |
|||
} |
|||
|
|||
|
|||
private void initTableData() { |
|||
DisplayMetrics metrics = new DisplayMetrics(); |
|||
getWindowManager().getDefaultDisplay().getMetrics(metrics); |
|||
int screenWith = metrics.widthPixels; |
|||
TableConfig config = smartTable.getConfig(); |
|||
FontStyle columnTitleStyle = config.getColumnTitleStyle(); |
|||
columnTitleStyle.setTextSpSize(this, 16); |
|||
config.setMinTableWidth(screenWith); |
|||
config.setColumnTitleHorizontalPadding(8); |
|||
config.setColumnTitleVerticalPadding(12); |
|||
config.setVerticalPadding(12); |
|||
IBackgroundFormat backgroundFormat = new BaseBackgroundFormat(getResources().getColor(R.color.white_grey_3)); |
|||
config.setColumnTitleBackground(backgroundFormat); |
|||
config.setShowXSequence(false); |
|||
config.setShowYSequence(false); |
|||
config.setShowTableTitle(false); |
|||
select = new Column<>(getString(R.string.select_all), "select"); |
|||
|
|||
AUFNR = new Column<>(getString(R.string.Work_order_number), "aufnr"); |
|||
GMNGA = new Column<>(getString(R.string.Quantity_reported), "gmnga"); |
|||
createTime = new Column<>(getString(R.string.Creation_time), "createTime"); |
|||
zxtpc = new Column<>(getString(R.string.Case_number), "zxtpc"); |
|||
zpc = new Column<>(getString(R.string.batch), "zpc"); |
|||
select.setFixed(true); |
|||
select.setFast(true); |
|||
select.setMinWidth(90); |
|||
AUFNR.setFast(true); |
|||
GMNGA.setFast(true); |
|||
createTime.setFast(true); |
|||
zxtpc.setFast(true); |
|||
zpc.setFast(true); |
|||
|
|||
//设置单个格子背景颜色
|
|||
smartTable.getConfig().setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() { |
|||
@Override |
|||
public int getBackGroundColor(CellInfo cellInfo) { |
|||
if ("select".equals(cellInfo.column.getFieldName())) { |
|||
return ContextCompat.getColor(FinshWarehouseActivity.this, R.color.white_grey_3); |
|||
} |
|||
return TableConfig.INVALID_COLOR; |
|||
} |
|||
|
|||
//根据背景颜色设置字体颜色
|
|||
@Override |
|||
public int getTextColor(CellInfo cellInfo) { |
|||
if ("select".equals(cellInfo.column.getFieldName())) { |
|||
return ContextCompat.getColor(FinshWarehouseActivity.this, R.color.app_color_theme_7); |
|||
} else { |
|||
return super.getTextColor(cellInfo); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
final int imgSize = DensityUtils.dp2px(this, 20); |
|||
select.setDrawFormat(new ImageResDrawFormat<Boolean>(imgSize, imgSize) { |
|||
@Override |
|||
protected Context getContext() { |
|||
return FinshWarehouseActivity.this; |
|||
} |
|||
|
|||
@Override |
|||
protected int getResourceID(Boolean val, String value, int position) { |
|||
if (list.get(position).isSelect()) { |
|||
return R.mipmap.ic_select_check; |
|||
} else { |
|||
return R.mipmap.ic_unselect_check; |
|||
} |
|||
} |
|||
}); |
|||
smartTable.setOnColumnClickListener(columnInfo -> { |
|||
String columnName = columnInfo.column.getColumnName(); |
|||
if (columnInfo.column.getFieldName().equals("select")) { |
|||
List<ReportWorkBean> beanList = smartTable.getTableData().getT(); |
|||
if (beanList != null && beanList.size() != 0) { |
|||
if (columnName.equals(getString(R.string.select_all))) { |
|||
select.setColumnName(getString(R.string.cancel_info)); |
|||
for (int i = 0; i < beanList.size(); i++) { |
|||
beanList.get(i).setSelect(true); |
|||
} |
|||
} else { |
|||
select.setColumnName(getString(R.string.select_all)); |
|||
for (int i = 0; i < beanList.size(); i++) { |
|||
beanList.get(i).setSelect(false); |
|||
} |
|||
} |
|||
smartTable.refreshDrawableState(); |
|||
smartTable.invalidate(); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
setTableData(); |
|||
setTableRowClickListener(); |
|||
} |
|||
|
|||
private void setTableRowClickListener() { |
|||
smartTable.getTableData().setOnRowClickListener((column, reportWorkOffsetBean, coIndex, row) -> { |
|||
if (column.getFieldName().equals("select")) { |
|||
List<ReportWorkBean> beanList = smartTable.getTableData().getT(); |
|||
if (beanList.get(row).isSelect()) { |
|||
beanList.get(row).setSelect(false); |
|||
} else { |
|||
beanList.get(row).setSelect(true); |
|||
} |
|||
int selectCount = 0; |
|||
for (int i = 0; i < beanList.size(); i++) { |
|||
if (beanList.get(i).isSelect()) { |
|||
selectCount++; |
|||
} |
|||
} |
|||
if (beanList.size() > 0 && selectCount == beanList.size()) { |
|||
select.setColumnName(getString(R.string.cancel_info)); |
|||
} else { |
|||
select.setColumnName(getString(R.string.select_all)); |
|||
} |
|||
smartTable.refreshDrawableState(); |
|||
smartTable.invalidate(); |
|||
|
|||
} else { |
|||
|
|||
List<DetailShowBean> list = new ArrayList<>(); |
|||
list.add(new DetailShowBean(getString(R.string.Work_order_number), reportWorkOffsetBean.getAufnr())); |
|||
list.add(new DetailShowBean(getString(R.string.Creation_time), reportWorkOffsetBean.getCreateTime())); |
|||
list.add(new DetailShowBean(getString(R.string.Process_confirmation_number), reportWorkOffsetBean.getResultRueck())); |
|||
list.add(new DetailShowBean(getString(R.string.counter), reportWorkOffsetBean.getResultRmzhl())); |
|||
list.add(new DetailShowBean(getString(R.string.Factory), reportWorkOffsetBean.getWerks())); |
|||
list.add(new DetailShowBean(getString(R.string.Case_number), reportWorkOffsetBean.getZxtpc())); |
|||
list.add(new DetailShowBean(getString(R.string.batch), reportWorkOffsetBean.getZpc())); |
|||
list.add(new DetailShowBean(getString(R.string.Quantity_reported), reportWorkOffsetBean.getGmnga() + "")); |
|||
list.add(new DetailShowBean(getString(R.string.A_unit_of_measurement_of_reported_quantity), reportWorkOffsetBean.getMeinh() + "")); |
|||
list.add(new DetailShowBean(getString(R.string.Basic_number_of_reports), reportWorkOffsetBean.getLmnga() + "")); |
|||
list.add(new DetailShowBean(getString(R.string.A_unit_of_measurement_of_basic_quantity_reported), reportWorkOffsetBean.getGmein())); |
|||
DetailBottomSheet detailBottomSheet = new DetailBottomSheet<>(context, getResources().getString(R.string.detail_info), list); |
|||
new XPopup.Builder(context) |
|||
.moveUpToKeyboard(false) //如果不加这个,评论弹窗会移动到软键盘上面
|
|||
.isRequestFocus(false) |
|||
.autoFocusEditText(false) |
|||
.autoOpenSoftInput(true) |
|||
.asCustom(detailBottomSheet) |
|||
.show(); |
|||
} |
|||
|
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 保存数据 |
|||
*/ |
|||
private void saveData() { |
|||
List<ReportWorkBean> reportWorkBeanList = smartTable.getTableData().getT(); |
|||
|
|||
List<FinshWarehouseSaveBean.ListBean> listBeanList = new ArrayList<>(); |
|||
for (int i = 0; i < reportWorkBeanList.size(); i++) { |
|||
ReportWorkBean reportWorkBean = reportWorkBeanList.get(i); |
|||
if (reportWorkBean.isSelect()) { |
|||
List<FinshWarehouseSaveBean.ItemBean> itemBeanList = new ArrayList<>(); |
|||
FinshWarehouseSaveBean.ItemBean itemBean = new FinshWarehouseSaveBean.ItemBean(); |
|||
itemBean.setAufnr(reportWorkBean.getAufnr()); |
|||
itemBean.setZgdsl(String.valueOf(reportWorkBean.getGmnga())); |
|||
itemBeanList.add(itemBean); |
|||
|
|||
FinshWarehouseSaveBean.ListBean listBean = new FinshWarehouseSaveBean.ListBean(); |
|||
listBean.setMatnr(reportWorkBean.getMatnr()); |
|||
listBean.setWerks(reportWorkBean.getWerks()); |
|||
listBean.setZcpdw(reportWorkBean.getMeinh()); |
|||
listBean.setZcpsl(String.valueOf(reportWorkBean.getGmnga())); |
|||
listBean.setZpc(reportWorkBean.getZpc()); |
|||
listBean.setZxtpc(reportWorkBean.getZxtpc()); |
|||
listBean.setZzlzt("10"); |
|||
|
|||
listBean.setItem(itemBeanList); |
|||
|
|||
listBeanList.add(listBean); |
|||
} |
|||
} |
|||
|
|||
if (listBeanList.size() == 0) { |
|||
ToastUtils.showLong(R.string.Please_select_the_data_you_want_to_save); |
|||
return; |
|||
} |
|||
|
|||
FinshWarehouseSaveBean bean = new FinshWarehouseSaveBean(); |
|||
bean.setList(listBeanList); |
|||
String json = gson.toJson(bean); |
|||
|
|||
HttpMethods.getInstance().storage(json, new BaseObserver<ResponseBody>(this) { |
|||
@Override |
|||
protected void onSuccess(ResponseBody responseBody) throws Exception { |
|||
String string = responseBody.string(); |
|||
Type objectType = new TypeToken<BaseResponseBean<String>>() { |
|||
}.getType(); |
|||
BaseResponseBean<String> baseResponseBean = gson.fromJson(string, objectType); |
|||
if (baseResponseBean.getCode() == 200) { |
|||
QMUIDialog.MessageDialogBuilder messageDialogBuilder = new QMUIDialog.MessageDialogBuilder(context); |
|||
messageDialogBuilder.setTitle(getResources().getString(R.string.tips_title)) |
|||
.setCancelable(false) |
|||
.setMessage(getString(R.string.Data_saved_successfully)) |
|||
.addAction(getResources().getString(R.string.cancel_info), (dialog, index) -> dialog.dismiss()) |
|||
.addAction(getResources().getString(R.string.confirm_info), (dialog, index) -> { |
|||
dialog.dismiss(); |
|||
}) |
|||
.create(R.style.QMUI_Dialog).show(); |
|||
messageDialogBuilder.show().setOnDismissListener(dialogInterface -> query()); |
|||
} else { |
|||
showError(baseResponseBean.getMsg()); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
protected void onFailure(Throwable e) throws Exception { |
|||
CustomErrorDialog(e, FinshWarehouseActivity.this); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
private void setTableData() { |
|||
mTableData = new TableData<>("", list, select, AUFNR, GMNGA,zxtpc,createTime,zpc); |
|||
smartTable.setTableData(mTableData); |
|||
smartTable.invalidate(); |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* 初始化顶部标题栏 |
|||
*/ |
|||
private void initTopBar() { |
|||
topbar.setTitle(getString(R.string.Finished_warehousing)); |
|||
topbar.addLeftBackImageButton().setOnClickListener(v -> finishActivity()); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 界面数据回调监听设置 |
|||
*/ |
|||
private void initListeners() { |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 重新刷新ui |
|||
*/ |
|||
@SuppressLint("SetTextI18n") |
|||
private void reInitUI() { |
|||
runOnUiThread(() -> { |
|||
dynamicFormAdapter.clearAllValues(); |
|||
if (KeyboardUtils.isSoftInputVisible(context)) { |
|||
KeyboardUtils.hideSoftInput(context); |
|||
} |
|||
setNextFocus("AUFNR"); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 初始化动态列表数据 |
|||
*/ |
|||
private void initRvData() { |
|||
// 从资源文件中读取界面数据
|
|||
String jsonStr = FindUtils.readJsonFromFile(context, "FinshWareHouseUI.json"); |
|||
// 将读取到的json数据转化为动态表单对象
|
|||
Type objectType = new TypeToken<List<DynamicFormBean>>() { |
|||
}.getType(); |
|||
//动态表单数据
|
|||
dynamicFormBeans = gson.fromJson(jsonStr, objectType); |
|||
// 动态表单绑定数据并绑定适配器到recycleView中
|
|||
dynamicFormAdapter = new DynamicFormAdapter(dynamicFormBeans, false, 0); |
|||
GridLayoutManager layout = new GridLayoutManager(this, 2); |
|||
layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { |
|||
@Override |
|||
public int getSpanSize(int i) { |
|||
return dynamicFormBeans.get(i).getType() == 8 ? 1 : 2; |
|||
} |
|||
}); |
|||
rvUi.setLayoutManager(layout); |
|||
rvUi.setAdapter(dynamicFormAdapter); |
|||
rvUi.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); |
|||
// 设置动态表单点击事件
|
|||
dynamicFormAdapter.setOnFormItemViewClickListener((dynamicFormBean, position, custom) -> { |
|||
if (custom.length > 0) { |
|||
if (custom[0].equals("scan")) { |
|||
selectDynamicFormBean = dynamicFormBean; |
|||
if (!hasPermission(Manifest.permission.CAMERA)) |
|||
requestPermission(CAMERA_CODE, Manifest.permission.CAMERA); |
|||
else |
|||
startScan(getResources().getString(R.string.scan_title)); |
|||
} |
|||
} |
|||
}); |
|||
dynamicFormAdapter.setOnFormItemViewActionListener((dynamicFormBean, position) -> { |
|||
String value = dynamicFormBean.getValue(); |
|||
switch (dynamicFormBean.getFieldName()) { |
|||
case "AUFNR": |
|||
if (TextUtils.isEmpty(value)) { |
|||
showError(getString(R.string.The_work_order_number_cannot_be_empty)); |
|||
dynamicFormAdapter.setFocusById(dynamicFormBean.getId()); |
|||
return; |
|||
} |
|||
if (KeyboardUtils.isSoftInputVisible(context)) { |
|||
KeyboardUtils.hideSoftInput(context); |
|||
} |
|||
query(); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 根据工单调用查询接口方法 |
|||
*/ |
|||
private void query() { |
|||
DynamicFormBean aufnrItem = dynamicFormAdapter.getItemByFieldName("AUFNR");//工单
|
|||
HttpMethods.getInstance().getReport(aufnrItem.getValue(), "", new BaseObserver<ResponseBody>(context) { |
|||
@Override |
|||
protected void onSuccess(ResponseBody body) throws Exception { |
|||
String string = body.string(); |
|||
Type objectType = new TypeToken<BaseResponseBean<List<ReportWorkBean>>>() { |
|||
}.getType(); |
|||
BaseResponseBean<List<ReportWorkBean>> baseResponseBean = gson.fromJson(string, objectType); |
|||
select.setColumnName(getString(R.string.select_all)); |
|||
if (baseResponseBean.getCode() == 200) { |
|||
list.clear(); |
|||
if (baseResponseBean.getData().size() > 0) { |
|||
list.addAll(baseResponseBean.getData()); |
|||
} else { |
|||
ToastUtils.showLong(getString(R.string.No_data_was_obtained)); |
|||
} |
|||
} else { |
|||
list.clear(); |
|||
showError(baseResponseBean.getMsg()); |
|||
} |
|||
setTableData(); |
|||
setTableRowClickListener(); |
|||
} |
|||
|
|||
@Override |
|||
protected void onFailure(Throwable e) throws Exception { |
|||
select.setColumnName(getString(R.string.select_all)); |
|||
list.clear(); |
|||
setTableData(); |
|||
setTableRowClickListener(); |
|||
CustomErrorDialog(e, FinshWarehouseActivity.this); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
@OnClick({R.id.iv_scan, R.id.btn_submit}) |
|||
public void onViewClicked(View view) { |
|||
if (AntiShakeUtils.isInvalidClick(view)) |
|||
return; |
|||
switch (view.getId()) { |
|||
case R.id.iv_scan: |
|||
//扫码
|
|||
if (!hasPermission(Manifest.permission.CAMERA)) |
|||
requestPermission(CAMERA_CODE, Manifest.permission.CAMERA); |
|||
else |
|||
startScan(getResources().getString(R.string.scan_title)); |
|||
break; |
|||
case R.id.btn_submit: |
|||
saveData(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
|
|||
@Override |
|||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
|||
super.onActivityResult(requestCode, resultCode, data); |
|||
if (requestCode == REQUEST_CODE_SCAN_FOR_GROUP) { |
|||
if (resultCode == RESULT_OK && data != null) { |
|||
String scanResult = data.getStringExtra(Intents.Scan.RESULT); |
|||
if (StringUtils.isTrimEmpty(scanResult)) { |
|||
SoundUtils.playSound(context, R.raw.warning); |
|||
ToastUtil.showShortToastCenter(context, getString(R.string.The_bar_code_cannot_be_blank)); |
|||
return; |
|||
} |
|||
if (selectDynamicFormBean != null) { |
|||
selectDynamicFormBean.setValue(scanResult); |
|||
dynamicFormAdapter.setItemByFieldName(selectDynamicFormBean.getFieldName(), selectDynamicFormBean); |
|||
} |
|||
switch (selectDynamicFormBean.getFieldName()) { |
|||
case "AUFNR": |
|||
|
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
private void showError(String msg) { |
|||
SoundUtils.playSound(context, R.raw.warning); |
|||
ToastUtil.showShortToastCenter(context, msg); |
|||
} |
|||
|
|||
/** |
|||
* 扫码 |
|||
* |
|||
* @param title 扫码标题 |
|||
*/ |
|||
private void startScan(String title) { |
|||
Intent intent = new Intent(context, CustomCaptureActivity.class); |
|||
intent.putExtra(KEY_TITLE, title); |
|||
intent.putExtra(KEY_IS_CONTINUOUS, false); |
|||
ActivityCompat.startActivityForResult(context, intent, REQUEST_CODE_SCAN_FOR_GROUP, null); |
|||
} |
|||
|
|||
@Override |
|||
public void doRequestPermissionsResult(int requestCode, @NonNull int[] grantResults) { |
|||
// 读取手机信息权限
|
|||
if (requestCode == CAMERA_CODE) { |
|||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) |
|||
// 权限请求成功
|
|||
startScan(getResources().getString(R.string.scan_title)); |
|||
else |
|||
// 权限请求失败
|
|||
Toast.makeText(context, getResources().getString(R.string.scan_no_permission), Toast.LENGTH_SHORT).show(); |
|||
} |
|||
} |
|||
|
|||
private void setNextFocus(String name) { |
|||
rvUi.postDelayed(() -> { |
|||
List<DynamicFormBean> data = dynamicFormAdapter.getData(); |
|||
for (DynamicFormBean bean : |
|||
data) { |
|||
if (bean.getFieldName().equals(name)) { |
|||
bean.setValue(""); |
|||
bean.setFocus(true); |
|||
} else { |
|||
bean.setFocus(false); |
|||
} |
|||
} |
|||
dynamicFormAdapter.notifyDataSetChanged(); |
|||
}, 200); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public boolean onKeyDown(int keyCode, KeyEvent event) { |
|||
if (keyCode == KeyEvent.KEYCODE_BACK) { |
|||
finishActivity(); |
|||
return true; |
|||
} |
|||
return super.onKeyDown(keyCode, event); |
|||
} |
|||
|
|||
private void finishActivity() { |
|||
finish(); |
|||
} |
|||
|
|||
@Override |
|||
protected void onDestroy() { |
|||
RxBus.getInstance().unRegister(this); |
|||
super.onDestroy(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,65 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|||
xmlns:app="http://schemas.android.com/apk/res-auto" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:background="@color/qmui_config_color_white" |
|||
android:orientation="vertical"> |
|||
|
|||
<com.qmuiteam.qmui.widget.QMUITopBar |
|||
android:id="@+id/topbar" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="?attr/qmui_topbar_height" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toTopOf="parent" /> |
|||
|
|||
<LinearLayout |
|||
android:id="@+id/ll_scan" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" |
|||
android:layout_below="@id/topbar" |
|||
android:orientation="vertical" |
|||
android:visibility="gone" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@id/topbar"> |
|||
|
|||
<include layout="@layout/layout_edit_scan" /> |
|||
</LinearLayout> |
|||
|
|||
<LinearLayout |
|||
android:layout_width="match_parent" |
|||
android:layout_height="0dp" |
|||
android:orientation="vertical" |
|||
app:layout_constraintBottom_toTopOf="@id/btn_submit" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" |
|||
app:layout_constraintTop_toBottomOf="@id/ll_scan"> |
|||
|
|||
<androidx.recyclerview.widget.RecyclerView |
|||
android:id="@+id/rv_ui" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="wrap_content" /> |
|||
|
|||
<com.techscan.wk.widgets.MySmartTable |
|||
android:id="@+id/smartTable" |
|||
android:layout_width="match_parent" |
|||
android:layout_height="match_parent" |
|||
android:layout_marginTop="5dp" /> |
|||
|
|||
</LinearLayout> |
|||
|
|||
<Button |
|||
android:id="@+id/btn_submit" |
|||
android:layout_width="0dp" |
|||
android:layout_marginLeft="5dp" |
|||
android:layout_marginRight="5dp" |
|||
android:layout_height="wrap_content" |
|||
android:background="@drawable/bg_scan_btn_selector" |
|||
android:text="@string/save_info" |
|||
android:textColor="@color/qmui_config_color_white" |
|||
app:layout_constraintBottom_toBottomOf="parent" |
|||
app:layout_constraintEnd_toEndOf="parent" |
|||
app:layout_constraintStart_toStartOf="parent" /> |
|||
</androidx.constraintlayout.widget.ConstraintLayout> |
Loading…
Reference in new issue