Browse Source

料仓删除滚动问题

调味吧台
liup 7 months ago
parent
commit
16d16a0f27
8 changed files with 58 additions and 42 deletions
  1. +2
    -2
      .idea/deploymentTargetSelector.xml
  2. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +6
    -6
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/sx_adapter.java
  4. +3
    -3
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/wl_adapter.java
  5. +5
    -3
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/zsx_adapter.java
  6. +22
    -15
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java
  7. +17
    -10
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java
  8. +2
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java

+ 2
- 2
.idea/deploymentTargetSelector.xml View File

@@ -4,10 +4,10 @@
<selectionStates> <selectionStates>
<SelectionState runConfigName="app"> <SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-05-21T06:28:46.108596400Z">
<DropdownSelection timestamp="2024-05-21T07:39:43.054726300Z">
<Target type="DEFAULT_BOOT"> <Target type="DEFAULT_BOOT">
<handle> <handle>
<DeviceId pluginId="Default" identifier="serial=192.168.1.12:5555;connection=b043ef16" />
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=74bb378d" />
</handle> </handle>
</Target> </Target>
</DropdownSelection> </DropdownSelection>


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -94,7 +94,7 @@ public class ConfigName {
/** /**
* 店铺设备号 * 店铺设备号
*/ */
public String DeviceAutoKey = "159";
public String DeviceAutoKey = "249";
/** /**
* 设备id * 设备id
*/ */


+ 6
- 6
app/src/main/java/com/bonait/bnframework/modules/home/adapter/sx_adapter.java View File

@@ -64,7 +64,7 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> {
MyLayoutManager layout = new MyLayoutManager(); MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true); layout.setAutoMeasureEnabled(true);
recyclerView.setLayoutManager(layout); recyclerView.setLayoutManager(layout);
zsx_adapter zsxadapter = new zsx_adapter(contextA,zsx,mListener);
zsx_adapter zsxadapter = new zsx_adapter(position,contextA,zsx,mListener);
recyclerView.setAdapter(zsxadapter); recyclerView.setAdapter(zsxadapter);




@@ -77,35 +77,35 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> {
name.setOnClickListener(new View.OnClickListener() { name.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
} }
}); });


sort.setOnClickListener(new View.OnClickListener() { sort.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
} }
}); });


typeS.setOnClickListener(new View.OnClickListener() { typeS.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
} }
}); });


button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
} }
}); });


button_add.setOnClickListener(new View.OnClickListener() { button_add.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
} }
}); });
return view; return view;


+ 3
- 3
app/src/main/java/com/bonait/bnframework/modules/home/adapter/wl_adapter.java View File

@@ -52,21 +52,21 @@ public class wl_adapter extends ArrayAdapter<BPA_MATERIAL> {
name.setOnClickListener(new View.OnClickListener() { name.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_material);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_material);
} }
}); });


button_update.setOnClickListener(new View.OnClickListener() { button_update.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_material);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_material);
} }
}); });


button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_material);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_material);
} }
}); });




+ 5
- 3
app/src/main/java/com/bonait/bnframework/modules/home/adapter/zsx_adapter.java View File

@@ -41,12 +41,14 @@ public class zsx_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
* 点击事件 * 点击事件
*/ */
public MyClickListener mListener=null; public MyClickListener mListener=null;
private int currentPos=0;


public zsx_adapter(Context context,List<BPA_GOODPROPERTY> data, MyClickListener listener) {
public zsx_adapter(int currentPos,Context context,List<BPA_GOODPROPERTY> data, MyClickListener listener) {
this.context = context; this.context = context;
mListener = listener; mListener = listener;
mLayoutInflater = LayoutInflater.from(context); mLayoutInflater = LayoutInflater.from(context);
goodproperties=data; goodproperties=data;
this.currentPos = currentPos;
} }


@NonNull @NonNull
@@ -84,13 +86,13 @@ public class zsx_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
ToastUtils.info("属性名称不能为空"); ToastUtils.info("属性名称不能为空");
return; return;
} }
if(mListener!=null) mListener.clickListener(view,goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,currentPos,goodproperty);
} }
}); });
myViewHolder.delete_text.setOnClickListener(new View.OnClickListener() { myViewHolder.delete_text.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,currentPos,goodproperty);
} }
}); });
} }


+ 22
- 15
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_sxgl_fragment.java View File

@@ -84,7 +84,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
} }
} }


Initdata_sx();
Initdata_sx(0);
} }


