Browse Source

新增出库单页面明细增加选中状态,增加保存按钮参数

ChengJH 3 years ago
parent
commit
ecc39968d7

+ 61 - 2
app/src/main/java/com/uas/uas_mes_zb_p/fragment/OutboundListAdd_Fragment.java

@@ -234,7 +234,7 @@ public class OutboundListAdd_Fragment extends BaseFragment implements OnColumnIt
                     @Override
                     public int getBackGroundColor(CellInfo cellInfo) {
                         if (cellInfo.row % 2 == 0) {
-                            return ContextCompat.getColor(mActivity, R.color.blue_50);
+                            return ContextCompat.getColor(mActivity, R.color.white);
                         }
                         return TableConfig.INVALID_COLOR;
                     }
@@ -296,9 +296,15 @@ public class OutboundListAdd_Fragment extends BaseFragment implements OnColumnIt
      * @param data
      */
     private void getDatalistCodes(String data) {
+        String positionid = SharedPreUtil.getString(mActivity, "pd_pdnoid", null);
+        if (!mFilterStorageInBeans.isEmpty()){
+            if (StringUtil.isEmpty(positionid)){
+                CommonUtil.toastNoRepeat(mActivity,"请先选择明细");
+                return;
+            }
+        }
         progressDialog.show();
 
-
         String ifcancel;
         if (add_checkbos.isChecked()==true){
 
@@ -360,6 +366,7 @@ public class OutboundListAdd_Fragment extends BaseFragment implements OnColumnIt
      * 弹框保存按钮
      */
     private void getDialogDatalistCodes(String data,String number) {
+        String positionid = SharedPreUtil.getString(mActivity, "pd_pdnoid", null);
         progressDialog.show();
         String out_editorcodes = SharedPreUtil.getString(mActivity, "out_editorcodes", null);
         String ifcancel;
@@ -382,6 +389,7 @@ public class OutboundListAdd_Fragment extends BaseFragment implements OnColumnIt
                 .addParam("pi_id", string_va_id)
                 .addParam("ifcancel",ifcancel)//是否勾选了取消采集
                 .addParam("remain",number)//手动输入的数
+                .addParam("pd_pdno",positionid)//明细序号
                 .addParam("em_code",ed_picking_code.getText().toString().trim())//界面领料人code
                 .build(), new HttpCallback() {
             @Override
@@ -801,12 +809,16 @@ public class OutboundListAdd_Fragment extends BaseFragment implements OnColumnIt
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         EventBus.getDefault().post(new MessageOutboundEvents("提交单据后刷新列表"));
+        SharedPreUtil.removeString(mActivity,"positionid");
+        SharedPreUtil.removeString(mActivity,"pd_pdnoid");
         return false;
     }
 
     @Override
     public boolean onFragmentBackPressed() {
         EventBus.getDefault().post(new MessageOutboundEvents("提交单据后刷新列表"));
+        SharedPreUtil.removeString(mActivity,"positionid");
+        SharedPreUtil.removeString(mActivity,"pd_pdnoid");
         return false;
     }
 
@@ -849,8 +861,55 @@ public class OutboundListAdd_Fragment extends BaseFragment implements OnColumnIt
             }
         }
 
+        private boolean ischeck=false;
         @Override
         public void onClick (Column < String > column, String value, String s,int position){
+            String pd_pdno = mFilterStorageInBeans.get(position).getPD_PDNO();
+            String positionid = SharedPreUtil.getString(mActivity, "positionid", null);
+            if (!StringUtil.isEmpty(positionid) && positionid.equals(position+"")){
+                SharedPreUtil.removeString(mActivity,"positionid");
+                SharedPreUtil.removeString(mActivity,"pd_pdnoid");
+                mSmartTable.getConfig()
+                        .setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() {
+                            @Override
+                            public int getBackGroundColor(CellInfo cellInfo) {
+                                int row = cellInfo.row;
+                                if (cellInfo.row  == position) {
+                                    ischeck=false;
+                                    if (ischeck==false){
+                                        return ContextCompat.getColor(mActivity, R.color.white);
+                                    }
+                                }
+                                return TableConfig.INVALID_COLOR;
+                            }
+                        });
+            }else {
+                SharedPreUtil.saveString(mActivity,"positionid",position+"");
+                SharedPreUtil.saveString(mActivity,"pd_pdnoid",pd_pdno+"");
+
+                mSmartTable.getConfig()
+                        .setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() {
+                            @Override
+                            public int getBackGroundColor(CellInfo cellInfo) {
+                                int row = cellInfo.row;
+                                if (cellInfo.row  == position) {
+                                    ischeck=false;
+                                    if (ischeck==false){
+                                        return ContextCompat.getColor(mActivity, R.color.search_gray);
+                                    }
+
+                                }
+                                return TableConfig.INVALID_COLOR;
+                            }
+                        });
+            }
+
+                mSmartTable.postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        mSmartTable.postInvalidate();
+                    }
+                }, 100);
 
         }
     @Override