Browse Source

料仓删除滚动问题

调味吧台
liup 5 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>
<SelectionState runConfigName="app">
<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">
<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>
</Target>
</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
*/


+ 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();
layout.setAutoMeasureEnabled(true);
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);


@@ -77,35 +77,35 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> {
name.setOnClickListener(new View.OnClickListener() {
@Override
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() {
@Override
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() {
@Override
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() {
@Override
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() {
@Override
public void onClick(View view) {
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,position,bpa_goodproperty);
}
});
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() {
@Override
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() {
@Override
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() {
@Override
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;
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;
mListener = listener;
mLayoutInflater = LayoutInflater.from(context);
goodproperties=data;
this.currentPos = currentPos;
}

@NonNull
@@ -84,13 +86,13 @@ public class zsx_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
ToastUtils.info("属性名称不能为空");
return;
}
if(mListener!=null) mListener.clickListener(view,goodproperty);
if(mListener!=null) mListener.clickListenerNew(view,currentPos,goodproperty);
}
});
myViewHolder.delete_text.setOnClickListener(new View.OnClickListener() {
@Override
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})
@@ -120,7 +120,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
bpa_goodproperty.userID = ConfigName.getInstance().user.userID;
QueryDB.AddGoodsProperty(bpa_goodproperty);
ToastUtils.info("新增成功");
Initdata_sx();
Initdata_sx(bpa_goodproperties.size());
KeyboardUtil.hideKeyboard(builder_add.getEditText());
dialog.dismiss();
} else {
@@ -137,6 +137,11 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment {// implements MyClickLis
private MyClickListener listener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {

}

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

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

bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0");
sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,listener);
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) {

}


+ 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() {
root.setOnClickListener(KeyboardUtil::hideKeyboard);
Initdata_wl();
Initdata_wl(0);
}

@SuppressLint("HandlerLeak")
@@ -90,7 +90,7 @@ public class Jcsjgl_wl_fragment extends BaseFragment {// implements MyClickListe
@Override
public void handleMessage(Message msg) {
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;
QueryDB.AddMaterial(bpa_material);
ToastUtils.info("新增成功");
Initdata_wl();
Initdata_wl(bpa_materials.size());
KeyboardUtil.hideKeyboard(builder_add.getEditText());
dialog.dismiss();
} 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 {
bpa_materials = QueryDB.GetMaterialALL();
wl_adapter adapter = new wl_adapter(context, R.layout.wl_item, bpa_materials, listener);
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) {

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

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

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();
MessageLog.ShowInfo("下发参数,开始校准 当前时间:"+startTime +" 出料时间"+((int) time)*100);
MessageLog.ShowInfo("下发参数,开始校准 当前时间:"+startTime +" 出料时间"+(int)( time*100));
ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"启停控制",true,null);//下发启动信号

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


Loading…
Cancel
Save