39 changed files with 1877 additions and 432 deletions
@ -1 +1 @@ |
|||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.1","enabled":true,"outputFile":"维科上料报工系统_v1.0.1.apk","fullName":"release","baseName":"release"},"path":"维科上料报工系统_v1.0.1.apk","properties":{}}] |
|
||||
|
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0.2","enabled":true,"outputFile":"维科上料报工系统_v1.0.2.apk","fullName":"release","baseName":"release"},"path":"维科上料报工系统_v1.0.2.apk","properties":{}}] |
||||
@ -0,0 +1,38 @@ |
|||||
|
[ |
||||
|
{ |
||||
|
"id": 1, |
||||
|
"type": 9, |
||||
|
"fieldName": "TIME", |
||||
|
"name": "日期", |
||||
|
"value": "", |
||||
|
"editExp": 0, |
||||
|
"values": [], |
||||
|
"mast": false, |
||||
|
"canChange": true, |
||||
|
"isShow": true, |
||||
|
"isFocus": true, |
||||
|
"language": { |
||||
|
"zh": "日期", |
||||
|
"en": "date", |
||||
|
"th": "วัน ที่" |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"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,202 @@ |
|||||
|
package com.techscan.wk.model; |
||||
|
|
||||
|
public class ProReturnBean { |
||||
|
private String select; |
||||
|
private String aufnr; |
||||
|
private String createTime; |
||||
|
private int createUser; |
||||
|
private int dr; |
||||
|
private String erfme; |
||||
|
private double erfmg; |
||||
|
private int id; |
||||
|
private int pickId; |
||||
|
private String lgort; |
||||
|
private String matnr; |
||||
|
private String sapStatus; |
||||
|
private String updateTime; |
||||
|
private int updateUser; |
||||
|
private String werks; |
||||
|
private String zboxid; |
||||
|
private String zitemo; |
||||
|
private String zlysj; |
||||
|
private String zpc; |
||||
|
private String zreqlineid; |
||||
|
private String zsapdoc; |
||||
|
private String zywlx; |
||||
|
|
||||
|
public int getPickId() { |
||||
|
return pickId; |
||||
|
} |
||||
|
|
||||
|
public void setPickId(int pickId) { |
||||
|
this.pickId = pickId; |
||||
|
} |
||||
|
|
||||
|
public String getSelect() { |
||||
|
return select; |
||||
|
} |
||||
|
|
||||
|
public void setSelect(String select) { |
||||
|
this.select = select; |
||||
|
} |
||||
|
|
||||
|
public void setAufnr(String aufnr) { |
||||
|
this.aufnr = aufnr; |
||||
|
} |
||||
|
|
||||
|
public String getAufnr() { |
||||
|
return aufnr; |
||||
|
} |
||||
|
|
||||
|
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 setErfme(String erfme) { |
||||
|
this.erfme = erfme; |
||||
|
} |
||||
|
|
||||
|
public String getErfme() { |
||||
|
return erfme; |
||||
|
} |
||||
|
|
||||
|
public void setErfmg(double erfmg) { |
||||
|
this.erfmg = erfmg; |
||||
|
} |
||||
|
|
||||
|
public double getErfmg() { |
||||
|
return erfmg; |
||||
|
} |
||||
|
|
||||
|
public void setId(int id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public int getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setLgort(String lgort) { |
||||
|
this.lgort = lgort; |
||||
|
} |
||||
|
|
||||
|
public String getLgort() { |
||||
|
return lgort; |
||||
|
} |
||||
|
|
||||
|
public void setMatnr(String matnr) { |
||||
|
this.matnr = matnr; |
||||
|
} |
||||
|
|
||||
|
public String getMatnr() { |
||||
|
return matnr; |
||||
|
} |
||||
|
|
||||
|
public void setSapStatus(String sapStatus) { |
||||
|
this.sapStatus = sapStatus; |
||||
|
} |
||||
|
|
||||
|
public String getSapStatus() { |
||||
|
return sapStatus; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateTime(String updateTime) { |
||||
|
this.updateTime = updateTime; |
||||
|
} |
||||
|
|
||||
|
public String getUpdateTime() { |
||||
|
return updateTime; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateUser(int updateUser) { |
||||
|
this.updateUser = updateUser; |
||||
|
} |
||||
|
|
||||
|
public int getUpdateUser() { |
||||
|
return updateUser; |
||||
|
} |
||||
|
|
||||
|
public void setWerks(String werks) { |
||||
|
this.werks = werks; |
||||
|
} |
||||
|
|
||||
|
public String getWerks() { |
||||
|
return werks; |
||||
|
} |
||||
|
|
||||
|
public void setZboxid(String zboxid) { |
||||
|
this.zboxid = zboxid; |
||||
|
} |
||||
|
|
||||
|
public String getZboxid() { |
||||
|
return zboxid; |
||||
|
} |
||||
|
|
||||
|
public void setZitemo(String zitemo) { |
||||
|
this.zitemo = zitemo; |
||||
|
} |
||||
|
|
||||
|
public String getZitemo() { |
||||
|
return zitemo; |
||||
|
} |
||||
|
|
||||
|
public void setZlysj(String zlysj) { |
||||
|
this.zlysj = zlysj; |
||||
|
} |
||||
|
|
||||
|
public String getZlysj() { |
||||
|
return zlysj; |
||||
|
} |
||||
|
|
||||
|
public void setZpc(String zpc) { |
||||
|
this.zpc = zpc; |
||||
|
} |
||||
|
|
||||
|
public String getZpc() { |
||||
|
return zpc; |
||||
|
} |
||||
|
|
||||
|
public void setZreqlineid(String zreqlineid) { |
||||
|
this.zreqlineid = zreqlineid; |
||||
|
} |
||||
|
|
||||
|
public String getZreqlineid() { |
||||
|
return zreqlineid; |
||||
|
} |
||||
|
|
||||
|
public void setZsapdoc(String zsapdoc) { |
||||
|
this.zsapdoc = zsapdoc; |
||||
|
} |
||||
|
|
||||
|
public String getZsapdoc() { |
||||
|
return zsapdoc; |
||||
|
} |
||||
|
|
||||
|
public void setZywlx(String zywlx) { |
||||
|
this.zywlx = zywlx; |
||||
|
} |
||||
|
|
||||
|
public String getZywlx() { |
||||
|
return zywlx; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,70 @@ |
|||||
|
package com.techscan.wk.ui.interfaces; |
||||
|
|
||||
|
import android.text.Editable; |
||||
|
import android.text.TextUtils; |
||||
|
import android.text.TextWatcher; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
|
import com.techscan.wk.model.DynamicFormBean; |
||||
|
|
||||
|
import java.lang.ref.WeakReference; |
||||
|
|
||||
|
/** |
||||
|
* Description |
||||
|
* Author: MULEI |
||||
|
* Date:2024/5/13 11:56 |
||||
|
*/ |
||||
|
public class CustomDecimalDigitsTextWatcher implements TextWatcher { |
||||
|
private WeakReference<EditText> editWeakReference; |
||||
|
private double maxNum; |
||||
|
|
||||
|
public CustomDecimalDigitsTextWatcher() { |
||||
|
} |
||||
|
|
||||
|
public CustomDecimalDigitsTextWatcher(EditText currentEditText, double maxNum) { |
||||
|
this.editWeakReference = new WeakReference<>(currentEditText); |
||||
|
this.maxNum = maxNum; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void beforeTextChanged(CharSequence charSequence, int start, int before, int count) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onTextChanged(CharSequence charSequence, int start, int before, int count) { |
||||
|
if (editWeakReference.get() == null) return; |
||||
|
EditText editText = editWeakReference.get(); |
||||
|
// 文本正在变化时执行
|
||||
|
// 检查用户输入的第一个字符是否为小数点
|
||||
|
if (charSequence.length() > 0 && charSequence.charAt(0) == '.') { |
||||
|
// 如果是小数点,移除开头的小数点
|
||||
|
editText.setText(charSequence.subSequence(1, charSequence.length())); |
||||
|
// 将光标移至末尾
|
||||
|
editText.setSelection(editText.getText().length()); |
||||
|
} else if (charSequence.length() > 1 && charSequence.charAt(0) == '0' && charSequence.charAt(1) != '.') { |
||||
|
//首位是0,后面必须是小数点,否则清除输入
|
||||
|
editText.setText(charSequence.subSequence(1, charSequence.length())); |
||||
|
// 将光标移至末尾
|
||||
|
editText.setSelection(editText.getText().length()); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void afterTextChanged(Editable editable) { |
||||
|
if (editWeakReference.get() == null) return; |
||||
|
EditText editText = editWeakReference.get(); |
||||
|
// 文本变化后执行
|
||||
|
String s = editable.toString(); |
||||
|
if (!TextUtils.isEmpty(s)) { |
||||
|
double v = Double.parseDouble(s); |
||||
|
if (v > maxNum) { |
||||
|
editText.setText(String.valueOf(maxNum)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
package com.techscan.wk.ui.interfaces; |
||||
|
|
||||
|
import com.lxj.xpopup.core.BottomPopupView; |
||||
|
import com.techscan.wk.model.ProReturnBean; |
||||
|
import com.techscan.wk.widgets.ProReturnBottomSheet; |
||||
|
|
||||
|
public interface ProReturnSaveListener { |
||||
|
void onSaveListener(ProReturnBean bean, ProReturnBottomSheet proReturnBottomSheet); |
||||
|
} |
||||
@ -0,0 +1,566 @@ |
|||||
|
package com.techscan.wk.ui.proreq; |
||||
|
|
||||
|
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.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.LayoutInflater; |
||||
|
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.style.FontStyle; |
||||
|
import com.bin.david.form.data.table.TableData; |
||||
|
import com.blankj.utilcode.util.KeyboardUtils; |
||||
|
import com.blankj.utilcode.util.StringUtils; |
||||
|
import com.blankj.utilcode.util.ToastUtils; |
||||
|
import com.codbking.widget.DatePickDialog; |
||||
|
import com.codbking.widget.bean.DateType; |
||||
|
import com.google.gson.reflect.TypeToken; |
||||
|
import com.king.zxing.Intents; |
||||
|
import com.lxj.xpopup.XPopup; |
||||
|
import com.lxj.xpopup.core.BottomPopupView; |
||||
|
import com.qmuiteam.qmui.widget.QMUITopBar; |
||||
|
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; |
||||
|
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; |
||||
|
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.ProReturnBean; |
||||
|
import com.techscan.wk.model.ReportWorkOffsetBean; |
||||
|
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.interfaces.ProReturnSaveListener; |
||||
|
import com.techscan.wk.ui.scan.CustomCaptureActivity; |
||||
|
import com.techscan.wk.utils.AntiShakeUtils; |
||||
|
import com.techscan.wk.utils.DateUtils; |
||||
|
import com.techscan.wk.utils.FindUtils; |
||||
|
import com.techscan.wk.utils.SoundUtils; |
||||
|
import com.techscan.wk.utils.ToastUtil; |
||||
|
import com.techscan.wk.utils.statusbar.StatusBarUtil; |
||||
|
import com.techscan.wk.widgets.DetailBottomSheet; |
||||
|
import com.techscan.wk.widgets.MySmartTable; |
||||
|
import com.techscan.wk.widgets.ProReturnBottomSheet; |
||||
|
|
||||
|
import java.lang.reflect.Type; |
||||
|
import java.text.ParseException; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Locale; |
||||
|
|
||||
|
import butterknife.BindView; |
||||
|
import butterknife.ButterKnife; |
||||
|
import butterknife.OnClick; |
||||
|
import io.reactivex.disposables.Disposable; |
||||
|
import okhttp3.ResponseBody; |
||||
|
import q.rorbin.badgeview.QBadgeView; |
||||
|
|
||||
|
/** |
||||
|
* 生产退料 |
||||
|
*/ |
||||
|
public class ProReturnActivity extends CommonFunctionActivity { |
||||
|
|
||||
|
@BindView(R.id.topbar) |
||||
|
QMUITopBar topbar; |
||||
|
@BindView(R.id.rv_ui) |
||||
|
RecyclerView rvUi; |
||||
|
|
||||
|
@BindView(R.id.smartTable) |
||||
|
MySmartTable<ProReturnBean> smartTable; |
||||
|
private Column<String> select; |
||||
|
private Column<String> AUFNR; |
||||
|
private Column<String> matnr; |
||||
|
private Column<String> erfmg; |
||||
|
private Column<String> zpc; |
||||
|
private Column<String> zlysj; |
||||
|
|
||||
|
|
||||
|
private DynamicFormAdapter dynamicFormAdapter; |
||||
|
private List<DynamicFormBean> dynamicFormBeans; |
||||
|
private DynamicFormBean selectDynamicFormBean; |
||||
|
private TableData<ProReturnBean> mTableData; |
||||
|
private List<ProReturnBean> list = new ArrayList<>(); |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_pro_return); |
||||
|
ButterKnife.bind(this); |
||||
|
setBody(true); |
||||
|
Disposable register = RxBus.getInstance().register(Event.class, eventMsg -> { |
||||
|
}); |
||||
|
|
||||
|
RxBus.getInstance().addSubscription(this, register); |
||||
|
|
||||
|
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.choice), "select"); |
||||
|
|
||||
|
AUFNR = new Column<>(getString(R.string.Work_order_number), "aufnr"); |
||||
|
matnr = new Column<>(getString(R.string.Material_number), "matnr"); |
||||
|
erfmg = new Column<>(getString(R.string.num_title), "erfmg"); |
||||
|
zpc = new Column<>(getString(R.string.batch), "zpc"); |
||||
|
zlysj = new Column<>(getString(R.string.Claim_time), "zlysj"); |
||||
|
|
||||
|
|
||||
|
select.setFixed(true); |
||||
|
select.setFast(true); |
||||
|
select.setMinWidth(110); |
||||
|
AUFNR.setFast(true); |
||||
|
matnr.setFast(true); |
||||
|
erfmg.setFast(true); |
||||
|
zpc.setFast(true); |
||||
|
zlysj.setFast(true); |
||||
|
|
||||
|
//设置单个格子背景颜色
|
||||
|
smartTable.getConfig().setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() { |
||||
|
@Override |
||||
|
public int getBackGroundColor(CellInfo cellInfo) { |
||||
|
if ("select".equals(cellInfo.column.getFieldName())) { |
||||
|
return ContextCompat.getColor(ProReturnActivity.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(ProReturnActivity.this, R.color.app_color_theme_7); |
||||
|
} else { |
||||
|
return super.getTextColor(cellInfo); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
setTableData(); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void saveData(ProReturnBean bean, int row) { |
||||
|
bean.setPickId(bean.getId()); |
||||
|
bean.setZlysj(""); |
||||
|
bean.setCreateTime(""); |
||||
|
bean.setCreateUser(0); |
||||
|
bean.setZsapdoc(""); |
||||
|
bean.setWerks(""); |
||||
|
HttpMethods.getInstance().saveBackPick(gson.toJson(bean), 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) { |
||||
|
new QMUIDialog.MessageDialogBuilder(context).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(); |
||||
|
query(); |
||||
|
} else { |
||||
|
showError(baseResponseBean.getMsg()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onFailure(Throwable e) throws Exception { |
||||
|
CustomErrorDialog(e, ProReturnActivity.this); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void setTableData() { |
||||
|
for (int i = 0; i < list.size(); i++) { |
||||
|
list.get(i).setSelect(getString(R.string.return_of_material)); |
||||
|
} |
||||
|
mTableData = new TableData<>("", list, select, AUFNR, matnr, erfmg, zpc, zlysj); |
||||
|
smartTable.setTableData(mTableData); |
||||
|
smartTable.invalidate(); |
||||
|
smartTable.getTableData().setOnRowClickListener((column, proReturnBean, i, row) -> { |
||||
|
if (column.getFieldName().equals("select")) { |
||||
|
if (AntiShakeUtils.isInvalidClick2(smartTable, 1500)) |
||||
|
return; |
||||
|
ProReturnBottomSheet detailBottomSheet = new ProReturnBottomSheet<>(context, getResources().getString(R.string.return_of_material), proReturnBean, (bean, proReturnBottomSheet) -> { |
||||
|
saveData(bean, row); |
||||
|
proReturnBottomSheet.dismiss(); |
||||
|
}); |
||||
|
new XPopup.Builder(context) |
||||
|
.moveUpToKeyboard(false) //如果不加这个,评论弹窗会移动到软键盘上面
|
||||
|
.isRequestFocus(false) |
||||
|
.autoFocusEditText(false) |
||||
|
.autoOpenSoftInput(true) |
||||
|
.asCustom(detailBottomSheet) |
||||
|
.show(); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 初始化顶部标题栏 |
||||
|
*/ |
||||
|
private void initTopBar() { |
||||
|
topbar.setTitle(getString(R.string.Production_return)); |
||||
|
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, "ProReturnUI.json"); |
||||
|
// 将读取到的json数据转化为动态表单对象
|
||||
|
Type objectType = new TypeToken<List<DynamicFormBean>>() { |
||||
|
}.getType(); |
||||
|
//动态表单数据
|
||||
|
dynamicFormBeans = gson.fromJson(jsonStr, objectType); |
||||
|
for (int i = 0; i < dynamicFormBeans.size(); i++) { |
||||
|
DynamicFormBean dynamicFormBean = dynamicFormBeans.get(i); |
||||
|
if (dynamicFormBean.getFieldName().equals("TIME")) { |
||||
|
dynamicFormBean.setStartValue(DateUtils.getNowDate()); |
||||
|
dynamicFormBean.setEndValue(DateUtils.getNowDate()); |
||||
|
} |
||||
|
} |
||||
|
// 动态表单绑定数据并绑定适配器到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)); |
||||
|
} |
||||
|
if (dynamicFormBean.getFieldName().equals("TIME")) { |
||||
|
chooseDate(dynamicFormBean.getFieldName(), custom[0], dynamicFormBean); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
dynamicFormAdapter.setOnFormItemViewActionListener((dynamicFormBean, position) -> { |
||||
|
String value = dynamicFormBean.getValue(); |
||||
|
switch (dynamicFormBean.getFieldName()) { |
||||
|
case "AUFNR": |
||||
|
if (KeyboardUtils.isSoftInputVisible(context)) { |
||||
|
KeyboardUtils.hideSoftInput(context); |
||||
|
} |
||||
|
query(); |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void query() { |
||||
|
DynamicFormBean TimeItem = dynamicFormAdapter.getItemByFieldName("TIME");//日期
|
||||
|
String startValue = TimeItem.getStartValue(); |
||||
|
String endValue = TimeItem.getEndValue(); |
||||
|
DynamicFormBean aufnrItem = dynamicFormAdapter.getItemByFieldName("AUFNR");//工单
|
||||
|
HttpMethods.getInstance().getPickList(aufnrItem.getValue(), startValue, endValue, new BaseObserver<ResponseBody>(context) { |
||||
|
@Override |
||||
|
protected void onSuccess(ResponseBody body) throws Exception { |
||||
|
String string = body.string(); |
||||
|
Type objectType = new TypeToken<BaseResponseBean<List<ProReturnBean>>>() { |
||||
|
}.getType(); |
||||
|
BaseResponseBean<List<ProReturnBean>> baseResponseBean = gson.fromJson(string, objectType); |
||||
|
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)); |
||||
|
} |
||||
|
setTableData(); |
||||
|
} else { |
||||
|
list.clear(); |
||||
|
setTableData(); |
||||
|
showError(baseResponseBean.getMsg()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onFailure(Throwable e) throws Exception { |
||||
|
list.clear(); |
||||
|
setTableData(); |
||||
|
CustomErrorDialog(e, ProReturnActivity.this); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@OnClick({R.id.iv_scan}) |
||||
|
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; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@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 "invcode": |
||||
|
|
||||
|
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); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private DatePickDialog dialog; |
||||
|
|
||||
|
private void chooseDate(String fieldName, String type, DynamicFormBean dynamicFormBean) { |
||||
|
|
||||
|
if (dialog != null && dialog.isShowing()) { |
||||
|
dialog.dismiss(); |
||||
|
} |
||||
|
//时间选择器
|
||||
|
dialog = new DatePickDialog(this); |
||||
|
//设置上下年分限制
|
||||
|
dialog.setYearLimt(80); |
||||
|
|
||||
|
//设置标题
|
||||
|
dialog.setTitle(StringUtils.equals(type, "left") ? getString(R.string.Select_start_date) : getString(R.string.Select_due_date)); |
||||
|
//设置类型
|
||||
|
dialog.setType(DateType.TYPE_YMD); |
||||
|
//设置消息体的显示格式,日期格式
|
||||
|
dialog.setMessageFormat("yyyy-MM-dd"); |
||||
|
//设置开始日期
|
||||
|
dialog.setStartDate(DateUtils.stringToDate(StringUtils.equals(type, "left") ? DateUtils.getNowDate() : DateUtils.getNowDate(), DateUtils.FORMAT_YEAR_MONTH_DAY)); |
||||
|
//设置点击确定按钮回调
|
||||
|
dialog.setOnSureLisener(date1 -> { |
||||
|
Date date = DateUtils.stringToDate(DateUtils.dateToString(date1, DateUtils.FORMAT_YEAR_MONTH_DAY), DateUtils.FORMAT_YEAR_MONTH_DAY); |
||||
|
switch (type) { |
||||
|
case "left"://选择订单开始日期
|
||||
|
String endDateStr = dynamicFormBean.getEndValue(); |
||||
|
if (!TextUtils.isEmpty(endDateStr)) { |
||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); |
||||
|
Date endDate; |
||||
|
try { |
||||
|
endDate = format.parse(endDateStr); |
||||
|
int result = date.compareTo(endDate); |
||||
|
if (result > 0) { |
||||
|
ToastUtil.showShortToast(context, getString(R.string.The_start_date_cannot_be_longer_than_the_end_date)); |
||||
|
SoundUtils.playSound(context, R.raw.warning); |
||||
|
return; |
||||
|
} |
||||
|
} catch (ParseException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
dynamicFormBean.setStartValue(DateUtils.dateToString(date, DateUtils.FORMAT_YEAR_MONTH_DAY)); |
||||
|
break; |
||||
|
case "right"://选择订单结束日期
|
||||
|
String startDateStr = dynamicFormBean.getStartValue(); |
||||
|
if (!TextUtils.isEmpty(startDateStr)) { |
||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); |
||||
|
Date startDate; |
||||
|
try { |
||||
|
startDate = format.parse(startDateStr); |
||||
|
int result = startDate.compareTo(date); |
||||
|
if (result > 0) { |
||||
|
ToastUtil.showShortToast(context, getString(R.string.The_deadline_cannot_be_less_than_the_start_date)); |
||||
|
SoundUtils.playSound(context, R.raw.warning); |
||||
|
return; |
||||
|
} |
||||
|
} catch (ParseException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
dynamicFormBean.setEndValue(DateUtils.dateToString(date, DateUtils.FORMAT_YEAR_MONTH_DAY)); |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
dynamicFormAdapter.setItemByFieldName(fieldName, dynamicFormBean); |
||||
|
}); |
||||
|
dialog.show(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@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 @@ |
|||||
|
package com.techscan.wk.ui.reportwork; |
||||
|
|
||||
|
import android.net.Uri; |
||||
|
import android.os.Bundle; |
||||
|
import android.text.TextUtils; |
||||
|
import android.view.View; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.Switch; |
||||
|
|
||||
|
import androidx.core.content.ContextCompat; |
||||
|
|
||||
|
import com.qmuiteam.qmui.widget.QMUITopBar; |
||||
|
import com.techscan.wk.R; |
||||
|
import com.techscan.wk.app.AppConst; |
||||
|
import com.techscan.wk.base.BaseActivity; |
||||
|
import com.techscan.wk.rxretrofit.HttpMethods; |
||||
|
import com.techscan.wk.utils.AntiShakeUtils; |
||||
|
import com.techscan.wk.utils.PreferencesUtil; |
||||
|
import com.techscan.wk.utils.ToastUtil; |
||||
|
import com.techscan.wk.utils.statusbar.StatusBarUtil; |
||||
|
|
||||
|
import butterknife.BindView; |
||||
|
import butterknife.ButterKnife; |
||||
|
import butterknife.OnClick; |
||||
|
|
||||
|
/** |
||||
|
* 设置 |
||||
|
*/ |
||||
|
public class ConfigSettingActivity extends BaseActivity { |
||||
|
|
||||
|
@BindView(R.id.topbar) |
||||
|
QMUITopBar topbar; |
||||
|
@BindView(R.id.swAutoInsertDetail) |
||||
|
Switch swAutoInsertDetail; |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||
|
super.onCreate(savedInstanceState); |
||||
|
setContentView(R.layout.activity_config_setting); |
||||
|
ButterKnife.bind(this); |
||||
|
|
||||
|
boolean aBoolean = PreferencesUtil.getBoolean(context, AppConst.SCAN_ADD_DETAIL, true); |
||||
|
swAutoInsertDetail.setChecked(aBoolean); |
||||
|
|
||||
|
initTopBar(); |
||||
|
|
||||
|
initSwitch(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 初始化标题栏 |
||||
|
*/ |
||||
|
private void initTopBar() { |
||||
|
topbar.setTitle(getString(R.string.configuration)); |
||||
|
topbar.addLeftBackImageButton().setOnClickListener(v -> finish()); |
||||
|
} |
||||
|
|
||||
|
private void initSwitch() { |
||||
|
swAutoInsertDetail.setOnCheckedChangeListener((buttonView, isChecked) -> { |
||||
|
PreferencesUtil.putBoolean(this, AppConst.SCAN_ADD_DETAIL, isChecked); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,220 @@ |
|||||
|
package com.techscan.wk.widgets; |
||||
|
|
||||
|
import android.app.Activity; |
||||
|
import android.content.ContentValues; |
||||
|
import android.content.Context; |
||||
|
import android.os.Handler; |
||||
|
import android.text.InputFilter; |
||||
|
import android.text.Spanned; |
||||
|
import android.text.TextUtils; |
||||
|
import android.view.KeyEvent; |
||||
|
import android.view.View; |
||||
|
import android.view.WindowManager; |
||||
|
import android.widget.Button; |
||||
|
import android.widget.EditText; |
||||
|
import android.widget.ImageView; |
||||
|
import android.widget.TextView; |
||||
|
|
||||
|
import androidx.annotation.NonNull; |
||||
|
import androidx.annotation.Nullable; |
||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||
|
|
||||
|
import com.blankj.utilcode.util.StringUtils; |
||||
|
import com.blankj.utilcode.util.ToastUtils; |
||||
|
import com.lxj.easyadapter.EasyAdapter; |
||||
|
import com.lxj.easyadapter.MultiItemTypeAdapter; |
||||
|
import com.lxj.easyadapter.ViewHolder; |
||||
|
import com.lxj.xpopup.XPopup; |
||||
|
import com.lxj.xpopup.core.BottomPopupView; |
||||
|
import com.lxj.xpopup.util.XPopupUtils; |
||||
|
import com.lxj.xpopup.widget.VerticalRecyclerView; |
||||
|
import com.orhanobut.logger.Logger; |
||||
|
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.model.BaseOptionsResponseBean; |
||||
|
import com.techscan.wk.model.DetailItemBean; |
||||
|
import com.techscan.wk.model.FlowOrderDetailBean; |
||||
|
import com.techscan.wk.model.FlowReportWorkDetailBean; |
||||
|
import com.techscan.wk.model.ProReqDetailBean; |
||||
|
import com.techscan.wk.model.ProReqOrdeTaskBean; |
||||
|
import com.techscan.wk.model.ProReturnBean; |
||||
|
import com.techscan.wk.model.ProductOrderResponseBean; |
||||
|
import com.techscan.wk.model.ReportWorkDetailBean; |
||||
|
import com.techscan.wk.rxbus.Event; |
||||
|
import com.techscan.wk.rxbus.RxBus; |
||||
|
import com.techscan.wk.ui.interfaces.CustomDecimalDigitsTextWatcher; |
||||
|
import com.techscan.wk.ui.interfaces.ProReturnSaveListener; |
||||
|
import com.techscan.wk.utils.ToastUtil; |
||||
|
import com.techscan.wk.utils.statusbar.SystemBarTintManager; |
||||
|
|
||||
|
import org.jetbrains.annotations.NotNull; |
||||
|
import org.litepal.LitePal; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Iterator; |
||||
|
import java.util.List; |
||||
|
import java.util.regex.Matcher; |
||||
|
import java.util.regex.Pattern; |
||||
|
|
||||
|
/** |
||||
|
* 版本:1.0 |
||||
|
* 创建日期:2021/1/11 14 |
||||
|
* 描述:CustomBottomSheet 自定义底部弹出框 |
||||
|
*/ |
||||
|
public class ProReturnBottomSheet<T> extends BottomPopupView { |
||||
|
|
||||
|
private Activity context; |
||||
|
private T infoBeans; |
||||
|
private String title; |
||||
|
private Boolean isShow = false; |
||||
|
private ProReturnSaveListener proReturnSaveListener; |
||||
|
|
||||
|
public ProReturnBottomSheet(@NonNull Activity context) { |
||||
|
super(context); |
||||
|
this.context = context; |
||||
|
} |
||||
|
|
||||
|
public ProReturnBottomSheet(@NonNull Activity context, String title) { |
||||
|
super(context); |
||||
|
this.context = context; |
||||
|
this.title = title; |
||||
|
} |
||||
|
|
||||
|
public ProReturnBottomSheet(@NonNull Activity context, String title, T t, ProReturnSaveListener proReturnSaveListener) { |
||||
|
super(context); |
||||
|
this.context = context; |
||||
|
this.title = title; |
||||
|
this.infoBeans = t; |
||||
|
this.proReturnSaveListener = proReturnSaveListener; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected int getImplLayoutId() { |
||||
|
return R.layout.layout_pro_return_dialog; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void onCreate() { |
||||
|
super.onCreate(); |
||||
|
TextView tvTitle = findViewById(R.id.tvTitle); |
||||
|
tvTitle.setText(title); |
||||
|
ImageView ivClose = findViewById(R.id.ivClose); |
||||
|
ivClose.setOnClickListener(view -> { |
||||
|
dismiss(); |
||||
|
}); |
||||
|
EditText etQty = findViewById(R.id.etQty); |
||||
|
// 设置小数点后几位小数
|
||||
|
DecimalDigitsInputFilter decimalDigitsInputFilter = new DecimalDigitsInputFilter(3); |
||||
|
InputFilter[] filters = new InputFilter[]{decimalDigitsInputFilter}; |
||||
|
etQty.setFilters(filters); |
||||
|
|
||||
|
TextView tvMaterial = findViewById(R.id.tvMaterial); |
||||
|
TextView tvBatch = findViewById(R.id.tvBatch); |
||||
|
TextView tvErfmg = findViewById(R.id.tvErfmg); |
||||
|
Button btnSubmit = findViewById(R.id.btn_submit); |
||||
|
if (infoBeans instanceof ProReturnBean) { |
||||
|
ProReturnBean infoBeans = (ProReturnBean) this.infoBeans; |
||||
|
CustomDecimalDigitsTextWatcher customDecimalDigitsTextWatcher = new CustomDecimalDigitsTextWatcher(etQty, ((ProReturnBean) this.infoBeans).getErfmg()); |
||||
|
etQty.addTextChangedListener(customDecimalDigitsTextWatcher); |
||||
|
etQty.setText(infoBeans.getErfmg() + ""); |
||||
|
tvMaterial.setText(infoBeans.getMatnr()); |
||||
|
tvBatch.setText(infoBeans.getZpc()); |
||||
|
tvErfmg.setText(infoBeans.getErfmg() + ""); |
||||
|
btnSubmit.setOnClickListener(view -> { |
||||
|
String qty = etQty.getText().toString().trim(); |
||||
|
if (TextUtils.isEmpty(qty)) { |
||||
|
ToastUtils.showLong(R.string.dialog_The_quantity_cannot_be_empty); |
||||
|
return; |
||||
|
} |
||||
|
if (qty.equals("0")) { |
||||
|
ToastUtils.showLong(R.string.dialog_The_value_cannot_be_0_or_less_than_0); |
||||
|
return; |
||||
|
} |
||||
|
if (Double.parseDouble(qty) < 0) { |
||||
|
ToastUtils.showLong(R.string.dialog_The_value_cannot_be_0_or_less_than_0); |
||||
|
return; |
||||
|
} |
||||
|
infoBeans.setErfmg(Double.parseDouble(qty)); |
||||
|
if (proReturnSaveListener != null) { |
||||
|
proReturnSaveListener.onSaveListener(infoBeans, this); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private class DecimalDigitsInputFilter implements InputFilter { |
||||
|
private final Pattern pattern; |
||||
|
|
||||
|
DecimalDigitsInputFilter(int decimalDigits) { |
||||
|
pattern = Pattern.compile("[0-9]+(\\.[0-9]{0," + decimalDigits + "})?"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CharSequence filter(CharSequence source, int start, int end, |
||||
|
Spanned dest, int dstart, int dend) { |
||||
|
String input = dest.subSequence(0, dstart).toString() |
||||
|
+ source.subSequence(start, end).toString() |
||||
|
+ dest.subSequence(dend, dest.length()).toString(); |
||||
|
Matcher matcher = pattern.matcher(input); |
||||
|
if (!matcher.matches()) { |
||||
|
return ""; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//完全可见执行
|
||||
|
@Override |
||||
|
protected void onShow() { |
||||
|
isShow = true; |
||||
|
super.onShow(); |
||||
|
} |
||||
|
|
||||
|
//完全消失执行
|
||||
|
@Override |
||||
|
protected void onDismiss() { |
||||
|
isShow = false; |
||||
|
super.onDismiss(); |
||||
|
} |
||||
|
|
||||
|
public Boolean getShow() { |
||||
|
return isShow; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected int getMaxHeight() { |
||||
|
return (int) (XPopupUtils.getWindowHeight(getContext()) * .85f); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) { |
||||
|
super.dismiss(); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void applySize(boolean isShowNavBar) { |
||||
|
LayoutParams params = (LayoutParams) this.getLayoutParams(); |
||||
|
int rotation = ((WindowManager) this.getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation(); |
||||
|
SystemBarTintManager systemBarTintManager = new SystemBarTintManager((Activity) this.getContext()); |
||||
|
boolean isNavBarShown = isShowNavBar || systemBarTintManager.getConfig().hasNavigtionBar() ? true : false; |
||||
|
if (rotation == 0) { |
||||
|
params.leftMargin = 0; |
||||
|
params.rightMargin = 0; |
||||
|
params.bottomMargin = isNavBarShown ? systemBarTintManager.getConfig().getNavigationBarHeight() : 0; |
||||
|
} else if (rotation == 1) { |
||||
|
params.bottomMargin = 0; |
||||
|
params.rightMargin = isNavBarShown ? systemBarTintManager.getConfig().getNavigationBarHeight() : 0; |
||||
|
params.leftMargin = 0; |
||||
|
} else if (rotation == 3) { |
||||
|
params.bottomMargin = 0; |
||||
|
params.leftMargin = 0; |
||||
|
params.rightMargin = isNavBarShown ? systemBarTintManager.getConfig().getNavigationBarHeight() : 0; |
||||
|
} |
||||
|
this.setLayoutParams(params); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
<?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="match_parent" |
||||
|
android:orientation="vertical" |
||||
|
tools:context=".ui.login.SettingActivity"> |
||||
|
|
||||
|
<com.qmuiteam.qmui.widget.QMUITopBar |
||||
|
android:id="@+id/topbar" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="?attr/qmui_topbar_height" /> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="6dp" |
||||
|
android:background="@color/qmui_config_color_white" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:minHeight="48dp" |
||||
|
android:orientation="horizontal" |
||||
|
android:paddingLeft="8dp" |
||||
|
android:paddingRight="8dp"> |
||||
|
|
||||
|
<TextView |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:layout_gravity="center_vertical" |
||||
|
android:layout_weight="0.8" |
||||
|
android:text="@string/Scanning_code_automatically_adds_details" |
||||
|
android:textSize="@dimen/sp_15" /> |
||||
|
|
||||
|
<Switch |
||||
|
android:id="@+id/swAutoInsertDetail" |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_gravity="center_vertical" |
||||
|
android:layout_weight="0.2" |
||||
|
android:gravity="right" /> |
||||
|
</LinearLayout> |
||||
|
|
||||
|
|
||||
|
</LinearLayout> |
||||
|
|
||||
|
</LinearLayout> |
||||
@ -0,0 +1,54 @@ |
|||||
|
<?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_toBottomOf="parent" |
||||
|
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> |
||||
|
|
||||
|
|
||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
||||
@ -0,0 +1,192 @@ |
|||||
|
<?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:background="@drawable/bg_round" |
||||
|
android:focusable="true" |
||||
|
android:focusableInTouchMode="true" |
||||
|
android:orientation="vertical"> |
||||
|
|
||||
|
<RelativeLayout |
||||
|
android:id="@+id/rlTitle" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="50dp"> |
||||
|
|
||||
|
<TextView |
||||
|
android:id="@+id/tvTitle" |
||||
|
android:layout_width="wrap_content" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_centerInParent="true" |
||||
|
android:text="标题" |
||||
|
android:textSize="18sp" /> |
||||
|
|
||||
|
<ImageView |
||||
|
android:id="@+id/ivClose" |
||||
|
android:layout_width="34dp" |
||||
|
android:layout_height="36dp" |
||||
|
android:layout_alignParentRight="true" |
||||
|
android:layout_centerVertical="true" |
||||
|
android:layout_marginEnd="5dp" |
||||
|
android:src="@drawable/ic_action_navigation_close" /> |
||||
|
|
||||
|
</RelativeLayout> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginLeft="20dp" |
||||
|
android:layout_marginRight="20dp" |
||||
|
android:orientation="vertical" |
||||
|
android:paddingTop="@dimen/dp_20" |
||||
|
android:paddingBottom="30dp"> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:gravity="center_vertical" |
||||
|
android:orientation="horizontal" |
||||
|
android:padding="4dp" |
||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||
|
app:layout_constraintStart_toStartOf="parent" |
||||
|
app:layout_constraintTop_toBottomOf="@id/llBatch"> |
||||
|
|
||||
|
<TextView |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.2" |
||||
|
android:text="@string/Quantity_of_returned_material" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
<EditText |
||||
|
android:id="@+id/etQty" |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.7" |
||||
|
android:inputType="numberDecimal" |
||||
|
android:text="" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
|
||||
|
</LinearLayout> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:id="@+id/llMaterial" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="5dp" |
||||
|
android:gravity="center_vertical" |
||||
|
android:orientation="horizontal" |
||||
|
android:padding="4dp" |
||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||
|
app:layout_constraintStart_toStartOf="parent" |
||||
|
app:layout_constraintTop_toTopOf="parent"> |
||||
|
|
||||
|
<TextView |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.2" |
||||
|
android:text="@string/Material_number" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
<EditText |
||||
|
android:id="@+id/tvMaterial" |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.7" |
||||
|
android:background="@null" |
||||
|
android:enabled="false" |
||||
|
android:text="XXXXXXXXXXX" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
|
||||
|
</LinearLayout> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:id="@+id/llBatch" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="@dimen/dp_10" |
||||
|
android:gravity="center_vertical" |
||||
|
android:orientation="horizontal" |
||||
|
android:padding="4dp" |
||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||
|
app:layout_constraintStart_toStartOf="parent" |
||||
|
app:layout_constraintTop_toBottomOf="@id/llMaterial"> |
||||
|
|
||||
|
<TextView |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.2" |
||||
|
android:text="@string/batch" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
<EditText |
||||
|
android:id="@+id/tvBatch" |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.7" |
||||
|
android:background="@null" |
||||
|
android:enabled="false" |
||||
|
android:text="XXXXXXXXXXX" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
|
||||
|
</LinearLayout> |
||||
|
|
||||
|
<LinearLayout |
||||
|
android:visibility="gone" |
||||
|
android:id="@+id/llNum" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_marginTop="@dimen/dp_10" |
||||
|
android:gravity="center_vertical" |
||||
|
android:orientation="horizontal" |
||||
|
android:padding="4dp" |
||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||
|
app:layout_constraintStart_toStartOf="parent" |
||||
|
app:layout_constraintTop_toBottomOf="@id/llMaterial"> |
||||
|
|
||||
|
<TextView |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.2" |
||||
|
android:text="领料数量" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
<EditText |
||||
|
android:id="@+id/tvErfmg" |
||||
|
android:layout_width="0dp" |
||||
|
android:layout_height="wrap_content" |
||||
|
android:layout_weight="0.7" |
||||
|
android:background="@null" |
||||
|
android:enabled="false" |
||||
|
android:text="XXXXXXXXXXX" |
||||
|
android:textColor="@color/textColor" |
||||
|
android:textSize="@dimen/sp_14" /> |
||||
|
|
||||
|
|
||||
|
</LinearLayout> |
||||
|
|
||||
|
</LinearLayout> |
||||
|
|
||||
|
<Button |
||||
|
android:id="@+id/btn_submit" |
||||
|
android:layout_width="match_parent" |
||||
|
android:layout_height="match_parent" |
||||
|
android:layout_marginLeft="20dp" |
||||
|
android:layout_marginRight="20dp" |
||||
|
android:layout_marginBottom="40dp" |
||||
|
android:background="@drawable/bg_scan_btn_selector" |
||||
|
android:text="@string/save_info" |
||||
|
android:textColor="@color/qmui_config_color_white" |
||||
|
tools:ignore="ButtonStyle" /> |
||||
|
</LinearLayout> |
||||
Loading…
Reference in new issue