@OnClick({R.id.add_sx}) @OnClick({R.id.add_sx})
@@ -120,7 +120,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; bpa_goodproperty.userID = ConfigName.getInstance().user.userID;
QueryDB.AddGoodsProperty(bpa_goodproperty); QueryDB.AddGoodsProperty(bpa_goodproperty);
ToastUtils.info("新增成功"); ToastUtils.info("新增成功");
Initdata_sx();
Initdata_sx(bpa_goodproperties.size());
KeyboardUtil.hideKeyboard(builder_add.getEditText()); KeyboardUtil.hideKeyboard(builder_add.getEditText());
dialog.dismiss(); dialog.dismiss();
} else { } else {
@@ -137,6 +137,11 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
private MyClickListener listener = new MyClickListener() { private MyClickListener listener = new MyClickListener() {
@Override @Override
public void clickListener(View v, Object data) { public void clickListener(View v, Object data) {

}

@Override
public void clickListenerNew(View v, int k, Object data) {
switch (v.getId()) { switch (v.getId()) {
case R.id.name://修改属性名称按钮 case R.id.name://修改属性名称按钮
final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context);
@@ -161,7 +166,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
return; return;
} }
QueryDB.UpdateGoodsPropertyName(((BPA_GOODPROPERTY) data).id, text.toString()); QueryDB.UpdateGoodsPropertyName(((BPA_GOODPROPERTY) data).id, text.toString());
Initdata_sx();
Initdata_sx(k);
KeyboardUtil.hideKeyboard(builder.getEditText()); KeyboardUtil.hideKeyboard(builder.getEditText());
dialog.dismiss(); dialog.dismiss();
} else { } else {
@@ -191,7 +196,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
CharSequence text = builder1.getEditText().getText(); CharSequence text = builder1.getEditText().getText();
if (text != null && text.length() > 0) { if (text != null && text.length() > 0) {
QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString())); QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString()));
Initdata_sx();
Initdata_sx(k);
KeyboardUtil.hideKeyboard(v); KeyboardUtil.hideKeyboard(v);
dialog.dismiss(); dialog.dismiss();
} else { } else {
@@ -257,7 +262,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
result=result.substring(0, result.length() - 1); result=result.substring(0, result.length() - 1);
} }
QueryDB.UpdateGoodsPropertyType(((BPA_GOODPROPERTY) data).id, result); QueryDB.UpdateGoodsPropertyType(((BPA_GOODPROPERTY) data).id, result);
Initdata_sx();
Initdata_sx(k);
KeyboardUtil.hideKeyboard(v); KeyboardUtil.hideKeyboard(v);
dialog.dismiss(); dialog.dismiss();
} }
@@ -282,7 +287,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
QueryDB.DeleteGoodsProperty(item); QueryDB.DeleteGoodsProperty(item);
} }
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data);
Initdata_sx();
Initdata_sx(k);
ToastUtils.info("删除成功"); ToastUtils.info("删除成功");
KeyboardUtil.hideKeyboard(v); KeyboardUtil.hideKeyboard(v);
dialog.dismiss(); dialog.dismiss();
@@ -301,14 +306,14 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; bpa_goodproperty.userID = ConfigName.getInstance().user.userID;
QueryDB.AddGoodsProperty(bpa_goodproperty); QueryDB.AddGoodsProperty(bpa_goodproperty);
ToastUtils.info("新增成功"); ToastUtils.info("新增成功");
Initdata_sx();
Initdata_sx(k);
KeyboardUtil.hideKeyboard(v); KeyboardUtil.hideKeyboard(v);
break; break;


case R.id.save_text://保存属性 case R.id.save_text://保存属性
QueryDB.UpdateGoodsProperty((BPA_GOODPROPERTY) data); QueryDB.UpdateGoodsProperty((BPA_GOODPROPERTY) data);
ToastUtils.info("保存成功"); ToastUtils.info("保存成功");
Initdata_sx();
Initdata_sx(k);
KeyboardUtil.hideKeyboard(v); KeyboardUtil.hideKeyboard(v);
break; break;
case R.id.delete_text://删除 case R.id.delete_text://删除
@@ -324,7 +329,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
} }
} }
QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data); QueryDB.DeleteGoodsProperty((BPA_GOODPROPERTY) data);
Initdata_sx();
Initdata_sx(k);
ToastUtils.info("删除成功"); ToastUtils.info("删除成功");
KeyboardUtil.hideKeyboard(v); KeyboardUtil.hideKeyboard(v);
dialog.dismiss(); dialog.dismiss();
@@ -333,11 +338,6 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
break; break;
} }
} }

@Override
public void clickListenerNew(View v, int k, Object data) {

}
}; };


// /** // /**
@@ -359,12 +359,19 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
/** /**
* 初始化数据加载 * 初始化数据加载
*/ */
public void Initdata_sx() {
public void Initdata_sx(int position) {
try { try {


bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0"); bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0");
sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,listener); sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,listener);
datatab_sx.setAdapter(adapter); datatab_sx.setAdapter(adapter);
if(position>0){
if(position>=bpa_goodproperties.size()-1){
datatab_sx.smoothScrollToPosition(bpa_goodproperties.size()-1);
}else {
datatab_sx.smoothScrollToPosition(position);
}
}
} catch (Exception e) { } catch (Exception e) {


} }


