|
@@ -14,18 +14,24 @@ import android.widget.AdapterView; |
|
|
import android.widget.ArrayAdapter; |
|
|
import android.widget.ArrayAdapter; |
|
|
import android.widget.Button; |
|
|
import android.widget.Button; |
|
|
import android.widget.LinearLayout; |
|
|
import android.widget.LinearLayout; |
|
|
|
|
|
import android.widget.ListView; |
|
|
import android.widget.Spinner; |
|
|
import android.widget.Spinner; |
|
|
|
|
|
|
|
|
import com.bonait.bnframework.R; |
|
|
import com.bonait.bnframework.R; |
|
|
import com.bonait.bnframework.common.base.BaseActivity; |
|
|
import com.bonait.bnframework.common.base.BaseActivity; |
|
|
|
|
|
import com.bonait.bnframework.common.constant.DataBus; |
|
|
import com.bonait.bnframework.common.constant.MessageName; |
|
|
import com.bonait.bnframework.common.constant.MessageName; |
|
|
import com.bonait.bnframework.common.db.QueryDB; |
|
|
import com.bonait.bnframework.common.db.QueryDB; |
|
|
|
|
|
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; |
|
|
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; |
|
|
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; |
|
|
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; |
|
|
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; |
|
|
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; |
|
|
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; |
|
|
|
|
|
import com.bonait.bnframework.common.helper.I.MyClickListener; |
|
|
import com.bonait.bnframework.common.helper.MyImage; |
|
|
import com.bonait.bnframework.common.helper.MyImage; |
|
|
import com.bonait.bnframework.common.message.MessageManager; |
|
|
import com.bonait.bnframework.common.message.MessageManager; |
|
|
import com.bonait.bnframework.common.utils.ToastUtils; |
|
|
import com.bonait.bnframework.common.utils.ToastUtils; |
|
|
|
|
|
import com.bonait.bnframework.modules.home.adapter.gongxubuzhou_adapter; |
|
|
|
|
|
import com.bonait.bnframework.modules.home.adapter.lcsz_adapter; |
|
|
import com.bonait.bnframework.modules.home.fragment.mode.fragment_gx; |
|
|
import com.bonait.bnframework.modules.home.fragment.mode.fragment_gx; |
|
|
import com.bonait.bnframework.modules.home.fragment.mode.item_gx; |
|
|
import com.bonait.bnframework.modules.home.fragment.mode.item_gx; |
|
|
import com.qmuiteam.qmui.widget.QMUITopBar; |
|
|
import com.qmuiteam.qmui.widget.QMUITopBar; |
|
@@ -45,7 +51,7 @@ import butterknife.BindView; |
|
|
import butterknife.ButterKnife; |
|
|
import butterknife.ButterKnife; |
|
|
import butterknife.OnClick; |
|
|
import butterknife.OnClick; |
|
|
|
|
|
|
|
|
public class DiyActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
public class DiyActivity extends BaseActivity implements MyClickListener { |
|
|
@BindView(R.id.topbar) |
|
|
@BindView(R.id.topbar) |
|
|
QMUITopBar mTopBar; |
|
|
QMUITopBar mTopBar; |
|
|
@BindView(R.id.Banner_Main) |
|
|
@BindView(R.id.Banner_Main) |
|
@@ -59,6 +65,14 @@ public class DiyActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
@BindView(R.id.gxchid) |
|
|
@BindView(R.id.gxchid) |
|
|
LinearLayout gxchid;//工序子集 |
|
|
LinearLayout gxchid;//工序子集 |
|
|
|
|
|
|
|
|
|
|
|
@BindView(R.id.datatab_gxbz) |
|
|
|
|
|
ListView datatab_gxbz;//工序步骤 |
|
|
|
|
|
public gongxubuzhou_adapter gxbz_adapter=null; |
|
|
|
|
|
/** |
|
|
|
|
|
* 工序步骤 |
|
|
|
|
|
*/ |
|
|
|
|
|
public ArrayList<BPA_GOODSRECIPE> bpa_goodsrecipes=new ArrayList<>(); |
|
|
@Override |
|
|
@Override |
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
super.onCreate(savedInstanceState); |
|
|
super.onCreate(savedInstanceState); |
|
@@ -67,7 +81,6 @@ public class DiyActivity extends BaseActivity { |
|
|
initTopBar(); |
|
|
initTopBar(); |
|
|
initData(); |
|
|
initData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void initData() |
|
|
private void initData() |
|
|
{ |
|
|
{ |
|
|
//1.初始化轮播图 |
|
|
//1.初始化轮播图 |
|
@@ -91,7 +104,9 @@ public class DiyActivity extends BaseActivity { |
|
|
public void onNothingSelected(AdapterView<?> adapterView) { |
|
|
public void onNothingSelected(AdapterView<?> adapterView) { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
//3. |
|
|
|
|
|
|
|
|
//3.工序步骤 |
|
|
|
|
|
gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item, (List<BPA_GOODSRECIPE>) bpa_goodsrecipes,this); |
|
|
|
|
|
datatab_gxbz.setAdapter(gxbz_adapter); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 根据选中工序id显示集合 |
|
|
* 根据选中工序id显示集合 |
|
@@ -127,13 +142,24 @@ public class DiyActivity extends BaseActivity { |
|
|
fragment_gx gongxu=new fragment_gx(this,null,gx); |
|
|
fragment_gx gongxu=new fragment_gx(this,null,gx); |
|
|
gxchid.addView(gongxu); |
|
|
gxchid.addView(gongxu); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}catch (Exception ex) |
|
|
}catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
* 获取选中行的变量 |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
int k=1; |
|
|
|
|
|
public BPA_GOODSRECIPE GetSelectItemFromValue() |
|
|
|
|
|
{ |
|
|
|
|
|
BPA_GOODSRECIPE pf=new BPA_GOODSRECIPE(); |
|
|
|
|
|
pf.processms="测试物料"; |
|
|
|
|
|
pf.sort=k; |
|
|
|
|
|
k++; |
|
|
|
|
|
return pf; |
|
|
|
|
|
} |
|
|
private void initTopBar() { |
|
|
private void initTopBar() { |
|
|
mTopBar.setTitle("DIY模式"); |
|
|
mTopBar.setTitle("DIY模式"); |
|
|
mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { |
|
|
mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() { |
|
@@ -143,7 +169,10 @@ public class DiyActivity extends BaseActivity { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
//获取图片存放到list中 |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取图片存放到list中 |
|
|
|
|
|
* @param arrayList |
|
|
|
|
|
*/ |
|
|
private void Drawable_Get(List arrayList) { |
|
|
private void Drawable_Get(List arrayList) { |
|
|
//从drawable文件夹下获取到事先准备的图片,在这里演示三张图片 |
|
|
//从drawable文件夹下获取到事先准备的图片,在这里演示三张图片 |
|
|
Drawable drawable = getResources().getDrawable(R.mipmap.hgr); |
|
|
Drawable drawable = getResources().getDrawable(R.mipmap.hgr); |
|
@@ -156,13 +185,15 @@ public class DiyActivity extends BaseActivity { |
|
|
//调用轮播图设置方法 |
|
|
//调用轮播图设置方法 |
|
|
Banner_Set(Banner_list); |
|
|
Banner_Set(Banner_list); |
|
|
} |
|
|
} |
|
|
//将图片存放到轮播图中 |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 将图片存放到轮播图中 |
|
|
|
|
|
* @param arrayList |
|
|
|
|
|
*/ |
|
|
private void Banner_Set(List arrayList) { |
|
|
private void Banner_Set(List arrayList) { |
|
|
//这是设置轮播图的关键位置,setImages(list) 设置轮播图的图片资源 |
|
|
//这是设置轮播图的关键位置,setImages(list) 设置轮播图的图片资源 |
|
|
//setImageLoader(一个实体类)用于加载图片到手机页面上显示 |
|
|
//setImageLoader(一个实体类)用于加载图片到手机页面上显示 |
|
|
Banner_Main.setImages(Banner_list).setImageLoader(new MyImage()).start(); |
|
|
Banner_Main.setImages(Banner_list).setImageLoader(new MyImage()).start(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 点击事件 |
|
|
* 点击事件 |
|
|
* @param view |
|
|
* @param view |
|
@@ -171,7 +202,8 @@ public class DiyActivity extends BaseActivity { |
|
|
public void onViewClicked(View view) { |
|
|
public void onViewClicked(View view) { |
|
|
switch (view.getId()) { |
|
|
switch (view.getId()) { |
|
|
case R.id.add_hrgx://添加工序 |
|
|
case R.id.add_hrgx://添加工序 |
|
|
|
|
|
|
|
|
|
|
|
bpa_goodsrecipes.add(GetSelectItemFromValue()); |
|
|
|
|
|
gxbz_adapter.notifyDataSetChanged(); |
|
|
ToastUtils.info("添加工序"); |
|
|
ToastUtils.info("添加工序"); |
|
|
break; |
|
|
break; |
|
|
case R.id.update_gx://修改工序 |
|
|
case R.id.update_gx://修改工序 |
|
@@ -179,7 +211,9 @@ public class DiyActivity extends BaseActivity { |
|
|
ToastUtils.info("修改工序"); |
|
|
ToastUtils.info("修改工序"); |
|
|
break; |
|
|
break; |
|
|
case R.id.delete_gx://删除工序 |
|
|
case R.id.delete_gx://删除工序 |
|
|
|
|
|
|
|
|
|
|
|
BPA_GOODSRECIPE obj= (BPA_GOODSRECIPE)datatab_gxbz.getSelectedItem(); |
|
|
|
|
|
bpa_goodsrecipes.remove(obj); |
|
|
|
|
|
gxbz_adapter.notifyDataSetChanged(); |
|
|
ToastUtils.info("删除工序"); |
|
|
ToastUtils.info("删除工序"); |
|
|
break; |
|
|
break; |
|
|
case R.id.shangyi://上移 |
|
|
case R.id.shangyi://上移 |
|
@@ -209,4 +243,17 @@ public class DiyActivity extends BaseActivity { |
|
|
protected boolean canDragBack() { |
|
|
protected boolean canDragBack() { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void clickListener(View v, Object data) { |
|
|
|
|
|
switch (v.getId()) { |
|
|
|
|
|
case R.id.text://步骤行点击 |
|
|
|
|
|
BPA_GOODSRECIPE pf=(BPA_GOODSRECIPE)data; |
|
|
|
|
|
ToastUtils.info("步骤行点击,"+pf.processms); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
@Override |
|
|
|
|
|
public void clickListenerNew(View v, int k, Object data) { |
|
|
|
|
|
} |
|
|
} |
|
|
} |