| | |
| | | gridDo.setKeyStatus(bean.getKeyStatus()); |
| | | gridDo.setWorkingStatus(bean.getWorkingStatus()); |
| | | updateList.add(gridDo); |
| | | oldMap.remove(key); |
| | | }else { |
| | | //新增 |
| | | CabinetGridDo gridDo = new CabinetGridDo(); |
| | |
| | | addList.add(gridDo); |
| | | } |
| | | } |
| | | if(oldMap.size()>0) { |
| | | CabinetGridDo[] dels = new CabinetGridDo[oldMap.size()]; |
| | | int i=0; |
| | | for (String key : oldMap.keySet()) { |
| | | dels[i] = oldMap.get(key); |
| | | i++; |
| | | } |
| | | //删除多的 |
| | | DaoManager.getCabinetGridDao().delete(dels); |
| | | } |
| | | if(addList.size()>0){ |
| | | DaoManager.getCabinetGridDao().insert(addList); |
| | | } |
| | | |
| | | //todo 去掉 |
| | | CabinetGridDo gridDo = oldMap.get("0101"); |
| | | if(gridDo!=null){ |
| | | EventBus.getDefault().post(new HttpEvent(StringUtil.DateToStrSS(new Date())+"=================>更新数据当前钥匙1:"+gridDo.getCurKeyCode())); |
| | | } |
| | | |
| | | if(updateList.size()>0){ |
| | | CabinetGridDo[] upList = new CabinetGridDo[updateList.size()]; |
| | | for(int i=0;i<updateList.size();i++){ |
| | |
| | | return DaoManager.getCabinetGridDao().getOpenGrids(); |
| | | } |
| | | |
| | | public void insertGrids(List<CabinetGridDo> addList){ |
| | | if(addList.size()>0){ |
| | | DaoManager.getCabinetGridDao().insert(addList); |
| | | } |
| | | addInfo("更新库数据:新增" + addList.size()); |
| | | } |
| | | |
| | | public void updateGrids(List<CabinetGridDo> updateList){ |
| | | if(updateList.size()>0){ |
| | | CabinetGridDo[] upList = new CabinetGridDo[updateList.size()]; |
| | |
| | | |
| | | public void addInfo(String info){ |
| | | String s = infoObs.get(); |
| | | s+=info+"\n"; |
| | | s=info+"\n"+s; |
| | | infoObs.set(s); |
| | | } |
| | | } |