+ 17
- 10
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/Jcsjgl_wl_fragment.java View File

@@ -82,7 +82,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
*/ */
public void InitView() { public void InitView() {
root.setOnClickListener(KeyboardUtil::hideKeyboard); root.setOnClickListener(KeyboardUtil::hideKeyboard);
Initdata_wl();
Initdata_wl(0);
} }


@SuppressLint("HandlerLeak") @SuppressLint("HandlerLeak")
@@ -90,7 +90,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
if (msg.obj.toString()== "MSG_REFRESH") { if (msg.obj.toString()== "MSG_REFRESH") {
Initdata_wl();
Initdata_wl(0);
} }
} }
}; };
@@ -127,7 +127,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
bpa_material.userID = ConfigName.getInstance().user.userID; bpa_material.userID = ConfigName.getInstance().user.userID;
QueryDB.AddMaterial(bpa_material); QueryDB.AddMaterial(bpa_material);
ToastUtils.info("新增成功"); ToastUtils.info("新增成功");
Initdata_wl();
Initdata_wl(bpa_materials.size());
KeyboardUtil.hideKeyboard(builder_add.getEditText()); KeyboardUtil.hideKeyboard(builder_add.getEditText());
dialog.dismiss(); dialog.dismiss();
} else { } else {
@@ -180,11 +180,18 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
/** /**
* 初始化数据加载 * 初始化数据加载
*/ */
public void Initdata_wl() {
public void Initdata_wl(int position) {
try { try {
bpa_materials = QueryDB.GetMaterialALL(); bpa_materials = QueryDB.GetMaterialALL();
wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, listener); wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, listener);
datatab_wl.setAdapter(adapter); datatab_wl.setAdapter(adapter);
if(position>0){
if(position>=bpa_materials.size()-1){
datatab_wl.smoothScrollToPosition(bpa_materials.size()-1);
}else {
datatab_wl.smoothScrollToPosition(position);
}
}
} catch (Exception e) { } catch (Exception e) {


} }
@@ -220,6 +227,10 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
private MyClickListener listener = new MyClickListener() { private MyClickListener listener = new MyClickListener() {
@Override @Override
public void clickListener(View v, Object data) { public void clickListener(View v, Object data) {
}

@Override
public void clickListenerNew(View v, int k, Object data) {
switch (v.getId()) { switch (v.getId()) {
case R.id.name://修改物料名称按钮 case R.id.name://修改物料名称按钮
case R.id.button_update://修改物料名称按钮 case R.id.button_update://修改物料名称按钮
@@ -244,7 +255,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
return; return;
} }
QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString()); QueryDB.UpdateMaterialName(((BPA_MATERIAL) data).id, text.toString());
Initdata_wl();
Initdata_wl(k);
ToastUtils.info("修改成功"); ToastUtils.info("修改成功");
dialog.dismiss(); dialog.dismiss();
} else { } else {
@@ -262,17 +273,13 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
@Override @Override
public void onClick(QMUIDialog dialog, int index) { public void onClick(QMUIDialog dialog, int index) {
QueryDB.DeleteMaterial((BPA_MATERIAL) data); QueryDB.DeleteMaterial((BPA_MATERIAL) data);
Initdata_wl();
Initdata_wl(k-1);
ToastUtils.info("删除成功"); ToastUtils.info("删除成功");
dialog.dismiss(); dialog.dismiss();
} }
}); });
break; break;
} }
}

@Override
public void clickListenerNew(View v, int k, Object data) {


} }
}; };


+ 2
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java View File

@@ -333,9 +333,9 @@ public class silos_jiaoyan extends LinearLayout {
return ExecuteTheRecipe.ReadShort(PLCName.称当前重量)>-20&&ExecuteTheRecipe.ReadShort(PLCName.称当前重量)<=20;},3000).OnSource(()->{ return ExecuteTheRecipe.ReadShort(PLCName.称当前重量)>-20&&ExecuteTheRecipe.ReadShort(PLCName.称当前重量)<=20;},3000).OnSource(()->{


WaitDialog.getInstance().AddText("下发参数,开始校准"); WaitDialog.getInstance().AddText("下发参数,开始校准");
ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"出料时间",((int) time)*100,null);//下发出料时间
ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"出料时间",(int) (time*100),null);//下发出料时间
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
MessageLog.ShowInfo("下发参数,开始校准 当前时间:"+startTime +" 出料时间"+((int) time)*100);
MessageLog.ShowInfo("下发参数,开始校准 当前时间:"+startTime +" 出料时间"+(int)( time*100));
ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"启停控制",true,null);//下发启动信号 ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"启停控制",true,null);//下发启动信号


WaitDialog.getInstance().AddText("等待校准完成"); WaitDialog.getInstance().AddText("等待校准完成");


Loading…
Cancel
Save